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>21 Jan 2011</date>
16 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
17 <authorinitials>EM</authorinitials>
18 <revhistory><revision>
19 <revnumber>4.74</revnumber>
20 <date>21 Jan 2011</date>
21 <authorinitials>EM</authorinitials>
22 </revision></revhistory>
23 <copyright><year>2011</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.74 of Exim.
202 Substantive changes from the 4.72 edition are marked in some
203 renditions of the document; this paragraph is so marked if the rendition is
204 capable of showing a change indicator.
207 This document is very much a reference manual; it is not a tutorial. The reader
208 is expected to have some familiarity with the SMTP mail transfer protocol and
209 with general Unix system administration. Although there are some discussions
210 and examples in places, the information is mostly organized in a way that makes
211 it easy to look up, rather than in a natural order for sequential reading.
212 Furthermore, the manual aims to cover every aspect of Exim in detail, including
213 a number of rarely-used, special-purpose features that are unlikely to be of
217 <indexterm role="concept">
218 <primary>books about Exim</primary>
220 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
221 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
222 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
223 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
226 This book also contains a chapter that gives a general introduction to SMTP and
227 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
228 with the latest release of Exim. (Note that the earlier book about Exim,
229 published by O’Reilly, covers Exim 3, and many things have changed in Exim 4.)
232 <indexterm role="concept">
233 <primary>Debian</primary>
234 <secondary>information sources</secondary>
236 If you are using a Debian distribution of Exim, you will find information about
237 Debian-specific features in the file
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
239 The command <command>man update-exim.conf</command> is another source of Debian-specific
243 <indexterm role="concept">
244 <primary><filename>doc/NewStuff</filename></primary>
246 <indexterm role="concept">
247 <primary><filename>doc/ChangeLog</filename></primary>
249 <indexterm role="concept">
250 <primary>change log</primary>
252 As the program develops, there may be features in newer versions that have not
253 yet made it into this document, which is updated only when the most significant
254 digit of the fractional part of the version number changes. Specifications of
255 new features that are not yet in this manual are placed in the file
256 <filename>doc/NewStuff</filename> in the Exim distribution.
259 Some features may be classified as <quote>experimental</quote>. These may change
260 incompatibly while they are developing, or even be withdrawn. For this reason,
261 they are not documented in this manual. Information about experimental features
262 can be found in the file <filename>doc/experimental.txt</filename>.
265 All changes to the program (whether new features, bug fixes, or other kinds of
266 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
269 <indexterm role="concept">
270 <primary><filename>doc/spec.txt</filename></primary>
272 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
273 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
276 <informaltable frame="none">
277 <tgroup cols="2" colsep="0" rowsep="0">
278 <colspec colwidth="100pt" align="left"/>
279 <colspec colwidth="254pt" align="left"/>
282 <entry><filename>OptionLists.txt</filename></entry>
283 <entry>list of all options in alphabetical order</entry>
286 <entry><filename>dbm.discuss.txt</filename></entry>
287 <entry>discussion about DBM libraries</entry>
290 <entry><filename>exim.8</filename></entry>
291 <entry>a man page of Exim’s command line options</entry>
294 <entry><filename>experimental.txt</filename></entry>
295 <entry>documentation of experimental features</entry>
298 <entry><filename>filter.txt</filename></entry>
299 <entry>specification of the filter language</entry>
302 <entry><filename>Exim3.upgrade</filename></entry>
303 <entry>upgrade notes from release 2 to release 3</entry>
306 <entry><filename>Exim4.upgrade</filename></entry>
307 <entry>upgrade notes from release 3 to release 4</entry>
313 The main specification and the specification of the filtering language are also
314 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
315 <xref linkend="SECTavail"/> below tells you how to get hold of these.
318 <section id="SECID2">
319 <title>FTP and web sites</title>
321 <indexterm role="concept">
322 <primary>web site</primary>
324 <indexterm role="concept">
325 <primary>FTP site</primary>
327 The primary site for Exim source distributions is currently the University of
328 Cambridge’s FTP site, whose contents are described in <emphasis>Where to find the Exim
329 distribution</emphasis> below. In addition, there is a web site and an FTP site at
330 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
331 <option>exim.org</option> site was previously hosted for a number of years by Energis
332 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
335 <indexterm role="concept">
336 <primary>wiki</primary>
338 <indexterm role="concept">
339 <primary>FAQ</primary>
341 As well as Exim distribution tar files, the Exim web site contains a number of
342 differently formatted versions of the documentation. A recent addition to the
343 online information is the Exim wiki (<emphasis role="bold"><ulink url="http://wiki.exim.org">http://wiki.exim.org</ulink></emphasis>),
344 which contains what used to be a separate FAQ, as well as various other
345 examples, tips, and know-how that have been contributed by Exim users.
348 <indexterm role="concept">
349 <primary>Bugzilla</primary>
351 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>. You can use
352 this to report bugs, and also to add items to the wish list. Please search
353 first to check that you are not duplicating a previous entry.
356 <section id="SECID3">
357 <title>Mailing lists</title>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
363 The following Exim mailing lists exist:
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
371 <entry><emphasis>exim-users@exim.org</emphasis></entry>
372 <entry>General discussion list</entry>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>Discussion of bugs, enhancements, etc.</entry>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>Moderated, low volume announcements list</entry>
383 <entry><emphasis>exim-future@exim.org</emphasis></entry>
384 <entry>Discussion of long-term development</entry>
390 You can subscribe to these lists, change your existing subscriptions, and view
391 or search the archives via the mailing lists link on the Exim home page.
392 <indexterm role="concept">
393 <primary>Debian</primary>
394 <secondary>mailing list for</secondary>
396 If you are using a Debian distribution of Exim, you may wish to subscribe to
397 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
401 <emphasis role="bold"><ulink url="http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users">http://lists.alioth.debian.org/mailman/listinfo/pkg-exim4-users</ulink></emphasis>
404 Please ask Debian-specific questions on this list and not on the general Exim
408 <section id="SECID4">
409 <title>Exim training</title>
411 <indexterm role="concept">
412 <primary>training courses</primary>
414 Training courses in Cambridge (UK) used to be run annually by the author of
415 Exim, before he retired. At the time of writing, there are no plans to run
416 further Exim courses in Cambridge. However, if that changes, relevant
417 information will be posted at <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
420 <section id="SECID5">
421 <title>Bug reports</title>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
429 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="http://bugs.exim.org">http://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
441 <indexterm role="concept">
442 <primary>distribution</primary>
443 <secondary>ftp site</secondary>
445 The master ftp site for the Exim distribution is
448 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
454 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
457 The file references that follow are relative to the <filename>exim</filename> directories at
458 these sites. There are now quite a number of independent mirror sites around
459 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
462 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
463 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
464 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
465 subdirectory, the current release can always be found in files called
468 <filename>exim-n.nn.tar.gz</filename>
469 <filename>exim-n.nn.tar.bz2</filename>
472 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
473 files contain identical data; the only difference is the type of compression.
474 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
477 <indexterm role="concept">
478 <primary>distribution</primary>
479 <secondary>signing details</secondary>
481 <indexterm role="concept">
482 <primary>distribution</primary>
483 <secondary>public key</secondary>
485 <indexterm role="concept">
486 <primary>public key for signed distribution</primary>
488 The distributions are currently signed with Nigel Metheringham’s GPG key. The
489 corresponding public key is available from a number of keyservers, and there is
490 also a copy in the file <filename>nigel-pubkey.asc</filename>. The signatures for the tar bundles are
494 <filename>exim-n.nn.tar.gz.asc</filename>
495 <filename>exim-n.nn.tar.bz2.asc</filename>
498 For each released version, the log of changes is made separately available in a
499 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
500 find out what has changed without having to download the entire distribution.
503 <indexterm role="concept">
504 <primary>documentation</primary>
505 <secondary>available formats</secondary>
507 The main distribution contains ASCII versions of this specification and other
508 documentation; other formats of the documents are available in separate files
509 inside the <filename>exim4</filename> directory of the FTP site:
512 <filename>exim-html-n.nn.tar.gz</filename>
513 <filename>exim-pdf-n.nn.tar.gz</filename>
514 <filename>exim-postscript-n.nn.tar.gz</filename>
515 <filename>exim-texinfo-n.nn.tar.gz</filename>
518 These tar files contain only the <filename>doc</filename> directory, not the complete
519 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
522 <section id="SECID6">
523 <title>Limitations</title>
527 <indexterm role="concept">
528 <primary>limitations of Exim</primary>
530 <indexterm role="concept">
531 <primary>bang paths</primary>
532 <secondary>not handled by Exim</secondary>
534 Exim is designed for use as an Internet MTA, and therefore handles addresses in
535 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
536 simple two-component bang paths can be converted by a straightforward rewriting
537 configuration. This restriction does not prevent Exim from being interfaced to
538 UUCP as a transport mechanism, provided that domain addresses are used.
543 <indexterm role="concept">
544 <primary>domainless addresses</primary>
546 <indexterm role="concept">
547 <primary>address</primary>
548 <secondary>without domain</secondary>
550 Exim insists that every address it handles has a domain attached. For incoming
551 local messages, domainless addresses are automatically qualified with a
552 configured domain value. Configuration options specify from which remote
553 systems unqualified addresses are acceptable. These are then qualified on
559 <indexterm role="concept">
560 <primary>transport</primary>
561 <secondary>external</secondary>
563 <indexterm role="concept">
564 <primary>external transports</primary>
566 The only external transport mechanisms that are currently implemented are SMTP
567 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
568 transport is available, and there are facilities for writing messages to files
569 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
570 to send messages to other transport mechanisms such as UUCP, provided they can
571 handle domain-style addresses. Batched SMTP input is also catered for.
576 Exim is not designed for storing mail for dial-in hosts. When the volumes of
577 such mail are large, it is better to get the messages <quote>delivered</quote> into files
578 (that is, off Exim’s queue) and subsequently passed on to the dial-in hosts by
584 Although Exim does have basic facilities for scanning incoming messages, these
585 are not comprehensive enough to do full virus or spam scanning. Such operations
586 are best carried out using additional specialized software packages. If you
587 compile Exim with the content-scanning extension, straightforward interfaces to
588 a number of common scanners are provided.
593 <section id="SECID7">
594 <title>Run time configuration</title>
596 Exim’s run time configuration is held in a single text file that is divided
597 into a number of sections. The entries in this file consist of keywords and
598 values, in the style of Smail 3 configuration files. A default configuration
599 file which is suitable for simple online installations is provided in the
600 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
603 <section id="SECID8">
604 <title>Calling interface</title>
606 <indexterm role="concept">
607 <primary>Sendmail compatibility</primary>
608 <secondary>command line interface</secondary>
610 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
611 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
612 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
613 about Sendmail in order to run Exim. For actions other than sending messages,
614 Sendmail-compatible options also exist, but those that produce output (for
615 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim’s own
616 format. There are also some additional options that are compatible with Smail
617 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
618 documents all Exim’s command line options. This information is automatically
619 made into the man page that forms part of the Exim distribution.
622 Control of messages on the queue can be done via certain privileged command
623 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
624 which displays current information in an X window, and which contains a menu
625 interface to Exim’s command line administration options.
628 <section id="SECID9">
629 <title>Terminology</title>
631 <indexterm role="concept">
632 <primary>terminology definitions</primary>
634 <indexterm role="concept">
635 <primary>body of message</primary>
636 <secondary>definition of</secondary>
638 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
639 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
640 below) by a blank line.
643 <indexterm role="concept">
644 <primary>bounce message</primary>
645 <secondary>definition of</secondary>
647 When a message cannot be delivered, it is normally returned to the sender in a
648 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
649 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
650 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
651 failure error report</quote>. Such messages have an empty sender address in the
652 message’s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
653 rise to further bounce messages.
656 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
657 value which is used in the absence of any setting in the configuration. It may
658 also qualify an action which is taken unless a configuration setting specifies
662 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
663 destination cannot immediately take place for some reason (a remote host may be
664 down, or a user’s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
668 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
669 host’s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
670 the part of an email address following the @ sign.
673 <indexterm role="concept">
674 <primary>envelope, definition of</primary>
676 <indexterm role="concept">
677 <primary>sender</primary>
678 <secondary>definition of</secondary>
680 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
681 body. The envelope contains a sender address (to which bounce messages should
682 be delivered), and any number of recipient addresses. References to the
683 sender or the recipients of a message usually mean the addresses in the
684 envelope. An MTA uses these addresses for delivery, and for returning bounce
685 messages, not the addresses that appear in the header lines.
688 <indexterm role="concept">
689 <primary>message</primary>
690 <secondary>header, definition of</secondary>
692 <indexterm role="concept">
693 <primary>header section</primary>
694 <secondary>definition of</secondary>
696 The <emphasis>header</emphasis> of a message is the first part of a message’s text, consisting
697 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
698 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
699 indenting the continuations. The header is separated from the body by a blank
703 <indexterm role="concept">
704 <primary>local part</primary>
705 <secondary>definition of</secondary>
707 <indexterm role="concept">
708 <primary>domain</primary>
709 <secondary>definition of</secondary>
711 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
712 part of an email address that precedes the @ sign. The part that follows the
713 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
716 <indexterm role="concept">
717 <primary>local delivery</primary>
718 <secondary>definition of</secondary>
720 <indexterm role="concept">
721 <primary>remote delivery, definition of</primary>
723 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
724 delivery to a file or a pipe on the local host from delivery by SMTP over
725 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
726 host it is running on are <emphasis>remote</emphasis>.
729 <indexterm role="concept">
730 <primary>return path</primary>
731 <secondary>definition of</secondary>
733 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
734 message’s envelope.
737 <indexterm role="concept">
738 <primary>queue</primary>
739 <secondary>definition of</secondary>
741 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
742 because this term is in widespread use in the context of MTAs. However, in
743 Exim’s case the reality is more like a pool than a queue, because there is
744 normally no ordering of waiting messages.
747 <indexterm role="concept">
748 <primary>queue runner</primary>
749 <secondary>definition of</secondary>
751 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
752 and attempts to deliver those messages whose retry times have come. This term
753 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
754 the waiting messages are normally processed in an unpredictable order.
757 <indexterm role="concept">
758 <primary>spool directory</primary>
759 <secondary>definition of</secondary>
761 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
762 messages on its queue – that is, those that it is in the process of
763 delivering. This should not be confused with the directory in which local
764 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
765 the Exim documentation, <quote>spool</quote> is always used in the first sense.
771 <title>Incorporated code</title>
773 <indexterm role="concept">
774 <primary>incorporated code</primary>
776 <indexterm role="concept">
777 <primary>regular expressions</primary>
778 <secondary>library</secondary>
780 <indexterm role="concept">
781 <primary>PCRE</primary>
783 A number of pieces of external code are included in the Exim distribution.
788 Regular expressions are supported in the main Exim program and in the
789 Exim monitor using the freely-distributable PCRE library, copyright
790 © University of Cambridge. The source to PCRE is no longer shipped with
791 Exim, so you will need to use the version of PCRE shipped with your system,
792 or obtain and install the full version of the library from
793 <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
798 <indexterm role="concept">
799 <primary>cdb</primary>
800 <secondary>acknowledgment</secondary>
802 Support for the cdb (Constant DataBase) lookup method is provided by code
803 contributed by Nigel Metheringham of (at the time he contributed it) Planet
804 Online Ltd. The implementation is completely contained within the code of Exim.
805 It does not link against an external cdb library. The code contains the
806 following statements:
810 Copyright © 1998 Nigel Metheringham, Planet Online Ltd
813 This program is free software; you can redistribute it and/or modify it under
814 the terms of the GNU General Public License as published by the Free Software
815 Foundation; either version 2 of the License, or (at your option) any later
817 This code implements Dan Bernstein’s Constant DataBase (cdb) spec. Information,
818 the spec and sample code for cdb can be obtained from
819 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows
820 some code from Dan Bernstein’s implementation (which has no license
821 restrictions applied to it).
827 <indexterm role="concept">
828 <primary>SPA authentication</primary>
830 <indexterm role="concept">
831 <primary>Samba project</primary>
833 <indexterm role="concept">
834 <primary>Microsoft Secure Password Authentication</primary>
836 Client support for Microsoft’s <emphasis>Secure Password Authentication</emphasis> is provided
837 by code contributed by Marc Prud’hommeaux. Server support was contributed by
838 Tom Kistner. This includes code taken from the Samba project, which is released
844 <indexterm role="concept">
845 <primary>Cyrus</primary>
847 <indexterm role="concept">
848 <primary><emphasis>pwcheck</emphasis> daemon</primary>
850 <indexterm role="concept">
851 <primary><emphasis>pwauthd</emphasis> daemon</primary>
853 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
854 by code taken from the Cyrus-SASL library and adapted by Alexander S.
855 Sabourenkov. The permission notice appears below, in accordance with the
856 conditions expressed therein.
860 Copyright © 2001 Carnegie Mellon University. All rights reserved.
863 Redistribution and use in source and binary forms, with or without
864 modification, are permitted provided that the following conditions
867 <orderedlist numeration="arabic">
870 Redistributions of source code must retain the above copyright
871 notice, this list of conditions and the following disclaimer.
876 Redistributions in binary form must reproduce the above copyright
877 notice, this list of conditions and the following disclaimer in
878 the documentation and/or other materials provided with the
884 The name <quote>Carnegie Mellon University</quote> must not be used to
885 endorse or promote products derived from this software without
886 prior written permission. For permission or any other legal
887 details, please contact
890 Office of Technology Transfer
891 Carnegie Mellon University
893 Pittsburgh, PA 15213-3890
894 (412) 268-4387, fax: (412) 268-7395
895 tech-transfer@andrew.cmu.edu
900 Redistributions of any form whatsoever must retain the following
904 <quote>This product includes software developed by Computing Services
905 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
908 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
909 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
910 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
911 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
912 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
913 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
914 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
922 <indexterm role="concept">
923 <primary>Exim monitor</primary>
924 <secondary>acknowledgment</secondary>
926 <indexterm role="concept">
927 <primary>X-windows</primary>
929 <indexterm role="concept">
930 <primary>Athena</primary>
932 The Exim Monitor program, which is an X-Window application, includes
933 modified versions of the Athena StripChart and TextPop widgets.
934 This code is copyright by DEC and MIT, and their permission notice appears
935 below, in accordance with the conditions expressed therein.
939 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
940 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
946 Permission to use, copy, modify, and distribute this software and its
947 documentation for any purpose and without fee is hereby granted,
948 provided that the above copyright notice appear in all copies and that
949 both that copyright notice and this permission notice appear in
950 supporting documentation, and that the names of Digital or MIT not be
951 used in advertising or publicity pertaining to distribution of the
952 software without specific, written prior permission.
955 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
956 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
957 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
958 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
959 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
960 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
967 Many people have contributed code fragments, some large, some small, that were
968 not covered by any specific licence requirements. It is assumed that the
969 contributors are happy to see their code incorporated into Exim under the GPL.
975 <chapter id="CHID11">
976 <title>How Exim receives and delivers mail</title>
977 <titleabbrev>Receiving and delivering mail</titleabbrev>
978 <section id="SECID10">
979 <title>Overall philosophy</title>
981 <indexterm role="concept">
982 <primary>design philosophy</primary>
984 Exim is designed to work efficiently on systems that are permanently connected
985 to the Internet and are handling a general mix of mail. In such circumstances,
986 most messages can be delivered immediately. Consequently, Exim does not
987 maintain independent queues of messages for specific domains or hosts, though
988 it does try to send several messages in a single SMTP connection after a host
989 has been down, and it also maintains per-host retry information.
992 <section id="SECID11">
993 <title>Policy control</title>
995 <indexterm role="concept">
996 <primary>policy control</primary>
997 <secondary>overview</secondary>
999 Policy controls are now an important feature of MTAs that are connected to the
1000 Internet. Perhaps their most important job is to stop MTAs being abused as
1001 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1002 unsolicited junk, and want to disguise its source. Exim provides flexible
1003 facilities for specifying policy controls on incoming mail:
1008 <indexterm role="concept">
1009 <primary>access control lists (ACLs)</primary>
1010 <secondary>introduction</secondary>
1012 Exim 4 (unlike previous versions of Exim) implements policy controls on
1013 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1014 series of statements that may either grant or deny access. ACLs can be used at
1015 several places in the SMTP dialogue while receiving a message from a remote
1016 host. However, the most common places are after each RCPT command, and at the
1017 very end of the message. The sysadmin can specify conditions for accepting or
1018 rejecting individual recipients or the entire message, respectively, at these
1019 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1025 An ACL is also available for locally generated, non-SMTP messages. In this
1026 case, the only available actions are to accept or deny the entire message.
1031 When Exim is compiled with the content-scanning extension, facilities are
1032 provided in the ACL mechanism for passing the message to external virus and/or
1033 spam scanning software. The result of such a scan is passed back to the ACL,
1034 which can then use it to decide what to do with the message.
1039 When a message has been received, either from a remote host or from the local
1040 host, but before the final acknowledgment has been sent, a locally supplied C
1041 function called <function>local_scan()</function> can be run to inspect the message and decide
1042 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1043 is accepted, the list of recipients can be modified by the function.
1048 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1049 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1050 Exim to be compiled with the content-scanning extension.
1055 After a message has been accepted, a further checking mechanism is available in
1056 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1057 runs at the start of every delivery process.
1062 <section id="SECID12">
1063 <title>User filters</title>
1065 <indexterm role="concept">
1066 <primary>filter</primary>
1067 <secondary>introduction</secondary>
1069 <indexterm role="concept">
1070 <primary>Sieve filter</primary>
1072 In a conventional Exim configuration, users are able to run private filters by
1073 setting up appropriate <filename>.forward</filename> files in their home directories. See
1074 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1075 configuration needed to support this, and the separate document entitled
1076 <emphasis>Exim’s interfaces to mail filtering</emphasis> for user details. Two different kinds
1077 of filtering are available:
1082 Sieve filters are written in the standard filtering language that is defined
1088 Exim filters are written in a syntax that is unique to Exim, but which is more
1089 powerful than Sieve, which it pre-dates.
1094 User filters are run as part of the routing process, described below.
1097 <section id="SECTmessiden">
1098 <title>Message identification</title>
1100 <indexterm role="concept">
1101 <primary>message ids</primary>
1102 <secondary>details of format</secondary>
1104 <indexterm role="concept">
1105 <primary>format</primary>
1106 <secondary>of message id</secondary>
1108 <indexterm role="concept">
1109 <primary>id of message</primary>
1111 <indexterm role="concept">
1112 <primary>base62</primary>
1114 <indexterm role="concept">
1115 <primary>base36</primary>
1117 <indexterm role="concept">
1118 <primary>Darwin</primary>
1120 <indexterm role="concept">
1121 <primary>Cygwin</primary>
1123 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1124 characters long. It is divided into three parts, separated by hyphens, for
1125 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1126 normally encoding numbers in base 62. However, in the Darwin operating
1127 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1128 (avoiding the use of lower case letters) is used instead, because the message
1129 id is used to construct file names, and the names of files in those systems are
1130 not always case-sensitive.
1133 <indexterm role="concept">
1134 <primary>pid (process id)</primary>
1135 <secondary>re-use of</secondary>
1137 The detail of the contents of the message id have changed as Exim has evolved.
1138 Earlier versions relied on the operating system not re-using a process id (pid)
1139 within one second. On modern operating systems, this assumption can no longer
1140 be made, so the algorithm had to be changed. To retain backward compatibility,
1141 the format of the message id was retained, which is why the following rules are
1147 The first six characters of the message id are the time at which the message
1148 started to be received, to a granularity of one second. That is, this field
1149 contains the number of seconds since the start of the epoch (the normal Unix
1150 way of representing the date and time of day).
1155 After the first hyphen, the next six characters are the id of the process that
1156 received the message.
1161 There are two different possibilities for the final two characters:
1163 <orderedlist numeration="arabic">
1166 <indexterm role="option">
1167 <primary><option>localhost_number</option></primary>
1169 If <option>localhost_number</option> is not set, this value is the fractional part of the
1170 time of reception, normally in units of 1/2000 of a second, but for systems
1171 that must use base 36 instead of base 62 (because of case-insensitive file
1172 systems), the units are 1/1000 of a second.
1177 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1178 the fractional part of the time, which in this case is in units of 1/200
1179 (1/100) of a second.
1186 After a message has been received, Exim waits for the clock to tick at the
1187 appropriate resolution before proceeding, so that if another message is
1188 received by the same process, or by another process with the same (re-used)
1189 pid, it is guaranteed that the time will be different. In most cases, the clock
1190 will already have ticked while the message was being received.
1193 <section id="SECID13">
1194 <title>Receiving mail</title>
1196 <indexterm role="concept">
1197 <primary>receiving mail</primary>
1199 <indexterm role="concept">
1200 <primary>message</primary>
1201 <secondary>reception</secondary>
1203 The only way Exim can receive mail from another host is using SMTP over
1204 TCP/IP, in which case the sender and recipient addresses are transferred using
1205 SMTP commands. However, from a locally running process (such as a user’s MUA),
1206 there are several possibilities:
1211 If the process runs Exim with the <option>-bm</option> option, the message is read
1212 non-interactively (usually via a pipe), with the recipients taken from the
1213 command line, or from the body of the message if <option>-t</option> is also used.
1218 If the process runs Exim with the <option>-bS</option> option, the message is also read
1219 non-interactively, but in this case the recipients are listed at the start of
1220 the message in a series of SMTP RCPT commands, terminated by a DATA
1221 command. This is so-called <quote>batch SMTP</quote> format,
1222 but it isn’t really SMTP. The SMTP commands are just another way of passing
1223 envelope addresses in a non-interactive submission.
1228 If the process runs Exim with the <option>-bs</option> option, the message is read
1229 interactively, using the SMTP protocol. A two-way pipe is normally used for
1230 passing data between the local process and the Exim process.
1231 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1232 example, the ACLs for SMTP commands are used for this form of submission.
1237 A local process may also make a TCP/IP call to the host’s loopback address
1238 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1239 does not treat the loopback address specially. It treats all such connections
1240 in the same way as connections from other hosts.
1245 <indexterm role="concept">
1246 <primary>message sender, constructed by Exim</primary>
1248 <indexterm role="concept">
1249 <primary>sender</primary>
1250 <secondary>constructed by Exim</secondary>
1252 In the three cases that do not involve TCP/IP, the sender address is
1253 constructed from the login name of the user that called Exim and a default
1254 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1255 option). For local or batch SMTP, a sender address that is passed using the
1256 SMTP MAIL command is ignored. However, the system administrator may allow
1257 certain users (<quote>trusted users</quote>) to specify a different sender address
1258 unconditionally, or all users to specify certain forms of different sender
1259 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1260 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1261 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1262 users to change sender addresses.
1265 Messages received by either of the non-interactive mechanisms are subject to
1266 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1267 (either over TCP/IP, or interacting with a local process) can be checked by a
1268 number of ACLs that operate at different times during the SMTP session. Either
1269 individual recipients, or the entire message, can be rejected if local policy
1270 requirements are not met. The <function>local_scan()</function> function (see chapter
1271 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1274 Exim can be configured not to start a delivery process when a message is
1275 received; this can be unconditional, or depend on the number of incoming SMTP
1276 connections or the system load. In these situations, new messages wait on the
1277 queue until a queue runner process picks them up. However, in standard
1278 configurations under normal conditions, delivery is started as soon as a
1279 message is received.
1282 <section id="SECID14">
1283 <title>Handling an incoming message</title>
1285 <indexterm role="concept">
1286 <primary>spool directory</primary>
1287 <secondary>files that hold a message</secondary>
1289 <indexterm role="concept">
1290 <primary>file</primary>
1291 <secondary>how a message is held</secondary>
1293 When Exim accepts a message, it writes two files in its spool directory. The
1294 first contains the envelope information, the current status of the message, and
1295 the header lines, and the second contains the body of the message. The names of
1296 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1297 file containing the envelope and header, and <literal>-D</literal> for the data file.
1300 <indexterm role="concept">
1301 <primary>spool directory</primary>
1302 <secondary><filename>input</filename> sub-directory</secondary>
1304 By default all these message files are held in a single directory called
1305 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1306 not perform very well if the number of files in a directory gets large; to
1307 improve performance in such cases, the <option>split_spool_directory</option> option can be
1308 used. This causes Exim to split up the input files into 62 sub-directories
1309 whose names are single letters or digits. When this is done, the queue is
1310 processed one sub-directory at a time instead of all at once, which can improve
1311 overall performance even when there are not enough files in each directory to
1312 affect file system performance.
1315 The envelope information consists of the address of the message’s sender and
1316 the addresses of the recipients. This information is entirely separate from
1317 any addresses contained in the header lines. The status of the message includes
1318 a list of recipients who have already received the message. The format of the
1319 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1322 <indexterm role="concept">
1323 <primary>rewriting</primary>
1324 <secondary>addresses</secondary>
1326 Address rewriting that is specified in the rewrite section of the configuration
1327 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1328 both in the header lines and the envelope, at the time the message is accepted.
1329 If during the course of delivery additional addresses are generated (for
1330 example, via aliasing), these new addresses are rewritten as soon as they are
1331 generated. At the time a message is actually delivered (transported) further
1332 rewriting can take place; because this is a transport option, it can be
1333 different for different forms of delivery. It is also possible to specify the
1334 addition or removal of certain header lines at the time the message is
1335 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1336 <xref linkend="CHAPtransportgeneric"/>).
1339 <section id="SECID15">
1340 <title>Life of a message</title>
1342 <indexterm role="concept">
1343 <primary>message</primary>
1344 <secondary>life of</secondary>
1346 <indexterm role="concept">
1347 <primary>message</primary>
1348 <secondary>frozen</secondary>
1350 A message remains in the spool directory until it is completely delivered to
1351 its recipients or to an error address, or until it is deleted by an
1352 administrator or by the user who originally created it. In cases when delivery
1353 cannot proceed – for example, when a message can neither be delivered to its
1354 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1355 spool, and no more deliveries are attempted.
1358 <indexterm role="concept">
1359 <primary>frozen messages</primary>
1360 <secondary>thawing</secondary>
1362 <indexterm role="concept">
1363 <primary>message</primary>
1364 <secondary>thawing frozen</secondary>
1366 An administrator can <quote>thaw</quote> such messages when the problem has been
1367 corrected, and can also freeze individual messages by hand if necessary. In
1368 addition, an administrator can force a delivery error, causing a bounce message
1372 <indexterm role="option">
1373 <primary><option>timeout_frozen_after</option></primary>
1375 <indexterm role="option">
1376 <primary><option>ignore_bounce_errors_after</option></primary>
1378 There are options called <option>ignore_bounce_errors_after</option> and
1379 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1380 The first applies only to frozen bounces, the second to any frozen messages.
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>log file for</secondary>
1387 <indexterm role="concept">
1388 <primary>log</primary>
1389 <secondary>file for each message</secondary>
1391 While Exim is working on a message, it writes information about each delivery
1392 attempt to its main log file. This includes successful, unsuccessful, and
1393 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1394 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1395 These logs are solely for the benefit of the administrator, and are normally
1396 deleted along with the spool files when processing of a message is complete.
1397 The use of individual message logs can be disabled by setting
1398 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1402 <indexterm role="concept">
1403 <primary>journal file</primary>
1405 <indexterm role="concept">
1406 <primary>file</primary>
1407 <secondary>journal</secondary>
1409 All the information Exim itself needs to set up a delivery is kept in the first
1410 spool file, along with the header lines. When a successful delivery occurs, the
1411 address is immediately written at the end of a journal file, whose name is the
1412 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1413 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1414 is updated to indicate which these are, and the journal file is then deleted.
1415 Updating the spool file is done by writing a new file and renaming it, to
1416 minimize the possibility of data loss.
1419 Should the system or the program crash after a successful delivery but before
1420 the spool file has been updated, the journal is left lying around. The next
1421 time Exim attempts to deliver the message, it reads the journal file and
1422 updates the spool file before proceeding. This minimizes the chances of double
1423 deliveries caused by crashes.
1426 <section id="SECTprocaddress">
1427 <title>Processing an address for delivery</title>
1429 <indexterm role="concept">
1430 <primary>drivers</primary>
1431 <secondary>definition of</secondary>
1433 <indexterm role="concept">
1434 <primary>router</primary>
1435 <secondary>definition of</secondary>
1437 <indexterm role="concept">
1438 <primary>transport</primary>
1439 <secondary>definition of</secondary>
1441 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1442 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1443 number of them is provided in the source distribution, and compile-time options
1444 specify which ones are included in the binary. Run time options specify which
1445 ones are actually used for delivering messages.
1448 <indexterm role="concept">
1449 <primary>drivers</primary>
1450 <secondary>instance definition</secondary>
1452 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1453 of that particular driver type. Multiple instances are allowed; for example,
1454 you can set up several different <command>smtp</command> transports, each with different
1455 option values that might specify different ports or different timeouts. Each
1456 instance has its own identifying name. In what follows we will normally use the
1457 instance name when discussing one particular instance (that is, one specific
1458 configuration of the driver), and the generic driver name when discussing
1459 the driver’s features in general.
1462 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1463 its delivery should happen, by assigning it to a specific transport, or
1464 converting the address into one or more new addresses (for example, via an
1465 alias file). A router may also explicitly choose to fail an address, causing it
1469 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim’s
1470 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1471 transport, the destination is a file or a pipe on the local host, whereas for a
1472 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1473 to a specific transport as a result of successful routing. If a message has
1474 several recipients, it may be passed to a number of different transports.
1477 <indexterm role="concept">
1478 <primary>preconditions</primary>
1479 <secondary>definition of</secondary>
1481 An address is processed by passing it to each configured router instance in
1482 turn, subject to certain preconditions, until a router accepts the address or
1483 specifies that it should be bounced. We will describe this process in more
1484 detail shortly. First, as a simple example, we consider how each recipient
1485 address in a message is processed in a small configuration of three routers.
1488 To make this a more concrete example, it is described in terms of some actual
1489 routers, but remember, this is only an example. You can configure Exim’s
1490 routers in many different ways, and there may be any number of routers in a
1494 The first router that is specified in a configuration is often one that handles
1495 addresses in domains that are not recognized specially by the local host. These
1496 are typically addresses for arbitrary domains on the Internet. A precondition
1497 is set up which looks for the special domains known to the host (for example,
1498 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1499 match. Typically, this is a router that looks up domains in the DNS in order to
1500 find the hosts to which this address routes. If it succeeds, the address is
1501 assigned to a suitable SMTP transport; if it does not succeed, the router is
1502 configured to fail the address.
1505 The second router is reached only when the domain is recognized as one that
1506 <quote>belongs</quote> to the local host. This router does redirection – also known as
1507 aliasing and forwarding. When it generates one or more new addresses from the
1508 original, each of them is routed independently from the start. Otherwise, the
1509 router may cause an address to fail, or it may simply decline to handle the
1510 address, in which case the address is passed to the next router.
1513 The final router in many configurations is one that checks to see if the
1514 address belongs to a local mailbox. The precondition may involve a check to
1515 see if the local part is the name of a login account, or it may look up the
1516 local part in a file or a database. If its preconditions are not met, or if
1517 the router declines, we have reached the end of the routers. When this happens,
1518 the address is bounced.
1521 <section id="SECID16">
1522 <title>Processing an address for verification</title>
1524 <indexterm role="concept">
1525 <primary>router</primary>
1526 <secondary>for verification</secondary>
1528 <indexterm role="concept">
1529 <primary>verifying address</primary>
1530 <secondary>overview</secondary>
1532 As well as being used to decide how to deliver to an address, Exim’s routers
1533 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1534 one of the checks to be performed in an ACL for incoming messages, on both
1535 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1536 <option>-bvs</option> command line options.
1539 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1540 does not affect the way the routers work, but it is a state that can be
1541 detected. By this means, a router can be skipped or made to behave differently
1542 when verifying. A common example is a configuration in which the first router
1543 sends all messages to a message-scanning program, unless they have been
1544 previously scanned. Thus, the first router accepts all addresses without any
1545 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1546 would be set for such a router, causing it to be skipped in verify mode.
1549 <section id="SECTrunindrou">
1550 <title>Running an individual router</title>
1552 <indexterm role="concept">
1553 <primary>router</primary>
1554 <secondary>running details</secondary>
1556 <indexterm role="concept">
1557 <primary>preconditions</primary>
1558 <secondary>checking</secondary>
1560 <indexterm role="concept">
1561 <primary>router</primary>
1562 <secondary>result of running</secondary>
1564 As explained in the example above, a number of preconditions are checked before
1565 running a router. If any are not met, the router is skipped, and the address is
1566 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1567 the router is run. What happens next depends on the outcome, which is one of
1573 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1574 transport, or generates one or more <quote>child</quote> addresses. Processing the
1575 original address ceases,
1576 <indexterm role="option">
1577 <primary><option>unseen</option></primary>
1579 unless the <option>unseen</option> option is set on the router. This option
1580 can be used to set up multiple deliveries with different routing (for example,
1581 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1582 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1586 Any child addresses generated by the router are processed independently,
1587 starting with the first router by default. It is possible to change this by
1588 setting the <option>redirect_router</option> option to specify which router to start at for
1589 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1590 <option>redirect_router</option> may be anywhere in the router configuration.
1595 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1596 requests that the address be passed to another router. By default the address
1597 is passed to the next router, but this can be changed by setting the
1598 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1599 must be below the current router (to avoid loops).
1604 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1605 recognize it at all. By default, the address is passed to the next router, but
1606 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1607 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1608 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1613 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1614 the generation of a bounce message. There is no further processing of the
1615 original address unless <option>unseen</option> is set on the router.
1620 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1621 database may be offline, or a DNS lookup may have timed out.) No further
1622 processing of the address happens in this delivery attempt. It is tried again
1623 next time the message is considered for delivery.
1628 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1629 its configuration). The action is as for defer.
1634 If an address reaches the end of the routers without having been accepted by
1635 any of them, it is bounced as unrouteable. The default error message in this
1636 situation is <quote>unrouteable address</quote>, but you can set your own message by
1637 making use of the <option>cannot_route_message</option> option. This can be set for any
1638 router; the value from the last router that <quote>saw</quote> the address is used.
1641 Sometimes while routing you want to fail a delivery when some conditions are
1642 met but others are not, instead of passing the address on for further routing.
1643 You can do this by having a second router that explicitly fails the delivery
1644 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1645 facility for this purpose.
1648 <section id="SECID17">
1649 <title>Duplicate addresses</title>
1651 <indexterm role="concept">
1652 <primary>case of local parts</primary>
1654 <indexterm role="concept">
1655 <primary>address duplicate, discarding</primary>
1657 <indexterm role="concept">
1658 <primary>duplicate addresses</primary>
1660 Once routing is complete, Exim scans the addresses that are assigned to local
1661 and remote transports, and discards any duplicates that it finds. During this
1662 check, local parts are treated as case-sensitive. This happens only when
1663 actually delivering a message; when testing routers with <option>-bt</option>, all the
1664 routed addresses are shown.
1667 <section id="SECTrouprecon">
1668 <title>Router preconditions</title>
1670 <indexterm role="concept">
1671 <primary>router</primary>
1672 <secondary>preconditions, order of processing</secondary>
1674 <indexterm role="concept">
1675 <primary>preconditions</primary>
1676 <secondary>order of processing</secondary>
1678 The preconditions that are tested for each router are listed below, in the
1679 order in which they are tested. The individual configuration options are
1680 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1685 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1686 the local parts handled by the router may or must have certain prefixes and/or
1687 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1688 skipped. These conditions are tested first. When an affix is present, it is
1689 removed from the local part before further processing, including the evaluation
1690 of any other conditions.
1695 Routers can be designated for use only when not verifying an address, that is,
1696 only when routing it for delivery (or testing its delivery routing). If the
1697 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1699 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1700 <option>verify_recipient</option>, which independently control the use of the router for
1701 sender and recipient verification. You can set these options directly if
1702 you want a router to be used for only one type of verification.
1707 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1708 run with the <option>-bt</option> option to test an address routing. This can be helpful
1709 when the first router sends all new messages to a scanner of some sort; it
1710 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1711 having to simulate the effect of the scanner.
1716 Routers can be designated for use only when verifying an address, as
1717 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1722 Individual routers can be explicitly skipped when running the routers to
1723 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1728 If the <option>domains</option> option is set, the domain of the address must be in the set
1729 of domains that it defines.
1734 <indexterm role="variable">
1735 <primary><varname>$local_part_prefix</varname></primary>
1737 <indexterm role="variable">
1738 <primary><varname>$local_part</varname></primary>
1740 <indexterm role="variable">
1741 <primary><varname>$local_part_suffix</varname></primary>
1743 If the <option>local_parts</option> option is set, the local part of the address must be in
1744 the set of local parts that it defines. If <option>local_part_prefix</option> or
1745 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1746 part before this check. If you want to do precondition tests on local parts
1747 that include affixes, you can do so by using a <option>condition</option> option (see below)
1748 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1749 <varname>$local_part_suffix</varname> as necessary.
1754 <indexterm role="variable">
1755 <primary><varname>$local_user_uid</varname></primary>
1757 <indexterm role="variable">
1758 <primary><varname>$local_user_gid</varname></primary>
1760 <indexterm role="variable">
1761 <primary><varname>$home</varname></primary>
1763 If the <option>check_local_user</option> option is set, the local part must be the name of
1764 an account on the local host. If this check succeeds, the uid and gid of the
1765 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1766 user’s home directory is placed in <varname>$home</varname>; these values can be used in the
1767 remaining preconditions.
1772 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1773 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1774 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1775 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1776 could lead to confusion.
1781 If the <option>senders</option> option is set, the envelope sender address must be in the
1782 set of addresses that it defines.
1787 If the <option>require_files</option> option is set, the existence or non-existence of
1788 specified files is tested.
1793 <indexterm role="concept">
1794 <primary>customizing</primary>
1795 <secondary>precondition</secondary>
1797 If the <option>condition</option> option is set, it is evaluated and tested. This option
1798 uses an expanded string to allow you to set up your own custom preconditions.
1799 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1804 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1805 it to check for the existence of a file in which to lookup up a domain, local
1806 part, or sender. However, as these options are all expanded, you can use the
1807 <option>exists</option> expansion condition to make such tests within each condition. The
1808 <option>require_files</option> option is intended for checking files that the router may be
1809 going to use internally, or which are needed by a specific transport (for
1810 example, <filename>.procmailrc</filename>).
1813 <section id="SECID18">
1814 <title>Delivery in detail</title>
1816 <indexterm role="concept">
1817 <primary>delivery</primary>
1818 <secondary>in detail</secondary>
1820 When a message is to be delivered, the sequence of events is as follows:
1825 If a system-wide filter file is specified, the message is passed to it. The
1826 filter may add recipients to the message, replace the recipients, discard the
1827 message, cause a new message to be generated, or cause the message delivery to
1828 fail. The format of the system filter file is the same as for Exim user filter
1829 files, described in the separate document entitled <emphasis>Exim’s interfaces to mail
1830 filtering</emphasis>.
1831 <indexterm role="concept">
1832 <primary>Sieve filter</primary>
1833 <secondary>not available for system filter</secondary>
1835 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1838 Some additional features are available in system filters – see chapter
1839 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1840 filter only once per delivery attempt, however many recipients it has. However,
1841 if there are several delivery attempts because one or more addresses could not
1842 be immediately delivered, the system filter is run each time. The filter
1843 condition <option>first_delivery</option> can be used to detect the first run of the system
1849 Each recipient address is offered to each configured router in turn, subject to
1850 its preconditions, until one is able to handle it. If no router can handle the
1851 address, that is, if they all decline, the address is failed. Because routers
1852 can be targeted at particular domains, several locally handled domains can be
1853 processed entirely independently of each other.
1858 <indexterm role="concept">
1859 <primary>routing</primary>
1860 <secondary>loops in</secondary>
1862 <indexterm role="concept">
1863 <primary>loop</primary>
1864 <secondary>while routing</secondary>
1866 A router that accepts an address may assign it to a local or a remote
1867 transport. However, the transport is not run at this time. Instead, the address
1868 is placed on a list for the particular transport, which will be run later.
1869 Alternatively, the router may generate one or more new addresses (typically
1870 from alias, forward, or filter files). New addresses are fed back into this
1871 process from the top, but in order to avoid loops, a router ignores any address
1872 which has an identically-named ancestor that was processed by itself.
1877 When all the routing has been done, addresses that have been successfully
1878 handled are passed to their assigned transports. When local transports are
1879 doing real local deliveries, they handle only one address at a time, but if a
1880 local transport is being used as a pseudo-remote transport (for example, to
1881 collect batched SMTP messages for transmission by some other means) multiple
1882 addresses can be handled. Remote transports can always handle more than one
1883 address at a time, but can be configured not to do so, or to restrict multiple
1884 addresses to the same domain.
1889 Each local delivery to a file or a pipe runs in a separate process under a
1890 non-privileged uid, and these deliveries are run one at a time. Remote
1891 deliveries also run in separate processes, normally under a uid that is private
1892 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1893 run in parallel. The maximum number of simultaneous remote deliveries for any
1894 one message is set by the <option>remote_max_parallel</option> option.
1895 The order in which deliveries are done is not defined, except that all local
1896 deliveries happen before any remote deliveries.
1901 <indexterm role="concept">
1902 <primary>queue runner</primary>
1904 When it encounters a local delivery during a queue run, Exim checks its retry
1905 database to see if there has been a previous temporary delivery failure for the
1906 address before running the local transport. If there was a previous failure,
1907 Exim does not attempt a new delivery until the retry time for the address is
1908 reached. However, this happens only for delivery attempts that are part of a
1909 queue run. Local deliveries are always attempted when delivery immediately
1910 follows message reception, even if retry times are set for them. This makes for
1911 better behaviour if one particular message is causing problems (for example,
1912 causing quota overflow, or provoking an error in a filter file).
1917 <indexterm role="concept">
1918 <primary>delivery</primary>
1919 <secondary>retry in remote transports</secondary>
1921 Remote transports do their own retry handling, since an address may be
1922 deliverable to one of a number of hosts, each of which may have a different
1923 retry time. If there have been previous temporary failures and no host has
1924 reached its retry time, no delivery is attempted, whether in a queue run or
1925 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1930 If there were any permanent errors, a bounce message is returned to an
1931 appropriate address (the sender in the common case), with details of the error
1932 for each failing address. Exim can be configured to send copies of bounce
1933 messages to other addresses.
1938 <indexterm role="concept">
1939 <primary>delivery</primary>
1940 <secondary>deferral</secondary>
1942 If one or more addresses suffered a temporary failure, the message is left on
1943 the queue, to be tried again later. Delivery of these addresses is said to be
1944 <emphasis>deferred</emphasis>.
1949 When all the recipient addresses have either been delivered or bounced,
1950 handling of the message is complete. The spool files and message log are
1951 deleted, though the message log can optionally be preserved if required.
1956 <section id="SECID19">
1957 <title>Retry mechanism</title>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry mechanism</secondary>
1963 <indexterm role="concept">
1964 <primary>retry</primary>
1965 <secondary>description of mechanism</secondary>
1967 <indexterm role="concept">
1968 <primary>queue runner</primary>
1970 Exim’s mechanism for retrying messages that fail to get delivered at the first
1971 attempt is the queue runner process. You must either run an Exim daemon that
1972 uses the <option>-q</option> option with a time interval to start queue runners at regular
1973 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
1974 not arrange for queue runners to be run, messages that fail temporarily at the
1975 first attempt will remain on your queue for ever. A queue runner process works
1976 its way through the queue, one message at a time, trying each delivery that has
1977 passed its retry time.
1978 You can run several queue runners at once.
1981 Exim uses a set of configured rules to determine when next to retry the failing
1982 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
1983 should give up trying to deliver to the address, at which point it generates a
1984 bounce message. If no retry rules are set for a particular host, address, and
1985 error combination, no retries are attempted, and temporary errors are treated
1989 <section id="SECID20">
1990 <title>Temporary delivery failure</title>
1992 <indexterm role="concept">
1993 <primary>delivery</primary>
1994 <secondary>temporary failure</secondary>
1996 There are many reasons why a message may not be immediately deliverable to a
1997 particular address. Failure to connect to a remote machine (because it, or the
1998 connection to it, is down) is one of the most common. Temporary failures may be
1999 detected during routing as well as during the transport stage of delivery.
2000 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2001 is on a file system where the user is over quota. Exim can be configured to
2002 impose its own quotas on local mailboxes; where system quotas are set they will
2005 <para revisionflag="changed">
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
2010 <indexterm role="concept">
2011 <primary>hints database</primary>
2013 Exim makes a note in its hints database, and whenever a successful
2014 SMTP delivery has happened, it looks to see if any other messages are waiting
2015 for the same host. If any are found, they are sent over the same SMTP
2016 connection, subject to a configuration limit as to the maximum number in any
2020 <section id="SECID21">
2021 <title>Permanent delivery failure</title>
2023 <indexterm role="concept">
2024 <primary>delivery</primary>
2025 <secondary>permanent failure</secondary>
2027 <indexterm role="concept">
2028 <primary>bounce message</primary>
2029 <secondary>when generated</secondary>
2031 When a message cannot be delivered to some or all of its intended recipients, a
2032 bounce message is generated. Temporary delivery failures turn into permanent
2033 errors when their timeout expires. All the addresses that fail in a given
2034 delivery attempt are listed in a single message. If the original message has
2035 many recipients, it is possible for some addresses to fail in one delivery
2036 attempt and others to fail subsequently, giving rise to more than one bounce
2037 message. The wording of bounce messages can be customized by the administrator.
2038 See chapter <xref linkend="CHAPemsgcust"/> for details.
2041 <indexterm role="concept">
2042 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2044 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2045 failed addresses, for the benefit of programs that try to analyse such messages
2049 <indexterm role="concept">
2050 <primary>bounce message</primary>
2051 <secondary>recipient of</secondary>
2053 A bounce message is normally sent to the sender of the original message, as
2054 obtained from the message’s envelope. For incoming SMTP messages, this is the
2055 address given in the MAIL command. However, when an address is expanded via a
2056 forward or alias file, an alternative address can be specified for delivery
2057 failures of the generated addresses. For a mailing list expansion (see section
2058 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2062 <section id="SECID22">
2063 <title>Failures to deliver bounce messages</title>
2065 <indexterm role="concept">
2066 <primary>bounce message</primary>
2067 <secondary>failure to deliver</secondary>
2069 If a bounce message (either locally generated or received from a remote host)
2070 itself suffers a permanent delivery failure, the message is left on the queue,
2071 but it is frozen, awaiting the attention of an administrator. There are options
2072 that can be used to make Exim discard such failed messages, or to keep them
2073 for only a short time (see <option>timeout_frozen_after</option> and
2074 <option>ignore_bounce_errors_after</option>).
2079 <chapter id="CHID3">
2080 <title>Building and installing Exim</title>
2082 <indexterm role="concept" id="IIDbuex" class="startofrange">
2083 <primary>building Exim</primary>
2086 <section id="SECID23">
2087 <title>Unpacking</title>
2089 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2090 creates a directory with the name of the current release (for example,
2091 <filename>exim-4.74</filename>) into which the following files are placed:
2093 <informaltable frame="none">
2094 <tgroup cols="2" colsep="0" rowsep="0">
2095 <colspec colwidth="140pt" align="left"/>
2096 <colspec colwidth="254pt" align="left"/>
2099 <entry> <filename>ACKNOWLEDGMENTS</filename></entry>
2100 <entry>contains some acknowledgments</entry>
2103 <entry> <filename>CHANGES</filename></entry>
2104 <entry>contains a reference to where changes are documented</entry>
2107 <entry> <filename>LICENCE</filename></entry>
2108 <entry>the GNU General Public Licence</entry>
2111 <entry> <filename>Makefile</filename></entry>
2112 <entry>top-level make file</entry>
2115 <entry> <filename>NOTICE</filename></entry>
2116 <entry>conditions for the use of Exim</entry>
2119 <entry> <filename>README</filename></entry>
2120 <entry>list of files, directories and simple build instructions</entry>
2126 Other files whose names begin with <filename>README</filename> may also be present. The
2127 following subdirectories are created:
2129 <informaltable frame="none">
2130 <tgroup cols="2" colsep="0" rowsep="0">
2131 <colspec colwidth="140pt" align="left"/>
2132 <colspec colwidth="254pt" align="left"/>
2135 <entry> <filename>Local</filename></entry>
2136 <entry>an empty directory for local configuration files</entry>
2139 <entry> <filename>OS</filename></entry>
2140 <entry>OS-specific files</entry>
2143 <entry> <filename>doc</filename></entry>
2144 <entry>documentation files</entry>
2147 <entry> <filename>exim_monitor</filename></entry>
2148 <entry>source files for the Exim monitor</entry>
2151 <entry> <filename>scripts</filename></entry>
2152 <entry>scripts used in the build process</entry>
2155 <entry> <filename>src</filename></entry>
2156 <entry>remaining source files</entry>
2159 <entry> <filename>util</filename></entry>
2160 <entry>independent utilities</entry>
2166 The main utility programs are contained in the <filename>src</filename> directory, and are built
2167 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2168 that may be useful to some sites.
2171 <section id="SECID24">
2172 <title>Multiple machine architectures and operating systems</title>
2174 <indexterm role="concept">
2175 <primary>building Exim</primary>
2176 <secondary>multiple OS/architectures</secondary>
2178 The building process for Exim is arranged to make it easy to build binaries for
2179 a number of different architectures and operating systems from the same set of
2180 source files. Compilation does not take place in the <filename>src</filename> directory.
2181 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2183 <indexterm role="concept">
2184 <primary>symbolic link</primary>
2185 <secondary>to build directory</secondary>
2187 Symbolic links to the sources are installed in this directory, which is where
2188 the actual building takes place. In most cases, Exim can discover the machine
2189 architecture and operating system for itself, but the defaults can be
2190 overridden if necessary.
2193 <section id="SECTpcre">
2194 <title>PCRE library</title>
2196 <indexterm role="concept">
2197 <primary>PCRE library</primary>
2199 Exim no longer has an embedded PCRE library as the vast majority of
2200 modern systems include PCRE as a system library, although you may need
2201 to install the PCRE or PCRE development package for your operating
2202 system. If your system has a normal PCRE installation the Exim build
2203 process will need no further configuration. If the library or the
2204 headers are in an unusual location you will need to set the PCRE_LIBS
2205 and INCLUDE directives appropriately. If your operating system has no
2206 PCRE support then you will need to obtain and build the current PCRE
2207 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>.
2210 <section id="SECTdb">
2211 <title>DBM libraries</title>
2213 <indexterm role="concept">
2214 <primary>DBM libraries</primary>
2215 <secondary>discussion of</secondary>
2217 <indexterm role="concept">
2218 <primary>hints database</primary>
2219 <secondary>DBM files used for</secondary>
2221 Even if you do not use any DBM files in your configuration, Exim still needs a
2222 DBM library in order to operate, because it uses indexed files for its hints
2223 databases. Unfortunately, there are a number of DBM libraries in existence, and
2224 different operating systems often have different ones installed.
2227 <indexterm role="concept">
2228 <primary>Solaris</primary>
2229 <secondary>DBM library for</secondary>
2231 <indexterm role="concept">
2232 <primary>IRIX, DBM library for</primary>
2234 <indexterm role="concept">
2235 <primary>BSD, DBM library for</primary>
2237 <indexterm role="concept">
2238 <primary>Linux, DBM library for</primary>
2240 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2241 Linux distribution, the DBM configuration should happen automatically, and you
2242 may be able to ignore this section. Otherwise, you may have to learn more than
2243 you would like about DBM libraries from what follows.
2246 <indexterm role="concept">
2247 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2249 Licensed versions of Unix normally contain a library of DBM functions operating
2250 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2251 versions of Unix seem to vary in what they contain as standard. In particular,
2252 some early versions of Linux have no default DBM library, and different
2253 distributors have chosen to bundle different libraries with their packaged
2254 versions. However, the more recent releases seem to have standardized on the
2255 Berkeley DB library.
2258 Different DBM libraries have different conventions for naming the files they
2259 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2262 <orderedlist numeration="arabic">
2265 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2266 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2271 <indexterm role="concept">
2272 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2274 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2275 compatibility interface it makes two different hard links to it with names
2276 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2277 file name is used unmodified.
2282 <indexterm role="concept">
2283 <primary>Berkeley DB library</primary>
2285 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2286 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2287 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2292 If the Berkeley package is used in its native mode, it operates on a single
2293 file called <filename>dbmfile</filename>; the programmer’s interface is somewhat different to
2294 the traditional <emphasis>ndbm</emphasis> interface.
2299 To complicate things further, there are several very different versions of the
2300 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2301 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2302 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2303 versions of Berkeley DB can be obtained from
2304 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2309 <indexterm role="concept">
2310 <primary><emphasis>tdb</emphasis> DBM library</primary>
2312 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2313 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2314 operates on a single file.
2319 <indexterm role="concept">
2320 <primary>USE_DB</primary>
2322 <indexterm role="concept">
2323 <primary>DBM libraries</primary>
2324 <secondary>configuration for building</secondary>
2326 Exim and its utilities can be compiled to use any of these interfaces. In order
2327 to use any version of the Berkeley DB package in native mode, you must set
2328 USE_DB in an appropriate configuration file (typically
2329 <filename>Local/Makefile</filename>). For example:
2331 <literallayout class="monospaced">
2335 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2336 error is diagnosed if you set more than one of these.
2339 At the lowest level, the build-time configuration sets none of these options,
2340 thereby assuming an interface of type (1). However, some operating system
2341 configuration files (for example, those for the BSD operating systems and
2342 Linux) assume type (4) by setting USE_DB as their default, and the
2343 configuration files for Cygwin set USE_GDBM. Anything you set in
2344 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2347 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2348 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2349 in one of these lines:
2351 <literallayout class="monospaced">
2356 Settings like that will work if the DBM library is installed in the standard
2357 place. Sometimes it is not, and the library’s header file may also not be in
2358 the default path. You may need to set INCLUDE to specify where the header
2359 file is, and to specify the path to the library more fully in DBMLIB, as in
2362 <literallayout class="monospaced">
2363 INCLUDE=-I/usr/local/include/db-4.1
2364 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2367 There is further detailed discussion about the various DBM libraries in the
2368 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2371 <section id="SECID25">
2372 <title>Pre-building configuration</title>
2374 <indexterm role="concept">
2375 <primary>building Exim</primary>
2376 <secondary>pre-building configuration</secondary>
2378 <indexterm role="concept">
2379 <primary>configuration for building Exim</primary>
2381 <indexterm role="concept">
2382 <primary><filename>Local/Makefile</filename></primary>
2384 <indexterm role="concept">
2385 <primary><filename>src/EDITME</filename></primary>
2387 Before building Exim, a local configuration file that specifies options
2388 independent of any operating system has to be created with the name
2389 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2390 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2391 therein. These descriptions are therefore not repeated here. If you are
2392 building Exim for the first time, the simplest thing to do is to copy
2393 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2396 There are three settings that you must supply, because Exim will not build
2397 without them. They are the location of the run time configuration file
2398 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2399 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2400 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2401 a colon-separated list of file names; Exim uses the first of them that exists.
2404 There are a few other parameters that can be specified either at build time or
2405 at run time, to enable the same binary to be used on a number of different
2406 machines. However, if the locations of Exim’s spool directory and log file
2407 directory (if not within the spool directory) are fixed, it is recommended that
2408 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2409 detected early in Exim’s execution (such as a malformed configuration file) can
2413 <indexterm role="concept">
2414 <primary>content scanning</primary>
2415 <secondary>specifying at build time</secondary>
2417 Exim’s interfaces for calling virus and spam scanning software directly from
2418 access control lists are not compiled by default. If you want to include these
2419 facilities, you need to set
2421 <literallayout class="monospaced">
2422 WITH_CONTENT_SCAN=yes
2425 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2426 chapter <xref linkend="CHAPexiscan"/>.
2429 <indexterm role="concept">
2430 <primary><filename>Local/eximon.conf</filename></primary>
2432 <indexterm role="concept">
2433 <primary><filename>exim_monitor/EDITME</filename></primary>
2435 If you are going to build the Exim monitor, a similar configuration process is
2436 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2437 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2438 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2439 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2442 This is all the configuration that is needed in straightforward cases for known
2443 operating systems. However, the building process is set up so that it is easy
2444 to override options that are set by default or by operating-system-specific
2445 configuration files, for example to change the name of the C compiler, which
2446 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2450 <section id="SECID26">
2451 <title>Support for iconv()</title>
2453 <indexterm role="concept">
2454 <primary><function>iconv()</function> support</primary>
2456 <indexterm role="concept">
2457 <primary>RFC 2047</primary>
2459 The contents of header lines in messages may be encoded according to the rules
2460 described RFC 2047. This makes it possible to transmit characters that are not
2461 in the ASCII character set, and to label them as being in a particular
2462 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2463 mechanism, it decodes them, and translates them into a specified character set
2464 (default ISO-8859-1). The translation is possible only if the operating system
2465 supports the <function>iconv()</function> function.
2468 However, some of the operating systems that supply <function>iconv()</function> do not support
2469 very many conversions. The GNU <option>libiconv</option> library (available from
2470 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2471 systems to remedy this deficiency, as well as on systems that do not supply
2472 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2474 <literallayout class="monospaced">
2478 to your <filename>Local/Makefile</filename> and rebuild Exim.
2481 <section id="SECTinctlsssl">
2482 <title>Including TLS/SSL encryption support</title>
2484 <indexterm role="concept">
2485 <primary>TLS</primary>
2486 <secondary>including support for TLS</secondary>
2488 <indexterm role="concept">
2489 <primary>encryption</primary>
2490 <secondary>including support for</secondary>
2492 <indexterm role="concept">
2493 <primary>SUPPORT_TLS</primary>
2495 <indexterm role="concept">
2496 <primary>OpenSSL</primary>
2497 <secondary>building Exim with</secondary>
2499 <indexterm role="concept">
2500 <primary>GnuTLS</primary>
2501 <secondary>building Exim with</secondary>
2503 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2504 command as per RFC 2487. It can also support legacy clients that expect to
2505 start a TLS session immediately on connection to a non-standard port (see the
2506 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2510 If you want to build Exim with TLS support, you must first install either the
2511 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2515 If OpenSSL is installed, you should set
2517 <literallayout class="monospaced">
2519 TLS_LIBS=-lssl -lcrypto
2522 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2523 OpenSSL library and include files. For example:
2525 <literallayout class="monospaced">
2527 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2528 TLS_INCLUDE=-I/usr/local/openssl/include/
2531 <indexterm role="concept">
2532 <primary>USE_GNUTLS</primary>
2534 If GnuTLS is installed, you should set
2536 <literallayout class="monospaced">
2539 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2542 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2543 library and include files. For example:
2545 <literallayout class="monospaced">
2548 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2549 TLS_INCLUDE=-I/usr/gnu/include
2552 You do not need to set TLS_INCLUDE if the relevant directory is already
2553 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2554 given in chapter <xref linkend="CHAPTLS"/>.
2557 <section id="SECID27" revisionflag="changed">
2558 <title>Use of tcpwrappers</title>
2559 <para revisionflag="changed">
2560 <indexterm role="concept">
2561 <primary>tcpwrappers, building Exim to support</primary>
2563 <indexterm role="concept">
2564 <primary>USE_TCP_WRAPPERS</primary>
2566 <indexterm role="concept">
2567 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2569 <indexterm role="concept">
2570 <primary>tcp_wrappers_daemon_name</primary>
2572 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2573 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2574 alternative to Exim’s own checking facilities for installations that are
2575 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2576 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2577 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2578 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2579 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2582 <literallayout class="monospaced" revisionflag="changed">
2583 USE_TCP_WRAPPERS=yes
2584 CFLAGS=-O -I/usr/local/include
2585 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2587 <para revisionflag="changed">
2588 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2589 files is <quote>exim</quote>. For example, the line
2591 <literallayout class="monospaced" revisionflag="changed">
2592 exim : LOCAL 192.168.1. .friendly.domain.example
2594 <para revisionflag="changed">
2595 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2596 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2597 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2598 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2599 in <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2600 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2604 <section id="SECID28">
2605 <title>Including support for IPv6</title>
2607 <indexterm role="concept">
2608 <primary>IPv6</primary>
2609 <secondary>including support for</secondary>
2611 Exim contains code for use on systems that have IPv6 support. Setting
2612 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2613 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2614 where the IPv6 support is not fully integrated into the normal include and
2618 Two different types of DNS record for handling IPv6 addresses have been
2619 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2620 currently seen as the mainstream. Another record type called A6 was proposed
2621 as better than AAAA because it had more flexibility. However, it was felt to be
2622 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2623 if anyone is actually using A6 records. Exim has support for A6 records, but
2624 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2625 support has not been tested for some time.
2628 <section id="SECTdynamicmodules" revisionflag="changed">
2629 <title>Dynamically loaded lookup module support</title>
2630 <para revisionflag="changed">
2631 <indexterm role="concept">
2632 <primary>lookup modules</primary>
2634 <indexterm role="concept">
2635 <primary>dynamic modules</primary>
2637 <indexterm role="concept">
2638 <primary>.so building</primary>
2640 On some platforms, Exim supports not compiling all lookup types directly into
2641 the main binary, instead putting some into external modules which can be loaded
2643 This permits packagers to build Exim with support for lookups with extensive
2644 library dependencies without requiring all users to install all of those
2646 Most, but not all, lookup types can be built this way.
2648 <para revisionflag="changed">
2649 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2650 installed; Exim will only load modules from that directory, as a security
2651 measure. You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2652 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2653 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2654 see <filename>src/EDITME</filename> for details.
2656 <para revisionflag="changed">
2657 Then, for each module to be loaded dynamically, define the relevant
2658 <literal>LOOKUP_</literal><<emphasis>lookup_type</emphasis>> flags to have the value "2" instead of "yes".
2659 For example, this will build in lsearch but load sqlite and mysql support
2662 <literallayout class="monospaced" revisionflag="changed">
2668 <section id="SECID29">
2669 <title>The building process</title>
2671 <indexterm role="concept">
2672 <primary>build directory</primary>
2674 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2675 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2676 operating system types, and creates a build directory if one does not exist.
2677 For example, on a Sun system running Solaris 8, the directory
2678 <filename>build-SunOS5-5.8-sparc</filename> is created.
2679 <indexterm role="concept">
2680 <primary>symbolic link</primary>
2681 <secondary>to source files</secondary>
2683 Symbolic links to relevant source files are installed in the build directory.
2686 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2687 building process fails if it is set.
2690 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2691 a make file inside the build directory, using the configuration files from the
2692 <filename>Local</filename> directory. The new make file is then passed to another instance of
2693 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2694 then compiling and linking the binaries for the Exim monitor (if configured), a
2695 number of utility programs, and finally Exim itself. The command <literal>make
2696 makefile</literal> can be used to force a rebuild of the make file in the build
2697 directory, should this ever be necessary.
2700 If you have problems building Exim, check for any comments there may be in the
2701 <filename>README</filename> file concerning your operating system, and also take a look at the
2702 FAQ, where some common problems are covered.
2705 <section id="SECID283">
2706 <title>Output from <quote>make</quote></title>
2708 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2709 unreadable, because these lines can be very long. For this reason, the normal
2710 output is suppressed by default, and instead output similar to that which
2711 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2712 each module that is being compiled or linked. However, it is still possible to
2713 get the full output, by calling <emphasis>make</emphasis> like this:
2715 <literallayout class="monospaced">
2719 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2720 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2721 given in addition to the short output.
2724 <section id="SECToverride">
2725 <title>Overriding build-time options for Exim</title>
2727 <indexterm role="concept">
2728 <primary>build-time options, overriding</primary>
2730 The main make file that is created at the beginning of the building process
2731 consists of the concatenation of a number of files which set configuration
2732 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2733 more than once, the last setting overrides any previous ones. This provides a
2734 convenient way of overriding defaults. The files that are concatenated are, in
2738 <filename>OS/Makefile-Default</filename>
2739 <filename>OS/Makefile-</filename><<emphasis>ostype</emphasis>>
2740 <filename>Local/Makefile</filename>
2741 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>
2742 <filename>Local/Makefile-</filename><<emphasis>archtype</emphasis>>
2743 <filename>Local/Makefile-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2744 <filename>OS/Makefile-Base</filename>
2747 <indexterm role="concept">
2748 <primary><filename>Local/Makefile</filename></primary>
2750 <indexterm role="concept">
2751 <primary>building Exim</primary>
2752 <secondary>operating system type</secondary>
2754 <indexterm role="concept">
2755 <primary>building Exim</primary>
2756 <secondary>architecture type</secondary>
2758 where <<emphasis>ostype</emphasis>> is the operating system type and <<emphasis>archtype</emphasis>> is the
2759 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2760 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2761 and are often not needed.
2764 The values used for <<emphasis>ostype</emphasis>> and <<emphasis>archtype</emphasis>> are obtained from scripts
2765 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2766 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2767 values are used, thereby providing a means of forcing particular settings.
2768 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2769 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2770 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2771 that Exim expects. You can run these scripts directly from the shell in order
2772 to find out what values are being used on your system.
2775 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2776 therein. Some (but not all) are mentioned below. If there is something that
2777 needs changing, review the contents of this file and the contents of the make
2778 file for your operating system (<filename>OS/Makefile-<ostype></filename>) to see what the
2782 <indexterm role="concept">
2783 <primary>building Exim</primary>
2784 <secondary>overriding default settings</secondary>
2786 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2787 or in <filename>OS/Makefile-<ostype></filename>, or to add any new definitions, you do not
2788 need to change the original files. Instead, you should make the changes by
2789 putting the new values in an appropriate <filename>Local</filename> file. For example,
2790 <indexterm role="concept">
2791 <primary>Tru64-Unix build-time settings</primary>
2793 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2794 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2795 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2796 called with the option <option>-std1</option>, to make it recognize some of the features of
2797 Standard C that Exim uses. (Most other compilers recognize Standard C by
2798 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2799 containing the lines
2801 <literallayout class="monospaced">
2806 If you are compiling for just one operating system, it may be easier to put
2807 these lines directly into <filename>Local/Makefile</filename>.
2810 Keeping all your local configuration settings separate from the distributed
2811 files makes it easy to transfer them to new versions of Exim simply by copying
2812 the contents of the <filename>Local</filename> directory.
2815 <indexterm role="concept">
2816 <primary>NIS lookup type</primary>
2817 <secondary>including support for</secondary>
2819 <indexterm role="concept">
2820 <primary>NIS+ lookup type</primary>
2821 <secondary>including support for</secondary>
2823 <indexterm role="concept">
2824 <primary>LDAP</primary>
2825 <secondary>including support for</secondary>
2827 <indexterm role="concept">
2828 <primary>lookup</primary>
2829 <secondary>inclusion in binary</secondary>
2831 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2832 lookup, but not all systems have these components installed, so the default is
2833 not to include the relevant code in the binary. All the different kinds of file
2834 and database lookup that Exim supports are implemented as separate code modules
2835 which are included only if the relevant compile-time options are set. In the
2836 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2838 <literallayout class="monospaced">
2844 and similar settings apply to the other lookup types. They are all listed in
2845 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2846 libraries need to be installed before compiling Exim.
2847 <indexterm role="concept">
2848 <primary>cdb</primary>
2849 <secondary>including support for</secondary>
2851 However, there are some optional lookup types (such as cdb) for which
2852 the code is entirely contained within Exim, and no external include
2853 files or libraries are required. When a lookup type is not included in the
2854 binary, attempts to configure Exim to use it cause run time configuration
2858 <indexterm role="concept">
2859 <primary>Perl</primary>
2860 <secondary>including support for</secondary>
2862 Exim can be linked with an embedded Perl interpreter, allowing Perl
2863 subroutines to be called during string expansion. To enable this facility,
2865 <literallayout class="monospaced">
2869 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2870 chapter <xref linkend="CHAPperl"/>.
2873 <indexterm role="concept">
2874 <primary>X11 libraries, location of</primary>
2876 The location of the X11 libraries is something that varies a lot between
2877 operating systems, and there may be different versions of X11 to cope
2878 with. Exim itself makes no use of X11, but if you are compiling the Exim
2879 monitor, the X11 libraries must be available.
2880 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2882 <literallayout class="monospaced">
2884 XINCLUDE=-I$(X11)/include
2885 XLFLAGS=-L$(X11)/lib
2888 These are overridden in some of the operating-system configuration files. For
2889 example, in <filename>OS/Makefile-SunOS5</filename> there is
2891 <literallayout class="monospaced">
2893 XINCLUDE=-I$(X11)/include
2894 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2897 If you need to override the default setting for your operating system, place a
2898 definition of all three of these variables into your
2899 <filename>Local/Makefile-<ostype></filename> file.
2902 <indexterm role="concept">
2903 <primary>EXTRALIBS</primary>
2905 If you need to add any extra libraries to the link steps, these can be put in a
2906 variable called EXTRALIBS, which appears in all the link commands, but by
2907 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2908 command for linking the main Exim binary, and not for any associated utilities.
2911 <indexterm role="concept">
2912 <primary>DBM libraries</primary>
2913 <secondary>configuration for building</secondary>
2915 There is also DBMLIB, which appears in the link commands for binaries that
2916 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2917 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2918 binary, and which can be used, for example, to include additional X11
2922 <indexterm role="concept">
2923 <primary>configuration file</primary>
2924 <secondary>editing</secondary>
2926 The make file copes with rebuilding Exim correctly if any of the configuration
2927 files are edited. However, if an optional configuration file is deleted, it is
2928 necessary to touch the associated non-optional file (that is,
2929 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2932 <section id="SECID30">
2933 <title>OS-specific header files</title>
2935 <indexterm role="concept">
2936 <primary><filename>os.h</filename></primary>
2938 <indexterm role="concept">
2939 <primary>building Exim</primary>
2940 <secondary>OS-specific C header files</secondary>
2942 The <filename>OS</filename> directory contains a number of files with names of the form
2943 <filename>os.h-<ostype></filename>. These are system-specific C header files that should not
2944 normally need to be changed. There is a list of macro settings that are
2945 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2946 are porting Exim to a new operating system.
2949 <section id="SECID31">
2950 <title>Overriding build-time options for the monitor</title>
2952 <indexterm role="concept">
2953 <primary>building Eximon</primary>
2955 A similar process is used for overriding things when building the Exim monitor,
2956 where the files that are involved are
2959 <filename>OS/eximon.conf-Default</filename>
2960 <filename>OS/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2961 <filename>Local/eximon.conf</filename>
2962 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>
2963 <filename>Local/eximon.conf-</filename><<emphasis>archtype</emphasis>>
2964 <filename>Local/eximon.conf-</filename><<emphasis>ostype</emphasis>>-<<emphasis>archtype</emphasis>>
2967 <indexterm role="concept">
2968 <primary><filename>Local/eximon.conf</filename></primary>
2970 As with Exim itself, the final three files need not exist, and in this case the
2971 <filename>OS/eximon.conf-<ostype></filename> file is also optional. The default values in
2972 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2973 variables of the same name, preceded by EXIMON_. For example, setting
2974 EXIMON_LOG_DEPTH in the environment overrides the value of
2975 LOG_DEPTH at run time.
2976 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2979 <section id="SECID32">
2980 <title>Installing Exim binaries and scripts</title>
2982 <indexterm role="concept">
2983 <primary>installing Exim</primary>
2985 <indexterm role="concept">
2986 <primary>BIN_DIRECTORY</primary>
2988 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2989 arguments. The script copies binaries and utility scripts into the directory
2990 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2991 <indexterm role="concept">
2992 <primary>setuid</primary>
2993 <secondary>installing Exim with</secondary>
2995 The install script copies files only if they are newer than the files they are
2996 going to replace. The Exim binary is required to be owned by root and have the
2997 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2998 install</literal> as root so that it can set up the Exim binary in this way. However, in
2999 some special situations (for example, if a host is doing no local deliveries)
3000 it may be possible to run Exim without making the binary setuid root (see
3001 chapter <xref linkend="CHAPsecurity"/> for details).
3004 <indexterm role="concept">
3005 <primary>CONFIGURE_FILE</primary>
3007 Exim’s run time configuration file is named by the CONFIGURE_FILE setting
3008 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3009 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3010 by the installation script. If a run time configuration file already exists, it
3011 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3012 alternative files, no default is installed.
3015 <indexterm role="concept">
3016 <primary>system aliases file</primary>
3018 <indexterm role="concept">
3019 <primary><filename>/etc/aliases</filename></primary>
3021 One change is made to the default configuration file when it is installed: the
3022 default configuration contains a router that references a system aliases file.
3023 The path to this file is set to the value specified by
3024 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3025 If the system aliases file does not exist, the installation script creates it,
3026 and outputs a comment to the user.
3029 The created file contains no aliases, but it does contain comments about the
3030 aliases a site should normally have. Mail aliases have traditionally been
3031 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3032 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3033 Exim’s configuration if necessary.
3036 The default configuration uses the local host’s name as the only local domain,
3037 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3038 running as the local user. System aliases and <filename>.forward</filename> files in users’ home
3039 directories are supported, but no NIS or NIS+ support is configured. Domains
3040 other than the name of the local host are routed using the DNS, with delivery
3044 It is possible to install Exim for special purposes (such as building a binary
3045 distribution) in a private part of the file system. You can do this by a
3048 <literallayout class="monospaced">
3049 make DESTDIR=/some/directory/ install
3052 This has the effect of pre-pending the specified directory to all the file
3053 paths, except the name of the system aliases file that appears in the default
3054 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3055 For backwards compatibility, ROOT is used if DESTDIR is not set,
3056 but this usage is deprecated.
3059 <indexterm role="concept">
3060 <primary>installing Exim</primary>
3061 <secondary>what is not installed</secondary>
3063 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3064 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3065 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3066 directory are copied, except for the info files when you have set
3067 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3070 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3071 to their names. The Exim binary itself, however, is handled differently. It is
3072 installed under a name that includes the version number and the compile number,
3073 for example <filename>exim-4.74-1</filename>. The script then arranges for a symbolic link
3074 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3075 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3076 from the directory (as seen by other processes).
3079 <indexterm role="concept">
3080 <primary>installing Exim</primary>
3081 <secondary>testing the script</secondary>
3083 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3084 real, you can pass the <option>-n</option> option to the installation script by this
3087 <literallayout class="monospaced">
3088 make INSTALL_ARG=-n install
3091 The contents of the variable INSTALL_ARG are passed to the installation
3092 script. You do not need to be root to run this test. Alternatively, you can run
3093 the installation script directly, but this must be from within the build
3094 directory. For example, from the top-level Exim directory you could use this
3097 <literallayout class="monospaced">
3098 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3101 <indexterm role="concept">
3102 <primary>installing Exim</primary>
3103 <secondary>install script options</secondary>
3105 There are two other options that can be supplied to the installation script.
3110 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3111 to root, and the call to make it a setuid binary.
3116 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3122 INSTALL_ARG can be used to pass these options to the script. For example:
3124 <literallayout class="monospaced">
3125 make INSTALL_ARG=-no_symlink install
3128 The installation script can also be given arguments specifying which files are
3129 to be copied. For example, to install just the Exim binary, and nothing else,
3130 without creating the symbolic link, you could use:
3132 <literallayout class="monospaced">
3133 make INSTALL_ARG='-no_symlink exim' install
3136 <section id="SECTinsinfdoc">
3137 <title>Installing info documentation</title>
3139 <indexterm role="concept">
3140 <primary>installing Exim</primary>
3141 <secondary><emphasis>info</emphasis> documentation</secondary>
3143 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3144 reason, the Texinfo source of Exim’s documentation is not included in the main
3145 distribution. Instead it is available separately from the ftp site (see section
3146 <xref linkend="SECTavail"/>).
3149 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3150 source of the documentation is found in the source tree, running <literal>make
3151 install</literal> automatically builds the info files and installs them.
3154 <section id="SECID33">
3155 <title>Setting up the spool directory</title>
3157 <indexterm role="concept">
3158 <primary>spool directory</primary>
3159 <secondary>creating</secondary>
3161 When it starts up, Exim tries to create its spool directory if it does not
3162 exist. The Exim uid and gid are used for the owner and group of the spool
3163 directory. Sub-directories are automatically created in the spool directory as
3167 <section id="SECID34">
3168 <title>Testing</title>
3170 <indexterm role="concept">
3171 <primary>testing</primary>
3172 <secondary>installation</secondary>
3174 Having installed Exim, you can check that the run time configuration file is
3175 syntactically valid by running the following command, which assumes that the
3176 Exim binary directory is within your PATH environment variable:
3178 <literallayout class="monospaced">
3182 If there are any errors in the configuration file, Exim outputs error messages.
3183 Otherwise it outputs the version number and build date,
3184 the DBM library that is being used, and information about which drivers and
3185 other optional code modules are included in the binary.
3186 Some simple routing tests can be done by using the address testing option. For
3190 <literal>exim -bt</literal> <<emphasis>local username</emphasis>>
3193 should verify that it recognizes a local mailbox, and
3196 <literal>exim -bt</literal> <<emphasis>remote address</emphasis>>
3199 a remote one. Then try getting it to deliver mail, both locally and remotely.
3200 This can be done by passing messages directly to Exim, without going through a
3201 user agent. For example:
3203 <literallayout class="monospaced">
3204 exim -v postmaster@your.domain.example
3205 From: user@your.domain.example
3206 To: postmaster@your.domain.example
3207 Subject: Testing Exim
3209 This is a test message.
3213 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3214 In this case you should see copies of three log lines, one for the message’s
3215 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3218 <indexterm role="concept">
3219 <primary>delivery</primary>
3220 <secondary>problems with</secondary>
3222 If you encounter problems, look at Exim’s log files (<emphasis>mainlog</emphasis> and
3223 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3224 of information is running Exim with debugging turned on, by specifying the
3225 <option>-d</option> option. If a message is stuck on Exim’s spool, you can force a delivery
3226 with debugging turned on by a command of the form
3229 <literal>exim -d -M</literal> <<emphasis>exim-message-id</emphasis>>
3232 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3233 produces rather a lot of output, but you can cut this down to specific areas.
3234 For example, if you use <option>-d-all+route</option> only the debugging information
3235 relevant to routing is included. (See the <option>-d</option> option in chapter
3236 <xref linkend="CHAPcommandline"/> for more details.)
3239 <indexterm role="concept">
3240 <primary><quote>sticky</quote> bit</primary>
3242 <indexterm role="concept">
3243 <primary>lock files</primary>
3245 One specific problem that has shown up on some sites is the inability to do
3246 local deliveries into a shared mailbox directory, because it does not have the
3247 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3248 writing to a mailbox file, and if it cannot create the lock file, the delivery
3249 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3250 directory, or by setting a specific group for local deliveries and allowing
3251 that group to create files in the directory (see the comments above the
3252 <command>local_delivery</command> transport in the default configuration file). Another
3253 approach is to configure Exim not to use lock files, but just to rely on
3254 <function>fcntl()</function> locking instead. However, you should do this only if all user
3255 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3256 see chapter <xref linkend="CHAPappendfile"/>.
3259 One thing that cannot be tested on a system that is already running an MTA is
3260 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3261 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3262 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3263 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3267 Testing a new version on a system that is already running Exim can most easily
3268 be done by building a binary with a different CONFIGURE_FILE setting. From
3269 within the run time configuration, all other file and directory names
3270 that Exim uses can be altered, in order to keep it entirely clear of the
3274 <section id="SECID35">
3275 <title>Replacing another MTA with Exim</title>
3277 <indexterm role="concept">
3278 <primary>replacing another MTA</primary>
3280 Building and installing Exim for the first time does not of itself put it in
3281 general use. The name by which the system’s MTA is called by mail user agents
3282 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3283 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3284 binary in order to get the user agents to pass messages to Exim. This is
3285 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3286 or <filename>/usr/lib/sendmail</filename>
3287 <indexterm role="concept">
3288 <primary>symbolic link</primary>
3289 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3291 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3292 privilege and executable status from the old MTA. It is then necessary to stop
3293 and restart the mailer daemon, if one is running.
3296 <indexterm role="concept">
3297 <primary>FreeBSD, MTA indirection</primary>
3299 <indexterm role="concept">
3300 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3302 Some operating systems have introduced alternative ways of switching MTAs. For
3303 example, if you are running FreeBSD, you need to edit the file
3304 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3305 described. A typical example of the contents of this file for running Exim is
3308 <literallayout class="monospaced">
3309 sendmail /usr/exim/bin/exim
3310 send-mail /usr/exim/bin/exim
3311 mailq /usr/exim/bin/exim -bp
3312 newaliases /usr/bin/true
3315 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3316 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3317 favourite user agent.
3320 You should consider what to tell your users about the change of MTA. Exim may
3321 have different capabilities to what was previously running, and there are
3322 various operational differences such as the text of messages produced by
3323 command line options and in bounce messages. If you allow your users to make
3324 use of Exim’s filtering capabilities, you should make the document entitled
3325 <emphasis>Exim’s interface to mail filtering</emphasis> available to them.
3328 <section id="SECID36">
3329 <title>Upgrading Exim</title>
3331 <indexterm role="concept">
3332 <primary>upgrading Exim</primary>
3334 If you are already running Exim on your host, building and installing a new
3335 version automatically makes it available to MUAs, or any other programs that
3336 call the MTA directly. However, if you are running an Exim daemon, you do need
3337 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3338 new binary. You do not need to stop processing mail in order to install a new
3339 version of Exim. The install script does not modify an existing runtime
3343 <section id="SECID37">
3344 <title>Stopping the Exim daemon on Solaris</title>
3346 <indexterm role="concept">
3347 <primary>Solaris</primary>
3348 <secondary>stopping Exim on</secondary>
3350 The standard command for stopping the mailer daemon on Solaris is
3352 <literallayout class="monospaced">
3353 /etc/init.d/sendmail stop
3356 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3357 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3358 for the text <quote>sendmail</quote>; this is not present because the actual program name
3359 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3360 solution is to replace the line that finds the process id with something like
3362 <literallayout class="monospaced">
3363 pid=`cat /var/spool/exim/exim-daemon.pid`
3366 to obtain the daemon’s pid directly from the file that Exim saves it in.
3369 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3370 still be received from local processes, and if automatic delivery is configured
3371 (the normal case), deliveries will still occur.
3376 <chapter id="CHAPcommandline">
3377 <title>The Exim command line</title>
3379 <indexterm role="concept" id="IIDclo1" class="startofrange">
3380 <primary>command line</primary>
3381 <secondary>options</secondary>
3383 <indexterm role="concept" id="IIDclo2" class="startofrange">
3384 <primary>options</primary>
3385 <secondary>command line</secondary>
3387 Exim’s command line takes the standard Unix form of a sequence of options,
3388 each starting with a hyphen character, followed by a number of arguments. The
3389 options are compatible with the main options of Sendmail, and there are also
3390 some additional options, some of which are compatible with Smail 3. Certain
3391 combinations of options do not make sense, and provoke an error if used.
3392 The form of the arguments depends on which options are set.
3394 <section id="SECID38">
3395 <title>Setting options by program name</title>
3397 <indexterm role="concept">
3398 <primary><emphasis>mailq</emphasis></primary>
3400 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3401 were present before any other options.
3402 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3404 This feature is for compatibility with some systems that contain a command of
3405 that name in one of the standard libraries, symbolically linked to
3406 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3409 <indexterm role="concept">
3410 <primary><emphasis>rsmtp</emphasis></primary>
3412 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3413 were present before any other options, for compatibility with Smail. The
3414 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3418 <indexterm role="concept">
3419 <primary><emphasis>rmail</emphasis></primary>
3421 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3422 <option>-oee</option> options were present before any other options, for compatibility with
3423 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3426 <indexterm role="concept">
3427 <primary><emphasis>runq</emphasis></primary>
3429 <indexterm role="concept">
3430 <primary>queue runner</primary>
3432 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3433 were present before any other options, for compatibility with Smail. The <option>-q</option>
3434 option causes a single queue runner process to be started.
3437 <indexterm role="concept">
3438 <primary><emphasis>newaliases</emphasis></primary>
3440 <indexterm role="concept">
3441 <primary>alias file</primary>
3442 <secondary>building</secondary>
3444 <indexterm role="concept">
3445 <primary>Sendmail compatibility</primary>
3446 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3448 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3449 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3450 This option is used for rebuilding Sendmail’s alias file. Exim does not have
3451 the concept of a single alias file, but can be configured to run a given
3452 command if called with the <option>-bi</option> option.
3455 <section id="SECTtrustedadmin">
3456 <title>Trusted and admin users</title>
3458 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3459 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3460 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3461 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3462 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3467 <indexterm role="concept">
3468 <primary>trusted users</primary>
3469 <secondary>definition of</secondary>
3471 <indexterm role="concept">
3472 <primary>user</primary>
3473 <secondary>trusted definition of</secondary>
3475 The trusted users are root, the Exim user, any user listed in the
3476 <option>trusted_users</option> configuration option, and any user whose current group or any
3477 supplementary group is one of those listed in the <option>trusted_groups</option>
3478 configuration option. Note that the Exim group is not automatically trusted.
3481 <indexterm role="concept">
3482 <primary><quote>From</quote> line</primary>
3484 <indexterm role="concept">
3485 <primary>envelope sender</primary>
3487 Trusted users are always permitted to use the <option>-f</option> option or a leading
3488 <quote>From </quote> line to specify the envelope sender of a message that is passed to
3489 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3490 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3491 users to set envelope senders.
3494 <indexterm role="concept">
3495 <primary><emphasis>From:</emphasis> header line</primary>
3497 <indexterm role="concept">
3498 <primary><emphasis>Sender:</emphasis> header line</primary>
3500 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3501 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3502 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3505 Trusted users may also specify a host name, host address, interface address,
3506 protocol name, ident value, and authentication data when submitting a message
3507 locally. Thus, they are able to insert messages into Exim’s queue locally that
3508 have the characteristics of messages received from a remote host. Untrusted
3509 users may in some circumstances use <option>-f</option>, but can never set the other values
3510 that are available to trusted users.
3515 <indexterm role="concept">
3516 <primary>user</primary>
3517 <secondary>admin definition of</secondary>
3519 <indexterm role="concept">
3520 <primary>admin user</primary>
3521 <secondary>definition of</secondary>
3523 The admin users are root, the Exim user, and any user that is a member of the
3524 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3525 The current group does not have to be one of these groups.
3528 Admin users are permitted to list the queue, and to carry out certain
3529 operations on messages, for example, to force delivery failures. It is also
3530 necessary to be an admin user in order to see the full information provided by
3531 the Exim monitor, and full debugging output.
3534 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3535 Exim to attempt delivery of messages on its queue is restricted to admin users.
3536 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3537 option false (that is, specifying <option>no_prod_requires_admin</option>).
3540 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3541 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3547 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3548 edit Exim’s configuration file, you are giving those users an easy way of
3549 getting root. There is further discussion of this issue at the start of chapter
3550 <xref linkend="CHAPconf"/>.
3553 <section id="SECID39">
3554 <title>Command line options</title>
3556 Exim’s command line options are described in alphabetical order below. If none
3557 of the options that specifies a specific action (such as starting the daemon or
3558 a queue runner, or testing an address, or receiving a message in a specific
3559 format, or listing the queue) are present, and there is at least one argument
3560 on the command line, <option>-bm</option> (accept a local message on the standard input,
3561 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3562 outputs a brief message about itself and exits.
3564 <!-- === Start of command line options === -->
3567 <term><option>--</option></term>
3570 <indexterm role="option">
3571 <primary>--</primary>
3573 <indexterm role="concept">
3574 <primary>options</primary>
3575 <secondary>command line; terminating</secondary>
3577 This is a pseudo-option whose only purpose is to terminate the options and
3578 therefore to cause subsequent command line items to be treated as arguments
3579 rather than options, even if they begin with hyphens.
3581 </listitem></varlistentry>
3583 <term><option>--help</option></term>
3586 <indexterm role="option">
3587 <primary><option>--help</option></primary>
3589 This option causes Exim to output a few sentences stating what it is.
3590 The same output is generated if the Exim binary is called with no options and
3593 </listitem></varlistentry>
3594 <varlistentry revisionflag="changed">
3595 <term><option>--version</option></term>
3597 <para revisionflag="changed">
3598 <indexterm role="option">
3599 <primary><option>--version</option></primary>
3601 This option is an alias for <option>-bV</option> and causes version information to be
3604 </listitem></varlistentry>
3606 <term><option>-B</option><<emphasis>type</emphasis>></term>
3609 <indexterm role="option">
3610 <primary><option>-B</option></primary>
3612 <indexterm role="concept">
3613 <primary>8-bit characters</primary>
3615 <indexterm role="concept">
3616 <primary>Sendmail compatibility</primary>
3617 <secondary>8-bit characters</secondary>
3619 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3620 clean; it ignores this option.
3622 </listitem></varlistentry>
3624 <term><option>-bd</option></term>
3627 <indexterm role="option">
3628 <primary><option>-bd</option></primary>
3630 <indexterm role="concept">
3631 <primary>daemon</primary>
3633 <indexterm role="concept">
3634 <primary>SMTP</primary>
3635 <secondary>listener</secondary>
3637 <indexterm role="concept">
3638 <primary>queue runner</primary>
3640 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3641 the <option>-bd</option> option is combined with the <option>-q</option><<emphasis>time</emphasis>> option, to specify
3642 that the daemon should also initiate periodic queue runs.
3645 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3646 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3647 disconnect from the controlling terminal. When running this way, it can be
3648 stopped by pressing ctrl-C.
3651 By default, Exim listens for incoming connections to the standard SMTP port on
3652 all the host’s running interfaces. However, it is possible to listen on other
3653 ports, on multiple ports, and only on specific interfaces. Chapter
3654 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3657 When a listening daemon
3658 <indexterm role="concept">
3659 <primary>daemon</primary>
3660 <secondary>process id (pid)</secondary>
3662 <indexterm role="concept">
3663 <primary>pid (process id)</primary>
3664 <secondary>of daemon</secondary>
3666 is started without the use of <option>-oX</option> (that is, without overriding the normal
3667 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3668 in Exim’s spool directory. This location can be overridden by setting
3669 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3673 When <option>-oX</option> is used on the command line to start a listening daemon, the
3674 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3675 used to specify a path on the command line if a pid file is required.
3679 <indexterm role="concept">
3680 <primary>SIGHUP</primary>
3682 <indexterm role="concept">
3683 <primary>daemon</primary>
3684 <secondary>restarting</secondary>
3686 can be used to cause the daemon to re-execute itself. This should be done
3687 whenever Exim’s configuration file, or any file that is incorporated into it by
3688 means of the <option>.include</option> facility, is changed, and also whenever a new version
3689 of Exim is installed. It is not necessary to do this when other files that are
3690 referenced from the configuration (for example, alias files) are changed,
3691 because these are reread each time they are used.
3693 </listitem></varlistentry>
3695 <term><option>-bdf</option></term>
3698 <indexterm role="option">
3699 <primary><option>-bdf</option></primary>
3701 This option has the same effect as <option>-bd</option> except that it never disconnects
3702 from the controlling terminal, even when no debugging is specified.
3704 </listitem></varlistentry>
3706 <term><option>-be</option></term>
3709 <indexterm role="option">
3710 <primary><option>-be</option></primary>
3712 <indexterm role="concept">
3713 <primary>testing</primary>
3714 <secondary>string expansion</secondary>
3716 <indexterm role="concept">
3717 <primary>expansion</primary>
3718 <secondary>testing</secondary>
3720 Run Exim in expansion testing mode. Exim discards its root privilege, to
3721 prevent ordinary users from using this mode to read otherwise inaccessible
3722 files. If no arguments are given, Exim runs interactively, prompting for lines
3723 of data. Otherwise, it processes each argument in turn.
3726 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3727 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3728 used without command line arguments. If successful, it uses the <function>readline()</function>
3729 function, which provides extensive line-editing facilities, for reading the
3730 test data. A line history is supported.
3733 Long expansion expressions can be split over several lines by using backslash
3734 continuations. As in Exim’s run time configuration, white space at the start of
3735 continuation lines is ignored. Each argument or data line is passed through the
3736 string expansion mechanism, and the result is output. Variable values from the
3737 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3738 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3739 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
3742 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3743 files or databases you are using, you must exit and restart Exim before trying
3744 the same lookup again. Otherwise, because each Exim process caches the results
3745 of lookups, you will just get the same result as before.
3747 </listitem></varlistentry>
3749 <term><option>-bem</option> <<emphasis>filename</emphasis>></term>
3752 <indexterm role="option">
3753 <primary><option>-bem</option></primary>
3755 <indexterm role="concept">
3756 <primary>testing</primary>
3757 <secondary>string expansion</secondary>
3759 <indexterm role="concept">
3760 <primary>expansion</primary>
3761 <secondary>testing</secondary>
3763 This option operates like <option>-be</option> except that it must be followed by the name
3764 of a file. For example:
3766 <literallayout class="monospaced">
3767 exim -bem /tmp/testmessage
3770 The file is read as a message (as if receiving a locally-submitted non-SMTP
3771 message) before any of the test expansions are done. Thus, message-specific
3772 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3773 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3774 recipients are read from the headers in the normal way, and are shown in the
3775 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3776 line, because further arguments are taken as strings to expand (just like
3777 <option>-be</option>).
3779 </listitem></varlistentry>
3781 <term><option>-bF</option> <<emphasis>filename</emphasis>></term>
3784 <indexterm role="option">
3785 <primary><option>-bF</option></primary>
3787 <indexterm role="concept">
3788 <primary>system filter</primary>
3789 <secondary>testing</secondary>
3791 <indexterm role="concept">
3792 <primary>testing</primary>
3793 <secondary>system filter</secondary>
3795 This option is the same as <option>-bf</option> except that it assumes that the filter being
3796 tested is a system filter. The additional commands that are available only in
3797 system filters are recognized.
3799 </listitem></varlistentry>
3801 <term><option>-bf</option> <<emphasis>filename</emphasis>></term>
3804 <indexterm role="option">
3805 <primary><option>-bf</option></primary>
3807 <indexterm role="concept">
3808 <primary>filter</primary>
3809 <secondary>testing</secondary>
3811 <indexterm role="concept">
3812 <primary>testing</primary>
3813 <secondary>filter file</secondary>
3815 <indexterm role="concept">
3816 <primary>forward file</primary>
3817 <secondary>testing</secondary>
3819 <indexterm role="concept">
3820 <primary>testing</primary>
3821 <secondary>forward file</secondary>
3823 <indexterm role="concept">
3824 <primary>Sieve filter</primary>
3825 <secondary>testing</secondary>
3827 This option runs Exim in user filter testing mode; the file is the filter file
3828 to be tested, and a test message must be supplied on the standard input. If
3829 there are no message-dependent tests in the filter, an empty file can be
3833 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3834 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3835 filter and a user filter in the same run. For example:
3837 <literallayout class="monospaced">
3838 exim -bF /system/filter -bf /user/filter </test/message
3841 This is helpful when the system filter adds header lines or sets filter
3842 variables that are used by the user filter.
3845 If the test filter file does not begin with one of the special lines
3847 <literallayout class="monospaced">
3852 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3853 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3854 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3858 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3859 detected, is a list of the actions that Exim would try to take if presented
3860 with the message for real. More details of filter testing are given in the
3861 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
3864 When testing a filter file,
3865 <indexterm role="concept">
3866 <primary><quote>From</quote> line</primary>
3868 <indexterm role="concept">
3869 <primary>envelope sender</primary>
3871 <indexterm role="option">
3872 <primary><option>-f</option></primary>
3873 <secondary>for filter testing</secondary>
3875 the envelope sender can be set by the <option>-f</option> option,
3876 or by a <quote>From </quote> line at the start of the test message. Various parameters
3877 that would normally be taken from the envelope recipient address of the message
3878 can be set by means of additional command line options (see the next four
3881 </listitem></varlistentry>
3883 <term><option>-bfd</option> <<emphasis>domain</emphasis>></term>
3886 <indexterm role="option">
3887 <primary><option>-bfd</option></primary>
3889 <indexterm role="variable">
3890 <primary><varname>$qualify_domain</varname></primary>
3892 This sets the domain of the recipient address when a filter file is being
3893 tested by means of the <option>-bf</option> option. The default is the value of
3894 <varname>$qualify_domain</varname>.
3896 </listitem></varlistentry>
3898 <term><option>-bfl</option> <<emphasis>local part</emphasis>></term>
3901 <indexterm role="option">
3902 <primary><option>-bfl</option></primary>
3904 This sets the local part of the recipient address when a filter file is being
3905 tested by means of the <option>-bf</option> option. The default is the username of the
3906 process that calls Exim. A local part should be specified with any prefix or
3907 suffix stripped, because that is how it appears to the filter when a message is
3908 actually being delivered.
3910 </listitem></varlistentry>
3912 <term><option>-bfp</option> <<emphasis>prefix</emphasis>></term>
3915 <indexterm role="option">
3916 <primary><option>-bfp</option></primary>
3918 This sets the prefix of the local part of the recipient address when a filter
3919 file is being tested by means of the <option>-bf</option> option. The default is an empty
3922 </listitem></varlistentry>
3924 <term><option>-bfs</option> <<emphasis>suffix</emphasis>></term>
3927 <indexterm role="option">
3928 <primary><option>-bfs</option></primary>
3930 This sets the suffix of the local part of the recipient address when a filter
3931 file is being tested by means of the <option>-bf</option> option. The default is an empty
3934 </listitem></varlistentry>
3936 <term><option>-bh</option> <<emphasis>IP address</emphasis>></term>
3939 <indexterm role="option">
3940 <primary><option>-bh</option></primary>
3942 <indexterm role="concept">
3943 <primary>testing</primary>
3944 <secondary>incoming SMTP</secondary>
3946 <indexterm role="concept">
3947 <primary>SMTP</primary>
3948 <secondary>testing incoming</secondary>
3950 <indexterm role="concept">
3951 <primary>testing</primary>
3952 <secondary>relay control</secondary>
3954 <indexterm role="concept">
3955 <primary>relaying</primary>
3956 <secondary>testing configuration</secondary>
3958 <indexterm role="concept">
3959 <primary>policy control</primary>
3960 <secondary>testing</secondary>
3962 <indexterm role="concept">
3963 <primary>debugging</primary>
3964 <secondary><option>-bh</option> option</secondary>
3966 This option runs a fake SMTP session as if from the given IP address, using the
3967 standard input and output. The IP address may include a port number at the end,
3968 after a full stop. For example:
3970 <literallayout class="monospaced">
3971 exim -bh 10.9.8.7.1234
3972 exim -bh fe80::a00:20ff:fe86:a061.5678
3975 When an IPv6 address is given, it is converted into canonical form. In the case
3976 of the second example above, the value of <varname>$sender_host_address</varname> after
3977 conversion to the canonical form is
3978 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3981 Comments as to what is going on are written to the standard error file. These
3982 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3983 This facility is provided for testing configuration options for incoming
3984 messages, to make sure they implement the required policy. For example, you can
3985 test your relay controls using <option>-bh</option>.
3988 <emphasis role="bold">Warning 1</emphasis>:
3989 <indexterm role="concept">
3990 <primary>RFC 1413</primary>
3992 You can test features of the configuration that rely on ident (RFC 1413)
3993 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3994 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3998 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3999 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4000 occur, use <option>-bhc</option> instead.
4003 Messages supplied during the testing session are discarded, and nothing is
4004 written to any of the real log files. There may be pauses when DNS (and other)
4005 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4006 can be used to specify a specific IP interface and port if this is important,
4007 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4008 session were authenticated.
4011 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4012 output just states whether a given recipient address from a given host is
4013 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4016 Features such as authentication and encryption, where the client input is not
4017 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4018 specialized SMTP test program such as
4019 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
4021 </listitem></varlistentry>
4023 <term><option>-bhc</option> <<emphasis>IP address</emphasis>></term>
4026 <indexterm role="option">
4027 <primary><option>-bhc</option></primary>
4029 This option operates in the same way as <option>-bh</option>, except that address
4030 verification callouts are performed if required. This includes consulting and
4031 updating the callout cache database.
4033 </listitem></varlistentry>
4035 <term><option>-bi</option></term>
4038 <indexterm role="option">
4039 <primary><option>-bi</option></primary>
4041 <indexterm role="concept">
4042 <primary>alias file</primary>
4043 <secondary>building</secondary>
4045 <indexterm role="concept">
4046 <primary>building alias file</primary>
4048 <indexterm role="concept">
4049 <primary>Sendmail compatibility</primary>
4050 <secondary><option>-bi</option> option</secondary>
4052 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4053 Exim does not have the concept of a single alias file, and so it cannot mimic
4054 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4055 tend to appear in various scripts such as NIS make files, so the option must be
4059 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4060 configuration option is run, under the uid and gid of the caller of Exim. If
4061 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4062 The command set by <option>bi_command</option> may not contain arguments. The command can
4063 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4064 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4065 <option>-bi</option> is a no-op.
4067 </listitem></varlistentry>
4069 <term><option>-bm</option></term>
4072 <indexterm role="option">
4073 <primary><option>-bm</option></primary>
4075 <indexterm role="concept">
4076 <primary>local message reception</primary>
4078 This option runs an Exim receiving process that accepts an incoming,
4079 locally-generated message on the current input. The recipients are given as the
4080 command arguments (except when <option>-t</option> is also present – see below). Each
4081 argument can be a comma-separated list of RFC 2822 addresses. This is the
4082 default option for selecting the overall action of an Exim call; it is assumed
4083 if no other conflicting option is present.
4086 If any addresses in the message are unqualified (have no domain), they are
4087 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4088 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4089 suppressing this for special cases.
4092 Policy checks on the contents of local messages can be enforced by means of
4093 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4096 <indexterm role="concept">
4097 <primary>return code</primary>
4098 <secondary>for <option>-bm</option></secondary>
4100 The return code is zero if the message is successfully accepted. Otherwise, the
4101 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting – see below.
4105 <indexterm role="concept">
4106 <primary>message</primary>
4107 <secondary>format</secondary>
4109 <indexterm role="concept">
4110 <primary>format</primary>
4111 <secondary>message</secondary>
4113 <indexterm role="concept">
4114 <primary><quote>From</quote> line</primary>
4116 <indexterm role="concept">
4117 <primary>UUCP</primary>
4118 <secondary><quote>From</quote> line</secondary>
4120 <indexterm role="concept">
4121 <primary>Sendmail compatibility</primary>
4122 <secondary><quote>From</quote> line</secondary>
4124 of the message must be as defined in RFC 2822, except that, for
4125 compatibility with Sendmail and Smail, a line in one of the forms
4127 <literallayout class="monospaced">
4128 From sender Fri Jan 5 12:55 GMT 1997
4129 From sender Fri, 5 Jan 97 12:55:01
4132 (with the weekday optional, and possibly with additional text after the date)
4133 is permitted to appear at the start of the message. There appears to be no
4134 authoritative specification of the format of this line. Exim recognizes it by
4135 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4136 option, which can be changed if necessary.
4139 <indexterm role="option">
4140 <primary><option>-f</option></primary>
4141 <secondary>overriding <quote>From</quote> line</secondary>
4143 The specified sender is treated as if it were given as the argument to the
4144 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4145 preference to the address taken from the message. The caller of Exim must be a
4146 trusted user for the sender of a message to be set in this way.
4148 </listitem></varlistentry>
4150 <term><option>-bnq</option></term>
4153 <indexterm role="option">
4154 <primary><option>-bnq</option></primary>
4156 <indexterm role="concept">
4157 <primary>address qualification, suppressing</primary>
4159 By default, Exim automatically qualifies unqualified addresses (those
4160 without domains) that appear in messages that are submitted locally (that
4161 is, not over TCP/IP). This qualification applies both to addresses in
4162 envelopes, and addresses in header lines. Sender addresses are qualified using
4163 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4164 defaults to the value of <option>qualify_domain</option>).
4167 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4168 being used to re-submit messages that originally came from remote hosts after
4169 content scanning, you probably do not want to qualify unqualified addresses in
4170 header lines. (Such lines will be present only if you have not enabled a header
4171 syntax check in the appropriate ACL.)
4174 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4175 messages that originate on the local host. When this is used, unqualified
4176 addresses in the envelope provoke errors (causing message rejection) and
4177 unqualified addresses in header lines are left alone.
4179 </listitem></varlistentry>
4181 <term><option>-bP</option></term>
4184 <indexterm role="option">
4185 <primary><option>-bP</option></primary>
4187 <indexterm role="concept">
4188 <primary>configuration options</primary>
4189 <secondary>extracting</secondary>
4191 <indexterm role="concept">
4192 <primary>options</primary>
4193 <secondary>configuration – extracting</secondary>
4195 If this option is given with no arguments, it causes the values of all Exim’s
4196 main configuration options to be written to the standard output. The values
4197 of one or more specific options can be requested by giving their names as
4198 arguments, for example:
4200 <literallayout class="monospaced">
4201 exim -bP qualify_domain hold_domains
4204 <indexterm role="concept">
4205 <primary>hiding configuration option values</primary>
4207 <indexterm role="concept">
4208 <primary>configuration options</primary>
4209 <secondary>hiding value of</secondary>
4211 <indexterm role="concept">
4212 <primary>options</primary>
4213 <secondary>hiding value of</secondary>
4215 However, any option setting that is preceded by the word <quote>hide</quote> in the
4216 configuration file is not shown in full, except to an admin user. For other
4217 users, the output is as in this example:
4219 <literallayout class="monospaced">
4220 mysql_servers = <value not displayable>
4223 If <option>configure_file</option> is given as an argument, the name of the run time
4224 configuration file is output.
4225 If a list of configuration files was supplied, the value that is output here
4226 is the name of the file that was actually used.
4229 <indexterm role="concept">
4230 <primary>daemon</primary>
4231 <secondary>process id (pid)</secondary>
4233 <indexterm role="concept">
4234 <primary>pid (process id)</primary>
4235 <secondary>of daemon</secondary>
4237 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4238 directories where log files and daemon pid files are written are output,
4239 respectively. If these values are unset, log files are written in a
4240 sub-directory of the spool directory called <option>log</option>, and the pid file is
4241 written directly into the spool directory.
4244 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4246 <literallayout class="monospaced">
4247 exim -bP +local_domains
4250 it searches for a matching named list of any type (domain, host, address, or
4251 local part) and outputs what it finds.
4254 <indexterm role="concept">
4255 <primary>options</primary>
4256 <secondary>router – extracting</secondary>
4258 <indexterm role="concept">
4259 <primary>options</primary>
4260 <secondary>transport – extracting</secondary>
4262 <indexterm role="concept">
4263 <primary>options</primary>
4264 <secondary>authenticator – extracting</secondary>
4266 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4267 followed by the name of an appropriate driver instance, the option settings for
4268 that driver are output. For example:
4270 <literallayout class="monospaced">
4271 exim -bP transport local_delivery
4274 The generic driver options are output first, followed by the driver’s private
4275 options. A list of the names of drivers of a particular type can be obtained by
4276 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4277 <option>authenticator_list</option>, and a complete list of all drivers with their option
4278 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4279 <option>authenticators</option>.
4282 <indexterm role="concept">
4283 <primary>options</primary>
4284 <secondary>macro – extracting</secondary>
4286 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4287 are available, similarly to the drivers. Because macros are sometimes used
4288 for storing passwords, this option is restricted.
4289 The output format is one item per line.
4291 </listitem></varlistentry>
4293 <term><option>-bp</option></term>
4296 <indexterm role="option">
4297 <primary><option>-bp</option></primary>
4299 <indexterm role="concept">
4300 <primary>queue</primary>
4301 <secondary>listing messages on</secondary>
4303 <indexterm role="concept">
4304 <primary>listing</primary>
4305 <secondary>messages on the queue</secondary>
4307 This option requests a listing of the contents of the mail queue on the
4308 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4309 just those messages are listed. By default, this option can be used only by an
4310 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4311 to allow any user to see the queue.
4314 Each message on the queue is displayed as in the following example:
4316 <literallayout class="monospaced">
4317 25m 2.9K 0t5C6f-0000c8-00 <alice@wonderland.fict.example>
4318 red.king@looking-glass.fict.example
4319 <other addresses>
4322 <indexterm role="concept">
4323 <primary>message</primary>
4324 <secondary>size in queue listing</secondary>
4326 <indexterm role="concept">
4327 <primary>size</primary>
4328 <secondary>of message</secondary>
4330 The first line contains the length of time the message has been on the queue
4331 (in this case 25 minutes), the size of the message (2.9K), the unique local
4332 identifier for the message, and the message sender, as contained in the
4333 envelope. For bounce messages, the sender address is empty, and appears as
4334 <quote><></quote>. If the message was submitted locally by an untrusted user who overrode
4335 the default sender address, the user’s login name is shown in parentheses
4336 before the sender address.
4339 <indexterm role="concept">
4340 <primary>frozen messages</primary>
4341 <secondary>in queue listing</secondary>
4343 If the message is frozen (attempts to deliver it are suspended) then the text
4344 <quote>*** frozen ***</quote> is displayed at the end of this line.
4347 The recipients of the message (taken from the envelope, not the headers) are
4348 displayed on subsequent lines. Those addresses to which the message has already
4349 been delivered are marked with the letter D. If an original address gets
4350 expanded into several addresses via an alias or forward file, the original is
4351 displayed with a D only when deliveries for all of its child addresses are
4354 </listitem></varlistentry>
4356 <term><option>-bpa</option></term>
4359 <indexterm role="option">
4360 <primary><option>-bpa</option></primary>
4362 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4363 that were generated from the original top level address(es) in each message by
4364 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4365 of just <quote>D</quote>.
4367 </listitem></varlistentry>
4369 <term><option>-bpc</option></term>
4372 <indexterm role="option">
4373 <primary><option>-bpc</option></primary>
4375 <indexterm role="concept">
4376 <primary>queue</primary>
4377 <secondary>count of messages on</secondary>
4379 This option counts the number of messages on the queue, and writes the total
4380 to the standard output. It is restricted to admin users, unless
4381 <option>queue_list_requires_admin</option> is set false.
4383 </listitem></varlistentry>
4385 <term><option>-bpr</option></term>
4388 <indexterm role="option">
4389 <primary><option>-bpr</option></primary>
4391 This option operates like <option>-bp</option>, but the output is not sorted into
4392 chronological order of message arrival. This can speed it up when there are
4393 lots of messages on the queue, and is particularly useful if the output is
4394 going to be post-processed in a way that doesn’t need the sorting.
4396 </listitem></varlistentry>
4398 <term><option>-bpra</option></term>
4401 <indexterm role="option">
4402 <primary><option>-bpra</option></primary>
4404 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4406 </listitem></varlistentry>
4408 <term><option>-bpru</option></term>
4411 <indexterm role="option">
4412 <primary><option>-bpru</option></primary>
4414 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4416 </listitem></varlistentry>
4418 <term><option>-bpu</option></term>
4421 <indexterm role="option">
4422 <primary><option>-bpu</option></primary>
4424 This option operates like <option>-bp</option> but shows only undelivered top-level
4425 addresses for each message displayed. Addresses generated by aliasing or
4426 forwarding are not shown, unless the message was deferred after processing by a
4427 router with the <option>one_time</option> option set.
4429 </listitem></varlistentry>
4431 <term><option>-brt</option></term>
4434 <indexterm role="option">
4435 <primary><option>-brt</option></primary>
4437 <indexterm role="concept">
4438 <primary>testing</primary>
4439 <secondary>retry configuration</secondary>
4441 <indexterm role="concept">
4442 <primary>retry</primary>
4443 <secondary>configuration testing</secondary>
4445 This option is for testing retry rules, and it must be followed by up to three
4446 arguments. It causes Exim to look for a retry rule that matches the values
4447 and to write it to the standard output. For example:
4449 <literallayout class="monospaced">
4450 exim -brt bach.comp.mus.example
4451 Retry rule: *.comp.mus.example F,2h,15m; F,4d,30m;
4454 See chapter <xref linkend="CHAPretry"/> for a description of Exim’s retry rules. The first
4455 argument, which is required, can be a complete address in the form
4456 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4457 contains a dot, it is interpreted as an optional second domain name; if no
4458 retry rule is found for the first argument, the second is tried. This ties in
4459 with Exim’s behaviour when looking for retry rules for remote hosts – if no
4460 rule is found that matches the host, one that matches the mail domain is
4461 sought. Finally, an argument that is the name of a specific delivery error, as
4462 used in setting up retry rules, can be given. For example:
4464 <literallayout class="monospaced">
4465 exim -brt haydn.comp.mus.example quota_3d
4466 Retry rule: *@haydn.comp.mus.example quota_3d F,1h,15m
4468 </listitem></varlistentry>
4470 <term><option>-brw</option></term>
4473 <indexterm role="option">
4474 <primary><option>-brw</option></primary>
4476 <indexterm role="concept">
4477 <primary>testing</primary>
4478 <secondary>rewriting</secondary>
4480 <indexterm role="concept">
4481 <primary>rewriting</primary>
4482 <secondary>testing</secondary>
4484 This option is for testing address rewriting rules, and it must be followed by
4485 a single argument, consisting of either a local part without a domain, or a
4486 complete address with a fully qualified domain. Exim outputs how this address
4487 would be rewritten for each possible place it might appear. See chapter
4488 <xref linkend="CHAPrewrite"/> for further details.
4490 </listitem></varlistentry>
4492 <term><option>-bS</option></term>
4495 <indexterm role="option">
4496 <primary><option>-bS</option></primary>
4498 <indexterm role="concept">
4499 <primary>SMTP</primary>
4500 <secondary>batched incoming</secondary>
4502 <indexterm role="concept">
4503 <primary>batched SMTP input</primary>
4505 This option is used for batched SMTP input, which is an alternative interface
4506 for non-interactive local message submission. A number of messages can be
4507 submitted in a single run. However, despite its name, this is not really SMTP
4508 input. Exim reads each message’s envelope from SMTP commands on the standard
4509 input, but generates no responses. If the caller is trusted, or
4510 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4511 believed; otherwise the sender is always the caller of Exim.
4514 The message itself is read from the standard input, in SMTP format (leading
4515 dots doubled), terminated by a line containing just a single dot. An error is
4516 provoked if the terminating dot is missing. A further message may then follow.
4519 As for other local message submissions, the contents of incoming batch SMTP
4520 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4521 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4522 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4525 Some other SMTP commands are recognized in the input. HELO and EHLO act
4526 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4527 QUIT quits, ignoring the rest of the standard input.
4530 <indexterm role="concept">
4531 <primary>return code</primary>
4532 <secondary>for <option>-bS</option></secondary>
4534 If any error is encountered, reports are written to the standard output and
4535 error streams, and Exim gives up immediately. The return code is 0 if no error
4536 was detected; it is 1 if one or more messages were accepted before the error
4537 was detected; otherwise it is 2.
4540 More details of input using batched SMTP are given in section
4541 <xref linkend="SECTincomingbatchedSMTP"/>.
4543 </listitem></varlistentry>
4545 <term><option>-bs</option></term>
4548 <indexterm role="option">
4549 <primary><option>-bs</option></primary>
4551 <indexterm role="concept">
4552 <primary>SMTP</primary>
4553 <secondary>local input</secondary>
4555 <indexterm role="concept">
4556 <primary>local SMTP input</primary>
4558 This option causes Exim to accept one or more messages by reading SMTP commands
4559 on the standard input, and producing SMTP replies on the standard output. SMTP
4560 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4561 Some user agents use this interface as a way of passing locally-generated
4562 messages to the MTA.
4566 <indexterm role="concept">
4567 <primary>sender</primary>
4568 <secondary>source of</secondary>
4570 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4571 set, the senders of messages are taken from the SMTP MAIL commands.
4572 Otherwise the content of these commands is ignored and the sender is set up as
4573 the calling user. Unqualified addresses are automatically qualified using
4574 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4575 <option>-bnq</option> option is used.
4578 <indexterm role="concept">
4579 <primary>inetd</primary>
4582 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4583 using a listening daemon. Exim can distinguish the two cases by checking
4584 whether the standard input is a TCP/IP socket. When Exim is called from
4585 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4586 above concerning senders and qualification do not apply. In this situation,
4587 Exim behaves in exactly the same way as it does when receiving a message via
4588 the listening daemon.
4590 </listitem></varlistentry>
4591 <varlistentry revisionflag="changed">
4592 <term><option>-bmalware</option> <<emphasis>filename</emphasis>></term>
4594 <para revisionflag="changed">
4595 <indexterm role="option">
4596 <primary><option>-bmalware</option></primary>
4598 <indexterm role="concept">
4599 <primary>testing</primary>
4600 <secondary>,</secondary>
4602 <indexterm role="concept">
4603 <primary>malware scan test</primary>
4605 This debugging option causes Exim to scan the given file,
4606 using the malware scanning framework. The option of <option>av_scanner</option> influences
4607 this option, so if <option>av_scanner</option>’s value is dependent upon an expansion then
4608 the expansion should have defaults which apply to this invocation. ACLs are
4609 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4610 will never be populated and <option>-bmalware</option> will fail.
4612 <para revisionflag="changed">
4613 Exim will have changed working directory before resolving the filename, so
4614 using fully qualified pathnames is advisable. Exim will be running as the Exim
4615 user when it tries to open the file, rather than as the invoking user.
4616 This option requires admin privileges.
4618 <para revisionflag="changed">
4619 The <option>-bmalware</option> option will not be extended to be more generally useful,
4620 there are better tools for file-scanning. This option exists to help
4621 administrators verify their Exim and AV scanner configuration.
4623 </listitem></varlistentry>
4625 <term><option>-bt</option></term>
4628 <indexterm role="option">
4629 <primary><option>-bt</option></primary>
4631 <indexterm role="concept">
4632 <primary>testing</primary>
4633 <secondary>addresses</secondary>
4635 <indexterm role="concept">
4636 <primary>address</primary>
4637 <secondary>testing</secondary>
4639 This option runs Exim in address testing mode, in which each argument is taken
4640 as a recipient address to be tested for deliverability. The results are
4641 written to the standard output. If a test fails, and the caller is not an admin
4642 user, no details of the failure are output, because these might contain
4643 sensitive information such as usernames and passwords for database lookups.
4646 If no arguments are given, Exim runs in an interactive manner, prompting with a
4647 right angle bracket for addresses to be tested.
4650 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4651 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4655 Each address is handled as if it were the recipient address of a message
4656 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4657 written to the standard output. However, any router that has
4658 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4659 genuine routing tests if your first router passes everything to a scanner
4663 <indexterm role="concept">
4664 <primary>return code</primary>
4665 <secondary>for <option>-bt</option></secondary>
4667 The return code is 2 if any address failed outright; it is 1 if no address
4668 failed outright but at least one could not be resolved for some reason. Return
4669 code 0 is given only when all addresses succeed.
4672 <indexterm role="concept">
4673 <primary>duplicate addresses</primary>
4675 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4676 addresses after routing is complete, so that only one delivery takes place.
4677 This does not happen when testing with <option>-bt</option>; the full results of routing are
4681 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4682 routers in the configuration makes any tests on the sender address of a
4684 <indexterm role="option">
4685 <primary><option>-f</option></primary>
4686 <secondary>for address testing</secondary>
4688 you can use the <option>-f</option> option to set an appropriate sender when running
4689 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4690 default qualifying domain. However, if you have set up (for example) routers
4691 whose behaviour depends on the contents of an incoming message, you cannot test
4692 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4695 </listitem></varlistentry>
4696 <varlistentry revisionflag="changed">
4697 <term><option>-bV</option></term>
4699 <para revisionflag="changed">
4700 <indexterm role="option">
4701 <primary><option>-bV</option></primary>
4703 <indexterm role="concept">
4704 <primary>version number of Exim</primary>
4706 This option causes Exim to write the current version number, compilation
4707 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4708 It also lists the DBM library that is being used, the optional modules (such as
4709 specific lookup types), the drivers that are included in the binary, and the
4710 name of the run time configuration file that is in use.
4713 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4714 configuration file. However, this is a static check only. It cannot check
4715 values that are to be expanded. For example, although a misspelt ACL verb is
4716 detected, an error in the verb’s arguments is not. You cannot rely on <option>-bV</option>
4717 alone to discover (for example) all the typos in the configuration; some
4718 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4719 dynamic testing facilities.
4721 </listitem></varlistentry>
4723 <term><option>-bv</option></term>
4726 <indexterm role="option">
4727 <primary><option>-bv</option></primary>
4729 <indexterm role="concept">
4730 <primary>verifying address</primary>
4731 <secondary>using <option>-bv</option></secondary>
4733 <indexterm role="concept">
4734 <primary>address</primary>
4735 <secondary>verification</secondary>
4737 This option runs Exim in address verification mode, in which each argument is
4738 taken as a recipient address to be verified by the routers. (This does
4739 not involve any verification callouts). During normal operation, verification
4740 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
4741 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
4742 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
4745 If verification fails, and the caller is not an admin user, no details of the
4746 failure are output, because these might contain sensitive information such as
4747 usernames and passwords for database lookups.
4750 If no arguments are given, Exim runs in an interactive manner, prompting with a
4751 right angle bracket for addresses to be verified.
4754 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4755 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4759 Verification differs from address testing (the <option>-bt</option> option) in that routers
4760 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4761 router that has <option>fail_verify</option> set, verification fails. The address is
4762 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4763 address, <option>-bvs</option> should be used.
4766 If the <option>-v</option> option is not set, the output consists of a single line for each
4767 address, stating whether it was verified or not, and giving a reason in the
4768 latter case. Without <option>-v</option>, generating more than one address by redirection
4769 causes verification to end successfully, without considering the generated
4770 addresses. However, if just one address is generated, processing continues,
4771 and the generated address must verify successfully for the overall verification
4775 When <option>-v</option> is set, more details are given of how the address has been handled,
4776 and in the case of address redirection, all the generated addresses are also
4777 considered. Verification may succeed for some and fail for others.
4781 <indexterm role="concept">
4782 <primary>return code</primary>
4783 <secondary>for <option>-bv</option></secondary>
4785 return code is 2 if any address failed outright; it is 1 if no address
4786 failed outright but at least one could not be resolved for some reason. Return
4787 code 0 is given only when all addresses succeed.
4790 If any of the routers in the configuration makes any tests on the sender
4791 address of a message, you should use the <option>-f</option> option to set an appropriate
4792 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4793 calling user at the default qualifying domain.
4795 </listitem></varlistentry>
4797 <term><option>-bvs</option></term>
4800 <indexterm role="option">
4801 <primary><option>-bvs</option></primary>
4803 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4804 than a recipient address. This affects any rewriting and qualification that
4807 </listitem></varlistentry>
4809 <term><option>-C</option> <<emphasis>filelist</emphasis>></term>
4812 <indexterm role="option">
4813 <primary><option>-C</option></primary>
4815 <indexterm role="concept">
4816 <primary>configuration file</primary>
4817 <secondary>alternate</secondary>
4819 <indexterm role="concept">
4820 <primary>CONFIGURE_FILE</primary>
4822 <indexterm role="concept">
4823 <primary>alternate configuration file</primary>
4825 This option causes Exim to find the run time configuration file from the given
4826 list instead of from the list specified by the CONFIGURE_FILE
4827 compile-time setting. Usually, the list will consist of just a single file
4828 name, but it can be a colon-separated list of names. In this case, the first
4829 file that exists is used. Failure to open an existing file stops Exim from
4830 proceeding any further along the list, and an error is generated.
4832 <para revisionflag="changed">
4833 When this option is used by a caller other than root, and the list is different
4834 from the compiled-in list, Exim gives up its root privilege immediately, and
4835 runs with the real and effective uid and gid set to those of the caller.
4836 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
4837 file contains a list of full pathnames, one per line, for configuration files
4838 which are trusted. Root privilege is retained for any configuration file so
4839 listed, as long as the caller is the Exim user (or the user specified in the
4840 CONFIGURE_OWNER option, if any), and as long as the configuration file is
4841 not writeable by inappropriate users or groups.
4843 <para revisionflag="changed">
4844 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
4845 configuration using <option>-C</option> right through message reception and delivery,
4846 even if the caller is root. The reception works, but by that time, Exim is
4847 running as the Exim user, so when it re-executes to regain privilege for the
4848 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
4849 test reception and delivery using two separate commands (one to put a message
4850 on the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4853 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4854 prefix string with which any file named in a <option>-C</option> command line option
4855 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4856 However, if the value of the <option>-C</option> option is identical to the value of
4857 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4858 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4859 unset, any file name can be used with <option>-C</option>.
4862 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4863 to a directory to which only root has access. This prevents someone who has
4864 broken into the Exim account from running a privileged Exim with an arbitrary
4868 The <option>-C</option> facility is useful for ensuring that configuration files are
4869 syntactically correct, but cannot be used for test deliveries, unless the
4870 caller is privileged, or unless it is an exotic configuration that does not
4871 require privilege. No check is made on the owner or group of the files
4872 specified by this option.
4874 </listitem></varlistentry>
4876 <term><option>-D</option><<emphasis>macro</emphasis>>=<<emphasis>value</emphasis>></term>
4879 <indexterm role="option">
4880 <primary><option>-D</option></primary>
4882 <indexterm role="concept">
4883 <primary>macro</primary>
4884 <secondary>setting on command line</secondary>
4886 This option can be used to override macro definitions in the configuration file
4887 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4888 unprivileged caller, it causes Exim to give up its root privilege.
4889 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4890 completely disabled, and its use causes an immediate error exit.
4892 <para revisionflag="changed">
4893 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
4894 colon-separated list of macros which are considered safe and, if <option>-D</option> only
4895 supplies macros from this list, and the values are acceptable, then Exim will
4896 not give up root privilege if the caller is root, the Exim run-time user, or
4897 the CONFIGURE_OWNER, if set. This is a transition mechanism and is expected
4898 to be removed in the future. Acceptable values for the macros satisfy the
4899 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
4902 The entire option (including equals sign if present) must all be within one
4903 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4904 string, in which case the equals sign is optional. These two commands are
4907 <literallayout class="monospaced">
4912 To include spaces in a macro definition item, quotes must be used. If you use
4913 quotes, spaces are permitted around the macro name and the equals sign. For
4916 <literallayout class="monospaced">
4917 exim '-D ABC = something' ...
4920 <option>-D</option> may be repeated up to 10 times on a command line.
4922 </listitem></varlistentry>
4924 <term><option>-d</option><<emphasis>debug options</emphasis>></term>
4927 <indexterm role="option">
4928 <primary><option>-d</option></primary>
4930 <indexterm role="concept">
4931 <primary>debugging</primary>
4932 <secondary>list of selectors</secondary>
4934 <indexterm role="concept">
4935 <primary>debugging</primary>
4936 <secondary><option>-d</option> option</secondary>
4938 This option causes debugging information to be written to the standard
4939 error stream. It is restricted to admin users because debugging output may show
4940 database queries that contain password information. Also, the details of users’
4941 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
4942 writes an error message to the standard error stream and exits with a non-zero
4946 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4947 standard debugging data is output. This can be reduced, or increased to include
4948 some more rarely needed information, by directly following <option>-d</option> with a string
4949 made up of names preceded by plus or minus characters. These add or remove sets
4950 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4951 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4952 no spaces are allowed in the debug setting. The available debugging categories
4956 <literal>acl </literal> ACL interpretation
4957 <literal>auth </literal> authenticators
4958 <literal>deliver </literal> general delivery logic
4959 <literal>dns </literal> DNS lookups (see also resolver)
4960 <literal>dnsbl </literal> DNS black list (aka RBL) code
4961 <literal>exec </literal> arguments for <function>execv()</function> calls
4962 <literal>expand </literal> detailed debugging for string expansions
4963 <literal>filter </literal> filter handling
4964 <literal>hints_lookup </literal> hints data lookups
4965 <literal>host_lookup </literal> all types of name-to-IP address handling
4966 <literal>ident </literal> ident lookup
4967 <literal>interface </literal> lists of local interfaces
4968 <literal>lists </literal> matching things in lists
4969 <literal>load </literal> system load checks
4970 <literal>local_scan </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4971 <literal>lookup </literal> general lookup code and all lookups
4972 <literal>memory </literal> memory handling
4973 <literal>pid </literal> add pid to debug output lines
4974 <literal>process_info </literal> setting info for the process log
4975 <literal>queue_run </literal> queue runs
4976 <literal>receive </literal> general message reception logic
4977 <literal>resolver </literal> turn on the DNS resolver’s debugging output
4978 <literal>retry </literal> retry handling
4979 <literal>rewrite </literal> address rewriting
4980 <literal>route </literal> address routing
4981 <literal>timestamp </literal> add timestamp to debug output lines
4982 <literal>tls </literal> TLS logic
4983 <literal>transport </literal> transports
4984 <literal>uid </literal> changes of uid/gid and looking up uid/gid
4985 <literal>verify </literal> address verification logic
4986 <literal>all </literal> almost all of the above (see below), and also <option>-v</option>
4989 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4990 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4991 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4992 is included, an awful lot of output that is very rarely of interest is
4993 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4994 turn everything off.
4997 <indexterm role="concept">
4998 <primary>resolver, debugging output</primary>
5000 <indexterm role="concept">
5001 <primary>DNS resolver, debugging output</primary>
5003 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5004 with DEBUG enabled. This is not the case in some operating systems. Also,
5005 unfortunately, debugging output from the DNS resolver is written to stdout
5009 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5010 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5011 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5012 daemon, which then passes it on to any re-executed Exims. Exim also
5013 automatically adds the pid to debug lines when several remote deliveries are
5017 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5018 of all debug output lines. This can be useful when trying to track down delays
5022 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5023 any debugging is selected, or if <option>-v</option> is used.
5025 </listitem></varlistentry>
5027 <term><option>-dd</option><<emphasis>debug options</emphasis>></term>
5030 <indexterm role="option">
5031 <primary><option>-dd</option></primary>
5033 This option behaves exactly like <option>-d</option> except when used on a command that
5034 starts a daemon process. In that case, debugging is turned off for the
5035 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5036 behaviour of the daemon without creating as much output as full debugging does.
5038 </listitem></varlistentry>
5040 <term><option>-dropcr</option></term>
5043 <indexterm role="option">
5044 <primary><option>-dropcr</option></primary>
5046 This is an obsolete option that is now a no-op. It used to affect the way Exim
5047 handled CR and LF characters in incoming messages. What happens now is
5048 described in section <xref linkend="SECTlineendings"/>.
5050 </listitem></varlistentry>
5052 <term><option>-E</option></term>
5055 <indexterm role="option">
5056 <primary><option>-E</option></primary>
5058 <indexterm role="concept">
5059 <primary>bounce message</primary>
5060 <secondary>generating</secondary>
5062 This option specifies that an incoming message is a locally-generated delivery
5063 failure report. It is used internally by Exim when handling delivery failures
5064 and is not intended for external use. Its only effect is to stop Exim
5065 generating certain messages to the postmaster, as otherwise message cascades
5066 could occur in some situations. As part of the same option, a message id may
5067 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5068 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5070 </listitem></varlistentry>
5072 <term><option>-e</option><emphasis>x</emphasis></term>
5075 <indexterm role="option">
5076 <primary><option>-e</option><emphasis>x</emphasis></primary>
5078 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5079 called by various programs without the leading <option>o</option> in the option. For
5080 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5081 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5083 </listitem></varlistentry>
5085 <term><option>-F</option> <<emphasis>string</emphasis>></term>
5088 <indexterm role="option">
5089 <primary><option>-F</option></primary>
5091 <indexterm role="concept">
5092 <primary>sender</primary>
5093 <secondary>name</secondary>
5095 <indexterm role="concept">
5096 <primary>name</primary>
5097 <secondary>of sender</secondary>
5099 This option sets the sender’s full name for use when a locally-generated
5100 message is being accepted. In the absence of this option, the user’s <emphasis>gecos</emphasis>
5101 entry from the password data is used. As users are generally permitted to alter
5102 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5103 between <option>-F</option> and the <<emphasis>string</emphasis>> is optional.
5105 </listitem></varlistentry>
5107 <term><option>-f</option> <<emphasis>address</emphasis>></term>
5110 <indexterm role="option">
5111 <primary><option>-f</option></primary>
5113 <indexterm role="concept">
5114 <primary>sender</primary>
5115 <secondary>address</secondary>
5117 <indexterm role="concept">
5118 <primary>address</primary>
5119 <secondary>sender</secondary>
5121 <indexterm role="concept">
5122 <primary>trusted users</primary>
5124 <indexterm role="concept">
5125 <primary>envelope sender</primary>
5127 <indexterm role="concept">
5128 <primary>user</primary>
5129 <secondary>trusted</secondary>
5131 This option sets the address of the envelope sender of a locally-generated
5132 message (also known as the return path). The option can normally be used only
5133 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5137 Processes running as root or the Exim user are always trusted. Other
5138 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5139 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5140 of a local message is set to the caller’s login name at the default qualify
5144 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5145 can be specified by any user, trusted or not, to create a message that can
5146 never provoke a bounce. An empty sender can be specified either as an empty
5147 string, or as a pair of angle brackets with nothing between them, as in these
5148 examples of shell commands:
5150 <literallayout class="monospaced">
5151 exim -f '<>' user@domain
5152 exim -f "" user@domain
5155 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5156 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5157 <option>-bv</option> options.
5160 Allowing untrusted users to change the sender address does not of itself make
5161 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5162 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5163 though this can be overridden by setting <option>no_local_from_check</option>.
5167 <indexterm role="concept">
5168 <primary><quote>From</quote> line</primary>
5170 space between <option>-f</option> and the <<emphasis>address</emphasis>> is optional (that is, they can be
5171 given as two arguments or one combined argument). The sender of a
5172 locally-generated message can also be set (when permitted) by an initial
5173 <quote>From </quote> line in the message – see the description of <option>-bm</option> above – but
5174 if <option>-f</option> is also present, it overrides <quote>From </quote>.
5176 </listitem></varlistentry>
5178 <term><option>-G</option></term>
5181 <indexterm role="option">
5182 <primary><option>-G</option></primary>
5184 <indexterm role="concept">
5185 <primary>Sendmail compatibility</primary>
5186 <secondary><option>-G</option> option ignored</secondary>
5188 This is a Sendmail option which is ignored by Exim.
5190 </listitem></varlistentry>
5192 <term><option>-h</option> <<emphasis>number</emphasis>></term>
5195 <indexterm role="option">
5196 <primary><option>-h</option></primary>
5198 <indexterm role="concept">
5199 <primary>Sendmail compatibility</primary>
5200 <secondary><option>-h</option> option ignored</secondary>
5202 This option is accepted for compatibility with Sendmail, but has no effect. (In
5203 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5206 </listitem></varlistentry>
5208 <term><option>-i</option></term>
5211 <indexterm role="option">
5212 <primary><option>-i</option></primary>
5214 <indexterm role="concept">
5215 <primary>Solaris</primary>
5216 <secondary><emphasis>mail</emphasis> command</secondary>
5218 <indexterm role="concept">
5219 <primary>dot</primary>
5220 <secondary>in incoming non-SMTP message</secondary>
5222 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5223 line by itself should not terminate an incoming, non-SMTP message. I can find
5224 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5225 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5227 </listitem></varlistentry>
5229 <term><option>-M</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5232 <indexterm role="option">
5233 <primary><option>-M</option></primary>
5235 <indexterm role="concept">
5236 <primary>forcing delivery</primary>
5238 <indexterm role="concept">
5239 <primary>delivery</primary>
5240 <secondary>forcing attempt</secondary>
5242 <indexterm role="concept">
5243 <primary>frozen messages</primary>
5244 <secondary>forcing delivery</secondary>
5246 This option requests Exim to run a delivery attempt on each message in turn. If
5247 any of the messages are frozen, they are automatically thawed before the
5248 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5249 and <option>hold_domains</option> are ignored.
5253 <indexterm role="concept">
5254 <primary>hints database</primary>
5255 <secondary>overriding retry hints</secondary>
5257 hints for any of the addresses are overridden – Exim tries to deliver even if
5258 the normal retry time has not yet been reached. This option requires the caller
5259 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5260 which can be set false to relax this restriction (and also the same requirement
5261 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5264 The deliveries happen synchronously, that is, the original Exim process does
5265 not terminate until all the delivery attempts have finished. No output is
5266 produced unless there is a serious error. If you want to see what is happening,
5267 use the <option>-v</option> option as well, or inspect Exim’s main log.
5269 </listitem></varlistentry>
5271 <term><option>-Mar</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5274 <indexterm role="option">
5275 <primary><option>-Mar</option></primary>
5277 <indexterm role="concept">
5278 <primary>message</primary>
5279 <secondary>adding recipients</secondary>
5281 <indexterm role="concept">
5282 <primary>recipient</primary>
5283 <secondary>adding</secondary>
5285 This option requests Exim to add the addresses to the list of recipients of the
5286 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5287 id, and the remaining ones must be email addresses. However, if the message is
5288 active (in the middle of a delivery attempt), it is not altered. This option
5289 can be used only by an admin user.
5291 </listitem></varlistentry>
5293 <term><option>-MC</option> <<emphasis>transport</emphasis>> <<emphasis>hostname</emphasis>> <<emphasis>sequence number</emphasis>> <<emphasis>message id</emphasis>></term>
5296 <indexterm role="option">
5297 <primary><option>-MC</option></primary>
5299 <indexterm role="concept">
5300 <primary>SMTP</primary>
5301 <secondary>passed connection</secondary>
5303 <indexterm role="concept">
5304 <primary>SMTP</primary>
5305 <secondary>multiple deliveries</secondary>
5307 <indexterm role="concept">
5308 <primary>multiple SMTP deliveries</primary>
5310 This option is not intended for use by external callers. It is used internally
5311 by Exim to invoke another instance of itself to deliver a waiting message using
5312 an existing SMTP connection, which is passed as the standard input. Details are
5313 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5314 must be root or the Exim user in order to use it.
5316 </listitem></varlistentry>
5318 <term><option>-MCA</option></term>
5321 <indexterm role="option">
5322 <primary><option>-MCA</option></primary>
5324 This option is not intended for use by external callers. It is used internally
5325 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5326 connection to the remote host has been authenticated.
5328 </listitem></varlistentry>
5330 <term><option>-MCP</option></term>
5333 <indexterm role="option">
5334 <primary><option>-MCP</option></primary>
5336 This option is not intended for use by external callers. It is used internally
5337 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5338 which Exim is connected supports pipelining.
5340 </listitem></varlistentry>
5342 <term><option>-MCQ</option> <<emphasis>process id</emphasis>> <<emphasis>pipe fd</emphasis>></term>
5345 <indexterm role="option">
5346 <primary><option>-MCQ</option></primary>
5348 This option is not intended for use by external callers. It is used internally
5349 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5350 started by a queue runner. It passes on the process id of the queue runner,
5351 together with the file descriptor number of an open pipe. Closure of the pipe
5352 signals the final completion of the sequence of processes that are passing
5353 messages through the same SMTP connection.
5355 </listitem></varlistentry>
5357 <term><option>-MCS</option></term>
5360 <indexterm role="option">
5361 <primary><option>-MCS</option></primary>
5363 This option is not intended for use by external callers. It is used internally
5364 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5365 SMTP SIZE option should be used on messages delivered down the existing
5368 </listitem></varlistentry>
5370 <term><option>-MCT</option></term>
5373 <indexterm role="option">
5374 <primary><option>-MCT</option></primary>
5376 This option is not intended for use by external callers. It is used internally
5377 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5378 host to which Exim is connected supports TLS encryption.
5380 </listitem></varlistentry>
5382 <term><option>-Mc</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5385 <indexterm role="option">
5386 <primary><option>-Mc</option></primary>
5388 <indexterm role="concept">
5389 <primary>hints database</primary>
5390 <secondary>not overridden by <option>-Mc</option></secondary>
5392 <indexterm role="concept">
5393 <primary>delivery</primary>
5394 <secondary>manually started – not forced</secondary>
5396 This option requests Exim to run a delivery attempt on each message in turn,
5397 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5398 that are found. This option is not very useful to external callers. It is
5399 provided mainly for internal use by Exim when it needs to re-invoke itself in
5400 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5401 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5402 respects retry times and other options such as <option>hold_domains</option> that are
5403 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5404 If you want to run a specific delivery as if in a queue run, you should use
5405 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5406 and other deliveries is made in one or two places.
5408 </listitem></varlistentry>
5410 <term><option>-Mes</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>></term>
5413 <indexterm role="option">
5414 <primary><option>-Mes</option></primary>
5416 <indexterm role="concept">
5417 <primary>message</primary>
5418 <secondary>changing sender</secondary>
5420 <indexterm role="concept">
5421 <primary>sender</primary>
5422 <secondary>changing</secondary>
5424 This option requests Exim to change the sender address in the message to the
5425 given address, which must be a fully qualified address or <quote><></quote> (<quote>es</quote> for
5426 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5427 be a message id, and the second one an email address. However, if the message
5428 is active (in the middle of a delivery attempt), its status is not altered.
5429 This option can be used only by an admin user.
5431 </listitem></varlistentry>
5433 <term><option>-Mf</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5436 <indexterm role="option">
5437 <primary><option>-Mf</option></primary>
5439 <indexterm role="concept">
5440 <primary>freezing messages</primary>
5442 <indexterm role="concept">
5443 <primary>message</primary>
5444 <secondary>manually freezing</secondary>
5446 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5447 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5448 either manually or as a result of the <option>auto_thaw</option> configuration option.
5449 However, if any of the messages are active (in the middle of a delivery
5450 attempt), their status is not altered. This option can be used only by an admin
5453 </listitem></varlistentry>
5455 <term><option>-Mg</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5458 <indexterm role="option">
5459 <primary><option>-Mg</option></primary>
5461 <indexterm role="concept">
5462 <primary>giving up on messages</primary>
5464 <indexterm role="concept">
5465 <primary>message</primary>
5466 <secondary>abandoning delivery attempts</secondary>
5468 <indexterm role="concept">
5469 <primary>delivery</primary>
5470 <secondary>abandoning further attempts</secondary>
5472 This option requests Exim to give up trying to deliver the listed messages,
5473 including any that are frozen. However, if any of the messages are active,
5474 their status is not altered. For non-bounce messages, a delivery error message
5475 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5476 Bounce messages are just discarded. This option can be used only by an admin
5479 </listitem></varlistentry>
5481 <term><option>-Mmad</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5484 <indexterm role="option">
5485 <primary><option>-Mmad</option></primary>
5487 <indexterm role="concept">
5488 <primary>delivery</primary>
5489 <secondary>cancelling all</secondary>
5491 This option requests Exim to mark all the recipient addresses in the messages
5492 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5493 message is active (in the middle of a delivery attempt), its status is not
5494 altered. This option can be used only by an admin user.
5496 </listitem></varlistentry>
5498 <term><option>-Mmd</option> <<emphasis>message id</emphasis>> <<emphasis>address</emphasis>> <<emphasis>address</emphasis>> ...</term>
5501 <indexterm role="option">
5502 <primary><option>-Mmd</option></primary>
5504 <indexterm role="concept">
5505 <primary>delivery</primary>
5506 <secondary>cancelling by address</secondary>
5508 <indexterm role="concept">
5509 <primary>recipient</primary>
5510 <secondary>removing</secondary>
5512 <indexterm role="concept">
5513 <primary>removing recipients</primary>
5515 This option requests Exim to mark the given addresses as already delivered
5516 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5517 the remaining ones must be email addresses. These are matched to recipient
5518 addresses in the message in a case-sensitive manner. If the message is active
5519 (in the middle of a delivery attempt), its status is not altered. This option
5520 can be used only by an admin user.
5522 </listitem></varlistentry>
5524 <term><option>-Mrm</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5527 <indexterm role="option">
5528 <primary><option>-Mrm</option></primary>
5530 <indexterm role="concept">
5531 <primary>removing messages</primary>
5533 <indexterm role="concept">
5534 <primary>abandoning mail</primary>
5536 <indexterm role="concept">
5537 <primary>message</primary>
5538 <secondary>manually discarding</secondary>
5540 This option requests Exim to remove the given messages from the queue. No
5541 bounce messages are sent; each message is simply forgotten. However, if any of
5542 the messages are active, their status is not altered. This option can be used
5543 only by an admin user or by the user who originally caused the message to be
5544 placed on the queue.
5546 </listitem></varlistentry>
5548 <term><option>-Mset</option> <<emphasis>message id</emphasis>></term>
5551 <indexterm role="option">
5552 <primary><option>-Mset</option></primary>
5554 <indexterm role="concept">
5555 <primary>testing</primary>
5556 <secondary>string expansion</secondary>
5558 <indexterm role="concept">
5559 <primary>expansion</primary>
5560 <secondary>testing</secondary>
5562 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5563 string expansions). Exim loads the given message from its spool before doing
5564 the test expansions, thus setting message-specific variables such as
5565 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5566 available. This feature is provided to make it easier to test expansions that
5567 make use of these variables. However, this option can be used only by an admin
5568 user. See also <option>-bem</option>.
5570 </listitem></varlistentry>
5572 <term><option>-Mt</option> <<emphasis>message id</emphasis>> <<emphasis>message id</emphasis>> ...</term>
5575 <indexterm role="option">
5576 <primary><option>-Mt</option></primary>
5578 <indexterm role="concept">
5579 <primary>thawing messages</primary>
5581 <indexterm role="concept">
5582 <primary>unfreezing messages</primary>
5584 <indexterm role="concept">
5585 <primary>frozen messages</primary>
5586 <secondary>thawing</secondary>
5588 <indexterm role="concept">
5589 <primary>message</primary>
5590 <secondary>thawing frozen</secondary>
5592 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5593 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5594 messages are active, their status is not altered. This option can be used only
5597 </listitem></varlistentry>
5599 <term><option>-Mvb</option> <<emphasis>message id</emphasis>></term>
5602 <indexterm role="option">
5603 <primary><option>-Mvb</option></primary>
5605 <indexterm role="concept">
5606 <primary>listing</primary>
5607 <secondary>message body</secondary>
5609 <indexterm role="concept">
5610 <primary>message</primary>
5611 <secondary>listing body of</secondary>
5613 This option causes the contents of the message body (-D) spool file to be
5614 written to the standard output. This option can be used only by an admin user.
5616 </listitem></varlistentry>
5617 <varlistentry revisionflag="changed">
5618 <term><option>-Mvc</option> <<emphasis>message id</emphasis>></term>
5620 <para revisionflag="changed">
5621 <indexterm role="option">
5622 <primary><option>-Mvc</option></primary>
5624 <indexterm role="concept">
5625 <primary>message</primary>
5626 <secondary>listing in RFC 2822 format</secondary>
5628 <indexterm role="concept">
5629 <primary>listing</primary>
5630 <secondary>message in RFC 2822 format</secondary>
5632 This option causes a copy of the complete message (header lines plus body) to
5633 be written to the standard output in RFC 2822 format. This option can be used
5634 only by an admin user.
5636 </listitem></varlistentry>
5638 <term><option>-Mvh</option> <<emphasis>message id</emphasis>></term>
5641 <indexterm role="option">
5642 <primary><option>-Mvh</option></primary>
5644 <indexterm role="concept">
5645 <primary>listing</primary>
5646 <secondary>message headers</secondary>
5648 <indexterm role="concept">
5649 <primary>header lines</primary>
5650 <secondary>listing</secondary>
5652 <indexterm role="concept">
5653 <primary>message</primary>
5654 <secondary>listing header lines</secondary>
5656 This option causes the contents of the message headers (-H) spool file to be
5657 written to the standard output. This option can be used only by an admin user.
5659 </listitem></varlistentry>
5661 <term><option>-Mvl</option> <<emphasis>message id</emphasis>></term>
5664 <indexterm role="option">
5665 <primary><option>-Mvl</option></primary>
5667 <indexterm role="concept">
5668 <primary>listing</primary>
5669 <secondary>message log</secondary>
5671 <indexterm role="concept">
5672 <primary>message</primary>
5673 <secondary>listing message log</secondary>
5675 This option causes the contents of the message log spool file to be written to
5676 the standard output. This option can be used only by an admin user.
5678 </listitem></varlistentry>
5680 <term><option>-m</option></term>
5683 <indexterm role="option">
5684 <primary><option>-m</option></primary>
5686 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5687 treats it that way too.
5689 </listitem></varlistentry>
5691 <term><option>-N</option></term>
5694 <indexterm role="option">
5695 <primary><option>-N</option></primary>
5697 <indexterm role="concept">
5698 <primary>debugging</primary>
5699 <secondary><option>-N</option> option</secondary>
5701 <indexterm role="concept">
5702 <primary>debugging</primary>
5703 <secondary>suppressing delivery</secondary>
5705 This is a debugging option that inhibits delivery of a message at the transport
5706 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery –
5707 it just doesn’t actually transport the message, but instead behaves as if it
5708 had successfully done so. However, it does not make any updates to the retry
5709 database, and the log entries for deliveries are flagged with <quote>*></quote> rather
5710 than <quote>=></quote>.
5713 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5714 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5715 words, an ordinary user can use it only when supplying an incoming message to
5716 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5717 address may be deferred because of a configuration problem on a transport, or a
5718 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5719 the message, and applies to any subsequent delivery attempts that may happen
5722 </listitem></varlistentry>
5724 <term><option>-n</option></term>
5727 <indexterm role="option">
5728 <primary><option>-n</option></primary>
5730 <indexterm role="concept">
5731 <primary>Sendmail compatibility</primary>
5732 <secondary><option>-n</option> option ignored</secondary>
5734 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5737 </listitem></varlistentry>
5739 <term><option>-O</option> <<emphasis>data</emphasis>></term>
5742 <indexterm role="option">
5743 <primary><option>-O</option></primary>
5745 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5748 </listitem></varlistentry>
5750 <term><option>-oA</option> <<emphasis>file name</emphasis>></term>
5753 <indexterm role="option">
5754 <primary><option>-oA</option></primary>
5756 <indexterm role="concept">
5757 <primary>Sendmail compatibility</primary>
5758 <secondary><option>-oA</option> option</secondary>
5760 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5761 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5764 </listitem></varlistentry>
5766 <term><option>-oB</option> <<emphasis>n</emphasis>></term>
5769 <indexterm role="option">
5770 <primary><option>-oB</option></primary>
5772 <indexterm role="concept">
5773 <primary>SMTP</primary>
5774 <secondary>passed connection</secondary>
5776 <indexterm role="concept">
5777 <primary>SMTP</primary>
5778 <secondary>multiple deliveries</secondary>
5780 <indexterm role="concept">
5781 <primary>multiple SMTP deliveries</primary>
5783 This is a debugging option which limits the maximum number of messages that can
5784 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5785 transport. If <<emphasis>n</emphasis>> is omitted, the limit is set to 1.
5787 </listitem></varlistentry>
5789 <term><option>-odb</option></term>
5792 <indexterm role="option">
5793 <primary><option>-odb</option></primary>
5795 <indexterm role="concept">
5796 <primary>background delivery</primary>
5798 <indexterm role="concept">
5799 <primary>delivery</primary>
5800 <secondary>in the background</secondary>
5802 This option applies to all modes in which Exim accepts incoming messages,
5803 including the listening daemon. It requests <quote>background</quote> delivery of such
5804 messages, which means that the accepting process automatically starts a
5805 delivery process for each message received, but does not wait for the delivery
5806 processes to finish.
5809 When all the messages have been received, the reception process exits,
5810 leaving the delivery processes to finish in their own time. The standard output
5811 and error streams are closed at the start of each delivery process.
5812 This is the default action if none of the <option>-od</option> options are present.
5815 If one of the queueing options in the configuration file
5816 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5817 overrides it if <option>queue_only_override</option> is set true, which is the default
5818 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5820 </listitem></varlistentry>
5822 <term><option>-odf</option></term>
5825 <indexterm role="option">
5826 <primary><option>-odf</option></primary>
5828 <indexterm role="concept">
5829 <primary>foreground delivery</primary>
5831 <indexterm role="concept">
5832 <primary>delivery</primary>
5833 <secondary>in the foreground</secondary>
5835 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5836 accepted a locally-generated message. (For the daemon it is exactly the same as
5837 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5838 and Exim waits for it to complete before proceeding.
5841 The original Exim reception process does not finish until the delivery
5842 process for the final message has ended. The standard error stream is left open
5846 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5847 false and one of the queueing options in the configuration file is in effect.
5850 If there is a temporary delivery error during foreground delivery, the
5851 message is left on the queue for later delivery, and the original reception
5852 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5853 restricted configuration that never queues messages.
5855 </listitem></varlistentry>
5857 <term><option>-odi</option></term>
5860 <indexterm role="option">
5861 <primary><option>-odi</option></primary>
5863 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5866 </listitem></varlistentry>
5868 <term><option>-odq</option></term>
5871 <indexterm role="option">
5872 <primary><option>-odq</option></primary>
5874 <indexterm role="concept">
5875 <primary>non-immediate delivery</primary>
5877 <indexterm role="concept">
5878 <primary>delivery</primary>
5879 <secondary>suppressing immediate</secondary>
5881 <indexterm role="concept">
5882 <primary>queueing incoming messages</primary>
5884 This option applies to all modes in which Exim accepts incoming messages,
5885 including the listening daemon. It specifies that the accepting process should
5886 not automatically start a delivery process for each message received. Messages
5887 are placed on the queue, and remain there until a subsequent queue runner
5888 process encounters them. There are several configuration options (such as
5889 <option>queue_only</option>) that can be used to queue incoming messages under certain
5890 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5893 </listitem></varlistentry>
5895 <term><option>-odqs</option></term>
5898 <indexterm role="option">
5899 <primary><option>-odqs</option></primary>
5901 <indexterm role="concept">
5902 <primary>SMTP</primary>
5903 <secondary>delaying delivery</secondary>
5905 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5906 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5907 <option>queue_only_override</option> is false and one of the queueing options in the
5908 configuration file is in effect.
5911 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5912 message, in the background by default, but in the foreground if <option>-odi</option> is
5913 also present. The recipient addresses are routed, and local deliveries are done
5914 in the normal way. However, if any SMTP deliveries are required, they are not
5915 done at this time, so the message remains on the queue until a subsequent queue
5916 runner process encounters it. Because routing was done, Exim knows which
5917 messages are waiting for which hosts, and so a number of messages for the same
5918 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5919 configuration option has the same effect for specific domains. See also the
5920 <option>-qq</option> option.
5922 </listitem></varlistentry>
5924 <term><option>-oee</option></term>
5927 <indexterm role="option">
5928 <primary><option>-oee</option></primary>
5930 <indexterm role="concept">
5931 <primary>error</primary>
5932 <secondary>reporting</secondary>
5934 If an error is detected while a non-SMTP message is being received (for
5935 example, a malformed address), the error is reported to the sender in a mail
5939 <indexterm role="concept">
5940 <primary>return code</primary>
5941 <secondary>for <option>-oee</option></secondary>
5944 this error message is successfully sent, the Exim receiving process
5945 exits with a return code of zero. If not, the return code is 2 if the problem
5946 is that the original message has no recipients, or 1 any other error. This is
5947 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5949 </listitem></varlistentry>
5951 <term><option>-oem</option></term>
5954 <indexterm role="option">
5955 <primary><option>-oem</option></primary>
5957 <indexterm role="concept">
5958 <primary>error</primary>
5959 <secondary>reporting</secondary>
5961 <indexterm role="concept">
5962 <primary>return code</primary>
5963 <secondary>for <option>-oem</option></secondary>
5965 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5966 return code, whether or not the error message was successfully sent.
5967 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5969 </listitem></varlistentry>
5971 <term><option>-oep</option></term>
5974 <indexterm role="option">
5975 <primary><option>-oep</option></primary>
5977 <indexterm role="concept">
5978 <primary>error</primary>
5979 <secondary>reporting</secondary>
5981 If an error is detected while a non-SMTP message is being received, the
5982 error is reported by writing a message to the standard error file (stderr).
5983 <indexterm role="concept">
5984 <primary>return code</primary>
5985 <secondary>for <option>-oep</option></secondary>
5987 The return code is 1 for all errors.
5989 </listitem></varlistentry>
5991 <term><option>-oeq</option></term>
5994 <indexterm role="option">
5995 <primary><option>-oeq</option></primary>
5997 <indexterm role="concept">
5998 <primary>error</primary>
5999 <secondary>reporting</secondary>
6001 This option is supported for compatibility with Sendmail, but has the same
6002 effect as <option>-oep</option>.
6004 </listitem></varlistentry>
6006 <term><option>-oew</option></term>
6009 <indexterm role="option">
6010 <primary><option>-oew</option></primary>
6012 <indexterm role="concept">
6013 <primary>error</primary>
6014 <secondary>reporting</secondary>
6016 This option is supported for compatibility with Sendmail, but has the same
6017 effect as <option>-oem</option>.
6019 </listitem></varlistentry>
6021 <term><option>-oi</option></term>
6024 <indexterm role="option">
6025 <primary><option>-oi</option></primary>
6027 <indexterm role="concept">
6028 <primary>dot</primary>
6029 <secondary>in incoming non-SMTP message</secondary>
6031 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6032 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6033 single dot does terminate, though Exim does no special processing for other
6034 lines that start with a dot. This option is set by default if Exim is called as
6035 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6037 </listitem></varlistentry>
6039 <term><option>-oitrue</option></term>
6042 <indexterm role="option">
6043 <primary><option>-oitrue</option></primary>
6045 This option is treated as synonymous with <option>-oi</option>.
6047 </listitem></varlistentry>
6049 <term><option>-oMa</option> <<emphasis>host address</emphasis>></term>
6052 <indexterm role="option">
6053 <primary><option>-oMa</option></primary>
6055 <indexterm role="concept">
6056 <primary>sender</primary>
6057 <secondary>host address, specifying for local message</secondary>
6059 A number of options starting with <option>-oM</option> can be used to set values associated
6060 with remote hosts on locally-submitted messages (that is, messages not received
6061 over TCP/IP). These options can be used by any caller in conjunction with the
6062 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6063 other circumstances, they are ignored unless the caller is trusted.
6066 The <option>-oMa</option> option sets the sender host address. This may include a port
6067 number at the end, after a full stop (period). For example:
6069 <literallayout class="monospaced">
6070 exim -bs -oMa 10.9.8.7.1234
6073 An alternative syntax is to enclose the IP address in square brackets,
6074 followed by a colon and the port number:
6076 <literallayout class="monospaced">
6077 exim -bs -oMa [10.9.8.7]:1234
6080 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6081 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6082 are present on the command line, the sender host IP address is taken from
6083 whichever one is last.
6085 </listitem></varlistentry>
6087 <term><option>-oMaa</option> <<emphasis>name</emphasis>></term>
6090 <indexterm role="option">
6091 <primary><option>-oMaa</option></primary>
6093 <indexterm role="concept">
6094 <primary>authentication</primary>
6095 <secondary>name, specifying for local message</secondary>
6097 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6098 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6099 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6100 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6101 authenticated SMTP session without actually using the SMTP AUTH command.
6103 </listitem></varlistentry>
6105 <term><option>-oMai</option> <<emphasis>string</emphasis>></term>
6108 <indexterm role="option">
6109 <primary><option>-oMai</option></primary>
6111 <indexterm role="concept">
6112 <primary>authentication</primary>
6113 <secondary>id, specifying for local message</secondary>
6115 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6116 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6117 This overrides the default value (the caller’s login id, except with <option>-bh</option>,
6118 where there is no default) for messages from local sources. See chapter
6119 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6121 </listitem></varlistentry>
6123 <term><option>-oMas</option> <<emphasis>address</emphasis>></term>
6126 <indexterm role="option">
6127 <primary><option>-oMas</option></primary>
6129 <indexterm role="concept">
6130 <primary>authentication</primary>
6131 <secondary>sender, specifying for local message</secondary>
6133 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6134 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6135 overrides the sender address that is created from the caller’s login id for
6136 messages from local sources, except when <option>-bh</option> is used, when there is no
6137 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6138 specified on a MAIL command overrides this value. See chapter
6139 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6141 </listitem></varlistentry>
6143 <term><option>-oMi</option> <<emphasis>interface address</emphasis>></term>
6146 <indexterm role="option">
6147 <primary><option>-oMi</option></primary>
6149 <indexterm role="concept">
6150 <primary>interface</primary>
6151 <secondary>address, specifying for local message</secondary>
6153 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6154 option sets the IP interface address value. A port number may be included,
6155 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6156 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6158 </listitem></varlistentry>
6160 <term><option>-oMr</option> <<emphasis>protocol name</emphasis>></term>
6163 <indexterm role="option">
6164 <primary><option>-oMr</option></primary>
6166 <indexterm role="concept">
6167 <primary>protocol, specifying for local message</primary>
6169 <indexterm role="variable">
6170 <primary><varname>$received_protocol</varname></primary>
6172 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6173 option sets the received protocol value that is stored in
6174 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6175 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6176 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6177 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6178 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6179 be set by <option>-oMr</option>.
6181 </listitem></varlistentry>
6183 <term><option>-oMs</option> <<emphasis>host name</emphasis>></term>
6186 <indexterm role="option">
6187 <primary><option>-oMs</option></primary>
6189 <indexterm role="concept">
6190 <primary>sender</primary>
6191 <secondary>host name, specifying for local message</secondary>
6193 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6194 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6195 present, Exim does not attempt to look up a host name from an IP address; it
6196 uses the name it is given.
6198 </listitem></varlistentry>
6200 <term><option>-oMt</option> <<emphasis>ident string</emphasis>></term>
6203 <indexterm role="option">
6204 <primary><option>-oMt</option></primary>
6206 <indexterm role="concept">
6207 <primary>sender</primary>
6208 <secondary>ident string, specifying for local message</secondary>
6210 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6211 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6212 local callers is the login id of the calling process, except when <option>-bh</option> is
6213 used, when there is no default.
6215 </listitem></varlistentry>
6217 <term><option>-om</option></term>
6220 <indexterm role="option">
6221 <primary><option>-om</option></primary>
6223 <indexterm role="concept">
6224 <primary>Sendmail compatibility</primary>
6225 <secondary><option>-om</option> option ignored</secondary>
6227 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6228 message should receive a copy of the message if the sender appears in an alias
6229 expansion. Exim always does this, so the option does nothing.
6231 </listitem></varlistentry>
6233 <term><option>-oo</option></term>
6236 <indexterm role="option">
6237 <primary><option>-oo</option></primary>
6239 <indexterm role="concept">
6240 <primary>Sendmail compatibility</primary>
6241 <secondary><option>-oo</option> option ignored</secondary>
6243 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6244 whatever that means.
6246 </listitem></varlistentry>
6248 <term><option>-oP</option> <<emphasis>path</emphasis>></term>
6251 <indexterm role="option">
6252 <primary><option>-oP</option></primary>
6254 <indexterm role="concept">
6255 <primary>pid (process id)</primary>
6256 <secondary>of daemon</secondary>
6258 <indexterm role="concept">
6259 <primary>daemon</primary>
6260 <secondary>process id (pid)</secondary>
6262 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6263 value. The option specifies the file to which the process id of the daemon is
6264 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6265 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6266 because in those cases, the normal pid file is not used.
6268 </listitem></varlistentry>
6270 <term><option>-or</option> <<emphasis>time</emphasis>></term>
6273 <indexterm role="option">
6274 <primary><option>-or</option></primary>
6276 <indexterm role="concept">
6277 <primary>timeout</primary>
6278 <secondary>for non-SMTP input</secondary>
6280 This option sets a timeout value for incoming non-SMTP messages. If it is not
6281 set, Exim will wait forever for the standard input. The value can also be set
6282 by the <option>receive_timeout</option> option. The format used for specifying times is
6283 described in section <xref linkend="SECTtimeformat"/>.
6285 </listitem></varlistentry>
6287 <term><option>-os</option> <<emphasis>time</emphasis>></term>
6290 <indexterm role="option">
6291 <primary><option>-os</option></primary>
6293 <indexterm role="concept">
6294 <primary>timeout</primary>
6295 <secondary>for SMTP input</secondary>
6297 <indexterm role="concept">
6298 <primary>SMTP</primary>
6299 <secondary>input timeout</secondary>
6301 This option sets a timeout value for incoming SMTP messages. The timeout
6302 applies to each SMTP command and block of data. The value can also be set by
6303 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6304 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6306 </listitem></varlistentry>
6308 <term><option>-ov</option></term>
6311 <indexterm role="option">
6312 <primary><option>-ov</option></primary>
6314 This option has exactly the same effect as <option>-v</option>.
6316 </listitem></varlistentry>
6318 <term><option>-oX</option> <<emphasis>number or string</emphasis>></term>
6321 <indexterm role="option">
6322 <primary><option>-oX</option></primary>
6324 <indexterm role="concept">
6325 <primary>TCP/IP</primary>
6326 <secondary>setting listening ports</secondary>
6328 <indexterm role="concept">
6329 <primary>TCP/IP</primary>
6330 <secondary>setting listening interfaces</secondary>
6332 <indexterm role="concept">
6333 <primary>port</primary>
6334 <secondary>receiving TCP/IP</secondary>
6336 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6337 is also given. It controls which ports and interfaces the daemon uses. Details
6338 of the syntax, and how it interacts with configuration file options, are given
6339 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6340 file is written unless <option>-oP</option> is also present to specify a pid file name.
6342 </listitem></varlistentry>
6344 <term><option>-pd</option></term>
6347 <indexterm role="option">
6348 <primary><option>-pd</option></primary>
6350 <indexterm role="concept">
6351 <primary>Perl</primary>
6352 <secondary>starting the interpreter</secondary>
6354 This option applies when an embedded Perl interpreter is linked with Exim (see
6355 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6356 option, forcing the starting of the interpreter to be delayed until it is
6359 </listitem></varlistentry>
6361 <term><option>-ps</option></term>
6364 <indexterm role="option">
6365 <primary><option>-ps</option></primary>
6367 <indexterm role="concept">
6368 <primary>Perl</primary>
6369 <secondary>starting the interpreter</secondary>
6371 This option applies when an embedded Perl interpreter is linked with Exim (see
6372 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6373 option, forcing the starting of the interpreter to occur as soon as Exim is
6376 </listitem></varlistentry>
6378 <term><option>-p</option><<emphasis>rval</emphasis>>:<<emphasis>sval</emphasis>></term>
6381 <indexterm role="option">
6382 <primary><option>-p</option></primary>
6384 For compatibility with Sendmail, this option is equivalent to
6387 <literal>-oMr</literal> <<emphasis>rval</emphasis>> <literal>-oMs</literal> <<emphasis>sval</emphasis>>
6390 It sets the incoming protocol and host name (for trusted callers). The
6391 host name and its colon can be omitted when only the protocol is to be set.
6392 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6393 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6394 or <literal>s</literal> using this option (but that does not seem a real limitation).
6396 </listitem></varlistentry>
6398 <term><option>-q</option></term>
6401 <indexterm role="option">
6402 <primary><option>-q</option></primary>
6404 <indexterm role="concept">
6405 <primary>queue runner</primary>
6406 <secondary>starting manually</secondary>
6408 This option is normally restricted to admin users. However, there is a
6409 configuration option called <option>prod_requires_admin</option> which can be set false to
6410 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6411 and <option>-S</option> options).
6414 <indexterm role="concept">
6415 <primary>queue runner</primary>
6416 <secondary>description of operation</secondary>
6418 The <option>-q</option> option starts one queue runner process. This scans the queue of
6419 waiting messages, and runs a delivery process for each one in turn. It waits
6420 for each delivery process to finish before starting the next one. A delivery
6421 process may not actually do any deliveries if the retry times for the addresses
6422 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6426 <indexterm role="concept">
6427 <primary>SMTP</primary>
6428 <secondary>passed connection</secondary>
6430 <indexterm role="concept">
6431 <primary>SMTP</primary>
6432 <secondary>multiple deliveries</secondary>
6434 <indexterm role="concept">
6435 <primary>multiple SMTP deliveries</primary>
6437 the delivery process spawns other processes to deliver other messages down
6438 passed SMTP connections, the queue runner waits for these to finish before
6442 When all the queued messages have been considered, the original queue runner
6443 process terminates. In other words, a single pass is made over the waiting
6444 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6445 this to be repeated periodically.
6448 Exim processes the waiting messages in an unpredictable order. It isn’t very
6449 random, but it is likely to be different each time, which is all that matters.
6450 If one particular message screws up a remote MTA, other messages to the same
6451 MTA have a chance of getting through if they get tried first.
6454 It is possible to cause the messages to be processed in lexical message id
6455 order, which is essentially the order in which they arrived, by setting the
6456 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6458 </listitem></varlistentry>
6460 <term><option>-q</option><<emphasis>qflags</emphasis>></term>
6463 The <option>-q</option> option may be followed by one or more flag letters that change its
6464 behaviour. They are all optional, but if more than one is present, they must
6465 appear in the correct order. Each flag is described in a separate item below.
6467 </listitem></varlistentry>
6469 <term><option>-qq...</option></term>
6472 <indexterm role="option">
6473 <primary><option>-qq</option></primary>
6475 <indexterm role="concept">
6476 <primary>queue</primary>
6477 <secondary>double scanning</secondary>
6479 <indexterm role="concept">
6480 <primary>queue</primary>
6481 <secondary>routing</secondary>
6483 <indexterm role="concept">
6484 <primary>routing</primary>
6485 <secondary>whole queue before delivery</secondary>
6487 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6488 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6489 every domain. Addresses are routed, local deliveries happen, but no remote
6493 <indexterm role="concept">
6494 <primary>hints database</primary>
6495 <secondary>remembering routing</secondary>
6497 The hints database that remembers which messages are waiting for specific hosts
6498 is updated, as if delivery to those hosts had been deferred. After this is
6499 complete, a second, normal queue scan happens, with routing and delivery taking
6500 place as normal. Messages that are routed to the same host should mostly be
6501 delivered down a single SMTP
6502 <indexterm role="concept">
6503 <primary>SMTP</primary>
6504 <secondary>passed connection</secondary>
6506 <indexterm role="concept">
6507 <primary>SMTP</primary>
6508 <secondary>multiple deliveries</secondary>
6510 <indexterm role="concept">
6511 <primary>multiple SMTP deliveries</primary>
6513 connection because of the hints that were set up during the first queue scan.
6514 This option may be useful for hosts that are connected to the Internet
6517 </listitem></varlistentry>
6519 <term><option>-q[q]i...</option></term>
6522 <indexterm role="option">
6523 <primary><option>-qi</option></primary>
6525 <indexterm role="concept">
6526 <primary>queue</primary>
6527 <secondary>initial delivery</secondary>
6529 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6530 those messages that haven’t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6531 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6532 <option>-odq</option> and want a queue runner just to process the new messages.
6534 </listitem></varlistentry>
6536 <term><option>-q[q][i]f...</option></term>
6539 <indexterm role="option">
6540 <primary><option>-qf</option></primary>
6542 <indexterm role="concept">
6543 <primary>queue</primary>
6544 <secondary>forcing delivery</secondary>
6546 <indexterm role="concept">
6547 <primary>delivery</primary>
6548 <secondary>forcing in queue run</secondary>
6550 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6551 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6552 their retry times are tried.
6554 </listitem></varlistentry>
6556 <term><option>-q[q][i]ff...</option></term>
6559 <indexterm role="option">
6560 <primary><option>-qff</option></primary>
6562 <indexterm role="concept">
6563 <primary>frozen messages</primary>
6564 <secondary>forcing delivery</secondary>
6566 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6569 </listitem></varlistentry>
6571 <term><option>-q[q][i][f[f]]l</option></term>
6574 <indexterm role="option">
6575 <primary><option>-ql</option></primary>
6577 <indexterm role="concept">
6578 <primary>queue</primary>
6579 <secondary>local deliveries only</secondary>
6581 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6582 be done. If a message requires any remote deliveries, it remains on the queue
6585 </listitem></varlistentry>
6587 <term><option>-q</option><<emphasis>qflags</emphasis>> <<emphasis>start id</emphasis>> <<emphasis>end id</emphasis>></term>
6590 <indexterm role="concept">
6591 <primary>queue</primary>
6592 <secondary>delivering specific messages</secondary>
6594 When scanning the queue, Exim can be made to skip over messages whose ids are
6595 lexically less than a given value by following the <option>-q</option> option with a
6596 starting message id. For example:
6598 <literallayout class="monospaced">
6599 exim -q 0t5C6f-0000c8-00
6602 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6603 second message id is given, messages whose ids are lexically greater than it
6604 are also skipped. If the same id is given twice, for example,
6606 <literallayout class="monospaced">
6607 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6610 just one delivery process is started, for that message. This differs from
6611 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6612 that it counts as a delivery from a queue run. Note that the selection
6613 mechanism does not affect the order in which the messages are scanned. There
6614 are also other ways of selecting specific sets of messages for delivery in a
6615 queue run – see <option>-R</option> and <option>-S</option>.
6617 </listitem></varlistentry>
6619 <term><option>-q</option><<emphasis>qflags</emphasis>><<emphasis>time</emphasis>></term>
6622 <indexterm role="concept">
6623 <primary>queue runner</primary>
6624 <secondary>starting periodically</secondary>
6626 <indexterm role="concept">
6627 <primary>periodic queue running</primary>
6629 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6630 starting a queue runner process at intervals specified by the given time value
6631 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6632 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6633 single daemon process handles both functions. A common way of starting up a
6634 combined daemon at system boot time is to use a command such as
6636 <literallayout class="monospaced">
6637 /usr/exim/bin/exim -bd -q30m
6640 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6641 process every 30 minutes.
6644 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6645 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6647 </listitem></varlistentry>
6649 <term><option>-qR</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6652 <indexterm role="option">
6653 <primary><option>-qR</option></primary>
6655 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6658 </listitem></varlistentry>
6660 <term><option>-qS</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6663 <indexterm role="option">
6664 <primary><option>-qS</option></primary>
6666 This option is synonymous with <option>-S</option>.
6668 </listitem></varlistentry>
6670 <term><option>-R</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6673 <indexterm role="option">
6674 <primary><option>-R</option></primary>
6676 <indexterm role="concept">
6677 <primary>queue runner</primary>
6678 <secondary>for specific recipients</secondary>
6680 <indexterm role="concept">
6681 <primary>delivery</primary>
6682 <secondary>to given domain</secondary>
6684 <indexterm role="concept">
6685 <primary>domain</primary>
6686 <secondary>delivery to</secondary>
6688 The <<emphasis>rsflags</emphasis>> may be empty, in which case the white space before the string
6689 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6690 which are the possible values for <<emphasis>rsflags</emphasis>>. White space is required if
6691 <<emphasis>rsflags</emphasis>> is not empty.
6694 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6695 perform a single queue run, except that, when scanning the messages on the
6696 queue, Exim processes only those that have at least one undelivered recipient
6697 address containing the given string, which is checked in a case-independent
6698 way. If the <<emphasis>rsflags</emphasis>> start with <emphasis>r</emphasis>, <<emphasis>string</emphasis>> is interpreted as a
6699 regular expression; otherwise it is a literal string.
6702 If you want to do periodic queue runs for messages with specific recipients,
6703 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6705 <literallayout class="monospaced">
6706 exim -q25m -R @special.domain.example
6709 This example does a queue run for messages with recipients in the given domain
6710 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6711 applied to each queue run.
6714 Once a message is selected for delivery by this mechanism, all its addresses
6715 are processed. For the first selected message, Exim overrides any retry
6716 information and forces a delivery attempt for each undelivered address. This
6717 means that if delivery of any address in the first message is successful, any
6718 existing retry information is deleted, and so delivery attempts for that
6719 address in subsequently selected messages (which are processed without forcing)
6720 will run. However, if delivery of any address does not succeed, the retry
6721 information is updated, and in subsequently selected messages, the failing
6722 address will be skipped.
6725 <indexterm role="concept">
6726 <primary>frozen messages</primary>
6727 <secondary>forcing delivery</secondary>
6729 If the <<emphasis>rsflags</emphasis>> contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6730 all selected messages, not just the first; frozen messages are included when
6731 <emphasis>ff</emphasis> is present.
6734 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6735 to a given domain after a host has been down for some time. When the SMTP
6736 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6737 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6738 an arbitrary command instead.
6740 </listitem></varlistentry>
6742 <term><option>-r</option></term>
6745 <indexterm role="option">
6746 <primary><option>-r</option></primary>
6748 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6750 </listitem></varlistentry>
6752 <term><option>-S</option><<emphasis>rsflags</emphasis>> <<emphasis>string</emphasis>></term>
6755 <indexterm role="option">
6756 <primary><option>-S</option></primary>
6758 <indexterm role="concept">
6759 <primary>delivery</primary>
6760 <secondary>from given sender</secondary>
6762 <indexterm role="concept">
6763 <primary>queue runner</primary>
6764 <secondary>for specific senders</secondary>
6766 This option acts like <option>-R</option> except that it checks the string against each
6767 message’s sender instead of against the recipients. If <option>-R</option> is also set, both
6768 conditions must be met for a message to be selected. If either of the options
6769 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6771 </listitem></varlistentry>
6773 <term><option>-Tqt</option> <<emphasis>times</emphasis>></term>
6776 <indexterm role="option">
6777 <primary><option>-Tqt</option></primary>
6779 This an option that is exclusively for use by the Exim testing suite. It is not
6780 recognized when Exim is run normally. It allows for the setting up of explicit
6781 <quote>queue times</quote> so that various warning/retry features can be tested.
6783 </listitem></varlistentry>
6785 <term><option>-t</option></term>
6788 <indexterm role="option">
6789 <primary><option>-t</option></primary>
6791 <indexterm role="concept">
6792 <primary>recipient</primary>
6793 <secondary>extracting from header lines</secondary>
6795 <indexterm role="concept">
6796 <primary><emphasis>Bcc:</emphasis> header line</primary>
6798 <indexterm role="concept">
6799 <primary><emphasis>Cc:</emphasis> header line</primary>
6801 <indexterm role="concept">
6802 <primary><emphasis>To:</emphasis> header line</primary>
6804 When Exim is receiving a locally-generated, non-SMTP message on its standard
6805 input, the <option>-t</option> option causes the recipients of the message to be obtained
6806 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6807 from the command arguments. The addresses are extracted before any rewriting
6808 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6811 <indexterm role="concept">
6812 <primary>Sendmail compatibility</primary>
6813 <secondary><option>-t</option> option</secondary>
6815 If the command has any arguments, they specify addresses to which the message
6816 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6817 the recipients list obtained from the headers. This is compatible with Smail 3
6818 and in accordance with the documented behaviour of several versions of
6819 Sendmail, as described in man pages on a number of operating systems (e.g.
6820 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6821 argument addresses to those obtained from the headers, and the O’Reilly
6822 Sendmail book documents it that way. Exim can be made to add argument addresses
6823 instead of subtracting them by setting the option
6824 <option>extract_addresses_remove_arguments</option> false.
6827 <indexterm role="concept">
6828 <primary><option>Resent-</option> header lines</primary>
6829 <secondary>with <option>-t</option></secondary>
6831 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6832 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6833 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6834 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6835 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6838 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6839 message is resent several times). The RFC also specifies that they should be
6840 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6841 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6842 nor indeed exactly what constitutes a <quote>set</quote>.
6843 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6844 are often added at the end of the header, and if a message is resent more than
6845 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6846 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6848 </listitem></varlistentry>
6850 <term><option>-ti</option></term>
6853 <indexterm role="option">
6854 <primary><option>-ti</option></primary>
6856 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6857 compatibility with Sendmail.
6859 </listitem></varlistentry>
6861 <term><option>-tls-on-connect</option></term>
6864 <indexterm role="option">
6865 <primary><option>-tls-on-connect</option></primary>
6867 <indexterm role="concept">
6868 <primary>TLS</primary>
6869 <secondary>use without STARTTLS</secondary>
6871 <indexterm role="concept">
6872 <primary>TLS</primary>
6873 <secondary>automatic start</secondary>
6875 This option is available when Exim is compiled with TLS support. It forces all
6876 incoming SMTP connections to behave as if the incoming port is listed in the
6877 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6878 <xref linkend="CHAPTLS"/> for further details.
6880 </listitem></varlistentry>
6882 <term><option>-U</option></term>
6885 <indexterm role="option">
6886 <primary><option>-U</option></primary>
6888 <indexterm role="concept">
6889 <primary>Sendmail compatibility</primary>
6890 <secondary><option>-U</option> option ignored</secondary>
6892 Sendmail uses this option for <quote>initial message submission</quote>, and its
6893 documentation states that in future releases, it may complain about
6894 syntactically invalid messages rather than fixing them when this flag is not
6895 set. Exim ignores this option.
6897 </listitem></varlistentry>
6899 <term><option>-v</option></term>
6902 <indexterm role="option">
6903 <primary><option>-v</option></primary>
6905 This option causes Exim to write information to the standard error stream,
6906 describing what it is doing. In particular, it shows the log lines for
6907 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6908 dialogue is shown. Some of the log lines shown may not actually be written to
6909 the log if the setting of <option>log_selector</option> discards them. Any relevant
6910 selectors are shown with each log line. If none are shown, the logging is
6913 </listitem></varlistentry>
6915 <term><option>-x</option></term>
6918 <indexterm role="option">
6919 <primary><option>-x</option></primary>
6921 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6922 National Language Support extended characters in the body of the mail item</quote>).
6923 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6926 </listitem></varlistentry>
6929 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6930 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6932 <!-- === End of command line options === -->
6936 <chapter id="CHAPconf">
6937 <title>The Exim run time configuration file</title>
6938 <titleabbrev>The runtime configuration file</titleabbrev>
6940 <indexterm role="concept">
6941 <primary>run time configuration</primary>
6943 <indexterm role="concept">
6944 <primary>configuration file</primary>
6945 <secondary>general description</secondary>
6947 <indexterm role="concept">
6948 <primary>CONFIGURE_FILE</primary>
6950 <indexterm role="concept">
6951 <primary>configuration file</primary>
6952 <secondary>errors in</secondary>
6954 <indexterm role="concept">
6955 <primary>error</primary>
6956 <secondary>in configuration file</secondary>
6958 <indexterm role="concept">
6959 <primary>return code</primary>
6960 <secondary>for bad configuration</secondary>
6962 Exim uses a single run time configuration file that is read whenever an Exim
6963 binary is executed. Note that in normal operation, this happens frequently,
6964 because Exim is designed to operate in a distributed manner, without central
6968 If a syntax error is detected while reading the configuration file, Exim
6969 writes a message on the standard error, and exits with a non-zero return code.
6970 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6971 errors can be detected at this time. The values of any expanded options are
6972 not checked until the expansion happens, even when the expansion does not
6973 actually alter the string.
6976 The name of the configuration file is compiled into the binary for security
6977 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6978 most configurations, this specifies a single file. However, it is permitted to
6979 give a colon-separated list of file names, in which case Exim uses the first
6980 existing file in the list.
6982 <para revisionflag="changed">
6983 <indexterm role="concept">
6984 <primary>EXIM_USER</primary>
6986 <indexterm role="concept">
6987 <primary>EXIM_GROUP</primary>
6989 <indexterm role="concept">
6990 <primary>CONFIGURE_OWNER</primary>
6992 <indexterm role="concept">
6993 <primary>CONFIGURE_GROUP</primary>
6995 <indexterm role="concept">
6996 <primary>configuration file</primary>
6997 <secondary>ownership</secondary>
6999 <indexterm role="concept">
7000 <primary>ownership</primary>
7001 <secondary>configuration file</secondary>
7003 The run time configuration file must be owned by root or by the user that is
7004 specified at compile time by the CONFIGURE_OWNER option (if set). The
7005 configuration file must not be world-writeable, or group-writeable unless its
7006 group is the root group or the one specified at compile time by the
7007 CONFIGURE_GROUP option.
7009 <para revisionflag="changed">
7010 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7011 to root, anybody who is able to edit the run time configuration file has an
7012 easy way to run commands as root. If you specify a user or group in the
7013 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7014 who are members of that group will trivially be able to obtain root privileges.
7016 <para revisionflag="changed">
7017 Up to Exim version 4.72, the run time configuration file was also permitted to
7018 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7019 since it offered a simple privilege escalation for any attacker who managed to
7020 compromise the Exim user account.
7023 A default configuration file, which will work correctly in simple situations,
7024 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7025 defines just one file name, the installation process copies the default
7026 configuration to a new file of that name if it did not previously exist. If
7027 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7028 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7031 <section id="SECID40" revisionflag="changed">
7032 <title>Using a different configuration file</title>
7033 <para revisionflag="changed">
7034 <indexterm role="concept">
7035 <primary>configuration file</primary>
7036 <secondary>alternate</secondary>
7038 A one-off alternate configuration can be specified by the <option>-C</option> command line
7039 option, which may specify a single file or a list of files. However, when
7040 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7041 unless the argument for <option>-C</option> is identical to the built-in value from
7042 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7043 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7044 is useful mainly for checking the syntax of configuration files before
7045 installing them. No owner or group checks are done on a configuration file
7046 specified by <option>-C</option>, if root privilege has been dropped.
7048 <para revisionflag="changed">
7049 Even the Exim user is not trusted to specify an arbitrary configuration file
7050 with the <option>-C</option> option to be used with root privileges, unless that file is
7051 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7052 testing a configuration using <option>-C</option> right through message reception and
7053 delivery, even if the caller is root. The reception works, but by that time,
7054 Exim is running as the Exim user, so when it re-execs to regain privilege for
7055 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7056 can test reception and delivery using two separate commands (one to put a
7057 message on the queue, using <option>-odq</option>, and another to do the delivery, using
7058 <option>-M</option>).
7061 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7062 prefix string with which any file named in a <option>-C</option> command line option must
7063 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
7064 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
7065 name can be used with <option>-C</option>.
7068 One-off changes to a configuration can be specified by the <option>-D</option> command line
7069 option, which defines and overrides values for macros used inside the
7070 configuration file. However, like <option>-C</option>, the use of this option by a
7071 non-privileged user causes Exim to discard its root privilege.
7072 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7073 completely disabled, and its use causes an immediate error exit.
7075 <para revisionflag="changed">
7076 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7077 to declare certain macro names trusted, such that root privilege will not
7078 necessarily be discarded.
7079 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7080 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7081 values are acceptable, then Exim will not give up root privilege if the caller
7082 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set. This is a
7083 transition mechanism and is expected to be removed in the future. Acceptable
7084 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7087 Some sites may wish to use the same Exim binary on different machines that
7088 share a file system, but to use different configuration files on each machine.
7089 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7090 looks for a file whose name is the configuration file name followed by a dot
7091 and the machine’s node name, as obtained from the <function>uname()</function> function. If this
7092 file does not exist, the standard name is tried. This processing occurs for
7093 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
7096 In some esoteric situations different versions of Exim may be run under
7097 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7098 help with this. See the comments in <filename>src/EDITME</filename> for details.
7101 <section id="SECTconffilfor">
7102 <title>Configuration file format</title>
7104 <indexterm role="concept">
7105 <primary>configuration file</primary>
7106 <secondary>format of</secondary>
7108 <indexterm role="concept">
7109 <primary>format</primary>
7110 <secondary>configuration file</secondary>
7112 Exim’s configuration file is divided into a number of different parts. General
7113 option settings must always appear at the start of the file. The other parts
7114 are all optional, and may appear in any order. Each part other than the first
7115 is introduced by the word <quote>begin</quote> followed by the name of the part. The
7121 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7122 <xref linkend="CHAPACL"/>).
7127 <indexterm role="concept">
7128 <primary>AUTH</primary>
7129 <secondary>configuration</secondary>
7131 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7132 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7137 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7138 addresses and determine how the message is to be delivered (see chapters
7139 <xref linkend="CHAProutergeneric"/>–<xref linkend="CHAPredirect"/>).
7144 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7145 define mechanisms for copying messages to destinations (see chapters
7146 <xref linkend="CHAPtransportgeneric"/>–<xref linkend="CHAPsmtptrans"/>).
7151 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
7152 If there is no retry section, or if it is empty (that is, no retry rules are
7153 defined), Exim will not retry deliveries. In this situation, temporary errors
7154 are treated the same as permanent errors. Retry rules are discussed in chapter
7155 <xref linkend="CHAPretry"/>.
7160 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7161 when new addresses are generated during delivery. Rewriting is discussed in
7162 chapter <xref linkend="CHAPrewrite"/>.
7167 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7168 want to use this feature, you must set
7170 <literallayout class="monospaced">
7171 LOCAL_SCAN_HAS_OPTIONS=yes
7174 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
7175 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7180 <indexterm role="concept">
7181 <primary>configuration file</primary>
7182 <secondary>leading white space in</secondary>
7184 <indexterm role="concept">
7185 <primary>configuration file</primary>
7186 <secondary>trailing white space in</secondary>
7188 <indexterm role="concept">
7189 <primary>white space</primary>
7190 <secondary>in configuration file</secondary>
7192 Leading and trailing white space in configuration lines is always ignored.
7195 Blank lines in the file, and lines starting with a # character (ignoring
7196 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7197 # character other than at the beginning of a line is not treated specially,
7198 and does not introduce a comment.
7201 Any non-comment line can be continued by ending it with a backslash. Note that
7202 the general rule for white space means that trailing white space after the
7203 backslash and leading white space at the start of continuation
7204 lines is ignored. Comment lines beginning with # (but not empty lines) may
7205 appear in the middle of a sequence of continuation lines.
7208 A convenient way to create a configuration file is to start from the
7209 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7210 change settings as required.
7213 The ACLs, retry rules, and rewriting rules have their own syntax which is
7214 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7215 respectively. The other parts of the configuration file have some syntactic
7216 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7217 onwards. Before that, the inclusion, macro, and conditional facilities are
7221 <section id="SECID41">
7222 <title>File inclusions in the configuration file</title>
7224 <indexterm role="concept">
7225 <primary>inclusions in configuration file</primary>
7227 <indexterm role="concept">
7228 <primary>configuration file</primary>
7229 <secondary>including other files</secondary>
7231 <indexterm role="concept">
7232 <primary><literal>.include</literal> in configuration file</primary>
7234 <indexterm role="concept">
7235 <primary><literal>.include_if_exists</literal> in configuration file</primary>
7237 You can include other files inside Exim’s run time configuration file by
7241 <literal>.include</literal> <<emphasis>file name</emphasis>>
7242 <literal>.include_if_exists</literal> <<emphasis>file name</emphasis>>
7245 on a line by itself. Double quotes round the file name are optional. If you use
7246 the first form, a configuration error occurs if the file does not exist; the
7247 second form does nothing for non-existent files. In all cases, an absolute file
7251 Includes may be nested to any depth, but remember that Exim reads its
7252 configuration file often, so it is a good idea to keep them to a minimum.
7253 If you change the contents of an included file, you must HUP the daemon,
7254 because an included file is read only when the configuration itself is read.
7257 The processing of inclusions happens early, at a physical line level, so, like
7258 comment lines, an inclusion can be used in the middle of an option setting,
7261 <literallayout class="monospaced">
7262 hosts_lookup = a.b.c \
7266 Include processing happens after macro processing (see below). Its effect is to
7267 process the lines of the included file as if they occurred inline where the
7271 <section id="SECTmacrodefs">
7272 <title>Macros in the configuration file</title>
7274 <indexterm role="concept">
7275 <primary>macro</primary>
7276 <secondary>description of</secondary>
7278 <indexterm role="concept">
7279 <primary>configuration file</primary>
7280 <secondary>macros</secondary>
7282 If a line in the main part of the configuration (that is, before the first
7283 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7284 definition, and must be of the form
7287 <<emphasis>name</emphasis>> = <<emphasis>rest of line</emphasis>>
7290 The name must consist of letters, digits, and underscores, and need not all be
7291 in upper case, though that is recommended. The rest of the line, including any
7292 continuations, is the replacement text, and has leading and trailing white
7293 space removed. Quotes are not removed. The replacement text can never end with
7294 a backslash character, but this doesn’t seem to be a serious limitation.
7297 Macros may also be defined between router, transport, authenticator, or ACL
7298 definitions. They may not, however, be defined within an individual driver or
7299 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7302 <section id="SECID42">
7303 <title>Macro substitution</title>
7305 Once a macro is defined, all subsequent lines in the file (and any included
7306 files) are scanned for the macro name; if there are several macros, the line is
7307 scanned for each in turn, in the order in which the macros are defined. The
7308 replacement text is not re-scanned for the current macro, though it is scanned
7309 for subsequently defined macros. For this reason, a macro name may not contain
7310 the name of a previously defined macro as a substring. You could, for example,
7314 <literal>ABCD_XYZ = </literal><<emphasis>something</emphasis>>
7315 <literal>ABCD = </literal><<emphasis>something else</emphasis>>
7318 but putting the definitions in the opposite order would provoke a configuration
7319 error. Macro expansion is applied to individual physical lines from the file,
7320 before checking for line continuation or file inclusion (see above). If a line
7321 consists solely of a macro name, and the expansion of the macro is empty, the
7322 line is ignored. A macro at the start of a line may turn the line into a
7323 comment line or a <literal>.include</literal> line.
7326 <section id="SECID43">
7327 <title>Redefining macros</title>
7329 Once defined, the value of a macro can be redefined later in the configuration
7330 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7331 <emphasis>=</emphasis>. For example:
7333 <literallayout class="monospaced">
7336 MAC == updated value
7339 Redefinition does not alter the order in which the macros are applied to the
7340 subsequent lines of the configuration file. It is still the same order in which
7341 the macros were originally defined. All that changes is the macro’s value.
7342 Redefinition makes it possible to accumulate values. For example:
7344 <literallayout class="monospaced">
7347 MAC == MAC and something added
7350 This can be helpful in situations where the configuration file is built
7351 from a number of other files.
7354 <section id="SECID44">
7355 <title>Overriding macro values</title>
7357 The values set for macros in the configuration file can be overridden by the
7358 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7359 used, unless called by root or the Exim user. A definition on the command line
7360 using the <option>-D</option> option causes all definitions and redefinitions within the
7364 <section id="SECID45">
7365 <title>Example of macro usage</title>
7367 As an example of macro usage, consider a configuration where aliases are looked
7368 up in a MySQL database. It helps to keep the file less cluttered if long
7369 strings such as SQL statements are defined separately as macros, for example:
7371 <literallayout class="monospaced">
7372 ALIAS_QUERY = select mailbox from user where \
7373 login='${quote_mysql:$local_part}';
7376 This can then be used in a <command>redirect</command> router setting like this:
7378 <literallayout class="monospaced">
7379 data = ${lookup mysql{ALIAS_QUERY}}
7382 In earlier versions of Exim macros were sometimes used for domain, host, or
7383 address lists. In Exim 4 these are handled better by named lists – see
7384 section <xref linkend="SECTnamedlists"/>.
7387 <section id="SECID46">
7388 <title>Conditional skips in the configuration file</title>
7390 <indexterm role="concept">
7391 <primary>configuration file</primary>
7392 <secondary>conditional skips</secondary>
7394 <indexterm role="concept">
7395 <primary><literal>.ifdef</literal></primary>
7397 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7398 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7399 portions of the configuration file. The processing happens whenever the file is
7400 read (that is, when an Exim binary starts to run).
7403 The implementation is very simple. Instances of the first four directives must
7404 be followed by text that includes the names of one or macros. The condition
7405 that is tested is whether or not any macro substitution has taken place in the
7408 <literallayout class="monospaced">
7410 message_size_limit = 50M
7412 message_size_limit = 100M
7416 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7417 otherwise. If there is more than one macro named on the line, the condition
7418 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7419 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7422 Although you can use a macro expansion to generate one of these directives,
7423 it is not very useful, because the condition <quote>there was a macro substitution
7424 in this line</quote> will always be true.
7427 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7428 to clarify complicated nestings.
7431 <section id="SECTcos">
7432 <title>Common option syntax</title>
7434 <indexterm role="concept">
7435 <primary>common option syntax</primary>
7437 <indexterm role="concept">
7438 <primary>syntax of common options</primary>
7440 <indexterm role="concept">
7441 <primary>configuration file</primary>
7442 <secondary>common option syntax</secondary>
7444 For the main set of options, driver options, and <function>local_scan()</function> options,
7445 each setting is on a line by itself, and starts with a name consisting of
7446 lower-case letters and underscores. Many options require a data value, and in
7447 these cases the name must be followed by an equals sign (with optional white
7448 space) and then the value. For example:
7450 <literallayout class="monospaced">
7451 qualify_domain = mydomain.example.com
7454 <indexterm role="concept">
7455 <primary>hiding configuration option values</primary>
7457 <indexterm role="concept">
7458 <primary>configuration options</primary>
7459 <secondary>hiding value of</secondary>
7461 <indexterm role="concept">
7462 <primary>options</primary>
7463 <secondary>hiding value of</secondary>
7465 Some option settings may contain sensitive data, for example, passwords for
7466 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7467 line option to read these values, you can precede the option settings with the
7468 word <quote>hide</quote>. For example:
7470 <literallayout class="monospaced">
7471 hide mysql_servers = localhost/users/admin/secret-password
7474 For non-admin users, such options are displayed like this:
7476 <literallayout class="monospaced">
7477 mysql_servers = <value not displayable>
7480 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7481 all instances of the same driver.
7484 The following sections describe the syntax used for the different data types
7485 that are found in option settings.
7488 <section id="SECID47">
7489 <title>Boolean options</title>
7491 <indexterm role="concept">
7492 <primary>format</primary>
7493 <secondary>boolean</secondary>
7495 <indexterm role="concept">
7496 <primary>boolean configuration values</primary>
7498 <indexterm role="option">
7499 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7501 <indexterm role="option">
7502 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7504 Options whose type is given as boolean are on/off switches. There are two
7505 different ways of specifying such options: with and without a data value. If
7506 the option name is specified on its own without data, the switch is turned on;
7507 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7508 boolean options may be followed by an equals sign and one of the words
7509 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7510 the following two settings have exactly the same effect:
7512 <literallayout class="monospaced">
7517 The following two lines also have the same (opposite) effect:
7519 <literallayout class="monospaced">
7524 You can use whichever syntax you prefer.
7527 <section id="SECID48">
7528 <title>Integer values</title>
7530 <indexterm role="concept">
7531 <primary>integer configuration values</primary>
7533 <indexterm role="concept">
7534 <primary>format</primary>
7535 <secondary>integer</secondary>
7537 If an option’s type is given as <quote>integer</quote>, the value can be given in decimal,
7538 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
7539 number is assumed. Otherwise, it is treated as an octal number unless it starts
7540 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
7544 If an integer value is followed by the letter K, it is multiplied by 1024; if
7545 it is followed by the letter M, it is multiplied by 1024x1024. When the values
7546 of integer option settings are output, values which are an exact multiple of
7547 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
7548 and M. The printing style is independent of the actual input format that was
7552 <section id="SECID49">
7553 <title>Octal integer values</title>
7555 <indexterm role="concept">
7556 <primary>integer format</primary>
7558 <indexterm role="concept">
7559 <primary>format</primary>
7560 <secondary>octal integer</secondary>
7562 If an option’s type is given as <quote>octal integer</quote>, its value is always
7563 interpreted as an octal number, whether or not it starts with the digit zero.
7564 Such options are always output in octal.
7567 <section id="SECID50">
7568 <title>Fixed point numbers</title>
7570 <indexterm role="concept">
7571 <primary>fixed point configuration values</primary>
7573 <indexterm role="concept">
7574 <primary>format</primary>
7575 <secondary>fixed point</secondary>
7577 If an option’s type is given as <quote>fixed-point</quote>, its value must be a decimal
7578 integer, optionally followed by a decimal point and up to three further digits.
7581 <section id="SECTtimeformat">
7582 <title>Time intervals</title>
7584 <indexterm role="concept">
7585 <primary>time interval</primary>
7586 <secondary>specifying in configuration</secondary>
7588 <indexterm role="concept">
7589 <primary>format</primary>
7590 <secondary>time interval</secondary>
7592 A time interval is specified as a sequence of numbers, each followed by one of
7593 the following letters, with no intervening white space:
7595 <informaltable frame="none">
7596 <tgroup cols="2" colsep="0" rowsep="0">
7597 <colspec colwidth="30pt" align="left"/>
7598 <colspec colwidth="254pt" align="left"/>
7601 <entry> <option>s</option></entry>
7602 <entry>seconds</entry>
7605 <entry> <option>m</option></entry>
7606 <entry>minutes</entry>
7609 <entry> <option>h</option></entry>
7610 <entry>hours</entry>
7613 <entry> <option>d</option></entry>
7617 <entry> <option>w</option></entry>
7618 <entry>weeks</entry>
7624 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7625 intervals are output in the same format. Exim does not restrict the values; it
7626 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7629 <section id="SECTstrings">
7630 <title>String values</title>
7632 <indexterm role="concept">
7633 <primary>string</primary>
7634 <secondary>format of configuration values</secondary>
7636 <indexterm role="concept">
7637 <primary>format</primary>
7638 <secondary>string</secondary>
7640 If an option’s type is specified as <quote>string</quote>, the value can be specified with
7641 or without double-quotes. If it does not start with a double-quote, the value
7642 consists of the remainder of the line plus any continuation lines, starting at
7643 the first character after any leading white space, with trailing white space
7644 removed, and with no interpretation of the characters in the string. Because
7645 Exim removes comment lines (those beginning with #) at an early stage, they can
7646 appear in the middle of a multi-line string. The following two settings are
7647 therefore equivalent:
7649 <literallayout class="monospaced">
7650 trusted_users = uucp:mail
7651 trusted_users = uucp:\
7652 # This comment line is ignored
7656 <indexterm role="concept">
7657 <primary>string</primary>
7658 <secondary>quoted</secondary>
7660 <indexterm role="concept">
7661 <primary>escape characters in quoted strings</primary>
7663 If a string does start with a double-quote, it must end with a closing
7664 double-quote, and any backslash characters other than those used for line
7665 continuation are interpreted as escape characters, as follows:
7667 <informaltable frame="none">
7668 <tgroup cols="2" colsep="0" rowsep="0">
7669 <colspec colwidth="100pt" align="left"/>
7670 <colspec colwidth="254pt" align="left"/>
7673 <entry> <literal>\\</literal></entry>
7674 <entry>single backslash</entry>
7677 <entry> <literal>\n</literal></entry>
7678 <entry>newline</entry>
7681 <entry> <literal>\r</literal></entry>
7682 <entry>carriage return</entry>
7685 <entry> <literal>\t</literal></entry>
7689 <entry> <literal>\</literal><<emphasis>octal digits</emphasis>></entry>
7690 <entry>up to 3 octal digits specify one character</entry>
7693 <entry> <literal>\x</literal><<emphasis>hex digits</emphasis>></entry>
7694 <entry>up to 2 hexadecimal digits specify one character</entry>
7700 If a backslash is followed by some other character, including a double-quote
7701 character, that character replaces the pair.
7704 Quoting is necessary only if you want to make use of the backslash escapes to
7705 insert special characters, or if you need to specify a value with leading or
7706 trailing spaces. These cases are rare, so quoting is almost never needed in
7707 current versions of Exim. In versions of Exim before 3.14, quoting was required
7708 in order to continue lines, so you may come across older configuration files
7709 and examples that apparently quote unnecessarily.
7712 <section id="SECID51">
7713 <title>Expanded strings</title>
7715 <indexterm role="concept">
7716 <primary>expansion</primary>
7717 <secondary>definition of</secondary>
7719 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7720 by which means various parts of the string may be changed according to the
7721 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7722 is as just described; in particular, the handling of backslashes in quoted
7723 strings is done as part of the input process, before expansion takes place.
7724 However, backslash is also an escape character for the expander, so any
7725 backslashes that are required for that reason must be doubled if they are
7726 within a quoted configuration string.
7729 <section id="SECID52">
7730 <title>User and group names</title>
7732 <indexterm role="concept">
7733 <primary>user name</primary>
7734 <secondary>format of</secondary>
7736 <indexterm role="concept">
7737 <primary>format</primary>
7738 <secondary>user name</secondary>
7740 <indexterm role="concept">
7741 <primary>groups</primary>
7742 <secondary>name format</secondary>
7744 <indexterm role="concept">
7745 <primary>format</primary>
7746 <secondary>group name</secondary>
7748 User and group names are specified as strings, using the syntax described
7749 above, but the strings are interpreted specially. A user or group name must
7750 either consist entirely of digits, or be a name that can be looked up using the
7751 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7754 <section id="SECTlistconstruct">
7755 <title>List construction</title>
7757 <indexterm role="concept">
7758 <primary>list</primary>
7759 <secondary>syntax of in configuration</secondary>
7761 <indexterm role="concept">
7762 <primary>format</primary>
7763 <secondary>list item in configuration</secondary>
7765 <indexterm role="concept">
7766 <primary>string</primary>
7767 <secondary>list, definition of</secondary>
7769 The data for some configuration options is a list of items, with colon as the
7770 default separator. Many of these options are shown with type <quote>string list</quote> in
7771 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7772 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7773 are all the same; however, those other than <quote>string list</quote> are subject to
7774 particular kinds of interpretation, as described in chapter
7775 <xref linkend="CHAPdomhosaddlists"/>.
7778 In all these cases, the entire list is treated as a single string as far as the
7779 input syntax is concerned. The <option>trusted_users</option> setting in section
7780 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7781 in a list, it must be entered as two colons. Leading and trailing white space
7782 on each item in a list is ignored. This makes it possible to include items that
7783 start with a colon, and in particular, certain forms of IPv6 address. For
7786 <literallayout class="monospaced">
7787 local_interfaces = 127.0.0.1 : ::::1
7790 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7793 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7794 list items, it is not ignored when parsing the list. The space after the first
7795 colon in the example above is necessary. If it were not there, the list would
7796 be interpreted as the two items 127.0.0.1:: and 1.
7799 <section id="SECID53">
7800 <title>Changing list separators</title>
7802 <indexterm role="concept">
7803 <primary>list separator</primary>
7804 <secondary>changing</secondary>
7806 <indexterm role="concept">
7807 <primary>IPv6</primary>
7808 <secondary>addresses in lists</secondary>
7810 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7811 introduced to allow the separator character to be changed. If a list begins
7812 with a left angle bracket, followed by any punctuation character, that
7813 character is used instead of colon as the list separator. For example, the list
7814 above can be rewritten to use a semicolon separator like this:
7816 <literallayout class="monospaced">
7817 local_interfaces = <; 127.0.0.1 ; ::1
7820 This facility applies to all lists, with the exception of the list in
7821 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7822 confined to circumstances where they really are needed.
7825 <indexterm role="concept">
7826 <primary>list separator</primary>
7827 <secondary>newline as</secondary>
7829 <indexterm role="concept">
7830 <primary>newline</primary>
7831 <secondary>as list separator</secondary>
7833 It is also possible to use newline and other control characters (those with
7834 code values less than 32, plus DEL) as separators in lists. Such separators
7835 must be provided literally at the time the list is processed. For options that
7836 are string-expanded, you can write the separator using a normal escape
7837 sequence. This will be processed by the expander before the string is
7838 interpreted as a list. For example, if a newline-separated list of domains is
7839 generated by a lookup, you can process it directly by a line such as this:
7841 <literallayout class="monospaced">
7842 domains = <\n ${lookup mysql{.....}}
7845 This avoids having to change the list separator in such data. You are unlikely
7846 to want to use a control character as a separator in an option that is not
7847 expanded, because the value is literal text. However, it can be done by giving
7848 the value in quotes. For example:
7850 <literallayout class="monospaced">
7851 local_interfaces = "<\n 127.0.0.1 \n ::1"
7854 Unlike printing character separators, which can be included in list items by
7855 doubling, it is not possible to include a control character as data when it is
7856 set as the separator. Two such characters in succession are interpreted as
7857 enclosing an empty list item.
7860 <section id="SECTempitelis">
7861 <title>Empty items in lists</title>
7863 <indexterm role="concept">
7864 <primary>list</primary>
7865 <secondary>empty item in</secondary>
7867 An empty item at the end of a list is always ignored. In other words, trailing
7868 separator characters are ignored. Thus, the list in
7870 <literallayout class="monospaced">
7871 senders = user@domain :
7874 contains only a single item. If you want to include an empty string as one item
7875 in a list, it must not be the last item. For example, this list contains three
7876 items, the second of which is empty:
7878 <literallayout class="monospaced">
7879 senders = user1@domain : : user2@domain
7882 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7883 are interpreted as representing a single colon data character (and the list
7884 would then contain just one item). If you want to specify a list that contains
7885 just one, empty item, you can do it as in this example:
7887 <literallayout class="monospaced">
7891 In this case, the first item is empty, and the second is discarded because it
7892 is at the end of the list.
7895 <section id="SECTfordricon">
7896 <title>Format of driver configurations</title>
7898 <indexterm role="concept">
7899 <primary>drivers</primary>
7900 <secondary>configuration format</secondary>
7902 There are separate parts in the configuration for defining routers, transports,
7903 and authenticators. In each part, you are defining a number of driver
7904 instances, each with its own set of options. Each driver instance is defined by
7905 a sequence of lines like this:
7908 <<emphasis>instance name</emphasis>>:
7909 <<emphasis>option</emphasis>>
7911 <<emphasis>option</emphasis>>
7914 In the following example, the instance name is <command>localuser</command>, and it is
7915 followed by three options settings:
7917 <literallayout class="monospaced">
7921 transport = local_delivery
7924 For each driver instance, you specify which Exim code module it uses – by the
7925 setting of the <option>driver</option> option – and (optionally) some configuration
7926 settings. For example, in the case of transports, if you want a transport to
7927 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7928 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7929 described in detail in its own separate chapter later in this manual.
7932 You can have several routers, transports, or authenticators that are based on
7933 the same underlying driver (each must have a different instance name).
7936 The order in which routers are defined is important, because addresses are
7937 passed to individual routers one by one, in order. The order in which
7938 transports are defined does not matter at all. The order in which
7939 authenticators are defined is used only when Exim, as a client, is searching
7940 them to find one that matches an authentication mechanism offered by the
7944 <indexterm role="concept">
7945 <primary>generic options</primary>
7947 <indexterm role="concept">
7948 <primary>options</primary>
7949 <secondary>generic – definition of</secondary>
7951 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7952 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7953 same type (that is, all routers, all transports or all authenticators). The
7954 <option>driver</option> option is a generic option that must appear in every definition.
7955 <indexterm role="concept">
7956 <primary>private options</primary>
7958 The private options are special for each driver, and none need appear, because
7959 they all have default values.
7962 The options may appear in any order, except that the <option>driver</option> option must
7963 precede any private options, since these depend on the particular driver. For
7964 this reason, it is recommended that <option>driver</option> always be the first option.
7967 Driver instance names, which are used for reference in log entries and
7968 elsewhere, can be any sequence of letters, digits, and underscores (starting
7969 with a letter) and must be unique among drivers of the same type. A router and
7970 a transport (for example) can each have the same name, but no two router
7971 instances can have the same name. The name of a driver instance should not be
7972 confused with the name of the underlying driver module. For example, the
7973 configuration lines:
7975 <literallayout class="monospaced">
7980 create an instance of the <command>smtp</command> transport driver whose name is
7981 <command>remote_smtp</command>. The same driver code can be used more than once, with
7982 different instance names and different option settings each time. A second
7983 instance of the <command>smtp</command> transport, with different options, might be defined
7986 <literallayout class="monospaced">
7990 command_timeout = 10s
7993 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7994 these transport instances from routers, and these names would appear in log
7998 Comment lines may be present in the middle of driver specifications. The full
7999 list of option settings for any particular driver instance, including all the
8000 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8006 <chapter id="CHAPdefconfil">
8007 <title>The default configuration file</title>
8009 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8010 <primary>configuration file</primary>
8011 <secondary>default <quote>walk through</quote></secondary>
8013 <indexterm role="concept">
8014 <primary>default</primary>
8015 <secondary>configuration file <quote>walk through</quote></secondary>
8017 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8018 is sufficient for a host with simple mail requirements. As an introduction to
8019 the way Exim is configured, this chapter <quote>walks through</quote> the default
8020 configuration, giving brief explanations of the settings. Detailed descriptions
8021 of the options are given in subsequent chapters. The default configuration file
8022 itself contains extensive comments about ways you might want to modify the
8023 initial settings. However, note that there are many options that are not
8024 mentioned at all in the default configuration.
8026 <section id="SECTdefconfmain">
8027 <title>Main configuration settings</title>
8029 The main (global) configuration option settings must always come first in the
8030 file. The first thing you’ll see in the file, after some initial comments, is
8033 <literallayout class="monospaced">
8034 # primary_hostname =
8037 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8038 to know the official, fully qualified name of your host, and this is where you
8039 can specify it. However, in most cases you do not need to set this option. When
8040 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8043 The first three non-comment configuration lines are as follows:
8045 <literallayout class="monospaced">
8046 domainlist local_domains = @
8047 domainlist relay_to_domains =
8048 hostlist relay_from_hosts = 127.0.0.1
8051 These are not, in fact, option settings. They are definitions of two named
8052 domain lists and one named host list. Exim allows you to give names to lists of
8053 domains, hosts, and email addresses, in order to make it easier to manage the
8054 configuration file (see section <xref linkend="SECTnamedlists"/>).
8057 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8058 later in the configuration to identify domains that are to be delivered
8062 <indexterm role="concept">
8063 <primary>@ in a domain list</primary>
8065 There is just one item in this list, the string <quote>@</quote>. This is a special form
8066 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8067 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8068 be delivered locally. Because the local host’s name is referenced indirectly,
8069 the same configuration file can be used on different hosts.
8072 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8073 list itself is empty. Later in the configuration we will come to the part that
8074 controls mail relaying through the local host; it allows relaying to any
8075 domains in this list. By default, therefore, no relaying on the basis of a mail
8076 domain is permitted.
8079 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8080 used later in the configuration to permit relaying from any host or IP address
8081 that matches the list. The default contains just the IP address of the IPv4
8082 loopback interface, which means that processes on the local host are able to
8083 submit mail for relaying by sending it over TCP/IP to that interface. No other
8084 hosts are permitted to submit messages for relaying.
8087 Just to be sure there’s no misunderstanding: at this point in the configuration
8088 we aren’t actually setting up any controls. We are just defining some domains
8089 and hosts that will be used in the controls that are specified later.
8092 The next two configuration lines are genuine option settings:
8094 <literallayout class="monospaced">
8095 acl_smtp_rcpt = acl_check_rcpt
8096 acl_smtp_data = acl_check_data
8099 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
8100 during an incoming SMTP session for every recipient of a message (every RCPT
8101 command), and after the contents of the message have been received,
8102 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
8103 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
8104 section of the configuration. The RCPT ACL controls which recipients are
8105 accepted for an incoming message – if a configuration does not provide an ACL
8106 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
8107 contents of a message to be checked.
8110 Two commented-out option settings are next:
8112 <literallayout class="monospaced">
8113 # av_scanner = clamd:/tmp/clamd
8114 # spamd_address = 127.0.0.1 783
8117 These are example settings that can be used when Exim is compiled with the
8118 content-scanning extension. The first specifies the interface to the virus
8119 scanner, and the second specifies the interface to SpamAssassin. Further
8120 details are given in chapter <xref linkend="CHAPexiscan"/>.
8123 Three more commented-out option settings follow:
8125 <literallayout class="monospaced">
8126 # tls_advertise_hosts = *
8127 # tls_certificate = /etc/ssl/exim.crt
8128 # tls_privatekey = /etc/ssl/exim.pem
8131 These are example settings that can be used when Exim is compiled with
8132 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
8133 first one specifies the list of clients that are allowed to use TLS when
8134 connecting to this server; in this case the wildcard means all clients. The
8135 other options specify where Exim should find its TLS certificate and private
8136 key, which together prove the server’s identity to any clients that connect.
8137 More details are given in chapter <xref linkend="CHAPTLS"/>.
8140 Another two commented-out option settings follow:
8142 <literallayout class="monospaced">
8143 # daemon_smtp_ports = 25 : 465 : 587
8144 # tls_on_connect_ports = 465
8147 <indexterm role="concept">
8148 <primary>port</primary>
8149 <secondary>465 and 587</secondary>
8151 <indexterm role="concept">
8152 <primary>port</primary>
8153 <secondary>for message submission</secondary>
8155 <indexterm role="concept">
8156 <primary>message</primary>
8157 <secondary>submission, ports for</secondary>
8159 <indexterm role="concept">
8160 <primary>ssmtp protocol</primary>
8162 <indexterm role="concept">
8163 <primary>smtps protocol</primary>
8165 <indexterm role="concept">
8166 <primary>SMTP</primary>
8167 <secondary>ssmtp protocol</secondary>
8169 <indexterm role="concept">
8170 <primary>SMTP</primary>
8171 <secondary>smtps protocol</secondary>
8173 These options provide better support for roaming users who wish to use this
8174 server for message submission. They are not much use unless you have turned on
8175 TLS (as described in the previous paragraph) and authentication (about which
8176 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8177 on end-user networks, so RFC 4409 specifies that message submission should use
8178 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8179 configured to use port 587 correctly, so these settings also enable the
8180 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8181 <xref linkend="SECTsupobssmt"/>).
8184 Two more commented-out options settings follow:
8186 <literallayout class="monospaced">
8188 # qualify_recipient =
8191 The first of these specifies a domain that Exim uses when it constructs a
8192 complete email address from a local login name. This is often needed when Exim
8193 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8194 the value of <option>primary_hostname</option> is used. If you set both of these options,
8195 you can have different qualification domains for sender and recipient
8196 addresses. If you set only the first one, its value is used in both cases.
8199 <indexterm role="concept">
8200 <primary>domain literal</primary>
8201 <secondary>recognizing format</secondary>
8203 The following line must be uncommented if you want Exim to recognize
8204 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8205 (an IP address within square brackets) instead of a named domain.
8207 <literallayout class="monospaced">
8208 # allow_domain_literals
8211 The RFCs still require this form, but many people think that in the modern
8212 Internet it makes little sense to permit mail to be sent to specific hosts by
8213 quoting their IP addresses. This ancient format has been used by people who
8214 try to abuse hosts by using them for unwanted relaying. However, some
8215 people believe there are circumstances (for example, messages addressed to
8216 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8219 The next configuration line is a kind of trigger guard:
8221 <literallayout class="monospaced">
8225 It specifies that no delivery must ever be run as the root user. The normal
8226 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8227 setting is a guard against slips in the configuration.
8228 The list of users specified by <option>never_users</option> is not, however, the complete
8229 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8230 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8231 contents of <option>never_users</option> are added to this list. By default
8232 FIXED_NEVER_USERS also specifies root.
8235 When a remote host connects to Exim in order to send mail, the only information
8236 Exim has about the host’s identity is its IP address. The next configuration
8239 <literallayout class="monospaced">
8243 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8244 in order to get a host name. This improves the quality of the logging
8245 information, but if you feel it is too expensive, you can remove it entirely,
8246 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8247 Note that it is not always possible to find a host name from an IP address,
8248 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8252 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8253 1413 (hence their names):
8255 <literallayout class="monospaced">
8257 rfc1413_query_timeout = 5s
8260 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8261 You can limit the hosts to which these calls are made, or change the timeout
8262 that is used. If you set the timeout to zero, all ident calls are disabled.
8263 Although they are cheap and can provide useful information for tracing problem
8264 messages, some hosts and firewalls have problems with ident calls. This can
8265 result in a timeout instead of an immediate refused connection, leading to
8266 delays on starting up an incoming SMTP session.
8269 When Exim receives messages over SMTP connections, it expects all addresses to
8270 be fully qualified with a domain, as required by the SMTP definition. However,
8271 if you are running a server to which simple clients submit messages, you may
8272 find that they send unqualified addresses. The two commented-out options:
8274 <literallayout class="monospaced">
8275 # sender_unqualified_hosts =
8276 # recipient_unqualified_hosts =
8279 show how you can specify hosts that are permitted to send unqualified sender
8280 and recipient addresses, respectively.
8283 The <option>percent_hack_domains</option> option is also commented out:
8285 <literallayout class="monospaced">
8286 # percent_hack_domains =
8289 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8290 This is an almost obsolete form of explicit email routing. If you do not know
8291 anything about it, you can safely ignore this topic.
8294 The last two settings in the main part of the default configuration are
8295 concerned with messages that have been <quote>frozen</quote> on Exim’s queue. When a
8296 message is frozen, Exim no longer continues to try to deliver it. Freezing
8297 occurs when a bounce message encounters a permanent failure because the sender
8298 address of the original message that caused the bounce is invalid, so the
8299 bounce cannot be delivered. This is probably the most common case, but there
8300 are also other conditions that cause freezing, and frozen messages are not
8301 always bounce messages.
8303 <literallayout class="monospaced">
8304 ignore_bounce_errors_after = 2d
8305 timeout_frozen_after = 7d
8308 The first of these options specifies that failing bounce messages are to be
8309 discarded after 2 days on the queue. The second specifies that any frozen
8310 message (whether a bounce message or not) is to be timed out (and discarded)
8311 after a week. In this configuration, the first setting ensures that no failing
8312 bounce message ever lasts a week.
8315 <section id="SECID54">
8316 <title>ACL configuration</title>
8318 <indexterm role="concept">
8319 <primary>default</primary>
8320 <secondary>ACLs</secondary>
8322 <indexterm role="concept">
8323 <primary>access control lists (ACLs)</primary>
8324 <secondary>default configuration</secondary>
8326 In the default configuration, the ACL section follows the main configuration.
8327 It starts with the line
8329 <literallayout class="monospaced">
8333 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8334 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8335 and <option>acl_smtp_data</option> above.
8338 <indexterm role="concept">
8339 <primary>RCPT</primary>
8340 <secondary>ACL for</secondary>
8342 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8343 RCPT command specifies one of the message’s recipients. The ACL statements
8344 are considered in order, until the recipient address is either accepted or
8345 rejected. The RCPT command is then accepted or rejected, according to the
8346 result of the ACL processing.
8348 <literallayout class="monospaced">
8352 This line, consisting of a name terminated by a colon, marks the start of the
8355 <literallayout class="monospaced">
8359 This ACL statement accepts the recipient if the sending host matches the list.
8360 But what does that strange list mean? It doesn’t actually contain any host
8361 names or IP addresses. The presence of the colon puts an empty item in the
8362 list; Exim matches this only if the incoming message did not come from a remote
8363 host, because in that case, the remote hostname is empty. The colon is
8364 important. Without it, the list itself is empty, and can never match anything.
8367 What this statement is doing is to accept unconditionally all recipients in
8368 messages that are submitted by SMTP from local processes using the standard
8369 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8372 <literallayout class="monospaced">
8373 deny message = Restricted characters in address
8374 domains = +local_domains
8375 local_parts = ^[.] : ^.*[@%!/|]
8377 deny message = Restricted characters in address
8378 domains = !+local_domains
8379 local_parts = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8382 These statements are concerned with local parts that contain any of the
8383 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8384 Although these characters are entirely legal in local parts (in the case of
8385 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8386 in Internet mail addresses.
8389 The first three have in the past been associated with explicitly routed
8390 addresses (percent is still sometimes used – see the <option>percent_hack_domains</option>
8391 option). Addresses containing these characters are regularly tried by spammers
8392 in an attempt to bypass relaying restrictions, and also by open relay testing
8393 programs. Unless you really need them it is safest to reject these characters
8394 at this early stage. This configuration is heavy-handed in rejecting these
8395 characters for all messages it accepts from remote hosts. This is a deliberate
8396 policy of being as safe as possible.
8399 The first rule above is stricter, and is applied to messages that are addressed
8400 to one of the local domains handled by this host. This is implemented by the
8401 first condition, which restricts it to domains that are listed in the
8402 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8403 reference to a named list. In this configuration, there is just one domain in
8404 <emphasis>local_domains</emphasis>, but in general there may be many.
8407 The second condition on the first statement uses two regular expressions to
8408 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8409 or <quote>|</quote>. If you have local accounts that include these characters, you will
8410 have to modify this rule.
8413 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8414 allows them because they have been encountered in practice. (Consider the
8415 common convention of local parts constructed as
8416 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8417 the author of Exim, who has no second initial.) However, a local part starting
8418 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8419 file name (for example, for a mailing list). This is also true for local parts
8420 that contain slashes. A pipe symbol can also be troublesome if the local part
8421 is incorporated unthinkingly into a shell command line.
8424 The second rule above applies to all other domains, and is less strict. This
8425 allows your own users to send outgoing messages to sites that use slashes
8426 and vertical bars in their local parts. It blocks local parts that begin
8427 with a dot, slash, or vertical bar, but allows these characters within the
8428 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8429 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8430 (or your users’ viruses) from mounting certain kinds of attack on remote sites.
8432 <literallayout class="monospaced">
8433 accept local_parts = postmaster
8434 domains = +local_domains
8437 This statement, which has two conditions, accepts an incoming address if the
8438 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8439 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8440 reference to a named list. In this configuration, there is just one domain in
8441 <emphasis>local_domains</emphasis>, but in general there may be many.
8444 The presence of this statement means that mail to postmaster is never blocked
8445 by any of the subsequent tests. This can be helpful while sorting out problems
8446 in cases where the subsequent tests are incorrectly denying access.
8448 <literallayout class="monospaced">
8449 require verify = sender
8452 This statement requires the sender address to be verified before any subsequent
8453 ACL statement can be used. If verification fails, the incoming recipient
8454 address is refused. Verification consists of trying to route the address, to
8455 see if a bounce message could be delivered to it. In the case of remote
8456 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8457 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8458 discusses the details of address verification.
8460 <literallayout class="monospaced">
8461 accept hosts = +relay_from_hosts
8462 control = submission
8465 This statement accepts the address if the message is coming from one of the
8466 hosts that are defined as being allowed to relay through this host. Recipient
8467 verification is omitted here, because in many cases the clients are dumb MUAs
8468 that do not cope well with SMTP error responses. For the same reason, the
8469 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8470 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8471 messages that are deficient in some way, for example, because they lack a
8472 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8473 probably add recipient verification here, and disable submission mode.
8475 <literallayout class="monospaced">
8476 accept authenticated = *
8477 control = submission
8480 This statement accepts the address if the client host has authenticated itself.
8481 Submission mode is again specified, on the grounds that such messages are most
8482 likely to come from MUAs. The default configuration does not define any
8483 authenticators, though it does include some nearly complete commented-out
8484 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8485 fact authenticate until you complete the authenticator definitions.
8487 <literallayout class="monospaced">
8488 require message = relay not permitted
8489 domains = +local_domains : +relay_domains
8492 This statement rejects the address if its domain is neither a local domain nor
8493 one of the domains for which this host is a relay.
8495 <literallayout class="monospaced">
8496 require verify = recipient
8499 This statement requires the recipient address to be verified; if verification
8500 fails, the address is rejected.
8502 <literallayout class="monospaced">
8503 # deny message = rejected because $sender_host_address \
8504 # is in a black list at $dnslist_domain\n\
8506 # dnslists = black.list.example
8508 # warn dnslists = black.list.example
8509 # add_header = X-Warning: $sender_host_address is in \
8510 # a black list at $dnslist_domain
8511 # log_message = found in $dnslist_domain
8514 These commented-out lines are examples of how you could configure Exim to check
8515 sending hosts against a DNS black list. The first statement rejects messages
8516 from blacklisted hosts, whereas the second just inserts a warning header
8519 <literallayout class="monospaced">
8520 # require verify = csa
8523 This commented-out line is an example of how you could turn on client SMTP
8524 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8527 <literallayout class="monospaced">
8531 The final statement in the first ACL unconditionally accepts any recipient
8532 address that has successfully passed all the previous tests.
8534 <literallayout class="monospaced">
8538 This line marks the start of the second ACL, and names it. Most of the contents
8539 of this ACL are commented out:
8541 <literallayout class="monospaced">
8543 # message = This message contains a virus \
8547 These lines are examples of how to arrange for messages to be scanned for
8548 viruses when Exim has been compiled with the content-scanning extension, and a
8549 suitable virus scanner is installed. If the message is found to contain a
8550 virus, it is rejected with the given custom error message.
8552 <literallayout class="monospaced">
8553 # warn spam = nobody
8554 # message = X-Spam_score: $spam_score\n\
8555 # X-Spam_score_int: $spam_score_int\n\
8556 # X-Spam_bar: $spam_bar\n\
8557 # X-Spam_report: $spam_report
8560 These lines are an example of how to arrange for messages to be scanned by
8561 SpamAssassin when Exim has been compiled with the content-scanning extension,
8562 and SpamAssassin has been installed. The SpamAssassin check is run with
8563 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8564 series of extra header line. In this case, the message is not rejected,
8565 whatever the spam score.
8567 <literallayout class="monospaced">
8571 This final line in the DATA ACL accepts the message unconditionally.
8574 <section id="SECID55">
8575 <title>Router configuration</title>
8577 <indexterm role="concept">
8578 <primary>default</primary>
8579 <secondary>routers</secondary>
8581 <indexterm role="concept">
8582 <primary>routers</primary>
8583 <secondary>default</secondary>
8585 The router configuration comes next in the default configuration, introduced
8588 <literallayout class="monospaced">
8592 Routers are the modules in Exim that make decisions about where to send
8593 messages. An address is passed to each router in turn, until it is either
8594 accepted, or failed. This means that the order in which you define the routers
8595 matters. Each router is fully described in its own chapter later in this
8596 manual. Here we give only brief overviews.
8598 <literallayout class="monospaced">
8600 # driver = ipliteral
8601 # domains = !+local_domains
8602 # transport = remote_smtp
8605 <indexterm role="concept">
8606 <primary>domain literal</primary>
8607 <secondary>default router</secondary>
8609 This router is commented out because the majority of sites do not want to
8610 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8611 you uncomment this router, you also need to uncomment the setting of
8612 <option>allow_domain_literals</option> in the main part of the configuration.
8614 <literallayout class="monospaced">
8617 domains = ! +local_domains
8618 transport = remote_smtp
8619 ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8623 The first uncommented router handles addresses that do not involve any local
8624 domains. This is specified by the line
8626 <literallayout class="monospaced">
8627 domains = ! +local_domains
8630 The <option>domains</option> option lists the domains to which this router applies, but the
8631 exclamation mark is a negation sign, so the router is used only for domains
8632 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8633 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8634 indicates that it is referring to a named list. Addresses in other domains are
8635 passed on to the following routers.
8638 The name of the router driver is <command>dnslookup</command>,
8639 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8640 the name of this router instance is the same as the name of the driver. The
8641 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8642 one of the driver modules that is in the Exim binary.
8645 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8646 DNS in order to obtain a list of hosts to which the address is routed. If the
8647 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8648 specified by the <option>transport</option> option. If the router does not find the domain
8649 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8650 the address fails and is bounced.
8653 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8654 be entirely ignored. This option is present because a number of cases have been
8655 encountered where MX records in the DNS point to host names
8656 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8657 Completely ignoring these IP addresses causes Exim to fail to route the
8658 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8659 continue to try to deliver the message periodically until the address timed
8662 <literallayout class="monospaced">
8667 data = ${lookup{$local_part}lsearch{/etc/aliases}}
8669 file_transport = address_file
8670 pipe_transport = address_pipe
8673 Control reaches this and subsequent routers only for addresses in the local
8674 domains. This router checks to see whether the local part is defined as an
8675 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8676 data that it looks up from that file. If no data is found for the local part,
8677 the value of the <option>data</option> option is empty, causing the address to be passed to
8681 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8682 often used. That is why it is referenced by from the default configuration
8683 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8684 <filename>Local/Makefile</filename> before building Exim.
8686 <literallayout class="monospaced">
8690 # local_part_suffix = +* : -*
8691 # local_part_suffix_optional
8692 file = $home/.forward
8697 file_transport = address_file
8698 pipe_transport = address_pipe
8699 reply_transport = address_reply
8702 This is the most complicated router in the default configuration. It is another
8703 redirection router, but this time it is looking for forwarding data set up by
8704 individual users. The <option>check_local_user</option> setting specifies a check that the
8705 local part of the address is the login name of a local user. If it is not, the
8706 router is skipped. The two commented options that follow <option>check_local_user</option>,
8709 <literallayout class="monospaced">
8710 # local_part_suffix = +* : -*
8711 # local_part_suffix_optional
8714 <indexterm role="variable">
8715 <primary><varname>$local_part_suffix</varname></primary>
8717 show how you can specify the recognition of local part suffixes. If the first
8718 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8719 by any sequence of characters, is removed from the local part and placed in the
8720 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8721 presence of a suffix in the local part is optional. When a suffix is present,
8722 the check for a local login uses the local part with the suffix removed.
8725 When a local user account is found, the file called <filename>.forward</filename> in the user’s
8726 home directory is consulted. If it does not exist, or is empty, the router
8727 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8728 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8731 <indexterm role="concept">
8732 <primary>Sieve filter</primary>
8733 <secondary>enabling in default router</secondary>
8735 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8736 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8737 is commented out by default), the contents of the file are interpreted as a set
8738 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8739 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8740 separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>.
8743 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8744 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8745 There are two reasons for doing this:
8747 <orderedlist numeration="arabic">
8750 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8751 checking an address for validity; it makes sense not to waste resources doing
8757 More importantly, when Exim is verifying addresses or handling an EXPN
8758 command during an SMTP session, it is running as the Exim user, not as root.
8759 The group is the Exim group, and no additional groups are set up.
8760 It may therefore not be possible for Exim to read users’ <filename>.forward</filename> files at
8766 The setting of <option>check_ancestor</option> prevents the router from generating a new
8767 address that is the same as any previous address that was redirected. (This
8768 works round a problem concerning a bad interaction between aliasing and
8769 forwarding – see section <xref linkend="SECTredlocmai"/>).
8772 The final three option settings specify the transports that are to be used when
8773 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8774 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8776 <literallayout class="monospaced">
8777 a.nother@elsewhere.example, /home/spqr/archive
8780 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8783 <literallayout class="monospaced">
8787 # local_part_suffix = +* : -*
8788 # local_part_suffix_optional
8789 transport = local_delivery
8792 The final router sets up delivery into local mailboxes, provided that the local
8793 part is the name of a local login, by accepting the address and assigning it to
8794 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8795 routers, so the address is bounced. The commented suffix settings fulfil the
8796 same purpose as they do for the <command>userforward</command> router.
8799 <section id="SECID56">
8800 <title>Transport configuration</title>
8802 <indexterm role="concept">
8803 <primary>default</primary>
8804 <secondary>transports</secondary>
8806 <indexterm role="concept">
8807 <primary>transports</primary>
8808 <secondary>default</secondary>
8810 Transports define mechanisms for actually delivering messages. They operate
8811 only when referenced from routers, so the order in which they are defined does
8812 not matter. The transports section of the configuration starts with
8814 <literallayout class="monospaced">
8818 One remote transport and four local transports are defined.
8820 <literallayout class="monospaced">
8825 This transport is used for delivering messages over SMTP connections. All its
8826 options are defaulted. The list of remote hosts comes from the router.
8828 <literallayout class="monospaced">
8831 file = /var/mail/$local_part
8839 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8840 traditional BSD mailbox format. By default it runs under the uid and gid of the
8841 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8842 directory. Some systems use the alternative approach of running mail deliveries
8843 under a particular group instead of using the sticky bit. The commented options
8844 show how this can be done.
8847 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8848 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8849 similarly-named options above.
8851 <literallayout class="monospaced">
8857 This transport is used for handling deliveries to pipes that are generated by
8858 redirection (aliasing or users’ <filename>.forward</filename> files). The <option>return_output</option>
8859 option specifies that any output generated by the pipe is to be returned to the
8862 <literallayout class="monospaced">
8870 This transport is used for handling deliveries to files that are generated by
8871 redirection. The name of the file is not specified in this instance of
8872 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8874 <literallayout class="monospaced">
8879 This transport is used for handling automatic replies generated by users’
8883 <section id="SECID57">
8884 <title>Default retry rule</title>
8886 <indexterm role="concept">
8887 <primary>retry</primary>
8888 <secondary>default rule</secondary>
8890 <indexterm role="concept">
8891 <primary>default</primary>
8892 <secondary>retry rule</secondary>
8894 The retry section of the configuration file contains rules which affect the way
8895 Exim retries deliveries that cannot be completed at the first attempt. It is
8896 introduced by the line
8898 <literallayout class="monospaced">
8902 In the default configuration, there is just one rule, which applies to all
8905 <literallayout class="monospaced">
8906 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
8909 This causes any temporarily failing address to be retried every 15 minutes for
8910 2 hours, then at intervals starting at one hour and increasing by a factor of
8911 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8912 is not delivered after 4 days of temporary failure, it is bounced.
8915 If the retry section is removed from the configuration, or is empty (that is,
8916 if no retry rules are defined), Exim will not retry deliveries. This turns
8917 temporary errors into permanent errors.
8920 <section id="SECID58">
8921 <title>Rewriting configuration</title>
8923 The rewriting section of the configuration, introduced by
8925 <literallayout class="monospaced">
8929 contains rules for rewriting addresses in messages as they arrive. There are no
8930 rewriting rules in the default configuration file.
8933 <section id="SECTdefconfauth">
8934 <title>Authenticators configuration</title>
8936 <indexterm role="concept">
8937 <primary>AUTH</primary>
8938 <secondary>configuration</secondary>
8940 The authenticators section of the configuration, introduced by
8942 <literallayout class="monospaced">
8943 begin authenticators
8946 defines mechanisms for the use of the SMTP AUTH command. The default
8947 configuration file contains two commented-out example authenticators
8948 which support plaintext username/password authentication using the
8949 standard PLAIN mechanism and the traditional but non-standard LOGIN
8950 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8951 to support most MUA software.
8954 The example PLAIN authenticator looks like this:
8956 <literallayout class="monospaced">
8958 # driver = plaintext
8959 # server_set_id = $auth2
8960 # server_prompts = :
8961 # server_condition = Authentication is not yet configured
8962 # server_advertise_condition = ${if def:tls_cipher }
8965 And the example LOGIN authenticator looks like this:
8967 <literallayout class="monospaced">
8969 # driver = plaintext
8970 # server_set_id = $auth1
8971 # server_prompts = <| Username: | Password:
8972 # server_condition = Authentication is not yet configured
8973 # server_advertise_condition = ${if def:tls_cipher }
8976 The <option>server_set_id</option> option makes Exim remember the authenticated username
8977 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8978 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8979 that it implements the details of the specific authentication mechanism,
8980 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8981 when Exim offers authentication to clients; in the examples, this is only
8982 when TLS or SSL has been started, so to enable the authenticators you also
8983 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8986 The <option>server_condition</option> setting defines how to verify that the username and
8987 password are correct. In the examples it just produces an error message.
8988 To make the authenticators work, you can use a string expansion
8989 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8992 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
8993 usercode and password are in different positions. <xref linkend="CHAPplaintext"/>
8997 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
9002 <chapter id="CHAPregexp">
9003 <title>Regular expressions</title>
9005 <indexterm role="concept">
9006 <primary>regular expressions</primary>
9007 <secondary>library</secondary>
9009 <indexterm role="concept">
9010 <primary>PCRE</primary>
9012 Exim supports the use of regular expressions in many of its options. It
9013 uses the PCRE regular expression library; this provides regular expression
9014 matching that is compatible with Perl 5. The syntax and semantics of
9015 regular expressions is discussed in many Perl reference books, and also in
9016 Jeffrey Friedl’s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
9017 O’Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
9020 The documentation for the syntax and semantics of the regular expressions that
9021 are supported by PCRE is included in the PCRE distribution, and no further
9022 description is included here. The PCRE functions are called from Exim using
9023 the default option settings (that is, with no PCRE options set), except that
9024 the PCRE_CASELESS option is set when the matching is required to be
9028 In most cases, when a regular expression is required in an Exim configuration,
9029 it has to start with a circumflex, in order to distinguish it from plain text
9030 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
9031 second item in the colon-separated list is a regular expression.
9033 <literallayout class="monospaced">
9034 domains = a.b.c : ^\\d{3} : *.y.z : ...
9037 The doubling of the backslash is required because of string expansion that
9038 precedes interpretation – see section <xref linkend="SECTlittext"/> for more discussion
9039 of this issue, and a way of avoiding the need for doubling backslashes. The
9040 regular expression that is eventually used in this example contains just one
9041 backslash. The circumflex is included in the regular expression, and has the
9042 normal effect of <quote>anchoring</quote> it to the start of the string that is being
9046 There are, however, two cases where a circumflex is not required for the
9047 recognition of a regular expression: these are the <option>match</option> condition in a
9048 string expansion, and the <option>matches</option> condition in an Exim filter file. In
9049 these cases, the relevant string is always treated as a regular expression; if
9050 it does not start with a circumflex, the expression is not anchored, and can
9051 match anywhere in the subject string.
9054 In all cases, if you want a regular expression to match at the end of a string,
9055 you must code the $ metacharacter to indicate this. For example:
9057 <literallayout class="monospaced">
9058 domains = ^\\d{3}\\.example
9061 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
9064 <literallayout class="monospaced">
9065 domains = ^\\d{3}\\.example\$
9068 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
9069 $ is needed because string expansion also interprets dollar characters.
9073 <chapter id="CHAPfdlookup">
9074 <title>File and database lookups</title>
9076 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
9077 <primary>file</primary>
9078 <secondary>lookups</secondary>
9080 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
9081 <primary>database</primary>
9082 <secondary>lookups</secondary>
9084 <indexterm role="concept">
9085 <primary>lookup</primary>
9086 <secondary>description of</secondary>
9088 Exim can be configured to look up data in files or databases as it processes
9089 messages. Two different kinds of syntax are used:
9091 <orderedlist numeration="arabic">
9094 A string that is to be expanded may contain explicit lookup requests. These
9095 cause parts of the string to be replaced by data that is obtained from the
9096 lookup. Lookups of this type are conditional expansion items. Different results
9097 can be defined for the cases of lookup success and failure. See chapter
9098 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
9103 Lists of domains, hosts, and email addresses can contain lookup requests as a
9104 way of avoiding excessively long linear lists. In this case, the data that is
9105 returned by the lookup is often (but not always) discarded; whether the lookup
9106 succeeds or fails is what really counts. These kinds of list are described in
9107 chapter <xref linkend="CHAPdomhosaddlists"/>.
9112 String expansions, lists, and lookups interact with each other in such a way
9113 that there is no order in which to describe any one of them that does not
9114 involve references to the others. Each of these three chapters makes more sense
9115 if you have read the other two first. If you are reading this for the first
9116 time, be aware that some of it will make a lot more sense after you have read
9117 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
9119 <section id="SECID60">
9120 <title>Examples of different lookup syntax</title>
9122 It is easy to confuse the two different kinds of lookup, especially as the
9123 lists that may contain the second kind are always expanded before being
9124 processed as lists. Therefore, they may also contain lookups of the first kind.
9125 Be careful to distinguish between the following two examples:
9127 <literallayout class="monospaced">
9128 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
9129 domains = lsearch;/some/file
9132 The first uses a string expansion, the result of which must be a domain list.
9133 No strings have been specified for a successful or a failing lookup; the
9134 defaults in this case are the looked-up data and an empty string, respectively.
9135 The expansion takes place before the string is processed as a list, and the
9136 file that is searched could contain lines like this:
9138 <literallayout class="monospaced">
9139 192.168.3.4: domain1:domain2:...
9140 192.168.1.9: domain3:domain4:...
9143 When the lookup succeeds, the result of the expansion is a list of domains (and
9144 possibly other types of item that are allowed in domain lists).
9147 In the second example, the lookup is a single item in a domain list. It causes
9148 Exim to use a lookup to see if the domain that is being processed can be found
9149 in the file. The file could contains lines like this:
9151 <literallayout class="monospaced">
9156 Any data that follows the keys is not relevant when checking that the domain
9157 matches the list item.
9160 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9161 Consider a file containing lines like this:
9163 <literallayout class="monospaced">
9164 192.168.5.6: lsearch;/another/file
9167 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9168 first <option>domains</option> setting above generates the second setting, which therefore
9169 causes a second lookup to occur.
9172 The rest of this chapter describes the different lookup types that are
9173 available. Any of them can be used in any part of the configuration where a
9174 lookup is permitted.
9177 <section id="SECID61">
9178 <title>Lookup types</title>
9180 <indexterm role="concept">
9181 <primary>lookup</primary>
9182 <secondary>types of</secondary>
9184 <indexterm role="concept">
9185 <primary>single-key lookup</primary>
9186 <secondary>definition of</secondary>
9188 Two different types of data lookup are implemented:
9193 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9194 and a single key to search for. The key must be a non-empty string for the
9195 lookup to succeed. The lookup type determines how the file is searched.
9200 <indexterm role="concept">
9201 <primary>query-style lookup</primary>
9202 <secondary>definition of</secondary>
9204 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9205 key value is assumed by Exim for query-style lookups. You can use whichever
9206 Exim variables you need to construct the database query.
9211 The code for each lookup type is in a separate source file that is included in
9212 the binary of Exim only if the corresponding compile-time option is set. The
9213 default settings in <filename>src/EDITME</filename> are:
9215 <literallayout class="monospaced">
9220 which means that only linear searching and DBM lookups are included by default.
9221 For some types of lookup (e.g. SQL databases), you need to install appropriate
9222 libraries and header files before building Exim.
9225 <section id="SECTsinglekeylookups">
9226 <title>Single-key lookup types</title>
9228 <indexterm role="concept">
9229 <primary>lookup</primary>
9230 <secondary>single-key types</secondary>
9232 <indexterm role="concept">
9233 <primary>single-key lookup</primary>
9234 <secondary>list of types</secondary>
9236 The following single-key lookup types are implemented:
9241 <indexterm role="concept">
9242 <primary>cdb</primary>
9243 <secondary>description of</secondary>
9245 <indexterm role="concept">
9246 <primary>lookup</primary>
9247 <secondary>cdb</secondary>
9249 <indexterm role="concept">
9250 <primary>binary zero</primary>
9251 <secondary>in lookup key</secondary>
9253 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9254 string without a terminating binary zero. The cdb format is designed for
9255 indexed files that are read frequently and never updated, except by total
9256 re-creation. As such, it is particularly suitable for large files containing
9257 aliases or other indexed data referenced by an MTA. Information about cdb can
9258 be found in several places:
9261 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9262 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9263 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9266 A cdb distribution is not needed in order to build Exim with cdb support,
9267 because the code for reading cdb files is included directly in Exim itself.
9268 However, no means of building or testing cdb files is provided with Exim, so
9269 you need to obtain a cdb distribution in order to do this.
9274 <indexterm role="concept">
9275 <primary>DBM</primary>
9276 <secondary>lookup type</secondary>
9278 <indexterm role="concept">
9279 <primary>lookup</primary>
9280 <secondary>dbm</secondary>
9282 <indexterm role="concept">
9283 <primary>binary zero</primary>
9284 <secondary>in lookup key</secondary>
9286 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9287 DBM file by looking up the record with the given key. A terminating binary
9288 zero is included in the key that is passed to the DBM library. See section
9289 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9292 <indexterm role="concept">
9293 <primary>Berkeley DB library</primary>
9294 <secondary>file format</secondary>
9296 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9297 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9298 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9299 the DB_UNKNOWN option. This enables it to handle any of the types of database
9300 that the library supports, and can be useful for accessing DBM files created by
9301 other applications. (For earlier DB versions, DB_HASH is always used.)
9306 <indexterm role="concept">
9307 <primary>lookup</primary>
9308 <secondary>dbmnz</secondary>
9310 <indexterm role="concept">
9311 <primary>lookup</primary>
9312 <secondary>dbm – terminating zero</secondary>
9314 <indexterm role="concept">
9315 <primary>binary zero</primary>
9316 <secondary>in lookup key</secondary>
9318 <indexterm role="concept">
9319 <primary>Courier</primary>
9321 <indexterm role="concept">
9322 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9324 <indexterm role="concept">
9325 <primary>dmbnz lookup type</primary>
9327 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9328 is not included in the key that is passed to the DBM library. You may need this
9329 if you want to look up data in files that are created by or shared with some
9330 other application that does not use terminating zeros. For example, you need to
9331 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9332 calls using the passwords from Courier’s <filename>/etc/userdbshadow.dat</filename> file. Exim’s
9333 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9334 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9339 <indexterm role="concept">
9340 <primary>lookup</primary>
9341 <secondary>dsearch</secondary>
9343 <indexterm role="concept">
9344 <primary>dsearch lookup type</primary>
9346 <command>dsearch</command>: The given file must be a directory; this is searched for an entry
9347 whose name is the key by calling the <function>lstat()</function> function. The key may not
9348 contain any forward slash characters. If <function>lstat()</function> succeeds, the result of
9349 the lookup is the name of the entry, which may be a file, directory,
9350 symbolic link, or any other kind of directory entry. An example of how this
9351 lookup can be used to support virtual domains is given in section
9352 <xref linkend="SECTvirtualdomains"/>.
9357 <indexterm role="concept">
9358 <primary>lookup</primary>
9359 <secondary>iplsearch</secondary>
9361 <indexterm role="concept">
9362 <primary>iplsearch lookup type</primary>
9364 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9365 terminated by a colon or white space or the end of the line. The keys in the
9366 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9367 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9368 being interpreted as a key terminator. For example:
9370 <literallayout class="monospaced">
9371 1.2.3.4: data for 1.2.3.4
9372 192.168.0.0/16: data for 192.168.0.0/16
9373 "abcd::cdab": data for abcd::cdab
9374 "abcd:abcd::/32" data for abcd:abcd::/32
9377 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9378 file is searched linearly, using the CIDR masks where present, until a matching
9379 key is found. The first key that matches is used; there is no attempt to find a
9380 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9381 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9384 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9385 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9386 lookup types support only literal keys.
9389 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9390 the implicit key is the host’s IP address rather than its name (see section
9391 <xref linkend="SECThoslispatsikey"/>).
9396 <indexterm role="concept">
9397 <primary>linear search</primary>
9399 <indexterm role="concept">
9400 <primary>lookup</primary>
9401 <secondary>lsearch</secondary>
9403 <indexterm role="concept">
9404 <primary>lsearch lookup type</primary>
9406 <indexterm role="concept">
9407 <primary>case sensitivity</primary>
9408 <secondary>in lsearch lookup</secondary>
9410 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9411 line beginning with the search key, terminated by a colon or white space or the
9412 end of the line. The search is case-insensitive; that is, upper and lower case
9413 letters are treated as the same. The first occurrence of the key that is found
9414 in the file is used.
9417 White space between the key and the colon is permitted. The remainder of the
9418 line, with leading and trailing white space removed, is the data. This can be
9419 continued onto subsequent lines by starting them with any amount of white
9420 space, but only a single space character is included in the data at such a
9421 junction. If the data begins with a colon, the key must be terminated by a
9424 <literallayout class="monospaced">
9428 Empty lines and lines beginning with # are ignored, even if they occur in the
9429 middle of an item. This is the traditional textual format of alias files. Note
9430 that the keys in an <command>lsearch</command> file are literal strings. There is no
9431 wildcarding of any kind.
9434 <indexterm role="concept">
9435 <primary>lookup</primary>
9436 <secondary>lsearch – colons in keys</secondary>
9438 <indexterm role="concept">
9439 <primary>white space</primary>
9440 <secondary>in lsearch key</secondary>
9442 In most <command>lsearch</command> files, keys are not required to contain colons or #
9443 characters, or white space. However, if you need this feature, it is available.
9444 If a key begins with a doublequote character, it is terminated only by a
9445 matching quote (or end of line), and the normal escaping rules apply to its
9446 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9447 quoted keys (exactly as for unquoted keys). There is no special handling of
9448 quotes for the data part of an <command>lsearch</command> line.
9453 <indexterm role="concept">
9454 <primary>NIS lookup type</primary>
9456 <indexterm role="concept">
9457 <primary>lookup</primary>
9458 <secondary>NIS</secondary>
9460 <indexterm role="concept">
9461 <primary>binary zero</primary>
9462 <secondary>in lookup key</secondary>
9464 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9465 the given key, without a terminating binary zero. There is a variant called
9466 <command>nis0</command> which does include the terminating binary zero in the key. This is
9467 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9468 aliases; the full map names must be used.
9473 <indexterm role="concept">
9474 <primary>wildlsearch lookup type</primary>
9476 <indexterm role="concept">
9477 <primary>lookup</primary>
9478 <secondary>wildlsearch</secondary>
9480 <indexterm role="concept">
9481 <primary>nwildlsearch lookup type</primary>
9483 <indexterm role="concept">
9484 <primary>lookup</primary>
9485 <secondary>nwildlsearch</secondary>
9487 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9488 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9489 the file may be wildcarded. The difference between these two lookup types is
9490 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9491 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9494 <indexterm role="concept">
9495 <primary>case sensitivity</primary>
9496 <secondary>in (n)wildlsearch lookup</secondary>
9498 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9499 file that are regular expressions can be made case-sensitive by the use of
9500 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9502 <orderedlist numeration="arabic">
9505 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9507 <literallayout class="monospaced">
9508 *.a.b.c data for anything.a.b.c
9509 *fish data for anythingfish
9514 The string may begin with a circumflex to indicate a regular expression. For
9515 example, for <command>wildlsearch</command>:
9517 <literallayout class="monospaced">
9518 ^\N\d+\.a\.b\N data for <digits>.a.b
9521 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9522 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9523 string-expanded, the equivalent entry is:
9525 <literallayout class="monospaced">
9526 ^\d+\.a\.b data for <digits>.a.b
9529 The case-insensitive flag is set at the start of compiling the regular
9530 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9531 For example, to make the entire pattern case-sensitive:
9533 <literallayout class="monospaced">
9534 ^(?-i)\d+\.a\.b data for <digits>.a.b
9537 If the regular expression contains white space or colon characters, you must
9538 either quote it (see <command>lsearch</command> above), or represent these characters in other
9539 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9540 colon. This may be easier than quoting, because if you quote, you have to
9541 escape all the backslashes inside the quotes.
9544 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9545 match for later use, because the results of all lookups are cached. If a lookup
9546 is repeated, the result is taken from the cache, and no actual pattern matching
9547 takes place. The values of all the numeric variables are unset after a
9548 <command>(n)wildlsearch</command> match.
9553 Although I cannot see it being of much use, the general matching function that
9554 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9555 lookup name terminated by a semicolon, and followed by lookup data. For
9558 <literallayout class="monospaced">
9559 cdb;/some/file data for keys that match the file
9562 The data that is obtained from the nested lookup is discarded.
9567 Keys that do not match any of these patterns are interpreted literally. The
9568 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9569 be followed by optional colons.
9572 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9573 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9574 lookup types support only literal keys.
9579 <section id="SECID62">
9580 <title>Query-style lookup types</title>
9582 <indexterm role="concept">
9583 <primary>lookup</primary>
9584 <secondary>query-style types</secondary>
9586 <indexterm role="concept">
9587 <primary>query-style lookup</primary>
9588 <secondary>list of types</secondary>
9590 The supported query-style lookup types are listed below. Further details about
9591 many of them are given in later sections.
9596 <indexterm role="concept">
9597 <primary>DNS</primary>
9598 <secondary>as a lookup type</secondary>
9600 <indexterm role="concept">
9601 <primary>lookup</primary>
9602 <secondary>DNS</secondary>
9604 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9605 are given in the supplied query. The resulting data is the contents of the
9606 records. See section <xref linkend="SECTdnsdb"/>.
9611 <indexterm role="concept">
9612 <primary>InterBase lookup type</primary>
9614 <indexterm role="concept">
9615 <primary>lookup</primary>
9616 <secondary>InterBase</secondary>
9618 <command>ibase</command>: This does a lookup in an InterBase database.
9623 <indexterm role="concept">
9624 <primary>LDAP</primary>
9625 <secondary>lookup type</secondary>
9627 <indexterm role="concept">
9628 <primary>lookup</primary>
9629 <secondary>LDAP</secondary>
9631 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9632 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9633 that permits values from multiple entries to be returned. A third variant
9634 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9635 any attribute values. See section <xref linkend="SECTldap"/>.
9640 <indexterm role="concept">
9641 <primary>MySQL</primary>
9642 <secondary>lookup type</secondary>
9644 <indexterm role="concept">
9645 <primary>lookup</primary>
9646 <secondary>MySQL</secondary>
9648 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9649 MySQL database. See section <xref linkend="SECTsql"/>.
9654 <indexterm role="concept">
9655 <primary>NIS+ lookup type</primary>
9657 <indexterm role="concept">
9658 <primary>lookup</primary>
9659 <secondary>NIS+</secondary>
9661 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9662 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9667 <indexterm role="concept">
9668 <primary>Oracle</primary>
9669 <secondary>lookup type</secondary>
9671 <indexterm role="concept">
9672 <primary>lookup</primary>
9673 <secondary>Oracle</secondary>
9675 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9676 Oracle database. See section <xref linkend="SECTsql"/>.
9681 <indexterm role="concept">
9682 <primary>lookup</primary>
9683 <secondary>passwd</secondary>
9685 <indexterm role="concept">
9686 <primary>passwd lookup type</primary>
9688 <indexterm role="concept">
9689 <primary><filename>/etc/passwd</filename></primary>
9691 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9692 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9693 success, the result string is the same as you would get from an <command>lsearch</command>
9694 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9695 password value. For example:
9697 <literallayout class="monospaced">
9698 *:42:42:King Rat:/home/kr:/bin/bash
9703 <indexterm role="concept">
9704 <primary>PostgreSQL lookup type</primary>
9706 <indexterm role="concept">
9707 <primary>lookup</primary>
9708 <secondary>PostgreSQL</secondary>
9710 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9711 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9716 <indexterm role="concept">
9717 <primary>sqlite lookup type</primary>
9719 <indexterm role="concept">
9720 <primary>lookup</primary>
9721 <secondary>sqlite</secondary>
9723 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9724 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9729 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9730 not likely to be useful in normal operation.
9735 <indexterm role="concept">
9736 <primary>whoson lookup type</primary>
9738 <indexterm role="concept">
9739 <primary>lookup</primary>
9740 <secondary>whoson</secondary>
9742 <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
9743 allows a server to check whether a particular (dynamically allocated) IP
9744 address is currently allocated to a known (trusted) user and, optionally, to
9745 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
9746 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
9747 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
9748 <quote>POP before SMTP</quote> checking using ACL statements such as
9750 <literallayout class="monospaced">
9751 require condition = \
9752 ${lookup whoson {$sender_host_address}{yes}{no}}
9755 The query consists of a single IP address. The value returned is the name of
9756 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9757 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9758 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9763 <section id="SECID63">
9764 <title>Temporary errors in lookups</title>
9766 <indexterm role="concept">
9767 <primary>lookup</primary>
9768 <secondary>temporary error in</secondary>
9770 Lookup functions can return temporary error codes if the lookup cannot be
9771 completed. For example, an SQL or LDAP database might be unavailable. For this
9772 reason, it is not advisable to use a lookup that might do this for critical
9773 options such as a list of local domains.
9776 When a lookup cannot be completed in a router or transport, delivery
9777 of the message (to the relevant address) is deferred, as for any other
9778 temporary error. In other circumstances Exim may assume the lookup has failed,
9779 or may give up altogether.
9782 <section id="SECTdefaultvaluelookups">
9783 <title>Default values in single-key lookups</title>
9785 <indexterm role="concept">
9786 <primary>wildcard lookups</primary>
9788 <indexterm role="concept">
9789 <primary>lookup</primary>
9790 <secondary>default values</secondary>
9792 <indexterm role="concept">
9793 <primary>lookup</primary>
9794 <secondary>wildcard</secondary>
9796 <indexterm role="concept">
9797 <primary>lookup</primary>
9798 <secondary>* added to type</secondary>
9800 <indexterm role="concept">
9801 <primary>default</primary>
9802 <secondary>in single-key lookups</secondary>
9804 In this context, a <quote>default value</quote> is a value specified by the administrator
9805 that is to be used if a lookup fails.
9808 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9809 lookups, the facilities of the query language must be used. An attempt to
9810 specify a default for a query-style lookup provokes an error.
9813 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9814 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9815 provide a default value. See also the section on partial matching below.
9818 <indexterm role="concept">
9819 <primary>*@ with single-key lookup</primary>
9821 <indexterm role="concept">
9822 <primary>lookup</primary>
9823 <secondary>*@ added to type</secondary>
9825 <indexterm role="concept">
9826 <primary>alias file</primary>
9827 <secondary>per-domain default</secondary>
9829 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9830 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9831 character, a second lookup is done with everything before the last @ replaced
9832 by *. This makes it possible to provide per-domain defaults in alias files
9833 that include the domains in the keys. If the second lookup fails (or doesn’t
9834 take place because there is no @ in the key), <quote>*</quote> is looked up.
9835 For example, a <command>redirect</command> router might contain:
9837 <literallayout class="monospaced">
9838 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9841 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9842 looks up these keys, in this order:
9844 <literallayout class="monospaced">
9850 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9851 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9852 complete scan is done for each key, and only if it is not found at all does
9853 Exim move on to try the next key.
9856 <section id="SECTpartiallookup">
9857 <title>Partial matching in single-key lookups</title>
9859 <indexterm role="concept">
9860 <primary>partial matching</primary>
9862 <indexterm role="concept">
9863 <primary>wildcard lookups</primary>
9865 <indexterm role="concept">
9866 <primary>lookup</primary>
9867 <secondary>partial matching</secondary>
9869 <indexterm role="concept">
9870 <primary>lookup</primary>
9871 <secondary>wildcard</secondary>
9873 <indexterm role="concept">
9874 <primary>asterisk</primary>
9875 <secondary>in search type</secondary>
9877 The normal operation of a single-key lookup is to search the file for an exact
9878 match with the given key. However, in a number of situations where domains are
9879 being looked up, it is useful to be able to do partial matching. In this case,
9880 information in the file that has a key starting with <quote>*.</quote> is matched by any
9881 domain that ends with the components that follow the full stop. For example, if
9882 a key in a DBM file is
9884 <literallayout class="monospaced">
9885 *.dates.fict.example
9888 then when partial matching is enabled this is matched by (amongst others)
9889 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9890 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9894 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9895 also not available for any lookup items in address lists (see section
9896 <xref linkend="SECTaddresslist"/>).
9899 Partial matching is implemented by doing a series of separate lookups using
9900 keys constructed by modifying the original subject key. This means that it can
9901 be used with any of the single-key lookup types, provided that
9902 partial matching keys
9903 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9904 Keys in the file that do not begin with the prefix are matched only by
9905 unmodified subject keys when partial matching is in use.
9908 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9909 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9910 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9911 is added at the start of the subject key, and it is looked up again. If that
9912 fails, further lookups are tried with dot-separated components removed from the
9913 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9917 A minimum number of two non-* components are required. This can be adjusted
9918 by including a number before the hyphen in the search type. For example,
9919 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9920 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9921 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9922 up when the minimum number of non-* components is two:
9924 <literallayout class="monospaced">
9925 2250.dates.fict.example
9926 *.2250.dates.fict.example
9927 *.dates.fict.example
9931 As soon as one key in the sequence is successfully looked up, the lookup
9935 <indexterm role="concept">
9936 <primary>lookup</primary>
9937 <secondary>partial matching – changing prefix</secondary>
9939 <indexterm role="concept">
9940 <primary>prefix</primary>
9941 <secondary>for partial matching</secondary>
9943 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9944 changed. The motivation for this feature is to allow Exim to operate with file
9945 formats that are used by other MTAs. A different prefix can be supplied in
9946 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9948 <literallayout class="monospaced">
9949 domains = partial(.)lsearch;/some/file
9952 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9953 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9954 components is unchanged). The prefix may consist of any punctuation characters
9955 other than a closing parenthesis. It may be empty, for example:
9957 <literallayout class="monospaced">
9958 domains = partial1()cdb;/some/file
9961 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9962 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9965 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9966 just one non-wild component has failed, and the original key is shortened right
9967 down to the null string) depends on the prefix:
9972 If the prefix has zero length, the whole lookup fails.
9977 If the prefix has length 1, a lookup for just the prefix is done. For
9978 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9983 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9984 remainder is looked up. With the default prefix, therefore, the final lookup is
9985 for <quote>*</quote> on its own.
9990 Otherwise, the whole prefix is looked up.
9995 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9996 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9997 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9998 specified, adding <quote>*</quote> to the search type has no effect with the default
9999 prefix, because the <quote>*</quote> key is already included in the sequence of partial
10000 lookups. However, there might be a use for lookup types such as
10001 <quote>partial0(.)lsearch*</quote>.
10004 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
10005 in domain lists and the like. Partial matching works only in terms of
10006 dot-separated components; a key such as <literal>*fict.example</literal>
10007 in a database file is useless, because the asterisk in a partial matching
10008 subject key is always followed by a dot.
10011 <section id="SECID64">
10012 <title>Lookup caching</title>
10014 <indexterm role="concept">
10015 <primary>lookup</primary>
10016 <secondary>caching</secondary>
10018 <indexterm role="concept">
10019 <primary>caching</primary>
10020 <secondary>lookup data</secondary>
10022 Exim caches all lookup results in order to avoid needless repetition of
10023 lookups. However, because (apart from the daemon) Exim operates as a collection
10024 of independent, short-lived processes, this caching applies only within a
10025 single Exim process. There is no inter-process lookup caching facility.
10028 For single-key lookups, Exim keeps the relevant files open in case there is
10029 another lookup that needs them. In some types of configuration this can lead to
10030 many files being kept open for messages with many recipients. To avoid hitting
10031 the operating system limit on the number of simultaneously open files, Exim
10032 closes the least recently used file when it needs to open more files than its
10033 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
10036 The single-key lookup files are closed and the lookup caches are flushed at
10037 strategic points during delivery – for example, after all routing is
10041 <section id="SECID65">
10042 <title>Quoting lookup data</title>
10044 <indexterm role="concept">
10045 <primary>lookup</primary>
10046 <secondary>quoting</secondary>
10048 <indexterm role="concept">
10049 <primary>quoting</primary>
10050 <secondary>in lookups</secondary>
10052 When data from an incoming message is included in a query-style lookup, there
10053 is the possibility of special characters in the data messing up the syntax of
10054 the query. For example, a NIS+ query that contains
10056 <literallayout class="monospaced">
10060 will be broken if the local part happens to contain a closing square bracket.
10061 For NIS+, data can be enclosed in double quotes like this:
10063 <literallayout class="monospaced">
10064 [name="$local_part"]
10067 but this still leaves the problem of a double quote in the data. The rule for
10068 NIS+ is that double quotes must be doubled. Other lookup types have different
10069 rules, and to cope with the differing requirements, an expansion operator
10070 of the following form is provided:
10072 <literallayout class="monospaced">
10073 ${quote_<lookup-type>:<string>}
10076 For example, the safest way to write the NIS+ query is
10078 <literallayout class="monospaced">
10079 [name="${quote_nisplus:$local_part}"]
10082 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
10083 operator can be used for all lookup types, but has no effect for single-key
10084 lookups, since no quoting is ever needed in their key strings.
10087 <section id="SECTdnsdb">
10088 <title>More about dnsdb</title>
10090 <indexterm role="concept">
10091 <primary>dnsdb lookup</primary>
10093 <indexterm role="concept">
10094 <primary>lookup</primary>
10095 <secondary>dnsdb</secondary>
10097 <indexterm role="concept">
10098 <primary>DNS</primary>
10099 <secondary>as a lookup type</secondary>
10101 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
10102 of a record type and a domain name, separated by an equals sign. For example,
10103 an expansion string could contain:
10105 <literallayout class="monospaced">
10106 ${lookup dnsdb{mx=a.b.example}{$value}fail}
10109 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
10110 is used on its own as the result. If the lookup does not succeed, the
10111 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> – see section
10112 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
10115 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
10116 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
10117 configured). If no type is given, TXT is assumed. When the type is PTR,
10118 the data can be an IP address, written as normal; inversion and the addition of
10119 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
10121 <literallayout class="monospaced">
10122 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
10125 If the data for a PTR record is not a syntactically valid IP address, it is not
10126 altered and nothing is added.
10129 <indexterm role="concept">
10130 <primary>MX record</primary>
10131 <secondary>in <command>dnsdb</command> lookup</secondary>
10133 <indexterm role="concept">
10134 <primary>SRV record</primary>
10135 <secondary>in <command>dnsdb</command> lookup</secondary>
10137 For an MX lookup, both the preference value and the host name are returned for
10138 each record, separated by a space. For an SRV lookup, the priority, weight,
10139 port, and host name are returned for each record, separated by spaces.
10142 For any record type, if multiple records are found (or, for A6 lookups, if a
10143 single record leads to multiple addresses), the data is returned as a
10144 concatenation, with newline as the default separator. The order, of course,
10145 depends on the DNS resolver. You can specify a different separator character
10146 between multiple records by putting a right angle-bracket followed immediately
10147 by the new separator at the start of the query. For example:
10149 <literallayout class="monospaced">
10150 ${lookup dnsdb{>: a=host1.example}}
10153 It is permitted to specify a space as the separator character. Further
10154 white space is ignored.
10157 <indexterm role="concept">
10158 <primary>TXT record</primary>
10159 <secondary>in <command>dnsdb</command> lookup</secondary>
10161 For TXT records with multiple items of data, only the first item is returned,
10162 unless a separator for them is specified using a comma after the separator
10163 character followed immediately by the TXT record item separator. To concatenate
10164 items without a separator, use a semicolon instead.
10166 <literallayout class="monospaced">
10167 ${lookup dnsdb{>\n,: txt=a.b.example}}
10168 ${lookup dnsdb{>\n; txt=a.b.example}}
10171 It is permitted to specify a space as the separator character. Further
10172 white space is ignored.
10175 <section id="SECID66">
10176 <title>Pseudo dnsdb record types</title>
10178 <indexterm role="concept">
10179 <primary>MX record</primary>
10180 <secondary>in <command>dnsdb</command> lookup</secondary>
10182 By default, both the preference value and the host name are returned for
10183 each MX record, separated by a space. If you want only host names, you can use
10184 the pseudo-type MXH:
10186 <literallayout class="monospaced">
10187 ${lookup dnsdb{mxh=a.b.example}}
10190 In this case, the preference values are omitted, and just the host names are
10194 <indexterm role="concept">
10195 <primary>name server for enclosing domain</primary>
10197 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10198 records on the given domain, but if none are found, it removes the first
10199 component of the domain name, and tries again. This process continues until NS
10200 records are found or there are no more components left (or there is a DNS
10201 error). In other words, it may return the name servers for a top-level domain,
10202 but it never returns the root name servers. If there are no NS records for the
10203 top-level domain, the lookup fails. Consider these examples:
10205 <literallayout class="monospaced">
10206 ${lookup dnsdb{zns=xxx.quercite.com}}
10207 ${lookup dnsdb{zns=xxx.edu}}
10210 Assuming that in each case there are no NS records for the full domain name,
10211 the first returns the name servers for <option>quercite.com</option>, and the second returns
10212 the name servers for <option>edu</option>.
10215 You should be careful about how you use this lookup because, unless the
10216 top-level domain does not exist, the lookup always returns some host names. The
10217 sort of use to which this might be put is for seeing if the name servers for a
10218 given domain are on a blacklist. You can probably assume that the name servers
10219 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10223 <indexterm role="concept">
10224 <primary>CSA</primary>
10225 <secondary>in <command>dnsdb</command> lookup</secondary>
10227 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10228 records according to the CSA rules, which are described in section
10229 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10230 not sufficient because of the extra parent domain search behaviour of CSA. The
10231 result of a successful lookup such as:
10233 <literallayout class="monospaced">
10234 ${lookup dnsdb {csa=$sender_helo_name}}
10237 has two space-separated fields: an authorization code and a target host name.
10238 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10239 authorization required but absent, or <quote>?</quote> for unknown.
10242 <section id="SECID67">
10243 <title>Multiple dnsdb lookups</title>
10245 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10246 However, you can specify a list of domains or IP addresses in a single
10247 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10248 the default separator, but with the ability to change this. For example:
10250 <literallayout class="monospaced">
10251 ${lookup dnsdb{one.domain.com:two.domain.com}}
10252 ${lookup dnsdb{a=one.host.com:two.host.com}}
10253 ${lookup dnsdb{ptr = <; 1.2.3.4 ; 4.5.6.8}}
10256 In order to retain backwards compatibility, there is one special case: if
10257 the lookup type is PTR and no change of separator is specified, Exim looks
10258 to see if the rest of the string is precisely one IPv6 address. In this
10259 case, it does not treat it as a list.
10262 The data from each lookup is concatenated, with newline separators by default,
10263 in the same way that multiple DNS records for a single item are handled. A
10264 different separator can be specified, as described above.
10267 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10268 temporary DNS error for any of them, the behaviour is controlled by
10269 an optional keyword followed by a comma that may appear before the record
10270 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10271 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10272 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10273 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10274 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10275 error causes the whole lookup to defer only if none of the other lookups
10276 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10278 <literallayout class="monospaced">
10279 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10280 ${lookup dnsdb{a=one.host.com:two.host.com}}
10283 Thus, in the default case, as long as at least one of the DNS lookups
10284 yields some data, the lookup succeeds.
10287 <section id="SECTldap">
10288 <title>More about LDAP</title>
10290 <indexterm role="concept">
10291 <primary>LDAP</primary>
10292 <secondary>lookup, more about</secondary>
10294 <indexterm role="concept">
10295 <primary>lookup</primary>
10296 <secondary>LDAP</secondary>
10298 <indexterm role="concept">
10299 <primary>Solaris</primary>
10300 <secondary>LDAP</secondary>
10302 The original LDAP implementation came from the University of Michigan; this has
10303 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10304 implementation comes from Netscape, and Solaris 7 and subsequent releases
10305 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10306 the lookup function level, their error handling is different. For this reason
10307 it is necessary to set a compile-time variable when building Exim with LDAP, to
10308 indicate which LDAP library is in use. One of the following should appear in
10309 your <filename>Local/Makefile</filename>:
10311 <literallayout class="monospaced">
10312 LDAP_LIB_TYPE=UMICHIGAN
10313 LDAP_LIB_TYPE=OPENLDAP1
10314 LDAP_LIB_TYPE=OPENLDAP2
10315 LDAP_LIB_TYPE=NETSCAPE
10316 LDAP_LIB_TYPE=SOLARIS
10319 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10320 same interface as the University of Michigan version.
10323 There are three LDAP lookup types in Exim. These behave slightly differently in
10324 the way they handle the results of a query:
10329 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10335 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10336 Distinguished Name that is returned rather than any attribute values.
10341 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10342 from all of them are returned.
10347 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10348 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10349 the data returned by a successful lookup is described in the next section.
10350 First we explain how LDAP queries are coded.
10353 <section id="SECTforldaque">
10354 <title>Format of LDAP queries</title>
10356 <indexterm role="concept">
10357 <primary>LDAP</primary>
10358 <secondary>query format</secondary>
10360 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10361 the configuration of a <command>redirect</command> router one might have this setting:
10363 <literallayout class="monospaced">
10364 data = ${lookup ldap \
10365 {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10366 c=UK?mailbox?base?}}
10369 <indexterm role="concept">
10370 <primary>LDAP</primary>
10371 <secondary>with TLS</secondary>
10373 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10374 secure (encrypted) LDAP connections. The second of these ensures that an
10375 encrypted TLS connection is used.
10378 <section id="SECID68">
10379 <title>LDAP quoting</title>
10381 <indexterm role="concept">
10382 <primary>LDAP</primary>
10383 <secondary>quoting</secondary>
10385 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10386 and the second because the LDAP query is represented as a URL. Furthermore,
10387 within an LDAP query, two different kinds of quoting are required. For this
10388 reason, there are two different LDAP-specific quoting operators.
10391 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10392 filter specifications. Conceptually, it first does the following conversions on
10395 <literallayout class="monospaced">
10402 in accordance with RFC 2254. The resulting string is then quoted according
10403 to the rules for URLs, that is, all non-alphanumeric characters except
10405 <literallayout class="monospaced">
10406 ! $ ' - . _ ( ) * +
10409 are converted to their hex values, preceded by a percent sign. For example:
10411 <literallayout class="monospaced">
10412 ${quote_ldap: a(bc)*, a<yz>; }
10417 <literallayout class="monospaced">
10418 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10421 Removing the URL quoting, this is (with a leading and a trailing space):
10423 <literallayout class="monospaced">
10424 a\28bc\29\2A, a<yz>;
10427 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10428 base DN specifications in queries. Conceptually, it first converts the string
10429 by inserting a backslash in front of any of the following characters:
10431 <literallayout class="monospaced">
10432 , + " \ < > ;
10435 It also inserts a backslash before any leading spaces or # characters, and
10436 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10437 is then quoted according to the rules for URLs. For example:
10439 <literallayout class="monospaced">
10440 ${quote_ldap_dn: a(bc)*, a<yz>; }
10445 <literallayout class="monospaced">
10446 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10449 Removing the URL quoting, this is (with a trailing space):
10451 <literallayout class="monospaced">
10452 \ a(bc)*\, a\<yz\>\;\
10455 There are some further comments about quoting in the section on LDAP
10456 authentication below.
10459 <section id="SECID69">
10460 <title>LDAP connections</title>
10462 <indexterm role="concept">
10463 <primary>LDAP</primary>
10464 <secondary>connections</secondary>
10466 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10467 is in use, via a Unix domain socket. The example given above does not specify
10468 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10469 by starting it with
10471 <literallayout class="monospaced">
10472 ldap://<hostname>:<port>/...
10475 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10476 used. When no server is specified in a query, a list of default servers is
10477 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10478 colon-separated list of servers which are tried in turn until one successfully
10479 handles a query, or there is a serious error. Successful handling either
10480 returns the requested data, or indicates that it does not exist. Serious errors
10481 are syntactical, or multiple values when only a single value is expected.
10482 Errors which cause the next server to be tried are connection failures, bind
10483 failures, and timeouts.
10486 For each server name in the list, a port number can be given. The standard way
10487 of specifying a host and port is to use a colon separator (RFC 1738). Because
10488 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10489 doubled. For example
10491 <literallayout class="monospaced">
10492 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10495 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10496 to the LDAP library with no server name, and the library’s default (normally
10497 the local host) is used.
10500 If you are using the OpenLDAP library, you can connect to an LDAP server using
10501 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10502 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10503 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10507 For this type of connection, instead of a host name for the server, a pathname
10508 for the socket is required, and the port number is not relevant. The pathname
10509 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10510 the query. In the former case, you can have settings such as
10512 <literallayout class="monospaced">
10513 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10516 When the pathname is given in the query, you have to escape the slashes as
10517 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10519 <literallayout class="monospaced">
10520 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10523 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10524 a pathname, it uses the Unix domain socket code, even if the query actually
10525 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10526 socket connection. This behaviour means that you can use a setting of
10527 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10528 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10529 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10533 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10534 specified, an error is diagnosed. However, if there are more items in
10535 <option>ldap_default_servers</option>, they are tried. In other words:
10540 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10546 Using <literal>ldapi</literal> with a host name causes an error.
10551 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10552 <option>ldap_default_servers</option>, does whatever the library does by default.
10555 <section id="SECID70">
10556 <title>LDAP authentication and control information</title>
10558 <indexterm role="concept">
10559 <primary>LDAP</primary>
10560 <secondary>authentication</secondary>
10562 The LDAP URL syntax provides no way of passing authentication and other control
10563 information to the server. To make this possible, the URL in an LDAP query may
10564 be preceded by any number of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> settings, separated by
10565 spaces. If a value contains spaces it must be enclosed in double quotes, and
10566 when double quotes are used, backslash is interpreted in the usual way inside
10567 them. The following names are recognized:
10570 <literal>DEREFERENCE</literal> set the dereferencing parameter
10571 <literal>NETTIME </literal> set a timeout for a network operation
10572 <literal>USER </literal> set the DN, for authenticating the LDAP bind
10573 <literal>PASS </literal> set the password, likewise
10574 <literal>REFERRALS </literal> set the referrals parameter
10575 <literal>SIZE </literal> set the limit for the number of entries returned
10576 <literal>TIME </literal> set the maximum waiting time for a query
10579 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10580 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10581 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10582 library from trying to follow referrals issued by the LDAP server.
10585 The name CONNECT is an obsolete name for NETTIME, retained for
10586 backwards compatibility. This timeout (specified as a number of seconds) is
10587 enforced from the client end for operations that can be carried out over a
10588 network. Specifically, it applies to network connections and calls to the
10589 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10590 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10591 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10592 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10593 Netscape SDK; for OpenLDAP no action is taken.
10596 The TIME parameter (also a number of seconds) is passed to the server to
10597 set a server-side limit on the time taken to complete a search.
10600 Here is an example of an LDAP query in an Exim lookup that uses some of these
10601 values. This is a single line, folded to fit on the page:
10603 <literallayout class="monospaced">
10605 {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10606 ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10610 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10611 any of the auxiliary data. Exim configuration settings that include lookups
10612 which contain password information should be preceded by <quote>hide</quote> to prevent
10613 non-admin users from using the <option>-bP</option> option to see their values.
10616 The auxiliary data items may be given in any order. The default is no
10617 connection timeout (the system timeout is used), no user or password, no limit
10618 on the number of entries returned, and no time limit on queries.
10621 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10622 removes any URL quoting that it may contain before passing it LDAP. Apparently
10623 some libraries do this for themselves, but some do not. Removing the URL
10624 quoting has two advantages:
10629 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10630 DNs as with DNs inside actual queries.
10635 It permits spaces inside USER= DNs.
10640 For example, a setting such as
10642 <literallayout class="monospaced">
10643 USER=cn=${quote_ldap_dn:$1}
10646 should work even if <varname>$1</varname> contains spaces.
10649 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10650 expansion operator, rather than the LDAP quote operators. The only reason this
10651 field needs quoting is to ensure that it conforms to the Exim syntax, which
10652 does not allow unquoted spaces. For example:
10654 <literallayout class="monospaced">
10658 The LDAP authentication mechanism can be used to check passwords as part of
10659 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10660 <xref linkend="CHAPexpand"/>.
10663 <section id="SECID71">
10664 <title>Format of data returned by LDAP</title>
10666 <indexterm role="concept">
10667 <primary>LDAP</primary>
10668 <secondary>returned data formats</secondary>
10670 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10671 as a sequence of values, for example
10673 <literallayout class="monospaced">
10674 cn=manager, o=University of Cambridge, c=UK
10677 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10678 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10679 the result between the data from different entries. It is possible for multiple
10680 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10681 you know that whatever values are returned all came from a single entry in the
10685 In the common case where you specify a single attribute in your LDAP query, the
10686 result is not quoted, and does not contain the attribute name. If the attribute
10687 has multiple values, they are separated by commas.
10690 If you specify multiple attributes, the result contains space-separated, quoted
10691 strings, each preceded by the attribute name and an equals sign. Within the
10692 quotes, the quote character, backslash, and newline are escaped with
10693 backslashes, and commas are used to separate multiple values for the attribute.
10694 Apart from the escaping, the string within quotes takes the same form as the
10695 output when a single attribute is requested. Specifying no attributes is the
10696 same as specifying all of an entry’s attributes.
10699 Here are some examples of the output format. The first line of each pair is an
10700 LDAP query, and the second is the data that is returned. The attribute called
10701 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10703 <literallayout class="monospaced">
10704 ldap:///o=base?attr1?sub?(uid=fred)
10707 ldap:///o=base?attr2?sub?(uid=fred)
10710 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10711 attr1="value1.1, value1.2" attr2="value two"
10713 ldap:///o=base??sub?(uid=fred)
10714 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10717 The <option>extract</option> operator in string expansions can be used to pick out
10718 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10719 make use of Exim’s <option>-be</option> option to run expansion tests and thereby check the
10720 results of LDAP lookups.
10723 <section id="SECTnisplus">
10724 <title>More about NIS+</title>
10726 <indexterm role="concept">
10727 <primary>NIS+ lookup type</primary>
10729 <indexterm role="concept">
10730 <primary>lookup</primary>
10731 <secondary>NIS+</secondary>
10733 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10734 and field name. If this is given, the result of a successful query is the
10735 contents of the named field; otherwise the result consists of a concatenation
10736 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10737 values containing spaces are quoted. For example, the query
10739 <literallayout class="monospaced">
10740 [name=mg1456],passwd.org_dir
10743 might return the string
10745 <literallayout class="monospaced">
10746 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10747 home=/home/mg1456 shell=/bin/bash shadow=""
10750 (split over two lines here to fit on the page), whereas
10752 <literallayout class="monospaced">
10753 [name=mg1456],passwd.org_dir:gcos
10758 <literallayout class="monospaced">
10762 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10763 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10764 operator is to double any quote characters within the text.
10767 <section id="SECTsql">
10768 <title>SQL lookups</title>
10770 <indexterm role="concept">
10771 <primary>SQL lookup types</primary>
10773 <indexterm role="concept">
10774 <primary>MySQL</primary>
10775 <secondary>lookup type</secondary>
10777 <indexterm role="concept">
10778 <primary>PostgreSQL lookup type</primary>
10780 <indexterm role="concept">
10781 <primary>lookup</primary>
10782 <secondary>MySQL</secondary>
10784 <indexterm role="concept">
10785 <primary>lookup</primary>
10786 <secondary>PostgreSQL</secondary>
10788 <indexterm role="concept">
10789 <primary>Oracle</primary>
10790 <secondary>lookup type</secondary>
10792 <indexterm role="concept">
10793 <primary>lookup</primary>
10794 <secondary>Oracle</secondary>
10796 <indexterm role="concept">
10797 <primary>InterBase lookup type</primary>
10799 <indexterm role="concept">
10800 <primary>lookup</primary>
10801 <secondary>InterBase</secondary>
10803 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10804 databases. Queries for these databases contain SQL statements, so an example
10807 <literallayout class="monospaced">
10808 ${lookup mysql{select mailbox from users where id='userx'}\
10812 If the result of the query contains more than one field, the data for each
10813 field in the row is returned, preceded by its name, so the result of
10815 <literallayout class="monospaced">
10816 ${lookup pgsql{select home,name from users where id='userx'}\
10822 <literallayout class="monospaced">
10823 home=/home/userx name="Mister X"
10826 Empty values and values containing spaces are double quoted, with embedded
10827 quotes escaped by a backslash. If the result of the query contains just one
10828 field, the value is passed back verbatim, without a field name, for example:
10830 <literallayout class="monospaced">
10834 If the result of the query yields more than one row, it is all concatenated,
10835 with a newline between the data for each row.
10838 <section id="SECID72">
10839 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10841 <indexterm role="concept">
10842 <primary>MySQL</primary>
10843 <secondary>lookup type</secondary>
10845 <indexterm role="concept">
10846 <primary>PostgreSQL lookup type</primary>
10848 <indexterm role="concept">
10849 <primary>lookup</primary>
10850 <secondary>MySQL</secondary>
10852 <indexterm role="concept">
10853 <primary>lookup</primary>
10854 <secondary>PostgreSQL</secondary>
10856 <indexterm role="concept">
10857 <primary>Oracle</primary>
10858 <secondary>lookup type</secondary>
10860 <indexterm role="concept">
10861 <primary>lookup</primary>
10862 <secondary>Oracle</secondary>
10864 <indexterm role="concept">
10865 <primary>InterBase lookup type</primary>
10867 <indexterm role="concept">
10868 <primary>lookup</primary>
10869 <secondary>InterBase</secondary>
10871 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10872 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10873 option (as appropriate) must be set to a colon-separated list of server
10875 (For MySQL and PostgreSQL only, the global option need not be set if all
10876 queries contain their own server information – see section
10877 <xref linkend="SECTspeserque"/>.) Each item in the list is a slash-separated list of four
10878 items: host name, database name, user name, and password. In the case of
10879 Oracle, the host name field is used for the <quote>service name</quote>, and the database
10880 name field is not used and should be empty. For example:
10882 <literallayout class="monospaced">
10883 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10886 Because password data is sensitive, you should always precede the setting with
10887 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10888 option. Here is an example where two MySQL servers are listed:
10890 <literallayout class="monospaced">
10891 hide mysql_servers = localhost/users/root/secret:\
10892 otherhost/users/root/othersecret
10895 For MySQL and PostgreSQL, a host may be specified as <<emphasis>name</emphasis>>:<<emphasis>port</emphasis>> but
10896 because this is a colon-separated list, the colon has to be doubled. For each
10897 query, these parameter groups are tried in order until a connection is made and
10898 a query is successfully processed. The result of a query may be that no data is
10899 found, but that is still a successful query. In other words, the list of
10900 servers provides a backup facility, not a list of different places to look.
10903 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10904 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10905 respectively, and the characters single-quote, double-quote, and backslash
10906 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10907 addition, escapes the percent and underscore characters. This cannot be done
10908 for MySQL because these escapes are not recognized in contexts where these
10909 characters are not special.
10912 <section id="SECTspeserque">
10913 <title>Specifying the server in the query</title>
10915 For MySQL and PostgreSQL lookups (but not currently for Oracle and InterBase),
10916 it is possible to specify a list of servers with an individual query. This is
10917 done by starting the query with
10920 <literal>servers=</literal><emphasis>server1:server2:server3:...</emphasis><literal>;</literal>
10923 Each item in the list may take one of two forms:
10925 <orderedlist numeration="arabic">
10928 If it contains no slashes it is assumed to be just a host name. The appropriate
10929 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
10930 of the same name, and the remaining parameters (database, user, password) are
10936 If it contains any slashes, it is taken as a complete parameter set.
10941 The list of servers is used in exactly the same way as the global list.
10942 Once a connection to a server has happened and a query has been
10943 successfully executed, processing of the lookup ceases.
10946 This feature is intended for use in master/slave situations where updates
10947 are occurring and you want to update the master rather than a slave. If the
10948 master is in the list as a backup for reading, you might have a global setting
10951 <literallayout class="monospaced">
10952 mysql_servers = slave1/db/name/pw:\
10953 slave2/db/name/pw:\
10957 In an updating lookup, you could then write:
10959 <literallayout class="monospaced">
10960 ${lookup mysql{servers=master; UPDATE ...} }
10963 That query would then be sent only to the master server. If, on the other hand,
10964 the master is not to be used for reading, and so is not present in the global
10965 option, you can still update it by a query of this form:
10967 <literallayout class="monospaced">
10968 ${lookup pgsql{servers=master/db/name/pw; UPDATE ...} }
10971 <section id="SECID73">
10972 <title>Special MySQL features</title>
10974 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10975 causes a connection to the server on the local host by means of a Unix domain
10976 socket. An alternate socket can be specified in parentheses. The full syntax of
10977 each item in <option>mysql_servers</option> is:
10980 <<emphasis>hostname</emphasis>>::<<emphasis>port</emphasis>>(<<emphasis>socket name</emphasis>>)/<<emphasis>database</emphasis>>/<<emphasis>user</emphasis>>/<<emphasis>password</emphasis>>
10983 Any of the three sub-parts of the first field can be omitted. For normal use on
10984 the local host it can be left blank or set to just <quote>localhost</quote>.
10987 No database need be supplied – but if it is absent here, it must be given in
10991 If a MySQL query is issued that does not request any data (an insert, update,
10992 or delete command), the result of the lookup is the number of rows affected.
10995 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10996 anything (for example, setting a field to the value it already has), the result
10997 is zero because no rows are affected.
11000 <section id="SECID74">
11001 <title>Special PostgreSQL features</title>
11003 PostgreSQL lookups can also use Unix domain socket connections to the database.
11004 This is usually faster and costs less CPU time than a TCP/IP connection.
11005 However it can be used only if the mail server runs on the same machine as the
11006 database server. A configuration line for PostgreSQL via Unix domain sockets
11009 <literallayout class="monospaced">
11010 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
11013 In other words, instead of supplying a host name, a path to the socket is
11014 given. The path name is enclosed in parentheses so that its slashes aren’t
11015 visually confused with the delimiters for the other server parameters.
11018 If a PostgreSQL query is issued that does not request any data (an insert,
11019 update, or delete command), the result of the lookup is the number of rows
11023 <section id="SECTsqlite">
11024 <title>More about SQLite</title>
11026 <indexterm role="concept">
11027 <primary>lookup</primary>
11028 <secondary>SQLite</secondary>
11030 <indexterm role="concept">
11031 <primary>sqlite lookup type</primary>
11033 SQLite is different to the other SQL lookups because a file name is required in
11034 addition to the SQL query. An SQLite database is a single file, and there is no
11035 daemon as in the other SQL databases. The interface to Exim requires the name
11036 of the file, as an absolute path, to be given at the start of the query. It is
11037 separated from the query by white space. This means that the path name cannot
11038 contain white space. Here is a lookup expansion example:
11040 <literallayout class="monospaced">
11041 ${lookup sqlite {/some/thing/sqlitedb \
11042 select name from aliases where id='userx';}}
11045 In a list, the syntax is similar. For example:
11047 <literallayout class="monospaced">
11048 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
11049 select * from relays where ip='$sender_host_address';
11052 The only character affected by the <option>quote_sqlite</option> operator is a single
11053 quote, which it doubles.
11056 The SQLite library handles multiple simultaneous accesses to the database
11057 internally. Multiple readers are permitted, but only one process can
11058 update at once. Attempts to access the database while it is being updated
11059 are rejected after a timeout period, during which the SQLite library
11060 waits for the lock to be released. In Exim, the default timeout is set
11061 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
11063 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
11064 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
11069 <chapter id="CHAPdomhosaddlists">
11070 <title>Domain, host, address, and local part lists</title>
11071 <titleabbrev>Domain, host, and address lists</titleabbrev>
11073 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
11074 <primary>lists of domains; hosts; etc.</primary>
11076 A number of Exim configuration options contain lists of domains, hosts,
11077 email addresses, or local parts. For example, the <option>hold_domains</option> option
11078 contains a list of domains whose delivery is currently suspended. These lists
11079 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
11080 arguments to expansion conditions such as <option>match_domain</option>.
11083 Each item in one of these lists is a pattern to be matched against a domain,
11084 host, email address, or local part, respectively. In the sections below, the
11085 different types of pattern for each case are described, but first we cover some
11086 general facilities that apply to all four kinds of list.
11088 <section id="SECID75">
11089 <title>Expansion of lists</title>
11091 <indexterm role="concept">
11092 <primary>expansion</primary>
11093 <secondary>of lists</secondary>
11095 Each list is expanded as a single string before it is used. The result of
11096 expansion must be a list, possibly containing empty items, which is split up
11097 into separate items for matching. By default, colon is the separator character,
11098 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
11099 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
11100 discusses the way to specify empty list items.
11103 If the string expansion is forced to fail, Exim behaves as if the item it is
11104 testing (domain, host, address, or local part) is not in the list. Other
11105 expansion failures cause temporary errors.
11108 If an item in a list is a regular expression, backslashes, dollars and possibly
11109 other special characters in the expression must be protected against
11110 misinterpretation by the string expander. The easiest way to do this is to use
11111 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
11112 expression should not be expanded. For example, in an ACL you might have:
11114 <literallayout class="monospaced">
11115 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
11116 ${lookup{$domain}lsearch{/badsenders/bydomain}}
11119 The first item is a regular expression that is protected from expansion by
11120 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
11121 senders based on the receiving domain.
11124 <section id="SECID76">
11125 <title>Negated items in lists</title>
11127 <indexterm role="concept">
11128 <primary>list</primary>
11129 <secondary>negation</secondary>
11131 <indexterm role="concept">
11132 <primary>negation</primary>
11133 <secondary>in lists</secondary>
11135 Items in a list may be positive or negative. Negative items are indicated by a
11136 leading exclamation mark, which may be followed by optional white space. A list
11137 defines a set of items (domains, etc). When Exim processes one of these lists,
11138 it is trying to find out whether a domain, host, address, or local part
11139 (respectively) is in the set that is defined by the list. It works like this:
11142 The list is scanned from left to right. If a positive item is matched, the
11143 subject that is being checked is in the set; if a negative item is matched, the
11144 subject is not in the set. If the end of the list is reached without the
11145 subject having matched any of the patterns, it is in the set if the last item
11146 was a negative one, but not if it was a positive one. For example, the list in
11148 <literallayout class="monospaced">
11149 domainlist relay_domains = !a.b.c : *.b.c
11152 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
11153 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
11154 list is positive. However, if the setting were
11156 <literallayout class="monospaced">
11157 domainlist relay_domains = !a.b.c
11160 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
11161 list is negative. In other words, a list that ends with a negative item behaves
11162 as if it had an extra item <literal>:*</literal> on the end.
11165 Another way of thinking about positive and negative items in lists is to read
11166 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
11170 <section id="SECTfilnamlis">
11171 <title>File names in lists</title>
11173 <indexterm role="concept">
11174 <primary>list</primary>
11175 <secondary>file name in</secondary>
11177 If an item in a domain, host, address, or local part list is an absolute file
11178 name (beginning with a slash character), each line of the file is read and
11179 processed as if it were an independent item in the list, except that further
11180 file names are not allowed,
11181 and no expansion of the data from the file takes place.
11182 Empty lines in the file are ignored, and the file may also contain comment
11188 For domain and host lists, if a # character appears anywhere in a line of the
11189 file, it and all following characters are ignored.
11194 Because local parts may legitimately contain # characters, a comment in an
11195 address list or local part list file is recognized only if # is preceded by
11196 white space or the start of the line. For example:
11198 <literallayout class="monospaced">
11199 not#comment@x.y.z # but this is a comment
11204 Putting a file name in a list has the same effect as inserting each line of the
11205 file as an item in the list (blank lines and comments excepted). However, there
11206 is one important difference: the file is read each time the list is processed,
11207 so if its contents vary over time, Exim’s behaviour changes.
11210 If a file name is preceded by an exclamation mark, the sense of any match
11211 within the file is inverted. For example, if
11213 <literallayout class="monospaced">
11214 hold_domains = !/etc/nohold-domains
11217 and the file contains the lines
11219 <literallayout class="monospaced">
11224 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
11225 any domain matching <literal>*.b.c</literal> is not.
11228 <section id="SECID77">
11229 <title>An lsearch file is not an out-of-line list</title>
11231 As will be described in the sections that follow, lookups can be used in lists
11232 to provide indexed methods of checking list membership. There has been some
11233 confusion about the way <command>lsearch</command> lookups work in lists. Because
11234 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
11235 sometimes thought that it is allowed to contain wild cards and other kinds of
11236 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
11237 always fixed strings, just as for any other single-key lookup type.
11240 If you want to use a file to contain wild-card patterns that form part of a
11241 list, just give the file name on its own, without a search type, as described
11242 in the previous section. You could also use the <command>wildlsearch</command> or
11243 <command>nwildlsearch</command>, but there is no advantage in doing this.
11246 <section id="SECTnamedlists">
11247 <title>Named lists</title>
11249 <indexterm role="concept">
11250 <primary>named lists</primary>
11252 <indexterm role="concept">
11253 <primary>list</primary>
11254 <secondary>named</secondary>
11256 A list of domains, hosts, email addresses, or local parts can be given a name
11257 which is then used to refer to the list elsewhere in the configuration. This is
11258 particularly convenient if the same list is required in several different
11259 places. It also allows lists to be given meaningful names, which can improve
11260 the readability of the configuration. For example, it is conventional to define
11261 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11262 locally on a host, using a configuration line such as
11264 <literallayout class="monospaced">
11265 domainlist local_domains = localhost:my.dom.example
11268 Named lists are referenced by giving their name preceded by a plus sign, so,
11269 for example, a router that is intended to handle local domains would be
11270 configured with the line
11272 <literallayout class="monospaced">
11273 domains = +local_domains
11276 The first router in a configuration is often one that handles all domains
11277 except the local ones, using a configuration with a negated item like this:
11279 <literallayout class="monospaced">
11282 domains = ! +local_domains
11283 transport = remote_smtp
11287 The four kinds of named list are created by configuration lines starting with
11288 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11289 respectively. Then there follows the name that you are defining, followed by an
11290 equals sign and the list itself. For example:
11292 <literallayout class="monospaced">
11293 hostlist relay_hosts = 192.168.23.0/24 : my.friend.example
11294 addresslist bad_senders = cdb;/etc/badsenders
11297 A named list may refer to other named lists:
11299 <literallayout class="monospaced">
11300 domainlist dom1 = first.example : second.example
11301 domainlist dom2 = +dom1 : third.example
11302 domainlist dom3 = fourth.example : +dom2 : fifth.example
11305 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11306 effect may not be what you intended, because the negation does not propagate
11307 out to the higher level. For example, consider:
11309 <literallayout class="monospaced">
11310 domainlist dom1 = !a.b
11311 domainlist dom2 = +dom1 : *.b
11314 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11315 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11316 means it matches the second list as well. The effect is not the same as
11318 <literallayout class="monospaced">
11319 domainlist dom2 = !a.b : *.b
11322 where <emphasis>x.y</emphasis> does not match. It’s best to avoid negation altogether in
11323 referenced lists if you can.
11326 Named lists may have a performance advantage. When Exim is routing an
11327 address or checking an incoming message, it caches the result of tests on named
11328 lists. So, if you have a setting such as
11330 <literallayout class="monospaced">
11331 domains = +local_domains
11334 on several of your routers
11335 or in several ACL statements,
11336 the actual test is done only for the first one. However, the caching works only
11337 if there are no expansions within the list itself or any sublists that it
11338 references. In other words, caching happens only for lists that are known to be
11339 the same each time they are referenced.
11342 By default, there may be up to 16 named lists of each type. This limit can be
11343 extended by changing a compile-time variable. The use of domain and host lists
11344 is recommended for concepts such as local domains, relay domains, and relay
11345 hosts. The default configuration is set up like this.
11348 <section id="SECID78">
11349 <title>Named lists compared with macros</title>
11351 <indexterm role="concept">
11352 <primary>list</primary>
11353 <secondary>named compared with macro</secondary>
11355 <indexterm role="concept">
11356 <primary>macro</primary>
11357 <secondary>compared with named list</secondary>
11359 At first sight, named lists might seem to be no different from macros in the
11360 configuration file. However, macros are just textual substitutions. If you
11363 <literallayout class="monospaced">
11364 ALIST = host1 : host2
11365 auth_advertise_hosts = !ALIST
11368 it probably won’t do what you want, because that is exactly the same as
11370 <literallayout class="monospaced">
11371 auth_advertise_hosts = !host1 : host2
11374 Notice that the second host name is not negated. However, if you use a host
11377 <literallayout class="monospaced">
11378 hostlist alist = host1 : host2
11379 auth_advertise_hosts = ! +alist
11382 the negation applies to the whole list, and so that is equivalent to
11384 <literallayout class="monospaced">
11385 auth_advertise_hosts = !host1 : !host2
11388 <section id="SECID79">
11389 <title>Named list caching</title>
11391 <indexterm role="concept">
11392 <primary>list</primary>
11393 <secondary>caching of named</secondary>
11395 <indexterm role="concept">
11396 <primary>caching</primary>
11397 <secondary>named lists</secondary>
11399 While processing a message, Exim caches the result of checking a named list if
11400 it is sure that the list is the same each time. In practice, this means that
11401 the cache operates only if the list contains no $ characters, which guarantees
11402 that it will not change when it is expanded. Sometimes, however, you may have
11403 an expanded list that you know will be the same each time within a given
11404 message. For example:
11406 <literallayout class="monospaced">
11407 domainlist special_domains = \
11408 ${lookup{$sender_host_address}cdb{/some/file}}
11411 This provides a list of domains that depends only on the sending host’s IP
11412 address. If this domain list is referenced a number of times (for example,
11413 in several ACL lines, or in several routers) the result of the check is not
11414 cached by default, because Exim does not know that it is going to be the
11415 same list each time.
11418 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11419 cache the result anyway. For example:
11421 <literallayout class="monospaced">
11422 domainlist_cache special_domains = ${lookup{...
11425 If you do this, you should be absolutely sure that caching is going to do
11426 the right thing in all cases. When in doubt, leave it out.
11429 <section id="SECTdomainlist">
11430 <title>Domain lists</title>
11432 <indexterm role="concept">
11433 <primary>domain list</primary>
11434 <secondary>patterns for</secondary>
11436 <indexterm role="concept">
11437 <primary>list</primary>
11438 <secondary>domain list</secondary>
11440 Domain lists contain patterns that are to be matched against a mail domain.
11441 The following types of item may appear in domain lists:
11446 <indexterm role="concept">
11447 <primary>primary host name</primary>
11449 <indexterm role="concept">
11450 <primary>host name</primary>
11451 <secondary>matched in domain list</secondary>
11453 <indexterm role="option">
11454 <primary><option>primary_hostname</option></primary>
11456 <indexterm role="concept">
11457 <primary>domain list</primary>
11458 <secondary>matching primary host name</secondary>
11460 <indexterm role="concept">
11461 <primary>@ in a domain list</primary>
11463 If a pattern consists of a single @ character, it matches the local host name,
11464 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11465 possible to use the same configuration file on several different hosts that
11466 differ only in their names.
11471 <indexterm role="concept">
11472 <primary>@[] in a domain list</primary>
11474 <indexterm role="concept">
11475 <primary>domain list</primary>
11476 <secondary>matching local IP interfaces</secondary>
11478 <indexterm role="concept">
11479 <primary>domain literal</primary>
11481 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
11482 in square brackets (as in an email address that contains a domain literal), but
11483 only if that IP address is recognized as local for email routing purposes. The
11484 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
11485 control which of a host’s several IP addresses are treated as local.
11486 In today’s Internet, the use of domain literals is controversial.
11491 <indexterm role="concept">
11492 <primary>@mx_any</primary>
11494 <indexterm role="concept">
11495 <primary>@mx_primary</primary>
11497 <indexterm role="concept">
11498 <primary>@mx_secondary</primary>
11500 <indexterm role="concept">
11501 <primary>domain list</primary>
11502 <secondary>matching MX pointers to local host</secondary>
11504 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11505 has an MX record pointing to the local host or to any host that is listed in
11506 <indexterm role="option">
11507 <primary><option>hosts_treat_as_local</option></primary>
11509 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11510 are similar, except that the first matches only when a primary MX target is the
11511 local host, and the second only when no primary MX target is the local host,
11512 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11513 preference value – there may of course be more than one of them.
11516 The MX lookup that takes place when matching a pattern of this type is
11517 performed with the resolver options for widening names turned off. Thus, for
11518 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11519 resolver’s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11520 options of the <command>dnslookup</command> router for a discussion of domain widening.
11523 Sometimes you may want to ignore certain IP addresses when using one of these
11524 patterns. You can specify this by following the pattern with <literal>/ignore=</literal><<emphasis>ip
11525 list</emphasis>>, where <<emphasis>ip list</emphasis>> is a list of IP addresses. These addresses are
11526 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11527 on a router). For example:
11529 <literallayout class="monospaced">
11530 domains = @mx_any/ignore=127.0.0.1
11533 This example matches any domain that has an MX record pointing to one of
11534 the local host’s IP addresses other than 127.0.0.1.
11537 The list of IP addresses is in fact processed by the same code that processes
11538 host lists, so it may contain CIDR-coded network specifications and it may also
11539 contain negative items.
11542 Because the list of IP addresses is a sublist within a domain list, you have to
11543 be careful about delimiters if there is more than one address. Like any other
11544 list, the default delimiter can be changed. Thus, you might have:
11546 <literallayout class="monospaced">
11547 domains = @mx_any/ignore=<;127.0.0.1;0.0.0.0 : \
11548 an.other.domain : ...
11551 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11552 involved, it is easiest to change the delimiter for the main list as well:
11554 <literallayout class="monospaced">
11555 domains = <? @mx_any/ignore=<;127.0.0.1;::1 ? \
11556 an.other.domain ? ...
11561 <indexterm role="concept">
11562 <primary>asterisk</primary>
11563 <secondary>in domain list</secondary>
11565 <indexterm role="concept">
11566 <primary>domain list</primary>
11567 <secondary>asterisk in</secondary>
11569 <indexterm role="concept">
11570 <primary>domain list</primary>
11571 <secondary>matching <quote>ends with</quote></secondary>
11573 If a pattern starts with an asterisk, the remaining characters of the pattern
11574 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11575 domain lists differs from its use in partial matching lookups. In a domain
11576 list, the character following the asterisk need not be a dot, whereas partial
11577 matching works only in terms of dot-separated components. For example, a domain
11578 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11579 <emphasis>cipher.key.ex</emphasis>.
11584 <indexterm role="concept">
11585 <primary>regular expressions</primary>
11586 <secondary>in domain list</secondary>
11588 <indexterm role="concept">
11589 <primary>domain list</primary>
11590 <secondary>matching regular expression</secondary>
11592 If a pattern starts with a circumflex character, it is treated as a regular
11593 expression, and matched against the domain using a regular expression matching
11594 function. The circumflex is treated as part of the regular expression.
11595 Email domains are case-independent, so this regular expression match is by
11596 default case-independent, but you can make it case-dependent by starting it
11597 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
11598 are given in chapter <xref linkend="CHAPregexp"/>.
11601 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11602 must escape any backslash and dollar characters in the regular expression, or
11603 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11604 it is not to be expanded (unless you really do want to build a regular
11605 expression by expansion, of course).
11610 <indexterm role="concept">
11611 <primary>lookup</primary>
11612 <secondary>in domain list</secondary>
11614 <indexterm role="concept">
11615 <primary>domain list</primary>
11616 <secondary>matching by lookup</secondary>
11618 If a pattern starts with the name of a single-key lookup type followed by a
11619 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11620 must be a file name in a suitable format for the lookup type. For example, for
11621 <quote>cdb;</quote> it must be an absolute path:
11623 <literallayout class="monospaced">
11624 domains = cdb;/etc/mail/local_domains.cdb
11627 The appropriate type of lookup is done on the file using the domain name as the
11628 key. In most cases, the data that is looked up is not used; Exim is interested
11629 only in whether or not the key is present in the file. However, when a lookup
11630 is used for the <option>domains</option> option on a router
11631 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11632 <varname>$domain_data</varname> variable and can be referred to in other router options or
11633 other statements in the same ACL.
11638 Any of the single-key lookup type names may be preceded by
11639 <literal>partial</literal><<emphasis>n</emphasis>><literal>-</literal>, where the <<emphasis>n</emphasis>> is optional, for example,
11641 <literallayout class="monospaced">
11642 domains = partial-dbm;/partial/domains
11645 This causes partial matching logic to be invoked; a description of how this
11646 works is given in section <xref linkend="SECTpartiallookup"/>.
11651 <indexterm role="concept">
11652 <primary>asterisk</primary>
11653 <secondary>in lookup type</secondary>
11655 Any of the single-key lookup types may be followed by an asterisk. This causes
11656 a default lookup for a key consisting of a single asterisk to be done if the
11657 original lookup fails. This is not a useful feature when using a domain list to
11658 select particular domains (because any domain would match), but it might have
11659 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11660 expansion variable.
11665 If the pattern starts with the name of a query-style lookup type followed by a
11666 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11667 pattern must be an appropriate query for the lookup type, as described in
11668 chapter <xref linkend="CHAPfdlookup"/>. For example:
11670 <literallayout class="monospaced">
11671 hold_domains = mysql;select domain from holdlist \
11672 where domain = '$domain';
11675 In most cases, the data that is looked up is not used (so for an SQL query, for
11676 example, it doesn’t matter what field you select). Exim is interested only in
11677 whether or not the query succeeds. However, when a lookup is used for the
11678 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11679 variable and can be referred to in other options.
11684 <indexterm role="concept">
11685 <primary>domain list</primary>
11686 <secondary>matching literal domain name</secondary>
11688 If none of the above cases apply, a caseless textual comparison is made
11689 between the pattern and the domain.
11694 Here is an example that uses several different kinds of pattern:
11696 <literallayout class="monospaced">
11697 domainlist funny_domains = \
11700 *.foundation.fict.example : \
11701 \N^[1-2]\d{3}\.fict\.example$\N : \
11702 partial-dbm;/opt/data/penguin/book : \
11703 nis;domains.byname : \
11704 nisplus;[name=$domain,status=local],domains.org_dir
11707 There are obvious processing trade-offs among the various matching modes. Using
11708 an asterisk is faster than a regular expression, and listing a few names
11709 explicitly probably is too. The use of a file or database lookup is expensive,
11710 but may be the only option if hundreds of names are required. Because the
11711 patterns are tested in order, it makes sense to put the most commonly matched
11715 <section id="SECThostlist">
11716 <title>Host lists</title>
11718 <indexterm role="concept">
11719 <primary>host list</primary>
11720 <secondary>patterns in</secondary>
11722 <indexterm role="concept">
11723 <primary>list</primary>
11724 <secondary>host list</secondary>
11726 Host lists are used to control what remote hosts are allowed to do. For
11727 example, some hosts may be allowed to use the local host as a relay, and some
11728 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11729 two different ways, by name or by IP address. In a host list, some types of
11730 pattern are matched to a host name, and some are matched to an IP address.
11731 You need to be particularly careful with this when single-key lookups are
11732 involved, to ensure that the right value is being used as the key.
11735 <section id="SECID80">
11736 <title>Special host list patterns</title>
11738 <indexterm role="concept">
11739 <primary>empty item in hosts list</primary>
11741 <indexterm role="concept">
11742 <primary>host list</primary>
11743 <secondary>empty string in</secondary>
11745 If a host list item is the empty string, it matches only when no remote host is
11746 involved. This is the case when a message is being received from a local
11747 process using SMTP on the standard input, that is, when a TCP/IP connection is
11751 <indexterm role="concept">
11752 <primary>asterisk</primary>
11753 <secondary>in host list</secondary>
11755 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11756 the IP address nor the name is actually inspected.
11759 <section id="SECThoslispatip">
11760 <title>Host list patterns that match by IP address</title>
11762 <indexterm role="concept">
11763 <primary>host list</primary>
11764 <secondary>matching IP addresses</secondary>
11766 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11767 the incoming address actually appears in the IPv6 host as
11768 <literal>::ffff:</literal><<emphasis>v4address</emphasis>>. When such an address is tested against a host
11769 list, it is converted into a traditional IPv4 address first. (Not all operating
11770 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11774 The following types of pattern in a host list check the remote host by
11775 inspecting its IP address:
11780 If the pattern is a plain domain name (not a regular expression, not starting
11781 with *, not a lookup of any kind), Exim calls the operating system function
11782 to find the associated IP address(es). Exim uses the newer
11783 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11784 This typically causes a forward DNS lookup of the name. The result is compared
11785 with the IP address of the subject host.
11788 If there is a temporary problem (such as a DNS timeout) with the host name
11789 lookup, a temporary error occurs. For example, if the list is being used in an
11790 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11791 temporary SMTP error code. If no IP address can be found for the host name,
11792 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11797 <indexterm role="concept">
11798 <primary>@ in a host list</primary>
11800 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11801 domain name, as just described.
11806 If the pattern is an IP address, it is matched against the IP address of the
11807 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11808 IPv6 addresses can be given in colon-separated format, but the colons have to
11809 be doubled so as not to be taken as item separators when the default list
11810 separator is used. IPv6 addresses are recognized even when Exim is compiled
11811 without IPv6 support. This means that if they appear in a host list on an
11812 IPv4-only host, Exim will not treat them as host names. They are just addresses
11813 that can never match a client host.
11818 <indexterm role="concept">
11819 <primary>@[] in a host list</primary>
11821 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11822 the local host. For example, if the local host is an IPv4 host with one
11823 interface address 10.45.23.56, these two ACL statements have the same effect:
11825 <literallayout class="monospaced">
11826 accept hosts = 127.0.0.1 : 10.45.23.56
11832 <indexterm role="concept">
11833 <primary>CIDR notation</primary>
11835 If the pattern is an IP address followed by a slash and a mask length (for
11836 example 10.11.42.0/24), it is matched against the IP address of the subject
11837 host under the given mask. This allows, an entire network of hosts to be
11838 included (or excluded) by a single item. The mask uses CIDR notation; it
11839 specifies the number of address bits that must match, starting from the most
11840 significant end of the address.
11843 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11844 of a range of addresses. It is the number of bits in the network portion of the
11845 address. The above example specifies a 24-bit netmask, so it matches all 256
11846 addresses in the 10.11.42.0 network. An item such as
11848 <literallayout class="monospaced">
11852 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11853 32 for an IPv4 address is the same as no mask at all; just a single address
11857 Here is another example which shows an IPv4 and an IPv6 network:
11859 <literallayout class="monospaced">
11860 recipient_unqualified_hosts = 192.168.0.0/16: \
11861 3ffe::ffff::836f::::/48
11864 The doubling of list separator characters applies only when these items
11865 appear inline in a host list. It is not required when indirecting via a file.
11868 <literallayout class="monospaced">
11869 recipient_unqualified_hosts = /opt/exim/unqualnets
11872 could make use of a file containing
11874 <literallayout class="monospaced">
11876 3ffe:ffff:836f::/48
11879 to have exactly the same effect as the previous example. When listing IPv6
11880 addresses inline, it is usually more convenient to use the facility for
11881 changing separator characters. This list contains the same two networks:
11883 <literallayout class="monospaced">
11884 recipient_unqualified_hosts = <; 172.16.0.0/12; \
11885 3ffe:ffff:836f::/48
11888 The separator is changed to semicolon by the leading <quote><;</quote> at the start of the
11894 <section id="SECThoslispatsikey">
11895 <title>Host list patterns for single-key lookups by host address</title>
11897 <indexterm role="concept">
11898 <primary>host list</primary>
11899 <secondary>lookup of IP address</secondary>
11901 When a host is to be identified by a single-key lookup of its complete IP
11902 address, the pattern takes this form:
11905 <literal>net-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11910 <literallayout class="monospaced">
11911 hosts_lookup = net-cdb;/hosts-by-ip.db
11914 The text form of the IP address of the subject host is used as the lookup key.
11915 IPv6 addresses are converted to an unabbreviated form, using lower case
11916 letters, with dots as separators because colon is the key terminator in
11917 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11918 quoting the keys, but this is a facility that was added later.] The data
11919 returned by the lookup is not used.
11922 <indexterm role="concept">
11923 <primary>IP address</primary>
11924 <secondary>masking</secondary>
11926 <indexterm role="concept">
11927 <primary>host list</primary>
11928 <secondary>masked IP address</secondary>
11930 Single-key lookups can also be performed using masked IP addresses, using
11931 patterns of this form:
11934 <literal>net<</literal><emphasis>number</emphasis><literal>>-<</literal><emphasis>single-key-search-type</emphasis><literal>>;<</literal><emphasis>search-data</emphasis><literal>></literal>
11939 <literallayout class="monospaced">
11940 net24-dbm;/networks.db
11943 The IP address of the subject host is masked using <<emphasis>number</emphasis>> as the mask
11944 length. A textual string is constructed from the masked value, followed by the
11945 mask, and this is used as the lookup key. For example, if the host’s IP address
11946 is 192.168.34.6, the key that is looked up for the above example is
11947 <quote>192.168.34.0/24</quote>.
11950 When an IPv6 address is converted to a string, dots are normally used instead
11951 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
11952 terminate <command>lsearch</command> keys). This was implemented some time before the ability
11953 to quote keys was made available in <command>lsearch</command> files. However, the more
11954 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
11955 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
11956 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
11957 converted using colons and not dots. In all cases, full, unabbreviated IPv6
11958 addresses are always used.
11961 Ideally, it would be nice to tidy up this anomalous situation by changing to
11962 colons in all cases, given that quoting is now available for <command>lsearch</command>.
11963 However, this would be an incompatible change that might break some existing
11967 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11968 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
11969 the former case the key strings include the mask value, whereas in the latter
11970 case the IP address is used on its own.
11973 <section id="SECThoslispatnam">
11974 <title>Host list patterns that match by host name</title>
11976 <indexterm role="concept">
11977 <primary>host</primary>
11978 <secondary>lookup failures</secondary>
11980 <indexterm role="concept">
11981 <primary>unknown host name</primary>
11983 <indexterm role="concept">
11984 <primary>host list</primary>
11985 <secondary>matching host name</secondary>
11987 There are several types of pattern that require Exim to know the name of the
11988 remote host. These are either wildcard patterns or lookups by name. (If a
11989 complete hostname is given without any wildcarding, it is used to find an IP
11990 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11994 If the remote host name is not already known when Exim encounters one of these
11995 patterns, it has to be found from the IP address.
11996 Although many sites on the Internet are conscientious about maintaining reverse
11997 DNS data for their hosts, there are also many that do not do this.
11998 Consequently, a name cannot always be found, and this may lead to unwanted
11999 effects. Take care when configuring host lists with wildcarded name patterns.
12000 Consider what will happen if a name cannot be found.
12003 Because of the problems of determining host names from IP addresses, matching
12004 against host names is not as common as matching against IP addresses.
12007 By default, in order to find a host name, Exim first does a reverse DNS lookup;
12008 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
12009 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
12010 are done can be changed by setting the <option>host_lookup_order</option> option. For
12011 security, once Exim has found one or more names, it looks up the IP addresses
12012 for these names and compares them with the IP address that it started with.
12013 Only those names whose IP addresses match are accepted. Any other names are
12014 discarded. If no names are left, Exim behaves as if the host name cannot be
12015 found. In the most common case there is only one name and one IP address.
12018 There are some options that control what happens if a host name cannot be
12019 found. These are described in section <xref linkend="SECTbehipnot"/> below.
12022 <indexterm role="concept">
12023 <primary>host</primary>
12024 <secondary>alias for</secondary>
12026 <indexterm role="concept">
12027 <primary>alias for host</primary>
12029 As a result of aliasing, hosts may have more than one name. When processing any
12030 of the following types of pattern, all the host’s names are checked:
12035 <indexterm role="concept">
12036 <primary>asterisk</primary>
12037 <secondary>in host list</secondary>
12039 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
12040 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
12041 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
12042 requirement. Other kinds of wildcarding require the use of a regular
12048 <indexterm role="concept">
12049 <primary>regular expressions</primary>
12050 <secondary>in host list</secondary>
12052 <indexterm role="concept">
12053 <primary>host list</primary>
12054 <secondary>regular expression in</secondary>
12056 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
12057 matched against the host name. Host names are case-independent, so this regular
12058 expression match is by default case-independent, but you can make it
12059 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
12060 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
12063 <literallayout class="monospaced">
12067 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
12068 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
12069 that backslash and dollar characters are not misinterpreted as part of the
12070 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
12071 part of the string as non-expandable. For example:
12073 <literallayout class="monospaced">
12074 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
12077 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
12078 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
12079 example. Without it, a match at the start of the host name is all that is
12085 <section id="SECTbehipnot">
12086 <title>Behaviour when an IP address or name cannot be found</title>
12088 <indexterm role="concept">
12089 <primary>host</primary>
12090 <secondary>lookup failures, permanent</secondary>
12092 While processing a host list, Exim may need to look up an IP address from a
12093 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
12094 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
12095 behaviour when it fails to find the information it is seeking is the same.
12098 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
12099 apply to temporary DNS errors, whose handling is described in the next section.
12102 <indexterm role="concept">
12103 <primary><literal>+include_unknown</literal></primary>
12105 <indexterm role="concept">
12106 <primary><literal>+ignore_unknown</literal></primary>
12108 By default, Exim behaves as if the host does not match the list. This may not
12109 always be what you want to happen. To change Exim’s behaviour, the special
12110 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
12111 top level – they are not recognized in an indirected file).
12116 If any item that follows <literal>+include_unknown</literal> requires information that
12117 cannot found, Exim behaves as if the host does match the list. For example,
12119 <literallayout class="monospaced">
12120 host_reject_connection = +include_unknown:*.enemy.ex
12123 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
12124 any hosts whose name it cannot find.
12129 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
12130 be found, Exim ignores that item and proceeds to the rest of the list. For
12133 <literallayout class="monospaced">
12134 accept hosts = +ignore_unknown : friend.example : \
12138 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
12139 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
12140 name can be found for 192.168.4.5, it is rejected.
12145 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
12146 list. The effect of each one lasts until the next, or until the end of the
12150 <section id="SECTtemdnserr">
12151 <title>Temporary DNS errors when looking up host information</title>
12153 <indexterm role="concept">
12154 <primary>host</primary>
12155 <secondary>lookup failures, temporary</secondary>
12157 <indexterm role="concept">
12158 <primary><literal>+include_defer</literal></primary>
12160 <indexterm role="concept">
12161 <primary><literal>+ignore_defer</literal></primary>
12163 A temporary DNS lookup failure normally causes a defer action (except when
12164 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
12165 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analagous to
12166 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
12167 section. These options should be used with care, probably only in non-critical
12168 host lists such as whitelists.
12171 <section id="SECThoslispatnamsk">
12172 <title>Host list patterns for single-key lookups by host name</title>
12174 <indexterm role="concept">
12175 <primary>unknown host name</primary>
12177 <indexterm role="concept">
12178 <primary>host list</primary>
12179 <secondary>matching host name</secondary>
12181 If a pattern is of the form
12184 <<emphasis>single-key-search-type</emphasis>>;<<emphasis>search-data</emphasis>>
12189 <literallayout class="monospaced">
12190 dbm;/host/accept/list
12193 a single-key lookup is performed, using the host name as its key. If the
12194 lookup succeeds, the host matches the item. The actual data that is looked up
12198 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
12199 keys in the file, not IP addresses. If you want to do lookups based on IP
12200 addresses, you must precede the search type with <quote>net-</quote> (see section
12201 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
12202 two items in the same list, one doing an address lookup and one doing a name
12203 lookup, both using the same file.
12206 <section id="SECID81">
12207 <title>Host list patterns for query-style lookups</title>
12209 If a pattern is of the form
12212 <<emphasis>query-style-search-type</emphasis>>;<<emphasis>query</emphasis>>
12215 the query is obeyed, and if it succeeds, the host matches the item. The actual
12216 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
12217 <varname>$sender_host_name</varname> can be used in the query. For example:
12219 <literallayout class="monospaced">
12220 hosts_lookup = pgsql;\
12221 select ip from hostlist where ip='$sender_host_address'
12224 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
12225 can use the <option>sg</option> expansion item to change this if you need to. If you want to
12226 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
12230 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
12231 looks up the host name if has not already done so. (See section
12232 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
12235 Historical note: prior to release 4.30, Exim would always attempt to find a
12236 host name before running the query, unless the search type was preceded by
12237 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
12238 still recognized for query-style lookups, but its presence or absence has no
12239 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
12240 See section <xref linkend="SECThoslispatsikey"/>.)
12243 <section id="SECTmixwilhos">
12244 <title>Mixing wildcarded host names and addresses in host lists</title>
12246 <indexterm role="concept">
12247 <primary>host list</primary>
12248 <secondary>mixing names and addresses in</secondary>
12250 If you have name lookups or wildcarded host names and IP addresses in the same
12251 host list, you should normally put the IP addresses first. For example, in an
12252 ACL you could have:
12254 <literallayout class="monospaced">
12255 accept hosts = 10.9.8.7 : *.friend.example
12258 The reason for this lies in the left-to-right way that Exim processes lists.
12259 It can test IP addresses without doing any DNS lookups, but when it reaches an
12260 item that requires a host name, it fails if it cannot find a host name to
12261 compare with the pattern. If the above list is given in the opposite order, the
12262 <option>accept</option> statement fails for a host whose name cannot be found, even if its
12263 IP address is 10.9.8.7.
12266 If you really do want to do the name check first, and still recognize the IP
12267 address, you can rewrite the ACL like this:
12269 <literallayout class="monospaced">
12270 accept hosts = *.friend.example
12271 accept hosts = 10.9.8.7
12274 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
12275 <xref linkend="CHAPACL"/> for details of ACLs.
12278 <section id="SECTaddresslist">
12279 <title>Address lists</title>
12281 <indexterm role="concept">
12282 <primary>list</primary>
12283 <secondary>address list</secondary>
12285 <indexterm role="concept">
12286 <primary>address list</primary>
12287 <secondary>empty item</secondary>
12289 <indexterm role="concept">
12290 <primary>address list</primary>
12291 <secondary>patterns</secondary>
12293 Address lists contain patterns that are matched against mail addresses. There
12294 is one special case to be considered: the sender address of a bounce message is
12295 always empty. You can test for this by providing an empty item in an address
12296 list. For example, you can set up a router to process bounce messages by
12297 using this option setting:
12299 <literallayout class="monospaced">
12303 The presence of the colon creates an empty item. If you do not provide any
12304 data, the list is empty and matches nothing. The empty sender can also be
12305 detected by a regular expression that matches an empty string,
12306 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12309 Non-empty items in an address list can be straightforward email addresses. For
12312 <literallayout class="monospaced">
12313 senders = jbc@askone.example : hs@anacreon.example
12316 A certain amount of wildcarding is permitted. If a pattern contains an @
12317 character, but is not a regular expression and does not begin with a
12318 semicolon-terminated lookup type (described below), the local part of the
12319 subject address is compared with the local part of the pattern, which may start
12320 with an asterisk. If the local parts match, the domain is checked in exactly
12321 the same way as for a pattern in a domain list. For example, the domain can be
12322 wildcarded, refer to a named list, or be a lookup:
12324 <literallayout class="monospaced">
12325 deny senders = *@*.spamming.site:\
12326 *@+hostile_domains:\
12327 bozo@partial-lsearch;/list/of/dodgy/sites:\
12328 *@dbm;/bad/domains.db
12331 <indexterm role="concept">
12332 <primary>local part</primary>
12333 <secondary>starting with !</secondary>
12335 <indexterm role="concept">
12336 <primary>address list</primary>
12337 <secondary>local part starting with !</secondary>
12339 If a local part that begins with an exclamation mark is required, it has to be
12340 specified using a regular expression, because otherwise the exclamation mark is
12341 treated as a sign of negation, as is standard in lists.
12344 If a non-empty pattern that is not a regular expression or a lookup does not
12345 contain an @ character, it is matched against the domain part of the subject
12346 address. The only two formats that are recognized this way are a literal
12347 domain, or a domain pattern that starts with *. In both these cases, the effect
12348 is the same as if <literal>*@</literal> preceded the pattern. For example:
12350 <literallayout class="monospaced">
12351 deny senders = enemy.domain : *.enemy.domain
12354 The following kinds of more complicated address list pattern can match any
12355 address, including the empty address that is characteristic of bounce message
12361 <indexterm role="concept">
12362 <primary>regular expressions</primary>
12363 <secondary>in address list</secondary>
12365 <indexterm role="concept">
12366 <primary>address list</primary>
12367 <secondary>regular expression in</secondary>
12369 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12370 done against the complete address, with the pattern as the regular expression.
12371 You must take care that backslash and dollar characters are not misinterpreted
12372 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12373 to mark that part of the string as non-expandable. For example:
12375 <literallayout class="monospaced">
12376 deny senders = \N^.*this.*@example\.com$\N : \
12377 \N^\d{8}.+@spamhaus.example$\N : ...
12380 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12381 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12386 <indexterm role="concept">
12387 <primary>address list</primary>
12388 <secondary>lookup for complete address</secondary>
12390 Complete addresses can be looked up by using a pattern that starts with a
12391 lookup type terminated by a semicolon, followed by the data for the lookup. For
12394 <literallayout class="monospaced">
12395 deny senders = cdb;/etc/blocked.senders : \
12396 mysql;select address from blocked where \
12397 address='${quote_mysql:$sender_address}'
12400 Both query-style and single-key lookup types can be used. For a single-key
12401 lookup type, Exim uses the complete address as the key. However, empty keys are
12402 not supported for single-key lookups, so a match against the empty address
12403 always fails. This restriction does not apply to query-style lookups.
12406 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12407 cannot be used, and is ignored if specified, with an entry being written to the
12409 <indexterm role="concept">
12410 <primary>*@ with single-key lookup</primary>
12412 However, you can configure lookup defaults, as described in section
12413 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12414 default. For example, with this lookup:
12416 <literallayout class="monospaced">
12417 accept senders = lsearch*@;/some/file
12420 the file could contains lines like this:
12422 <literallayout class="monospaced">
12423 user1@domain1.example
12427 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12430 <literallayout class="monospaced">
12431 nimrod@jaeger.example
12436 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12437 would mean that every address matches, thus rendering the test useless.
12440 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12442 <literallayout class="monospaced">
12443 deny recipients = dbm*@;/some/file
12444 deny recipients = *@dbm;/some/file
12447 The first does a whole address lookup, with defaulting, as just described,
12448 because it starts with a lookup type. The second matches the local part and
12449 domain independently, as described in a bullet point below.
12454 The following kinds of address list pattern can match only non-empty addresses.
12455 If the subject address is empty, a match against any of these pattern types
12461 <indexterm role="concept">
12462 <primary>@@ with single-key lookup</primary>
12464 <indexterm role="concept">
12465 <primary>address list</primary>
12466 <secondary>@@ lookup type</secondary>
12468 <indexterm role="concept">
12469 <primary>address list</primary>
12470 <secondary>split local part and domain</secondary>
12472 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12473 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12474 split into a local part and a domain. The domain is looked up in the file. If
12475 it is not found, there is no match. If it is found, the data that is looked up
12476 from the file is treated as a colon-separated list of local part patterns, each
12477 of which is matched against the subject local part in turn.
12480 <indexterm role="concept">
12481 <primary>asterisk</primary>
12482 <secondary>in address list</secondary>
12484 The lookup may be a partial one, and/or one involving a search for a default
12485 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12486 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12487 even be further lookups. They may also be independently negated. For example,
12490 <literallayout class="monospaced">
12491 deny senders = @@dbm;/etc/reject-by-domain
12494 the data from which the DBM file is built could contain lines like
12496 <literallayout class="monospaced">
12497 baddomain.com: !postmaster : *
12500 to reject all senders except <option>postmaster</option> from that domain.
12503 <indexterm role="concept">
12504 <primary>local part</primary>
12505 <secondary>starting with !</secondary>
12507 If a local part that actually begins with an exclamation mark is required, it
12508 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12509 may be split over several lines by indenting the second and subsequent lines,
12510 but the separating colon must still be included at line breaks. White space
12511 surrounding the colons is ignored. For example:
12513 <literallayout class="monospaced">
12514 aol.com: spammer1 : spammer2 : ^[0-9]+$ :
12515 spammer3 : spammer4
12518 As in all colon-separated lists in Exim, a colon can be included in an item by
12522 If the last item in the list starts with a right angle-bracket, the remainder
12523 of the item is taken as a new key to look up in order to obtain a continuation
12524 list of local parts. The new key can be any sequence of characters. Thus one
12525 might have entries like
12527 <literallayout class="monospaced">
12528 aol.com: spammer1 : spammer 2 : >*
12529 xyz.com: spammer3 : >*
12533 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12534 local parts for all domains, in addition to the specific local parts listed for
12535 each domain. Of course, using this feature costs another lookup each time a
12536 chain is followed, but the effort needed to maintain the data is reduced.
12539 <indexterm role="concept">
12540 <primary>loop</primary>
12541 <secondary>in lookups</secondary>
12543 It is possible to construct loops using this facility, and in order to catch
12544 them, the chains may be no more than fifty items long.
12549 The @@<<emphasis>lookup</emphasis>> style of item can also be used with a query-style
12550 lookup, but in this case, the chaining facility is not available. The lookup
12551 can only return a single list of local parts.
12556 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12557 in these two examples:
12559 <literallayout class="monospaced">
12561 senders = *@+my_list
12564 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12565 example it is a named domain list.
12568 <section id="SECTcasletadd">
12569 <title>Case of letters in address lists</title>
12571 <indexterm role="concept">
12572 <primary>case of local parts</primary>
12574 <indexterm role="concept">
12575 <primary>address list</primary>
12576 <secondary>case forcing</secondary>
12578 <indexterm role="concept">
12579 <primary>case forcing in address lists</primary>
12581 Domains in email addresses are always handled caselessly, but for local parts
12582 case may be significant on some systems (see <option>caseful_local_part</option> for how
12583 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12584 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12585 blocking lists should be done in a case-independent manner. Since most address
12586 lists in Exim are used for this kind of control, Exim attempts to do this by
12590 The domain portion of an address is always lowercased before matching it to an
12591 address list. The local part is lowercased by default, and any string
12592 comparisons that take place are done caselessly. This means that the data in
12593 the address list itself, in files included as plain file names, and in any file
12594 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12595 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12596 works caselessly) must be in lower case, because these lookups are not
12600 <indexterm role="concept">
12601 <primary><literal>+caseful</literal></primary>
12603 To allow for the possibility of caseful address list matching, if an item in
12604 an address list is the string <quote>+caseful</quote>, the original case of the local
12605 part is restored for any comparisons that follow, and string comparisons are no
12606 longer case-independent. This does not affect the domain, which remains in
12607 lower case. However, although independent matches on the domain alone are still
12608 performed caselessly, regular expressions that match against an entire address
12609 become case-sensitive after <quote>+caseful</quote> has been seen.
12612 <section id="SECTlocparlis">
12613 <title>Local part lists</title>
12615 <indexterm role="concept">
12616 <primary>list</primary>
12617 <secondary>local part list</secondary>
12619 <indexterm role="concept">
12620 <primary>local part</primary>
12621 <secondary>list</secondary>
12623 Case-sensitivity in local part lists is handled in the same way as for address
12624 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12625 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12626 set false, the subject is lowercased and the matching is initially
12627 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12628 matching in the local part list, but not elsewhere in the router. If
12629 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12630 option is case-sensitive from the start.
12633 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12634 comments are handled in the same way as address lists – they are recognized
12635 only if the # is preceded by white space or the start of the line.
12636 Otherwise, local part lists are matched in the same way as domain lists, except
12637 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12638 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12639 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12641 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12646 <chapter id="CHAPexpand">
12647 <title>String expansions</title>
12649 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12650 <primary>expansion</primary>
12651 <secondary>of strings</secondary>
12653 Many strings in Exim’s run time configuration are expanded before use. Some of
12654 them are expanded every time they are used; others are expanded only once.
12657 When a string is being expanded it is copied verbatim from left to right except
12658 when a dollar or backslash character is encountered. A dollar specifies the
12659 start of a portion of the string that is interpreted and replaced as described
12660 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12661 escape character, as described in the following section.
12663 <section id="SECTlittext">
12664 <title>Literal text in expanded strings</title>
12666 <indexterm role="concept">
12667 <primary>expansion</primary>
12668 <secondary>including literal text</secondary>
12670 An uninterpreted dollar can be included in an expanded string by putting a
12671 backslash in front of it. A backslash can be used to prevent any special
12672 character being treated specially in an expansion, including backslash itself.
12673 If the string appears in quotes in the configuration file, two backslashes are
12674 required because the quotes themselves cause interpretation of backslashes when
12675 the string is read in (see section <xref linkend="SECTstrings"/>).
12678 <indexterm role="concept">
12679 <primary>expansion</primary>
12680 <secondary>non-expandable substrings</secondary>
12682 A portion of the string can specified as non-expandable by placing it between
12683 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12684 expressions, which often contain backslashes and dollar signs. For example:
12686 <literallayout class="monospaced">
12687 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12690 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12691 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12695 <section id="SECID82">
12696 <title>Character escape sequences in expanded strings</title>
12698 <indexterm role="concept">
12699 <primary>expansion</primary>
12700 <secondary>escape sequences</secondary>
12702 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12703 expanded string is recognized as an escape sequence for the character newline,
12704 carriage return, or tab, respectively. A backslash followed by up to three
12705 octal digits is recognized as an octal encoding for a single character, and a
12706 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12710 These escape sequences are also recognized in quoted strings when they are read
12711 in. Their interpretation in expansions as well is useful for unquoted strings,
12712 and for other cases such as looked-up strings that are then expanded.
12715 <section id="SECID83">
12716 <title>Testing string expansions</title>
12718 <indexterm role="concept">
12719 <primary>expansion</primary>
12720 <secondary>testing</secondary>
12722 <indexterm role="concept">
12723 <primary>testing</primary>
12724 <secondary>string expansion</secondary>
12726 <indexterm role="option">
12727 <primary><option>-be</option></primary>
12729 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12730 takes the command arguments, or lines from the standard input if there are no
12731 arguments, runs them through the string expansion code, and writes the results
12732 to the standard output. Variables based on configuration values are set up, but
12733 since no message is being processed, variables such as <varname>$local_part</varname> have no
12734 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12735 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12736 and <option>nhash</option>.
12739 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12740 instead runs under the uid and gid it was called with, to prevent users from
12741 using <option>-be</option> for reading files to which they do not have access.
12744 <indexterm role="option">
12745 <primary><option>-bem</option></primary>
12747 If you want to test expansions that include variables whose values are taken
12748 from a message, there are two other options that can be used. The <option>-bem</option>
12749 option is like <option>-be</option> except that it is followed by a file name. The file is
12750 read as a message before doing the test expansions. For example:
12752 <literallayout class="monospaced">
12753 exim -bem /tmp/test.message '$h_subject:'
12756 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12757 Exim message identifier. For example:
12759 <literallayout class="monospaced">
12760 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12763 This loads the message from Exim’s spool before doing the test expansions, and
12764 is therefore restricted to admin users.
12767 <section id="SECTforexpfai">
12768 <title>Forced expansion failure</title>
12770 <indexterm role="concept">
12771 <primary>expansion</primary>
12772 <secondary>forced failure</secondary>
12774 A number of expansions that are described in the following section have
12775 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12776 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12777 used depends on some condition that is evaluated as part of the expansion. If,
12778 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12779 the entire string expansion fails in a way that can be detected by the code
12780 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12781 its consequences depend on the circumstances. In some cases it is no different
12782 from any other expansion failure, but in others a different action may be
12783 taken. Such variations are mentioned in the documentation of the option that is
12787 <section id="SECTexpansionitems">
12788 <title>Expansion items</title>
12790 The following items are recognized in expanded strings. White space may be used
12791 between sub-items that are keywords or substrings enclosed in braces inside an
12792 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12793 white space is significant.
12797 <term><emphasis role="bold">$</emphasis><<emphasis>variable name</emphasis>> or <emphasis role="bold">${</emphasis><<emphasis>variable name</emphasis>><emphasis role="bold">}</emphasis></term>
12800 <indexterm role="concept">
12801 <primary>expansion</primary>
12802 <secondary>variables</secondary>
12804 Substitute the contents of the named variable, for example:
12806 <literallayout class="monospaced">
12811 The second form can be used to separate the name from subsequent alphanumeric
12812 characters. This form (using braces) is available only for variables; it does
12813 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12814 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12815 given, the expansion fails.
12817 </listitem></varlistentry>
12819 <term><emphasis role="bold">${</emphasis><<emphasis>op</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
12822 <indexterm role="concept">
12823 <primary>expansion</primary>
12824 <secondary>operators</secondary>
12826 The string is first itself expanded, and then the operation specified by
12827 <<emphasis>op</emphasis>> is applied to it. For example:
12829 <literallayout class="monospaced">
12833 The string starts with the first character after the colon, which may be
12834 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12835 below. The operator notation is used for simple expansion items that have just
12836 one argument, because it reduces the number of braces and therefore makes the
12837 string easier to understand.
12839 </listitem></varlistentry>
12841 <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>
12844 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
12845 expansion item below.
12847 </listitem></varlistentry>
12849 <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>
12852 <indexterm role="concept">
12853 <primary><option>dlfunc</option></primary>
12855 This expansion dynamically loads and then calls a locally-written C function.
12856 This functionality is available only if Exim is compiled with
12858 <literallayout class="monospaced">
12862 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12863 object so that it doesn’t reload the same object file in the same Exim process
12864 (but of course Exim does start new processes frequently).
12867 There may be from zero to eight arguments to the function. When compiling
12868 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12869 included. The Exim variables and functions that are defined by that API
12870 are also available for dynamically loaded functions. The function itself
12871 must have the following type:
12873 <literallayout class="monospaced">
12874 int dlfunction(uschar **yield, int argc, uschar *argv[])
12877 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12878 function should return one of the following values:
12881 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12882 into the expanded string that is being built.
12885 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12886 from <emphasis>yield</emphasis>, if it is set.
12889 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12890 taken from <emphasis>yield</emphasis> if it is set.
12893 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12896 When compiling a function that is to be used in this way with gcc,
12897 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12898 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12900 </listitem></varlistentry>
12902 <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>
12905 <indexterm role="concept">
12906 <primary>expansion</primary>
12907 <secondary>extracting substrings by key</secondary>
12909 <indexterm role="concept">
12910 <primary><option>extract</option></primary>
12911 <secondary>substrings by key</secondary>
12913 The key and <<emphasis>string1</emphasis>> are first expanded separately. Leading and trailing
12914 white space is removed from the key (but not from any of the strings). The key
12915 must not consist entirely of digits. The expanded <<emphasis>string1</emphasis>> must be of the
12919 <<emphasis>key1</emphasis>> = <<emphasis>value1</emphasis>> <<emphasis>key2</emphasis>> = <<emphasis>value2</emphasis>> ...
12922 <indexterm role="variable">
12923 <primary><varname>$value</varname></primary>
12925 where the equals signs and spaces (but not both) are optional. If any of the
12926 values contain white space, they must be enclosed in double quotes, and any
12927 values that are enclosed in double quotes are subject to escape processing as
12928 described in section <xref linkend="SECTstrings"/>. The expanded <<emphasis>string1</emphasis>> is searched
12929 for the value that corresponds to the key. The search is case-insensitive. If
12930 the key is found, <<emphasis>string2</emphasis>> is expanded, and replaces the whole item;
12931 otherwise <<emphasis>string3</emphasis>> is used. During the expansion of <<emphasis>string2</emphasis>> the
12932 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12933 is restored to any previous value it might have had.
12936 If {<<emphasis>string3</emphasis>>} is omitted, the item is replaced by an empty string if the
12937 key is not found. If {<<emphasis>string2</emphasis>>} is also omitted, the value that was
12938 extracted is used. Thus, for example, these two expansions are identical, and
12939 yield <quote>2001</quote>:
12941 <literallayout class="monospaced">
12942 ${extract{gid}{uid=1984 gid=2001}}
12943 ${extract{gid}{uid=1984 gid=2001}{$value}}
12946 Instead of {<<emphasis>string3</emphasis>>} the word <quote>fail</quote> (not in curly brackets) can
12947 appear, for example:
12949 <literallayout class="monospaced">
12950 ${extract{Z}{A=... B=...}{$value} fail }
12953 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12954 {<<emphasis>string2</emphasis>>} must be present for <quote>fail</quote> to be recognized.
12956 </listitem></varlistentry>
12958 <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>
12961 <indexterm role="concept">
12962 <primary>expansion</primary>
12963 <secondary>extracting substrings by number</secondary>
12965 <indexterm role="concept">
12966 <primary><option>extract</option></primary>
12967 <secondary>substrings by number</secondary>
12969 The <<emphasis>number</emphasis>> argument must consist entirely of decimal digits,
12970 apart from leading and trailing white space, which is ignored.
12971 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12972 behaves in the same way, except that, instead of extracting a named field, it
12973 extracts from <<emphasis>string1</emphasis>> the field whose number is given as the first
12974 argument. You can use <varname>$value</varname> in <<emphasis>string2</emphasis>> or <literal>fail</literal> instead of
12975 <<emphasis>string3</emphasis>> as before.
12978 The fields in the string are separated by any one of the characters in the
12979 separator string. These may include space or tab characters.
12980 The first field is numbered one. If the number is negative, the fields are
12981 counted from the end of the string, with the rightmost one numbered -1. If the
12982 number given is zero, the entire string is returned. If the modulus of the
12983 number is greater than the number of fields in the string, the result is the
12984 expansion of <<emphasis>string3</emphasis>>, or the empty string if <<emphasis>string3</emphasis>> is not
12985 provided. For example:
12987 <literallayout class="monospaced">
12988 ${extract{2}{:}{x:42:99:& Mailer::/bin/bash}}
12991 yields <quote>42</quote>, and
12993 <literallayout class="monospaced">
12994 ${extract{-4}{:}{x:42:99:& Mailer::/bin/bash}}
12997 yields <quote>99</quote>. Two successive separators mean that the field between them is
12998 empty (for example, the fifth field above).
13000 </listitem></varlistentry>
13002 <term><emphasis role="bold">${filter{</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>condition</emphasis>><emphasis role="bold">}}</emphasis></term>
13005 <indexterm role="concept">
13006 <primary>list</primary>
13007 <secondary>selecting by condition</secondary>
13009 <indexterm role="concept">
13010 <primary>expansion</primary>
13011 <secondary>selecting from list by condition</secondary>
13013 <indexterm role="variable">
13014 <primary><varname>$item</varname></primary>
13016 After expansion, <<emphasis>string</emphasis>> is interpreted as a list, colon-separated by
13017 default, but the separator can be changed in the usual way. For each item
13018 in this list, its value is place in <varname>$item</varname>, and then the condition is
13019 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
13020 item in a new list; if the condition is false, the item is discarded. The
13021 separator used for the output list is the same as the one used for the
13022 input, but a separator setting is not included in the output. For example:
13024 <literallayout class="monospaced">
13025 ${filter{a:b:c}{!eq{$item}{b}}
13028 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
13029 to what it was before. See also the <emphasis role="bold">map</emphasis> and <emphasis role="bold">reduce</emphasis> expansion items.
13031 </listitem></varlistentry>
13033 <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>
13036 <indexterm role="concept">
13037 <primary>hash function</primary>
13038 <secondary>textual</secondary>
13040 <indexterm role="concept">
13041 <primary>expansion</primary>
13042 <secondary>textual hash</secondary>
13044 This is a textual hashing function, and was the first to be implemented in
13045 early versions of Exim. In current releases, there are other hashing functions
13046 (numeric, MD5, and SHA-1), which are described below.
13049 The first two strings, after expansion, must be numbers. Call them <<emphasis>m</emphasis>> and
13050 <<emphasis>n</emphasis>>. If you are using fixed values for these numbers, that is, if
13051 <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you can
13052 use the simpler operator notation that avoids some of the braces:
13054 <literallayout class="monospaced">
13055 ${hash_<n>_<m>:<string>}
13058 The second number is optional (in both notations). If <<emphasis>n</emphasis>> is greater than
13059 or equal to the length of the string, the expansion item returns the string.
13060 Otherwise it computes a new string of length <<emphasis>n</emphasis>> by applying a hashing
13061 function to the string. The new string consists of characters taken from the
13062 first <<emphasis>m</emphasis>> characters of the string
13064 <literallayout class="monospaced">
13065 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
13068 If <<emphasis>m</emphasis>> is not present the value 26 is used, so that only lower case
13069 letters appear. For example:
13072 <literal>$hash{3}{monty}} </literal> yields <literal>jmg</literal>
13073 <literal>$hash{5}{monty}} </literal> yields <literal>monty</literal>
13074 <literal>$hash{4}{62}{monty python}}</literal> yields <literal>fbWx</literal>
13076 </listitem></varlistentry>
13078 <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>
13079 <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>
13080 <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>
13083 <indexterm role="concept">
13084 <primary>expansion</primary>
13085 <secondary>header insertion</secondary>
13087 <indexterm role="variable">
13088 <primary><varname>$header_</varname></primary>
13090 <indexterm role="variable">
13091 <primary><varname>$bheader_</varname></primary>
13093 <indexterm role="variable">
13094 <primary><varname>$rheader_</varname></primary>
13096 <indexterm role="concept">
13097 <primary>header lines</primary>
13098 <secondary>in expansion strings</secondary>
13100 <indexterm role="concept">
13101 <primary>header lines</primary>
13102 <secondary>character sets</secondary>
13104 <indexterm role="concept">
13105 <primary>header lines</primary>
13106 <secondary>decoding</secondary>
13108 Substitute the contents of the named message header line, for example
13110 <literallayout class="monospaced">
13114 The newline that terminates a header line is not included in the expansion, but
13115 internal newlines (caused by splitting the header line over several physical
13116 lines) may be present.
13119 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
13120 the data in the header line is interpreted.
13125 <indexterm role="concept">
13126 <primary>white space</primary>
13127 <secondary>in header lines</secondary>
13129 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
13130 processing at all, and without the removal of leading and trailing white space.
13135 <indexterm role="concept">
13136 <primary>base64 encoding</primary>
13137 <secondary>in header lines</secondary>
13139 <option>bheader</option> removes leading and trailing white space, and then decodes base64
13140 or quoted-printable MIME <quote>words</quote> within the header text, but does no
13141 character set translation. If decoding of what looks superficially like a MIME
13142 <quote>word</quote> fails, the raw string is returned. If decoding
13143 <indexterm role="concept">
13144 <primary>binary zero</primary>
13145 <secondary>in header line</secondary>
13147 produces a binary zero character, it is replaced by a question mark – this is
13148 what Exim does for binary zeros that are actually received in header lines.
13153 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
13154 standard character set. This is an attempt to produce the same string as would
13155 be displayed on a user’s MUA. If translation fails, the <option>bheader</option> string is
13156 returned. Translation is attempted only on operating systems that support the
13157 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
13158 a system Makefile or in <filename>Local/Makefile</filename>.
13163 In a filter file, the target character set for <option>header</option> can be specified by a
13164 command of the following form:
13166 <literallayout class="monospaced">
13167 headers charset "UTF-8"
13170 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
13171 subsequently obeyed filter commands. In the absence of this command, the target
13172 character set in a filter is taken from the setting of the <option>headers_charset</option>
13173 option in the runtime configuration. The value of this option defaults to the
13174 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
13178 Header names follow the syntax of RFC 2822, which states that they may contain
13179 any printing characters except space and colon. Consequently, curly brackets
13180 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
13181 if they were variables. Attempting to do so causes a syntax error.
13184 Only header lines that are common to all copies of a message are visible to
13185 this mechanism. These are the original header lines that are received with the
13186 message, and any that are added by an ACL statement or by a system
13187 filter. Header lines that are added to a particular copy of a message by a
13188 router or transport are not accessible.
13191 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
13192 before the DATA ACL, because the header structure is not set up until the
13193 message is received. Header lines that are added in a RCPT ACL (for example)
13194 are saved until the message’s incoming header lines are available, at which
13195 point they are added. When a DATA ACL is running, however, header lines added
13196 by earlier ACLs are visible.
13199 Upper case and lower case letters are synonymous in header names. If the
13200 following character is white space, the terminating colon may be omitted, but
13201 this is not recommended, because you may then forget it when it is needed. When
13202 white space terminates the header name, it is included in the expanded string.
13203 If the message does not contain the given header, the expansion item is
13204 replaced by an empty string. (See the <option>def</option> condition in section
13205 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
13208 If there is more than one header with the same name, they are all concatenated
13209 to form the substitution string, up to a maximum length of 64K. Unless
13210 <option>rheader</option> is being used, leading and trailing white space is removed from
13211 each header before concatenation, and a completely empty header is ignored. A
13212 newline character is then inserted between non-empty headers, but there is no
13213 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
13214 those headers that contain lists of addresses, a comma is also inserted at the
13215 junctions between headers. This does not happen for the <option>rheader</option> expansion.
13217 </listitem></varlistentry>
13219 <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>
13222 <indexterm role="concept">
13223 <primary>expansion</primary>
13224 <secondary>hmac hashing</secondary>
13226 <indexterm role="concept">
13227 <primary><option>hmac</option></primary>
13229 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
13230 shared secret and some text into a message authentication code, as specified in
13231 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
13232 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
13233 cryptographic hash, allowing for authentication that is not possible with MD5
13234 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
13235 present. For example:
13237 <literallayout class="monospaced">
13238 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
13241 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
13244 <literallayout class="monospaced">
13245 dd97e3ba5d1a61b5006108f8c8252953
13248 As an example of how this might be used, you might put in the main part of
13249 an Exim configuration:
13251 <literallayout class="monospaced">
13252 SPAMSCAN_SECRET=cohgheeLei2thahw
13255 In a router or a transport you could then have:
13257 <literallayout class="monospaced">
13259 X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
13260 ${hmac{md5}{SPAMSCAN_SECRET}\
13261 {${primary_hostname},${message_exim_id},$h_message-id:}}
13264 Then given a message, you can check where it was scanned by looking at the
13265 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
13266 this header line is authentic by recomputing the authentication code from the
13267 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
13268 using Exim’s <option>-be</option> option, or by other means, for example by using the
13269 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
13271 </listitem></varlistentry>
13273 <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>
13276 <indexterm role="concept">
13277 <primary>expansion</primary>
13278 <secondary>conditional</secondary>
13280 <indexterm role="concept">
13281 <primary><option>if</option>, expansion item</primary>
13283 If <<emphasis>condition</emphasis>> is true, <<emphasis>string1</emphasis>> is expanded and replaces the whole
13284 item; otherwise <<emphasis>string2</emphasis>> is used. The available conditions are described
13285 in section <xref linkend="SECTexpcond"/> below. For example:
13287 <literallayout class="monospaced">
13288 ${if eq {$local_part}{postmaster} {yes}{no} }
13291 The second string need not be present; if it is not and the condition is not
13292 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
13293 be present instead of the second string (without any curly brackets). In this
13294 case, the expansion is forced to fail if the condition is not true (see section
13295 <xref linkend="SECTforexpfai"/>).
13298 If both strings are omitted, the result is the string <literal>true</literal> if the condition
13299 is true, and the empty string if the condition is false. This makes it less
13300 cumbersome to write custom ACL and router conditions. For example, instead of
13302 <literallayout class="monospaced">
13303 condition = ${if >{$acl_m4}{3}{true}{false}}
13308 <literallayout class="monospaced">
13309 condition = ${if >{$acl_m4}{3}}
13311 </listitem></varlistentry>
13313 <term><emphasis role="bold">${length{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13316 <indexterm role="concept">
13317 <primary>expansion</primary>
13318 <secondary>string truncation</secondary>
13320 <indexterm role="concept">
13321 <primary><option>length</option> expansion item</primary>
13323 The <option>length</option> item is used to extract the initial portion of a string. Both
13324 strings are expanded, and the first one must yield a number, <<emphasis>n</emphasis>>, say. If
13325 you are using a fixed value for the number, that is, if <<emphasis>string1</emphasis>> does not
13326 change when expanded, you can use the simpler operator notation that avoids
13327 some of the braces:
13329 <literallayout class="monospaced">
13330 ${length_<n>:<string>}
13333 The result of this item is either the first <<emphasis>n</emphasis>> characters or the whole
13334 of <<emphasis>string2</emphasis>>, whichever is the shorter. Do not confuse <option>length</option> with
13335 <option>strlen</option>, which gives the length of a string.
13337 </listitem></varlistentry>
13339 <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>
13342 This is the first of one of two different types of lookup item, which are both
13343 described in the next item.
13345 </listitem></varlistentry>
13347 <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>
13350 <indexterm role="concept">
13351 <primary>expansion</primary>
13352 <secondary>lookup in</secondary>
13354 <indexterm role="concept">
13355 <primary>file</primary>
13356 <secondary>lookups</secondary>
13358 <indexterm role="concept">
13359 <primary>lookup</primary>
13360 <secondary>in expanded string</secondary>
13362 The two forms of lookup item specify data lookups in files and databases, as
13363 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13364 lookups, and the second is used for query-style lookups. The <<emphasis>key</emphasis>>,
13365 <<emphasis>file</emphasis>>, and <<emphasis>query</emphasis>> strings are expanded before use.
13368 If there is any white space in a lookup item which is part of a filter command,
13369 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13370 other place where white space is significant, the lookup item must be enclosed
13371 in double quotes. The use of data lookups in users’ filter files may be locked
13372 out by the system administrator.
13375 <indexterm role="variable">
13376 <primary><varname>$value</varname></primary>
13378 If the lookup succeeds, <<emphasis>string1</emphasis>> is expanded and replaces the entire item.
13379 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13380 lookup. Afterwards it reverts to the value it had previously (at the outer
13381 level it is empty). If the lookup fails, <<emphasis>string2</emphasis>> is expanded and replaces
13382 the entire item. If {<<emphasis>string2</emphasis>>} is omitted, the replacement is the empty
13383 string on failure. If <<emphasis>string2</emphasis>> is provided, it can itself be a nested
13384 lookup, thus providing a mechanism for looking up a default value when the
13385 original lookup fails.
13388 If a nested lookup is used as part of <<emphasis>string1</emphasis>>, <varname>$value</varname> contains the
13389 data for the outer lookup while the parameters of the second lookup are
13390 expanded, and also while <<emphasis>string2</emphasis>> of the second lookup is expanded, should
13391 the second lookup fail. Instead of {<<emphasis>string2</emphasis>>} the word <quote>fail</quote> can
13392 appear, and in this case, if the lookup fails, the entire expansion is forced
13393 to fail (see section <xref linkend="SECTforexpfai"/>). If both {<<emphasis>string1</emphasis>>} and
13394 {<<emphasis>string2</emphasis>>} are omitted, the result is the looked up value in the case of a
13395 successful lookup, and nothing in the case of failure.
13398 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13399 search type in order to do partial matching, and * or *@ may follow a search
13400 type to request default lookups if the key does not match (see sections
13401 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13404 <indexterm role="concept">
13405 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13406 <secondary>in lookup expansion</secondary>
13408 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13409 and non-wild parts of the key during the expansion of the replacement text.
13410 They return to their previous values at the end of the lookup item.
13413 This example looks up the postmaster alias in the conventional alias file:
13415 <literallayout class="monospaced">
13416 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13419 This example uses NIS+ to look up the full name of the user corresponding to
13420 the local part of an address, forcing the expansion to fail if it is not found:
13422 <literallayout class="monospaced">
13423 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13426 </listitem></varlistentry>
13428 <term><emphasis role="bold">${map{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}}</emphasis></term>
13431 <indexterm role="concept">
13432 <primary>expansion</primary>
13433 <secondary>list creation</secondary>
13435 <indexterm role="variable">
13436 <primary><varname>$item</varname></primary>
13438 After expansion, <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by
13439 default, but the separator can be changed in the usual way. For each item
13440 in this list, its value is place in <varname>$item</varname>, and then <<emphasis>string2</emphasis>> is
13441 expanded and added to the output as an item in a new list. The separator used
13442 for the output list is the same as the one used for the input, but a separator
13443 setting is not included in the output. For example:
13445 <literallayout class="monospaced">
13446 ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}}
13449 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
13450 value of <varname>$item</varname> is restored to what it was before. See also the <emphasis role="bold">filter</emphasis>
13451 and <emphasis role="bold">reduce</emphasis> expansion items.
13453 </listitem></varlistentry>
13455 <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>
13458 <indexterm role="concept">
13459 <primary>expansion</primary>
13460 <secondary>numeric hash</secondary>
13462 <indexterm role="concept">
13463 <primary>hash function</primary>
13464 <secondary>numeric</secondary>
13466 The three strings are expanded; the first two must yield numbers. Call them
13467 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13468 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13469 can use the simpler operator notation that avoids some of the braces:
13471 <literallayout class="monospaced">
13472 ${nhash_<n>_<m>:<string>}
13475 The second number is optional (in both notations). If there is only one number,
13476 the result is a number in the range 0–<<emphasis>n</emphasis>>-1. Otherwise, the string is
13477 processed by a div/mod hash function that returns two numbers, separated by a
13478 slash, in the ranges 0 to <<emphasis>n</emphasis>>-1 and 0 to <<emphasis>m</emphasis>>-1, respectively. For
13481 <literallayout class="monospaced">
13482 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13485 returns the string <quote>6/33</quote>.
13487 </listitem></varlistentry>
13489 <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>
13492 <indexterm role="concept">
13493 <primary>Perl</primary>
13494 <secondary>use in expanded string</secondary>
13496 <indexterm role="concept">
13497 <primary>expansion</primary>
13498 <secondary>calling Perl from</secondary>
13500 This item is available only if Exim has been built to include an embedded Perl
13501 interpreter. The subroutine name and the arguments are first separately
13502 expanded, and then the Perl subroutine is called with those arguments. No
13503 additional arguments need be given; the maximum number permitted, including the
13504 name of the subroutine, is nine.
13507 The return value of the subroutine is inserted into the expanded string, unless
13508 the return value is <option>undef</option>. In that case, the expansion fails in the same
13509 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13510 Whatever you return is evaluated in a scalar context. For example, if you
13511 return the name of a Perl vector, the return value is the size of the vector,
13515 If the subroutine exits by calling Perl’s <option>die</option> function, the expansion fails
13516 with the error message that was passed to <option>die</option>. More details of the embedded
13517 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13520 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13521 out the use of this expansion item in filter files.
13523 </listitem></varlistentry>
13525 <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>
13528 <indexterm role="concept">
13529 <primary><option>prvs</option> expansion item</primary>
13531 The first argument is a complete email address and the second is secret
13532 keystring. The third argument, specifying a key number, is optional. If absent,
13533 it defaults to 0. The result of the expansion is a prvs-signed email address,
13534 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13535 as part of a bounce address tag validation (BATV) scheme. For more discussion
13536 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13538 </listitem></varlistentry>
13540 <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>
13543 <indexterm role="concept">
13544 <primary><option>prvscheck</option> expansion item</primary>
13546 This expansion item is the complement of the <option>prvs</option> item. It is used for
13547 checking prvs-signed addresses. If the expansion of the first argument does not
13548 yield a syntactically valid prvs-signed address, the whole item expands to the
13549 empty string. When the first argument does expand to a syntactically valid
13550 prvs-signed address, the second argument is expanded, with the prvs-decoded
13551 version of the address and the key number extracted from the address in the
13552 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13555 These two variables can be used in the expansion of the second argument to
13556 retrieve the secret. The validity of the prvs-signed address is then checked
13557 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13558 which is empty for failure or <quote>1</quote> for success.
13561 The third argument is optional; if it is missing, it defaults to an empty
13562 string. This argument is now expanded. If the result is an empty string, the
13563 result of the expansion is the decoded version of the address. This is the case
13564 whether or not the signature was valid. Otherwise, the result of the expansion
13565 is the expansion of the third argument.
13568 All three variables can be used in the expansion of the third argument.
13569 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13570 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13572 </listitem></varlistentry>
13574 <term><emphasis role="bold">${readfile{</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>eol string</emphasis>><emphasis role="bold">}}</emphasis></term>
13577 <indexterm role="concept">
13578 <primary>expansion</primary>
13579 <secondary>inserting an entire file</secondary>
13581 <indexterm role="concept">
13582 <primary>file</primary>
13583 <secondary>inserting into expansion</secondary>
13585 <indexterm role="concept">
13586 <primary><option>readfile</option> expansion item</primary>
13588 The file name and end-of-line string are first expanded separately. The file is
13589 then read, and its contents replace the entire item. All newline characters in
13590 the file are replaced by the end-of-line string if it is present. Otherwise,
13591 newlines are left in the string.
13592 String expansion is not applied to the contents of the file. If you want this,
13593 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13594 the string expansion fails.
13597 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13598 locks out the use of this expansion item in filter files.
13600 </listitem></varlistentry>
13602 <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>
13605 <indexterm role="concept">
13606 <primary>expansion</primary>
13607 <secondary>inserting from a socket</secondary>
13609 <indexterm role="concept">
13610 <primary>socket, use of in expansion</primary>
13612 <indexterm role="concept">
13613 <primary><option>readsocket</option> expansion item</primary>
13615 This item inserts data from a Unix domain or Internet socket into the expanded
13616 string. The minimal way of using it uses just two arguments, as in these
13619 <literallayout class="monospaced">
13620 ${readsocket{/socket/name}{request string}}
13621 ${readsocket{inet:some.host:1234}{request string}}
13624 For a Unix domain socket, the first substring must be the path to the socket.
13625 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13626 a host name or IP address, followed by a colon and a port, which can be a
13627 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13628 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13631 <literallayout class="monospaced">
13632 ${readsocket{inet:[::1]:1234}{request string}}
13635 Only a single host name may be given, but if looking it up yields more than
13636 one IP address, they are each tried in turn until a connection is made. For
13637 both kinds of socket, Exim makes a connection, writes the request string
13638 (unless it is an empty string) and reads from the socket until an end-of-file
13639 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13640 extend what can be done. Firstly, you can vary the timeout. For example:
13642 <literallayout class="monospaced">
13643 ${readsocket{/socket/name}{request string}{3s}}
13646 A fourth argument allows you to change any newlines that are in the data
13647 that is read, in the same way as for <option>readfile</option> (see above). This example
13648 turns them into spaces:
13650 <literallayout class="monospaced">
13651 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13654 As with all expansions, the substrings are expanded before the processing
13655 happens. Errors in these sub-expansions cause the expansion to fail. In
13656 addition, the following errors can occur:
13661 Failure to create a socket file descriptor;
13666 Failure to connect the socket;
13671 Failure to write the request string;
13676 Timeout on reading from the socket.
13681 By default, any of these errors causes the expansion to fail. However, if
13682 you supply a fifth substring, it is expanded and used when any of the above
13683 errors occurs. For example:
13685 <literallayout class="monospaced">
13686 ${readsocket{/socket/name}{request string}{3s}{\n}\
13690 You can test for the existence of a Unix domain socket by wrapping this
13691 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13692 and the actual opening of the socket, so it is safer to use the fifth argument
13693 if you want to be absolutely sure of avoiding an expansion error for a
13694 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13697 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13698 locks out the use of this expansion item in filter files.
13700 </listitem></varlistentry>
13702 <term><emphasis role="bold">${reduce{</emphasis><<emphasis>string1</emphasis>>}{<<emphasis>string2</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string3</emphasis>><emphasis role="bold">}}</emphasis></term>
13705 <indexterm role="concept">
13706 <primary>expansion</primary>
13707 <secondary>reducing a list to a scalar</secondary>
13709 <indexterm role="concept">
13710 <primary>list</primary>
13711 <secondary>reducing to a scalar</secondary>
13713 <indexterm role="variable">
13714 <primary><varname>$value</varname></primary>
13716 <indexterm role="variable">
13717 <primary><varname>$item</varname></primary>
13719 This operation reduces a list to a single, scalar string. After expansion,
13720 <<emphasis>string1</emphasis>> is interpreted as a list, colon-separated by default, but the
13721 separator can be changed in the usual way. Then <<emphasis>string2</emphasis>> is expanded and
13722 assigned to the <varname>$value</varname> variable. After this, each item in the <<emphasis>string1</emphasis>>
13723 list is assigned to <varname>$item</varname> in turn, and <<emphasis>string3</emphasis>> is expanded for each of
13724 them. The result of that expansion is assigned to <varname>$value</varname> before the next
13725 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
13726 added to the expansion output. The <emphasis role="bold">reduce</emphasis> expansion item can be used in a
13727 number of ways. For example, to add up a list of numbers:
13729 <literallayout class="monospaced">
13730 ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
13733 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
13736 <literallayout class="monospaced">
13737 ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
13740 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
13741 restored to what they were before. See also the <emphasis role="bold">filter</emphasis> and <emphasis role="bold">map</emphasis>
13744 </listitem></varlistentry>
13746 <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>
13749 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13750 expansion item above.
13752 </listitem></varlistentry>
13754 <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>
13757 <indexterm role="concept">
13758 <primary>expansion</primary>
13759 <secondary>running a command</secondary>
13761 <indexterm role="concept">
13762 <primary><option>run</option> expansion item</primary>
13764 The command and its arguments are first expanded separately, and then the
13765 command is run in a separate process, but under the same uid and gid. As in
13766 other command executions from Exim, a shell is not used by default. If you want
13767 a shell, you must explicitly code it.
13770 The standard input for the command exists, but is empty. The standard output
13771 and standard error are set to the same file descriptor.
13772 <indexterm role="concept">
13773 <primary>return code</primary>
13774 <secondary>from <option>run</option> expansion</secondary>
13776 <indexterm role="variable">
13777 <primary><varname>$value</varname></primary>
13779 If the command succeeds (gives a zero return code) <<emphasis>string1</emphasis>> is expanded
13780 and replaces the entire item; during this expansion, the standard output/error
13781 from the command is in the variable <varname>$value</varname>. If the command fails,
13782 <<emphasis>string2</emphasis>>, if present, is expanded and used. Once again, during the
13783 expansion, the standard output/error from the command is in the variable
13784 <varname>$value</varname>.
13787 If <<emphasis>string2</emphasis>> is absent, the result is empty. Alternatively, <<emphasis>string2</emphasis>>
13788 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13789 command does not succeed. If both strings are omitted, the result is contents
13790 of the standard output/error on success, and nothing on failure.
13793 <indexterm role="variable">
13794 <primary><varname>$runrc</varname></primary>
13796 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13797 remains set afterwards, so in a filter file you can do things like this:
13799 <literallayout class="monospaced">
13800 if "${run{x y z}{}}$runrc" is 1 then ...
13801 elif $runrc is 2 then ...
13806 If execution of the command fails (for example, the command does not exist),
13807 the return code is 127 – the same code that shells use for non-existent
13811 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13812 option values are expanded, except for those preconditions whose order of
13813 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13814 by the expansion of one option, and use it in another.
13817 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13818 out the use of this expansion item in filter files.
13820 </listitem></varlistentry>
13822 <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>
13825 <indexterm role="concept">
13826 <primary>expansion</primary>
13827 <secondary>string substitution</secondary>
13829 <indexterm role="concept">
13830 <primary><option>sg</option> expansion item</primary>
13832 This item works like Perl’s substitution operator (s) with the global (/g)
13833 option; hence its name. However, unlike the Perl equivalent, Exim does not
13834 modify the subject string; instead it returns the modified string for insertion
13835 into the overall expansion. The item takes three arguments: the subject string,
13836 a regular expression, and a substitution string. For example:
13838 <literallayout class="monospaced">
13839 ${sg{abcdefabcdef}{abc}{xyz}}
13842 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13843 if any $ or \ characters are required in the regular expression or in the
13844 substitution string, they have to be escaped. For example:
13846 <literallayout class="monospaced">
13847 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13850 yields <quote>defabc</quote>, and
13852 <literallayout class="monospaced">
13853 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13856 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13857 the regular expression from string expansion.
13859 </listitem></varlistentry>
13861 <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>
13864 <indexterm role="concept">
13865 <primary><option>substr</option> expansion item</primary>
13867 <indexterm role="concept">
13868 <primary>substring extraction</primary>
13870 <indexterm role="concept">
13871 <primary>expansion</primary>
13872 <secondary>substring extraction</secondary>
13874 The three strings are expanded; the first two must yield numbers. Call them
13875 <<emphasis>n</emphasis>> and <<emphasis>m</emphasis>>. If you are using fixed values for these numbers, that is,
13876 if <<emphasis>string1</emphasis>> and <<emphasis>string2</emphasis>> do not change when they are expanded, you
13877 can use the simpler operator notation that avoids some of the braces:
13879 <literallayout class="monospaced">
13880 ${substr_<n>_<m>:<string>}
13883 The second number is optional (in both notations).
13884 If it is absent in the simpler format, the preceding underscore must also be
13888 The <option>substr</option> item can be used to extract more general substrings than
13889 <option>length</option>. The first number, <<emphasis>n</emphasis>>, is a starting offset, and <<emphasis>m</emphasis>> is the
13890 length required. For example
13892 <literallayout class="monospaced">
13893 ${substr{3}{2}{$local_part}}
13896 If the starting offset is greater than the string length the result is the
13897 null string; if the length plus starting offset is greater than the string
13898 length, the result is the right-hand part of the string, starting from the
13899 given offset. The first character in the string has offset zero.
13902 The <option>substr</option> expansion item can take negative offset values to count
13903 from the right-hand end of its operand. The last character is offset -1, the
13904 second-last is offset -2, and so on. Thus, for example,
13906 <literallayout class="monospaced">
13907 ${substr{-5}{2}{1234567}}
13910 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13911 length of the string, the substring starts at the beginning of the string, and
13912 the length is reduced by the amount of overshoot. Thus, for example,
13914 <literallayout class="monospaced">
13915 ${substr{-5}{2}{12}}
13918 yields an empty string, but
13920 <literallayout class="monospaced">
13921 ${substr{-3}{2}{12}}
13924 yields <quote>1</quote>.
13927 When the second number is omitted from <option>substr</option>, the remainder of the string
13928 is taken if the offset is positive. If it is negative, all characters in the
13929 string preceding the offset point are taken. For example, an offset of -1 and
13930 no length, as in these semantically identical examples:
13932 <literallayout class="monospaced">
13934 ${substr{-1}{abcde}}
13937 yields all but the last character of the string, that is, <quote>abcd</quote>.
13939 </listitem></varlistentry>
13941 <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>
13944 <indexterm role="concept">
13945 <primary>expansion</primary>
13946 <secondary>character translation</secondary>
13948 <indexterm role="concept">
13949 <primary><option>tr</option> expansion item</primary>
13951 This item does single-character translation on its subject string. The second
13952 argument is a list of characters to be translated in the subject string. Each
13953 matching character is replaced by the corresponding character from the
13954 replacement list. For example
13956 <literallayout class="monospaced">
13957 ${tr{abcdea}{ac}{13}}
13960 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13961 last occurrence is used. If the third string is shorter than the second, its
13962 last character is replicated. However, if it is empty, no translation takes
13965 </listitem></varlistentry>
13968 <section id="SECTexpop">
13969 <title>Expansion operators</title>
13971 <indexterm role="concept">
13972 <primary>expansion</primary>
13973 <secondary>operators</secondary>
13975 For expansion items that perform transformations on a single argument string,
13976 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13977 The substring is first expanded before the operation is applied to it. The
13978 following operations can be performed:
13982 <term><emphasis role="bold">${address:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
13985 <indexterm role="concept">
13986 <primary>expansion</primary>
13987 <secondary>RFC 2822 address handling</secondary>
13989 <indexterm role="concept">
13990 <primary><option>address</option> expansion item</primary>
13992 The string is interpreted as an RFC 2822 address, as it might appear in a
13993 header line, and the effective address is extracted from it. If the string does
13994 not parse successfully, the result is empty.
13996 </listitem></varlistentry>
13998 <term><emphasis role="bold">${addresses:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14001 <indexterm role="concept">
14002 <primary>expansion</primary>
14003 <secondary>RFC 2822 address handling</secondary>
14005 <indexterm role="concept">
14006 <primary><option>addresses</option> expansion item</primary>
14008 The string (after expansion) is interpreted as a list of addresses in RFC
14009 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
14010 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
14011 result of the expansion is a colon-separated list, with appropriate
14012 doubling of colons should any happen to be present in the email addresses.
14013 Syntactically invalid RFC2822 address items are omitted from the output.
14016 It is possible to specify a character other than colon for the output
14017 separator by starting the string with > followed by the new separator
14018 character. For example:
14020 <literallayout class="monospaced">
14021 ${addresses:>& Chief <ceo@up.stairs>, sec@base.ment (dogsbody)}
14024 expands to <literal>ceo@up.stairs&sec@base.ment</literal>. Compare the <emphasis role="bold">address</emphasis> (singular)
14025 expansion item, which extracts the working address from a single RFC2822
14026 address. See the <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and <emphasis role="bold">reduce</emphasis> items for ways of
14029 </listitem></varlistentry>
14031 <term><emphasis role="bold">${base62:</emphasis><<emphasis>digits</emphasis>><emphasis role="bold">}</emphasis></term>
14034 <indexterm role="concept">
14035 <primary><option>base62</option> expansion item</primary>
14037 <indexterm role="concept">
14038 <primary>expansion</primary>
14039 <secondary>conversion to base 62</secondary>
14041 The string must consist entirely of decimal digits. The number is converted to
14042 base 62 and output as a string of six characters, including leading zeros. In
14043 the few operating environments where Exim uses base 36 instead of base 62 for
14044 its message identifiers (because those systems do not have case-sensitive file
14045 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
14046 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
14048 </listitem></varlistentry>
14050 <term><emphasis role="bold">${base62d:</emphasis><<emphasis>base-62 digits</emphasis>><emphasis role="bold">}</emphasis></term>
14053 <indexterm role="concept">
14054 <primary><option>base62d</option> expansion item</primary>
14056 <indexterm role="concept">
14057 <primary>expansion</primary>
14058 <secondary>conversion to base 62</secondary>
14060 The string must consist entirely of base-62 digits, or, in operating
14061 environments where Exim uses base 36 instead of base 62 for its message
14062 identifiers, base-36 digits. The number is converted to decimal and output as a
14065 </listitem></varlistentry>
14067 <term><emphasis role="bold">${domain:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14070 <indexterm role="concept">
14071 <primary>domain</primary>
14072 <secondary>extraction</secondary>
14074 <indexterm role="concept">
14075 <primary>expansion</primary>
14076 <secondary>domain extraction</secondary>
14078 The string is interpreted as an RFC 2822 address and the domain is extracted
14079 from it. If the string does not parse successfully, the result is empty.
14081 </listitem></varlistentry>
14083 <term><emphasis role="bold">${escape:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14086 <indexterm role="concept">
14087 <primary>expansion</primary>
14088 <secondary>escaping non-printing characters</secondary>
14090 <indexterm role="concept">
14091 <primary><option>escape</option> expansion item</primary>
14093 If the string contains any non-printing characters, they are converted to
14094 escape sequences starting with a backslash. Whether characters with the most
14095 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
14096 is controlled by the <option>print_topbitchars</option> option.
14098 </listitem></varlistentry>
14100 <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>
14103 <indexterm role="concept">
14104 <primary>expansion</primary>
14105 <secondary>expression evaluation</secondary>
14107 <indexterm role="concept">
14108 <primary>expansion</primary>
14109 <secondary>arithmetic expression</secondary>
14111 <indexterm role="concept">
14112 <primary><option>eval</option> expansion item</primary>
14114 These items supports simple arithmetic and bitwise logical operations in
14115 expansion strings. The string (after expansion) must be a conventional
14116 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
14117 logical operators, and parentheses. All operations are carried out using
14118 integer arithmetic. The operator priorities are as follows (the same as in the
14119 C programming language):
14121 <informaltable frame="none">
14122 <tgroup cols="2" colsep="0" rowsep="0">
14123 <colspec colwidth="70pt" align="left"/>
14124 <colspec colwidth="300pt" align="left"/>
14127 <entry> <emphasis>highest:</emphasis></entry>
14128 <entry>not (~), negate (-)</entry>
14131 <entry> </entry>
14132 <entry>multiply (*), divide (/), remainder (%)</entry>
14135 <entry> </entry>
14136 <entry>plus (+), minus (-)</entry>
14139 <entry> </entry>
14140 <entry>shift-left (<<), shift-right (>>)</entry>
14143 <entry> </entry>
14144 <entry>and (&)</entry>
14147 <entry> </entry>
14148 <entry>xor (^)</entry>
14151 <entry> <emphasis>lowest:</emphasis></entry>
14152 <entry>or (|)</entry>
14158 Binary operators with the same priority are evaluated from left to right. White
14159 space is permitted before or after operators.
14162 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
14163 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
14164 decimal, even if they start with a leading zero; hexadecimal numbers are not
14165 permitted. This can be useful when processing numbers extracted from dates or
14166 times, which often do have leading zeros.
14169 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
14170 respectively. Negative numbers are supported. The result of the computation is
14171 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
14174 <literal>${eval:1+1} </literal> yields 2
14175 <literal>${eval:1+2*3} </literal> yields 7
14176 <literal>${eval:(1+2)*3} </literal> yields 9
14177 <literal>${eval:2+42%5} </literal> yields 4
14178 <literal>${eval:0xc&5} </literal> yields 4
14179 <literal>${eval:0xc|5} </literal> yields 13
14180 <literal>${eval:0xc^5} </literal> yields 9
14181 <literal>${eval:0xc>>1} </literal> yields 6
14182 <literal>${eval:0xc<<1} </literal> yields 24
14183 <literal>${eval:~255&0x1234} </literal> yields 4608
14184 <literal>${eval:-(~255&0x1234)} </literal> yields -4608
14187 As a more realistic example, in an ACL you might have
14189 <literallayout class="monospaced">
14190 deny message = Too many bad recipients
14193 {>{$rcpt_count}{10}} \
14196 {$recipients_count} \
14197 {${eval:$rcpt_count/2}} \
14202 The condition is true if there have been more than 10 RCPT commands and
14203 fewer than half of them have resulted in a valid recipient.
14205 </listitem></varlistentry>
14207 <term><emphasis role="bold">${expand:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14210 <indexterm role="concept">
14211 <primary>expansion</primary>
14212 <secondary>re-expansion of substring</secondary>
14214 The <option>expand</option> operator causes a string to be expanded for a second time. For
14217 <literallayout class="monospaced">
14218 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
14221 first looks up a string in a file while expanding the operand for <option>expand</option>,
14222 and then re-expands what it has found.
14224 </listitem></varlistentry>
14226 <term><emphasis role="bold">${from_utf8:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14229 <indexterm role="concept">
14230 <primary>Unicode</primary>
14232 <indexterm role="concept">
14233 <primary>UTF-8</primary>
14234 <secondary>conversion from</secondary>
14236 <indexterm role="concept">
14237 <primary>expansion</primary>
14238 <secondary>UTF-8 conversion</secondary>
14240 <indexterm role="concept">
14241 <primary><option>from_utf8</option> expansion item</primary>
14243 The world is slowly moving towards Unicode, although there are no standards for
14244 email yet. However, other applications (including some databases) are starting
14245 to store data in Unicode, using UTF-8 encoding. This operator converts from a
14246 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
14247 converted to underscores. The input must be a valid UTF-8 string. If it is not,
14248 the result is an undefined sequence of bytes.
14251 Unicode code points with values less than 256 are compatible with ASCII and
14252 ISO-8859-1 (also known as Latin-1).
14253 For example, character 169 is the copyright symbol in both cases, though the
14254 way it is encoded is different. In UTF-8, more than one byte is needed for
14255 characters with code values greater than 127, whereas ISO-8859-1 is a
14256 single-byte encoding (but thereby limited to 256 characters). This makes
14257 translation from UTF-8 to ISO-8859-1 straightforward.
14259 </listitem></varlistentry>
14261 <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>
14264 <indexterm role="concept">
14265 <primary>hash function</primary>
14266 <secondary>textual</secondary>
14268 <indexterm role="concept">
14269 <primary>expansion</primary>
14270 <secondary>textual hash</secondary>
14272 The <option>hash</option> operator is a simpler interface to the hashing function that can
14273 be used when the two parameters are fixed numbers (as opposed to strings that
14274 change when expanded). The effect is the same as
14276 <literallayout class="monospaced">
14277 ${hash{<n>}{<m>}{<string>}}
14280 See the description of the general <option>hash</option> item above for details. The
14281 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
14283 </listitem></varlistentry>
14285 <term><emphasis role="bold">${hex2b64:</emphasis><<emphasis>hexstring</emphasis>><emphasis role="bold">}</emphasis></term>
14288 <indexterm role="concept">
14289 <primary>base64 encoding</primary>
14290 <secondary>conversion from hex</secondary>
14292 <indexterm role="concept">
14293 <primary>expansion</primary>
14294 <secondary>hex to base64</secondary>
14296 <indexterm role="concept">
14297 <primary><option>hex2b64</option> expansion item</primary>
14299 This operator converts a hex string into one that is base64 encoded. This can
14300 be useful for processing the output of the MD5 and SHA-1 hashing functions.
14302 </listitem></varlistentry>
14304 <term><emphasis role="bold">${lc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14307 <indexterm role="concept">
14308 <primary>case forcing in strings</primary>
14310 <indexterm role="concept">
14311 <primary>string</primary>
14312 <secondary>case forcing</secondary>
14314 <indexterm role="concept">
14315 <primary>lower casing</primary>
14317 <indexterm role="concept">
14318 <primary>expansion</primary>
14319 <secondary>case forcing</secondary>
14321 <indexterm role="concept">
14322 <primary><option>lc</option> expansion item</primary>
14324 This forces the letters in the string into lower-case, for example:
14326 <literallayout class="monospaced">
14329 </listitem></varlistentry>
14331 <term><emphasis role="bold">${length_</emphasis><<emphasis>number</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14334 <indexterm role="concept">
14335 <primary>expansion</primary>
14336 <secondary>string truncation</secondary>
14338 <indexterm role="concept">
14339 <primary><option>length</option> expansion item</primary>
14341 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
14342 can be used when the parameter is a fixed number (as opposed to a string that
14343 changes when expanded). The effect is the same as
14345 <literallayout class="monospaced">
14346 ${length{<number>}{<string>}}
14349 See the description of the general <option>length</option> item above for details. Note that
14350 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
14351 when <option>length</option> is used as an operator.
14353 </listitem></varlistentry>
14355 <term><emphasis role="bold">${local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14358 <indexterm role="concept">
14359 <primary>expansion</primary>
14360 <secondary>local part extraction</secondary>
14362 <indexterm role="concept">
14363 <primary><option>local_part</option> expansion item</primary>
14365 The string is interpreted as an RFC 2822 address and the local part is
14366 extracted from it. If the string does not parse successfully, the result is
14369 </listitem></varlistentry>
14371 <term><emphasis role="bold">${mask:</emphasis><<emphasis>IP address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>bit count</emphasis>><emphasis role="bold">}</emphasis></term>
14374 <indexterm role="concept">
14375 <primary>masked IP address</primary>
14377 <indexterm role="concept">
14378 <primary>IP address</primary>
14379 <secondary>masking</secondary>
14381 <indexterm role="concept">
14382 <primary>CIDR notation</primary>
14384 <indexterm role="concept">
14385 <primary>expansion</primary>
14386 <secondary>IP address masking</secondary>
14388 <indexterm role="concept">
14389 <primary><option>mask</option> expansion item</primary>
14391 If the form of the string to be operated on is not an IP address followed by a
14392 slash and an integer (that is, a network address in CIDR notation), the
14393 expansion fails. Otherwise, this operator converts the IP address to binary,
14394 masks off the least significant bits according to the bit count, and converts
14395 the result back to text, with mask appended. For example,
14397 <literallayout class="monospaced">
14398 ${mask:10.111.131.206/28}
14401 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
14402 be mostly used for looking up masked addresses in files, the result for an IPv6
14403 address uses dots to separate components instead of colons, because colon
14404 terminates a key string in lsearch files. So, for example,
14406 <literallayout class="monospaced">
14407 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
14412 <literallayout class="monospaced">
14413 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14416 Letters in IPv6 addresses are always output in lower case.
14418 </listitem></varlistentry>
14420 <term><emphasis role="bold">${md5:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14423 <indexterm role="concept">
14424 <primary>MD5 hash</primary>
14426 <indexterm role="concept">
14427 <primary>expansion</primary>
14428 <secondary>MD5 hash</secondary>
14430 <indexterm role="concept">
14431 <primary><option>md5</option> expansion item</primary>
14433 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14434 as a 32-digit hexadecimal number, in which any letters are in lower case.
14436 </listitem></varlistentry>
14438 <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>
14441 <indexterm role="concept">
14442 <primary>expansion</primary>
14443 <secondary>numeric hash</secondary>
14445 <indexterm role="concept">
14446 <primary>hash function</primary>
14447 <secondary>numeric</secondary>
14449 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14450 that can be used when the two parameters are fixed numbers (as opposed to
14451 strings that change when expanded). The effect is the same as
14453 <literallayout class="monospaced">
14454 ${nhash{<n>}{<m>}{<string>}}
14457 See the description of the general <option>nhash</option> item above for details.
14459 </listitem></varlistentry>
14461 <term><emphasis role="bold">${quote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14464 <indexterm role="concept">
14465 <primary>quoting</primary>
14466 <secondary>in string expansions</secondary>
14468 <indexterm role="concept">
14469 <primary>expansion</primary>
14470 <secondary>quoting</secondary>
14472 <indexterm role="concept">
14473 <primary><option>quote</option> expansion item</primary>
14475 The <option>quote</option> operator puts its argument into double quotes if it
14476 is an empty string or
14477 contains anything other than letters, digits, underscores, dots, and hyphens.
14478 Any occurrences of double quotes and backslashes are escaped with a backslash.
14479 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14480 respectively For example,
14482 <literallayout class="monospaced">
14488 <literallayout class="monospaced">
14492 The place where this is useful is when the argument is a substitution from a
14493 variable or a message header.
14495 </listitem></varlistentry>
14497 <term><emphasis role="bold">${quote_local_part:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14500 <indexterm role="concept">
14501 <primary><option>quote_local_part</option> expansion item</primary>
14503 This operator is like <option>quote</option>, except that it quotes the string only if
14504 required to do so by the rules of RFC 2822 for quoting local parts. For
14505 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14506 If you are creating a new email address from the contents of <varname>$local_part</varname>
14507 (or any other unknown data), you should always use this operator.
14509 </listitem></varlistentry>
14511 <term><emphasis role="bold">${quote_</emphasis><<emphasis>lookup-type</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14514 <indexterm role="concept">
14515 <primary>quoting</primary>
14516 <secondary>lookup-specific</secondary>
14518 This operator applies lookup-specific quoting rules to the string. Each
14519 query-style lookup type has its own quoting rules which are described with
14520 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14522 <literallayout class="monospaced">
14523 ${quote_ldap:two * two}
14528 <literallayout class="monospaced">
14532 For single-key lookup types, no quoting is ever necessary and this operator
14533 yields an unchanged string.
14535 </listitem></varlistentry>
14537 <term><emphasis role="bold">${randint:</emphasis><<emphasis>n</emphasis>><emphasis role="bold">}</emphasis></term>
14540 <indexterm role="concept">
14541 <primary>random number</primary>
14543 This operator returns a somewhat random number which is less than the
14544 supplied number and is at least 0. The quality of this randomness depends
14545 on how Exim was built; the values are not suitable for keying material.
14546 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
14547 Otherwise, the implementation may be arc4random(), random() seeded by
14548 srandomdev() or srandom(), or a custom implementation even weaker than
14551 </listitem></varlistentry>
14552 <varlistentry revisionflag="changed">
14553 <term><emphasis role="bold">${reverse_ip:</emphasis><<emphasis>ipaddr</emphasis>><emphasis role="bold">}</emphasis></term>
14555 <para revisionflag="changed">
14556 <indexterm role="concept">
14557 <primary>expansion</primary>
14558 <secondary>IP address</secondary>
14560 This operator reverses an IP address; for IPv4 addresses, the result is in
14561 dotted-quad decimal form, while for IPv6 addreses the result is in
14562 dotted-nibble hexadecimal form. In both cases, this is the "natural" form
14563 for DNS. For example,
14565 <literallayout class="monospaced" revisionflag="changed">
14566 ${reverse_ip:192.0.2.4} and ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.3}
14568 <para revisionflag="changed">
14571 <literallayout class="monospaced" revisionflag="changed">
14572 4.2.0.192 and 3.0.2.0.0.0.0.c.d.c.b.a.1.0.0.0.9.0.0.0.2.4.c.0.8.b.d.0.1.0.0.2
14574 </listitem></varlistentry>
14576 <term><emphasis role="bold">${rfc2047:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14579 <indexterm role="concept">
14580 <primary>expansion</primary>
14581 <secondary>RFC 2047</secondary>
14583 <indexterm role="concept">
14584 <primary>RFC 2047</primary>
14585 <secondary>expansion operator</secondary>
14587 <indexterm role="concept">
14588 <primary><option>rfc2047</option> expansion item</primary>
14590 This operator encodes text according to the rules of RFC 2047. This is an
14591 encoding that is used in header lines to encode non-ASCII characters. It is
14592 assumed that the input string is in the encoding specified by the
14593 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14594 contains only characters in the range 33–126, and no instances of the
14597 <literallayout class="monospaced">
14598 ? = ( ) < > @ , ; : \ " . [ ] _
14601 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14602 string, using as many <quote>encoded words</quote> as necessary to encode all the
14605 </listitem></varlistentry>
14607 <term><emphasis role="bold">${rfc2047d:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14610 <indexterm role="concept">
14611 <primary>expansion</primary>
14612 <secondary>RFC 2047</secondary>
14614 <indexterm role="concept">
14615 <primary>RFC 2047</primary>
14616 <secondary>decoding</secondary>
14618 <indexterm role="concept">
14619 <primary><option>rfc2047d</option> expansion item</primary>
14621 This operator decodes strings that are encoded as per RFC 2047. Binary zero
14622 bytes are replaced by question marks. Characters are converted into the
14623 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
14624 not recognized unless <option>check_rfc2047_length</option> is set false.
14627 <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
14628 access a header line, RFC 2047 decoding is done automatically. You do not need
14629 to use this operator as well.
14631 </listitem></varlistentry>
14633 <term><emphasis role="bold">${rxquote:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14636 <indexterm role="concept">
14637 <primary>quoting</primary>
14638 <secondary>in regular expressions</secondary>
14640 <indexterm role="concept">
14641 <primary>regular expressions</primary>
14642 <secondary>quoting</secondary>
14644 <indexterm role="concept">
14645 <primary><option>rxquote</option> expansion item</primary>
14647 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14648 characters in its argument. This is useful when substituting the values of
14649 variables or headers inside regular expressions.
14651 </listitem></varlistentry>
14653 <term><emphasis role="bold">${sha1:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14656 <indexterm role="concept">
14657 <primary>SHA-1 hash</primary>
14659 <indexterm role="concept">
14660 <primary>expansion</primary>
14661 <secondary>SHA-1 hashing</secondary>
14663 <indexterm role="concept">
14664 <primary><option>sha2</option> expansion item</primary>
14666 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14667 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14669 </listitem></varlistentry>
14671 <term><emphasis role="bold">${stat:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14674 <indexterm role="concept">
14675 <primary>expansion</primary>
14676 <secondary>statting a file</secondary>
14678 <indexterm role="concept">
14679 <primary>file</primary>
14680 <secondary>extracting characteristics</secondary>
14682 <indexterm role="concept">
14683 <primary><option>stat</option> expansion item</primary>
14685 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14686 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14687 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14688 series of <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>> pairs, where the values are all numerical,
14689 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14690 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14691 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14692 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14693 can extract individual fields using the <option>extract</option> expansion item.
14696 The use of the <option>stat</option> expansion in users’ filter files can be locked out by
14697 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14698 systems for files larger than 2GB.
14700 </listitem></varlistentry>
14702 <term><emphasis role="bold">${str2b64:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14705 <indexterm role="concept">
14706 <primary>expansion</primary>
14707 <secondary>base64 encoding</secondary>
14709 <indexterm role="concept">
14710 <primary>base64 encoding</primary>
14711 <secondary>in string expansion</secondary>
14713 <indexterm role="concept">
14714 <primary><option>str2b64</option> expansion item</primary>
14716 This operator converts a string into one that is base64 encoded.
14718 </listitem></varlistentry>
14720 <term><emphasis role="bold">${strlen:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14723 <indexterm role="concept">
14724 <primary>expansion</primary>
14725 <secondary>string length</secondary>
14727 <indexterm role="concept">
14728 <primary>string</primary>
14729 <secondary>length in expansion</secondary>
14731 <indexterm role="concept">
14732 <primary><option>strlen</option> expansion item</primary>
14734 The item is replace by the length of the expanded string, expressed as a
14735 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14737 </listitem></varlistentry>
14739 <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>
14742 <indexterm role="concept">
14743 <primary><option>substr</option> expansion item</primary>
14745 <indexterm role="concept">
14746 <primary>substring extraction</primary>
14748 <indexterm role="concept">
14749 <primary>expansion</primary>
14750 <secondary>substring expansion</secondary>
14752 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14753 can be used when the two parameters are fixed numbers (as opposed to strings
14754 that change when expanded). The effect is the same as
14756 <literallayout class="monospaced">
14757 ${substr{<start>}{<length>}{<string>}}
14760 See the description of the general <option>substr</option> item above for details. The
14761 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14763 </listitem></varlistentry>
14765 <term><emphasis role="bold">${time_eval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14768 <indexterm role="concept">
14769 <primary><option>time_eval</option> expansion item</primary>
14771 <indexterm role="concept">
14772 <primary>time interval</primary>
14773 <secondary>decoding</secondary>
14775 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14778 </listitem></varlistentry>
14780 <term><emphasis role="bold">${time_interval:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14783 <indexterm role="concept">
14784 <primary><option>time_interval</option> expansion item</primary>
14786 <indexterm role="concept">
14787 <primary>time interval</primary>
14788 <secondary>formatting</secondary>
14790 The argument (after sub-expansion) must be a sequence of decimal digits that
14791 represents an interval of time as a number of seconds. It is converted into a
14792 number of larger units and output in Exim’s normal time format, for example,
14793 <literal>1w3d4h2m6s</literal>.
14795 </listitem></varlistentry>
14797 <term><emphasis role="bold">${uc:</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14800 <indexterm role="concept">
14801 <primary>case forcing in strings</primary>
14803 <indexterm role="concept">
14804 <primary>string</primary>
14805 <secondary>case forcing</secondary>
14807 <indexterm role="concept">
14808 <primary>upper casing</primary>
14810 <indexterm role="concept">
14811 <primary>expansion</primary>
14812 <secondary>case forcing</secondary>
14814 <indexterm role="concept">
14815 <primary><option>uc</option> expansion item</primary>
14817 This forces the letters in the string into upper-case.
14819 </listitem></varlistentry>
14822 <section id="SECTexpcond">
14823 <title>Expansion conditions</title>
14825 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14826 <primary>expansion</primary>
14827 <secondary>conditions</secondary>
14829 The following conditions are available for testing by the <option>${if</option> construct
14830 while expanding strings:
14834 <term><emphasis role="bold">!</emphasis><<emphasis>condition</emphasis>></term>
14837 <indexterm role="concept">
14838 <primary>expansion</primary>
14839 <secondary>negating a condition</secondary>
14841 <indexterm role="concept">
14842 <primary>negation</primary>
14843 <secondary>in expansion condition</secondary>
14845 Preceding any condition with an exclamation mark negates the result of the
14848 </listitem></varlistentry>
14850 <term><<emphasis>symbolic operator</emphasis>> <emphasis role="bold">{</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14853 <indexterm role="concept">
14854 <primary>numeric comparison</primary>
14856 <indexterm role="concept">
14857 <primary>expansion</primary>
14858 <secondary>numeric comparison</secondary>
14860 There are a number of symbolic operators for doing numeric comparisons. They
14864 <literal>= </literal> equal
14865 <literal>== </literal> equal
14866 <literal>> </literal> greater
14867 <literal>>= </literal> greater or equal
14868 <literal>< </literal> less
14869 <literal><= </literal> less or equal
14874 <literallayout class="monospaced">
14875 ${if >{$message_size}{10M} ...
14878 Note that the general negation operator provides for inequality testing. The
14879 two strings must take the form of optionally signed decimal integers,
14880 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14881 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14882 As a special case, the numerical value of an empty string is taken as
14885 </listitem></varlistentry>
14886 <varlistentry revisionflag="changed">
14887 <term><emphasis role="bold">bool {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14889 <para revisionflag="changed">
14890 <indexterm role="concept">
14891 <primary>expansion</primary>
14892 <secondary>boolean parsing</secondary>
14894 <indexterm role="concept">
14895 <primary><option>bool</option> expansion condition</primary>
14897 This condition turns a string holding a true or false representation into
14898 a boolean state. It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
14899 (case-insensitively); also positive integer numbers map to true if non-zero,
14900 false if zero. Leading and trailing whitespace is ignored.
14901 All other string values will result in expansion failure.
14903 <para revisionflag="changed">
14904 When combined with ACL variables, this expansion condition will let you
14905 make decisions in one place and act on those decisions in another place.
14908 <literallayout class="monospaced" revisionflag="changed">
14909 ${if bool{$acl_m_privileged_sender} ...
14911 </listitem></varlistentry>
14912 <varlistentry revisionflag="changed">
14913 <term><emphasis role="bold">bool_lax {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
14915 <para revisionflag="changed">
14916 <indexterm role="concept">
14917 <primary>expansion</primary>
14918 <secondary>boolean parsing</secondary>
14920 <indexterm role="concept">
14921 <primary><option>bool_lax</option> expansion condition</primary>
14923 Like <option>bool</option>, this condition turns a string into a boolean state. But
14924 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
14925 loose definition that the Router <option>condition</option> option uses. The empty string
14926 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
14927 true. Leading and trailing whitespace is ignored.
14929 <para revisionflag="changed">
14930 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
14932 </listitem></varlistentry>
14934 <term><emphasis role="bold">crypteq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
14937 <indexterm role="concept">
14938 <primary>expansion</primary>
14939 <secondary>encrypted comparison</secondary>
14941 <indexterm role="concept">
14942 <primary>encrypted strings, comparing</primary>
14944 <indexterm role="concept">
14945 <primary><option>crypteq</option> expansion condition</primary>
14947 This condition is included in the Exim binary if it is built to support any
14948 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14949 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14950 included in the binary.
14953 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14954 compared against the second, which is already encrypted. The second string may
14955 be in the LDAP form for storing encrypted strings, which starts with the
14956 encryption type in curly brackets, followed by the data. If the second string
14957 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14958 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14959 Typically this will be a field from a password file. An example of an encrypted
14960 string in LDAP form is:
14962 <literallayout class="monospaced">
14963 {md5}CY9rzUYh03PK3k6DJie09g==
14966 If such a string appears directly in an expansion, the curly brackets have to
14967 be quoted, because they are part of the expansion syntax. For example:
14969 <literallayout class="monospaced">
14970 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14973 The following encryption types (whose names are matched case-independently) are
14979 <indexterm role="concept">
14980 <primary>MD5 hash</primary>
14982 <indexterm role="concept">
14983 <primary>base64 encoding</primary>
14984 <secondary>in encrypted password</secondary>
14986 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14987 printable characters to compare with the remainder of the second string. If the
14988 length of the comparison string is 24, Exim assumes that it is base64 encoded
14989 (as in the above example). If the length is 32, Exim assumes that it is a
14990 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14996 <indexterm role="concept">
14997 <primary>SHA-1 hash</primary>
14999 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
15000 printable characters to compare with the remainder of the second string. If the
15001 length of the comparison string is 28, Exim assumes that it is base64 encoded.
15002 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
15003 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
15008 <indexterm role="concept">
15009 <primary><function>crypt()</function></primary>
15011 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
15012 only the first eight characters of the password. However, in modern operating
15013 systems this is no longer true, and in many cases the entire password is used,
15014 whatever its length.
15019 <indexterm role="concept">
15020 <primary><function>crypt16()</function></primary>
15022 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
15023 use up to 16 characters of the password in some operating systems. Again, in
15024 modern operating systems, more characters may be used.
15029 Exim has its own version of <function>crypt16()</function>, which is just a double call to
15030 <function>crypt()</function>. For operating systems that have their own version, setting
15031 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
15032 operating system version instead of its own. This option is set by default in
15033 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
15034 support <function>crypt16()</function>.
15037 Some years after Exim’s <function>crypt16()</function> was implemented, a user discovered that
15038 it was not using the same algorithm as some operating systems’ versions. It
15039 turns out that as well as <function>crypt16()</function> there is a function called
15040 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
15041 algorithm, and both of them may be different to Exim’s built-in <function>crypt16()</function>.
15044 However, since there is now a move away from the traditional <function>crypt()</function>
15045 functions towards using SHA1 and other algorithms, tidying up this area of
15046 Exim is seen as very low priority.
15049 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
15050 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
15051 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
15052 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
15053 function by specifying it explicitly in curly brackets.
15055 </listitem></varlistentry>
15057 <term><emphasis role="bold">def:</emphasis><<emphasis>variable name</emphasis>></term>
15060 <indexterm role="concept">
15061 <primary>expansion</primary>
15062 <secondary>checking for empty variable</secondary>
15064 <indexterm role="concept">
15065 <primary><option>def</option> expansion condition</primary>
15067 The <option>def</option> condition must be followed by the name of one of the expansion
15068 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
15069 variable does not contain the empty string. For example:
15071 <literallayout class="monospaced">
15072 ${if def:sender_ident {from $sender_ident}}
15075 Note that the variable name is given without a leading <option>$</option> character. If the
15076 variable does not exist, the expansion fails.
15078 </listitem></varlistentry>
15080 <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>
15083 <indexterm role="concept">
15084 <primary>expansion</primary>
15085 <secondary>checking header line existence</secondary>
15087 This condition is true if a message is being processed and the named header
15088 exists in the message. For example,
15090 <literallayout class="monospaced">
15091 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
15094 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
15095 the header name must be terminated by a colon if white space does not follow.
15097 </listitem></varlistentry>
15099 <term><emphasis role="bold">eq {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15100 <term><emphasis role="bold">eqi {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15103 <indexterm role="concept">
15104 <primary>string</primary>
15105 <secondary>comparison</secondary>
15107 <indexterm role="concept">
15108 <primary>expansion</primary>
15109 <secondary>string comparison</secondary>
15111 <indexterm role="concept">
15112 <primary><option>eq</option> expansion condition</primary>
15114 <indexterm role="concept">
15115 <primary><option>eqi</option> expansion condition</primary>
15117 The two substrings are first expanded. The condition is true if the two
15118 resulting strings are identical. For <option>eq</option> the comparison includes the case of
15119 letters, whereas for <option>eqi</option> the comparison is case-independent.
15121 </listitem></varlistentry>
15123 <term><emphasis role="bold">exists {</emphasis><<emphasis>file name</emphasis>><emphasis role="bold">}</emphasis></term>
15126 <indexterm role="concept">
15127 <primary>expansion</primary>
15128 <secondary>file existence test</secondary>
15130 <indexterm role="concept">
15131 <primary>file</primary>
15132 <secondary>existence test</secondary>
15134 <indexterm role="concept">
15135 <primary><option>exists</option>, expansion condition</primary>
15137 The substring is first expanded and then interpreted as an absolute path. The
15138 condition is true if the named file (or directory) exists. The existence test
15139 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
15140 users’ filter files may be locked out by the system administrator.
15142 </listitem></varlistentry>
15144 <term><emphasis role="bold">first_delivery</emphasis></term>
15147 <indexterm role="concept">
15148 <primary>delivery</primary>
15149 <secondary>first</secondary>
15151 <indexterm role="concept">
15152 <primary>first delivery</primary>
15154 <indexterm role="concept">
15155 <primary>expansion</primary>
15156 <secondary>first delivery test</secondary>
15158 <indexterm role="concept">
15159 <primary><option>first_delivery</option> expansion condition</primary>
15161 This condition, which has no data, is true during a message’s first delivery
15162 attempt. It is false during any subsequent delivery attempts.
15164 </listitem></varlistentry>
15166 <term><emphasis role="bold">forall{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
15167 <term><emphasis role="bold">forany{</emphasis><<emphasis>a list</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>a condition</emphasis>><emphasis role="bold">}</emphasis></term>
15170 <indexterm role="concept">
15171 <primary>list</primary>
15172 <secondary>iterative conditions</secondary>
15174 <indexterm role="concept">
15175 <primary>expansion</primary>
15176 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
15178 <indexterm role="concept">
15179 <primary>expansion</primary>
15180 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
15182 <indexterm role="variable">
15183 <primary><varname>$item</varname></primary>
15185 These conditions iterate over a list. The first argument is expanded to form
15186 the list. By default, the list separator is a colon, but it can be changed by
15187 the normal method. The second argument is interpreted as a condition that is to
15188 be applied to each item in the list in turn. During the interpretation of the
15189 condition, the current list item is placed in a variable called <varname>$item</varname>.
15194 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
15195 the result of the whole condition is true. If the condition is false for all
15196 items in the list, the overall condition is false.
15201 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
15202 and the result of the whole condition is false. If the condition is true for
15203 all items in the list, the overall condition is true.
15208 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
15209 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
15210 that the condition must be false for at least one item. In this example, the
15211 list separator is changed to a comma:
15213 <literallayout class="monospaced">
15214 ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}}
15217 The value of <varname>$item</varname> is saved and restored while <emphasis role="bold">forany</emphasis> or <emphasis role="bold">forall</emphasis> is
15218 being processed, to enable these expansion items to be nested.
15220 </listitem></varlistentry>
15222 <term><emphasis role="bold">ge {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15223 <term><emphasis role="bold">gei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15226 <indexterm role="concept">
15227 <primary>string</primary>
15228 <secondary>comparison</secondary>
15230 <indexterm role="concept">
15231 <primary>expansion</primary>
15232 <secondary>string comparison</secondary>
15234 <indexterm role="concept">
15235 <primary><option>ge</option> expansion condition</primary>
15237 <indexterm role="concept">
15238 <primary><option>gei</option> expansion condition</primary>
15240 The two substrings are first expanded. The condition is true if the first
15241 string is lexically greater than or equal to the second string. For <option>ge</option> the
15242 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
15245 </listitem></varlistentry>
15247 <term><emphasis role="bold">gt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15248 <term><emphasis role="bold">gti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15251 <indexterm role="concept">
15252 <primary>string</primary>
15253 <secondary>comparison</secondary>
15255 <indexterm role="concept">
15256 <primary>expansion</primary>
15257 <secondary>string comparison</secondary>
15259 <indexterm role="concept">
15260 <primary><option>gt</option> expansion condition</primary>
15262 <indexterm role="concept">
15263 <primary><option>gti</option> expansion condition</primary>
15265 The two substrings are first expanded. The condition is true if the first
15266 string is lexically greater than the second string. For <option>gt</option> the comparison
15267 includes the case of letters, whereas for <option>gti</option> the comparison is
15270 </listitem></varlistentry>
15272 <term><emphasis role="bold">isip {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15273 <term><emphasis role="bold">isip4 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15274 <term><emphasis role="bold">isip6 {</emphasis><<emphasis>string</emphasis>><emphasis role="bold">}</emphasis></term>
15277 <indexterm role="concept">
15278 <primary>IP address</primary>
15279 <secondary>testing string format</secondary>
15281 <indexterm role="concept">
15282 <primary>string</primary>
15283 <secondary>testing for IP address</secondary>
15285 <indexterm role="concept">
15286 <primary><option>isip</option> expansion condition</primary>
15288 <indexterm role="concept">
15289 <primary><option>isip4</option> expansion condition</primary>
15291 <indexterm role="concept">
15292 <primary><option>isip6</option> expansion condition</primary>
15294 The substring is first expanded, and then tested to see if it has the form of
15295 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
15296 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
15299 For an IPv4 address, the test is for four dot-separated components, each of
15300 which consists of from one to three digits. For an IPv6 address, up to eight
15301 colon-separated components are permitted, each containing from one to four
15302 hexadecimal digits. There may be fewer than eight components if an empty
15303 component (adjacent colons) is present. Only one empty component is permitted.
15306 <emphasis role="bold">Note</emphasis>: The checks are just on the form of the address; actual numerical
15307 values are not considered. Thus, for example, 999.999.999.999 passes the IPv4
15308 check. The main use of these tests is to distinguish between IP addresses and
15309 host names, or between IPv4 and IPv6 addresses. For example, you could use
15311 <literallayout class="monospaced">
15312 ${if isip4{$sender_host_address}...
15315 to test which IP version an incoming SMTP connection is using.
15317 </listitem></varlistentry>
15319 <term><emphasis role="bold">ldapauth {</emphasis><<emphasis>ldap query</emphasis>><emphasis role="bold">}</emphasis></term>
15322 <indexterm role="concept">
15323 <primary>LDAP</primary>
15324 <secondary>use for authentication</secondary>
15326 <indexterm role="concept">
15327 <primary>expansion</primary>
15328 <secondary>LDAP authentication test</secondary>
15330 <indexterm role="concept">
15331 <primary><option>ldapauth</option> expansion condition</primary>
15333 This condition supports user authentication using LDAP. See section
15334 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
15335 queries. For this use, the query must contain a user name and password. The
15336 query itself is not used, and can be empty. The condition is true if the
15337 password is not empty, and the user name and password are accepted by the LDAP
15338 server. An empty password is rejected without calling LDAP because LDAP binds
15339 with an empty password are considered anonymous regardless of the username, and
15340 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
15341 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
15344 </listitem></varlistentry>
15346 <term><emphasis role="bold">le {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15347 <term><emphasis role="bold">lei {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15350 <indexterm role="concept">
15351 <primary>string</primary>
15352 <secondary>comparison</secondary>
15354 <indexterm role="concept">
15355 <primary>expansion</primary>
15356 <secondary>string comparison</secondary>
15358 <indexterm role="concept">
15359 <primary><option>le</option> expansion condition</primary>
15361 <indexterm role="concept">
15362 <primary><option>lei</option> expansion condition</primary>
15364 The two substrings are first expanded. The condition is true if the first
15365 string is lexically less than or equal to the second string. For <option>le</option> the
15366 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
15369 </listitem></varlistentry>
15371 <term><emphasis role="bold">lt {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15372 <term><emphasis role="bold">lti {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15375 <indexterm role="concept">
15376 <primary>string</primary>
15377 <secondary>comparison</secondary>
15379 <indexterm role="concept">
15380 <primary>expansion</primary>
15381 <secondary>string comparison</secondary>
15383 <indexterm role="concept">
15384 <primary><option>lt</option> expansion condition</primary>
15386 <indexterm role="concept">
15387 <primary><option>lti</option> expansion condition</primary>
15389 The two substrings are first expanded. The condition is true if the first
15390 string is lexically less than the second string. For <option>lt</option> the comparison
15391 includes the case of letters, whereas for <option>lti</option> the comparison is
15394 </listitem></varlistentry>
15396 <term><emphasis role="bold">match {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15399 <indexterm role="concept">
15400 <primary>expansion</primary>
15401 <secondary>regular expression comparison</secondary>
15403 <indexterm role="concept">
15404 <primary>regular expressions</primary>
15405 <secondary>match in expanded string</secondary>
15407 <indexterm role="concept">
15408 <primary><option>match</option> expansion condition</primary>
15410 The two substrings are first expanded. The second is then treated as a regular
15411 expression and applied to the first. Because of the pre-expansion, if the
15412 regular expression contains dollar, or backslash characters, they must be
15413 escaped. Care must also be taken if the regular expression contains braces
15414 (curly brackets). A closing brace must be escaped so that it is not taken as a
15415 premature termination of <<emphasis>string2</emphasis>>. The easiest approach is to use the
15416 <literal>\N</literal> feature to disable expansion of the regular expression.
15419 <literallayout class="monospaced">
15420 ${if match {$local_part}{\N^\d{3}\N} ...
15423 If the whole expansion string is in double quotes, further escaping of
15424 backslashes is also required.
15427 The condition is true if the regular expression match succeeds.
15428 The regular expression is not required to begin with a circumflex
15429 metacharacter, but if there is no circumflex, the expression is not anchored,
15430 and it may match anywhere in the subject, not just at the start. If you want
15431 the pattern to match at the end of the subject, you must include the <literal>$</literal>
15432 metacharacter at an appropriate point.
15435 <indexterm role="concept">
15436 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15437 <secondary>in <option>if</option> expansion</secondary>
15439 At the start of an <option>if</option> expansion the values of the numeric variable
15440 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
15441 succeeds causes them to be reset to the substrings of that condition and they
15442 will have these values during the expansion of the success string. At the end
15443 of the <option>if</option> expansion, the previous values are restored. After testing a
15444 combination of conditions using <option>or</option>, the subsequent values of the numeric
15445 variables are those of the condition that succeeded.
15447 </listitem></varlistentry>
15449 <term><emphasis role="bold">match_address {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15452 <indexterm role="concept">
15453 <primary><option>match_address</option> expansion condition</primary>
15455 See <emphasis role="bold">match_local_part</emphasis>.
15457 </listitem></varlistentry>
15459 <term><emphasis role="bold">match_domain {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15462 <indexterm role="concept">
15463 <primary><option>match_domain</option> expansion condition</primary>
15465 See <emphasis role="bold">match_local_part</emphasis>.
15467 </listitem></varlistentry>
15469 <term><emphasis role="bold">match_ip {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15472 <indexterm role="concept">
15473 <primary><option>match_ip</option> expansion condition</primary>
15475 This condition matches an IP address to a list of IP address patterns. It must
15476 be followed by two argument strings. The first (after expansion) must be an IP
15477 address or an empty string. The second (after expansion) is a restricted host
15478 list that can match only an IP address, not a host name. For example:
15480 <literallayout class="monospaced">
15481 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
15484 The specific types of host list item that are permitted in the list are:
15489 An IP address, optionally with a CIDR mask.
15494 A single asterisk, which matches any IP address.
15499 An empty item, which matches only if the IP address is empty. This could be
15500 useful for testing for a locally submitted message or one from specific hosts
15501 in a single test such as
15503 <literallayout class="monospaced">
15504 ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
15507 where the first item in the list is the empty string.
15512 The item @[] matches any of the local host’s interface addresses.
15517 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
15518 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
15519 address into a host name. The most common type of linear search for
15520 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
15521 masks. For example:
15523 <literallayout class="monospaced">
15524 ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
15527 It is of course possible to use other kinds of lookup, and in such a case, you
15528 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
15529 address mask, for example:
15531 <literallayout class="monospaced">
15532 ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
15535 However, unless you are combining a <option>match_ip</option> condition with others, it is
15536 just as easy to use the fact that a lookup is itself a condition, and write:
15538 <literallayout class="monospaced">
15539 ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
15544 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
15546 </listitem></varlistentry>
15548 <term><emphasis role="bold">match_local_part {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15551 <indexterm role="concept">
15552 <primary>domain list</primary>
15553 <secondary>in expansion condition</secondary>
15555 <indexterm role="concept">
15556 <primary>address list</primary>
15557 <secondary>in expansion condition</secondary>
15559 <indexterm role="concept">
15560 <primary>local part</primary>
15561 <secondary>list, in expansion condition</secondary>
15563 <indexterm role="concept">
15564 <primary><option>match_local_part</option> expansion condition</primary>
15566 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15567 possible to test domain, address, and local part lists within expansions. Each
15568 condition requires two arguments: an item and a list to match. A trivial
15571 <literallayout class="monospaced">
15572 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15575 In each case, the second argument may contain any of the allowable items for a
15576 list of the appropriate type. Also, because the second argument (after
15577 expansion) is a standard form of list, it is possible to refer to a named list.
15578 Thus, you can use conditions like this:
15580 <literallayout class="monospaced">
15581 ${if match_domain{$domain}{+local_domains}{...
15584 <indexterm role="concept">
15585 <primary><literal>+caseful</literal></primary>
15587 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15588 item can be used, as in all address lists, to cause subsequent items to
15589 have their local parts matched casefully. Domains are always matched
15593 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15594 hosts have two identities: a name and an IP address, and it is not clear
15595 how to specify cleanly how such a test would work. However, IP addresses can be
15596 matched using <option>match_ip</option>.
15598 </listitem></varlistentry>
15600 <term><emphasis role="bold">pam {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">:...}</emphasis></term>
15603 <indexterm role="concept">
15604 <primary>PAM authentication</primary>
15606 <indexterm role="concept">
15607 <primary>AUTH</primary>
15608 <secondary>with PAM</secondary>
15610 <indexterm role="concept">
15611 <primary>Solaris</primary>
15612 <secondary>PAM support</secondary>
15614 <indexterm role="concept">
15615 <primary>expansion</primary>
15616 <secondary>PAM authentication test</secondary>
15618 <indexterm role="concept">
15619 <primary><option>pam</option> expansion condition</primary>
15621 <emphasis>Pluggable Authentication Modules</emphasis>
15622 (<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
15623 available in the latest releases of Solaris and in some GNU/Linux
15624 distributions. The Exim support, which is intended for use in conjunction with
15625 the SMTP AUTH command, is available only if Exim is compiled with
15627 <literallayout class="monospaced">
15631 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15632 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15635 The argument string is first expanded, and the result must be a
15636 colon-separated list of strings. Leading and trailing white space is ignored.
15637 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15638 taken from the first item in the colon-separated data string (<<emphasis>string1</emphasis>>).
15639 The remaining items in the data string are passed over in response to requests
15640 from the authentication function. In the simple case there will only be one
15641 request, for a password, so the data consists of just two strings.
15644 There can be problems if any of the strings are permitted to contain colon
15645 characters. In the usual way, these have to be doubled to avoid being taken as
15646 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15647 item can be used to double any existing colons. For example, the configuration
15648 of a LOGIN authenticator might contain this setting:
15650 <literallayout class="monospaced">
15651 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15654 For a PLAIN authenticator you could use:
15656 <literallayout class="monospaced">
15657 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15660 In some operating systems, PAM authentication can be done only from a process
15661 running as root. Since Exim is running as the Exim user when receiving
15662 messages, this means that PAM cannot be used directly in those systems.
15663 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15664 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>.
15665 The patched module allows one special uid/gid combination, in addition to root,
15666 to authenticate. If you build the patched module to allow the Exim user and
15667 group, PAM can then be used from an Exim authenticator.
15669 </listitem></varlistentry>
15671 <term><emphasis role="bold">pwcheck {</emphasis><<emphasis>string1</emphasis>><emphasis role="bold">:</emphasis><<emphasis>string2</emphasis>><emphasis role="bold">}</emphasis></term>
15674 <indexterm role="concept">
15675 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15677 <indexterm role="concept">
15678 <primary>Cyrus</primary>
15680 <indexterm role="concept">
15681 <primary>expansion</primary>
15682 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15684 <indexterm role="concept">
15685 <primary><option>pwcheck</option> expansion condition</primary>
15687 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15688 This is one way of making it possible for passwords to be checked by a process
15689 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15690 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15693 The pwcheck support is not included in Exim by default. You need to specify
15694 the location of the pwcheck daemon’s socket in <filename>Local/Makefile</filename> before
15695 building Exim. For example:
15697 <literallayout class="monospaced">
15698 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15701 You do not need to install the full Cyrus software suite in order to use
15702 the pwcheck daemon. You can compile and install just the daemon alone
15703 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15704 access to the <filename>/var/pwcheck</filename> directory.
15707 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15708 password, separated by a colon. For example, in a LOGIN authenticator
15709 configuration, you might have this:
15711 <literallayout class="monospaced">
15712 server_condition = ${if pwcheck{$auth1:$auth2}}
15715 Again, for a PLAIN authenticator configuration, this would be:
15717 <literallayout class="monospaced">
15718 server_condition = ${if pwcheck{$auth2:$auth3}}
15720 </listitem></varlistentry>
15722 <term><emphasis role="bold">queue_running</emphasis></term>
15725 <indexterm role="concept">
15726 <primary>queue runner</primary>
15727 <secondary>detecting when delivering from</secondary>
15729 <indexterm role="concept">
15730 <primary>expansion</primary>
15731 <secondary>queue runner test</secondary>
15733 <indexterm role="concept">
15734 <primary><option>queue_running</option> expansion condition</primary>
15736 This condition, which has no data, is true during delivery attempts that are
15737 initiated by queue runner processes, and false otherwise.
15739 </listitem></varlistentry>
15741 <term><emphasis role="bold">radius {</emphasis><<emphasis>authentication string</emphasis>><emphasis role="bold">}</emphasis></term>
15744 <indexterm role="concept">
15745 <primary>Radius</primary>
15747 <indexterm role="concept">
15748 <primary>expansion</primary>
15749 <secondary>Radius authentication</secondary>
15751 <indexterm role="concept">
15752 <primary><option>radius</option> expansion condition</primary>
15754 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15755 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15756 the Radius client configuration file in order to build Exim with Radius
15760 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15761 library, using the original API. If you are using release 0.4.0 or later of
15762 this library, you need to set
15764 <literallayout class="monospaced">
15765 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15768 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15769 <option>libradius</option> library that comes with FreeBSD. To do this, set
15771 <literallayout class="monospaced">
15772 RADIUS_LIB_TYPE=RADLIB
15775 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15776 You may also have to supply a suitable setting in EXTRALIBS so that the
15777 Radius library can be found when Exim is linked.
15780 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15781 Radius client library, which calls the Radius server. The condition is true if
15782 the authentication is successful. For example:
15784 <literallayout class="monospaced">
15785 server_condition = ${if radius{<arguments>}}
15787 </listitem></varlistentry>
15789 <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>
15792 <indexterm role="concept">
15793 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15795 <indexterm role="concept">
15796 <primary>Cyrus</primary>
15798 <indexterm role="concept">
15799 <primary>expansion</primary>
15800 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15802 <indexterm role="concept">
15803 <primary><option>saslauthd</option> expansion condition</primary>
15805 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15806 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15807 Using this daemon is one way of making it possible for passwords to be checked
15808 by a process that is not running as root.
15811 The saslauthd support is not included in Exim by default. You need to specify
15812 the location of the saslauthd daemon’s socket in <filename>Local/Makefile</filename> before
15813 building Exim. For example:
15815 <literallayout class="monospaced">
15816 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15819 You do not need to install the full Cyrus software suite in order to use
15820 the saslauthd daemon. You can compile and install just the daemon alone
15821 from the Cyrus SASL library.
15824 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15825 two are mandatory. For example:
15827 <literallayout class="monospaced">
15828 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15831 The service and the realm are optional (which is why the arguments are enclosed
15832 in their own set of braces). For details of the meaning of the service and
15833 realm, and how to run the daemon, consult the Cyrus documentation.
15835 </listitem></varlistentry>
15838 <section id="SECID84">
15839 <title>Combining expansion conditions</title>
15841 <indexterm role="concept">
15842 <primary>expansion</primary>
15843 <secondary>combining conditions</secondary>
15845 Several conditions can be tested at once by combining them using the <option>and</option>
15846 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15847 conditions on their own, and precede their lists of sub-conditions. Each
15848 sub-condition must be enclosed in braces within the overall braces that contain
15849 the list. No repetition of <option>if</option> is used.
15853 <term><emphasis role="bold">or {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15856 <indexterm role="concept">
15857 <primary><quote>or</quote> expansion condition</primary>
15859 <indexterm role="concept">
15860 <primary>expansion</primary>
15861 <secondary><quote>or</quote> of conditions</secondary>
15863 The sub-conditions are evaluated from left to right. The condition is true if
15864 any one of the sub-conditions is true.
15867 <literallayout class="monospaced">
15868 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15871 When a true sub-condition is found, the following ones are parsed but not
15872 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15873 numeric variables afterwards are taken from the first one that succeeds.
15875 </listitem></varlistentry>
15877 <term><emphasis role="bold">and {{</emphasis><<emphasis>cond1</emphasis>><emphasis role="bold">}{</emphasis><<emphasis>cond2</emphasis>><emphasis role="bold">}...}</emphasis></term>
15880 <indexterm role="concept">
15881 <primary><quote>and</quote> expansion condition</primary>
15883 <indexterm role="concept">
15884 <primary>expansion</primary>
15885 <secondary><quote>and</quote> of conditions</secondary>
15887 The sub-conditions are evaluated from left to right. The condition is true if
15888 all of the sub-conditions are true. If there are several <quote>match</quote>
15889 sub-conditions, the values of the numeric variables afterwards are taken from
15890 the last one. When a false sub-condition is found, the following ones are
15891 parsed but not evaluated.
15893 </listitem></varlistentry>
15896 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15899 <section id="SECTexpvar">
15900 <title>Expansion variables</title>
15902 <indexterm role="concept">
15903 <primary>expansion</primary>
15904 <secondary>variables, list of</secondary>
15906 This section contains an alphabetical list of all the expansion variables. Some
15907 of them are available only when Exim is compiled with specific options such as
15908 support for TLS or the content scanning extension.
15912 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15915 <indexterm role="concept">
15916 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15918 When a <option>match</option> expansion condition succeeds, these variables contain the
15919 captured substrings identified by the regular expression during subsequent
15920 processing of the success string of the containing <option>if</option> expansion item.
15921 However, they do not retain their values afterwards; in fact, their previous
15922 values are restored at the end of processing an <option>if</option> item. The numerical
15923 variables may also be set externally by some other matching process which
15924 precedes the expansion of the string. For example, the commands available in
15925 Exim filter files include an <option>if</option> command with its own regular expression
15926 matching condition.
15928 </listitem></varlistentry>
15930 <term><varname>$acl_c...</varname></term>
15933 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15934 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
15935 long, but the sixth character must be either a digit or an underscore. For
15936 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
15937 variables persist throughout the lifetime of an SMTP connection. They can be
15938 used to pass information between ACLs and between different invocations of the
15939 same ACL. When a message is received, the values of these variables are saved
15940 with the message, and can be accessed by filters, routers, and transports
15941 during subsequent delivery.
15943 </listitem></varlistentry>
15945 <term><varname>$acl_m...</varname></term>
15948 These variables are like the <varname>$acl_c...</varname> variables, except that their values
15949 are reset after a message has been received. Thus, if several messages are
15950 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
15951 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
15952 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
15953 message is received, the values of these variables are saved with the message,
15954 and can be accessed by filters, routers, and transports during subsequent
15957 </listitem></varlistentry>
15959 <term><varname>$acl_verify_message</varname></term>
15962 <indexterm role="variable">
15963 <primary><varname>$acl_verify_message</varname></primary>
15965 After an address verification has failed, this variable contains the failure
15966 message. It retains its value for use in subsequent modifiers. The message can
15967 be preserved by coding like this:
15969 <literallayout class="monospaced">
15970 warn !verify = sender
15971 set acl_m0 = $acl_verify_message
15974 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15975 <option>log_message</option> modifiers, to include information about the verification
15978 </listitem></varlistentry>
15980 <term><varname>$address_data</varname></term>
15983 <indexterm role="variable">
15984 <primary><varname>$address_data</varname></primary>
15986 This variable is set by means of the <option>address_data</option> option in routers. The
15987 value then remains with the address while it is processed by subsequent routers
15988 and eventually a transport. If the transport is handling multiple addresses,
15989 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15990 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15994 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15995 a recipient address, the final value is still in the variable for subsequent
15996 conditions and modifiers of the ACL statement. If routing the address caused it
15997 to be redirected to just one address, the child address is also routed as part
15998 of the verification, and in this case the final value of <varname>$address_data</varname> is
15999 from the child’s routing.
16002 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16003 sender address, the final value is also preserved, but this time in
16004 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
16008 In both cases (recipient and sender verification), the value does not persist
16009 after the end of the current ACL statement. If you want to preserve
16010 these values for longer, you can save them in ACL variables.
16012 </listitem></varlistentry>
16014 <term><varname>$address_file</varname></term>
16017 <indexterm role="variable">
16018 <primary><varname>$address_file</varname></primary>
16020 When, as a result of aliasing, forwarding, or filtering, a message is directed
16021 to a specific file, this variable holds the name of the file when the transport
16022 is running. At other times, the variable is empty. For example, using the
16023 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
16025 <literallayout class="monospaced">
16026 /home/r2d2/savemail
16029 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
16030 contains the text string <literal>/home/r2d2/savemail</literal>.
16031 <indexterm role="concept">
16032 <primary>Sieve filter</primary>
16033 <secondary>value of <varname>$address_file</varname></secondary>
16035 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
16036 then up to the transport configuration to generate an appropriate absolute path
16037 to the relevant file.
16039 </listitem></varlistentry>
16041 <term><varname>$address_pipe</varname></term>
16044 <indexterm role="variable">
16045 <primary><varname>$address_pipe</varname></primary>
16047 When, as a result of aliasing or forwarding, a message is directed to a pipe,
16048 this variable holds the pipe command when the transport is running.
16050 </listitem></varlistentry>
16052 <term><varname>$auth1</varname> – <varname>$auth3</varname></term>
16055 <indexterm role="variable">
16056 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
16058 These variables are used in SMTP authenticators (see chapters
16059 <xref linkend="CHAPplaintext"/>–<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
16061 </listitem></varlistentry>
16063 <term><varname>$authenticated_id</varname></term>
16066 <indexterm role="concept">
16067 <primary>authentication</primary>
16068 <secondary>id</secondary>
16070 <indexterm role="variable">
16071 <primary><varname>$authenticated_id</varname></primary>
16073 When a server successfully authenticates a client it may be configured to
16074 preserve some of the authentication information in the variable
16075 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
16076 user/password authenticator configuration might preserve the user name for use
16077 in the routers. Note that this is not the same information that is saved in
16078 <varname>$sender_host_authenticated</varname>.
16079 When a message is submitted locally (that is, not over a TCP connection)
16080 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
16081 process. However, a trusted user can override this by means of the <option>-oMai</option>
16082 command line option.
16084 </listitem></varlistentry>
16086 <term><varname>$authenticated_sender</varname></term>
16089 <indexterm role="concept">
16090 <primary>sender</primary>
16091 <secondary>authenticated</secondary>
16093 <indexterm role="concept">
16094 <primary>authentication</primary>
16095 <secondary>sender</secondary>
16097 <indexterm role="concept">
16098 <primary>AUTH</primary>
16099 <secondary>on MAIL command</secondary>
16101 <indexterm role="variable">
16102 <primary><varname>$authenticated_sender</varname></primary>
16104 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
16105 SMTP MAIL command if it believes the sender is sufficiently trusted, as
16106 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
16107 <quote><></quote>, it is set as the authenticated sender of the message, and the value is
16108 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
16109 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
16112 <indexterm role="variable">
16113 <primary><varname>$qualify_domain</varname></primary>
16115 When a message is submitted locally (that is, not over a TCP connection), the
16116 value of <varname>$authenticated_sender</varname> is an address constructed from the login
16117 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
16118 can override this by means of the <option>-oMas</option> command line option.
16120 </listitem></varlistentry>
16122 <term><varname>$authentication_failed</varname></term>
16125 <indexterm role="concept">
16126 <primary>authentication</primary>
16127 <secondary>failure</secondary>
16129 <indexterm role="variable">
16130 <primary><varname>$authentication_failed</varname></primary>
16132 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
16133 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
16134 possible to distinguish between <quote>did not try to authenticate</quote>
16135 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
16136 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
16137 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
16138 negative response to an AUTH command, including (for example) an attempt to use
16139 an undefined mechanism.
16141 </listitem></varlistentry>
16143 <term><varname>$body_linecount</varname></term>
16146 <indexterm role="concept">
16147 <primary>message body</primary>
16148 <secondary>line count</secondary>
16150 <indexterm role="concept">
16151 <primary>body of message</primary>
16152 <secondary>line count</secondary>
16154 <indexterm role="variable">
16155 <primary><varname>$body_linecount</varname></primary>
16157 When a message is being received or delivered, this variable contains the
16158 number of lines in the message’s body. See also <varname>$message_linecount</varname>.
16160 </listitem></varlistentry>
16162 <term><varname>$body_zerocount</varname></term>
16165 <indexterm role="concept">
16166 <primary>message body</primary>
16167 <secondary>binary zero count</secondary>
16169 <indexterm role="concept">
16170 <primary>body of message</primary>
16171 <secondary>binary zero count</secondary>
16173 <indexterm role="concept">
16174 <primary>binary zero</primary>
16175 <secondary>in message body</secondary>
16177 <indexterm role="variable">
16178 <primary><varname>$body_zerocount</varname></primary>
16180 When a message is being received or delivered, this variable contains the
16181 number of binary zero bytes in the message’s body.
16183 </listitem></varlistentry>
16185 <term><varname>$bounce_recipient</varname></term>
16188 <indexterm role="variable">
16189 <primary><varname>$bounce_recipient</varname></primary>
16191 This is set to the recipient address of a bounce message while Exim is creating
16192 it. It is useful if a customized bounce message text file is in use (see
16193 chapter <xref linkend="CHAPemsgcust"/>).
16195 </listitem></varlistentry>
16197 <term><varname>$bounce_return_size_limit</varname></term>
16200 <indexterm role="variable">
16201 <primary><varname>$bounce_return_size_limit</varname></primary>
16203 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
16204 up to a multiple of 1000. It is useful when a customized error message text
16205 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
16207 </listitem></varlistentry>
16209 <term><varname>$caller_gid</varname></term>
16212 <indexterm role="concept">
16213 <primary>gid (group id)</primary>
16214 <secondary>caller</secondary>
16216 <indexterm role="variable">
16217 <primary><varname>$caller_gid</varname></primary>
16219 The real group id under which the process that called Exim was running. This is
16220 not the same as the group id of the originator of a message (see
16221 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
16222 incarnation normally contains the Exim gid.
16224 </listitem></varlistentry>
16226 <term><varname>$caller_uid</varname></term>
16229 <indexterm role="concept">
16230 <primary>uid (user id)</primary>
16231 <secondary>caller</secondary>
16233 <indexterm role="variable">
16234 <primary><varname>$caller_uid</varname></primary>
16236 The real user id under which the process that called Exim was running. This is
16237 not the same as the user id of the originator of a message (see
16238 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
16239 incarnation normally contains the Exim uid.
16241 </listitem></varlistentry>
16243 <term><varname>$compile_date</varname></term>
16246 <indexterm role="variable">
16247 <primary><varname>$compile_date</varname></primary>
16249 The date on which the Exim binary was compiled.
16251 </listitem></varlistentry>
16253 <term><varname>$compile_number</varname></term>
16256 <indexterm role="variable">
16257 <primary><varname>$compile_number</varname></primary>
16259 The building process for Exim keeps a count of the number
16260 of times it has been compiled. This serves to distinguish different
16261 compilations of the same version of the program.
16263 </listitem></varlistentry>
16265 <term><varname>$demime_errorlevel</varname></term>
16268 <indexterm role="variable">
16269 <primary><varname>$demime_errorlevel</varname></primary>
16271 This variable is available when Exim is compiled with
16272 the content-scanning extension and the obsolete <option>demime</option> condition. For
16273 details, see section <xref linkend="SECTdemimecond"/>.
16275 </listitem></varlistentry>
16277 <term><varname>$demime_reason</varname></term>
16280 <indexterm role="variable">
16281 <primary><varname>$demime_reason</varname></primary>
16283 This variable is available when Exim is compiled with the
16284 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16285 see section <xref linkend="SECTdemimecond"/>.
16287 </listitem></varlistentry>
16289 <term><varname>$dnslist_domain</varname></term>
16290 <term><varname>$dnslist_matched</varname></term>
16291 <term><varname>$dnslist_text</varname></term>
16292 <term><varname>$dnslist_value</varname></term>
16295 <indexterm role="variable">
16296 <primary><varname>$dnslist_domain</varname></primary>
16298 <indexterm role="variable">
16299 <primary><varname>$dnslist_matched</varname></primary>
16301 <indexterm role="variable">
16302 <primary><varname>$dnslist_text</varname></primary>
16304 <indexterm role="variable">
16305 <primary><varname>$dnslist_value</varname></primary>
16307 <indexterm role="concept">
16308 <primary>black list (DNS)</primary>
16310 When a DNS (black) list lookup succeeds, these variables are set to contain
16311 the following data from the lookup: the list’s domain name, the key that was
16312 looked up, the contents of any associated TXT record, and the value from the
16313 main A record. See section <xref linkend="SECID204"/> for more details.
16315 </listitem></varlistentry>
16317 <term><varname>$domain</varname></term>
16320 <indexterm role="variable">
16321 <primary><varname>$domain</varname></primary>
16323 When an address is being routed, or delivered on its own, this variable
16324 contains the domain. Uppercase letters in the domain are converted into lower
16325 case for <varname>$domain</varname>.
16328 Global address rewriting happens when a message is received, so the value of
16329 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
16330 is set during user filtering, but not during system filtering, because a
16331 message may have many recipients and the system filter is called just once.
16334 When more than one address is being delivered at once (for example, several
16335 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
16336 have the same domain. Transports can be restricted to handling only one domain
16337 at a time if the value of <varname>$domain</varname> is required at transport time – this is
16338 the default for local transports. For further details of the environment in
16339 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
16342 <indexterm role="option">
16343 <primary><option>delay_warning_condition</option></primary>
16345 At the end of a delivery, if all deferred addresses have the same domain, it is
16346 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
16349 The <varname>$domain</varname> variable is also used in some other circumstances:
16354 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
16355 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
16356 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
16357 normally set during the running of the MAIL ACL. However, if the sender address
16358 is verified with a callout during the MAIL ACL, the sender domain is placed in
16359 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
16360 the <command>smtp</command> transport.
16365 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16366 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
16367 it can be used in the expansion of the replacement address, for example, to
16368 rewrite domains by file lookup.
16373 With one important exception, whenever a domain list is being scanned,
16374 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
16375 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
16376 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
16377 that, in a RCPT ACL, the sender domain list can be dependent on the
16378 recipient domain (which is what is in <varname>$domain</varname> at this time).
16383 <indexterm role="concept">
16384 <primary>ETRN</primary>
16385 <secondary>value of <varname>$domain</varname></secondary>
16387 <indexterm role="option">
16388 <primary><option>smtp_etrn_command</option></primary>
16390 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
16391 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
16395 </listitem></varlistentry>
16397 <term><varname>$domain_data</varname></term>
16400 <indexterm role="variable">
16401 <primary><varname>$domain_data</varname></primary>
16403 When the <option>domains</option> option on a router matches a domain by
16404 means of a lookup, the data read by the lookup is available during the running
16405 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
16406 address to a transport, the value is available in that transport. If the
16407 transport is handling multiple addresses, the value from the first address is
16411 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
16412 domain by means of a lookup. The data read by the lookup is available during
16413 the rest of the ACL statement. In all other situations, this variable expands
16416 </listitem></varlistentry>
16418 <term><varname>$exim_gid</varname></term>
16421 <indexterm role="variable">
16422 <primary><varname>$exim_gid</varname></primary>
16424 This variable contains the numerical value of the Exim group id.
16426 </listitem></varlistentry>
16428 <term><varname>$exim_path</varname></term>
16431 <indexterm role="variable">
16432 <primary><varname>$exim_path</varname></primary>
16434 This variable contains the path to the Exim binary.
16436 </listitem></varlistentry>
16438 <term><varname>$exim_uid</varname></term>
16441 <indexterm role="variable">
16442 <primary><varname>$exim_uid</varname></primary>
16444 This variable contains the numerical value of the Exim user id.
16446 </listitem></varlistentry>
16448 <term><varname>$found_extension</varname></term>
16451 <indexterm role="variable">
16452 <primary><varname>$found_extension</varname></primary>
16454 This variable is available when Exim is compiled with the
16455 content-scanning extension and the obsolete <option>demime</option> condition. For details,
16456 see section <xref linkend="SECTdemimecond"/>.
16458 </listitem></varlistentry>
16460 <term><varname>$header_</varname><<emphasis>name</emphasis>></term>
16463 This is not strictly an expansion variable. It is expansion syntax for
16464 inserting the message header line with the given name. Note that the name must
16465 be terminated by colon or white space, because it may contain a wide variety of
16466 characters. Note also that braces must <emphasis>not</emphasis> be used.
16468 </listitem></varlistentry>
16470 <term><varname>$home</varname></term>
16473 <indexterm role="variable">
16474 <primary><varname>$home</varname></primary>
16476 When the <option>check_local_user</option> option is set for a router, the user’s home
16477 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
16478 means it is set during the running of users’ filter files. A router may also
16479 explicitly set a home directory for use by a transport; this can be overridden
16480 by a setting on the transport itself.
16483 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
16484 of the environment variable HOME.
16486 </listitem></varlistentry>
16488 <term><varname>$host</varname></term>
16491 <indexterm role="variable">
16492 <primary><varname>$host</varname></primary>
16494 If a router assigns an address to a transport (any transport), and passes a
16495 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
16496 to run is the name of the first host on the list. Note that this applies both
16497 to local and remote transports.
16500 <indexterm role="concept">
16501 <primary>transport</primary>
16502 <secondary>filter</secondary>
16504 <indexterm role="concept">
16505 <primary>filter</primary>
16506 <secondary>transport filter</secondary>
16508 For the <command>smtp</command> transport, if there is more than one host, the value of
16509 <varname>$host</varname> changes as the transport works its way through the list. In
16510 particular, when the <command>smtp</command> transport is expanding its options for encryption
16511 using TLS, or for specifying a transport filter (see chapter
16512 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
16516 When used in the client part of an authenticator configuration (see chapter
16517 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
16518 client is connected.
16520 </listitem></varlistentry>
16522 <term><varname>$host_address</varname></term>
16525 <indexterm role="variable">
16526 <primary><varname>$host_address</varname></primary>
16528 This variable is set to the remote host’s IP address whenever <varname>$host</varname> is set
16529 for a remote connection. It is also set to the IP address that is being checked
16530 when the <option>ignore_target_hosts</option> option is being processed.
16532 </listitem></varlistentry>
16534 <term><varname>$host_data</varname></term>
16537 <indexterm role="variable">
16538 <primary><varname>$host_data</varname></primary>
16540 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
16541 result of the lookup is made available in the <varname>$host_data</varname> variable. This
16542 allows you, for example, to do things like this:
16544 <literallayout class="monospaced">
16545 deny hosts = net-lsearch;/some/file
16546 message = $host_data
16548 </listitem></varlistentry>
16550 <term><varname>$host_lookup_deferred</varname></term>
16553 <indexterm role="concept">
16554 <primary>host name</primary>
16555 <secondary>lookup, failure of</secondary>
16557 <indexterm role="variable">
16558 <primary><varname>$host_lookup_deferred</varname></primary>
16560 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16561 message comes from a remote host and there is an attempt to look up the host’s
16562 name from its IP address, and the attempt is not successful, one of these
16563 variables is set to <quote>1</quote>.
16568 If the lookup receives a definite negative response (for example, a DNS lookup
16569 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16574 If there is any kind of problem during the lookup, such that Exim cannot
16575 tell whether or not the host name is defined (for example, a timeout for a DNS
16576 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16581 Looking up a host’s name from its IP address consists of more than just a
16582 single reverse lookup. Exim checks that a forward lookup of at least one of the
16583 names it receives from a reverse lookup yields the original IP address. If this
16584 is not the case, Exim does not accept the looked up name(s), and
16585 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16586 IP address (for example, the existence of a PTR record in the DNS) is not
16587 sufficient on its own for the success of a host name lookup. If the reverse
16588 lookup succeeds, but there is a lookup problem such as a timeout when checking
16589 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16590 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16592 </listitem></varlistentry>
16594 <term><varname>$host_lookup_failed</varname></term>
16597 <indexterm role="variable">
16598 <primary><varname>$host_lookup_failed</varname></primary>
16600 See <varname>$host_lookup_deferred</varname>.
16602 </listitem></varlistentry>
16604 <term><varname>$inode</varname></term>
16607 <indexterm role="variable">
16608 <primary><varname>$inode</varname></primary>
16610 The only time this variable is set is while expanding the <option>directory_file</option>
16611 option in the <command>appendfile</command> transport. The variable contains the inode number
16612 of the temporary file which is about to be renamed. It can be used to construct
16613 a unique name for the file.
16615 </listitem></varlistentry>
16617 <term><varname>$interface_address</varname></term>
16620 <indexterm role="variable">
16621 <primary><varname>$interface_address</varname></primary>
16623 This is an obsolete name for <varname>$received_ip_address</varname>.
16625 </listitem></varlistentry>
16627 <term><varname>$interface_port</varname></term>
16630 <indexterm role="variable">
16631 <primary><varname>$interface_port</varname></primary>
16633 This is an obsolete name for <varname>$received_port</varname>.
16635 </listitem></varlistentry>
16637 <term><varname>$item</varname></term>
16640 <indexterm role="variable">
16641 <primary><varname>$item</varname></primary>
16643 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
16644 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
16645 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
16648 </listitem></varlistentry>
16650 <term><varname>$ldap_dn</varname></term>
16653 <indexterm role="variable">
16654 <primary><varname>$ldap_dn</varname></primary>
16656 This variable, which is available only when Exim is compiled with LDAP support,
16657 contains the DN from the last entry in the most recently successful LDAP
16660 </listitem></varlistentry>
16662 <term><varname>$load_average</varname></term>
16665 <indexterm role="variable">
16666 <primary><varname>$load_average</varname></primary>
16668 This variable contains the system load average, multiplied by 1000 so that it
16669 is an integer. For example, if the load average is 0.21, the value of the
16670 variable is 210. The value is recomputed every time the variable is referenced.
16672 </listitem></varlistentry>
16674 <term><varname>$local_part</varname></term>
16677 <indexterm role="variable">
16678 <primary><varname>$local_part</varname></primary>
16680 When an address is being routed, or delivered on its own, this
16681 variable contains the local part. When a number of addresses are being
16682 delivered together (for example, multiple RCPT commands in an SMTP
16683 session), <varname>$local_part</varname> is not set.
16686 Global address rewriting happens when a message is received, so the value of
16687 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16688 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16689 because a message may have many recipients and the system filter is called just
16693 <indexterm role="variable">
16694 <primary><varname>$local_part_prefix</varname></primary>
16696 <indexterm role="variable">
16697 <primary><varname>$local_part_suffix</varname></primary>
16699 If a local part prefix or suffix has been recognized, it is not included in the
16700 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16701 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16702 <varname>$local_part_suffix</varname>, respectively.
16705 When a message is being delivered to a file, pipe, or autoreply transport as a
16706 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16707 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16708 <varname>$address_pipe</varname>).
16711 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16712 local part of the recipient address.
16715 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16716 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16717 it can be used in the expansion of the replacement address, for example.
16720 In all cases, all quoting is removed from the local part. For example, for both
16723 <literallayout class="monospaced">
16724 "abc:xyz"@test.example
16725 abc\:xyz@test.example
16728 the value of <varname>$local_part</varname> is
16730 <literallayout class="monospaced">
16734 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16735 inside a quoting operator. For example, in a <command>redirect</command> router you could
16738 <literallayout class="monospaced">
16739 data = ${quote_local_part:$local_part}@new.domain.example
16742 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16743 to process local parts in a case-dependent manner in a router, you can set the
16744 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16746 </listitem></varlistentry>
16748 <term><varname>$local_part_data</varname></term>
16751 <indexterm role="variable">
16752 <primary><varname>$local_part_data</varname></primary>
16754 When the <option>local_parts</option> option on a router matches a local part by means of a
16755 lookup, the data read by the lookup is available during the running of the
16756 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16757 to a transport, the value is available in that transport. If the transport is
16758 handling multiple addresses, the value from the first address is used.
16761 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16762 matches a local part by means of a lookup. The data read by the lookup is
16763 available during the rest of the ACL statement. In all other situations, this
16764 variable expands to nothing.
16766 </listitem></varlistentry>
16768 <term><varname>$local_part_prefix</varname></term>
16771 <indexterm role="variable">
16772 <primary><varname>$local_part_prefix</varname></primary>
16774 When an address is being routed or delivered, and a
16775 specific prefix for the local part was recognized, it is available in this
16776 variable, having been removed from <varname>$local_part</varname>.
16778 </listitem></varlistentry>
16780 <term><varname>$local_part_suffix</varname></term>
16783 <indexterm role="variable">
16784 <primary><varname>$local_part_suffix</varname></primary>
16786 When an address is being routed or delivered, and a
16787 specific suffix for the local part was recognized, it is available in this
16788 variable, having been removed from <varname>$local_part</varname>.
16790 </listitem></varlistentry>
16792 <term><varname>$local_scan_data</varname></term>
16795 <indexterm role="variable">
16796 <primary><varname>$local_scan_data</varname></primary>
16798 This variable contains the text returned by the <function>local_scan()</function> function when
16799 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16801 </listitem></varlistentry>
16803 <term><varname>$local_user_gid</varname></term>
16806 <indexterm role="variable">
16807 <primary><varname>$local_user_gid</varname></primary>
16809 See <varname>$local_user_uid</varname>.
16811 </listitem></varlistentry>
16813 <term><varname>$local_user_uid</varname></term>
16816 <indexterm role="variable">
16817 <primary><varname>$local_user_uid</varname></primary>
16819 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16820 <option>check_local_user</option> router precondition succeeds. This means that their values
16821 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16822 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16823 router-specific expansions. At all other times, the values in these variables
16824 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16826 </listitem></varlistentry>
16828 <term><varname>$localhost_number</varname></term>
16831 <indexterm role="variable">
16832 <primary><varname>$localhost_number</varname></primary>
16834 This contains the expanded value of the
16835 <option>localhost_number</option> option. The expansion happens after the main options have
16838 </listitem></varlistentry>
16840 <term><varname>$log_inodes</varname></term>
16843 <indexterm role="variable">
16844 <primary><varname>$log_inodes</varname></primary>
16846 The number of free inodes in the disk partition where Exim’s
16847 log files are being written. The value is recalculated whenever the variable is
16848 referenced. If the relevant file system does not have the concept of inodes,
16849 the value of is -1. See also the <option>check_log_inodes</option> option.
16851 </listitem></varlistentry>
16853 <term><varname>$log_space</varname></term>
16856 <indexterm role="variable">
16857 <primary><varname>$log_space</varname></primary>
16859 The amount of free space (as a number of kilobytes) in the disk
16860 partition where Exim’s log files are being written. The value is recalculated
16861 whenever the variable is referenced. If the operating system does not have the
16862 ability to find the amount of free space (only true for experimental systems),
16863 the space value is -1. See also the <option>check_log_space</option> option.
16865 </listitem></varlistentry>
16867 <term><varname>$mailstore_basename</varname></term>
16870 <indexterm role="variable">
16871 <primary><varname>$mailstore_basename</varname></primary>
16873 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16874 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16875 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16876 contains the basename of the files that are being written, that is, the name
16877 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16880 </listitem></varlistentry>
16882 <term><varname>$malware_name</varname></term>
16885 <indexterm role="variable">
16886 <primary><varname>$malware_name</varname></primary>
16888 This variable is available when Exim is compiled with the
16889 content-scanning extension. It is set to the name of the virus that was found
16890 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16892 </listitem></varlistentry>
16894 <term><varname>$max_received_linelength</varname></term>
16897 <indexterm role="variable">
16898 <primary><varname>$max_received_linelength</varname></primary>
16900 <indexterm role="concept">
16901 <primary>maximum</primary>
16902 <secondary>line length</secondary>
16904 <indexterm role="concept">
16905 <primary>line length</primary>
16906 <secondary>maximum</secondary>
16908 This variable contains the number of bytes in the longest line that was
16909 received as part of the message, not counting the line termination
16912 </listitem></varlistentry>
16914 <term><varname>$message_age</varname></term>
16917 <indexterm role="concept">
16918 <primary>message</primary>
16919 <secondary>age of</secondary>
16921 <indexterm role="variable">
16922 <primary><varname>$message_age</varname></primary>
16924 This variable is set at the start of a delivery attempt to contain the number
16925 of seconds since the message was received. It does not change during a single
16928 </listitem></varlistentry>
16930 <term><varname>$message_body</varname></term>
16933 <indexterm role="concept">
16934 <primary>body of message</primary>
16935 <secondary>expansion variable</secondary>
16937 <indexterm role="concept">
16938 <primary>message body</primary>
16939 <secondary>in expansion</secondary>
16941 <indexterm role="concept">
16942 <primary>binary zero</primary>
16943 <secondary>in message body</secondary>
16945 <indexterm role="variable">
16946 <primary><varname>$message_body</varname></primary>
16948 <indexterm role="option">
16949 <primary><option>message_body_visible</option></primary>
16951 This variable contains the initial portion of a message’s body while it is
16952 being delivered, and is intended mainly for use in filter files. The maximum
16953 number of characters of the body that are put into the variable is set by the
16954 <option>message_body_visible</option> configuration option; the default is 500.
16957 <indexterm role="option">
16958 <primary><option>message_body_newlines</option></primary>
16960 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
16961 easier to search for phrases that might be split over a line break. However,
16962 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
16963 zeros are always converted into spaces.
16965 </listitem></varlistentry>
16967 <term><varname>$message_body_end</varname></term>
16970 <indexterm role="concept">
16971 <primary>body of message</primary>
16972 <secondary>expansion variable</secondary>
16974 <indexterm role="concept">
16975 <primary>message body</primary>
16976 <secondary>in expansion</secondary>
16978 <indexterm role="variable">
16979 <primary><varname>$message_body_end</varname></primary>
16981 This variable contains the final portion of a message’s
16982 body while it is being delivered. The format and maximum size are as for
16983 <varname>$message_body</varname>.
16985 </listitem></varlistentry>
16987 <term><varname>$message_body_size</varname></term>
16990 <indexterm role="concept">
16991 <primary>body of message</primary>
16992 <secondary>size</secondary>
16994 <indexterm role="concept">
16995 <primary>message body</primary>
16996 <secondary>size</secondary>
16998 <indexterm role="variable">
16999 <primary><varname>$message_body_size</varname></primary>
17001 When a message is being delivered, this variable contains the size of the body
17002 in bytes. The count starts from the character after the blank line that
17003 separates the body from the header. Newlines are included in the count. See
17004 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17006 </listitem></varlistentry>
17008 <term><varname>$message_exim_id</varname></term>
17011 <indexterm role="variable">
17012 <primary><varname>$message_exim_id</varname></primary>
17014 When a message is being received or delivered, this variable contains the
17015 unique message id that is generated and used by Exim to identify the message.
17016 An id is not created for a message until after its header has been successfully
17017 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
17018 line; it is the local id that Exim assigns to the message, for example:
17019 <literal>1BXTIK-0001yO-VA</literal>.
17021 </listitem></varlistentry>
17023 <term><varname>$message_headers</varname></term>
17026 <indexterm role="variable">
17027 <primary><varname>$message_headers</varname></primary>
17029 This variable contains a concatenation of all the header lines when a message
17030 is being processed, except for lines added by routers or transports. The header
17031 lines are separated by newline characters. Their contents are decoded in the
17032 same way as a header line that is inserted by <option>bheader</option>.
17034 </listitem></varlistentry>
17036 <term><varname>$message_headers_raw</varname></term>
17039 <indexterm role="variable">
17040 <primary><varname>$message_headers_raw</varname></primary>
17042 This variable is like <varname>$message_headers</varname> except that no processing of the
17043 contents of header lines is done.
17045 </listitem></varlistentry>
17047 <term><varname>$message_id</varname></term>
17050 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
17052 </listitem></varlistentry>
17054 <term><varname>$message_linecount</varname></term>
17057 <indexterm role="variable">
17058 <primary><varname>$message_linecount</varname></primary>
17060 This variable contains the total number of lines in the header and body of the
17061 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
17062 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
17063 number of lines received. Before delivery happens (that is, before filters,
17064 routers, and transports run) the count is increased to include the
17065 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
17066 lines that are added by ACLs. The blank line that separates the message header
17067 from the body is not counted. Here is an example of the use of this variable in
17070 <literallayout class="monospaced">
17071 deny message = Too many lines in message header
17073 ${if <{250}{${eval:$message_linecount - $body_linecount}}}
17076 In the MAIL and RCPT ACLs, the value is zero because at that stage the
17077 message has not yet been received.
17079 </listitem></varlistentry>
17081 <term><varname>$message_size</varname></term>
17084 <indexterm role="concept">
17085 <primary>size</primary>
17086 <secondary>of message</secondary>
17088 <indexterm role="concept">
17089 <primary>message</primary>
17090 <secondary>size</secondary>
17092 <indexterm role="variable">
17093 <primary><varname>$message_size</varname></primary>
17095 When a message is being processed, this variable contains its size in bytes. In
17096 most cases, the size includes those headers that were received with the
17097 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
17098 deliveries as they are written. However, there is one special case: during the
17099 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
17100 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
17101 precise size of the file that has been written. See also
17102 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
17105 <indexterm role="concept">
17106 <primary>RCPT</primary>
17107 <secondary>value of <varname>$message_size</varname></secondary>
17109 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
17110 contains the size supplied on the MAIL command, or -1 if no size was given. The
17111 value may not, of course, be truthful.
17113 </listitem></varlistentry>
17115 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
17118 A number of variables whose names start with <varname>$mime</varname> are
17119 available when Exim is compiled with the content-scanning extension. For
17120 details, see section <xref linkend="SECTscanmimepart"/>.
17122 </listitem></varlistentry>
17124 <term><varname>$n0</varname> – <varname>$n9</varname></term>
17127 These variables are counters that can be incremented by means
17128 of the <option>add</option> command in filter files.
17130 </listitem></varlistentry>
17132 <term><varname>$original_domain</varname></term>
17135 <indexterm role="variable">
17136 <primary><varname>$domain</varname></primary>
17138 <indexterm role="variable">
17139 <primary><varname>$original_domain</varname></primary>
17141 When a top-level address is being processed for delivery, this contains the
17142 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
17143 generated by an alias, forward, or filter file) is being processed, this
17144 variable contains the domain of the original address (lower cased). This
17145 differs from <varname>$parent_domain</varname> only when there is more than one level of
17146 aliasing or forwarding. When more than one address is being delivered in a
17147 single transport run, <varname>$original_domain</varname> is not set.
17150 If a new address is created by means of a <option>deliver</option> command in a system
17151 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17152 part <emphasis>system-filter</emphasis> and the default qualify domain.
17154 </listitem></varlistentry>
17156 <term><varname>$original_local_part</varname></term>
17159 <indexterm role="variable">
17160 <primary><varname>$local_part</varname></primary>
17162 <indexterm role="variable">
17163 <primary><varname>$original_local_part</varname></primary>
17165 When a top-level address is being processed for delivery, this contains the
17166 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
17167 local part, because <varname>$original_local_part</varname> always contains the full local
17168 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
17169 filter file) is being processed, this variable contains the full local part of
17170 the original address.
17173 If the router that did the redirection processed the local part
17174 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
17175 This variable differs from <varname>$parent_local_part</varname> only when there is more than
17176 one level of aliasing or forwarding. When more than one address is being
17177 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
17180 If a new address is created by means of a <option>deliver</option> command in a system
17181 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
17182 part <emphasis>system-filter</emphasis> and the default qualify domain.
17184 </listitem></varlistentry>
17186 <term><varname>$originator_gid</varname></term>
17189 <indexterm role="concept">
17190 <primary>gid (group id)</primary>
17191 <secondary>of originating user</secondary>
17193 <indexterm role="concept">
17194 <primary>sender</primary>
17195 <secondary>gid</secondary>
17197 <indexterm role="variable">
17198 <primary><varname>$caller_gid</varname></primary>
17200 <indexterm role="variable">
17201 <primary><varname>$originator_gid</varname></primary>
17203 This variable contains the value of <varname>$caller_gid</varname> that was set when the
17204 message was received. For messages received via the command line, this is the
17205 gid of the sending user. For messages received by SMTP over TCP/IP, this is
17206 normally the gid of the Exim user.
17208 </listitem></varlistentry>
17210 <term><varname>$originator_uid</varname></term>
17213 <indexterm role="concept">
17214 <primary>uid (user id)</primary>
17215 <secondary>of originating user</secondary>
17217 <indexterm role="concept">
17218 <primary>sender</primary>
17219 <secondary>uid</secondary>
17221 <indexterm role="variable">
17222 <primary><varname>$caller_uid</varname></primary>
17224 <indexterm role="variable">
17225 <primary><varname>$originaltor_uid</varname></primary>
17227 The value of <varname>$caller_uid</varname> that was set when the message was received. For
17228 messages received via the command line, this is the uid of the sending user.
17229 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
17232 </listitem></varlistentry>
17234 <term><varname>$parent_domain</varname></term>
17237 <indexterm role="variable">
17238 <primary><varname>$parent_domain</varname></primary>
17240 This variable is similar to <varname>$original_domain</varname> (see
17241 above), except that it refers to the immediately preceding parent address.
17243 </listitem></varlistentry>
17245 <term><varname>$parent_local_part</varname></term>
17248 <indexterm role="variable">
17249 <primary><varname>$parent_local_part</varname></primary>
17251 This variable is similar to <varname>$original_local_part</varname>
17252 (see above), except that it refers to the immediately preceding parent address.
17254 </listitem></varlistentry>
17256 <term><varname>$pid</varname></term>
17259 <indexterm role="concept">
17260 <primary>pid (process id)</primary>
17261 <secondary>of current process</secondary>
17263 <indexterm role="variable">
17264 <primary><varname>$pid</varname></primary>
17266 This variable contains the current process id.
17268 </listitem></varlistentry>
17270 <term><varname>$pipe_addresses</varname></term>
17273 <indexterm role="concept">
17274 <primary>filter</primary>
17275 <secondary>transport filter</secondary>
17277 <indexterm role="concept">
17278 <primary>transport</primary>
17279 <secondary>filter</secondary>
17281 <indexterm role="variable">
17282 <primary><varname>$pipe_addresses</varname></primary>
17284 This is not an expansion variable, but is mentioned here because the string
17285 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
17286 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
17287 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
17288 It cannot be used in general expansion strings, and provokes an <quote>unknown
17289 variable</quote> error if encountered.
17291 </listitem></varlistentry>
17293 <term><varname>$primary_hostname</varname></term>
17296 <indexterm role="variable">
17297 <primary><varname>$primary_hostname</varname></primary>
17299 This variable contains the value set by <option>primary_hostname</option> in the
17300 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
17301 a single-component name, Exim calls <function>gethostbyname()</function> (or
17302 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
17303 qualified host name. See also <varname>$smtp_active_hostname</varname>.
17305 </listitem></varlistentry>
17307 <term><varname>$prvscheck_address</varname></term>
17310 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17311 which is described in sections <xref linkend="SECTexpansionitems"/> and
17312 <xref linkend="SECTverifyPRVS"/>.
17314 </listitem></varlistentry>
17316 <term><varname>$prvscheck_keynum</varname></term>
17319 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17320 which is described in sections <xref linkend="SECTexpansionitems"/> and
17321 <xref linkend="SECTverifyPRVS"/>.
17323 </listitem></varlistentry>
17325 <term><varname>$prvscheck_result</varname></term>
17328 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
17329 which is described in sections <xref linkend="SECTexpansionitems"/> and
17330 <xref linkend="SECTverifyPRVS"/>.
17332 </listitem></varlistentry>
17334 <term><varname>$qualify_domain</varname></term>
17337 <indexterm role="variable">
17338 <primary><varname>$qualify_domain</varname></primary>
17340 The value set for the <option>qualify_domain</option> option in the configuration file.
17342 </listitem></varlistentry>
17344 <term><varname>$qualify_recipient</varname></term>
17347 <indexterm role="variable">
17348 <primary><varname>$qualify_recipient</varname></primary>
17350 The value set for the <option>qualify_recipient</option> option in the configuration file,
17351 or if not set, the value of <varname>$qualify_domain</varname>.
17353 </listitem></varlistentry>
17355 <term><varname>$rcpt_count</varname></term>
17358 <indexterm role="variable">
17359 <primary><varname>$rcpt_count</varname></primary>
17361 When a message is being received by SMTP, this variable contains the number of
17362 RCPT commands received for the current message. If this variable is used in a
17363 RCPT ACL, its value includes the current command.
17365 </listitem></varlistentry>
17367 <term><varname>$rcpt_defer_count</varname></term>
17370 <indexterm role="variable">
17371 <primary><varname>$rcpt_defer_count</varname></primary>
17373 <indexterm role="concept">
17374 <primary>4<emphasis>xx</emphasis> responses</primary>
17375 <secondary>count of</secondary>
17377 When a message is being received by SMTP, this variable contains the number of
17378 RCPT commands in the current message that have previously been rejected with a
17379 temporary (4<emphasis>xx</emphasis>) response.
17381 </listitem></varlistentry>
17383 <term><varname>$rcpt_fail_count</varname></term>
17386 <indexterm role="variable">
17387 <primary><varname>$rcpt_fail_count</varname></primary>
17389 When a message is being received by SMTP, this variable contains the number of
17390 RCPT commands in the current message that have previously been rejected with a
17391 permanent (5<emphasis>xx</emphasis>) response.
17393 </listitem></varlistentry>
17395 <term><varname>$received_count</varname></term>
17398 <indexterm role="variable">
17399 <primary><varname>$received_count</varname></primary>
17401 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
17402 including the one added by Exim (so its value is always greater than zero). It
17403 is available in the DATA ACL, the non-SMTP ACL, and while routing and
17406 </listitem></varlistentry>
17408 <term><varname>$received_for</varname></term>
17411 <indexterm role="variable">
17412 <primary><varname>$received_for</varname></primary>
17414 If there is only a single recipient address in an incoming message, this
17415 variable contains that address when the <emphasis>Received:</emphasis> header line is being
17416 built. The value is copied after recipient rewriting has happened, but before
17417 the <function>local_scan()</function> function is run.
17419 </listitem></varlistentry>
17421 <term><varname>$received_ip_address</varname></term>
17424 <indexterm role="variable">
17425 <primary><varname>$received_ip_address</varname></primary>
17427 As soon as an Exim server starts processing an incoming TCP/IP connection, this
17428 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
17429 is set to the local port number. (The remote IP address and port are in
17430 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
17431 the port value is -1 unless it has been set using the <option>-oMi</option> command line
17435 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
17436 could be used, for example, to make the file name for a TLS certificate depend
17437 on which interface and/or port is being used for the incoming connection. The
17438 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
17439 messages that are received, thus making these variables available at delivery
17443 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
17444 the values are unknown (unless they are explicitly set by options of the
17445 <command>smtp</command> transport).
17447 </listitem></varlistentry>
17449 <term><varname>$received_port</varname></term>
17452 <indexterm role="variable">
17453 <primary><varname>$received_port</varname></primary>
17455 See <varname>$received_ip_address</varname>.
17457 </listitem></varlistentry>
17459 <term><varname>$received_protocol</varname></term>
17462 <indexterm role="variable">
17463 <primary><varname>$received_protocol</varname></primary>
17465 When a message is being processed, this variable contains the name of the
17466 protocol by which it was received. Most of the names used by Exim are defined
17467 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
17468 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
17469 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
17470 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
17471 connection and the client was successfully authenticated.
17474 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
17475 automatically set up on connection without the use of STARTTLS (see
17476 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
17477 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
17478 where the client initially uses EHLO, sets up an encrypted connection using
17479 STARTTLS, and then uses HELO afterwards.
17482 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
17483 messages that are injected locally by trusted callers. This is commonly used to
17484 identify messages that are being re-injected after some kind of scanning.
17486 </listitem></varlistentry>
17488 <term><varname>$received_time</varname></term>
17491 <indexterm role="variable">
17492 <primary><varname>$received_time</varname></primary>
17494 This variable contains the date and time when the current message was received,
17495 as a number of seconds since the start of the Unix epoch.
17497 </listitem></varlistentry>
17499 <term><varname>$recipient_data</varname></term>
17502 <indexterm role="variable">
17503 <primary><varname>$recipient_data</varname></primary>
17505 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
17506 condition. It contains the data from the lookup, and the value remains set
17507 until the next <option>recipients</option> test. Thus, you can do things like this:
17510 <literal>require recipients = cdb*@;/some/file</literal>
17511 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
17514 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17515 method in the address list, using the semicolon syntax as in the example above.
17516 The variable is not set for a lookup that is used as part of the string
17517 expansion that all such lists undergo before being interpreted.
17519 </listitem></varlistentry>
17521 <term><varname>$recipient_verify_failure</varname></term>
17524 <indexterm role="variable">
17525 <primary><varname>$recipient_verify_failure</varname></primary>
17527 In an ACL, when a recipient verification fails, this variable contains
17528 information about the failure. It is set to one of the following words:
17533 <quote>qualify</quote>: The address was unqualified (no domain), and the message
17534 was neither local nor came from an exempted host.
17539 <quote>route</quote>: Routing failed.
17544 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
17545 or before the MAIL command (that is, on initial connection, HELO, or
17551 <quote>recipient</quote>: The RCPT command in a callout was rejected.
17556 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
17561 The main use of this variable is expected to be to distinguish between
17562 rejections of MAIL and rejections of RCPT.
17564 </listitem></varlistentry>
17566 <term><varname>$recipients</varname></term>
17569 <indexterm role="variable">
17570 <primary><varname>$recipients</varname></primary>
17572 This variable contains a list of envelope recipients for a message. A comma and
17573 a space separate the addresses in the replacement text. However, the variable
17574 is not generally available, to prevent exposure of Bcc recipients in
17575 unprivileged users’ filter files. You can use <varname>$recipients</varname> only in these
17578 <orderedlist numeration="arabic">
17581 In a system filter file.
17586 In the ACLs associated with the DATA command and with non-SMTP messages, that
17587 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
17588 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
17589 <option>acl_not_smtp_mime</option>.
17594 From within a <function>local_scan()</function> function.
17598 </listitem></varlistentry>
17600 <term><varname>$recipients_count</varname></term>
17603 <indexterm role="variable">
17604 <primary><varname>$recipients_count</varname></primary>
17606 When a message is being processed, this variable contains the number of
17607 envelope recipients that came with the message. Duplicates are not excluded
17608 from the count. While a message is being received over SMTP, the number
17609 increases for each accepted recipient. It can be referenced in an ACL.
17611 </listitem></varlistentry>
17613 <term><varname>$regex_match_string</varname></term>
17616 <indexterm role="variable">
17617 <primary><varname>$regex_match_string</varname></primary>
17619 This variable is set to contain the matching regular expression after a
17620 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17622 </listitem></varlistentry>
17624 <term><varname>$reply_address</varname></term>
17627 <indexterm role="variable">
17628 <primary><varname>$reply_address</varname></primary>
17630 When a message is being processed, this variable contains the contents of the
17631 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17632 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17633 white space, the value is not processed in any way. In particular, no RFC 2047
17634 decoding or character code translation takes place.
17636 </listitem></varlistentry>
17638 <term><varname>$return_path</varname></term>
17641 <indexterm role="variable">
17642 <primary><varname>$return_path</varname></primary>
17644 When a message is being delivered, this variable contains the return path –
17645 the sender field that will be sent as part of the envelope. It is not enclosed
17646 in <> characters. At the start of routing an address, <varname>$return_path</varname> has the
17647 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17648 mailing list has been expanded by a router which specifies a different address
17649 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17650 address, whereas <varname>$sender_address</varname> always contains the original sender address
17651 that was received with the message. In other words, <varname>$sender_address</varname> contains
17652 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17655 </listitem></varlistentry>
17657 <term><varname>$return_size_limit</varname></term>
17660 <indexterm role="variable">
17661 <primary><varname>$return_size_limit</varname></primary>
17663 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17665 </listitem></varlistentry>
17667 <term><varname>$runrc</varname></term>
17670 <indexterm role="concept">
17671 <primary>return code</primary>
17672 <secondary>from <option>run</option> expansion</secondary>
17674 <indexterm role="variable">
17675 <primary><varname>$runrc</varname></primary>
17677 This variable contains the return code from a command that is run by the
17678 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17679 assume the order in which option values are expanded, except for those
17680 preconditions whose order of testing is documented. Therefore, you cannot
17681 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17684 </listitem></varlistentry>
17686 <term><varname>$self_hostname</varname></term>
17689 <indexterm role="option">
17690 <primary><option>self</option></primary>
17691 <secondary>value of host name</secondary>
17693 <indexterm role="variable">
17694 <primary><varname>$self_hostname</varname></primary>
17696 When an address is routed to a supposedly remote host that turns out to be the
17697 local host, what happens is controlled by the <option>self</option> generic router option.
17698 One of its values causes the address to be passed to another router. When this
17699 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17700 original router encountered. In other circumstances its contents are null.
17702 </listitem></varlistentry>
17704 <term><varname>$sender_address</varname></term>
17707 <indexterm role="variable">
17708 <primary><varname>$sender_address</varname></primary>
17710 When a message is being processed, this variable contains the sender’s address
17711 that was received in the message’s envelope. The case of letters in the address
17712 is retained, in both the local part and the domain. For bounce messages, the
17713 value of this variable is the empty string. See also <varname>$return_path</varname>.
17715 </listitem></varlistentry>
17717 <term><varname>$sender_address_data</varname></term>
17720 <indexterm role="variable">
17721 <primary><varname>$address_data</varname></primary>
17723 <indexterm role="variable">
17724 <primary><varname>$sender_address_data</varname></primary>
17726 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17727 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17728 distinguish it from data from a recipient address. The value does not persist
17729 after the end of the current ACL statement. If you want to preserve it for
17730 longer, you can save it in an ACL variable.
17732 </listitem></varlistentry>
17734 <term><varname>$sender_address_domain</varname></term>
17737 <indexterm role="variable">
17738 <primary><varname>$sender_address_domain</varname></primary>
17740 The domain portion of <varname>$sender_address</varname>.
17742 </listitem></varlistentry>
17744 <term><varname>$sender_address_local_part</varname></term>
17747 <indexterm role="variable">
17748 <primary><varname>$sender_address_local_part</varname></primary>
17750 The local part portion of <varname>$sender_address</varname>.
17752 </listitem></varlistentry>
17754 <term><varname>$sender_data</varname></term>
17757 <indexterm role="variable">
17758 <primary><varname>$sender_data</varname></primary>
17760 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17761 in a router <option>senders</option> option. It contains the data from the lookup, and the
17762 value remains set until the next <option>senders</option> test. Thus, you can do things like
17766 <literal>require senders = cdb*@;/some/file</literal>
17767 <literal>deny </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17770 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17771 method in the address list, using the semicolon syntax as in the example above.
17772 The variable is not set for a lookup that is used as part of the string
17773 expansion that all such lists undergo before being interpreted.
17775 </listitem></varlistentry>
17777 <term><varname>$sender_fullhost</varname></term>
17780 <indexterm role="variable">
17781 <primary><varname>$sender_fullhost</varname></primary>
17783 When a message is received from a remote host, this variable contains the host
17784 name and IP address in a single string. It ends with the IP address in square
17785 brackets, followed by a colon and a port number if the logging of ports is
17786 enabled. The format of the rest of the string depends on whether the host
17787 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17788 looking up its IP address. (Looking up the IP address can be forced by the
17789 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17790 start of the string is a verified host name; if this is not present,
17791 verification either failed or was not requested. A host name in parentheses is
17792 the argument of a HELO or EHLO command. This is omitted if it is identical to
17793 the verified host name or to the host’s IP address in square brackets.
17795 </listitem></varlistentry>
17797 <term><varname>$sender_helo_name</varname></term>
17800 <indexterm role="variable">
17801 <primary><varname>$sender_helo_name</varname></primary>
17803 When a message is received from a remote host that has issued a HELO or EHLO
17804 command, the argument of that command is placed in this variable. It is also
17805 set if HELO or EHLO is used when a message is received using SMTP locally via
17806 the <option>-bs</option> or <option>-bS</option> options.
17808 </listitem></varlistentry>
17810 <term><varname>$sender_host_address</varname></term>
17813 <indexterm role="variable">
17814 <primary><varname>$sender_host_address</varname></primary>
17816 When a message is received from a remote host, this variable contains that
17817 host’s IP address. For locally submitted messages, it is empty.
17819 </listitem></varlistentry>
17821 <term><varname>$sender_host_authenticated</varname></term>
17824 <indexterm role="variable">
17825 <primary><varname>$sender_host_authenticated</varname></primary>
17827 This variable contains the name (not the public name) of the authenticator
17828 driver that successfully authenticated the client from which the message was
17829 received. It is empty if there was no successful authentication. See also
17830 <varname>$authenticated_id</varname>.
17832 </listitem></varlistentry>
17834 <term><varname>$sender_host_name</varname></term>
17837 <indexterm role="variable">
17838 <primary><varname>$sender_host_name</varname></primary>
17840 When a message is received from a remote host, this variable contains the
17841 host’s name as obtained by looking up its IP address. For messages received by
17842 other means, this variable is empty.
17845 <indexterm role="variable">
17846 <primary><varname>$host_lookup_failed</varname></primary>
17848 If the host name has not previously been looked up, a reference to
17849 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17850 A looked up name is accepted only if it leads back to the original IP address
17851 via a forward lookup. If either the reverse or the forward lookup fails to find
17852 any data, or if the forward lookup does not yield the original IP address,
17853 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17856 <indexterm role="variable">
17857 <primary><varname>$host_lookup_deferred</varname></primary>
17859 However, if either of the lookups cannot be completed (for example, there is a
17860 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17861 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17864 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17865 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17866 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17867 is set to <quote>1</quote>.
17870 Exim does not automatically look up every calling host’s name. If you want
17871 maximum efficiency, you should arrange your configuration so that it avoids
17872 these lookups altogether. The lookup happens only if one or more of the
17873 following are true:
17878 A string containing <varname>$sender_host_name</varname> is expanded.
17883 The calling host matches the list in <option>host_lookup</option>. In the default
17884 configuration, this option is set to *, so it must be changed if lookups are
17885 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17890 Exim needs the host name in order to test an item in a host list. The items
17891 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17892 <xref linkend="SECThoslispatnamsk"/>.
17897 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17898 In this case, the host name is required to compare with the name quoted in any
17899 EHLO or HELO commands that the client issues.
17904 The remote host issues a EHLO or HELO command that quotes one of the
17905 domains in <option>helo_lookup_domains</option>. The default value of this option is
17907 <literallayout class="monospaced">
17908 helo_lookup_domains = @ : @[]
17911 which causes a lookup if a remote host (incorrectly) gives the server’s name or
17912 IP address in an EHLO or HELO command.
17916 </listitem></varlistentry>
17918 <term><varname>$sender_host_port</varname></term>
17921 <indexterm role="variable">
17922 <primary><varname>$sender_host_port</varname></primary>
17924 When a message is received from a remote host, this variable contains the port
17925 number that was used on the remote host.
17927 </listitem></varlistentry>
17929 <term><varname>$sender_ident</varname></term>
17932 <indexterm role="variable">
17933 <primary><varname>$sender_ident</varname></primary>
17935 When a message is received from a remote host, this variable contains the
17936 identification received in response to an RFC 1413 request. When a message has
17937 been received locally, this variable contains the login name of the user that
17940 </listitem></varlistentry>
17942 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17945 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17946 <option>ratelimit</option> ACL condition. Details are given in section
17947 <xref linkend="SECTratelimiting"/>.
17949 </listitem></varlistentry>
17951 <term><varname>$sender_rcvhost</varname></term>
17954 <indexterm role="concept">
17955 <primary>DNS</primary>
17956 <secondary>reverse lookup</secondary>
17958 <indexterm role="concept">
17959 <primary>reverse DNS lookup</primary>
17961 <indexterm role="variable">
17962 <primary><varname>$sender_rcvhost</varname></primary>
17964 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17965 either the verified host name (as obtained from a reverse DNS lookup) or, if
17966 there is no verified host name, the IP address in square brackets. After that
17967 there may be text in parentheses. When the first item is a verified host name,
17968 the first thing in the parentheses is the IP address in square brackets,
17969 followed by a colon and a port number if port logging is enabled. When the
17970 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17974 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17975 was used and its argument was not identical to the real host name or IP
17976 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17977 all three items are present in the parentheses, a newline and tab are inserted
17978 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17980 </listitem></varlistentry>
17982 <term><varname>$sender_verify_failure</varname></term>
17985 <indexterm role="variable">
17986 <primary><varname>$sender_verify_failure</varname></primary>
17988 In an ACL, when a sender verification fails, this variable contains information
17989 about the failure. The details are the same as for
17990 <varname>$recipient_verify_failure</varname>.
17992 </listitem></varlistentry>
17994 <term><varname>$sending_ip_address</varname></term>
17997 <indexterm role="variable">
17998 <primary><varname>$sending_ip_address</varname></primary>
18000 This variable is set whenever an outgoing SMTP connection to another host has
18001 been set up. It contains the IP address of the local interface that is being
18002 used. This is useful if a host that has more than one IP address wants to take
18003 on different personalities depending on which one is being used. For incoming
18004 connections, see <varname>$received_ip_address</varname>.
18006 </listitem></varlistentry>
18008 <term><varname>$sending_port</varname></term>
18011 <indexterm role="variable">
18012 <primary><varname>$sending_port</varname></primary>
18014 This variable is set whenever an outgoing SMTP connection to another host has
18015 been set up. It contains the local port that is being used. For incoming
18016 connections, see <varname>$received_port</varname>.
18018 </listitem></varlistentry>
18020 <term><varname>$smtp_active_hostname</varname></term>
18023 <indexterm role="variable">
18024 <primary><varname>$smtp_active_hostname</varname></primary>
18026 During an incoming SMTP session, this variable contains the value of the active
18027 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
18028 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
18029 value can be consulted during routing and delivery.
18031 </listitem></varlistentry>
18033 <term><varname>$smtp_command</varname></term>
18036 <indexterm role="variable">
18037 <primary><varname>$smtp_command</varname></primary>
18039 During the processing of an incoming SMTP command, this variable contains the
18040 entire command. This makes it possible to distinguish between HELO and EHLO in
18041 the HELO ACL, and also to distinguish between commands such as these:
18043 <literallayout class="monospaced">
18045 MAIL FROM: <>
18048 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
18049 command, the address in <varname>$smtp_command</varname> is the original address before any
18050 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
18051 the address after SMTP-time rewriting.
18053 </listitem></varlistentry>
18055 <term><varname>$smtp_command_argument</varname></term>
18058 <indexterm role="concept">
18059 <primary>SMTP</primary>
18060 <secondary>command, argument for</secondary>
18062 <indexterm role="variable">
18063 <primary><varname>$smtp_command_argument</varname></primary>
18065 While an ACL is running to check an SMTP command, this variable contains the
18066 argument, that is, the text that follows the command name, with leading white
18067 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
18068 somewhat redundant, but is retained for backwards compatibility.
18070 </listitem></varlistentry>
18072 <term><varname>$smtp_count_at_connection_start</varname></term>
18075 <indexterm role="variable">
18076 <primary><varname>$smtp_count_at_connection_start</varname></primary>
18078 This variable is set greater than zero only in processes spawned by the Exim
18079 daemon for handling incoming SMTP connections. The name is deliberately long,
18080 in order to emphasize what the contents are. When the daemon accepts a new
18081 connection, it increments this variable. A copy of the variable is passed to
18082 the child process that handles the connection, but its value is fixed, and
18083 never changes. It is only an approximation of how many incoming connections
18084 there actually are, because many other connections may come and go while a
18085 single connection is being processed. When a child process terminates, the
18086 daemon decrements its copy of the variable.
18088 </listitem></varlistentry>
18090 <term><varname>$sn0</varname> – <varname>$sn9</varname></term>
18093 These variables are copies of the values of the <varname>$n0</varname> – <varname>$n9</varname> accumulators
18094 that were current at the end of the system filter file. This allows a system
18095 filter file to set values that can be tested in users’ filter files. For
18096 example, a system filter could set a value indicating how likely it is that a
18097 message is junk mail.
18099 </listitem></varlistentry>
18101 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
18104 A number of variables whose names start with <varname>$spam</varname> are available when Exim
18105 is compiled with the content-scanning extension. For details, see section
18106 <xref linkend="SECTscanspamass"/>.
18108 </listitem></varlistentry>
18110 <term><varname>$spool_directory</varname></term>
18113 <indexterm role="variable">
18114 <primary><varname>$spool_directory</varname></primary>
18116 The name of Exim’s spool directory.
18118 </listitem></varlistentry>
18120 <term><varname>$spool_inodes</varname></term>
18123 <indexterm role="variable">
18124 <primary><varname>$spool_inodes</varname></primary>
18126 The number of free inodes in the disk partition where Exim’s spool files are
18127 being written. The value is recalculated whenever the variable is referenced.
18128 If the relevant file system does not have the concept of inodes, the value of
18129 is -1. See also the <option>check_spool_inodes</option> option.
18131 </listitem></varlistentry>
18133 <term><varname>$spool_space</varname></term>
18136 <indexterm role="variable">
18137 <primary><varname>$spool_space</varname></primary>
18139 The amount of free space (as a number of kilobytes) in the disk partition where
18140 Exim’s spool files are being written. The value is recalculated whenever the
18141 variable is referenced. If the operating system does not have the ability to
18142 find the amount of free space (only true for experimental systems), the space
18143 value is -1. For example, to check in an ACL that there is at least 50
18144 megabytes free on the spool, you could write:
18146 <literallayout class="monospaced">
18147 condition = ${if > {$spool_space}{50000}}
18150 See also the <option>check_spool_space</option> option.
18152 </listitem></varlistentry>
18154 <term><varname>$thisaddress</varname></term>
18157 <indexterm role="variable">
18158 <primary><varname>$thisaddress</varname></primary>
18160 This variable is set only during the processing of the <option>foranyaddress</option>
18161 command in a filter file. Its use is explained in the description of that
18162 command, which can be found in the separate document entitled <emphasis>Exim’s
18163 interfaces to mail filtering</emphasis>.
18165 </listitem></varlistentry>
18167 <term><varname>$tls_certificate_verified</varname></term>
18170 <indexterm role="variable">
18171 <primary><varname>$tls_certificate_verified</varname></primary>
18173 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
18174 message was received, and <quote>0</quote> otherwise.
18176 </listitem></varlistentry>
18178 <term><varname>$tls_cipher</varname></term>
18181 <indexterm role="variable">
18182 <primary><varname>$tls_cipher</varname></primary>
18184 When a message is received from a remote host over an encrypted SMTP
18185 connection, this variable is set to the cipher suite that was negotiated, for
18186 example DES-CBC3-SHA. In other circumstances, in particular, for message
18187 received over unencrypted connections, the variable is empty. Testing
18188 <varname>$tls_cipher</varname> for emptiness is one way of distinguishing between encrypted and
18189 non-encrypted connections during ACL processing.
18192 The <varname>$tls_cipher</varname> variable retains its value during message delivery, except
18193 when an outward SMTP delivery takes place via the <command>smtp</command> transport. In this
18194 case, <varname>$tls_cipher</varname> is cleared before any outgoing SMTP connection is made,
18195 and then set to the outgoing cipher suite if one is negotiated. See chapter
18196 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
18197 details of the <command>smtp</command> transport.
18199 </listitem></varlistentry>
18201 <term><varname>$tls_peerdn</varname></term>
18204 <indexterm role="variable">
18205 <primary><varname>$tls_peerdn</varname></primary>
18207 When a message is received from a remote host over an encrypted SMTP
18208 connection, and Exim is configured to request a certificate from the client,
18209 the value of the Distinguished Name of the certificate is made available in the
18210 <varname>$tls_peerdn</varname> during subsequent processing. Like <varname>$tls_cipher</varname>, the
18211 value is retained during message delivery, except during outbound SMTP
18214 </listitem></varlistentry>
18216 <term><varname>$tod_bsdinbox</varname></term>
18219 <indexterm role="variable">
18220 <primary><varname>$tod_bsdinbox</varname></primary>
18222 The time of day and the date, in the format required for BSD-style mailbox
18223 files, for example: Thu Oct 17 17:14:09 1995.
18225 </listitem></varlistentry>
18227 <term><varname>$tod_epoch</varname></term>
18230 <indexterm role="variable">
18231 <primary><varname>$tod_epoch</varname></primary>
18233 The time and date as a number of seconds since the start of the Unix epoch.
18235 </listitem></varlistentry>
18237 <term><varname>$tod_full</varname></term>
18240 <indexterm role="variable">
18241 <primary><varname>$tod_full</varname></primary>
18243 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
18244 +0100. The timezone is always given as a numerical offset from UTC, with
18245 positive values used for timezones that are ahead (east) of UTC, and negative
18246 values for those that are behind (west).
18248 </listitem></varlistentry>
18250 <term><varname>$tod_log</varname></term>
18253 <indexterm role="variable">
18254 <primary><varname>$tod_log</varname></primary>
18256 The time and date in the format used for writing Exim’s log files, for example:
18257 1995-10-12 15:32:29, but without a timezone.
18259 </listitem></varlistentry>
18261 <term><varname>$tod_logfile</varname></term>
18264 <indexterm role="variable">
18265 <primary><varname>$tod_logfile</varname></primary>
18267 This variable contains the date in the format yyyymmdd. This is the format that
18268 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
18271 </listitem></varlistentry>
18273 <term><varname>$tod_zone</varname></term>
18276 <indexterm role="variable">
18277 <primary><varname>$tod_zone</varname></primary>
18279 This variable contains the numerical value of the local timezone, for example:
18282 </listitem></varlistentry>
18284 <term><varname>$tod_zulu</varname></term>
18287 <indexterm role="variable">
18288 <primary><varname>$tod_zulu</varname></primary>
18290 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
18291 by ISO 8601, for example: 20030221154023Z.
18293 </listitem></varlistentry>
18295 <term><varname>$value</varname></term>
18298 <indexterm role="variable">
18299 <primary><varname>$value</varname></primary>
18301 This variable contains the result of an expansion lookup, extraction operation,
18302 or external command, as described above. It is also used during a
18303 <emphasis role="bold">reduce</emphasis> expansion.
18305 </listitem></varlistentry>
18307 <term><varname>$version_number</varname></term>
18310 <indexterm role="variable">
18311 <primary><varname>$version_number</varname></primary>
18313 The version number of Exim.
18315 </listitem></varlistentry>
18317 <term><varname>$warn_message_delay</varname></term>
18320 <indexterm role="variable">
18321 <primary><varname>$warn_message_delay</varname></primary>
18323 This variable is set only during the creation of a message warning about a
18324 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18326 </listitem></varlistentry>
18328 <term><varname>$warn_message_recipients</varname></term>
18331 <indexterm role="variable">
18332 <primary><varname>$warn_message_recipients</varname></primary>
18334 This variable is set only during the creation of a message warning about a
18335 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
18337 </listitem></varlistentry>
18340 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
18345 <chapter id="CHAPperl">
18346 <title>Embedded Perl</title>
18348 <indexterm role="concept" id="IIDperl" class="startofrange">
18349 <primary>Perl</primary>
18350 <secondary>calling from Exim</secondary>
18352 Exim can be built to include an embedded Perl interpreter. When this is done,
18353 Perl subroutines can be called as part of the string expansion process. To make
18354 use of the Perl support, you need version 5.004 or later of Perl installed on
18355 your system. To include the embedded interpreter in the Exim binary, include
18358 <literallayout class="monospaced">
18362 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
18364 <section id="SECID85">
18365 <title>Setting up so Perl can be used</title>
18367 <indexterm role="option">
18368 <primary><option>perl_startup</option></primary>
18370 Access to Perl subroutines is via a global configuration option called
18371 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
18372 no <option>perl_startup</option> option in the Exim configuration file then no Perl
18373 interpreter is started and there is almost no overhead for Exim (since none of
18374 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
18375 option then the associated value is taken to be Perl code which is executed in
18376 a newly created Perl interpreter.
18379 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
18380 need backslashes before any characters to escape special meanings. The option
18381 should usually be something like
18383 <literallayout class="monospaced">
18384 perl_startup = do '/etc/exim.pl'
18387 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
18388 use from Exim. Exim can be configured either to start up a Perl interpreter as
18389 soon as it is entered, or to wait until the first time it is needed. Starting
18390 the interpreter at the beginning ensures that it is done while Exim still has
18391 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
18392 fact used in a particular run. Also, note that this does not mean that Exim is
18393 necessarily running as root when Perl is called at a later time. By default,
18394 the interpreter is started only when it is needed, but this can be changed in
18400 <indexterm role="option">
18401 <primary><option>perl_at_start</option></primary>
18403 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
18404 a startup when Exim is entered.
18409 The command line option <option>-ps</option> also requests a startup when Exim is entered,
18410 overriding the setting of <option>perl_at_start</option>.
18415 There is also a command line option <option>-pd</option> (for delay) which suppresses the
18416 initial startup, even if <option>perl_at_start</option> is set.
18419 <section id="SECID86">
18420 <title>Calling Perl subroutines</title>
18422 When the configuration file includes a <option>perl_startup</option> option you can make use
18423 of the string expansion item to call the Perl subroutines that are defined
18424 by the <option>perl_startup</option> code. The operator is used in any of the following
18427 <literallayout class="monospaced">
18429 ${perl{foo}{argument}}
18430 ${perl{foo}{argument1}{argument2} ... }
18433 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
18434 arguments may be passed. Passing more than this results in an expansion failure
18435 with an error message of the form
18437 <literallayout class="monospaced">
18438 Too many arguments passed to Perl subroutine "foo" (max is 8)
18441 The return value of the Perl subroutine is evaluated in a scalar context before
18442 it is passed back to Exim to be inserted into the expanded string. If the
18443 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
18444 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
18445 by obeying Perl’s <option>die</option> function, the expansion fails with the error message
18446 that was passed to <option>die</option>.
18449 <section id="SECID87">
18450 <title>Calling Exim functions from Perl</title>
18452 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
18453 is available to call back into Exim’s string expansion function. For example,
18456 <literallayout class="monospaced">
18457 my $lp = Exim::expand_string('$local_part');
18460 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
18461 Note those are single quotes and not double quotes to protect against
18462 <varname>$local_part</varname> being interpolated as a Perl variable.
18465 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
18466 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
18467 expansion string, the Perl call from the original expansion string fails with
18468 an appropriate error message, in the same way as if <option>die</option> were used.
18471 <indexterm role="concept">
18472 <primary>debugging</primary>
18473 <secondary>from embedded Perl</secondary>
18475 <indexterm role="concept">
18476 <primary>log</primary>
18477 <secondary>writing from embedded Perl</secondary>
18479 Two other Exim functions are available for use from within Perl code.
18480 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim’s
18481 debugging is enabled. If you want a newline at the end, you must supply it.
18482 <emphasis>Exim::log_write()</emphasis> writes a string to Exim’s main log, adding a leading
18483 timestamp. In this case, you should not supply a terminating newline.
18486 <section id="SECID88">
18487 <title>Use of standard output and error by Perl</title>
18489 <indexterm role="concept">
18490 <primary>Perl</primary>
18491 <secondary>standard output and error</secondary>
18493 You should not write to the standard error or output streams from within your
18494 Perl code, as it is not defined how these are set up. In versions of Exim
18495 before 4.50, it is possible for the standard output or error to refer to the
18496 SMTP connection during message reception via the daemon. Writing to this stream
18497 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
18498 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
18499 avoided, but the output is lost.
18502 <indexterm role="concept">
18503 <primary>Perl</primary>
18504 <secondary>use of <option>warn</option></secondary>
18506 The Perl <option>warn</option> statement writes to the standard error stream by default.
18507 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
18508 you have no control. When Exim starts up the Perl interpreter, it arranges for
18509 output from the <option>warn</option> statement to be written to the Exim main log. You can
18510 change this by including appropriate Perl magic somewhere in your Perl code.
18511 For example, to discard <option>warn</option> output completely, you need this:
18513 <literallayout class="monospaced">
18514 $SIG{__WARN__} = sub { };
18517 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
18518 example, the code for the subroutine is empty, so it does nothing, but you can
18519 include any Perl code that you like. The text of the <option>warn</option> message is passed
18520 as the first subroutine argument.
18521 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
18526 <chapter id="CHAPinterfaces">
18527 <title>Starting the daemon and the use of network interfaces</title>
18528 <titleabbrev>Starting the daemon</titleabbrev>
18530 <indexterm role="concept">
18531 <primary>daemon</primary>
18532 <secondary>starting</secondary>
18534 <indexterm role="concept">
18535 <primary>interface</primary>
18536 <secondary>listening</secondary>
18538 <indexterm role="concept">
18539 <primary>network interface</primary>
18541 <indexterm role="concept">
18542 <primary>interface</primary>
18543 <secondary>network</secondary>
18545 <indexterm role="concept">
18546 <primary>IP address</primary>
18547 <secondary>for listening</secondary>
18549 <indexterm role="concept">
18550 <primary>daemon</primary>
18551 <secondary>listening IP addresses</secondary>
18553 <indexterm role="concept">
18554 <primary>TCP/IP</primary>
18555 <secondary>setting listening interfaces</secondary>
18557 <indexterm role="concept">
18558 <primary>TCP/IP</primary>
18559 <secondary>setting listening ports</secondary>
18561 A host that is connected to a TCP/IP network may have one or more physical
18562 hardware network interfaces. Each of these interfaces may be configured as one
18563 or more <quote>logical</quote> interfaces, which are the entities that a program actually
18564 works with. Each of these logical interfaces is associated with an IP address.
18565 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
18566 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
18567 knowledge about the host’s interfaces for use in three different circumstances:
18569 <orderedlist numeration="arabic">
18572 When a listening daemon is started, Exim needs to know which interfaces
18573 and ports to listen on.
18578 When Exim is routing an address, it needs to know which IP addresses
18579 are associated with local interfaces. This is required for the correct
18580 processing of MX lists by removing the local host and others with the
18581 same or higher priority values. Also, Exim needs to detect cases
18582 when an address is routed to an IP address that in fact belongs to the
18583 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
18584 option of the smtp transport is set (as appropriate), this is treated
18585 as an error situation.
18590 When Exim connects to a remote host, it may need to know which interface to use
18591 for the outgoing connection.
18596 Exim’s default behaviour is likely to be appropriate in the vast majority
18597 of cases. If your host has only one interface, and you want all its IP
18598 addresses to be treated in the same way, and you are using only the
18599 standard SMTP port, you should not need to take any special action. The
18600 rest of this chapter does not apply to you.
18603 In a more complicated situation you may want to listen only on certain
18604 interfaces, or on different ports, and for this reason there are a number of
18605 options that can be used to influence Exim’s behaviour. The rest of this
18606 chapter describes how they operate.
18609 When a message is received over TCP/IP, the interface and port that were
18610 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
18612 <section id="SECID89">
18613 <title>Starting a listening daemon</title>
18615 When a listening daemon is started (by means of the <option>-bd</option> command line
18616 option), the interfaces and ports on which it listens are controlled by the
18622 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
18623 compatibility, this option can also be specified in the singular.)
18628 <option>local_interfaces</option> contains list of interface IP addresses on which to
18629 listen. Each item may optionally also specify a port.
18634 The default list separator in both cases is a colon, but this can be changed as
18635 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
18636 it is usually best to change the separator to avoid having to double all the
18637 colons. For example:
18639 <literallayout class="monospaced">
18640 local_interfaces = <; 127.0.0.1 ; \
18643 3ffe:ffff:836f::fe86:a061
18646 There are two different formats for specifying a port along with an IP address
18647 in <option>local_interfaces</option>:
18649 <orderedlist numeration="arabic">
18652 The port is added onto the address with a dot separator. For example, to listen
18653 on port 1234 on two different IP addresses:
18655 <literallayout class="monospaced">
18656 local_interfaces = <; 192.168.23.65.1234 ; \
18657 3ffe:ffff:836f::fe86:a061.1234
18662 The IP address is enclosed in square brackets, and the port is added
18663 with a colon separator, for example:
18665 <literallayout class="monospaced">
18666 local_interfaces = <; [192.168.23.65]:1234 ; \
18667 [3ffe:ffff:836f::fe86:a061]:1234
18672 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18673 default setting contains just one port:
18675 <literallayout class="monospaced">
18676 daemon_smtp_ports = smtp
18679 If more than one port is listed, each interface that does not have its own port
18680 specified listens on all of them. Ports that are listed in
18681 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18682 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18683 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18686 <section id="SECID90">
18687 <title>Special IP listening addresses</title>
18689 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18690 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18691 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18692 instead of setting up separate listening sockets for each interface. The
18693 default value of <option>local_interfaces</option> is
18695 <literallayout class="monospaced">
18696 local_interfaces = 0.0.0.0
18699 when Exim is built without IPv6 support; otherwise it is:
18701 <literallayout class="monospaced">
18702 local_interfaces = <; ::0 ; 0.0.0.0
18705 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18708 <section id="SECID91">
18709 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18711 The <option>-oX</option> command line option can be used to override the values of
18712 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18713 instance. Another way of doing this would be to use macros and the <option>-D</option>
18714 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18715 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18719 The value of <option>-oX</option> is a list of items. The default colon separator can be
18720 changed in the usual way if required. If there are any items that do not
18721 contain dots or colons (that is, are not IP addresses), the value of
18722 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18723 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18724 replaced by those items. Thus, for example,
18726 <literallayout class="monospaced">
18730 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18733 <literallayout class="monospaced">
18734 -oX 192.168.34.5.1125
18737 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18738 (However, since <option>local_interfaces</option> now contains no items without ports, the
18739 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18742 <section id="SECTsupobssmt">
18743 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18745 <indexterm role="concept">
18746 <primary>ssmtp protocol</primary>
18748 <indexterm role="concept">
18749 <primary>smtps protocol</primary>
18751 <indexterm role="concept">
18752 <primary>SMTP</primary>
18753 <secondary>ssmtp protocol</secondary>
18755 <indexterm role="concept">
18756 <primary>SMTP</primary>
18757 <secondary>smtps protocol</secondary>
18759 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18760 before the STARTTLS command was standardized for SMTP. Some legacy clients
18761 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18762 list of port numbers, connections to those ports must use SSMTP. The most
18763 common use of this option is expected to be
18765 <literallayout class="monospaced">
18766 tls_on_connect_ports = 465
18769 because 465 is the usual port number used by the legacy clients. There is also
18770 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18771 this way when a daemon is started.
18774 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18775 daemon to listen on those ports. You must still specify them in
18776 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18777 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18778 connections via the daemon.)
18781 <section id="SECID92">
18782 <title>IPv6 address scopes</title>
18784 <indexterm role="concept">
18785 <primary>IPv6</primary>
18786 <secondary>address scopes</secondary>
18788 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18789 can, in principle, have the same link-local IPv6 address on different
18790 interfaces. Thus, additional information is needed, over and above the IP
18791 address, to distinguish individual interfaces. A convention of using a
18792 percent sign followed by something (often the interface name) has been
18793 adopted in some cases, leading to addresses like this:
18795 <literallayout class="monospaced">
18796 fe80::202:b3ff:fe03:45c1%eth0
18799 To accommodate this usage, a percent sign followed by an arbitrary string is
18800 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18801 to convert a textual IPv6 address for actual use. This function recognizes the
18802 percent convention in operating systems that support it, and it processes the
18803 address appropriately. Unfortunately, some older libraries have problems with
18804 <function>getaddrinfo()</function>. If
18806 <literallayout class="monospaced">
18807 IPV6_USE_INET_PTON=yes
18810 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18811 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18812 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18813 function.) Of course, this means that the additional functionality of
18814 <function>getaddrinfo()</function> – recognizing scoped addresses – is lost.
18817 <section id="SECID93">
18818 <title>Disabling IPv6</title>
18820 <indexterm role="concept">
18821 <primary>IPv6</primary>
18822 <secondary>disabling</secondary>
18824 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18825 run on a host whose kernel does not support IPv6. The binary will fall back to
18826 using IPv4, but it may waste resources looking up AAAA records, and trying to
18827 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18828 <indexterm role="option">
18829 <primary><option>disable_ipv6</option></primary>
18831 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18832 activities take place. AAAA records are never looked up, and any IPv6 addresses
18833 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18834 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18835 to handle IPv6 literal addresses.
18838 On the other hand, when IPv6 is in use, there may be times when you want to
18839 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18840 option to globally suppress the lookup of AAAA records for specified domains,
18841 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18842 IPv6 addresses in an individual router.
18845 <section id="SECID94">
18846 <title>Examples of starting a listening daemon</title>
18848 The default case in an IPv6 environment is
18850 <literallayout class="monospaced">
18851 daemon_smtp_ports = smtp
18852 local_interfaces = <; ::0 ; 0.0.0.0
18855 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18856 Either one or two sockets may be used, depending on the characteristics of
18857 the TCP/IP stack. (This is complicated and messy; for more information,
18858 read the comments in the <filename>daemon.c</filename> source file.)
18861 To specify listening on ports 25 and 26 on all interfaces:
18863 <literallayout class="monospaced">
18864 daemon_smtp_ports = 25 : 26
18867 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18869 <literallayout class="monospaced">
18870 local_interfaces = <; ::0.25 ; ::0.26 \
18871 0.0.0.0.25 ; 0.0.0.0.26
18874 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18875 IPv4 loopback address only:
18877 <literallayout class="monospaced">
18878 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18881 To specify listening on the default port on specific interfaces only:
18883 <literallayout class="monospaced">
18884 local_interfaces = 192.168.34.67 : 192.168.34.67
18887 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18890 <section id="SECTreclocipadd">
18891 <title>Recognizing the local host</title>
18893 The <option>local_interfaces</option> option is also used when Exim needs to determine
18894 whether or not an IP address refers to the local host. That is, the IP
18895 addresses of all the interfaces on which a daemon is listening are always
18899 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18900 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18901 available interfaces from the operating system, and extracts the relevant
18902 (that is, IPv4 or IPv6) addresses to use for checking.
18905 Some systems set up large numbers of virtual interfaces in order to provide
18906 many virtual web servers. In this situation, you may want to listen for
18907 email on only a few of the available interfaces, but nevertheless treat all
18908 interfaces as local when routing. You can do this by setting
18909 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18910 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18911 used for listening. Consider this example:
18913 <literallayout class="monospaced">
18914 local_interfaces = <; 127.0.0.1 ; ::1 ; \
18916 3ffe:2101:12:1:a00:20ff:fe86:a061
18918 extra_local_interfaces = <; ::0 ; 0.0.0.0
18921 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18922 address, but all available interface addresses are treated as local when
18926 In some environments the local host name may be in an MX list, but with an IP
18927 address that is not assigned to any local interface. In other cases it may be
18928 desirable to treat other host names as if they referred to the local host. Both
18929 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18930 This contains host names rather than IP addresses. When a host is referenced
18931 during routing, either via an MX record or directly, it is treated as the local
18932 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18933 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18936 <section id="SECID95">
18937 <title>Delivering to a remote host</title>
18939 Delivery to a remote host is handled by the smtp transport. By default, it
18940 allows the system’s TCP/IP functions to choose which interface to use (if
18941 there is more than one) when connecting to a remote host. However, the
18942 <option>interface</option> option can be set to specify which interface is used. See the
18943 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18949 <chapter id="CHAPmainconfig">
18950 <title>Main configuration</title>
18952 <indexterm role="concept" id="IIDconfima" class="startofrange">
18953 <primary>configuration file</primary>
18954 <secondary>main section</secondary>
18956 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18957 <primary>main configuration</primary>
18959 The first part of the run time configuration file contains three types of item:
18964 Macro definitions: These lines start with an upper case letter. See section
18965 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18970 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18971 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18972 section <xref linkend="SECTnamedlists"/>.
18977 Main configuration settings: Each setting occupies one line of the file
18978 (with possible continuations). If any setting is preceded by the word
18979 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18980 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18986 This chapter specifies all the main configuration options, along with their
18987 types and default values. For ease of finding a particular option, they appear
18988 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18989 are now so many options, they are first listed briefly in functional groups, as
18990 an aid to finding the name of the option you are looking for. Some options are
18991 listed in more than one group.
18993 <section id="SECID96">
18994 <title>Miscellaneous</title>
18995 <informaltable frame="none">
18996 <tgroup cols="2" colsep="0" rowsep="0">
18997 <colspec colwidth="196pt" align="left"/>
18998 <colspec colwidth="254pt" align="left"/>
19001 <entry><option>bi_command</option></entry>
19002 <entry>to run for <option>-bi</option> command line option</entry>
19005 <entry><option>disable_ipv6</option></entry>
19006 <entry>do no IPv6 processing</entry>
19009 <entry><option>keep_malformed</option></entry>
19010 <entry>for broken files – should not happen</entry>
19013 <entry><option>localhost_number</option></entry>
19014 <entry>for unique message ids in clusters</entry>
19017 <entry><option>message_body_newlines</option></entry>
19018 <entry>retain newlines in <varname>$message_body</varname></entry>
19021 <entry><option>message_body_visible</option></entry>
19022 <entry>how much to show in <varname>$message_body</varname></entry>
19025 <entry><option>mua_wrapper</option></entry>
19026 <entry>run in <quote>MUA wrapper</quote> mode</entry>
19029 <entry><option>print_topbitchars</option></entry>
19030 <entry>top-bit characters are printing</entry>
19033 <entry><option>timezone</option></entry>
19034 <entry>force time zone</entry>
19040 <section id="SECID97">
19041 <title>Exim parameters</title>
19042 <informaltable frame="none">
19043 <tgroup cols="2" colsep="0" rowsep="0">
19044 <colspec colwidth="196pt" align="left"/>
19045 <colspec colwidth="254pt" align="left"/>
19048 <entry><option>exim_group</option></entry>
19049 <entry>override compiled-in value</entry>
19052 <entry><option>exim_path</option></entry>
19053 <entry>override compiled-in value</entry>
19056 <entry><option>exim_user</option></entry>
19057 <entry>override compiled-in value</entry>
19060 <entry><option>primary_hostname</option></entry>
19061 <entry>default from <function>uname()</function></entry>
19064 <entry><option>split_spool_directory</option></entry>
19065 <entry>use multiple directories</entry>
19068 <entry><option>spool_directory</option></entry>
19069 <entry>override compiled-in value</entry>
19075 <section id="SECID98">
19076 <title>Privilege controls</title>
19077 <informaltable frame="none">
19078 <tgroup cols="2" colsep="0" rowsep="0">
19079 <colspec colwidth="196pt" align="left"/>
19080 <colspec colwidth="254pt" align="left"/>
19083 <entry><option>admin_groups</option></entry>
19084 <entry>groups that are Exim admin users</entry>
19087 <entry><option>deliver_drop_privilege</option></entry>
19088 <entry>drop root for delivery processes</entry>
19091 <entry><option>local_from_check</option></entry>
19092 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
19095 <entry><option>local_from_prefix</option></entry>
19096 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19099 <entry><option>local_from_suffix</option></entry>
19100 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
19103 <entry><option>local_sender_retain</option></entry>
19104 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
19107 <entry><option>never_users</option></entry>
19108 <entry>do not run deliveries as these</entry>
19111 <entry><option>prod_requires_admin</option></entry>
19112 <entry>forced delivery requires admin user</entry>
19115 <entry><option>queue_list_requires_admin</option></entry>
19116 <entry>queue listing requires admin user</entry>
19119 <entry><option>trusted_groups</option></entry>
19120 <entry>groups that are trusted</entry>
19123 <entry><option>trusted_users</option></entry>
19124 <entry>users that are trusted</entry>
19130 <section id="SECID99">
19131 <title>Logging</title>
19132 <informaltable frame="none">
19133 <tgroup cols="2" colsep="0" rowsep="0">
19134 <colspec colwidth="196pt" align="left"/>
19135 <colspec colwidth="254pt" align="left"/>
19138 <entry><option>hosts_connection_nolog</option></entry>
19139 <entry>exemption from connect logging</entry>
19142 <entry><option>log_file_path</option></entry>
19143 <entry>override compiled-in value</entry>
19146 <entry><option>log_selector</option></entry>
19147 <entry>set/unset optional logging</entry>
19150 <entry><option>log_timezone</option></entry>
19151 <entry>add timezone to log lines</entry>
19154 <entry><option>message_logs</option></entry>
19155 <entry>create per-message logs</entry>
19158 <entry><option>preserve_message_logs</option></entry>
19159 <entry>after message completion</entry>
19162 <entry><option>process_log_path</option></entry>
19163 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
19166 <entry><option>syslog_duplication</option></entry>
19167 <entry>controls duplicate log lines on syslog</entry>
19170 <entry><option>syslog_facility</option></entry>
19171 <entry>set syslog <quote>facility</quote> field</entry>
19174 <entry><option>syslog_processname</option></entry>
19175 <entry>set syslog <quote>ident</quote> field</entry>
19178 <entry><option>syslog_timestamp</option></entry>
19179 <entry>timestamp syslog lines</entry>
19182 <entry><option>write_rejectlog</option></entry>
19183 <entry>control use of message log</entry>
19189 <section id="SECID100">
19190 <title>Frozen messages</title>
19191 <informaltable frame="none">
19192 <tgroup cols="2" colsep="0" rowsep="0">
19193 <colspec colwidth="196pt" align="left"/>
19194 <colspec colwidth="254pt" align="left"/>
19197 <entry><option>auto_thaw</option></entry>
19198 <entry>sets time for retrying frozen messages</entry>
19201 <entry><option>freeze_tell</option></entry>
19202 <entry>send message when freezing</entry>
19205 <entry><option>move_frozen_messages</option></entry>
19206 <entry>to another directory</entry>
19209 <entry><option>timeout_frozen_after</option></entry>
19210 <entry>keep frozen messages only so long</entry>
19216 <section id="SECID101">
19217 <title>Data lookups</title>
19218 <informaltable frame="none">
19219 <tgroup cols="2" colsep="0" rowsep="0">
19220 <colspec colwidth="196pt" align="left"/>
19221 <colspec colwidth="254pt" align="left"/>
19224 <entry><option>ibase_servers</option></entry>
19225 <entry>InterBase servers</entry>
19228 <entry><option>ldap_default_servers</option></entry>
19229 <entry>used if no server in query</entry>
19232 <entry><option>ldap_version</option></entry>
19233 <entry>set protocol version</entry>
19236 <entry><option>lookup_open_max</option></entry>
19237 <entry>lookup files held open</entry>
19240 <entry><option>mysql_servers</option></entry>
19241 <entry>default MySQL servers</entry>
19244 <entry><option>oracle_servers</option></entry>
19245 <entry>Oracle servers</entry>
19248 <entry><option>pgsql_servers</option></entry>
19249 <entry>default PostgreSQL servers</entry>
19252 <entry><option>sqlite_lock_timeout</option></entry>
19253 <entry>as it says</entry>
19259 <section id="SECID102">
19260 <title>Message ids</title>
19261 <informaltable frame="none">
19262 <tgroup cols="2" colsep="0" rowsep="0">
19263 <colspec colwidth="196pt" align="left"/>
19264 <colspec colwidth="254pt" align="left"/>
19267 <entry><option>message_id_header_domain</option></entry>
19268 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
19271 <entry><option>message_id_header_text</option></entry>
19272 <entry>ditto</entry>
19278 <section id="SECID103">
19279 <title>Embedded Perl Startup</title>
19280 <informaltable frame="none">
19281 <tgroup cols="2" colsep="0" rowsep="0">
19282 <colspec colwidth="196pt" align="left"/>
19283 <colspec colwidth="254pt" align="left"/>
19286 <entry><option>perl_at_start</option></entry>
19287 <entry>always start the interpreter</entry>
19290 <entry><option>perl_startup</option></entry>
19291 <entry>code to obey when starting Perl</entry>
19297 <section id="SECID104">
19298 <title>Daemon</title>
19299 <informaltable frame="none">
19300 <tgroup cols="2" colsep="0" rowsep="0">
19301 <colspec colwidth="196pt" align="left"/>
19302 <colspec colwidth="254pt" align="left"/>
19305 <entry><option>daemon_smtp_ports</option></entry>
19306 <entry>default ports</entry>
19309 <entry><option>daemon_startup_retries</option></entry>
19310 <entry>number of times to retry</entry>
19313 <entry><option>daemon_startup_sleep</option></entry>
19314 <entry>time to sleep between tries</entry>
19317 <entry><option>extra_local_interfaces</option></entry>
19318 <entry>not necessarily listened on</entry>
19321 <entry><option>local_interfaces</option></entry>
19322 <entry>on which to listen, with optional ports</entry>
19325 <entry><option>pid_file_path</option></entry>
19326 <entry>override compiled-in value</entry>
19329 <entry><option>queue_run_max</option></entry>
19330 <entry>maximum simultaneous queue runners</entry>
19336 <section id="SECID105">
19337 <title>Resource control</title>
19338 <informaltable frame="none">
19339 <tgroup cols="2" colsep="0" rowsep="0">
19340 <colspec colwidth="196pt" align="left"/>
19341 <colspec colwidth="254pt" align="left"/>
19344 <entry><option>check_log_inodes</option></entry>
19345 <entry>before accepting a message</entry>
19348 <entry><option>check_log_space</option></entry>
19349 <entry>before accepting a message</entry>
19352 <entry><option>check_spool_inodes</option></entry>
19353 <entry>before accepting a message</entry>
19356 <entry><option>check_spool_space</option></entry>
19357 <entry>before accepting a message</entry>
19360 <entry><option>deliver_queue_load_max</option></entry>
19361 <entry>no queue deliveries if load high</entry>
19364 <entry><option>queue_only_load</option></entry>
19365 <entry>queue incoming if load high</entry>
19368 <entry><option>queue_only_load_latch</option></entry>
19369 <entry>don’t re-evaluate load for each message</entry>
19372 <entry><option>queue_run_max</option></entry>
19373 <entry>maximum simultaneous queue runners</entry>
19376 <entry><option>remote_max_parallel</option></entry>
19377 <entry>parallel SMTP delivery per message</entry>
19380 <entry><option>smtp_accept_max</option></entry>
19381 <entry>simultaneous incoming connections</entry>
19384 <entry><option>smtp_accept_max_nonmail</option></entry>
19385 <entry>non-mail commands</entry>
19388 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19389 <entry>hosts to which the limit applies</entry>
19392 <entry><option>smtp_accept_max_per_connection</option></entry>
19393 <entry>messages per connection</entry>
19396 <entry><option>smtp_accept_max_per_host</option></entry>
19397 <entry>connections from one host</entry>
19400 <entry><option>smtp_accept_queue</option></entry>
19401 <entry>queue mail if more connections</entry>
19404 <entry><option>smtp_accept_queue_per_connection</option></entry>
19405 <entry>queue if more messages per connection</entry>
19408 <entry><option>smtp_accept_reserve</option></entry>
19409 <entry>only reserve hosts if more connections</entry>
19412 <entry><option>smtp_check_spool_space</option></entry>
19413 <entry>from SIZE on MAIL command</entry>
19416 <entry><option>smtp_connect_backlog</option></entry>
19417 <entry>passed to TCP/IP stack</entry>
19420 <entry><option>smtp_load_reserve</option></entry>
19421 <entry>SMTP from reserved hosts if load high</entry>
19424 <entry><option>smtp_reserve_hosts</option></entry>
19425 <entry>these are the reserve hosts</entry>
19431 <section id="SECID106">
19432 <title>Policy controls</title>
19433 <informaltable frame="none">
19434 <tgroup cols="2" colsep="0" rowsep="0">
19435 <colspec colwidth="196pt" align="left"/>
19436 <colspec colwidth="254pt" align="left"/>
19439 <entry><option>acl_not_smtp</option></entry>
19440 <entry>ACL for non-SMTP messages</entry>
19443 <entry><option>acl_not_smtp_mime</option></entry>
19444 <entry>ACL for non-SMTP MIME parts</entry>
19447 <entry><option>acl_not_smtp_start</option></entry>
19448 <entry>ACL for start of non-SMTP message</entry>
19451 <entry><option>acl_smtp_auth</option></entry>
19452 <entry>ACL for AUTH</entry>
19455 <entry><option>acl_smtp_connect</option></entry>
19456 <entry>ACL for connection</entry>
19459 <entry><option>acl_smtp_data</option></entry>
19460 <entry>ACL for DATA</entry>
19463 <entry><option>acl_smtp_dkim</option></entry>
19464 <entry>ACL for DKIM verification</entry>
19467 <entry><option>acl_smtp_etrn</option></entry>
19468 <entry>ACL for ETRN</entry>
19471 <entry><option>acl_smtp_expn</option></entry>
19472 <entry>ACL for EXPN</entry>
19475 <entry><option>acl_smtp_helo</option></entry>
19476 <entry>ACL for EHLO or HELO</entry>
19479 <entry><option>acl_smtp_mail</option></entry>
19480 <entry>ACL for MAIL</entry>
19483 <entry><option>acl_smtp_mailauth</option></entry>
19484 <entry>ACL for AUTH on MAIL command</entry>
19487 <entry><option>acl_smtp_mime</option></entry>
19488 <entry>ACL for MIME parts</entry>
19491 <entry><option>acl_smtp_predata</option></entry>
19492 <entry>ACL for start of data</entry>
19495 <entry><option>acl_smtp_quit</option></entry>
19496 <entry>ACL for QUIT</entry>
19499 <entry><option>acl_smtp_rcpt</option></entry>
19500 <entry>ACL for RCPT</entry>
19503 <entry><option>acl_smtp_starttls</option></entry>
19504 <entry>ACL for STARTTLS</entry>
19507 <entry><option>acl_smtp_vrfy</option></entry>
19508 <entry>ACL for VRFY</entry>
19511 <entry><option>av_scanner</option></entry>
19512 <entry>specify virus scanner</entry>
19515 <entry><option>check_rfc2047_length</option></entry>
19516 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19519 <entry><option>dns_csa_search_limit</option></entry>
19520 <entry>control CSA parent search depth</entry>
19523 <entry><option>dns_csa_use_reverse</option></entry>
19524 <entry>en/disable CSA IP reverse search</entry>
19527 <entry><option>header_maxsize</option></entry>
19528 <entry>total size of message header</entry>
19531 <entry><option>header_line_maxsize</option></entry>
19532 <entry>individual header line limit</entry>
19535 <entry><option>helo_accept_junk_hosts</option></entry>
19536 <entry>allow syntactic junk from these hosts</entry>
19539 <entry><option>helo_allow_chars</option></entry>
19540 <entry>allow illegal chars in HELO names</entry>
19543 <entry><option>helo_lookup_domains</option></entry>
19544 <entry>lookup hostname for these HELO names</entry>
19547 <entry><option>helo_try_verify_hosts</option></entry>
19548 <entry>HELO soft-checked for these hosts</entry>
19551 <entry><option>helo_verify_hosts</option></entry>
19552 <entry>HELO hard-checked for these hosts</entry>
19555 <entry><option>host_lookup</option></entry>
19556 <entry>host name looked up for these hosts</entry>
19559 <entry><option>host_lookup_order</option></entry>
19560 <entry>order of DNS and local name lookups</entry>
19563 <entry><option>host_reject_connection</option></entry>
19564 <entry>reject connection from these hosts</entry>
19567 <entry><option>hosts_treat_as_local</option></entry>
19568 <entry>useful in some cluster configurations</entry>
19571 <entry><option>local_scan_timeout</option></entry>
19572 <entry>timeout for <function>local_scan()</function></entry>
19575 <entry><option>message_size_limit</option></entry>
19576 <entry>for all messages</entry>
19579 <entry><option>percent_hack_domains</option></entry>
19580 <entry>recognize %-hack for these domains</entry>
19583 <entry><option>spamd_address</option></entry>
19584 <entry>set interface to SpamAssassin</entry>
19587 <entry><option>strict_acl_vars</option></entry>
19588 <entry>object to unset ACL variables</entry>
19594 <section id="SECID107">
19595 <title>Callout cache</title>
19596 <informaltable frame="none">
19597 <tgroup cols="2" colsep="0" rowsep="0">
19598 <colspec colwidth="196pt" align="left"/>
19599 <colspec colwidth="254pt" align="left"/>
19602 <entry><option>callout_domain_negative_expire</option></entry>
19603 <entry>timeout for negative domain cache item</entry>
19606 <entry><option>callout_domain_positive_expire</option></entry>
19607 <entry>timeout for positive domain cache item</entry>
19610 <entry><option>callout_negative_expire</option></entry>
19611 <entry>timeout for negative address cache item</entry>
19614 <entry><option>callout_positive_expire</option></entry>
19615 <entry>timeout for positive address cache item</entry>
19618 <entry><option>callout_random_local_part</option></entry>
19619 <entry>string to use for <quote>random</quote> testing</entry>
19625 <section id="SECID108">
19627 <informaltable frame="none">
19628 <tgroup cols="2" colsep="0" rowsep="0">
19629 <colspec colwidth="196pt" align="left"/>
19630 <colspec colwidth="254pt" align="left"/>
19633 <entry><option>gnutls_require_kx</option></entry>
19634 <entry>control GnuTLS key exchanges</entry>
19637 <entry><option>gnutls_require_mac</option></entry>
19638 <entry>control GnuTLS MAC algorithms</entry>
19641 <entry><option>gnutls_require_protocols</option></entry>
19642 <entry>control GnuTLS protocols</entry>
19645 <entry><option>gnutls_compat_mode</option></entry>
19646 <entry>use GnuTLS compatibility mode</entry>
19649 <entry><option>openssl_options</option></entry>
19650 <entry>adjust OpenSSL compatibility options</entry>
19653 <entry><option>tls_advertise_hosts</option></entry>
19654 <entry>advertise TLS to these hosts</entry>
19657 <entry><option>tls_certificate</option></entry>
19658 <entry>location of server certificate</entry>
19661 <entry><option>tls_crl</option></entry>
19662 <entry>certificate revocation list</entry>
19665 <entry><option>tls_dhparam</option></entry>
19666 <entry>DH parameters for server</entry>
19669 <entry><option>tls_on_connect_ports</option></entry>
19670 <entry>specify SSMTP (SMTPS) ports</entry>
19673 <entry><option>tls_privatekey</option></entry>
19674 <entry>location of server private key</entry>
19677 <entry><option>tls_remember_esmtp</option></entry>
19678 <entry>don’t reset after starting TLS</entry>
19681 <entry><option>tls_require_ciphers</option></entry>
19682 <entry>specify acceptable ciphers</entry>
19685 <entry><option>tls_try_verify_hosts</option></entry>
19686 <entry>try to verify client certificate</entry>
19689 <entry><option>tls_verify_certificates</option></entry>
19690 <entry>expected client certificates</entry>
19693 <entry><option>tls_verify_hosts</option></entry>
19694 <entry>insist on client certificate verify</entry>
19700 <section id="SECID109">
19701 <title>Local user handling</title>
19702 <informaltable frame="none">
19703 <tgroup cols="2" colsep="0" rowsep="0">
19704 <colspec colwidth="196pt" align="left"/>
19705 <colspec colwidth="254pt" align="left"/>
19708 <entry><option>finduser_retries</option></entry>
19709 <entry>useful in NIS environments</entry>
19712 <entry><option>gecos_name</option></entry>
19713 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19716 <entry><option>gecos_pattern</option></entry>
19717 <entry>ditto</entry>
19720 <entry><option>max_username_length</option></entry>
19721 <entry>for systems that truncate</entry>
19724 <entry><option>unknown_login</option></entry>
19725 <entry>used when no login name found</entry>
19728 <entry><option>unknown_username</option></entry>
19729 <entry>ditto</entry>
19732 <entry><option>uucp_from_pattern</option></entry>
19733 <entry>for recognizing <quote>From </quote> lines</entry>
19736 <entry><option>uucp_from_sender</option></entry>
19737 <entry>ditto</entry>
19743 <section id="SECID110">
19744 <title>All incoming messages (SMTP and non-SMTP)</title>
19745 <informaltable frame="none">
19746 <tgroup cols="2" colsep="0" rowsep="0">
19747 <colspec colwidth="196pt" align="left"/>
19748 <colspec colwidth="254pt" align="left"/>
19751 <entry><option>header_maxsize</option></entry>
19752 <entry>total size of message header</entry>
19755 <entry><option>header_line_maxsize</option></entry>
19756 <entry>individual header line limit</entry>
19759 <entry><option>message_size_limit</option></entry>
19760 <entry>applies to all messages</entry>
19763 <entry><option>percent_hack_domains</option></entry>
19764 <entry>recognize %-hack for these domains</entry>
19767 <entry><option>received_header_text</option></entry>
19768 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19771 <entry><option>received_headers_max</option></entry>
19772 <entry>for mail loop detection</entry>
19775 <entry><option>recipients_max</option></entry>
19776 <entry>limit per message</entry>
19779 <entry><option>recipients_max_reject</option></entry>
19780 <entry>permanently reject excess recipients</entry>
19786 <section id="SECID111">
19787 <title>Non-SMTP incoming messages</title>
19788 <informaltable frame="none">
19789 <tgroup cols="2" colsep="0" rowsep="0">
19790 <colspec colwidth="196pt" align="left"/>
19791 <colspec colwidth="254pt" align="left"/>
19794 <entry><option>receive_timeout</option></entry>
19795 <entry>for non-SMTP messages</entry>
19801 <section id="SECID112">
19802 <title>Incoming SMTP messages</title>
19804 See also the <emphasis>Policy controls</emphasis> section above.
19806 <informaltable frame="none">
19807 <tgroup cols="2" colsep="0" rowsep="0">
19808 <colspec colwidth="196pt" align="left"/>
19809 <colspec colwidth="254pt" align="left"/>
19812 <entry><option>host_lookup</option></entry>
19813 <entry>host name looked up for these hosts</entry>
19816 <entry><option>host_lookup_order</option></entry>
19817 <entry>order of DNS and local name lookups</entry>
19820 <entry><option>recipient_unqualified_hosts</option></entry>
19821 <entry>may send unqualified recipients</entry>
19824 <entry><option>rfc1413_hosts</option></entry>
19825 <entry>make ident calls to these hosts</entry>
19828 <entry><option>rfc1413_query_timeout</option></entry>
19829 <entry>zero disables ident calls</entry>
19832 <entry><option>sender_unqualified_hosts</option></entry>
19833 <entry>may send unqualified senders</entry>
19836 <entry><option>smtp_accept_keepalive</option></entry>
19837 <entry>some TCP/IP magic</entry>
19840 <entry><option>smtp_accept_max</option></entry>
19841 <entry>simultaneous incoming connections</entry>
19844 <entry><option>smtp_accept_max_nonmail</option></entry>
19845 <entry>non-mail commands</entry>
19848 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19849 <entry>hosts to which the limit applies</entry>
19852 <entry><option>smtp_accept_max_per_connection</option></entry>
19853 <entry>messages per connection</entry>
19856 <entry><option>smtp_accept_max_per_host</option></entry>
19857 <entry>connections from one host</entry>
19860 <entry><option>smtp_accept_queue</option></entry>
19861 <entry>queue mail if more connections</entry>
19864 <entry><option>smtp_accept_queue_per_connection</option></entry>
19865 <entry>queue if more messages per connection</entry>
19868 <entry><option>smtp_accept_reserve</option></entry>
19869 <entry>only reserve hosts if more connections</entry>
19872 <entry><option>smtp_active_hostname</option></entry>
19873 <entry>host name to use in messages</entry>
19876 <entry><option>smtp_banner</option></entry>
19877 <entry>text for welcome banner</entry>
19880 <entry><option>smtp_check_spool_space</option></entry>
19881 <entry>from SIZE on MAIL command</entry>
19884 <entry><option>smtp_connect_backlog</option></entry>
19885 <entry>passed to TCP/IP stack</entry>
19888 <entry><option>smtp_enforce_sync</option></entry>
19889 <entry>of SMTP command/responses</entry>
19892 <entry><option>smtp_etrn_command</option></entry>
19893 <entry>what to run for ETRN</entry>
19896 <entry><option>smtp_etrn_serialize</option></entry>
19897 <entry>only one at once</entry>
19900 <entry><option>smtp_load_reserve</option></entry>
19901 <entry>only reserve hosts if this load</entry>
19904 <entry><option>smtp_max_unknown_commands</option></entry>
19905 <entry>before dropping connection</entry>
19908 <entry><option>smtp_ratelimit_hosts</option></entry>
19909 <entry>apply ratelimiting to these hosts</entry>
19912 <entry><option>smtp_ratelimit_mail</option></entry>
19913 <entry>ratelimit for MAIL commands</entry>
19916 <entry><option>smtp_ratelimit_rcpt</option></entry>
19917 <entry>ratelimit for RCPT commands</entry>
19920 <entry><option>smtp_receive_timeout</option></entry>
19921 <entry>per command or data line</entry>
19924 <entry><option>smtp_reserve_hosts</option></entry>
19925 <entry>these are the reserve hosts</entry>
19928 <entry><option>smtp_return_error_details</option></entry>
19929 <entry>give detail on rejections</entry>
19935 <section id="SECID113">
19936 <title>SMTP extensions</title>
19937 <informaltable frame="none">
19938 <tgroup cols="2" colsep="0" rowsep="0">
19939 <colspec colwidth="196pt" align="left"/>
19940 <colspec colwidth="254pt" align="left"/>
19943 <entry><option>accept_8bitmime</option></entry>
19944 <entry>advertise 8BITMIME</entry>
19947 <entry><option>auth_advertise_hosts</option></entry>
19948 <entry>advertise AUTH to these hosts</entry>
19951 <entry><option>ignore_fromline_hosts</option></entry>
19952 <entry>allow <quote>From </quote> from these hosts</entry>
19955 <entry><option>ignore_fromline_local</option></entry>
19956 <entry>allow <quote>From </quote> from local SMTP</entry>
19959 <entry><option>pipelining_advertise_hosts</option></entry>
19960 <entry>advertise pipelining to these hosts</entry>
19963 <entry><option>tls_advertise_hosts</option></entry>
19964 <entry>advertise TLS to these hosts</entry>
19970 <section id="SECID114">
19971 <title>Processing messages</title>
19972 <informaltable frame="none">
19973 <tgroup cols="2" colsep="0" rowsep="0">
19974 <colspec colwidth="196pt" align="left"/>
19975 <colspec colwidth="254pt" align="left"/>
19978 <entry><option>allow_domain_literals</option></entry>
19979 <entry>recognize domain literal syntax</entry>
19982 <entry><option>allow_mx_to_ip</option></entry>
19983 <entry>allow MX to point to IP address</entry>
19986 <entry><option>allow_utf8_domains</option></entry>
19987 <entry>in addresses</entry>
19990 <entry><option>check_rfc2047_length</option></entry>
19991 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19994 <entry><option>delivery_date_remove</option></entry>
19995 <entry>from incoming messages</entry>
19998 <entry><option>envelope_to_remove</option></entry>
19999 <entry>from incoming messages</entry>
20002 <entry><option>extract_addresses_remove_arguments</option></entry>
20003 <entry>affects <option>-t</option> processing</entry>
20006 <entry><option>headers_charset</option></entry>
20007 <entry>default for translations</entry>
20010 <entry><option>qualify_domain</option></entry>
20011 <entry>default for senders</entry>
20014 <entry><option>qualify_recipient</option></entry>
20015 <entry>default for recipients</entry>
20018 <entry><option>return_path_remove</option></entry>
20019 <entry>from incoming messages</entry>
20022 <entry><option>strip_excess_angle_brackets</option></entry>
20023 <entry>in addresses</entry>
20026 <entry><option>strip_trailing_dot</option></entry>
20027 <entry>at end of addresses</entry>
20030 <entry><option>untrusted_set_sender</option></entry>
20031 <entry>untrusted can set envelope sender</entry>
20037 <section id="SECID115">
20038 <title>System filter</title>
20039 <informaltable frame="none">
20040 <tgroup cols="2" colsep="0" rowsep="0">
20041 <colspec colwidth="196pt" align="left"/>
20042 <colspec colwidth="254pt" align="left"/>
20045 <entry><option>system_filter</option></entry>
20046 <entry>locate system filter</entry>
20049 <entry><option>system_filter_directory_transport</option></entry>
20050 <entry>transport for delivery to a directory</entry>
20053 <entry><option>system_filter_file_transport</option></entry>
20054 <entry>transport for delivery to a file</entry>
20057 <entry><option>system_filter_group</option></entry>
20058 <entry>group for filter running</entry>
20061 <entry><option>system_filter_pipe_transport</option></entry>
20062 <entry>transport for delivery to a pipe</entry>
20065 <entry><option>system_filter_reply_transport</option></entry>
20066 <entry>transport for autoreply delivery</entry>
20069 <entry><option>system_filter_user</option></entry>
20070 <entry>user for filter running</entry>
20076 <section id="SECID116">
20077 <title>Routing and delivery</title>
20078 <informaltable frame="none">
20079 <tgroup cols="2" colsep="0" rowsep="0">
20080 <colspec colwidth="196pt" align="left"/>
20081 <colspec colwidth="254pt" align="left"/>
20084 <entry><option>disable_ipv6</option></entry>
20085 <entry>do no IPv6 processing</entry>
20088 <entry><option>dns_again_means_nonexist</option></entry>
20089 <entry>for broken domains</entry>
20092 <entry><option>dns_check_names_pattern</option></entry>
20093 <entry>pre-DNS syntax check</entry>
20096 <entry><option>dns_ipv4_lookup</option></entry>
20097 <entry>only v4 lookup for these domains</entry>
20100 <entry><option>dns_retrans</option></entry>
20101 <entry>parameter for resolver</entry>
20104 <entry><option>dns_retry</option></entry>
20105 <entry>parameter for resolver</entry>
20108 <entry><option>hold_domains</option></entry>
20109 <entry>hold delivery for these domains</entry>
20112 <entry><option>local_interfaces</option></entry>
20113 <entry>for routing checks</entry>
20116 <entry><option>queue_domains</option></entry>
20117 <entry>no immediate delivery for these</entry>
20120 <entry><option>queue_only</option></entry>
20121 <entry>no immediate delivery at all</entry>
20124 <entry><option>queue_only_file</option></entry>
20125 <entry>no immediate delivery if file exists</entry>
20128 <entry><option>queue_only_load</option></entry>
20129 <entry>no immediate delivery if load is high</entry>
20132 <entry><option>queue_only_load_latch</option></entry>
20133 <entry>don’t re-evaluate load for each message</entry>
20136 <entry><option>queue_only_override</option></entry>
20137 <entry>allow command line to override</entry>
20140 <entry><option>queue_run_in_order</option></entry>
20141 <entry>order of arrival</entry>
20144 <entry><option>queue_run_max</option></entry>
20145 <entry>of simultaneous queue runners</entry>
20148 <entry><option>queue_smtp_domains</option></entry>
20149 <entry>no immediate SMTP delivery for these</entry>
20152 <entry><option>remote_max_parallel</option></entry>
20153 <entry>parallel SMTP delivery per message</entry>
20156 <entry><option>remote_sort_domains</option></entry>
20157 <entry>order of remote deliveries</entry>
20160 <entry><option>retry_data_expire</option></entry>
20161 <entry>timeout for retry data</entry>
20164 <entry><option>retry_interval_max</option></entry>
20165 <entry>safety net for retry rules</entry>
20171 <section id="SECID117">
20172 <title>Bounce and warning messages</title>
20173 <informaltable frame="none">
20174 <tgroup cols="2" colsep="0" rowsep="0">
20175 <colspec colwidth="196pt" align="left"/>
20176 <colspec colwidth="254pt" align="left"/>
20179 <entry><option>bounce_message_file</option></entry>
20180 <entry>content of bounce</entry>
20183 <entry><option>bounce_message_text</option></entry>
20184 <entry>content of bounce</entry>
20187 <entry><option>bounce_return_body</option></entry>
20188 <entry>include body if returning message</entry>
20191 <entry><option>bounce_return_message</option></entry>
20192 <entry>include original message in bounce</entry>
20195 <entry><option>bounce_return_size_limit</option></entry>
20196 <entry>limit on returned message</entry>
20199 <entry><option>bounce_sender_authentication</option></entry>
20200 <entry>send authenticated sender with bounce</entry>
20203 <entry><option>dsn_from</option></entry>
20204 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
20207 <entry><option>errors_copy</option></entry>
20208 <entry>copy bounce messages</entry>
20211 <entry><option>errors_reply_to</option></entry>
20212 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
20215 <entry><option>delay_warning</option></entry>
20216 <entry>time schedule</entry>
20219 <entry><option>delay_warning_condition</option></entry>
20220 <entry>condition for warning messages</entry>
20223 <entry><option>ignore_bounce_errors_after</option></entry>
20224 <entry>discard undeliverable bounces</entry>
20227 <entry><option>smtp_return_error_details</option></entry>
20228 <entry>give detail on rejections</entry>
20231 <entry><option>warn_message_file</option></entry>
20232 <entry>content of warning message</entry>
20238 <section id="SECTalomo">
20239 <title>Alphabetical list of main options</title>
20241 Those options that undergo string expansion before use are marked with
20245 <indexterm role="option">
20246 <primary><option>accept_8bitmime</option></primary>
20249 <informaltable frame="all">
20250 <tgroup cols="4" colsep="0" rowsep="0">
20251 <colspec colwidth="8*" align="left"/>
20252 <colspec colwidth="6*" align="center"/>
20253 <colspec colwidth="6*" align="center"/>
20254 <colspec colwidth="6*" align="right"/>
20257 <entry><option>accept_8bitmime</option></entry>
20258 <entry>Use: <emphasis>main</emphasis></entry>
20259 <entry>Type: <emphasis>boolean</emphasis></entry>
20260 <entry>Default: <emphasis>false</emphasis></entry>
20266 <indexterm role="concept">
20267 <primary>8BITMIME</primary>
20269 <indexterm role="concept">
20270 <primary>8-bit characters</primary>
20272 This option causes Exim to send 8BITMIME in its response to an SMTP
20273 EHLO command, and to accept the BODY= parameter on MAIL commands.
20274 However, though Exim is 8-bit clean, it is not a protocol converter, and it
20275 takes no steps to do anything special with messages received by this route.
20276 Consequently, this option is turned off by default.
20279 <indexterm role="option">
20280 <primary><option>acl_not_smtp</option></primary>
20283 <informaltable frame="all">
20284 <tgroup cols="4" colsep="0" rowsep="0">
20285 <colspec colwidth="8*" align="left"/>
20286 <colspec colwidth="6*" align="center"/>
20287 <colspec colwidth="6*" align="center"/>
20288 <colspec colwidth="6*" align="right"/>
20291 <entry><option>acl_not_smtp</option></entry>
20292 <entry>Use: <emphasis>main</emphasis></entry>
20293 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20294 <entry>Default: <emphasis>unset</emphasis></entry>
20300 <indexterm role="concept">
20301 <primary>access control lists (ACLs)</primary>
20302 <secondary>for non-SMTP messages</secondary>
20304 <indexterm role="concept">
20305 <primary>non-SMTP messages</primary>
20306 <secondary>ACLs for</secondary>
20308 This option defines the ACL that is run when a non-SMTP message has been
20309 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
20313 <indexterm role="option">
20314 <primary><option>acl_not_smtp_mime</option></primary>
20317 <informaltable frame="all">
20318 <tgroup cols="4" colsep="0" rowsep="0">
20319 <colspec colwidth="8*" align="left"/>
20320 <colspec colwidth="6*" align="center"/>
20321 <colspec colwidth="6*" align="center"/>
20322 <colspec colwidth="6*" align="right"/>
20325 <entry><option>acl_not_smtp_mime</option></entry>
20326 <entry>Use: <emphasis>main</emphasis></entry>
20327 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20328 <entry>Default: <emphasis>unset</emphasis></entry>
20334 This option defines the ACL that is run for individual MIME parts of non-SMTP
20335 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
20339 <indexterm role="option">
20340 <primary><option>acl_not_smtp_start</option></primary>
20343 <informaltable frame="all">
20344 <tgroup cols="4" colsep="0" rowsep="0">
20345 <colspec colwidth="8*" align="left"/>
20346 <colspec colwidth="6*" align="center"/>
20347 <colspec colwidth="6*" align="center"/>
20348 <colspec colwidth="6*" align="right"/>
20351 <entry><option>acl_not_smtp_start</option></entry>
20352 <entry>Use: <emphasis>main</emphasis></entry>
20353 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20354 <entry>Default: <emphasis>unset</emphasis></entry>
20360 <indexterm role="concept">
20361 <primary>access control lists (ACLs)</primary>
20362 <secondary>at start of non-SMTP message</secondary>
20364 <indexterm role="concept">
20365 <primary>non-SMTP messages</primary>
20366 <secondary>ACLs for</secondary>
20368 This option defines the ACL that is run before Exim starts reading a
20369 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
20372 <indexterm role="option">
20373 <primary><option>acl_smtp_auth</option></primary>
20376 <informaltable frame="all">
20377 <tgroup cols="4" colsep="0" rowsep="0">
20378 <colspec colwidth="8*" align="left"/>
20379 <colspec colwidth="6*" align="center"/>
20380 <colspec colwidth="6*" align="center"/>
20381 <colspec colwidth="6*" align="right"/>
20384 <entry><option>acl_smtp_auth</option></entry>
20385 <entry>Use: <emphasis>main</emphasis></entry>
20386 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20387 <entry>Default: <emphasis>unset</emphasis></entry>
20393 <indexterm role="concept">
20394 <primary>access control lists (ACLs)</primary>
20395 <secondary>setting up for SMTP commands</secondary>
20397 <indexterm role="concept">
20398 <primary>AUTH</primary>
20399 <secondary>ACL for</secondary>
20401 This option defines the ACL that is run when an SMTP AUTH command is
20402 received. See chapter <xref linkend="CHAPACL"/> for further details.
20405 <indexterm role="option">
20406 <primary><option>acl_smtp_connect</option></primary>
20409 <informaltable frame="all">
20410 <tgroup cols="4" colsep="0" rowsep="0">
20411 <colspec colwidth="8*" align="left"/>
20412 <colspec colwidth="6*" align="center"/>
20413 <colspec colwidth="6*" align="center"/>
20414 <colspec colwidth="6*" align="right"/>
20417 <entry><option>acl_smtp_connect</option></entry>
20418 <entry>Use: <emphasis>main</emphasis></entry>
20419 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20420 <entry>Default: <emphasis>unset</emphasis></entry>
20426 <indexterm role="concept">
20427 <primary>access control lists (ACLs)</primary>
20428 <secondary>on SMTP connection</secondary>
20430 This option defines the ACL that is run when an SMTP connection is received.
20431 See chapter <xref linkend="CHAPACL"/> for further details.
20434 <indexterm role="option">
20435 <primary><option>acl_smtp_data</option></primary>
20438 <informaltable frame="all">
20439 <tgroup cols="4" colsep="0" rowsep="0">
20440 <colspec colwidth="8*" align="left"/>
20441 <colspec colwidth="6*" align="center"/>
20442 <colspec colwidth="6*" align="center"/>
20443 <colspec colwidth="6*" align="right"/>
20446 <entry><option>acl_smtp_data</option></entry>
20447 <entry>Use: <emphasis>main</emphasis></entry>
20448 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20449 <entry>Default: <emphasis>unset</emphasis></entry>
20455 <indexterm role="concept">
20456 <primary>DATA</primary>
20457 <secondary>ACL for</secondary>
20459 This option defines the ACL that is run after an SMTP DATA command has been
20460 processed and the message itself has been received, but before the final
20461 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
20464 <indexterm role="option">
20465 <primary><option>acl_smtp_etrn</option></primary>
20468 <informaltable frame="all">
20469 <tgroup cols="4" colsep="0" rowsep="0">
20470 <colspec colwidth="8*" align="left"/>
20471 <colspec colwidth="6*" align="center"/>
20472 <colspec colwidth="6*" align="center"/>
20473 <colspec colwidth="6*" align="right"/>
20476 <entry><option>acl_smtp_etrn</option></entry>
20477 <entry>Use: <emphasis>main</emphasis></entry>
20478 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20479 <entry>Default: <emphasis>unset</emphasis></entry>
20485 <indexterm role="concept">
20486 <primary>ETRN</primary>
20487 <secondary>ACL for</secondary>
20489 This option defines the ACL that is run when an SMTP ETRN command is
20490 received. See chapter <xref linkend="CHAPACL"/> for further details.
20493 <indexterm role="option">
20494 <primary><option>acl_smtp_expn</option></primary>
20497 <informaltable frame="all">
20498 <tgroup cols="4" colsep="0" rowsep="0">
20499 <colspec colwidth="8*" align="left"/>
20500 <colspec colwidth="6*" align="center"/>
20501 <colspec colwidth="6*" align="center"/>
20502 <colspec colwidth="6*" align="right"/>
20505 <entry><option>acl_smtp_expn</option></entry>
20506 <entry>Use: <emphasis>main</emphasis></entry>
20507 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20508 <entry>Default: <emphasis>unset</emphasis></entry>
20514 <indexterm role="concept">
20515 <primary>EXPN</primary>
20516 <secondary>ACL for</secondary>
20518 This option defines the ACL that is run when an SMTP EXPN command is
20519 received. See chapter <xref linkend="CHAPACL"/> for further details.
20522 <indexterm role="option">
20523 <primary><option>acl_smtp_helo</option></primary>
20526 <informaltable frame="all">
20527 <tgroup cols="4" colsep="0" rowsep="0">
20528 <colspec colwidth="8*" align="left"/>
20529 <colspec colwidth="6*" align="center"/>
20530 <colspec colwidth="6*" align="center"/>
20531 <colspec colwidth="6*" align="right"/>
20534 <entry><option>acl_smtp_helo</option></entry>
20535 <entry>Use: <emphasis>main</emphasis></entry>
20536 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20537 <entry>Default: <emphasis>unset</emphasis></entry>
20543 <indexterm role="concept">
20544 <primary>EHLO</primary>
20545 <secondary>ACL for</secondary>
20547 <indexterm role="concept">
20548 <primary>HELO</primary>
20549 <secondary>ACL for</secondary>
20551 This option defines the ACL that is run when an SMTP EHLO or HELO
20552 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
20555 <indexterm role="option">
20556 <primary><option>acl_smtp_mail</option></primary>
20559 <informaltable frame="all">
20560 <tgroup cols="4" colsep="0" rowsep="0">
20561 <colspec colwidth="8*" align="left"/>
20562 <colspec colwidth="6*" align="center"/>
20563 <colspec colwidth="6*" align="center"/>
20564 <colspec colwidth="6*" align="right"/>
20567 <entry><option>acl_smtp_mail</option></entry>
20568 <entry>Use: <emphasis>main</emphasis></entry>
20569 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20570 <entry>Default: <emphasis>unset</emphasis></entry>
20576 <indexterm role="concept">
20577 <primary>MAIL</primary>
20578 <secondary>ACL for</secondary>
20580 This option defines the ACL that is run when an SMTP MAIL command is
20581 received. See chapter <xref linkend="CHAPACL"/> for further details.
20584 <indexterm role="option">
20585 <primary><option>acl_smtp_mailauth</option></primary>
20588 <informaltable frame="all">
20589 <tgroup cols="4" colsep="0" rowsep="0">
20590 <colspec colwidth="8*" align="left"/>
20591 <colspec colwidth="6*" align="center"/>
20592 <colspec colwidth="6*" align="center"/>
20593 <colspec colwidth="6*" align="right"/>
20596 <entry><option>acl_smtp_mailauth</option></entry>
20597 <entry>Use: <emphasis>main</emphasis></entry>
20598 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20599 <entry>Default: <emphasis>unset</emphasis></entry>
20605 <indexterm role="concept">
20606 <primary>AUTH</primary>
20607 <secondary>on MAIL command</secondary>
20609 This option defines the ACL that is run when there is an AUTH parameter on
20610 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
20611 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
20614 <indexterm role="option">
20615 <primary><option>acl_smtp_mime</option></primary>
20618 <informaltable frame="all">
20619 <tgroup cols="4" colsep="0" rowsep="0">
20620 <colspec colwidth="8*" align="left"/>
20621 <colspec colwidth="6*" align="center"/>
20622 <colspec colwidth="6*" align="center"/>
20623 <colspec colwidth="6*" align="right"/>
20626 <entry><option>acl_smtp_mime</option></entry>
20627 <entry>Use: <emphasis>main</emphasis></entry>
20628 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20629 <entry>Default: <emphasis>unset</emphasis></entry>
20635 <indexterm role="concept">
20636 <primary>MIME content scanning</primary>
20637 <secondary>ACL for</secondary>
20639 This option is available when Exim is built with the content-scanning
20640 extension. It defines the ACL that is run for each MIME part in a message. See
20641 section <xref linkend="SECTscanmimepart"/> for details.
20644 <indexterm role="option">
20645 <primary><option>acl_smtp_predata</option></primary>
20648 <informaltable frame="all">
20649 <tgroup cols="4" colsep="0" rowsep="0">
20650 <colspec colwidth="8*" align="left"/>
20651 <colspec colwidth="6*" align="center"/>
20652 <colspec colwidth="6*" align="center"/>
20653 <colspec colwidth="6*" align="right"/>
20656 <entry><option>acl_smtp_predata</option></entry>
20657 <entry>Use: <emphasis>main</emphasis></entry>
20658 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20659 <entry>Default: <emphasis>unset</emphasis></entry>
20665 This option defines the ACL that is run when an SMTP DATA command is
20666 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
20670 <indexterm role="option">
20671 <primary><option>acl_smtp_quit</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>acl_smtp_quit</option></entry>
20683 <entry>Use: <emphasis>main</emphasis></entry>
20684 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20685 <entry>Default: <emphasis>unset</emphasis></entry>
20691 <indexterm role="concept">
20692 <primary>QUIT, ACL for</primary>
20694 This option defines the ACL that is run when an SMTP QUIT command is
20695 received. See chapter <xref linkend="CHAPACL"/> for further details.
20698 <indexterm role="option">
20699 <primary><option>acl_smtp_rcpt</option></primary>
20702 <informaltable frame="all">
20703 <tgroup cols="4" colsep="0" rowsep="0">
20704 <colspec colwidth="8*" align="left"/>
20705 <colspec colwidth="6*" align="center"/>
20706 <colspec colwidth="6*" align="center"/>
20707 <colspec colwidth="6*" align="right"/>
20710 <entry><option>acl_smtp_rcpt</option></entry>
20711 <entry>Use: <emphasis>main</emphasis></entry>
20712 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20713 <entry>Default: <emphasis>unset</emphasis></entry>
20719 <indexterm role="concept">
20720 <primary>RCPT</primary>
20721 <secondary>ACL for</secondary>
20723 This option defines the ACL that is run when an SMTP RCPT command is
20724 received. See chapter <xref linkend="CHAPACL"/> for further details.
20727 <indexterm role="option">
20728 <primary><option>acl_smtp_starttls</option></primary>
20731 <informaltable frame="all">
20732 <tgroup cols="4" colsep="0" rowsep="0">
20733 <colspec colwidth="8*" align="left"/>
20734 <colspec colwidth="6*" align="center"/>
20735 <colspec colwidth="6*" align="center"/>
20736 <colspec colwidth="6*" align="right"/>
20739 <entry><option>acl_smtp_starttls</option></entry>
20740 <entry>Use: <emphasis>main</emphasis></entry>
20741 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20742 <entry>Default: <emphasis>unset</emphasis></entry>
20748 <indexterm role="concept">
20749 <primary>STARTTLS, ACL for</primary>
20751 This option defines the ACL that is run when an SMTP STARTTLS command is
20752 received. See chapter <xref linkend="CHAPACL"/> for further details.
20755 <indexterm role="option">
20756 <primary><option>acl_smtp_vrfy</option></primary>
20759 <informaltable frame="all">
20760 <tgroup cols="4" colsep="0" rowsep="0">
20761 <colspec colwidth="8*" align="left"/>
20762 <colspec colwidth="6*" align="center"/>
20763 <colspec colwidth="6*" align="center"/>
20764 <colspec colwidth="6*" align="right"/>
20767 <entry><option>acl_smtp_vrfy</option></entry>
20768 <entry>Use: <emphasis>main</emphasis></entry>
20769 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
20770 <entry>Default: <emphasis>unset</emphasis></entry>
20776 <indexterm role="concept">
20777 <primary>VRFY</primary>
20778 <secondary>ACL for</secondary>
20780 This option defines the ACL that is run when an SMTP VRFY command is
20781 received. See chapter <xref linkend="CHAPACL"/> for further details.
20784 <indexterm role="option">
20785 <primary><option>admin_groups</option></primary>
20788 <informaltable frame="all">
20789 <tgroup cols="4" colsep="0" rowsep="0">
20790 <colspec colwidth="8*" align="left"/>
20791 <colspec colwidth="6*" align="center"/>
20792 <colspec colwidth="6*" align="center"/>
20793 <colspec colwidth="6*" align="right"/>
20796 <entry><option>admin_groups</option></entry>
20797 <entry>Use: <emphasis>main</emphasis></entry>
20798 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
20799 <entry>Default: <emphasis>unset</emphasis></entry>
20805 <indexterm role="concept">
20806 <primary>admin user</primary>
20808 This option is expanded just once, at the start of Exim’s processing. If the
20809 current group or any of the supplementary groups of an Exim caller is in this
20810 colon-separated list, the caller has admin privileges. If all your system
20811 programmers are in a specific group, for example, you can give them all Exim
20812 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20813 not permit them to read Exim’s spool files (whose group owner is the Exim gid).
20814 To permit this, you have to add individuals to the Exim group.
20817 <indexterm role="option">
20818 <primary><option>allow_domain_literals</option></primary>
20821 <informaltable frame="all">
20822 <tgroup cols="4" colsep="0" rowsep="0">
20823 <colspec colwidth="8*" align="left"/>
20824 <colspec colwidth="6*" align="center"/>
20825 <colspec colwidth="6*" align="center"/>
20826 <colspec colwidth="6*" align="right"/>
20829 <entry><option>allow_domain_literals</option></entry>
20830 <entry>Use: <emphasis>main</emphasis></entry>
20831 <entry>Type: <emphasis>boolean</emphasis></entry>
20832 <entry>Default: <emphasis>false</emphasis></entry>
20838 <indexterm role="concept">
20839 <primary>domain literal</primary>
20841 If this option is set, the RFC 2822 domain literal format is permitted in
20842 email addresses. The option is not set by default, because the domain literal
20843 format is not normally required these days, and few people know about it. It
20844 has, however, been exploited by mail abusers.
20847 Unfortunately, it seems that some DNS black list maintainers are using this
20848 format to report black listing to postmasters. If you want to accept messages
20849 addressed to your hosts by IP address, you need to set
20850 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20851 domains (defined in the named domain list <option>local_domains</option> in the default
20852 configuration). This <quote>magic string</quote> matches the domain literal form of all
20853 the local host’s IP addresses.
20856 <indexterm role="option">
20857 <primary><option>allow_mx_to_ip</option></primary>
20860 <informaltable frame="all">
20861 <tgroup cols="4" colsep="0" rowsep="0">
20862 <colspec colwidth="8*" align="left"/>
20863 <colspec colwidth="6*" align="center"/>
20864 <colspec colwidth="6*" align="center"/>
20865 <colspec colwidth="6*" align="right"/>
20868 <entry><option>allow_mx_to_ip</option></entry>
20869 <entry>Use: <emphasis>main</emphasis></entry>
20870 <entry>Type: <emphasis>boolean</emphasis></entry>
20871 <entry>Default: <emphasis>false</emphasis></entry>
20877 <indexterm role="concept">
20878 <primary>MX record</primary>
20879 <secondary>pointing to IP address</secondary>
20881 It appears that more and more DNS zone administrators are breaking the rules
20882 and putting domain names that look like IP addresses on the right hand side of
20883 MX records. Exim follows the rules and rejects this, giving an error message
20884 that explains the mis-configuration. However, some other MTAs support this
20885 practice, so to avoid <quote>Why can’t Exim do this?</quote> complaints,
20886 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20887 recommended, except when you have no other choice.
20890 <indexterm role="option">
20891 <primary><option>allow_utf8_domains</option></primary>
20894 <informaltable frame="all">
20895 <tgroup cols="4" colsep="0" rowsep="0">
20896 <colspec colwidth="8*" align="left"/>
20897 <colspec colwidth="6*" align="center"/>
20898 <colspec colwidth="6*" align="center"/>
20899 <colspec colwidth="6*" align="right"/>
20902 <entry><option>allow_utf8_domains</option></entry>
20903 <entry>Use: <emphasis>main</emphasis></entry>
20904 <entry>Type: <emphasis>boolean</emphasis></entry>
20905 <entry>Default: <emphasis>false</emphasis></entry>
20911 <indexterm role="concept">
20912 <primary>domain</primary>
20913 <secondary>UTF-8 characters in</secondary>
20915 <indexterm role="concept">
20916 <primary>UTF-8</primary>
20917 <secondary>in domain name</secondary>
20919 Lots of discussion is going on about internationalized domain names. One
20920 camp is strongly in favour of just using UTF-8 characters, and it seems
20921 that at least two other MTAs permit this. This option allows Exim users to
20922 experiment if they wish.
20925 If it is set true, Exim’s domain parsing function allows valid
20926 UTF-8 multicharacters to appear in domain name components, in addition to
20927 letters, digits, and hyphens. However, just setting this option is not
20928 enough; if you want to look up these domain names in the DNS, you must also
20929 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20930 suitable setting is:
20932 <literallayout class="monospaced">
20933 dns_check_names_pattern = (?i)^(?>(?(1)\.|())[a-z0-9\xc0-\xff]\
20934 (?>[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20937 Alternatively, you can just disable this feature by setting
20939 <literallayout class="monospaced">
20940 dns_check_names_pattern =
20943 That is, set the option to an empty string so that no check is done.
20946 <indexterm role="option">
20947 <primary><option>auth_advertise_hosts</option></primary>
20950 <informaltable frame="all">
20951 <tgroup cols="4" colsep="0" rowsep="0">
20952 <colspec colwidth="8*" align="left"/>
20953 <colspec colwidth="6*" align="center"/>
20954 <colspec colwidth="6*" align="center"/>
20955 <colspec colwidth="6*" align="right"/>
20958 <entry><option>auth_advertise_hosts</option></entry>
20959 <entry>Use: <emphasis>main</emphasis></entry>
20960 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
20961 <entry>Default: <emphasis>*</emphasis></entry>
20967 <indexterm role="concept">
20968 <primary>authentication</primary>
20969 <secondary>advertising</secondary>
20971 <indexterm role="concept">
20972 <primary>AUTH</primary>
20973 <secondary>advertising</secondary>
20975 If any server authentication mechanisms are configured, Exim advertises them in
20976 response to an EHLO command only if the calling host matches this list.
20977 Otherwise, Exim does not advertise AUTH.
20978 Exim does not accept AUTH commands from clients to which it has not
20979 advertised the availability of AUTH. The advertising of individual
20980 authentication mechanisms can be controlled by the use of the
20981 <option>server_advertise_condition</option> generic authenticator option on the individual
20982 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20985 Certain mail clients (for example, Netscape) require the user to provide a name
20986 and password for authentication if AUTH is advertised, even though it may
20987 not be needed (the host may accept messages from hosts on its local LAN without
20988 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20989 to make these clients more friendly by excluding them from the set of hosts to
20990 which Exim advertises AUTH.
20993 <indexterm role="concept">
20994 <primary>AUTH</primary>
20995 <secondary>advertising when encrypted</secondary>
20997 If you want to advertise the availability of AUTH only when the connection
20998 is encrypted using TLS, you can make use of the fact that the value of this
20999 option is expanded, with a setting like this:
21001 <literallayout class="monospaced">
21002 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
21005 <indexterm role="variable">
21006 <primary><varname>$tls_cipher</varname></primary>
21008 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
21009 the expansion is empty, thus matching no hosts. Otherwise, the result of the
21010 expansion is *, which matches all hosts.
21013 <indexterm role="option">
21014 <primary><option>auto_thaw</option></primary>
21017 <informaltable frame="all">
21018 <tgroup cols="4" colsep="0" rowsep="0">
21019 <colspec colwidth="8*" align="left"/>
21020 <colspec colwidth="6*" align="center"/>
21021 <colspec colwidth="6*" align="center"/>
21022 <colspec colwidth="6*" align="right"/>
21025 <entry><option>auto_thaw</option></entry>
21026 <entry>Use: <emphasis>main</emphasis></entry>
21027 <entry>Type: <emphasis>time</emphasis></entry>
21028 <entry>Default: <emphasis>0s</emphasis></entry>
21034 <indexterm role="concept">
21035 <primary>thawing messages</primary>
21037 <indexterm role="concept">
21038 <primary>unfreezing messages</primary>
21040 If this option is set to a time greater than zero, a queue runner will try a
21041 new delivery attempt on any frozen message, other than a bounce message, if
21042 this much time has passed since it was frozen. This may result in the message
21043 being re-frozen if nothing has changed since the last attempt. It is a way of
21044 saying <quote>keep on trying, even though there are big problems</quote>.
21047 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
21048 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
21049 thought to be very useful any more, and its use should probably be avoided.
21051 <para revisionflag="changed">
21052 <indexterm role="option">
21053 <primary><option>av_scanner</option></primary>
21056 <informaltable frame="all" revisionflag="changed">
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>av_scanner</option></entry>
21065 <entry>Use: <emphasis>main</emphasis></entry>
21066 <entry>Type: <emphasis>string</emphasis></entry>
21067 <entry>Default: <emphasis>see below</emphasis></entry>
21072 <para revisionflag="changed">
21073 This option is available if Exim is built with the content-scanning extension.
21074 It specifies which anti-virus scanner to use. The default value is:
21076 <literallayout class="monospaced" revisionflag="changed">
21077 sophie:/var/run/sophie
21079 <para revisionflag="changed">
21080 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
21081 before use. See section <xref linkend="SECTscanvirus"/> for further details.
21084 <indexterm role="option">
21085 <primary><option>bi_command</option></primary>
21088 <informaltable frame="all">
21089 <tgroup cols="4" colsep="0" rowsep="0">
21090 <colspec colwidth="8*" align="left"/>
21091 <colspec colwidth="6*" align="center"/>
21092 <colspec colwidth="6*" align="center"/>
21093 <colspec colwidth="6*" align="right"/>
21096 <entry><option>bi_command</option></entry>
21097 <entry>Use: <emphasis>main</emphasis></entry>
21098 <entry>Type: <emphasis>string</emphasis></entry>
21099 <entry>Default: <emphasis>unset</emphasis></entry>
21105 <indexterm role="option">
21106 <primary><option>-bi</option></primary>
21108 This option supplies the name of a command that is run when Exim is called with
21109 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
21110 just the command name, it is not a complete command line. If an argument is
21111 required, it must come from the <option>-oA</option> command line option.
21114 <indexterm role="option">
21115 <primary><option>bounce_message_file</option></primary>
21118 <informaltable frame="all">
21119 <tgroup cols="4" colsep="0" rowsep="0">
21120 <colspec colwidth="8*" align="left"/>
21121 <colspec colwidth="6*" align="center"/>
21122 <colspec colwidth="6*" align="center"/>
21123 <colspec colwidth="6*" align="right"/>
21126 <entry><option>bounce_message_file</option></entry>
21127 <entry>Use: <emphasis>main</emphasis></entry>
21128 <entry>Type: <emphasis>string</emphasis></entry>
21129 <entry>Default: <emphasis>unset</emphasis></entry>
21135 <indexterm role="concept">
21136 <primary>bounce message</primary>
21137 <secondary>customizing</secondary>
21139 <indexterm role="concept">
21140 <primary>customizing</primary>
21141 <secondary>bounce message</secondary>
21143 This option defines a template file containing paragraphs of text to be used
21144 for constructing bounce messages. Details of the file’s contents are given in
21145 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
21148 <indexterm role="option">
21149 <primary><option>bounce_message_text</option></primary>
21152 <informaltable frame="all">
21153 <tgroup cols="4" colsep="0" rowsep="0">
21154 <colspec colwidth="8*" align="left"/>
21155 <colspec colwidth="6*" align="center"/>
21156 <colspec colwidth="6*" align="center"/>
21157 <colspec colwidth="6*" align="right"/>
21160 <entry><option>bounce_message_text</option></entry>
21161 <entry>Use: <emphasis>main</emphasis></entry>
21162 <entry>Type: <emphasis>string</emphasis></entry>
21163 <entry>Default: <emphasis>unset</emphasis></entry>
21169 When this option is set, its contents are included in the default bounce
21170 message immediately after <quote>This message was created automatically by mail
21171 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
21174 <indexterm role="option">
21175 <primary><option>bounce_return_body</option></primary>
21178 <informaltable frame="all">
21179 <tgroup cols="4" colsep="0" rowsep="0">
21180 <colspec colwidth="8*" align="left"/>
21181 <colspec colwidth="6*" align="center"/>
21182 <colspec colwidth="6*" align="center"/>
21183 <colspec colwidth="6*" align="right"/>
21186 <entry><option>bounce_return_body</option></entry>
21187 <entry>Use: <emphasis>main</emphasis></entry>
21188 <entry>Type: <emphasis>boolean</emphasis></entry>
21189 <entry>Default: <emphasis>true</emphasis></entry>
21195 <indexterm role="concept">
21196 <primary>bounce message</primary>
21197 <secondary>including body</secondary>
21199 This option controls whether the body of an incoming message is included in a
21200 bounce message when <option>bounce_return_message</option> is true. The default setting
21201 causes the entire message, both header and body, to be returned (subject to the
21202 value of <option>bounce_return_size_limit</option>). If this option is false, only the
21203 message header is included. In the case of a non-SMTP message containing an
21204 error that is detected during reception, only those header lines preceding the
21205 point at which the error was detected are returned.
21206 <indexterm role="concept">
21207 <primary>bounce message</primary>
21208 <secondary>including original</secondary>
21212 <indexterm role="option">
21213 <primary><option>bounce_return_message</option></primary>
21216 <informaltable frame="all">
21217 <tgroup cols="4" colsep="0" rowsep="0">
21218 <colspec colwidth="8*" align="left"/>
21219 <colspec colwidth="6*" align="center"/>
21220 <colspec colwidth="6*" align="center"/>
21221 <colspec colwidth="6*" align="right"/>
21224 <entry><option>bounce_return_message</option></entry>
21225 <entry>Use: <emphasis>main</emphasis></entry>
21226 <entry>Type: <emphasis>boolean</emphasis></entry>
21227 <entry>Default: <emphasis>true</emphasis></entry>
21233 If this option is set false, none of the original message is included in
21234 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
21235 <option>bounce_return_body</option>.
21238 <indexterm role="option">
21239 <primary><option>bounce_return_size_limit</option></primary>
21242 <informaltable frame="all">
21243 <tgroup cols="4" colsep="0" rowsep="0">
21244 <colspec colwidth="8*" align="left"/>
21245 <colspec colwidth="6*" align="center"/>
21246 <colspec colwidth="6*" align="center"/>
21247 <colspec colwidth="6*" align="right"/>
21250 <entry><option>bounce_return_size_limit</option></entry>
21251 <entry>Use: <emphasis>main</emphasis></entry>
21252 <entry>Type: <emphasis>integer</emphasis></entry>
21253 <entry>Default: <emphasis>100K</emphasis></entry>
21259 <indexterm role="concept">
21260 <primary>size</primary>
21261 <secondary>of bounce, limit</secondary>
21263 <indexterm role="concept">
21264 <primary>bounce message</primary>
21265 <secondary>size limit</secondary>
21267 <indexterm role="concept">
21268 <primary>limit</primary>
21269 <secondary>bounce message size</secondary>
21271 This option sets a limit in bytes on the size of messages that are returned to
21272 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
21273 limit should be less than the value of the global <option>message_size_limit</option> and of
21274 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
21275 that Exim generates. If this option is set to zero there is no limit.
21278 When the body of any message that is to be included in a bounce message is
21279 greater than the limit, it is truncated, and a comment pointing this out is
21280 added at the top. The actual cutoff may be greater than the value given, owing
21281 to the use of buffering for transferring the message in chunks (typically 8K in
21282 size). The idea is to save bandwidth on those undeliverable 15-megabyte
21286 <indexterm role="option">
21287 <primary><option>bounce_sender_authentication</option></primary>
21290 <informaltable frame="all">
21291 <tgroup cols="4" colsep="0" rowsep="0">
21292 <colspec colwidth="8*" align="left"/>
21293 <colspec colwidth="6*" align="center"/>
21294 <colspec colwidth="6*" align="center"/>
21295 <colspec colwidth="6*" align="right"/>
21298 <entry><option>bounce_sender_authentication</option></entry>
21299 <entry>Use: <emphasis>main</emphasis></entry>
21300 <entry>Type: <emphasis>string</emphasis></entry>
21301 <entry>Default: <emphasis>unset</emphasis></entry>
21307 <indexterm role="concept">
21308 <primary>bounce message</primary>
21309 <secondary>sender authentication</secondary>
21311 <indexterm role="concept">
21312 <primary>authentication</primary>
21313 <secondary>bounce message</secondary>
21315 <indexterm role="concept">
21316 <primary>AUTH</primary>
21317 <secondary>on bounce message</secondary>
21319 This option provides an authenticated sender address that is sent with any
21320 bounce messages generated by Exim that are sent over an authenticated SMTP
21321 connection. A typical setting might be:
21323 <literallayout class="monospaced">
21324 bounce_sender_authentication = mailer-daemon@my.domain.example
21327 which would cause bounce messages to be sent using the SMTP command:
21329 <literallayout class="monospaced">
21330 MAIL FROM:<> AUTH=mailer-daemon@my.domain.example
21333 The value of <option>bounce_sender_authentication</option> must always be a complete email
21337 <indexterm role="option">
21338 <primary><option>callout_domain_negative_expire</option></primary>
21341 <informaltable frame="all">
21342 <tgroup cols="4" colsep="0" rowsep="0">
21343 <colspec colwidth="8*" align="left"/>
21344 <colspec colwidth="6*" align="center"/>
21345 <colspec colwidth="6*" align="center"/>
21346 <colspec colwidth="6*" align="right"/>
21349 <entry><option>callout_domain_negative_expire</option></entry>
21350 <entry>Use: <emphasis>main</emphasis></entry>
21351 <entry>Type: <emphasis>time</emphasis></entry>
21352 <entry>Default: <emphasis>3h</emphasis></entry>
21358 <indexterm role="concept">
21359 <primary>caching</primary>
21360 <secondary>callout timeouts</secondary>
21362 <indexterm role="concept">
21363 <primary>callout</primary>
21364 <secondary>caching timeouts</secondary>
21366 This option specifies the expiry time for negative callout cache data for a
21367 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21368 section <xref linkend="SECTcallvercache"/> for details of the caching.
21371 <indexterm role="option">
21372 <primary><option>callout_domain_positive_expire</option></primary>
21375 <informaltable frame="all">
21376 <tgroup cols="4" colsep="0" rowsep="0">
21377 <colspec colwidth="8*" align="left"/>
21378 <colspec colwidth="6*" align="center"/>
21379 <colspec colwidth="6*" align="center"/>
21380 <colspec colwidth="6*" align="right"/>
21383 <entry><option>callout_domain_positive_expire</option></entry>
21384 <entry>Use: <emphasis>main</emphasis></entry>
21385 <entry>Type: <emphasis>time</emphasis></entry>
21386 <entry>Default: <emphasis>7d</emphasis></entry>
21392 This option specifies the expiry time for positive callout cache data for a
21393 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21394 section <xref linkend="SECTcallvercache"/> for details of the caching.
21397 <indexterm role="option">
21398 <primary><option>callout_negative_expire</option></primary>
21401 <informaltable frame="all">
21402 <tgroup cols="4" colsep="0" rowsep="0">
21403 <colspec colwidth="8*" align="left"/>
21404 <colspec colwidth="6*" align="center"/>
21405 <colspec colwidth="6*" align="center"/>
21406 <colspec colwidth="6*" align="right"/>
21409 <entry><option>callout_negative_expire</option></entry>
21410 <entry>Use: <emphasis>main</emphasis></entry>
21411 <entry>Type: <emphasis>time</emphasis></entry>
21412 <entry>Default: <emphasis>2h</emphasis></entry>
21418 This option specifies the expiry time for negative callout cache data for an
21419 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21420 section <xref linkend="SECTcallvercache"/> for details of the caching.
21423 <indexterm role="option">
21424 <primary><option>callout_positive_expire</option></primary>
21427 <informaltable frame="all">
21428 <tgroup cols="4" colsep="0" rowsep="0">
21429 <colspec colwidth="8*" align="left"/>
21430 <colspec colwidth="6*" align="center"/>
21431 <colspec colwidth="6*" align="center"/>
21432 <colspec colwidth="6*" align="right"/>
21435 <entry><option>callout_positive_expire</option></entry>
21436 <entry>Use: <emphasis>main</emphasis></entry>
21437 <entry>Type: <emphasis>time</emphasis></entry>
21438 <entry>Default: <emphasis>24h</emphasis></entry>
21444 This option specifies the expiry time for positive callout cache data for an
21445 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
21446 section <xref linkend="SECTcallvercache"/> for details of the caching.
21449 <indexterm role="option">
21450 <primary><option>callout_random_local_part</option></primary>
21453 <informaltable frame="all">
21454 <tgroup cols="4" colsep="0" rowsep="0">
21455 <colspec colwidth="8*" align="left"/>
21456 <colspec colwidth="6*" align="center"/>
21457 <colspec colwidth="6*" align="center"/>
21458 <colspec colwidth="6*" align="right"/>
21461 <entry><option>callout_random_local_part</option></entry>
21462 <entry>Use: <emphasis>main</emphasis></entry>
21463 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21464 <entry>Default: <emphasis>see below</emphasis></entry>
21470 This option defines the <quote>random</quote> local part that can be used as part of
21471 callout verification. The default value is
21473 <literallayout class="monospaced">
21474 $primary_host_name-$tod_epoch-testing
21477 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
21480 <indexterm role="option">
21481 <primary><option>check_log_inodes</option></primary>
21484 <informaltable frame="all">
21485 <tgroup cols="4" colsep="0" rowsep="0">
21486 <colspec colwidth="8*" align="left"/>
21487 <colspec colwidth="6*" align="center"/>
21488 <colspec colwidth="6*" align="center"/>
21489 <colspec colwidth="6*" align="right"/>
21492 <entry><option>check_log_inodes</option></entry>
21493 <entry>Use: <emphasis>main</emphasis></entry>
21494 <entry>Type: <emphasis>integer</emphasis></entry>
21495 <entry>Default: <emphasis>0</emphasis></entry>
21501 See <option>check_spool_space</option> below.
21504 <indexterm role="option">
21505 <primary><option>check_log_space</option></primary>
21508 <informaltable frame="all">
21509 <tgroup cols="4" colsep="0" rowsep="0">
21510 <colspec colwidth="8*" align="left"/>
21511 <colspec colwidth="6*" align="center"/>
21512 <colspec colwidth="6*" align="center"/>
21513 <colspec colwidth="6*" align="right"/>
21516 <entry><option>check_log_space</option></entry>
21517 <entry>Use: <emphasis>main</emphasis></entry>
21518 <entry>Type: <emphasis>integer</emphasis></entry>
21519 <entry>Default: <emphasis>0</emphasis></entry>
21525 See <option>check_spool_space</option> below.
21528 <indexterm role="option">
21529 <primary><option>check_rfc2047_length</option></primary>
21531 <indexterm role="concept">
21532 <primary>RFC 2047</primary>
21533 <secondary>disabling length check</secondary>
21535 <indexterm role="option">
21536 <primary><option>check_rfc2047_length</option></primary>
21539 <informaltable frame="all">
21540 <tgroup cols="4" colsep="0" rowsep="0">
21541 <colspec colwidth="8*" align="left"/>
21542 <colspec colwidth="6*" align="center"/>
21543 <colspec colwidth="6*" align="center"/>
21544 <colspec colwidth="6*" align="right"/>
21547 <entry><option>check_rfc2047_length</option></entry>
21548 <entry>Use: <emphasis>main</emphasis></entry>
21549 <entry>Type: <emphasis>boolean</emphasis></entry>
21550 <entry>Default: <emphasis>true</emphasis></entry>
21556 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
21557 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
21558 word; strings to be encoded that exceed this length are supposed to use
21559 multiple encoded words. By default, Exim does not recognize encoded words that
21560 exceed the maximum length. However, it seems that some software, in violation
21561 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
21562 set false, Exim recognizes encoded words of any length.
21565 <indexterm role="option">
21566 <primary><option>check_spool_inodes</option></primary>
21569 <informaltable frame="all">
21570 <tgroup cols="4" colsep="0" rowsep="0">
21571 <colspec colwidth="8*" align="left"/>
21572 <colspec colwidth="6*" align="center"/>
21573 <colspec colwidth="6*" align="center"/>
21574 <colspec colwidth="6*" align="right"/>
21577 <entry><option>check_spool_inodes</option></entry>
21578 <entry>Use: <emphasis>main</emphasis></entry>
21579 <entry>Type: <emphasis>integer</emphasis></entry>
21580 <entry>Default: <emphasis>0</emphasis></entry>
21586 See <option>check_spool_space</option> below.
21589 <indexterm role="option">
21590 <primary><option>check_spool_space</option></primary>
21593 <informaltable frame="all">
21594 <tgroup cols="4" colsep="0" rowsep="0">
21595 <colspec colwidth="8*" align="left"/>
21596 <colspec colwidth="6*" align="center"/>
21597 <colspec colwidth="6*" align="center"/>
21598 <colspec colwidth="6*" align="right"/>
21601 <entry><option>check_spool_space</option></entry>
21602 <entry>Use: <emphasis>main</emphasis></entry>
21603 <entry>Type: <emphasis>integer</emphasis></entry>
21604 <entry>Default: <emphasis>0</emphasis></entry>
21610 <indexterm role="concept">
21611 <primary>checking disk space</primary>
21613 <indexterm role="concept">
21614 <primary>disk space, checking</primary>
21616 <indexterm role="concept">
21617 <primary>spool directory</primary>
21618 <secondary>checking space</secondary>
21620 The four <option>check_...</option> options allow for checking of disk resources before a
21621 message is accepted.
21624 <indexterm role="variable">
21625 <primary><varname>$log_inodes</varname></primary>
21627 <indexterm role="variable">
21628 <primary><varname>$log_space</varname></primary>
21630 <indexterm role="variable">
21631 <primary><varname>$spool_inodes</varname></primary>
21633 <indexterm role="variable">
21634 <primary><varname>$spool_space</varname></primary>
21636 When any of these options are set, they apply to all incoming messages. If you
21637 want to apply different checks to different kinds of message, you can do so by
21638 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
21639 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
21642 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
21643 either value is greater than zero, for example:
21645 <literallayout class="monospaced">
21646 check_spool_space = 10M
21647 check_spool_inodes = 100
21650 The spool partition is the one that contains the directory defined by
21651 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
21655 <option>check_log_space</option> and <option>check_log_inodes</option> check the partition in which log
21656 files are written if either is greater than zero. These should be set only if
21657 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
21660 If there is less space or fewer inodes than requested, Exim refuses to accept
21661 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
21662 error response to the MAIL command. If ESMTP is in use and there was a
21663 SIZE parameter on the MAIL command, its value is added to the
21664 <option>check_spool_space</option> value, and the check is performed even if
21665 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
21668 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
21669 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
21672 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
21673 failure a message is written to stderr and Exim exits with a non-zero code, as
21674 it obviously cannot send an error message of any kind.
21677 <indexterm role="option">
21678 <primary><option>daemon_smtp_ports</option></primary>
21681 <informaltable frame="all">
21682 <tgroup cols="4" colsep="0" rowsep="0">
21683 <colspec colwidth="8*" align="left"/>
21684 <colspec colwidth="6*" align="center"/>
21685 <colspec colwidth="6*" align="center"/>
21686 <colspec colwidth="6*" align="right"/>
21689 <entry><option>daemon_smtp_ports</option></entry>
21690 <entry>Use: <emphasis>main</emphasis></entry>
21691 <entry>Type: <emphasis>string</emphasis></entry>
21692 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
21698 <indexterm role="concept">
21699 <primary>port</primary>
21700 <secondary>for daemon</secondary>
21702 <indexterm role="concept">
21703 <primary>TCP/IP</primary>
21704 <secondary>setting listening ports</secondary>
21706 This option specifies one or more default SMTP ports on which the Exim daemon
21707 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21708 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21711 <indexterm role="option">
21712 <primary><option>daemon_startup_retries</option></primary>
21715 <informaltable frame="all">
21716 <tgroup cols="4" colsep="0" rowsep="0">
21717 <colspec colwidth="8*" align="left"/>
21718 <colspec colwidth="6*" align="center"/>
21719 <colspec colwidth="6*" align="center"/>
21720 <colspec colwidth="6*" align="right"/>
21723 <entry><option>daemon_startup_retries</option></entry>
21724 <entry>Use: <emphasis>main</emphasis></entry>
21725 <entry>Type: <emphasis>integer</emphasis></entry>
21726 <entry>Default: <emphasis>9</emphasis></entry>
21732 <indexterm role="concept">
21733 <primary>daemon startup, retrying</primary>
21735 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21736 the daemon at startup when it cannot immediately bind a listening socket
21737 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21738 defines the number of retries after the first failure, and
21739 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21742 <indexterm role="option">
21743 <primary><option>daemon_startup_sleep</option></primary>
21746 <informaltable frame="all">
21747 <tgroup cols="4" colsep="0" rowsep="0">
21748 <colspec colwidth="8*" align="left"/>
21749 <colspec colwidth="6*" align="center"/>
21750 <colspec colwidth="6*" align="center"/>
21751 <colspec colwidth="6*" align="right"/>
21754 <entry><option>daemon_startup_sleep</option></entry>
21755 <entry>Use: <emphasis>main</emphasis></entry>
21756 <entry>Type: <emphasis>time</emphasis></entry>
21757 <entry>Default: <emphasis>30s</emphasis></entry>
21763 See <option>daemon_startup_retries</option>.
21766 <indexterm role="option">
21767 <primary><option>delay_warning</option></primary>
21770 <informaltable frame="all">
21771 <tgroup cols="4" colsep="0" rowsep="0">
21772 <colspec colwidth="8*" align="left"/>
21773 <colspec colwidth="6*" align="center"/>
21774 <colspec colwidth="6*" align="center"/>
21775 <colspec colwidth="6*" align="right"/>
21778 <entry><option>delay_warning</option></entry>
21779 <entry>Use: <emphasis>main</emphasis></entry>
21780 <entry>Type: <emphasis>time list</emphasis></entry>
21781 <entry>Default: <emphasis>24h</emphasis></entry>
21787 <indexterm role="concept">
21788 <primary>warning of delay</primary>
21790 <indexterm role="concept">
21791 <primary>delay warning, specifying</primary>
21793 When a message is delayed, Exim sends a warning message to the sender at
21794 intervals specified by this option. The data is a colon-separated list of times
21795 after which to send warning messages. If the value of the option is an empty
21796 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21797 message has been on the queue for longer than the last time, the last interval
21798 between the times is used to compute subsequent warning times. For example,
21801 <literallayout class="monospaced">
21802 delay_warning = 4h:8h:24h
21805 the first message is sent after 4 hours, the second after 8 hours, and
21806 the third one after 24 hours. After that, messages are sent every 16 hours,
21807 because that is the interval between the last two times on the list. If you set
21808 just one time, it specifies the repeat interval. For example, with:
21810 <literallayout class="monospaced">
21814 messages are repeated every six hours. To stop warnings after a given time, set
21815 a very large time at the end of the list. For example:
21817 <literallayout class="monospaced">
21818 delay_warning = 2h:12h:99d
21821 <indexterm role="option">
21822 <primary><option>delay_warning_condition</option></primary>
21825 <informaltable frame="all">
21826 <tgroup cols="4" colsep="0" rowsep="0">
21827 <colspec colwidth="8*" align="left"/>
21828 <colspec colwidth="6*" align="center"/>
21829 <colspec colwidth="6*" align="center"/>
21830 <colspec colwidth="6*" align="right"/>
21833 <entry><option>delay_warning_condition</option></entry>
21834 <entry>Use: <emphasis>main</emphasis></entry>
21835 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
21836 <entry>Default: <emphasis>see below</emphasis></entry>
21842 <indexterm role="variable">
21843 <primary><varname>$domain</varname></primary>
21845 The string is expanded at the time a warning message might be sent. If all the
21846 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21847 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21848 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21849 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21850 not sent. The default is:
21852 <literallayout class="monospaced">
21853 delay_warning_condition = ${if or {\
21854 { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21855 { match{$h_precedence:}{(?i)bulk|list|junk} }\
21856 { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21860 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21861 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21862 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21863 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21866 <indexterm role="option">
21867 <primary><option>deliver_drop_privilege</option></primary>
21870 <informaltable frame="all">
21871 <tgroup cols="4" colsep="0" rowsep="0">
21872 <colspec colwidth="8*" align="left"/>
21873 <colspec colwidth="6*" align="center"/>
21874 <colspec colwidth="6*" align="center"/>
21875 <colspec colwidth="6*" align="right"/>
21878 <entry><option>deliver_drop_privilege</option></entry>
21879 <entry>Use: <emphasis>main</emphasis></entry>
21880 <entry>Type: <emphasis>boolean</emphasis></entry>
21881 <entry>Default: <emphasis>false</emphasis></entry>
21887 <indexterm role="concept">
21888 <primary>unprivileged delivery</primary>
21890 <indexterm role="concept">
21891 <primary>delivery</primary>
21892 <secondary>unprivileged</secondary>
21894 If this option is set true, Exim drops its root privilege at the start of a
21895 delivery process, and runs as the Exim user throughout. This severely restricts
21896 the kinds of local delivery that are possible, but is viable in certain types
21897 of configuration. There is a discussion about the use of root privilege in
21898 chapter <xref linkend="CHAPsecurity"/>.
21901 <indexterm role="option">
21902 <primary><option>deliver_queue_load_max</option></primary>
21905 <informaltable frame="all">
21906 <tgroup cols="4" colsep="0" rowsep="0">
21907 <colspec colwidth="8*" align="left"/>
21908 <colspec colwidth="6*" align="center"/>
21909 <colspec colwidth="6*" align="center"/>
21910 <colspec colwidth="6*" align="right"/>
21913 <entry><option>deliver_queue_load_max</option></entry>
21914 <entry>Use: <emphasis>main</emphasis></entry>
21915 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21916 <entry>Default: <emphasis>unset</emphasis></entry>
21922 <indexterm role="concept">
21923 <primary>load average</primary>
21925 <indexterm role="concept">
21926 <primary>queue runner</primary>
21927 <secondary>abandoning</secondary>
21929 When this option is set, a queue run is abandoned if the system load average
21930 becomes greater than the value of the option. The option has no effect on
21931 ancient operating systems on which Exim cannot determine the load average.
21932 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21935 <indexterm role="option">
21936 <primary><option>delivery_date_remove</option></primary>
21939 <informaltable frame="all">
21940 <tgroup cols="4" colsep="0" rowsep="0">
21941 <colspec colwidth="8*" align="left"/>
21942 <colspec colwidth="6*" align="center"/>
21943 <colspec colwidth="6*" align="center"/>
21944 <colspec colwidth="6*" align="right"/>
21947 <entry><option>delivery_date_remove</option></entry>
21948 <entry>Use: <emphasis>main</emphasis></entry>
21949 <entry>Type: <emphasis>boolean</emphasis></entry>
21950 <entry>Default: <emphasis>true</emphasis></entry>
21956 <indexterm role="concept">
21957 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21959 Exim’s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21960 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21961 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21962 should not be present in incoming messages, and this option causes them to be
21963 removed at the time the message is received, to avoid any problems that might
21964 occur when a delivered message is subsequently sent on to some other recipient.
21967 <indexterm role="option">
21968 <primary><option>disable_fsync</option></primary>
21971 <informaltable frame="all">
21972 <tgroup cols="4" colsep="0" rowsep="0">
21973 <colspec colwidth="8*" align="left"/>
21974 <colspec colwidth="6*" align="center"/>
21975 <colspec colwidth="6*" align="center"/>
21976 <colspec colwidth="6*" align="right"/>
21979 <entry><option>disable_fsync</option></entry>
21980 <entry>Use: <emphasis>main</emphasis></entry>
21981 <entry>Type: <emphasis>boolean</emphasis></entry>
21982 <entry>Default: <emphasis>false</emphasis></entry>
21988 <indexterm role="concept">
21989 <primary><function>fsync()</function>, disabling</primary>
21991 This option is available only if Exim was built with the compile-time option
21992 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
21993 a runtime configuration generates an <quote>unknown option</quote> error. You should not
21994 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
21995 really, really, really understand what you are doing. <emphasis>No pre-compiled
21996 distributions of Exim should ever make this option available.</emphasis>
21999 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
22000 updated files’ data to be written to disc before continuing. Unexpected events
22001 such as crashes and power outages may cause data to be lost or scrambled.
22002 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
22005 <indexterm role="option">
22006 <primary><option>disable_ipv6</option></primary>
22009 <informaltable frame="all">
22010 <tgroup cols="4" colsep="0" rowsep="0">
22011 <colspec colwidth="8*" align="left"/>
22012 <colspec colwidth="6*" align="center"/>
22013 <colspec colwidth="6*" align="center"/>
22014 <colspec colwidth="6*" align="right"/>
22017 <entry><option>disable_ipv6</option></entry>
22018 <entry>Use: <emphasis>main</emphasis></entry>
22019 <entry>Type: <emphasis>boolean</emphasis></entry>
22020 <entry>Default: <emphasis>false</emphasis></entry>
22026 <indexterm role="concept">
22027 <primary>IPv6</primary>
22028 <secondary>disabling</secondary>
22030 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
22031 activities take place. AAAA records are never looked up, and any IPv6 addresses
22032 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
22033 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
22034 to handle IPv6 literal addresses.
22037 <indexterm role="option">
22038 <primary><option>dns_again_means_nonexist</option></primary>
22041 <informaltable frame="all">
22042 <tgroup cols="4" colsep="0" rowsep="0">
22043 <colspec colwidth="8*" align="left"/>
22044 <colspec colwidth="6*" align="center"/>
22045 <colspec colwidth="6*" align="center"/>
22046 <colspec colwidth="6*" align="right"/>
22049 <entry><option>dns_again_means_nonexist</option></entry>
22050 <entry>Use: <emphasis>main</emphasis></entry>
22051 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22052 <entry>Default: <emphasis>unset</emphasis></entry>
22058 <indexterm role="concept">
22059 <primary>DNS</primary>
22060 <secondary><quote>try again</quote> response; overriding</secondary>
22062 DNS lookups give a <quote>try again</quote> response for the DNS errors
22063 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
22064 keep trying to deliver a message, or to give repeated temporary errors to
22065 incoming mail. Sometimes the effect is caused by a badly set up name server and
22066 may persist for a long time. If a domain which exhibits this problem matches
22067 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
22068 This option should be used with care. You can make it apply to reverse lookups
22069 by a setting such as this:
22071 <literallayout class="monospaced">
22072 dns_again_means_nonexist = *.in-addr.arpa
22075 This option applies to all DNS lookups that Exim does. It also applies when the
22076 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
22077 since these are most likely to be caused by DNS lookup problems. The
22078 <command>dnslookup</command> router has some options of its own for controlling what happens
22079 when lookups for MX or SRV records give temporary errors. These more specific
22080 options are applied after this global option.
22083 <indexterm role="option">
22084 <primary><option>dns_check_names_pattern</option></primary>
22087 <informaltable frame="all">
22088 <tgroup cols="4" colsep="0" rowsep="0">
22089 <colspec colwidth="8*" align="left"/>
22090 <colspec colwidth="6*" align="center"/>
22091 <colspec colwidth="6*" align="center"/>
22092 <colspec colwidth="6*" align="right"/>
22095 <entry><option>dns_check_names_pattern</option></entry>
22096 <entry>Use: <emphasis>main</emphasis></entry>
22097 <entry>Type: <emphasis>string</emphasis></entry>
22098 <entry>Default: <emphasis>see below</emphasis></entry>
22104 <indexterm role="concept">
22105 <primary>DNS</primary>
22106 <secondary>pre-check of name syntax</secondary>
22108 When this option is set to a non-empty string, it causes Exim to check domain
22109 names for characters that are not allowed in host names before handing them to
22110 the DNS resolver, because some resolvers give temporary errors for names that
22111 contain unusual characters. If a domain name contains any unwanted characters,
22112 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
22113 done by matching the domain name against a regular expression, which is the
22114 value of this option. The default pattern is
22116 <literallayout class="monospaced">
22117 dns_check_names_pattern = \
22118 (?i)^(?>(?(1)\.|())[^\W_](?>[a-z0-9/-]*[^\W_])?)+$
22121 which permits only letters, digits, slashes, and hyphens in components, but
22122 they must start and end with a letter or digit. Slashes are not, in fact,
22123 permitted in host names, but they are found in certain NS records (which can be
22124 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
22125 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
22129 <indexterm role="option">
22130 <primary><option>dns_csa_search_limit</option></primary>
22133 <informaltable frame="all">
22134 <tgroup cols="4" colsep="0" rowsep="0">
22135 <colspec colwidth="8*" align="left"/>
22136 <colspec colwidth="6*" align="center"/>
22137 <colspec colwidth="6*" align="center"/>
22138 <colspec colwidth="6*" align="right"/>
22141 <entry><option>dns_csa_search_limit</option></entry>
22142 <entry>Use: <emphasis>main</emphasis></entry>
22143 <entry>Type: <emphasis>integer</emphasis></entry>
22144 <entry>Default: <emphasis>5</emphasis></entry>
22150 This option controls the depth of parental searching for CSA SRV records in the
22151 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
22154 <indexterm role="option">
22155 <primary><option>dns_csa_use_reverse</option></primary>
22158 <informaltable frame="all">
22159 <tgroup cols="4" colsep="0" rowsep="0">
22160 <colspec colwidth="8*" align="left"/>
22161 <colspec colwidth="6*" align="center"/>
22162 <colspec colwidth="6*" align="center"/>
22163 <colspec colwidth="6*" align="right"/>
22166 <entry><option>dns_csa_use_reverse</option></entry>
22167 <entry>Use: <emphasis>main</emphasis></entry>
22168 <entry>Type: <emphasis>boolean</emphasis></entry>
22169 <entry>Default: <emphasis>true</emphasis></entry>
22175 This option controls whether or not an IP address, given as a CSA domain, is
22176 reversed and looked up in the reverse DNS, as described in more detail in
22177 section <xref linkend="SECTverifyCSA"/>.
22180 <indexterm role="option">
22181 <primary><option>dns_ipv4_lookup</option></primary>
22184 <informaltable frame="all">
22185 <tgroup cols="4" colsep="0" rowsep="0">
22186 <colspec colwidth="8*" align="left"/>
22187 <colspec colwidth="6*" align="center"/>
22188 <colspec colwidth="6*" align="center"/>
22189 <colspec colwidth="6*" align="right"/>
22192 <entry><option>dns_ipv4_lookup</option></entry>
22193 <entry>Use: <emphasis>main</emphasis></entry>
22194 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
22195 <entry>Default: <emphasis>unset</emphasis></entry>
22201 <indexterm role="concept">
22202 <primary>IPv6</primary>
22203 <secondary>DNS lookup for AAAA records</secondary>
22205 <indexterm role="concept">
22206 <primary>DNS</primary>
22207 <secondary>IPv6 lookup for AAAA records</secondary>
22209 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
22210 looks for IPv6 address records (AAAA records) as well as IPv4 address records
22211 (A records) when trying to find IP addresses for hosts, unless the host’s
22212 domain matches this list.
22215 This is a fudge to help with name servers that give big delays or otherwise do
22216 not work for the AAAA record type. In due course, when the world’s name
22217 servers have all been upgraded, there should be no need for this option.
22220 <indexterm role="option">
22221 <primary><option>dns_retrans</option></primary>
22224 <informaltable frame="all">
22225 <tgroup cols="4" colsep="0" rowsep="0">
22226 <colspec colwidth="8*" align="left"/>
22227 <colspec colwidth="6*" align="center"/>
22228 <colspec colwidth="6*" align="center"/>
22229 <colspec colwidth="6*" align="right"/>
22232 <entry><option>dns_retrans</option></entry>
22233 <entry>Use: <emphasis>main</emphasis></entry>
22234 <entry>Type: <emphasis>time</emphasis></entry>
22235 <entry>Default: <emphasis>0s</emphasis></entry>
22241 <indexterm role="concept">
22242 <primary>DNS</primary>
22243 <secondary>resolver options</secondary>
22245 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
22246 retransmission and retry parameters for DNS lookups. Values of zero (the
22247 defaults) leave the system default settings unchanged. The first value is the
22248 time between retries, and the second is the number of retries. It isn’t
22249 totally clear exactly how these settings affect the total time a DNS lookup may
22250 take. I haven’t found any documentation about timeouts on DNS lookups; these
22251 parameter values are available in the external resolver interface structure,
22252 but nowhere does it seem to describe how they are used or what you might want
22256 <indexterm role="option">
22257 <primary><option>dns_retry</option></primary>
22260 <informaltable frame="all">
22261 <tgroup cols="4" colsep="0" rowsep="0">
22262 <colspec colwidth="8*" align="left"/>
22263 <colspec colwidth="6*" align="center"/>
22264 <colspec colwidth="6*" align="center"/>
22265 <colspec colwidth="6*" align="right"/>
22268 <entry><option>dns_retry</option></entry>
22269 <entry>Use: <emphasis>main</emphasis></entry>
22270 <entry>Type: <emphasis>integer</emphasis></entry>
22271 <entry>Default: <emphasis>0</emphasis></entry>
22277 See <option>dns_retrans</option> above.
22280 <indexterm role="option">
22281 <primary><option>drop_cr</option></primary>
22284 <informaltable frame="all">
22285 <tgroup cols="4" colsep="0" rowsep="0">
22286 <colspec colwidth="8*" align="left"/>
22287 <colspec colwidth="6*" align="center"/>
22288 <colspec colwidth="6*" align="center"/>
22289 <colspec colwidth="6*" align="right"/>
22292 <entry><option>drop_cr</option></entry>
22293 <entry>Use: <emphasis>main</emphasis></entry>
22294 <entry>Type: <emphasis>boolean</emphasis></entry>
22295 <entry>Default: <emphasis>false</emphasis></entry>
22301 This is an obsolete option that is now a no-op. It used to affect the way Exim
22302 handled CR and LF characters in incoming messages. What happens now is
22303 described in section <xref linkend="SECTlineendings"/>.
22306 <indexterm role="option">
22307 <primary><option>dsn_from</option></primary>
22310 <informaltable frame="all">
22311 <tgroup cols="4" colsep="0" rowsep="0">
22312 <colspec colwidth="8*" align="left"/>
22313 <colspec colwidth="6*" align="center"/>
22314 <colspec colwidth="6*" align="center"/>
22315 <colspec colwidth="6*" align="right"/>
22318 <entry><option>dsn_from</option></entry>
22319 <entry>Use: <emphasis>main</emphasis></entry>
22320 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22321 <entry>Default: <emphasis>see below</emphasis></entry>
22327 <indexterm role="concept">
22328 <primary><emphasis>From:</emphasis> header line</primary>
22329 <secondary>in bounces</secondary>
22331 <indexterm role="concept">
22332 <primary>bounce messages</primary>
22333 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
22335 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
22336 bounces and other automatically generated messages (<quote>Delivery Status
22337 Notifications</quote> – hence the name of the option). The default setting is:
22339 <literallayout class="monospaced">
22340 dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain>
22343 The value is expanded every time it is needed. If the expansion fails, a
22344 panic is logged, and the default value is used.
22347 <indexterm role="option">
22348 <primary><option>envelope_to_remove</option></primary>
22351 <informaltable frame="all">
22352 <tgroup cols="4" colsep="0" rowsep="0">
22353 <colspec colwidth="8*" align="left"/>
22354 <colspec colwidth="6*" align="center"/>
22355 <colspec colwidth="6*" align="center"/>
22356 <colspec colwidth="6*" align="right"/>
22359 <entry><option>envelope_to_remove</option></entry>
22360 <entry>Use: <emphasis>main</emphasis></entry>
22361 <entry>Type: <emphasis>boolean</emphasis></entry>
22362 <entry>Default: <emphasis>true</emphasis></entry>
22368 <indexterm role="concept">
22369 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
22371 Exim’s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
22372 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
22373 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
22374 messages’s envelope that caused the delivery to happen. Such headers should not
22375 be present in incoming messages, and this option causes them to be removed at
22376 the time the message is received, to avoid any problems that might occur when a
22377 delivered message is subsequently sent on to some other recipient.
22380 <indexterm role="option">
22381 <primary><option>errors_copy</option></primary>
22384 <informaltable frame="all">
22385 <tgroup cols="4" colsep="0" rowsep="0">
22386 <colspec colwidth="8*" align="left"/>
22387 <colspec colwidth="6*" align="center"/>
22388 <colspec colwidth="6*" align="center"/>
22389 <colspec colwidth="6*" align="right"/>
22392 <entry><option>errors_copy</option></entry>
22393 <entry>Use: <emphasis>main</emphasis></entry>
22394 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
22395 <entry>Default: <emphasis>unset</emphasis></entry>
22401 <indexterm role="concept">
22402 <primary>bounce message</primary>
22403 <secondary>copy to other address</secondary>
22405 <indexterm role="concept">
22406 <primary>copy of bounce message</primary>
22408 Setting this option causes Exim to send bcc copies of bounce messages that it
22409 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
22410 coming from elsewhere. The value of the option is a colon-separated list of
22411 items. Each item consists of a pattern, terminated by white space, followed by
22412 a comma-separated list of email addresses. If a pattern contains spaces, it
22413 must be enclosed in double quotes.
22416 Each pattern is processed in the same way as a single item in an address list
22417 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
22418 the bounce message, the message is copied to the addresses on the list. The
22419 items are scanned in order, and once a matching one is found, no further items
22420 are examined. For example:
22422 <literallayout class="monospaced">
22423 errors_copy = spqr@mydomain postmaster@mydomain.example :\
22424 rqps@mydomain hostmaster@mydomain.example,\
22425 postmaster@mydomain.example
22428 <indexterm role="variable">
22429 <primary><varname>$domain</varname></primary>
22431 <indexterm role="variable">
22432 <primary><varname>$local_part</varname></primary>
22434 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
22435 and <varname>$domain</varname> are set from the original recipient of the error message, and if
22436 there was any wildcard matching in the pattern, the expansion
22437 <indexterm role="concept">
22438 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22439 <secondary>in <option>errors_copy</option></secondary>
22441 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
22444 <indexterm role="option">
22445 <primary><option>errors_reply_to</option></primary>
22448 <informaltable frame="all">
22449 <tgroup cols="4" colsep="0" rowsep="0">
22450 <colspec colwidth="8*" align="left"/>
22451 <colspec colwidth="6*" align="center"/>
22452 <colspec colwidth="6*" align="center"/>
22453 <colspec colwidth="6*" align="right"/>
22456 <entry><option>errors_reply_to</option></entry>
22457 <entry>Use: <emphasis>main</emphasis></entry>
22458 <entry>Type: <emphasis>string</emphasis></entry>
22459 <entry>Default: <emphasis>unset</emphasis></entry>
22465 <indexterm role="concept">
22466 <primary>bounce message</primary>
22467 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
22469 By default, Exim’s bounce and delivery warning messages contain the header line
22472 <literal>From: Mail Delivery System <Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>></literal>
22475 <indexterm role="option">
22476 <primary><option>quota_warn_message</option></primary>
22478 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
22479 A warning message that is generated by the <option>quota_warn_message</option> option in an
22480 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
22481 overrides the default.
22484 Experience shows that people reply to bounce messages. If the
22485 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
22486 and warning messages. For example:
22488 <literallayout class="monospaced">
22489 errors_reply_to = postmaster@my.domain.example
22492 The value of the option is not expanded. It must specify a valid RFC 2822
22493 address. However, if a warning message that is generated by the
22494 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
22495 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
22499 <indexterm role="option">
22500 <primary><option>exim_group</option></primary>
22503 <informaltable frame="all">
22504 <tgroup cols="4" colsep="0" rowsep="0">
22505 <colspec colwidth="8*" align="left"/>
22506 <colspec colwidth="6*" align="center"/>
22507 <colspec colwidth="6*" align="center"/>
22508 <colspec colwidth="6*" align="right"/>
22511 <entry><option>exim_group</option></entry>
22512 <entry>Use: <emphasis>main</emphasis></entry>
22513 <entry>Type: <emphasis>string</emphasis></entry>
22514 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22520 <indexterm role="concept">
22521 <primary>gid (group id)</primary>
22522 <secondary>Exim’s own</secondary>
22524 <indexterm role="concept">
22525 <primary>Exim group</primary>
22527 This option changes the gid under which Exim runs when it gives up root
22528 privilege. The default value is compiled into the binary. The value of this
22529 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
22530 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
22531 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
22535 <indexterm role="option">
22536 <primary><option>exim_path</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>exim_path</option></entry>
22548 <entry>Use: <emphasis>main</emphasis></entry>
22549 <entry>Type: <emphasis>string</emphasis></entry>
22550 <entry>Default: <emphasis>see below</emphasis></entry>
22556 <indexterm role="concept">
22557 <primary>Exim binary, path name</primary>
22559 This option specifies the path name of the Exim binary, which is used when Exim
22560 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
22561 the directory configured at compile time by the BIN_DIRECTORY setting. It
22562 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
22564 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
22565 you will break those Exim utilities that scan the configuration file to find
22566 where the binary is. (They then use the <option>-bP</option> option to extract option
22567 settings such as the value of <option>spool_directory</option>.)
22570 <indexterm role="option">
22571 <primary><option>exim_user</option></primary>
22574 <informaltable frame="all">
22575 <tgroup cols="4" colsep="0" rowsep="0">
22576 <colspec colwidth="8*" align="left"/>
22577 <colspec colwidth="6*" align="center"/>
22578 <colspec colwidth="6*" align="center"/>
22579 <colspec colwidth="6*" align="right"/>
22582 <entry><option>exim_user</option></entry>
22583 <entry>Use: <emphasis>main</emphasis></entry>
22584 <entry>Type: <emphasis>string</emphasis></entry>
22585 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
22591 <indexterm role="concept">
22592 <primary>uid (user id)</primary>
22593 <secondary>Exim’s own</secondary>
22595 <indexterm role="concept">
22596 <primary>Exim user</primary>
22598 This option changes the uid under which Exim runs when it gives up root
22599 privilege. The default value is compiled into the binary. Ownership of the run
22600 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
22601 options is checked against the values in the binary, not what is set here.
22604 Unless it consists entirely of digits, the string is looked up using
22605 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
22606 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
22607 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
22610 <indexterm role="option">
22611 <primary><option>extra_local_interfaces</option></primary>
22614 <informaltable frame="all">
22615 <tgroup cols="4" colsep="0" rowsep="0">
22616 <colspec colwidth="8*" align="left"/>
22617 <colspec colwidth="6*" align="center"/>
22618 <colspec colwidth="6*" align="center"/>
22619 <colspec colwidth="6*" align="right"/>
22622 <entry><option>extra_local_interfaces</option></entry>
22623 <entry>Use: <emphasis>main</emphasis></entry>
22624 <entry>Type: <emphasis>string list</emphasis></entry>
22625 <entry>Default: <emphasis>unset</emphasis></entry>
22631 This option defines network interfaces that are to be considered local when
22632 routing, but which are not used for listening by the daemon. See section
22633 <xref linkend="SECTreclocipadd"/> for details.
22636 <indexterm role="option">
22637 <primary><option>extract_addresses_remove_arguments</option></primary>
22640 <informaltable frame="all">
22641 <tgroup cols="4" colsep="0" rowsep="0">
22642 <colspec colwidth="8*" align="left"/>
22643 <colspec colwidth="6*" align="center"/>
22644 <colspec colwidth="6*" align="center"/>
22645 <colspec colwidth="6*" align="right"/>
22648 <entry><option>extract_addresses_remove_ arguments</option></entry>
22649 <entry>Use: <emphasis>main</emphasis></entry>
22650 <entry>Type: <emphasis>boolean</emphasis></entry>
22651 <entry>Default: <emphasis>true</emphasis></entry>
22657 <indexterm role="option">
22658 <primary><option>-t</option></primary>
22660 <indexterm role="concept">
22661 <primary>command line</primary>
22662 <secondary>addresses with <option>-t</option></secondary>
22664 <indexterm role="concept">
22665 <primary>Sendmail compatibility</primary>
22666 <secondary><option>-t</option> option</secondary>
22668 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
22669 are present on the command line when the <option>-t</option> option is used to build an
22670 envelope from a message’s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
22671 line addresses are removed from the recipients list. This is also how Smail
22672 behaves. However, other Sendmail documentation (the O’Reilly book) states that
22673 command line addresses are added to those obtained from the header lines. When
22674 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
22675 argument headers. If it is set false, Exim adds rather than removes argument
22679 <indexterm role="option">
22680 <primary><option>finduser_retries</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>finduser_retries</option></entry>
22692 <entry>Use: <emphasis>main</emphasis></entry>
22693 <entry>Type: <emphasis>integer</emphasis></entry>
22694 <entry>Default: <emphasis>0</emphasis></entry>
22700 <indexterm role="concept">
22701 <primary>NIS, retrying user lookups</primary>
22703 On systems running NIS or other schemes in which user and group information is
22704 distributed from a remote system, there can be times when <function>getpwnam()</function> and
22705 related functions fail, even when given valid data, because things time out.
22706 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
22707 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
22708 many extra times to find a user or a group, waiting for one second between
22712 <indexterm role="concept">
22713 <primary><filename>/etc/passwd</filename></primary>
22714 <secondary>multiple reading of</secondary>
22716 You should not set this option greater than zero if your user information is in
22717 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
22718 search the file multiple times for non-existent users, and also cause delay.
22721 <indexterm role="option">
22722 <primary><option>freeze_tell</option></primary>
22725 <informaltable frame="all">
22726 <tgroup cols="4" colsep="0" rowsep="0">
22727 <colspec colwidth="8*" align="left"/>
22728 <colspec colwidth="6*" align="center"/>
22729 <colspec colwidth="6*" align="center"/>
22730 <colspec colwidth="6*" align="right"/>
22733 <entry><option>freeze_tell</option></entry>
22734 <entry>Use: <emphasis>main</emphasis></entry>
22735 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
22736 <entry>Default: <emphasis>unset</emphasis></entry>
22742 <indexterm role="concept">
22743 <primary>freezing messages</primary>
22744 <secondary>sending a message when freezing</secondary>
22746 On encountering certain errors, or when configured to do so in a system filter,
22747 ACL, or special router, Exim freezes a message. This means that no further
22748 delivery attempts take place until an administrator thaws the message, or the
22749 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
22750 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
22751 warning message whenever it freezes something, unless the message it is
22752 freezing is a locally-generated bounce message. (Without this exception there
22753 is the possibility of looping.) The warning message is sent to the addresses
22754 supplied as the comma-separated value of this option. If several of the
22755 message’s addresses cause freezing, only a single message is sent. If the
22756 freezing was automatic, the reason(s) for freezing can be found in the message
22757 log. If you configure freezing in a filter or ACL, you must arrange for any
22758 logging that you require.
22761 <indexterm role="option">
22762 <primary><option>gecos_name</option></primary>
22765 <informaltable frame="all">
22766 <tgroup cols="4" colsep="0" rowsep="0">
22767 <colspec colwidth="8*" align="left"/>
22768 <colspec colwidth="6*" align="center"/>
22769 <colspec colwidth="6*" align="center"/>
22770 <colspec colwidth="6*" align="right"/>
22773 <entry><option>gecos_name</option></entry>
22774 <entry>Use: <emphasis>main</emphasis></entry>
22775 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
22776 <entry>Default: <emphasis>unset</emphasis></entry>
22782 <indexterm role="concept">
22783 <primary>HP-UX</primary>
22785 <indexterm role="concept">
22786 <primary><quote>gecos</quote> field, parsing</primary>
22788 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22789 password file to hold other information in addition to users’ real names. Exim
22790 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22791 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22792 of the field are used unchanged, except that, if an ampersand is encountered,
22793 it is replaced by the user’s login name with the first character forced to
22794 upper case, since this is a convention that is observed on many systems.
22797 When these options are set, <option>gecos_pattern</option> is treated as a regular
22798 expression that is to be applied to the field (again with & replaced by the
22799 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22800 user’s name.
22803 <indexterm role="concept">
22804 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22805 <secondary>in <option>gecos_name</option></secondary>
22807 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22808 pick up sub-fields that were matched by the pattern. In HP-UX, where the user’s
22809 name terminates at the first comma, the following can be used:
22811 <literallayout class="monospaced">
22812 gecos_pattern = ([^,]*)
22816 <indexterm role="option">
22817 <primary><option>gecos_pattern</option></primary>
22820 <informaltable frame="all">
22821 <tgroup cols="4" colsep="0" rowsep="0">
22822 <colspec colwidth="8*" align="left"/>
22823 <colspec colwidth="6*" align="center"/>
22824 <colspec colwidth="6*" align="center"/>
22825 <colspec colwidth="6*" align="right"/>
22828 <entry><option>gecos_pattern</option></entry>
22829 <entry>Use: <emphasis>main</emphasis></entry>
22830 <entry>Type: <emphasis>string</emphasis></entry>
22831 <entry>Default: <emphasis>unset</emphasis></entry>
22837 See <option>gecos_name</option> above.
22840 <indexterm role="option">
22841 <primary><option>gnutls_require_kx</option></primary>
22844 <informaltable frame="all">
22845 <tgroup cols="4" colsep="0" rowsep="0">
22846 <colspec colwidth="8*" align="left"/>
22847 <colspec colwidth="6*" align="center"/>
22848 <colspec colwidth="6*" align="center"/>
22849 <colspec colwidth="6*" align="right"/>
22852 <entry><option>gnutls_require_kx</option></entry>
22853 <entry>Use: <emphasis>main</emphasis></entry>
22854 <entry>Type: <emphasis>string</emphasis></entry>
22855 <entry>Default: <emphasis>unset</emphasis></entry>
22861 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
22862 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22865 <indexterm role="option">
22866 <primary><option>gnutls_require_mac</option></primary>
22869 <informaltable frame="all">
22870 <tgroup cols="4" colsep="0" rowsep="0">
22871 <colspec colwidth="8*" align="left"/>
22872 <colspec colwidth="6*" align="center"/>
22873 <colspec colwidth="6*" align="center"/>
22874 <colspec colwidth="6*" align="right"/>
22877 <entry><option>gnutls_require_mac</option></entry>
22878 <entry>Use: <emphasis>main</emphasis></entry>
22879 <entry>Type: <emphasis>string</emphasis></entry>
22880 <entry>Default: <emphasis>unset</emphasis></entry>
22886 This option controls the MAC algorithms when GnuTLS is used in an Exim
22887 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22890 <indexterm role="option">
22891 <primary><option>gnutls_require_protocols</option></primary>
22894 <informaltable frame="all">
22895 <tgroup cols="4" colsep="0" rowsep="0">
22896 <colspec colwidth="8*" align="left"/>
22897 <colspec colwidth="6*" align="center"/>
22898 <colspec colwidth="6*" align="center"/>
22899 <colspec colwidth="6*" align="right"/>
22902 <entry><option>gnutls_require_protocols</option></entry>
22903 <entry>Use: <emphasis>main</emphasis></entry>
22904 <entry>Type: <emphasis>string</emphasis></entry>
22905 <entry>Default: <emphasis>unset</emphasis></entry>
22911 This option controls the protocols when GnuTLS is used in an Exim
22912 server. For details, see section <xref linkend="SECTreqciphgnu"/>.
22915 <indexterm role="option">
22916 <primary><option>gnutls_compat_mode</option></primary>
22919 <informaltable frame="all">
22920 <tgroup cols="4" colsep="0" rowsep="0">
22921 <colspec colwidth="8*" align="left"/>
22922 <colspec colwidth="6*" align="center"/>
22923 <colspec colwidth="6*" align="center"/>
22924 <colspec colwidth="6*" align="right"/>
22927 <entry><option>gnutls_compat_mode</option></entry>
22928 <entry>Use: <emphasis>main</emphasis></entry>
22929 <entry>Type: <emphasis>boolean</emphasis></entry>
22930 <entry>Default: <emphasis>unset</emphasis></entry>
22936 This option controls whether GnuTLS is used in compatibility mode in an Exim
22937 server. This reduces security slightly, but improves interworking with older
22938 implementations of TLS.
22941 <indexterm role="option">
22942 <primary><option>headers_charset</option></primary>
22945 <informaltable frame="all">
22946 <tgroup cols="4" colsep="0" rowsep="0">
22947 <colspec colwidth="8*" align="left"/>
22948 <colspec colwidth="6*" align="center"/>
22949 <colspec colwidth="6*" align="center"/>
22950 <colspec colwidth="6*" align="right"/>
22953 <entry><option>headers_charset</option></entry>
22954 <entry>Use: <emphasis>main</emphasis></entry>
22955 <entry>Type: <emphasis>string</emphasis></entry>
22956 <entry>Default: <emphasis>see below</emphasis></entry>
22962 This option sets a default character set for translating from encoded MIME
22963 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22964 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22965 ultimate default is ISO-8859-1. For more details see the description of header
22966 insertions in section <xref linkend="SECTexpansionitems"/>.
22969 <indexterm role="option">
22970 <primary><option>header_maxsize</option></primary>
22973 <informaltable frame="all">
22974 <tgroup cols="4" colsep="0" rowsep="0">
22975 <colspec colwidth="8*" align="left"/>
22976 <colspec colwidth="6*" align="center"/>
22977 <colspec colwidth="6*" align="center"/>
22978 <colspec colwidth="6*" align="right"/>
22981 <entry><option>header_maxsize</option></entry>
22982 <entry>Use: <emphasis>main</emphasis></entry>
22983 <entry>Type: <emphasis>integer</emphasis></entry>
22984 <entry>Default: <emphasis>see below</emphasis></entry>
22990 <indexterm role="concept">
22991 <primary>header section</primary>
22992 <secondary>maximum size of</secondary>
22994 <indexterm role="concept">
22995 <primary>limit</primary>
22996 <secondary>size of message header section</secondary>
22998 This option controls the overall maximum size of a message’s header
22999 section. The default is the value of HEADER_MAXSIZE in
23000 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
23001 sections are rejected.
23004 <indexterm role="option">
23005 <primary><option>header_line_maxsize</option></primary>
23008 <informaltable frame="all">
23009 <tgroup cols="4" colsep="0" rowsep="0">
23010 <colspec colwidth="8*" align="left"/>
23011 <colspec colwidth="6*" align="center"/>
23012 <colspec colwidth="6*" align="center"/>
23013 <colspec colwidth="6*" align="right"/>
23016 <entry><option>header_line_maxsize</option></entry>
23017 <entry>Use: <emphasis>main</emphasis></entry>
23018 <entry>Type: <emphasis>integer</emphasis></entry>
23019 <entry>Default: <emphasis>0</emphasis></entry>
23025 <indexterm role="concept">
23026 <primary>header lines</primary>
23027 <secondary>maximum size of</secondary>
23029 <indexterm role="concept">
23030 <primary>limit</primary>
23031 <secondary>size of one header line</secondary>
23033 This option limits the length of any individual header line in a message, after
23034 all the continuations have been joined together. Messages with individual
23035 header lines that are longer than the limit are rejected. The default value of
23036 zero means <quote>no limit</quote>.
23039 <indexterm role="option">
23040 <primary><option>helo_accept_junk_hosts</option></primary>
23043 <informaltable frame="all">
23044 <tgroup cols="4" colsep="0" rowsep="0">
23045 <colspec colwidth="8*" align="left"/>
23046 <colspec colwidth="6*" align="center"/>
23047 <colspec colwidth="6*" align="center"/>
23048 <colspec colwidth="6*" align="right"/>
23051 <entry><option>helo_accept_junk_hosts</option></entry>
23052 <entry>Use: <emphasis>main</emphasis></entry>
23053 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23054 <entry>Default: <emphasis>unset</emphasis></entry>
23060 <indexterm role="concept">
23061 <primary>HELO</primary>
23062 <secondary>accepting junk data</secondary>
23064 <indexterm role="concept">
23065 <primary>EHLO</primary>
23066 <secondary>accepting junk data</secondary>
23068 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
23069 mail, and gives an error response for invalid data. Unfortunately, there are
23070 some SMTP clients that send syntactic junk. They can be accommodated by setting
23071 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
23072 if you want to do semantic checking.
23073 See also <option>helo_allow_chars</option> for a way of extending the permitted character
23077 <indexterm role="option">
23078 <primary><option>helo_allow_chars</option></primary>
23081 <informaltable frame="all">
23082 <tgroup cols="4" colsep="0" rowsep="0">
23083 <colspec colwidth="8*" align="left"/>
23084 <colspec colwidth="6*" align="center"/>
23085 <colspec colwidth="6*" align="center"/>
23086 <colspec colwidth="6*" align="right"/>
23089 <entry><option>helo_allow_chars</option></entry>
23090 <entry>Use: <emphasis>main</emphasis></entry>
23091 <entry>Type: <emphasis>string</emphasis></entry>
23092 <entry>Default: <emphasis>unset</emphasis></entry>
23098 <indexterm role="concept">
23099 <primary>HELO</primary>
23100 <secondary>underscores in</secondary>
23102 <indexterm role="concept">
23103 <primary>EHLO</primary>
23104 <secondary>underscores in</secondary>
23106 <indexterm role="concept">
23107 <primary>underscore in EHLO/HELO</primary>
23109 This option can be set to a string of rogue characters that are permitted in
23110 all EHLO and HELO names in addition to the standard letters, digits,
23111 hyphens, and dots. If you really must allow underscores, you can set
23113 <literallayout class="monospaced">
23114 helo_allow_chars = _
23117 Note that the value is one string, not a list.
23120 <indexterm role="option">
23121 <primary><option>helo_lookup_domains</option></primary>
23124 <informaltable frame="all">
23125 <tgroup cols="4" colsep="0" rowsep="0">
23126 <colspec colwidth="8*" align="left"/>
23127 <colspec colwidth="6*" align="center"/>
23128 <colspec colwidth="6*" align="center"/>
23129 <colspec colwidth="6*" align="right"/>
23132 <entry><option>helo_lookup_domains</option></entry>
23133 <entry>Use: <emphasis>main</emphasis></entry>
23134 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23135 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
23141 <indexterm role="concept">
23142 <primary>HELO</primary>
23143 <secondary>forcing reverse lookup</secondary>
23145 <indexterm role="concept">
23146 <primary>EHLO</primary>
23147 <secondary>forcing reverse lookup</secondary>
23149 If the domain given by a client in a HELO or EHLO command matches this
23150 list, a reverse lookup is done in order to establish the host’s true name. The
23151 default forces a lookup if the client host gives the server’s name or any of
23152 its IP addresses (in brackets), something that broken clients have been seen to
23156 <indexterm role="option">
23157 <primary><option>helo_try_verify_hosts</option></primary>
23160 <informaltable frame="all">
23161 <tgroup cols="4" colsep="0" rowsep="0">
23162 <colspec colwidth="8*" align="left"/>
23163 <colspec colwidth="6*" align="center"/>
23164 <colspec colwidth="6*" align="center"/>
23165 <colspec colwidth="6*" align="right"/>
23168 <entry><option>helo_try_verify_hosts</option></entry>
23169 <entry>Use: <emphasis>main</emphasis></entry>
23170 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23171 <entry>Default: <emphasis>unset</emphasis></entry>
23177 <indexterm role="concept">
23178 <primary>HELO verifying</primary>
23179 <secondary>optional</secondary>
23181 <indexterm role="concept">
23182 <primary>EHLO</primary>
23183 <secondary>verifying, optional</secondary>
23185 By default, Exim just checks the syntax of HELO and EHLO commands (see
23186 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
23187 to do more extensive checking of the data supplied by these commands. The ACL
23188 condition <literal>verify = helo</literal> is provided to make this possible.
23189 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
23190 to force the check to occur. From release 4.53 onwards, this is no longer
23191 necessary. If the check has not been done before <literal>verify = helo</literal> is
23192 encountered, it is done at that time. Consequently, this option is obsolete.
23193 Its specification is retained here for backwards compatibility.
23196 When an EHLO or HELO command is received, if the calling host matches
23197 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
23198 EHLO command either:
23203 is an IP literal matching the calling address of the host, or
23208 <indexterm role="concept">
23209 <primary>DNS</primary>
23210 <secondary>reverse lookup</secondary>
23212 <indexterm role="concept">
23213 <primary>reverse DNS lookup</primary>
23215 matches the host name that Exim obtains by doing a reverse lookup of the
23216 calling host address, or
23221 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
23222 available) yields the calling host address.
23227 However, the EHLO or HELO command is not rejected if any of the checks
23228 fail. Processing continues, but the result of the check is remembered, and can
23229 be detected later in an ACL by the <literal>verify = helo</literal> condition.
23232 <indexterm role="option">
23233 <primary><option>helo_verify_hosts</option></primary>
23236 <informaltable frame="all">
23237 <tgroup cols="4" colsep="0" rowsep="0">
23238 <colspec colwidth="8*" align="left"/>
23239 <colspec colwidth="6*" align="center"/>
23240 <colspec colwidth="6*" align="center"/>
23241 <colspec colwidth="6*" align="right"/>
23244 <entry><option>helo_verify_hosts</option></entry>
23245 <entry>Use: <emphasis>main</emphasis></entry>
23246 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23247 <entry>Default: <emphasis>unset</emphasis></entry>
23253 <indexterm role="concept">
23254 <primary>HELO verifying</primary>
23255 <secondary>mandatory</secondary>
23257 <indexterm role="concept">
23258 <primary>EHLO</primary>
23259 <secondary>verifying, mandatory</secondary>
23261 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
23262 backwards compatibility. For hosts that match this option, Exim checks the host
23263 name given in the HELO or EHLO in the same way as for
23264 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
23265 rejected with a 550 error, and entries are written to the main and reject logs.
23266 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
23270 <indexterm role="option">
23271 <primary><option>hold_domains</option></primary>
23274 <informaltable frame="all">
23275 <tgroup cols="4" colsep="0" rowsep="0">
23276 <colspec colwidth="8*" align="left"/>
23277 <colspec colwidth="6*" align="center"/>
23278 <colspec colwidth="6*" align="center"/>
23279 <colspec colwidth="6*" align="right"/>
23282 <entry><option>hold_domains</option></entry>
23283 <entry>Use: <emphasis>main</emphasis></entry>
23284 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23285 <entry>Default: <emphasis>unset</emphasis></entry>
23291 <indexterm role="concept">
23292 <primary>domain</primary>
23293 <secondary>delaying delivery</secondary>
23295 <indexterm role="concept">
23296 <primary>delivery</primary>
23297 <secondary>delaying certain domains</secondary>
23299 This option allows mail for particular domains to be held on the queue
23300 manually. The option is overridden if a message delivery is forced with the
23301 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
23302 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
23303 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
23304 it is deferred every time the message is looked at.
23307 This option is intended as a temporary operational measure for delaying the
23308 delivery of mail while some problem is being sorted out, or some new
23309 configuration tested. If you just want to delay the processing of some
23310 domains until a queue run occurs, you should use <option>queue_domains</option> or
23311 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
23314 A setting of <option>hold_domains</option> does not override Exim’s code for removing
23315 messages from the queue if they have been there longer than the longest retry
23316 time in any retry rule. If you want to hold messages for longer than the normal
23317 retry times, insert a dummy retry rule with a long retry time.
23320 <indexterm role="option">
23321 <primary><option>host_lookup</option></primary>
23324 <informaltable frame="all">
23325 <tgroup cols="4" colsep="0" rowsep="0">
23326 <colspec colwidth="8*" align="left"/>
23327 <colspec colwidth="6*" align="center"/>
23328 <colspec colwidth="6*" align="center"/>
23329 <colspec colwidth="6*" align="right"/>
23332 <entry><option>host_lookup</option></entry>
23333 <entry>Use: <emphasis>main</emphasis></entry>
23334 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23335 <entry>Default: <emphasis>unset</emphasis></entry>
23341 <indexterm role="concept">
23342 <primary>host name</primary>
23343 <secondary>lookup, forcing</secondary>
23345 Exim does not look up the name of a calling host from its IP address unless it
23346 is required to compare against some host list, or the host matches
23347 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
23348 option (which normally contains IP addresses rather than host names). The
23349 default configuration file contains
23351 <literallayout class="monospaced">
23355 which causes a lookup to happen for all hosts. If the expense of these lookups
23356 is felt to be too great, the setting can be changed or removed.
23359 After a successful reverse lookup, Exim does a forward lookup on the name it
23360 has obtained, to verify that it yields the IP address that it started with. If
23361 this check fails, Exim behaves as if the name lookup failed.
23364 <indexterm role="variable">
23365 <primary><varname>$host_lookup_failed</varname></primary>
23367 <indexterm role="variable">
23368 <primary><varname>$sender_host_name</varname></primary>
23370 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
23371 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
23372 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
23373 <literal>verify = reverse_host_lookup</literal> in ACLs.
23376 <indexterm role="option">
23377 <primary><option>host_lookup_order</option></primary>
23380 <informaltable frame="all">
23381 <tgroup cols="4" colsep="0" rowsep="0">
23382 <colspec colwidth="8*" align="left"/>
23383 <colspec colwidth="6*" align="center"/>
23384 <colspec colwidth="6*" align="center"/>
23385 <colspec colwidth="6*" align="right"/>
23388 <entry><option>host_lookup_order</option></entry>
23389 <entry>Use: <emphasis>main</emphasis></entry>
23390 <entry>Type: <emphasis>string list</emphasis></entry>
23391 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
23397 This option specifies the order of different lookup methods when Exim is trying
23398 to find a host name from an IP address. The default is to do a DNS lookup
23399 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
23400 if that fails. You can change the order of these lookups, or omit one entirely,
23404 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
23405 multiple PTR records in the DNS and the IP address is not listed in
23406 <filename>/etc/hosts</filename>. Different operating systems give different results in this
23407 case. That is why the default tries a DNS lookup first.
23410 <indexterm role="option">
23411 <primary><option>host_reject_connection</option></primary>
23414 <informaltable frame="all">
23415 <tgroup cols="4" colsep="0" rowsep="0">
23416 <colspec colwidth="8*" align="left"/>
23417 <colspec colwidth="6*" align="center"/>
23418 <colspec colwidth="6*" align="center"/>
23419 <colspec colwidth="6*" align="right"/>
23422 <entry><option>host_reject_connection</option></entry>
23423 <entry>Use: <emphasis>main</emphasis></entry>
23424 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23425 <entry>Default: <emphasis>unset</emphasis></entry>
23431 <indexterm role="concept">
23432 <primary>host</primary>
23433 <secondary>rejecting connections from</secondary>
23435 If this option is set, incoming SMTP calls from the hosts listed are rejected
23436 as soon as the connection is made.
23437 This option is obsolete, and retained only for backward compatibility, because
23438 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
23439 connections immediately.
23442 The ability to give an immediate rejection (either by this option or using an
23443 ACL) is provided for use in unusual cases. Many hosts will just try again,
23444 sometimes without much delay. Normally, it is better to use an ACL to reject
23445 incoming messages at a later stage, such as after RCPT commands. See
23446 chapter <xref linkend="CHAPACL"/>.
23449 <indexterm role="option">
23450 <primary><option>hosts_connection_nolog</option></primary>
23453 <informaltable frame="all">
23454 <tgroup cols="4" colsep="0" rowsep="0">
23455 <colspec colwidth="8*" align="left"/>
23456 <colspec colwidth="6*" align="center"/>
23457 <colspec colwidth="6*" align="center"/>
23458 <colspec colwidth="6*" align="right"/>
23461 <entry><option>hosts_connection_nolog</option></entry>
23462 <entry>Use: <emphasis>main</emphasis></entry>
23463 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23464 <entry>Default: <emphasis>unset</emphasis></entry>
23470 <indexterm role="concept">
23471 <primary>host</primary>
23472 <secondary>not logging connections from</secondary>
23474 This option defines a list of hosts for which connection logging does not
23475 happen, even though the <option>smtp_connection</option> log selector is set. For example,
23476 you might want not to log SMTP connections from local processes, or from
23477 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
23478 the daemon; you should therefore strive to restrict its value to a short inline
23479 list of IP addresses and networks. To disable logging SMTP connections from
23480 local processes, you must create a host list with an empty item. For example:
23482 <literallayout class="monospaced">
23483 hosts_connection_nolog = :
23486 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
23489 <indexterm role="option">
23490 <primary><option>hosts_treat_as_local</option></primary>
23493 <informaltable frame="all">
23494 <tgroup cols="4" colsep="0" rowsep="0">
23495 <colspec colwidth="8*" align="left"/>
23496 <colspec colwidth="6*" align="center"/>
23497 <colspec colwidth="6*" align="center"/>
23498 <colspec colwidth="6*" align="right"/>
23501 <entry><option>hosts_treat_as_local</option></entry>
23502 <entry>Use: <emphasis>main</emphasis></entry>
23503 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
23504 <entry>Default: <emphasis>unset</emphasis></entry>
23510 <indexterm role="concept">
23511 <primary>local host</primary>
23512 <secondary>domains treated as</secondary>
23514 <indexterm role="concept">
23515 <primary>host</primary>
23516 <secondary>treated as local</secondary>
23518 If this option is set, any host names that match the domain list are treated as
23519 if they were the local host when Exim is scanning host lists obtained from MX
23521 or other sources. Note that the value of this option is a domain list, not a
23522 host list, because it is always used to check host names, not IP addresses.
23525 This option also applies when Exim is matching the special items
23526 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
23527 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
23528 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
23529 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
23530 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
23531 interfaces and recognizing the local host.
23534 <indexterm role="option">
23535 <primary><option>ibase_servers</option></primary>
23538 <informaltable frame="all">
23539 <tgroup cols="4" colsep="0" rowsep="0">
23540 <colspec colwidth="8*" align="left"/>
23541 <colspec colwidth="6*" align="center"/>
23542 <colspec colwidth="6*" align="center"/>
23543 <colspec colwidth="6*" align="right"/>
23546 <entry><option>ibase_servers</option></entry>
23547 <entry>Use: <emphasis>main</emphasis></entry>
23548 <entry>Type: <emphasis>string list</emphasis></entry>
23549 <entry>Default: <emphasis>unset</emphasis></entry>
23555 <indexterm role="concept">
23556 <primary>InterBase</primary>
23557 <secondary>server list</secondary>
23559 This option provides a list of InterBase servers and associated connection data,
23560 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
23561 The option is available only if Exim has been built with InterBase support.
23564 <indexterm role="option">
23565 <primary><option>ignore_bounce_errors_after</option></primary>
23568 <informaltable frame="all">
23569 <tgroup cols="4" colsep="0" rowsep="0">
23570 <colspec colwidth="8*" align="left"/>
23571 <colspec colwidth="6*" align="center"/>
23572 <colspec colwidth="6*" align="center"/>
23573 <colspec colwidth="6*" align="right"/>
23576 <entry><option>ignore_bounce_errors_after</option></entry>
23577 <entry>Use: <emphasis>main</emphasis></entry>
23578 <entry>Type: <emphasis>time</emphasis></entry>
23579 <entry>Default: <emphasis>10w</emphasis></entry>
23585 <indexterm role="concept">
23586 <primary>bounce message</primary>
23587 <secondary>discarding</secondary>
23589 <indexterm role="concept">
23590 <primary>discarding bounce message</primary>
23592 This option affects the processing of bounce messages that cannot be delivered,
23593 that is, those that suffer a permanent delivery failure. (Bounce messages that
23594 suffer temporary delivery failures are of course retried in the usual way.)
23597 After a permanent delivery failure, bounce messages are frozen,
23598 because there is no sender to whom they can be returned. When a frozen bounce
23599 message has been on the queue for more than the given time, it is unfrozen at
23600 the next queue run, and a further delivery is attempted. If delivery fails
23601 again, the bounce message is discarded. This makes it possible to keep failed
23602 bounce messages around for a shorter time than the normal maximum retry time
23603 for frozen messages. For example,
23605 <literallayout class="monospaced">
23606 ignore_bounce_errors_after = 12h
23609 retries failed bounce message deliveries after 12 hours, discarding any further
23610 failures. If the value of this option is set to a zero time period, bounce
23611 failures are discarded immediately. Setting a very long time (as in the default
23612 value) has the effect of disabling this option. For ways of automatically
23613 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
23614 <option>timeout_frozen_after</option>.
23617 <indexterm role="option">
23618 <primary><option>ignore_fromline_hosts</option></primary>
23621 <informaltable frame="all">
23622 <tgroup cols="4" colsep="0" rowsep="0">
23623 <colspec colwidth="8*" align="left"/>
23624 <colspec colwidth="6*" align="center"/>
23625 <colspec colwidth="6*" align="center"/>
23626 <colspec colwidth="6*" align="right"/>
23629 <entry><option>ignore_fromline_hosts</option></entry>
23630 <entry>Use: <emphasis>main</emphasis></entry>
23631 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
23632 <entry>Default: <emphasis>unset</emphasis></entry>
23638 <indexterm role="concept">
23639 <primary><quote>From</quote> line</primary>
23641 <indexterm role="concept">
23642 <primary>UUCP</primary>
23643 <secondary><quote>From</quote> line</secondary>
23645 Some broken SMTP clients insist on sending a UUCP-like <quote>From </quote> line before
23646 the headers of a message. By default this is treated as the start of the
23647 message’s body, which means that any following headers are not recognized as
23648 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
23649 match those hosts that insist on sending it. If the sender is actually a local
23650 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
23651 <option>ignore_fromline_local</option> must be set to achieve this effect.
23654 <indexterm role="option">
23655 <primary><option>ignore_fromline_local</option></primary>
23658 <informaltable frame="all">
23659 <tgroup cols="4" colsep="0" rowsep="0">
23660 <colspec colwidth="8*" align="left"/>
23661 <colspec colwidth="6*" align="center"/>
23662 <colspec colwidth="6*" align="center"/>
23663 <colspec colwidth="6*" align="right"/>
23666 <entry><option>ignore_fromline_local</option></entry>
23667 <entry>Use: <emphasis>main</emphasis></entry>
23668 <entry>Type: <emphasis>boolean</emphasis></entry>
23669 <entry>Default: <emphasis>false</emphasis></entry>
23675 See <option>ignore_fromline_hosts</option> above.
23678 <indexterm role="option">
23679 <primary><option>keep_malformed</option></primary>
23682 <informaltable frame="all">
23683 <tgroup cols="4" colsep="0" rowsep="0">
23684 <colspec colwidth="8*" align="left"/>
23685 <colspec colwidth="6*" align="center"/>
23686 <colspec colwidth="6*" align="center"/>
23687 <colspec colwidth="6*" align="right"/>
23690 <entry><option>keep_malformed</option></entry>
23691 <entry>Use: <emphasis>main</emphasis></entry>
23692 <entry>Type: <emphasis>time</emphasis></entry>
23693 <entry>Default: <emphasis>4d</emphasis></entry>
23699 This option specifies the length of time to keep messages whose spool files
23700 have been corrupted in some way. This should, of course, never happen. At the
23701 next attempt to deliver such a message, it gets removed. The incident is
23705 <indexterm role="option">
23706 <primary><option>ldap_default_servers</option></primary>
23709 <informaltable frame="all">
23710 <tgroup cols="4" colsep="0" rowsep="0">
23711 <colspec colwidth="8*" align="left"/>
23712 <colspec colwidth="6*" align="center"/>
23713 <colspec colwidth="6*" align="center"/>
23714 <colspec colwidth="6*" align="right"/>
23717 <entry><option>ldap_default_servers</option></entry>
23718 <entry>Use: <emphasis>main</emphasis></entry>
23719 <entry>Type: <emphasis>string list</emphasis></entry>
23720 <entry>Default: <emphasis>unset</emphasis></entry>
23726 <indexterm role="concept">
23727 <primary>LDAP</primary>
23728 <secondary>default servers</secondary>
23730 This option provides a list of LDAP servers which are tried in turn when an
23731 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
23732 details of LDAP queries. This option is available only when Exim has been built
23736 <indexterm role="option">
23737 <primary><option>ldap_version</option></primary>
23740 <informaltable frame="all">
23741 <tgroup cols="4" colsep="0" rowsep="0">
23742 <colspec colwidth="8*" align="left"/>
23743 <colspec colwidth="6*" align="center"/>
23744 <colspec colwidth="6*" align="center"/>
23745 <colspec colwidth="6*" align="right"/>
23748 <entry><option>ldap_version</option></entry>
23749 <entry>Use: <emphasis>main</emphasis></entry>
23750 <entry>Type: <emphasis>integer</emphasis></entry>
23751 <entry>Default: <emphasis>unset</emphasis></entry>
23757 <indexterm role="concept">
23758 <primary>LDAP</primary>
23759 <secondary>protocol version, forcing</secondary>
23761 This option can be used to force Exim to set a specific protocol version for
23762 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
23763 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
23764 the LDAP headers; otherwise it is 2. This option is available only when Exim
23765 has been built with LDAP support.
23768 <indexterm role="option">
23769 <primary><option>local_from_check</option></primary>
23772 <informaltable frame="all">
23773 <tgroup cols="4" colsep="0" rowsep="0">
23774 <colspec colwidth="8*" align="left"/>
23775 <colspec colwidth="6*" align="center"/>
23776 <colspec colwidth="6*" align="center"/>
23777 <colspec colwidth="6*" align="right"/>
23780 <entry><option>local_from_check</option></entry>
23781 <entry>Use: <emphasis>main</emphasis></entry>
23782 <entry>Type: <emphasis>boolean</emphasis></entry>
23783 <entry>Default: <emphasis>true</emphasis></entry>
23789 <indexterm role="concept">
23790 <primary><emphasis>Sender:</emphasis> header line</primary>
23791 <secondary>disabling addition of</secondary>
23793 <indexterm role="concept">
23794 <primary><emphasis>From:</emphasis> header line</primary>
23795 <secondary>disabling checking of</secondary>
23797 When a message is submitted locally (that is, not over a TCP/IP connection) by
23798 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
23799 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
23800 the domain specified by <option>qualify_domain</option>.
23803 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
23804 locally submitted message is automatically qualified by Exim, unless the
23805 <option>-bnq</option> command line option is used.
23808 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
23809 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
23810 <emphasis>Sender:</emphasis> header with an address constructed from the calling user’s login
23811 and the default qualify domain.
23814 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
23815 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
23816 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
23817 <option>local_sender_retain</option> to be true.
23820 <indexterm role="concept">
23821 <primary>envelope sender</primary>
23823 These options affect only the header lines in the message. The envelope sender
23824 is still forced to be the login id at the qualify domain unless
23825 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
23828 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
23829 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
23830 has more details about <emphasis>Sender:</emphasis> processing.
23833 <indexterm role="option">
23834 <primary><option>local_from_prefix</option></primary>
23837 <informaltable frame="all">
23838 <tgroup cols="4" colsep="0" rowsep="0">
23839 <colspec colwidth="8*" align="left"/>
23840 <colspec colwidth="6*" align="center"/>
23841 <colspec colwidth="6*" align="center"/>
23842 <colspec colwidth="6*" align="right"/>
23845 <entry><option>local_from_prefix</option></entry>
23846 <entry>Use: <emphasis>main</emphasis></entry>
23847 <entry>Type: <emphasis>string</emphasis></entry>
23848 <entry>Default: <emphasis>unset</emphasis></entry>
23854 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
23855 matching the login id (see <option>local_from_check</option> above), it can be configured to
23856 ignore certain prefixes and suffixes in the local part of the address. This is
23857 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
23858 appropriate lists, in the same form as the <option>local_part_prefix</option> and
23859 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
23862 <literallayout class="monospaced">
23863 local_from_prefix = *-
23866 is set, a <emphasis>From:</emphasis> line containing
23868 <literallayout class="monospaced">
23869 From: anything-user@your.domain.example
23872 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
23873 matches the actual sender address that is constructed from the login name and
23877 <indexterm role="option">
23878 <primary><option>local_from_suffix</option></primary>
23881 <informaltable frame="all">
23882 <tgroup cols="4" colsep="0" rowsep="0">
23883 <colspec colwidth="8*" align="left"/>
23884 <colspec colwidth="6*" align="center"/>
23885 <colspec colwidth="6*" align="center"/>
23886 <colspec colwidth="6*" align="right"/>
23889 <entry><option>local_from_suffix</option></entry>
23890 <entry>Use: <emphasis>main</emphasis></entry>
23891 <entry>Type: <emphasis>string</emphasis></entry>
23892 <entry>Default: <emphasis>unset</emphasis></entry>
23898 See <option>local_from_prefix</option> above.
23901 <indexterm role="option">
23902 <primary><option>local_interfaces</option></primary>
23905 <informaltable frame="all">
23906 <tgroup cols="4" colsep="0" rowsep="0">
23907 <colspec colwidth="8*" align="left"/>
23908 <colspec colwidth="6*" align="center"/>
23909 <colspec colwidth="6*" align="center"/>
23910 <colspec colwidth="6*" align="right"/>
23913 <entry><option>local_interfaces</option></entry>
23914 <entry>Use: <emphasis>main</emphasis></entry>
23915 <entry>Type: <emphasis>string list</emphasis></entry>
23916 <entry>Default: <emphasis>see below</emphasis></entry>
23922 This option controls which network interfaces are used by the daemon for
23923 listening; they are also used to identify the local host when routing. Chapter
23924 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23925 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23926 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23927 <option>local_interfaces</option> is
23929 <literallayout class="monospaced">
23930 local_interfaces = 0.0.0.0
23933 when Exim is built without IPv6 support; otherwise it is
23935 <literallayout class="monospaced">
23936 local_interfaces = <; ::0 ; 0.0.0.0
23939 <indexterm role="option">
23940 <primary><option>local_scan_timeout</option></primary>
23943 <informaltable frame="all">
23944 <tgroup cols="4" colsep="0" rowsep="0">
23945 <colspec colwidth="8*" align="left"/>
23946 <colspec colwidth="6*" align="center"/>
23947 <colspec colwidth="6*" align="center"/>
23948 <colspec colwidth="6*" align="right"/>
23951 <entry><option>local_scan_timeout</option></entry>
23952 <entry>Use: <emphasis>main</emphasis></entry>
23953 <entry>Type: <emphasis>time</emphasis></entry>
23954 <entry>Default: <emphasis>5m</emphasis></entry>
23960 <indexterm role="concept">
23961 <primary>timeout</primary>
23962 <secondary>for <function>local_scan()</function> function</secondary>
23964 <indexterm role="concept">
23965 <primary><function>local_scan()</function> function</primary>
23966 <secondary>timeout</secondary>
23968 This timeout applies to the <function>local_scan()</function> function (see chapter
23969 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23970 the incoming message is rejected with a temporary error if it is an SMTP
23971 message. For a non-SMTP message, the message is dropped and Exim ends with a
23972 non-zero code. The incident is logged on the main and reject logs.
23975 <indexterm role="option">
23976 <primary><option>local_sender_retain</option></primary>
23979 <informaltable frame="all">
23980 <tgroup cols="4" colsep="0" rowsep="0">
23981 <colspec colwidth="8*" align="left"/>
23982 <colspec colwidth="6*" align="center"/>
23983 <colspec colwidth="6*" align="center"/>
23984 <colspec colwidth="6*" align="right"/>
23987 <entry><option>local_sender_retain</option></entry>
23988 <entry>Use: <emphasis>main</emphasis></entry>
23989 <entry>Type: <emphasis>boolean</emphasis></entry>
23990 <entry>Default: <emphasis>false</emphasis></entry>
23996 <indexterm role="concept">
23997 <primary><emphasis>Sender:</emphasis> header line</primary>
23998 <secondary>retaining from local submission</secondary>
24000 When a message is submitted locally (that is, not over a TCP/IP connection) by
24001 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
24002 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
24003 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
24004 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
24005 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
24008 <indexterm role="option">
24009 <primary><option>localhost_number</option></primary>
24012 <informaltable frame="all">
24013 <tgroup cols="4" colsep="0" rowsep="0">
24014 <colspec colwidth="8*" align="left"/>
24015 <colspec colwidth="6*" align="center"/>
24016 <colspec colwidth="6*" align="center"/>
24017 <colspec colwidth="6*" align="right"/>
24020 <entry><option>localhost_number</option></entry>
24021 <entry>Use: <emphasis>main</emphasis></entry>
24022 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24023 <entry>Default: <emphasis>unset</emphasis></entry>
24029 <indexterm role="concept">
24030 <primary>host</primary>
24031 <secondary>locally unique number for</secondary>
24033 <indexterm role="concept">
24034 <primary>message ids</primary>
24035 <secondary>with multiple hosts</secondary>
24037 <indexterm role="variable">
24038 <primary><varname>$localhost_number</varname></primary>
24040 Exim’s message ids are normally unique only within the local host. If
24041 uniqueness among a set of hosts is required, each host must set a different
24042 value for the <option>localhost_number</option> option. The string is expanded immediately
24043 after reading the configuration file (so that a number can be computed from the
24044 host name, for example) and the result of the expansion must be a number in the
24045 range 0–16 (or 0–10 on operating systems with case-insensitive file
24046 systems). This is available in subsequent string expansions via the variable
24047 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
24048 characters of the message id, instead of just being a fractional part of the
24049 time, are computed from the time and the local host number as described in
24050 section <xref linkend="SECTmessiden"/>.
24053 <indexterm role="option">
24054 <primary><option>log_file_path</option></primary>
24057 <informaltable frame="all">
24058 <tgroup cols="4" colsep="0" rowsep="0">
24059 <colspec colwidth="8*" align="left"/>
24060 <colspec colwidth="6*" align="center"/>
24061 <colspec colwidth="6*" align="center"/>
24062 <colspec colwidth="6*" align="right"/>
24065 <entry><option>log_file_path</option></entry>
24066 <entry>Use: <emphasis>main</emphasis></entry>
24067 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
24068 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24074 <indexterm role="concept">
24075 <primary>log</primary>
24076 <secondary>file path for</secondary>
24078 This option sets the path which is used to determine the names of Exim’s log
24079 files, or indicates that logging is to be to syslog, or both. It is expanded
24080 when Exim is entered, so it can, for example, contain a reference to the host
24081 name. If no specific path is set for the log files at compile or run time, they
24082 are written in a sub-directory called <filename>log</filename> in Exim’s spool directory.
24083 Chapter <xref linkend="CHAPlog"/> contains further details about Exim’s logging, and
24084 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
24085 used. If this string is fixed at your installation (contains no expansion
24086 variables) it is recommended that you do not set this option in the
24087 configuration file, but instead supply the path using LOG_FILE_PATH in
24088 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
24089 early on – in particular, failure to read the configuration file.
24092 <indexterm role="option">
24093 <primary><option>log_selector</option></primary>
24096 <informaltable frame="all">
24097 <tgroup cols="4" colsep="0" rowsep="0">
24098 <colspec colwidth="8*" align="left"/>
24099 <colspec colwidth="6*" align="center"/>
24100 <colspec colwidth="6*" align="center"/>
24101 <colspec colwidth="6*" align="right"/>
24104 <entry><option>log_selector</option></entry>
24105 <entry>Use: <emphasis>main</emphasis></entry>
24106 <entry>Type: <emphasis>string</emphasis></entry>
24107 <entry>Default: <emphasis>unset</emphasis></entry>
24113 <indexterm role="concept">
24114 <primary>log</primary>
24115 <secondary>selectors</secondary>
24117 This option can be used to reduce or increase the number of things that Exim
24118 writes to its log files. Its argument is made up of names preceded by plus or
24119 minus characters. For example:
24121 <literallayout class="monospaced">
24122 log_selector = +arguments -retry_defer
24125 A list of possible names and what they control is given in the chapter on
24126 logging, in section <xref linkend="SECTlogselector"/>.
24129 <indexterm role="option">
24130 <primary><option>log_timezone</option></primary>
24133 <informaltable frame="all">
24134 <tgroup cols="4" colsep="0" rowsep="0">
24135 <colspec colwidth="8*" align="left"/>
24136 <colspec colwidth="6*" align="center"/>
24137 <colspec colwidth="6*" align="center"/>
24138 <colspec colwidth="6*" align="right"/>
24141 <entry><option>log_timezone</option></entry>
24142 <entry>Use: <emphasis>main</emphasis></entry>
24143 <entry>Type: <emphasis>boolean</emphasis></entry>
24144 <entry>Default: <emphasis>false</emphasis></entry>
24150 <indexterm role="concept">
24151 <primary>log</primary>
24152 <secondary>timezone for entries</secondary>
24154 <indexterm role="variable">
24155 <primary><varname>$tod_log</varname></primary>
24157 <indexterm role="variable">
24158 <primary><varname>$tod_zone</varname></primary>
24160 By default, the timestamps on log lines are in local time without the
24161 timezone. This means that if your timezone changes twice a year, the timestamps
24162 in log lines are ambiguous for an hour when the clocks go back. One way of
24163 avoiding this problem is to set the timezone to UTC. An alternative is to set
24164 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
24165 timestamps in log lines. Turning on this option can add quite a lot to the size
24166 of log files because each line is extended by 6 characters. Note that the
24167 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
24168 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
24171 <indexterm role="option">
24172 <primary><option>lookup_open_max</option></primary>
24175 <informaltable frame="all">
24176 <tgroup cols="4" colsep="0" rowsep="0">
24177 <colspec colwidth="8*" align="left"/>
24178 <colspec colwidth="6*" align="center"/>
24179 <colspec colwidth="6*" align="center"/>
24180 <colspec colwidth="6*" align="right"/>
24183 <entry><option>lookup_open_max</option></entry>
24184 <entry>Use: <emphasis>main</emphasis></entry>
24185 <entry>Type: <emphasis>integer</emphasis></entry>
24186 <entry>Default: <emphasis>25</emphasis></entry>
24192 <indexterm role="concept">
24193 <primary>too many open files</primary>
24195 <indexterm role="concept">
24196 <primary>open files, too many</primary>
24198 <indexterm role="concept">
24199 <primary>file</primary>
24200 <secondary>too many open</secondary>
24202 <indexterm role="concept">
24203 <primary>lookup</primary>
24204 <secondary>maximum open files</secondary>
24206 <indexterm role="concept">
24207 <primary>limit</primary>
24208 <secondary>open files for lookups</secondary>
24210 This option limits the number of simultaneously open files for single-key
24211 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
24212 Exim normally keeps these files open during routing, because often the same
24213 file is required several times. If the limit is reached, Exim closes the least
24214 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
24215 actually opens two files for each logical DBM database, though it still counts
24216 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
24217 open files</quote> errors with NDBM, you need to reduce the value of
24218 <option>lookup_open_max</option>.
24221 <indexterm role="option">
24222 <primary><option>max_username_length</option></primary>
24225 <informaltable frame="all">
24226 <tgroup cols="4" colsep="0" rowsep="0">
24227 <colspec colwidth="8*" align="left"/>
24228 <colspec colwidth="6*" align="center"/>
24229 <colspec colwidth="6*" align="center"/>
24230 <colspec colwidth="6*" align="right"/>
24233 <entry><option>max_username_length</option></entry>
24234 <entry>Use: <emphasis>main</emphasis></entry>
24235 <entry>Type: <emphasis>integer</emphasis></entry>
24236 <entry>Default: <emphasis>0</emphasis></entry>
24242 <indexterm role="concept">
24243 <primary>length of login name</primary>
24245 <indexterm role="concept">
24246 <primary>user name</primary>
24247 <secondary>maximum length</secondary>
24249 <indexterm role="concept">
24250 <primary>limit</primary>
24251 <secondary>user name length</secondary>
24253 Some operating systems are broken in that they truncate long arguments to
24254 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
24255 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
24256 an argument that is longer behaves as if <function>getpwnam()</function> failed.
24259 <indexterm role="option">
24260 <primary><option>message_body_newlines</option></primary>
24263 <informaltable frame="all">
24264 <tgroup cols="4" colsep="0" rowsep="0">
24265 <colspec colwidth="8*" align="left"/>
24266 <colspec colwidth="6*" align="center"/>
24267 <colspec colwidth="6*" align="center"/>
24268 <colspec colwidth="6*" align="right"/>
24271 <entry><option>message_body_newlines</option></entry>
24272 <entry>Use: <emphasis>main</emphasis></entry>
24273 <entry>Type: <emphasis>bool</emphasis></entry>
24274 <entry>Default: <emphasis>false</emphasis></entry>
24280 <indexterm role="concept">
24281 <primary>message body</primary>
24282 <secondary>newlines in variables</secondary>
24284 <indexterm role="concept">
24285 <primary>newline</primary>
24286 <secondary>in message body variables</secondary>
24288 <indexterm role="variable">
24289 <primary><varname>$message_body</varname></primary>
24291 <indexterm role="variable">
24292 <primary><varname>$message_body_end</varname></primary>
24294 By default, newlines in the message body are replaced by spaces when setting
24295 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
24296 option is set true, this no longer happens.
24299 <indexterm role="option">
24300 <primary><option>message_body_visible</option></primary>
24303 <informaltable frame="all">
24304 <tgroup cols="4" colsep="0" rowsep="0">
24305 <colspec colwidth="8*" align="left"/>
24306 <colspec colwidth="6*" align="center"/>
24307 <colspec colwidth="6*" align="center"/>
24308 <colspec colwidth="6*" align="right"/>
24311 <entry><option>message_body_visible</option></entry>
24312 <entry>Use: <emphasis>main</emphasis></entry>
24313 <entry>Type: <emphasis>integer</emphasis></entry>
24314 <entry>Default: <emphasis>500</emphasis></entry>
24320 <indexterm role="concept">
24321 <primary>body of message</primary>
24322 <secondary>visible size</secondary>
24324 <indexterm role="concept">
24325 <primary>message body</primary>
24326 <secondary>visible size</secondary>
24328 <indexterm role="variable">
24329 <primary><varname>$message_body</varname></primary>
24331 <indexterm role="variable">
24332 <primary><varname>$message_body_end</varname></primary>
24334 This option specifies how much of a message’s body is to be included in the
24335 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
24338 <indexterm role="option">
24339 <primary><option>message_id_header_domain</option></primary>
24342 <informaltable frame="all">
24343 <tgroup cols="4" colsep="0" rowsep="0">
24344 <colspec colwidth="8*" align="left"/>
24345 <colspec colwidth="6*" align="center"/>
24346 <colspec colwidth="6*" align="center"/>
24347 <colspec colwidth="6*" align="right"/>
24350 <entry><option>message_id_header_domain</option></entry>
24351 <entry>Use: <emphasis>main</emphasis></entry>
24352 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24353 <entry>Default: <emphasis>unset</emphasis></entry>
24359 <indexterm role="concept">
24360 <primary><emphasis>Message-ID:</emphasis> header line</primary>
24362 If this option is set, the string is expanded and used as the right hand side
24363 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
24364 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
24365 means <quote>not received over TCP/IP.</quote>
24366 Otherwise, the primary host name is used.
24367 Only letters, digits, dot and hyphen are accepted; any other characters are
24368 replaced by hyphens. If the expansion is forced to fail, or if the result is an
24369 empty string, the option is ignored.
24372 <indexterm role="option">
24373 <primary><option>message_id_header_text</option></primary>
24376 <informaltable frame="all">
24377 <tgroup cols="4" colsep="0" rowsep="0">
24378 <colspec colwidth="8*" align="left"/>
24379 <colspec colwidth="6*" align="center"/>
24380 <colspec colwidth="6*" align="center"/>
24381 <colspec colwidth="6*" align="right"/>
24384 <entry><option>message_id_header_text</option></entry>
24385 <entry>Use: <emphasis>main</emphasis></entry>
24386 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24387 <entry>Default: <emphasis>unset</emphasis></entry>
24393 If this variable is set, the string is expanded and used to augment the text of
24394 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
24395 message does not have one. The text of this header is required by RFC 2822 to
24396 take the form of an address. By default, Exim uses its internal message id as
24397 the local part, and the primary host name as the domain. If this option is set,
24398 it is expanded, and provided the expansion is not forced to fail, and does not
24399 yield an empty string, the result is inserted into the header immediately
24400 before the @, separated from the internal message id by a dot. Any characters
24401 that are illegal in an address are automatically converted into hyphens. This
24402 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
24403 colons will become hyphens.
24406 <indexterm role="option">
24407 <primary><option>message_logs</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>message_logs</option></entry>
24419 <entry>Use: <emphasis>main</emphasis></entry>
24420 <entry>Type: <emphasis>boolean</emphasis></entry>
24421 <entry>Default: <emphasis>true</emphasis></entry>
24427 <indexterm role="concept">
24428 <primary>message logs</primary>
24429 <secondary>disabling</secondary>
24431 <indexterm role="concept">
24432 <primary>log</primary>
24433 <secondary>message log; disabling</secondary>
24435 If this option is turned off, per-message log files are not created in the
24436 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
24437 Exim, by reducing the number of files involved in handling a message from a
24438 minimum of four (header spool file, body spool file, delivery journal, and
24439 per-message log) to three. The other major I/O activity is Exim’s main log,
24440 which is not affected by this option.
24443 <indexterm role="option">
24444 <primary><option>message_size_limit</option></primary>
24447 <informaltable frame="all">
24448 <tgroup cols="4" colsep="0" rowsep="0">
24449 <colspec colwidth="8*" align="left"/>
24450 <colspec colwidth="6*" align="center"/>
24451 <colspec colwidth="6*" align="center"/>
24452 <colspec colwidth="6*" align="right"/>
24455 <entry><option>message_size_limit</option></entry>
24456 <entry>Use: <emphasis>main</emphasis></entry>
24457 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24458 <entry>Default: <emphasis>50M</emphasis></entry>
24464 <indexterm role="concept">
24465 <primary>message</primary>
24466 <secondary>size limit</secondary>
24468 <indexterm role="concept">
24469 <primary>limit</primary>
24470 <secondary>message size</secondary>
24472 <indexterm role="concept">
24473 <primary>size</primary>
24474 <secondary>of message, limit</secondary>
24476 This option limits the maximum size of message that Exim will process. The
24477 value is expanded for each incoming connection so, for example, it can be made
24478 to depend on the IP address of the remote host for messages arriving via
24479 TCP/IP. After expansion, the value must be a sequence of decimal digits,
24480 optionally followed by K or M.
24483 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message’s sender or any
24484 other properties of an individual message, because it has to be advertised in
24485 the server’s response to EHLO. String expansion failure causes a temporary
24486 error. A value of zero means no limit, but its use is not recommended. See also
24487 <option>bounce_return_size_limit</option>.
24490 Incoming SMTP messages are failed with a 552 error if the limit is
24491 exceeded; locally-generated messages either get a stderr message or a delivery
24492 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
24493 an oversized message is logged in both the main and the reject logs. See also
24494 the generic transport option <option>message_size_limit</option>, which limits the size of
24495 message that an individual transport can process.
24497 <para revisionflag="changed">
24498 If you use a virus-scanner and set this option to to a value larger than the
24499 maximum size that your virus-scanner is configured to support, you may get
24500 failures triggered by large mails. The right size to configure for the
24501 virus-scanner depends upon what data is passed and the options in use but it’s
24502 probably safest to just set it to a little larger than this value. Eg, with a
24503 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
24504 some problems may result.
24507 <indexterm role="option">
24508 <primary><option>move_frozen_messages</option></primary>
24511 <informaltable frame="all">
24512 <tgroup cols="4" colsep="0" rowsep="0">
24513 <colspec colwidth="8*" align="left"/>
24514 <colspec colwidth="6*" align="center"/>
24515 <colspec colwidth="6*" align="center"/>
24516 <colspec colwidth="6*" align="right"/>
24519 <entry><option>move_frozen_messages</option></entry>
24520 <entry>Use: <emphasis>main</emphasis></entry>
24521 <entry>Type: <emphasis>boolean</emphasis></entry>
24522 <entry>Default: <emphasis>false</emphasis></entry>
24528 <indexterm role="concept">
24529 <primary>frozen messages</primary>
24530 <secondary>moving</secondary>
24532 This option, which is available only if Exim has been built with the setting
24534 <literallayout class="monospaced">
24535 SUPPORT_MOVE_FROZEN_MESSAGES=yes
24538 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
24539 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
24540 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
24541 standard utilities for handling such moved messages, and they do not show up in
24542 lists generated by <option>-bp</option> or by the Exim monitor.
24545 <indexterm role="option">
24546 <primary><option>mua_wrapper</option></primary>
24549 <informaltable frame="all">
24550 <tgroup cols="4" colsep="0" rowsep="0">
24551 <colspec colwidth="8*" align="left"/>
24552 <colspec colwidth="6*" align="center"/>
24553 <colspec colwidth="6*" align="center"/>
24554 <colspec colwidth="6*" align="right"/>
24557 <entry><option>mua_wrapper</option></entry>
24558 <entry>Use: <emphasis>main</emphasis></entry>
24559 <entry>Type: <emphasis>boolean</emphasis></entry>
24560 <entry>Default: <emphasis>false</emphasis></entry>
24566 Setting this option true causes Exim to run in a very restrictive mode in which
24567 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
24568 contains a full description of this facility.
24571 <indexterm role="option">
24572 <primary><option>mysql_servers</option></primary>
24575 <informaltable frame="all">
24576 <tgroup cols="4" colsep="0" rowsep="0">
24577 <colspec colwidth="8*" align="left"/>
24578 <colspec colwidth="6*" align="center"/>
24579 <colspec colwidth="6*" align="center"/>
24580 <colspec colwidth="6*" align="right"/>
24583 <entry><option>mysql_servers</option></entry>
24584 <entry>Use: <emphasis>main</emphasis></entry>
24585 <entry>Type: <emphasis>string list</emphasis></entry>
24586 <entry>Default: <emphasis>unset</emphasis></entry>
24592 <indexterm role="concept">
24593 <primary>MySQL</primary>
24594 <secondary>server list</secondary>
24596 This option provides a list of MySQL servers and associated connection data, to
24597 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
24598 option is available only if Exim has been built with MySQL support.
24601 <indexterm role="option">
24602 <primary><option>never_users</option></primary>
24605 <informaltable frame="all">
24606 <tgroup cols="4" colsep="0" rowsep="0">
24607 <colspec colwidth="8*" align="left"/>
24608 <colspec colwidth="6*" align="center"/>
24609 <colspec colwidth="6*" align="center"/>
24610 <colspec colwidth="6*" align="right"/>
24613 <entry><option>never_users</option></entry>
24614 <entry>Use: <emphasis>main</emphasis></entry>
24615 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
24616 <entry>Default: <emphasis>unset</emphasis></entry>
24622 This option is expanded just once, at the start of Exim’s processing. Local
24623 message deliveries are normally run in processes that are setuid to the
24624 recipient, and remote deliveries are normally run under Exim’s own uid and gid.
24625 It is usually desirable to prevent any deliveries from running as root, as a
24629 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
24630 list of users that must not be used for local deliveries. This list is fixed in
24631 the binary and cannot be overridden by the configuration file. By default, it
24632 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
24633 can be used to add more users to the fixed list.
24636 If a message is to be delivered as one of the users on the fixed list or the
24637 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
24640 <literallayout class="monospaced">
24641 never_users = root:daemon:bin
24644 Including root is redundant if it is also on the fixed list, but it does no
24645 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
24648 <para revisionflag="changed">
24649 <indexterm role="option">
24650 <primary><option>openssl_options</option></primary>
24653 <informaltable frame="all" revisionflag="changed">
24654 <tgroup cols="4" colsep="0" rowsep="0">
24655 <colspec colwidth="8*" align="left"/>
24656 <colspec colwidth="6*" align="center"/>
24657 <colspec colwidth="6*" align="center"/>
24658 <colspec colwidth="6*" align="right"/>
24661 <entry><option>openssl_options</option></entry>
24662 <entry>Use: <emphasis>main</emphasis></entry>
24663 <entry>Type: <emphasis>string list</emphasis></entry>
24664 <entry>Default: <emphasis>+dont_insert_empty_fragments</emphasis></entry>
24669 <para revisionflag="changed">
24670 <indexterm role="concept">
24671 <primary>OpenSSL </primary>
24672 <secondary>compatibility</secondary>
24674 This option allows an administrator to adjust the SSL options applied
24675 by OpenSSL to connections. It is given as a space-separated list of items,
24676 each one to be +added or -subtracted from the current value. The default
24677 value is one option which happens to have been set historically. You can
24678 remove all options with:
24680 <literallayout class="monospaced" revisionflag="changed">
24681 openssl_options = -all
24683 <para revisionflag="changed">
24684 This option is only available if Exim is built against OpenSSL. The values
24685 available for this option vary according to the age of your OpenSSL install.
24686 The <quote>all</quote> value controls a subset of flags which are available, typically
24687 the bug workaround options. The <emphasis>SSL_CTX_set_options</emphasis> man page will
24688 list the values known on your system and Exim should support all the
24689 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options. The Exim
24690 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
24692 <para revisionflag="changed">
24693 Note that adjusting the options can have severe impact upon the security of
24694 SSL as used by Exim. It is possible to disable safety checks and shoot
24695 yourself in the foot in various unpleasant ways. This option should not be
24696 adjusted lightly. An unrecognised item will be detected at by invoking Exim
24697 with the <option>-bV</option> flag.
24699 <para revisionflag="changed">
24702 <literallayout class="monospaced" revisionflag="changed">
24703 openssl_options = -all +microsoft_big_sslv3_buffer
24706 <indexterm role="option">
24707 <primary><option>oracle_servers</option></primary>
24710 <informaltable frame="all">
24711 <tgroup cols="4" colsep="0" rowsep="0">
24712 <colspec colwidth="8*" align="left"/>
24713 <colspec colwidth="6*" align="center"/>
24714 <colspec colwidth="6*" align="center"/>
24715 <colspec colwidth="6*" align="right"/>
24718 <entry><option>oracle_servers</option></entry>
24719 <entry>Use: <emphasis>main</emphasis></entry>
24720 <entry>Type: <emphasis>string list</emphasis></entry>
24721 <entry>Default: <emphasis>unset</emphasis></entry>
24727 <indexterm role="concept">
24728 <primary>Oracle</primary>
24729 <secondary>server list</secondary>
24731 This option provides a list of Oracle servers and associated connection data,
24732 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
24733 The option is available only if Exim has been built with Oracle support.
24736 <indexterm role="option">
24737 <primary><option>percent_hack_domains</option></primary>
24740 <informaltable frame="all">
24741 <tgroup cols="4" colsep="0" rowsep="0">
24742 <colspec colwidth="8*" align="left"/>
24743 <colspec colwidth="6*" align="center"/>
24744 <colspec colwidth="6*" align="center"/>
24745 <colspec colwidth="6*" align="right"/>
24748 <entry><option>percent_hack_domains</option></entry>
24749 <entry>Use: <emphasis>main</emphasis></entry>
24750 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
24751 <entry>Default: <emphasis>unset</emphasis></entry>
24757 <indexterm role="concept">
24758 <primary><quote>percent hack</quote></primary>
24760 <indexterm role="concept">
24761 <primary>source routing</primary>
24762 <secondary>in email address</secondary>
24764 <indexterm role="concept">
24765 <primary>address</primary>
24766 <secondary>source-routed</secondary>
24768 The <quote>percent hack</quote> is the convention whereby a local part containing a
24769 percent sign is re-interpreted as a new email address, with the percent
24770 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
24771 also applied to RFC 2822 addresses that begin with an @ character. If this
24772 option is set, Exim implements the percent facility for those domains listed,
24773 but no others. This happens before an incoming SMTP address is tested against
24777 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
24778 trying to get round relaying restrictions. For this reason, it is best avoided
24779 if at all possible. Unfortunately, a number of less security-conscious MTAs
24780 implement it unconditionally. If you are running Exim on a gateway host, and
24781 routing mail through to internal MTAs without processing the local parts, it is
24782 a good idea to reject recipient addresses with percent characters in their
24783 local parts. Exim’s default configuration does this.
24786 <indexterm role="option">
24787 <primary><option>perl_at_start</option></primary>
24790 <informaltable frame="all">
24791 <tgroup cols="4" colsep="0" rowsep="0">
24792 <colspec colwidth="8*" align="left"/>
24793 <colspec colwidth="6*" align="center"/>
24794 <colspec colwidth="6*" align="center"/>
24795 <colspec colwidth="6*" align="right"/>
24798 <entry><option>perl_at_start</option></entry>
24799 <entry>Use: <emphasis>main</emphasis></entry>
24800 <entry>Type: <emphasis>boolean</emphasis></entry>
24801 <entry>Default: <emphasis>false</emphasis></entry>
24807 This option is available only when Exim is built with an embedded Perl
24808 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24811 <indexterm role="option">
24812 <primary><option>perl_startup</option></primary>
24815 <informaltable frame="all">
24816 <tgroup cols="4" colsep="0" rowsep="0">
24817 <colspec colwidth="8*" align="left"/>
24818 <colspec colwidth="6*" align="center"/>
24819 <colspec colwidth="6*" align="center"/>
24820 <colspec colwidth="6*" align="right"/>
24823 <entry><option>perl_startup</option></entry>
24824 <entry>Use: <emphasis>main</emphasis></entry>
24825 <entry>Type: <emphasis>string</emphasis></entry>
24826 <entry>Default: <emphasis>unset</emphasis></entry>
24832 This option is available only when Exim is built with an embedded Perl
24833 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
24836 <indexterm role="option">
24837 <primary><option>pgsql_servers</option></primary>
24840 <informaltable frame="all">
24841 <tgroup cols="4" colsep="0" rowsep="0">
24842 <colspec colwidth="8*" align="left"/>
24843 <colspec colwidth="6*" align="center"/>
24844 <colspec colwidth="6*" align="center"/>
24845 <colspec colwidth="6*" align="right"/>
24848 <entry><option>pgsql_servers</option></entry>
24849 <entry>Use: <emphasis>main</emphasis></entry>
24850 <entry>Type: <emphasis>string list</emphasis></entry>
24851 <entry>Default: <emphasis>unset</emphasis></entry>
24857 <indexterm role="concept">
24858 <primary>PostgreSQL lookup type</primary>
24859 <secondary>server list</secondary>
24861 This option provides a list of PostgreSQL servers and associated connection
24862 data, to be used in conjunction with <command>pgsql</command> lookups (see section
24863 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
24864 PostgreSQL support.
24867 <indexterm role="option">
24868 <primary><option>pid_file_path</option></primary>
24871 <informaltable frame="all">
24872 <tgroup cols="4" colsep="0" rowsep="0">
24873 <colspec colwidth="8*" align="left"/>
24874 <colspec colwidth="6*" align="center"/>
24875 <colspec colwidth="6*" align="center"/>
24876 <colspec colwidth="6*" align="right"/>
24879 <entry><option>pid_file_path</option></entry>
24880 <entry>Use: <emphasis>main</emphasis></entry>
24881 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
24882 <entry>Default: <emphasis>set at compile time</emphasis></entry>
24888 <indexterm role="concept">
24889 <primary>daemon</primary>
24890 <secondary>pid file path</secondary>
24892 <indexterm role="concept">
24893 <primary>pid file, path for</primary>
24895 This option sets the name of the file to which the Exim daemon writes its
24896 process id. The string is expanded, so it can contain, for example, references
24899 <literallayout class="monospaced">
24900 pid_file_path = /var/log/$primary_hostname/exim.pid
24903 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim’s
24905 The value set by the option can be overridden by the <option>-oP</option> command line
24906 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
24907 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
24910 <indexterm role="option">
24911 <primary><option>pipelining_advertise_hosts</option></primary>
24914 <informaltable frame="all">
24915 <tgroup cols="4" colsep="0" rowsep="0">
24916 <colspec colwidth="8*" align="left"/>
24917 <colspec colwidth="6*" align="center"/>
24918 <colspec colwidth="6*" align="center"/>
24919 <colspec colwidth="6*" align="right"/>
24922 <entry><option>pipelining_advertise_hosts</option></entry>
24923 <entry>Use: <emphasis>main</emphasis></entry>
24924 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
24925 <entry>Default: <emphasis>*</emphasis></entry>
24931 <indexterm role="concept">
24932 <primary>PIPELINING</primary>
24933 <secondary>suppressing advertising</secondary>
24935 This option can be used to suppress the advertisement of the SMTP
24936 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
24937 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
24938 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
24939 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
24940 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
24941 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
24944 <indexterm role="option">
24945 <primary><option>preserve_message_logs</option></primary>
24948 <informaltable frame="all">
24949 <tgroup cols="4" colsep="0" rowsep="0">
24950 <colspec colwidth="8*" align="left"/>
24951 <colspec colwidth="6*" align="center"/>
24952 <colspec colwidth="6*" align="center"/>
24953 <colspec colwidth="6*" align="right"/>
24956 <entry><option>preserve_message_logs</option></entry>
24957 <entry>Use: <emphasis>main</emphasis></entry>
24958 <entry>Type: <emphasis>boolean</emphasis></entry>
24959 <entry>Default: <emphasis>false</emphasis></entry>
24965 <indexterm role="concept">
24966 <primary>message logs</primary>
24967 <secondary>preserving</secondary>
24969 If this option is set, message log files are not deleted when messages are
24970 completed. Instead, they are moved to a sub-directory of the spool directory
24971 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
24972 purposes. This is a dangerous option to set on systems with any appreciable
24973 volume of mail. Use with care!
24976 <indexterm role="option">
24977 <primary><option>primary_hostname</option></primary>
24980 <informaltable frame="all">
24981 <tgroup cols="4" colsep="0" rowsep="0">
24982 <colspec colwidth="8*" align="left"/>
24983 <colspec colwidth="6*" align="center"/>
24984 <colspec colwidth="6*" align="center"/>
24985 <colspec colwidth="6*" align="right"/>
24988 <entry><option>primary_hostname</option></entry>
24989 <entry>Use: <emphasis>main</emphasis></entry>
24990 <entry>Type: <emphasis>string</emphasis></entry>
24991 <entry>Default: <emphasis>see below</emphasis></entry>
24997 <indexterm role="concept">
24998 <primary>name</primary>
24999 <secondary>of local host</secondary>
25001 <indexterm role="concept">
25002 <primary>host</primary>
25003 <secondary>name of local</secondary>
25005 <indexterm role="concept">
25006 <primary>local host</primary>
25007 <secondary>name of</secondary>
25009 <indexterm role="variable">
25010 <primary><varname>$primary_hostname</varname></primary>
25012 This specifies the name of the current host. It is used in the default EHLO or
25013 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
25014 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
25015 The value is also used by default in some SMTP response messages from an Exim
25016 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
25019 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
25020 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
25021 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
25022 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
25023 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
25024 explicitly by this option, or defaulted.
25027 <indexterm role="option">
25028 <primary><option>print_topbitchars</option></primary>
25031 <informaltable frame="all">
25032 <tgroup cols="4" colsep="0" rowsep="0">
25033 <colspec colwidth="8*" align="left"/>
25034 <colspec colwidth="6*" align="center"/>
25035 <colspec colwidth="6*" align="center"/>
25036 <colspec colwidth="6*" align="right"/>
25039 <entry><option>print_topbitchars</option></entry>
25040 <entry>Use: <emphasis>main</emphasis></entry>
25041 <entry>Type: <emphasis>boolean</emphasis></entry>
25042 <entry>Default: <emphasis>false</emphasis></entry>
25048 <indexterm role="concept">
25049 <primary>printing characters</primary>
25051 <indexterm role="concept">
25052 <primary>8-bit characters</primary>
25054 By default, Exim considers only those characters whose codes lie in the range
25055 32–126 to be printing characters. In a number of circumstances (for example,
25056 when writing log entries) non-printing characters are converted into escape
25057 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
25058 is set, code values of 128 and above are also considered to be printing
25062 This option also affects the header syntax checks performed by the
25063 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
25064 the user’s full name when constructing From: and Sender: addresses (as
25065 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
25066 Exim to generate eight bit message headers that do not conform to the
25070 <indexterm role="option">
25071 <primary><option>process_log_path</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>process_log_path</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>process log path</primary>
25094 <indexterm role="concept">
25095 <primary>log</primary>
25096 <secondary>process log</secondary>
25098 <indexterm role="concept">
25099 <primary><emphasis>exiwhat</emphasis></primary>
25101 This option sets the name of the file to which an Exim process writes its
25102 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
25103 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
25104 in Exim’s spool directory is used. The ability to specify the name explicitly
25105 can be useful in environments where two different Exims are running, using
25106 different spool directories.
25109 <indexterm role="option">
25110 <primary><option>prod_requires_admin</option></primary>
25113 <informaltable frame="all">
25114 <tgroup cols="4" colsep="0" rowsep="0">
25115 <colspec colwidth="8*" align="left"/>
25116 <colspec colwidth="6*" align="center"/>
25117 <colspec colwidth="6*" align="center"/>
25118 <colspec colwidth="6*" align="right"/>
25121 <entry><option>prod_requires_admin</option></entry>
25122 <entry>Use: <emphasis>main</emphasis></entry>
25123 <entry>Type: <emphasis>boolean</emphasis></entry>
25124 <entry>Default: <emphasis>true</emphasis></entry>
25130 <indexterm role="option">
25131 <primary><option>-M</option></primary>
25133 <indexterm role="option">
25134 <primary><option>-R</option></primary>
25136 <indexterm role="option">
25137 <primary><option>-q</option></primary>
25139 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
25140 admin user unless <option>prod_requires_admin</option> is set false. See also
25141 <option>queue_list_requires_admin</option>.
25144 <indexterm role="option">
25145 <primary><option>qualify_domain</option></primary>
25148 <informaltable frame="all">
25149 <tgroup cols="4" colsep="0" rowsep="0">
25150 <colspec colwidth="8*" align="left"/>
25151 <colspec colwidth="6*" align="center"/>
25152 <colspec colwidth="6*" align="center"/>
25153 <colspec colwidth="6*" align="right"/>
25156 <entry><option>qualify_domain</option></entry>
25157 <entry>Use: <emphasis>main</emphasis></entry>
25158 <entry>Type: <emphasis>string</emphasis></entry>
25159 <entry>Default: <emphasis>see below</emphasis></entry>
25165 <indexterm role="concept">
25166 <primary>domain</primary>
25167 <secondary>for qualifying addresses</secondary>
25169 <indexterm role="concept">
25170 <primary>address</primary>
25171 <secondary>qualification</secondary>
25173 This option specifies the domain name that is added to any envelope sender
25174 addresses that do not have a domain qualification. It also applies to
25175 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
25176 are accepted by default only for locally-generated messages. Qualification is
25177 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
25178 locally-generated messages, unless the <option>-bnq</option> command line option is used.
25181 Messages from external sources must always contain fully qualified addresses,
25182 unless the sending host matches <option>sender_unqualified_hosts</option> or
25183 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
25184 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
25185 necessary. Internally, Exim always works with fully qualified envelope
25186 addresses. If <option>qualify_domain</option> is not set, it defaults to the
25187 <option>primary_hostname</option> value.
25190 <indexterm role="option">
25191 <primary><option>qualify_recipient</option></primary>
25194 <informaltable frame="all">
25195 <tgroup cols="4" colsep="0" rowsep="0">
25196 <colspec colwidth="8*" align="left"/>
25197 <colspec colwidth="6*" align="center"/>
25198 <colspec colwidth="6*" align="center"/>
25199 <colspec colwidth="6*" align="right"/>
25202 <entry><option>qualify_recipient</option></entry>
25203 <entry>Use: <emphasis>main</emphasis></entry>
25204 <entry>Type: <emphasis>string</emphasis></entry>
25205 <entry>Default: <emphasis>see below</emphasis></entry>
25211 This option allows you to specify a different domain for qualifying recipient
25212 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
25215 <indexterm role="option">
25216 <primary><option>queue_domains</option></primary>
25219 <informaltable frame="all">
25220 <tgroup cols="4" colsep="0" rowsep="0">
25221 <colspec colwidth="8*" align="left"/>
25222 <colspec colwidth="6*" align="center"/>
25223 <colspec colwidth="6*" align="center"/>
25224 <colspec colwidth="6*" align="right"/>
25227 <entry><option>queue_domains</option></entry>
25228 <entry>Use: <emphasis>main</emphasis></entry>
25229 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25230 <entry>Default: <emphasis>unset</emphasis></entry>
25236 <indexterm role="concept">
25237 <primary>domain</primary>
25238 <secondary>specifying non-immediate delivery</secondary>
25240 <indexterm role="concept">
25241 <primary>queueing incoming messages</primary>
25243 <indexterm role="concept">
25244 <primary>message</primary>
25245 <secondary>queueing certain domains</secondary>
25247 This option lists domains for which immediate delivery is not required.
25248 A delivery process is started whenever a message is received, but only those
25249 domains that do not match are processed. All other deliveries wait until the
25250 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
25253 <indexterm role="option">
25254 <primary><option>queue_list_requires_admin</option></primary>
25257 <informaltable frame="all">
25258 <tgroup cols="4" colsep="0" rowsep="0">
25259 <colspec colwidth="8*" align="left"/>
25260 <colspec colwidth="6*" align="center"/>
25261 <colspec colwidth="6*" align="center"/>
25262 <colspec colwidth="6*" align="right"/>
25265 <entry><option>queue_list_requires_admin</option></entry>
25266 <entry>Use: <emphasis>main</emphasis></entry>
25267 <entry>Type: <emphasis>boolean</emphasis></entry>
25268 <entry>Default: <emphasis>true</emphasis></entry>
25274 <indexterm role="option">
25275 <primary><option>-bp</option></primary>
25277 The <option>-bp</option> command-line option, which lists the messages that are on the
25278 queue, requires the caller to be an admin user unless
25279 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
25282 <indexterm role="option">
25283 <primary><option>queue_only</option></primary>
25286 <informaltable frame="all">
25287 <tgroup cols="4" colsep="0" rowsep="0">
25288 <colspec colwidth="8*" align="left"/>
25289 <colspec colwidth="6*" align="center"/>
25290 <colspec colwidth="6*" align="center"/>
25291 <colspec colwidth="6*" align="right"/>
25294 <entry><option>queue_only</option></entry>
25295 <entry>Use: <emphasis>main</emphasis></entry>
25296 <entry>Type: <emphasis>boolean</emphasis></entry>
25297 <entry>Default: <emphasis>false</emphasis></entry>
25303 <indexterm role="concept">
25304 <primary>queueing incoming messages</primary>
25306 <indexterm role="concept">
25307 <primary>message</primary>
25308 <secondary>queueing unconditionally</secondary>
25310 If <option>queue_only</option> is set, a delivery process is not automatically started
25311 whenever a message is received. Instead, the message waits on the queue for the
25312 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
25313 delivered immediately when certain conditions (such as heavy load) occur.
25316 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
25317 and <option>-odi</option> command line options override <option>queue_only</option> unless
25318 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
25319 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
25322 <indexterm role="option">
25323 <primary><option>queue_only_file</option></primary>
25326 <informaltable frame="all">
25327 <tgroup cols="4" colsep="0" rowsep="0">
25328 <colspec colwidth="8*" align="left"/>
25329 <colspec colwidth="6*" align="center"/>
25330 <colspec colwidth="6*" align="center"/>
25331 <colspec colwidth="6*" align="right"/>
25334 <entry><option>queue_only_file</option></entry>
25335 <entry>Use: <emphasis>main</emphasis></entry>
25336 <entry>Type: <emphasis>string</emphasis></entry>
25337 <entry>Default: <emphasis>unset</emphasis></entry>
25343 <indexterm role="concept">
25344 <primary>queueing incoming messages</primary>
25346 <indexterm role="concept">
25347 <primary>message</primary>
25348 <secondary>queueing by file existence</secondary>
25350 This option can be set to a colon-separated list of absolute path names, each
25351 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
25352 it tests for the existence of each listed path using a call to <function>stat()</function>. For
25353 each path that exists, the corresponding queueing option is set.
25354 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
25355 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
25357 <literallayout class="monospaced">
25358 queue_only_file = smtp/some/file
25361 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
25362 <filename>/some/file</filename> exists.
25365 <indexterm role="option">
25366 <primary><option>queue_only_load</option></primary>
25369 <informaltable frame="all">
25370 <tgroup cols="4" colsep="0" rowsep="0">
25371 <colspec colwidth="8*" align="left"/>
25372 <colspec colwidth="6*" align="center"/>
25373 <colspec colwidth="6*" align="center"/>
25374 <colspec colwidth="6*" align="right"/>
25377 <entry><option>queue_only_load</option></entry>
25378 <entry>Use: <emphasis>main</emphasis></entry>
25379 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25380 <entry>Default: <emphasis>unset</emphasis></entry>
25386 <indexterm role="concept">
25387 <primary>load average</primary>
25389 <indexterm role="concept">
25390 <primary>queueing incoming messages</primary>
25392 <indexterm role="concept">
25393 <primary>message</primary>
25394 <secondary>queueing by load</secondary>
25396 If the system load average is higher than this value, incoming messages from
25397 all sources are queued, and no automatic deliveries are started. If this
25398 happens during local or remote SMTP input, all subsequent messages received on
25399 the same SMTP connection are queued by default, whatever happens to the load in
25400 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
25404 Deliveries will subsequently be performed by queue runner processes. This
25405 option has no effect on ancient operating systems on which Exim cannot
25406 determine the load average. See also <option>deliver_queue_load_max</option> and
25407 <option>smtp_load_reserve</option>.
25410 <indexterm role="option">
25411 <primary><option>queue_only_load_latch</option></primary>
25414 <informaltable frame="all">
25415 <tgroup cols="4" colsep="0" rowsep="0">
25416 <colspec colwidth="8*" align="left"/>
25417 <colspec colwidth="6*" align="center"/>
25418 <colspec colwidth="6*" align="center"/>
25419 <colspec colwidth="6*" align="right"/>
25422 <entry><option>queue_only_load_latch</option></entry>
25423 <entry>Use: <emphasis>main</emphasis></entry>
25424 <entry>Type: <emphasis>boolean</emphasis></entry>
25425 <entry>Default: <emphasis>true</emphasis></entry>
25431 <indexterm role="concept">
25432 <primary>load average</primary>
25433 <secondary>re-evaluating per message</secondary>
25435 When this option is true (the default), once one message has been queued
25436 because the load average is higher than the value set by <option>queue_only_load</option>,
25437 all subsequent messages received on the same SMTP connection are also queued.
25438 This is a deliberate choice; even though the load average may fall below the
25439 threshold, it doesn’t seem right to deliver later messages on the same
25440 connection when not delivering earlier ones. However, there are special
25441 circumstances such as very long-lived connections from scanning appliances
25442 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
25443 should be set false. This causes the value of the load average to be
25444 re-evaluated for each message.
25447 <indexterm role="option">
25448 <primary><option>queue_only_override</option></primary>
25451 <informaltable frame="all">
25452 <tgroup cols="4" colsep="0" rowsep="0">
25453 <colspec colwidth="8*" align="left"/>
25454 <colspec colwidth="6*" align="center"/>
25455 <colspec colwidth="6*" align="center"/>
25456 <colspec colwidth="6*" align="right"/>
25459 <entry><option>queue_only_override</option></entry>
25460 <entry>Use: <emphasis>main</emphasis></entry>
25461 <entry>Type: <emphasis>boolean</emphasis></entry>
25462 <entry>Default: <emphasis>true</emphasis></entry>
25468 <indexterm role="concept">
25469 <primary>queueing incoming messages</primary>
25471 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
25472 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
25473 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
25474 to override; they are accepted, but ignored.
25477 <indexterm role="option">
25478 <primary><option>queue_run_in_order</option></primary>
25481 <informaltable frame="all">
25482 <tgroup cols="4" colsep="0" rowsep="0">
25483 <colspec colwidth="8*" align="left"/>
25484 <colspec colwidth="6*" align="center"/>
25485 <colspec colwidth="6*" align="center"/>
25486 <colspec colwidth="6*" align="right"/>
25489 <entry><option>queue_run_in_order</option></entry>
25490 <entry>Use: <emphasis>main</emphasis></entry>
25491 <entry>Type: <emphasis>boolean</emphasis></entry>
25492 <entry>Default: <emphasis>false</emphasis></entry>
25498 <indexterm role="concept">
25499 <primary>queue runner</primary>
25500 <secondary>processing messages in order</secondary>
25502 If this option is set, queue runs happen in order of message arrival instead of
25503 in an arbitrary order. For this to happen, a complete list of the entire queue
25504 must be set up before the deliveries start. When the queue is all held in a
25505 single directory (the default), a single list is created for both the ordered
25506 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
25507 single list is not created when <option>queue_run_in_order</option> is false. In this case,
25508 the sub-directories are processed one at a time (in a random order), and this
25509 avoids setting up one huge list for the whole queue. Thus, setting
25510 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
25511 when the queue is large, because of the extra work in setting up the single,
25512 large list. In most situations, <option>queue_run_in_order</option> should not be set.
25515 <indexterm role="option">
25516 <primary><option>queue_run_max</option></primary>
25519 <informaltable frame="all">
25520 <tgroup cols="4" colsep="0" rowsep="0">
25521 <colspec colwidth="8*" align="left"/>
25522 <colspec colwidth="6*" align="center"/>
25523 <colspec colwidth="6*" align="center"/>
25524 <colspec colwidth="6*" align="right"/>
25527 <entry><option>queue_run_max</option></entry>
25528 <entry>Use: <emphasis>main</emphasis></entry>
25529 <entry>Type: <emphasis>integer</emphasis></entry>
25530 <entry>Default: <emphasis>5</emphasis></entry>
25536 <indexterm role="concept">
25537 <primary>queue runner</primary>
25538 <secondary>maximum number of</secondary>
25540 This controls the maximum number of queue runner processes that an Exim daemon
25541 can run simultaneously. This does not mean that it starts them all at once,
25542 but rather that if the maximum number are still running when the time comes to
25543 start another one, it refrains from starting another one. This can happen with
25544 very large queues and/or very sluggish deliveries. This option does not,
25545 however, interlock with other processes, so additional queue runners can be
25546 started by other means, or by killing and restarting the daemon.
25549 Setting this option to zero does not suppress queue runs; rather, it disables
25550 the limit, allowing any number of simultaneous queue runner processes to be
25551 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
25552 the daemon’s command line.
25555 <indexterm role="option">
25556 <primary><option>queue_smtp_domains</option></primary>
25559 <informaltable frame="all">
25560 <tgroup cols="4" colsep="0" rowsep="0">
25561 <colspec colwidth="8*" align="left"/>
25562 <colspec colwidth="6*" align="center"/>
25563 <colspec colwidth="6*" align="center"/>
25564 <colspec colwidth="6*" align="right"/>
25567 <entry><option>queue_smtp_domains</option></entry>
25568 <entry>Use: <emphasis>main</emphasis></entry>
25569 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25570 <entry>Default: <emphasis>unset</emphasis></entry>
25576 <indexterm role="concept">
25577 <primary>queueing incoming messages</primary>
25579 <indexterm role="concept">
25580 <primary>message</primary>
25581 <secondary>queueing remote deliveries</secondary>
25583 When this option is set, a delivery process is started whenever a message is
25584 received, routing is performed, and local deliveries take place.
25585 However, if any SMTP deliveries are required for domains that match
25586 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
25587 message waits on the queue for the next queue run. Since routing of the message
25588 has taken place, Exim knows to which remote hosts it must be delivered, and so
25589 when the queue run happens, multiple messages for the same host are delivered
25590 over a single SMTP connection. The <option>-odqs</option> command line option causes all
25591 SMTP deliveries to be queued in this way, and is equivalent to setting
25592 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
25593 <option>queue_domains</option>.
25596 <indexterm role="option">
25597 <primary><option>receive_timeout</option></primary>
25600 <informaltable frame="all">
25601 <tgroup cols="4" colsep="0" rowsep="0">
25602 <colspec colwidth="8*" align="left"/>
25603 <colspec colwidth="6*" align="center"/>
25604 <colspec colwidth="6*" align="center"/>
25605 <colspec colwidth="6*" align="right"/>
25608 <entry><option>receive_timeout</option></entry>
25609 <entry>Use: <emphasis>main</emphasis></entry>
25610 <entry>Type: <emphasis>time</emphasis></entry>
25611 <entry>Default: <emphasis>0s</emphasis></entry>
25617 <indexterm role="concept">
25618 <primary>timeout</primary>
25619 <secondary>for non-SMTP input</secondary>
25621 This option sets the timeout for accepting a non-SMTP message, that is, the
25622 maximum time that Exim waits when reading a message on the standard input. If
25623 the value is zero, it will wait for ever. This setting is overridden by the
25624 <option>-or</option> command line option. The timeout for incoming SMTP messages is
25625 controlled by <option>smtp_receive_timeout</option>.
25628 <indexterm role="option">
25629 <primary><option>received_header_text</option></primary>
25632 <informaltable frame="all">
25633 <tgroup cols="4" colsep="0" rowsep="0">
25634 <colspec colwidth="8*" align="left"/>
25635 <colspec colwidth="6*" align="center"/>
25636 <colspec colwidth="6*" align="center"/>
25637 <colspec colwidth="6*" align="right"/>
25640 <entry><option>received_header_text</option></entry>
25641 <entry>Use: <emphasis>main</emphasis></entry>
25642 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
25643 <entry>Default: <emphasis>see below</emphasis></entry>
25649 <indexterm role="concept">
25650 <primary>customizing</primary>
25651 <secondary><emphasis>Received:</emphasis> header</secondary>
25653 <indexterm role="concept">
25654 <primary><emphasis>Received:</emphasis> header line</primary>
25655 <secondary>customizing</secondary>
25657 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
25658 added to each message, except for the timestamp, which is automatically added
25659 on at the end (preceded by a semicolon). The string is expanded each time it is
25660 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
25661 added to the message. Otherwise, the string should start with the text
25662 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
25663 header lines. The default setting is:
25665 <literallayout class="monospaced">
25666 received_header_text = Received: \
25667 ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
25668 {${if def:sender_ident \
25669 {from ${quote_local_part:$sender_ident} }}\
25670 ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
25671 by $primary_hostname \
25672 ${if def:received_protocol {with $received_protocol}} \
25673 ${if def:tls_cipher {($tls_cipher)\n\t}}\
25674 (Exim $version_number)\n\t\
25675 ${if def:sender_address \
25676 {(envelope-from <$sender_address>)\n\t}}\
25677 id $message_exim_id\
25678 ${if def:received_for {\n\tfor $received_for}}
25681 The reference to the TLS cipher is omitted when Exim is built without TLS
25682 support. The use of conditional expansions ensures that this works for both
25683 locally generated messages and messages received from remote hosts, giving
25684 header lines such as the following:
25686 <literallayout class="monospaced">
25687 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
25688 by marley.carol.example with esmtp (Exim 4.00)
25689 (envelope-from <bob@carol.example>)
25690 id 16IOWa-00019l-00
25691 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
25692 Received: by scrooge.carol.example with local (Exim 4.00)
25693 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
25696 Until the body of the message has been received, the timestamp is the time when
25697 the message started to be received. Once the body has arrived, and all policy
25698 checks have taken place, the timestamp is updated to the time at which the
25699 message was accepted.
25702 <indexterm role="option">
25703 <primary><option>received_headers_max</option></primary>
25706 <informaltable frame="all">
25707 <tgroup cols="4" colsep="0" rowsep="0">
25708 <colspec colwidth="8*" align="left"/>
25709 <colspec colwidth="6*" align="center"/>
25710 <colspec colwidth="6*" align="center"/>
25711 <colspec colwidth="6*" align="right"/>
25714 <entry><option>received_headers_max</option></entry>
25715 <entry>Use: <emphasis>main</emphasis></entry>
25716 <entry>Type: <emphasis>integer</emphasis></entry>
25717 <entry>Default: <emphasis>30</emphasis></entry>
25723 <indexterm role="concept">
25724 <primary>loop</primary>
25725 <secondary>prevention</secondary>
25727 <indexterm role="concept">
25728 <primary>mail loop prevention</primary>
25730 <indexterm role="concept">
25731 <primary><emphasis>Received:</emphasis> header line</primary>
25732 <secondary>counting</secondary>
25734 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
25735 counted, and if it is greater than this parameter, a mail loop is assumed to
25736 have occurred, the delivery is abandoned, and an error message is generated.
25737 This applies to both local and remote deliveries.
25740 <indexterm role="option">
25741 <primary><option>recipient_unqualified_hosts</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>recipient_unqualified_hosts</option></entry>
25753 <entry>Use: <emphasis>main</emphasis></entry>
25754 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
25755 <entry>Default: <emphasis>unset</emphasis></entry>
25761 <indexterm role="concept">
25762 <primary>unqualified addresses</primary>
25764 <indexterm role="concept">
25765 <primary>host</primary>
25766 <secondary>unqualified addresses from</secondary>
25768 This option lists those hosts from which Exim is prepared to accept unqualified
25769 recipient addresses in message envelopes. The addresses are made fully
25770 qualified by the addition of the <option>qualify_recipient</option> value. This option also
25771 affects message header lines. Exim does not reject unqualified recipient
25772 addresses in headers, but it qualifies them only if the message came from a
25773 host that matches <option>recipient_unqualified_hosts</option>,
25774 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
25775 option was not set.
25778 <indexterm role="option">
25779 <primary><option>recipients_max</option></primary>
25782 <informaltable frame="all">
25783 <tgroup cols="4" colsep="0" rowsep="0">
25784 <colspec colwidth="8*" align="left"/>
25785 <colspec colwidth="6*" align="center"/>
25786 <colspec colwidth="6*" align="center"/>
25787 <colspec colwidth="6*" align="right"/>
25790 <entry><option>recipients_max</option></entry>
25791 <entry>Use: <emphasis>main</emphasis></entry>
25792 <entry>Type: <emphasis>integer</emphasis></entry>
25793 <entry>Default: <emphasis>0</emphasis></entry>
25799 <indexterm role="concept">
25800 <primary>limit</primary>
25801 <secondary>number of recipients</secondary>
25803 <indexterm role="concept">
25804 <primary>recipient</primary>
25805 <secondary>maximum number</secondary>
25807 If this option is set greater than zero, it specifies the maximum number of
25808 original recipients for any message. Additional recipients that are generated
25809 by aliasing or forwarding do not count. SMTP messages get a 452 response for
25810 all recipients over the limit; earlier recipients are delivered as normal.
25811 Non-SMTP messages with too many recipients are failed, and no deliveries are
25815 <indexterm role="concept">
25816 <primary>RCPT</primary>
25817 <secondary>maximum number of incoming</secondary>
25819 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
25820 RCPT commands in a single message.
25823 <indexterm role="option">
25824 <primary><option>recipients_max_reject</option></primary>
25827 <informaltable frame="all">
25828 <tgroup cols="4" colsep="0" rowsep="0">
25829 <colspec colwidth="8*" align="left"/>
25830 <colspec colwidth="6*" align="center"/>
25831 <colspec colwidth="6*" align="center"/>
25832 <colspec colwidth="6*" align="right"/>
25835 <entry><option>recipients_max_reject</option></entry>
25836 <entry>Use: <emphasis>main</emphasis></entry>
25837 <entry>Type: <emphasis>boolean</emphasis></entry>
25838 <entry>Default: <emphasis>false</emphasis></entry>
25844 If this option is set true, Exim rejects SMTP messages containing too many
25845 recipients by giving 552 errors to the surplus RCPT commands, and a 554
25846 error to the eventual DATA command. Otherwise (the default) it gives a 452
25847 error to the surplus RCPT commands and accepts the message on behalf of the
25848 initial set of recipients. The remote server should then re-send the message
25849 for the remaining recipients at a later time.
25852 <indexterm role="option">
25853 <primary><option>remote_max_parallel</option></primary>
25856 <informaltable frame="all">
25857 <tgroup cols="4" colsep="0" rowsep="0">
25858 <colspec colwidth="8*" align="left"/>
25859 <colspec colwidth="6*" align="center"/>
25860 <colspec colwidth="6*" align="center"/>
25861 <colspec colwidth="6*" align="right"/>
25864 <entry><option>remote_max_parallel</option></entry>
25865 <entry>Use: <emphasis>main</emphasis></entry>
25866 <entry>Type: <emphasis>integer</emphasis></entry>
25867 <entry>Default: <emphasis>2</emphasis></entry>
25873 <indexterm role="concept">
25874 <primary>delivery</primary>
25875 <secondary>parallelism for remote</secondary>
25877 This option controls parallel delivery of one message to a number of remote
25878 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
25879 does all the remote deliveries for a message one by one. Otherwise, if a single
25880 message has to be delivered to more than one remote host, or if several copies
25881 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
25882 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
25883 deliveries are required, the maximum number of processes are started, and as
25884 each one finishes, another is begun. The order of starting processes is the
25885 same as if sequential delivery were being done, and can be controlled by the
25886 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
25887 with debugging turned on, the debugging output from each delivery process is
25888 tagged with its process id.
25891 This option controls only the maximum number of parallel deliveries for one
25892 message in one Exim delivery process. Because Exim has no central queue
25893 manager, there is no way of controlling the total number of simultaneous
25894 deliveries if the configuration allows a delivery attempt as soon as a message
25898 <indexterm role="concept">
25899 <primary>number of deliveries</primary>
25901 <indexterm role="concept">
25902 <primary>delivery</primary>
25903 <secondary>maximum number of</secondary>
25905 If you want to control the total number of deliveries on the system, you
25906 need to set the <option>queue_only</option> option. This ensures that all incoming messages
25907 are added to the queue without starting a delivery process. Then set up an Exim
25908 daemon to start queue runner processes at appropriate intervals (probably
25909 fairly often, for example, every minute), and limit the total number of queue
25910 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
25911 delivers only one message at a time, the maximum number of deliveries that can
25912 then take place at once is <option>queue_run_max</option> multiplied by
25913 <option>remote_max_parallel</option>.
25916 If it is purely remote deliveries you want to control, use
25917 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
25918 doing the SMTP routing before queueing, so that several messages for the same
25919 host will eventually get delivered down the same connection.
25922 <indexterm role="option">
25923 <primary><option>remote_sort_domains</option></primary>
25926 <informaltable frame="all">
25927 <tgroup cols="4" colsep="0" rowsep="0">
25928 <colspec colwidth="8*" align="left"/>
25929 <colspec colwidth="6*" align="center"/>
25930 <colspec colwidth="6*" align="center"/>
25931 <colspec colwidth="6*" align="right"/>
25934 <entry><option>remote_sort_domains</option></entry>
25935 <entry>Use: <emphasis>main</emphasis></entry>
25936 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
25937 <entry>Default: <emphasis>unset</emphasis></entry>
25943 <indexterm role="concept">
25944 <primary>sorting remote deliveries</primary>
25946 <indexterm role="concept">
25947 <primary>delivery</primary>
25948 <secondary>sorting remote</secondary>
25950 When there are a number of remote deliveries for a message, they are sorted by
25951 domain into the order given by this list. For example,
25953 <literallayout class="monospaced">
25954 remote_sort_domains = *.cam.ac.uk:*.uk
25957 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
25958 then to those in the <option>uk</option> domain, then to any others.
25961 <indexterm role="option">
25962 <primary><option>retry_data_expire</option></primary>
25965 <informaltable frame="all">
25966 <tgroup cols="4" colsep="0" rowsep="0">
25967 <colspec colwidth="8*" align="left"/>
25968 <colspec colwidth="6*" align="center"/>
25969 <colspec colwidth="6*" align="center"/>
25970 <colspec colwidth="6*" align="right"/>
25973 <entry><option>retry_data_expire</option></entry>
25974 <entry>Use: <emphasis>main</emphasis></entry>
25975 <entry>Type: <emphasis>time</emphasis></entry>
25976 <entry>Default: <emphasis>7d</emphasis></entry>
25982 <indexterm role="concept">
25983 <primary>hints database</primary>
25984 <secondary>data expiry</secondary>
25986 This option sets a <quote>use before</quote> time on retry information in Exim’s hints
25987 database. Any older retry data is ignored. This means that, for example, once a
25988 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
25992 <indexterm role="option">
25993 <primary><option>retry_interval_max</option></primary>
25996 <informaltable frame="all">
25997 <tgroup cols="4" colsep="0" rowsep="0">
25998 <colspec colwidth="8*" align="left"/>
25999 <colspec colwidth="6*" align="center"/>
26000 <colspec colwidth="6*" align="center"/>
26001 <colspec colwidth="6*" align="right"/>
26004 <entry><option>retry_interval_max</option></entry>
26005 <entry>Use: <emphasis>main</emphasis></entry>
26006 <entry>Type: <emphasis>time</emphasis></entry>
26007 <entry>Default: <emphasis>24h</emphasis></entry>
26013 <indexterm role="concept">
26014 <primary>retry</primary>
26015 <secondary>limit on interval</secondary>
26017 <indexterm role="concept">
26018 <primary>limit</primary>
26019 <secondary>on retry interval</secondary>
26021 Chapter <xref linkend="CHAPretry"/> describes Exim’s mechanisms for controlling the
26022 intervals between delivery attempts for messages that cannot be delivered
26023 straight away. This option sets an overall limit to the length of time between
26024 retries. It cannot be set greater than 24 hours; any attempt to do so forces
26028 <indexterm role="option">
26029 <primary><option>return_path_remove</option></primary>
26032 <informaltable frame="all">
26033 <tgroup cols="4" colsep="0" rowsep="0">
26034 <colspec colwidth="8*" align="left"/>
26035 <colspec colwidth="6*" align="center"/>
26036 <colspec colwidth="6*" align="center"/>
26037 <colspec colwidth="6*" align="right"/>
26040 <entry><option>return_path_remove</option></entry>
26041 <entry>Use: <emphasis>main</emphasis></entry>
26042 <entry>Type: <emphasis>boolean</emphasis></entry>
26043 <entry>Default: <emphasis>true</emphasis></entry>
26049 <indexterm role="concept">
26050 <primary><emphasis>Return-path:</emphasis> header line</primary>
26051 <secondary>removing</secondary>
26053 RFC 2821, section 4.4, states that an SMTP server must insert a
26054 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
26055 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
26056 MAIL command. This description implies that this header should not be present
26057 in an incoming message. If <option>return_path_remove</option> is true, any existing
26058 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
26059 received. Exim’s transports have options for adding <emphasis>Return-path:</emphasis> headers at
26060 the time of delivery. They are normally used only for final local deliveries.
26063 <indexterm role="option">
26064 <primary><option>return_size_limit</option></primary>
26067 <informaltable frame="all">
26068 <tgroup cols="4" colsep="0" rowsep="0">
26069 <colspec colwidth="8*" align="left"/>
26070 <colspec colwidth="6*" align="center"/>
26071 <colspec colwidth="6*" align="center"/>
26072 <colspec colwidth="6*" align="right"/>
26075 <entry><option>return_size_limit</option></entry>
26076 <entry>Use: <emphasis>main</emphasis></entry>
26077 <entry>Type: <emphasis>integer</emphasis></entry>
26078 <entry>Default: <emphasis>100K</emphasis></entry>
26084 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
26087 <indexterm role="option">
26088 <primary><option>rfc1413_hosts</option></primary>
26091 <informaltable frame="all">
26092 <tgroup cols="4" colsep="0" rowsep="0">
26093 <colspec colwidth="8*" align="left"/>
26094 <colspec colwidth="6*" align="center"/>
26095 <colspec colwidth="6*" align="center"/>
26096 <colspec colwidth="6*" align="right"/>
26099 <entry><option>rfc1413_hosts</option></entry>
26100 <entry>Use: <emphasis>main</emphasis></entry>
26101 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26102 <entry>Default: <emphasis>*</emphasis></entry>
26108 <indexterm role="concept">
26109 <primary>RFC 1413</primary>
26111 <indexterm role="concept">
26112 <primary>host</primary>
26113 <secondary>for RFC 1413 calls</secondary>
26115 RFC 1413 identification calls are made to any client host which matches an item
26119 <indexterm role="option">
26120 <primary><option>rfc1413_query_timeout</option></primary>
26123 <informaltable frame="all">
26124 <tgroup cols="4" colsep="0" rowsep="0">
26125 <colspec colwidth="8*" align="left"/>
26126 <colspec colwidth="6*" align="center"/>
26127 <colspec colwidth="6*" align="center"/>
26128 <colspec colwidth="6*" align="right"/>
26131 <entry><option>rfc1413_query_timeout</option></entry>
26132 <entry>Use: <emphasis>main</emphasis></entry>
26133 <entry>Type: <emphasis>time</emphasis></entry>
26134 <entry>Default: <emphasis>5s</emphasis></entry>
26140 <indexterm role="concept">
26141 <primary>RFC 1413</primary>
26142 <secondary>query timeout</secondary>
26144 <indexterm role="concept">
26145 <primary>timeout</primary>
26146 <secondary>for RFC 1413 call</secondary>
26148 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
26149 no RFC 1413 calls are ever made.
26152 <indexterm role="option">
26153 <primary><option>sender_unqualified_hosts</option></primary>
26156 <informaltable frame="all">
26157 <tgroup cols="4" colsep="0" rowsep="0">
26158 <colspec colwidth="8*" align="left"/>
26159 <colspec colwidth="6*" align="center"/>
26160 <colspec colwidth="6*" align="center"/>
26161 <colspec colwidth="6*" align="right"/>
26164 <entry><option>sender_unqualified_hosts</option></entry>
26165 <entry>Use: <emphasis>main</emphasis></entry>
26166 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26167 <entry>Default: <emphasis>unset</emphasis></entry>
26173 <indexterm role="concept">
26174 <primary>unqualified addresses</primary>
26176 <indexterm role="concept">
26177 <primary>host</primary>
26178 <secondary>unqualified addresses from</secondary>
26180 This option lists those hosts from which Exim is prepared to accept unqualified
26181 sender addresses. The addresses are made fully qualified by the addition of
26182 <option>qualify_domain</option>. This option also affects message header lines. Exim does
26183 not reject unqualified addresses in headers that contain sender addresses, but
26184 it qualifies them only if the message came from a host that matches
26185 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
26186 using TCP/IP), and the <option>-bnq</option> option was not set.
26189 <indexterm role="option">
26190 <primary><option>smtp_accept_keepalive</option></primary>
26193 <informaltable frame="all">
26194 <tgroup cols="4" colsep="0" rowsep="0">
26195 <colspec colwidth="8*" align="left"/>
26196 <colspec colwidth="6*" align="center"/>
26197 <colspec colwidth="6*" align="center"/>
26198 <colspec colwidth="6*" align="right"/>
26201 <entry><option>smtp_accept_keepalive</option></entry>
26202 <entry>Use: <emphasis>main</emphasis></entry>
26203 <entry>Type: <emphasis>boolean</emphasis></entry>
26204 <entry>Default: <emphasis>true</emphasis></entry>
26210 <indexterm role="concept">
26211 <primary>keepalive</primary>
26212 <secondary>on incoming connection</secondary>
26214 This option controls the setting of the SO_KEEPALIVE option on incoming
26215 TCP/IP socket connections. When set, it causes the kernel to probe idle
26216 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
26217 other end of the connection should send an acknowledgment if the connection is
26218 still okay or a reset if the connection has been aborted. The reason for doing
26219 this is that it has the beneficial effect of freeing up certain types of
26220 connection that can get stuck when the remote host is disconnected without
26221 tidying up the TCP/IP call properly. The keepalive mechanism takes several
26222 hours to detect unreachable hosts.
26225 <indexterm role="option">
26226 <primary><option>smtp_accept_max</option></primary>
26229 <informaltable frame="all">
26230 <tgroup cols="4" colsep="0" rowsep="0">
26231 <colspec colwidth="8*" align="left"/>
26232 <colspec colwidth="6*" align="center"/>
26233 <colspec colwidth="6*" align="center"/>
26234 <colspec colwidth="6*" align="right"/>
26237 <entry><option>smtp_accept_max</option></entry>
26238 <entry>Use: <emphasis>main</emphasis></entry>
26239 <entry>Type: <emphasis>integer</emphasis></entry>
26240 <entry>Default: <emphasis>20</emphasis></entry>
26246 <indexterm role="concept">
26247 <primary>limit</primary>
26248 <secondary>incoming SMTP connections</secondary>
26250 <indexterm role="concept">
26251 <primary>SMTP</primary>
26252 <secondary>incoming connection count</secondary>
26254 <indexterm role="concept">
26255 <primary>inetd</primary>
26257 This option specifies the maximum number of simultaneous incoming SMTP calls
26258 that Exim will accept. It applies only to the listening daemon; there is no
26259 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
26260 value is set to zero, no limit is applied. However, it is required to be
26261 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
26262 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
26265 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
26266 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
26267 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
26268 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
26271 <indexterm role="option">
26272 <primary><option>smtp_accept_max_nonmail</option></primary>
26275 <informaltable frame="all">
26276 <tgroup cols="4" colsep="0" rowsep="0">
26277 <colspec colwidth="8*" align="left"/>
26278 <colspec colwidth="6*" align="center"/>
26279 <colspec colwidth="6*" align="center"/>
26280 <colspec colwidth="6*" align="right"/>
26283 <entry><option>smtp_accept_max_nonmail</option></entry>
26284 <entry>Use: <emphasis>main</emphasis></entry>
26285 <entry>Type: <emphasis>integer</emphasis></entry>
26286 <entry>Default: <emphasis>10</emphasis></entry>
26292 <indexterm role="concept">
26293 <primary>limit</primary>
26294 <secondary>non-mail SMTP commands</secondary>
26296 <indexterm role="concept">
26297 <primary>SMTP</primary>
26298 <secondary>limiting non-mail commands</secondary>
26300 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
26301 the connection if there are too many. This option defines <quote>too many</quote>. The
26302 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
26303 client looping sending EHLO, for example. The check is applied only if the
26304 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
26307 When a new message is expected, one occurrence of RSET is not counted. This
26308 allows a client to send one RSET between messages (this is not necessary,
26309 but some clients do it). Exim also allows one uncounted occurrence of HELO
26310 or EHLO, and one occurrence of STARTTLS between messages. After
26311 starting up a TLS session, another EHLO is expected, and so it too is not
26312 counted. The first occurrence of AUTH in a connection, or immediately
26313 following STARTTLS is not counted. Otherwise, all commands other than
26314 MAIL, RCPT, DATA, and QUIT are counted.
26317 <indexterm role="option">
26318 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
26321 <informaltable frame="all">
26322 <tgroup cols="4" colsep="0" rowsep="0">
26323 <colspec colwidth="8*" align="left"/>
26324 <colspec colwidth="6*" align="center"/>
26325 <colspec colwidth="6*" align="center"/>
26326 <colspec colwidth="6*" align="right"/>
26329 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
26330 <entry>Use: <emphasis>main</emphasis></entry>
26331 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
26332 <entry>Default: <emphasis>*</emphasis></entry>
26338 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
26339 check by setting this option. The default value makes it apply to all hosts. By
26340 changing the value, you can exclude any badly-behaved hosts that you have to
26344 <indexterm role="option">
26345 <primary><option>smtp_accept_max_per_connection</option></primary>
26348 <informaltable frame="all">
26349 <tgroup cols="4" colsep="0" rowsep="0">
26350 <colspec colwidth="8*" align="left"/>
26351 <colspec colwidth="6*" align="center"/>
26352 <colspec colwidth="6*" align="center"/>
26353 <colspec colwidth="6*" align="right"/>
26356 <entry><option>smtp_accept_max_per_ connection</option></entry>
26357 <entry>Use: <emphasis>main</emphasis></entry>
26358 <entry>Type: <emphasis>integer</emphasis></entry>
26359 <entry>Default: <emphasis>1000</emphasis></entry>
26365 <indexterm role="concept">
26366 <primary>SMTP</primary>
26367 <secondary>limiting incoming message count</secondary>
26369 <indexterm role="concept">
26370 <primary>limit</primary>
26371 <secondary>messages per SMTP connection</secondary>
26373 The value of this option limits the number of MAIL commands that Exim is
26374 prepared to accept over a single SMTP connection, whether or not each command
26375 results in the transfer of a message. After the limit is reached, a 421
26376 response is given to subsequent MAIL commands. This limit is a safety
26377 precaution against a client that goes mad (incidents of this type have been
26381 <indexterm role="option">
26382 <primary><option>smtp_accept_max_per_host</option></primary>
26385 <informaltable frame="all">
26386 <tgroup cols="4" colsep="0" rowsep="0">
26387 <colspec colwidth="8*" align="left"/>
26388 <colspec colwidth="6*" align="center"/>
26389 <colspec colwidth="6*" align="center"/>
26390 <colspec colwidth="6*" align="right"/>
26393 <entry><option>smtp_accept_max_per_host</option></entry>
26394 <entry>Use: <emphasis>main</emphasis></entry>
26395 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26396 <entry>Default: <emphasis>unset</emphasis></entry>
26402 <indexterm role="concept">
26403 <primary>limit</primary>
26404 <secondary>SMTP connections from one host</secondary>
26406 <indexterm role="concept">
26407 <primary>host</primary>
26408 <secondary>limiting SMTP connections from</secondary>
26410 This option restricts the number of simultaneous IP connections from a single
26411 host (strictly, from a single IP address) to the Exim daemon. The option is
26412 expanded, to enable different limits to be applied to different hosts by
26413 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
26414 connection attempts from the same host are rejected with error code 421. This
26415 is entirely independent of <option>smtp_accept_reserve</option>. The option’s default value
26416 of zero imposes no limit. If this option is set greater than zero, it is
26417 required that <option>smtp_accept_max</option> be non-zero.
26420 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
26421 constructions that take an appreciable amount of time. The expansion and test
26422 happen in the main daemon loop, in order to reject additional connections
26423 without forking additional processes (otherwise a denial-of-service attack
26424 could cause a vast number or processes to be created). While the daemon is
26425 doing this processing, it cannot accept any other incoming connections.
26428 <indexterm role="option">
26429 <primary><option>smtp_accept_queue</option></primary>
26432 <informaltable frame="all">
26433 <tgroup cols="4" colsep="0" rowsep="0">
26434 <colspec colwidth="8*" align="left"/>
26435 <colspec colwidth="6*" align="center"/>
26436 <colspec colwidth="6*" align="center"/>
26437 <colspec colwidth="6*" align="right"/>
26440 <entry><option>smtp_accept_queue</option></entry>
26441 <entry>Use: <emphasis>main</emphasis></entry>
26442 <entry>Type: <emphasis>integer</emphasis></entry>
26443 <entry>Default: <emphasis>0</emphasis></entry>
26449 <indexterm role="concept">
26450 <primary>SMTP</primary>
26451 <secondary>incoming connection count</secondary>
26453 <indexterm role="concept">
26454 <primary>queueing incoming messages</primary>
26456 <indexterm role="concept">
26457 <primary>message</primary>
26458 <secondary>queueing by SMTP connection count</secondary>
26460 If the number of simultaneous incoming SMTP connections being handled via the
26461 listening daemon exceeds this value, messages received by SMTP are just placed
26462 on the queue; no delivery processes are started automatically. The count is
26463 fixed at the start of an SMTP connection. It cannot be updated in the
26464 subprocess that receives messages, and so the queueing or not queueing applies
26465 to all messages received in the same connection.
26468 A value of zero implies no limit, and clearly any non-zero value is useful only
26469 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
26470 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
26471 various <option>-od</option><emphasis>x</emphasis> command line options.
26474 <indexterm role="option">
26475 <primary><option>smtp_accept_queue_per_connection</option></primary>
26478 <informaltable frame="all">
26479 <tgroup cols="4" colsep="0" rowsep="0">
26480 <colspec colwidth="8*" align="left"/>
26481 <colspec colwidth="6*" align="center"/>
26482 <colspec colwidth="6*" align="center"/>
26483 <colspec colwidth="6*" align="right"/>
26486 <entry><option>smtp_accept_queue_per_ connection</option></entry>
26487 <entry>Use: <emphasis>main</emphasis></entry>
26488 <entry>Type: <emphasis>integer</emphasis></entry>
26489 <entry>Default: <emphasis>10</emphasis></entry>
26495 <indexterm role="concept">
26496 <primary>queueing incoming messages</primary>
26498 <indexterm role="concept">
26499 <primary>message</primary>
26500 <secondary>queueing by message count</secondary>
26502 This option limits the number of delivery processes that Exim starts
26503 automatically when receiving messages via SMTP, whether via the daemon or by
26504 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
26505 and the number of messages received in a single SMTP session exceeds this
26506 number, subsequent messages are placed on the queue, but no delivery processes
26507 are started. This helps to limit the number of Exim processes when a server
26508 restarts after downtime and there is a lot of mail waiting for it on other
26509 systems. On large systems, the default should probably be increased, and on
26510 dial-in client systems it should probably be set to zero (that is, disabled).
26513 <indexterm role="option">
26514 <primary><option>smtp_accept_reserve</option></primary>
26517 <informaltable frame="all">
26518 <tgroup cols="4" colsep="0" rowsep="0">
26519 <colspec colwidth="8*" align="left"/>
26520 <colspec colwidth="6*" align="center"/>
26521 <colspec colwidth="6*" align="center"/>
26522 <colspec colwidth="6*" align="right"/>
26525 <entry><option>smtp_accept_reserve</option></entry>
26526 <entry>Use: <emphasis>main</emphasis></entry>
26527 <entry>Type: <emphasis>integer</emphasis></entry>
26528 <entry>Default: <emphasis>0</emphasis></entry>
26534 <indexterm role="concept">
26535 <primary>SMTP</primary>
26536 <secondary>incoming call count</secondary>
26538 <indexterm role="concept">
26539 <primary>host</primary>
26540 <secondary>reserved</secondary>
26542 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
26543 number of SMTP connections that are reserved for connections from the hosts
26544 that are specified in <option>smtp_reserve_hosts</option>. The value set in
26545 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
26546 restricted to this number of connections; the option specifies a minimum number
26547 of connection slots for them, not a maximum. It is a guarantee that this group
26548 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
26549 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
26553 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
26554 set to 5, once there are 45 active connections (from any hosts), new
26555 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
26556 provided the other criteria for acceptance are met.
26559 <indexterm role="option">
26560 <primary><option>smtp_active_hostname</option></primary>
26563 <informaltable frame="all">
26564 <tgroup cols="4" colsep="0" rowsep="0">
26565 <colspec colwidth="8*" align="left"/>
26566 <colspec colwidth="6*" align="center"/>
26567 <colspec colwidth="6*" align="center"/>
26568 <colspec colwidth="6*" align="right"/>
26571 <entry><option>smtp_active_hostname</option></entry>
26572 <entry>Use: <emphasis>main</emphasis></entry>
26573 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26574 <entry>Default: <emphasis>unset</emphasis></entry>
26580 <indexterm role="concept">
26581 <primary>host</primary>
26582 <secondary>name in SMTP responses</secondary>
26584 <indexterm role="concept">
26585 <primary>SMTP</primary>
26586 <secondary>host name in responses</secondary>
26588 <indexterm role="variable">
26589 <primary><varname>$primary_hostname</varname></primary>
26591 This option is provided for multi-homed servers that want to masquerade as
26592 several different hosts. At the start of an incoming SMTP connection, its value
26593 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
26594 responses. For example, it is used as domain name in the response to an
26595 incoming HELO or EHLO command.
26598 <indexterm role="variable">
26599 <primary><varname>$smtp_active_hostname</varname></primary>
26601 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
26602 is saved with any messages that are received. It is therefore available for use
26603 in routers and transports when the message is later delivered.
26606 If this option is unset, or if its expansion is forced to fail, or if the
26607 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
26608 used. Other expansion failures cause a message to be written to the main and
26609 panic logs, and the SMTP command receives a temporary error. Typically, the
26610 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
26613 <literallayout class="monospaced">
26614 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
26615 {cox.mydomain}{box.mydomain}}
26618 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
26619 messages, it is also used as the default for HELO commands in callout
26620 verification if there is no remote transport from which to obtain a
26621 <option>helo_data</option> value.
26624 <indexterm role="option">
26625 <primary><option>smtp_banner</option></primary>
26628 <informaltable frame="all">
26629 <tgroup cols="4" colsep="0" rowsep="0">
26630 <colspec colwidth="8*" align="left"/>
26631 <colspec colwidth="6*" align="center"/>
26632 <colspec colwidth="6*" align="center"/>
26633 <colspec colwidth="6*" align="right"/>
26636 <entry><option>smtp_banner</option></entry>
26637 <entry>Use: <emphasis>main</emphasis></entry>
26638 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26639 <entry>Default: <emphasis>see below</emphasis></entry>
26645 <indexterm role="concept">
26646 <primary>SMTP</primary>
26647 <secondary>welcome banner</secondary>
26649 <indexterm role="concept">
26650 <primary>banner for SMTP</primary>
26652 <indexterm role="concept">
26653 <primary>welcome banner for SMTP</primary>
26655 <indexterm role="concept">
26656 <primary>customizing</primary>
26657 <secondary>SMTP banner</secondary>
26659 This string, which is expanded every time it is used, is output as the initial
26660 positive response to an SMTP connection. The default setting is:
26662 <literallayout class="monospaced">
26663 smtp_banner = $smtp_active_hostname ESMTP Exim \
26664 $version_number $tod_full
26667 Failure to expand the string causes a panic error. If you want to create a
26668 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
26669 appropriate points, but not at the end. Note that the 220 code is not included
26670 in this string. Exim adds it automatically (several times in the case of a
26671 multiline response).
26674 <indexterm role="option">
26675 <primary><option>smtp_check_spool_space</option></primary>
26678 <informaltable frame="all">
26679 <tgroup cols="4" colsep="0" rowsep="0">
26680 <colspec colwidth="8*" align="left"/>
26681 <colspec colwidth="6*" align="center"/>
26682 <colspec colwidth="6*" align="center"/>
26683 <colspec colwidth="6*" align="right"/>
26686 <entry><option>smtp_check_spool_space</option></entry>
26687 <entry>Use: <emphasis>main</emphasis></entry>
26688 <entry>Type: <emphasis>boolean</emphasis></entry>
26689 <entry>Default: <emphasis>true</emphasis></entry>
26695 <indexterm role="concept">
26696 <primary>checking disk space</primary>
26698 <indexterm role="concept">
26699 <primary>disk space, checking</primary>
26701 <indexterm role="concept">
26702 <primary>spool directory</primary>
26703 <secondary>checking space</secondary>
26705 When this option is set, if an incoming SMTP session encounters the SIZE
26706 option on a MAIL command, it checks that there is enough space in the
26707 spool directory’s partition to accept a message of that size, while still
26708 leaving free the amount specified by <option>check_spool_space</option> (even if that value
26709 is zero). If there isn’t enough space, a temporary error code is returned.
26712 <indexterm role="option">
26713 <primary><option>smtp_connect_backlog</option></primary>
26716 <informaltable frame="all">
26717 <tgroup cols="4" colsep="0" rowsep="0">
26718 <colspec colwidth="8*" align="left"/>
26719 <colspec colwidth="6*" align="center"/>
26720 <colspec colwidth="6*" align="center"/>
26721 <colspec colwidth="6*" align="right"/>
26724 <entry><option>smtp_connect_backlog</option></entry>
26725 <entry>Use: <emphasis>main</emphasis></entry>
26726 <entry>Type: <emphasis>integer</emphasis></entry>
26727 <entry>Default: <emphasis>20</emphasis></entry>
26733 <indexterm role="concept">
26734 <primary>connection backlog</primary>
26736 <indexterm role="concept">
26737 <primary>SMTP</primary>
26738 <secondary>connection backlog</secondary>
26740 <indexterm role="concept">
26741 <primary>backlog of connections</primary>
26743 This option specifies a maximum number of waiting SMTP connections. Exim passes
26744 this value to the TCP/IP system when it sets up its listener. Once this number
26745 of connections are waiting for the daemon’s attention, subsequent connection
26746 attempts are refused at the TCP/IP level. At least, that is what the manuals
26747 say; in some circumstances such connection attempts have been observed to time
26748 out instead. For large systems it is probably a good idea to increase the
26749 value (to 50, say). It also gives some protection against denial-of-service
26750 attacks by SYN flooding.
26753 <indexterm role="option">
26754 <primary><option>smtp_enforce_sync</option></primary>
26757 <informaltable frame="all">
26758 <tgroup cols="4" colsep="0" rowsep="0">
26759 <colspec colwidth="8*" align="left"/>
26760 <colspec colwidth="6*" align="center"/>
26761 <colspec colwidth="6*" align="center"/>
26762 <colspec colwidth="6*" align="right"/>
26765 <entry><option>smtp_enforce_sync</option></entry>
26766 <entry>Use: <emphasis>main</emphasis></entry>
26767 <entry>Type: <emphasis>boolean</emphasis></entry>
26768 <entry>Default: <emphasis>true</emphasis></entry>
26774 <indexterm role="concept">
26775 <primary>SMTP</primary>
26776 <secondary>synchronization checking</secondary>
26778 <indexterm role="concept">
26779 <primary>synchronization checking in SMTP</primary>
26781 The SMTP protocol specification requires the client to wait for a response from
26782 the server at certain points in the dialogue. Without PIPELINING these
26783 synchronization points are after every command; with PIPELINING they are
26784 fewer, but they still exist.
26787 Some spamming sites send out a complete set of SMTP commands without waiting
26788 for any response. Exim protects against this by rejecting a message if the
26789 client has sent further input when it should not have. The error response <quote>554
26790 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
26791 for this error cannot be perfect because of transmission delays (unexpected
26792 input may be on its way but not yet received when Exim checks). However, it
26793 does detect many instances.
26796 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
26797 If you want to disable the check selectively (for example, only for certain
26798 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
26799 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
26802 <indexterm role="option">
26803 <primary><option>smtp_etrn_command</option></primary>
26806 <informaltable frame="all">
26807 <tgroup cols="4" colsep="0" rowsep="0">
26808 <colspec colwidth="8*" align="left"/>
26809 <colspec colwidth="6*" align="center"/>
26810 <colspec colwidth="6*" align="center"/>
26811 <colspec colwidth="6*" align="right"/>
26814 <entry><option>smtp_etrn_command</option></entry>
26815 <entry>Use: <emphasis>main</emphasis></entry>
26816 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
26817 <entry>Default: <emphasis>unset</emphasis></entry>
26823 <indexterm role="concept">
26824 <primary>ETRN</primary>
26825 <secondary>command to be run</secondary>
26827 <indexterm role="variable">
26828 <primary><varname>$domain</varname></primary>
26830 If this option is set, the given command is run whenever an SMTP ETRN
26831 command is received from a host that is permitted to issue such commands (see
26832 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
26833 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
26834 argument of the ETRN command, and no syntax checking is done on it. For
26837 <literallayout class="monospaced">
26838 smtp_etrn_command = /etc/etrn_command $domain \
26839 $sender_host_address
26842 A new process is created to run the command, but Exim does not wait for it to
26843 complete. Consequently, its status cannot be checked. If the command cannot be
26844 run, a line is written to the panic log, but the ETRN caller still receives
26845 a 250 success response. Exim is normally running under its own uid when
26846 receiving SMTP, so it is not possible for it to change the uid before running
26850 <indexterm role="option">
26851 <primary><option>smtp_etrn_serialize</option></primary>
26854 <informaltable frame="all">
26855 <tgroup cols="4" colsep="0" rowsep="0">
26856 <colspec colwidth="8*" align="left"/>
26857 <colspec colwidth="6*" align="center"/>
26858 <colspec colwidth="6*" align="center"/>
26859 <colspec colwidth="6*" align="right"/>
26862 <entry><option>smtp_etrn_serialize</option></entry>
26863 <entry>Use: <emphasis>main</emphasis></entry>
26864 <entry>Type: <emphasis>boolean</emphasis></entry>
26865 <entry>Default: <emphasis>true</emphasis></entry>
26871 <indexterm role="concept">
26872 <primary>ETRN</primary>
26873 <secondary>serializing</secondary>
26875 When this option is set, it prevents the simultaneous execution of more than
26876 one identical command as a result of ETRN in an SMTP connection. See
26877 section <xref linkend="SECTETRN"/> for details.
26880 <indexterm role="option">
26881 <primary><option>smtp_load_reserve</option></primary>
26884 <informaltable frame="all">
26885 <tgroup cols="4" colsep="0" rowsep="0">
26886 <colspec colwidth="8*" align="left"/>
26887 <colspec colwidth="6*" align="center"/>
26888 <colspec colwidth="6*" align="center"/>
26889 <colspec colwidth="6*" align="right"/>
26892 <entry><option>smtp_load_reserve</option></entry>
26893 <entry>Use: <emphasis>main</emphasis></entry>
26894 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26895 <entry>Default: <emphasis>unset</emphasis></entry>
26901 <indexterm role="concept">
26902 <primary>load average</primary>
26904 If the system load average ever gets higher than this, incoming SMTP calls are
26905 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
26906 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
26907 the load is over the limit. The option has no effect on ancient operating
26908 systems on which Exim cannot determine the load average. See also
26909 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
26912 <indexterm role="option">
26913 <primary><option>smtp_max_synprot_errors</option></primary>
26916 <informaltable frame="all">
26917 <tgroup cols="4" colsep="0" rowsep="0">
26918 <colspec colwidth="8*" align="left"/>
26919 <colspec colwidth="6*" align="center"/>
26920 <colspec colwidth="6*" align="center"/>
26921 <colspec colwidth="6*" align="right"/>
26924 <entry><option>smtp_max_synprot_errors</option></entry>
26925 <entry>Use: <emphasis>main</emphasis></entry>
26926 <entry>Type: <emphasis>integer</emphasis></entry>
26927 <entry>Default: <emphasis>3</emphasis></entry>
26933 <indexterm role="concept">
26934 <primary>SMTP</primary>
26935 <secondary>limiting syntax and protocol errors</secondary>
26937 <indexterm role="concept">
26938 <primary>limit</primary>
26939 <secondary>SMTP syntax and protocol errors</secondary>
26941 Exim rejects SMTP commands that contain syntax or protocol errors. In
26942 particular, a syntactically invalid email address, as in this command:
26944 <literallayout class="monospaced">
26945 RCPT TO:<abc xyz@a.b.c>
26948 causes immediate rejection of the command, before any other tests are done.
26949 (The ACL cannot be run if there is no valid address to set up for it.) An
26950 example of a protocol error is receiving RCPT before MAIL. If there are
26951 too many syntax or protocol errors in one SMTP session, the connection is
26952 dropped. The limit is set by this option.
26955 <indexterm role="concept">
26956 <primary>PIPELINING</primary>
26957 <secondary>expected errors</secondary>
26959 When the PIPELINING extension to SMTP is in use, some protocol errors are
26960 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
26961 Exim assumes that PIPELINING will be used if it advertises it (see
26962 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
26963 not count towards the limit.
26966 <indexterm role="option">
26967 <primary><option>smtp_max_unknown_commands</option></primary>
26970 <informaltable frame="all">
26971 <tgroup cols="4" colsep="0" rowsep="0">
26972 <colspec colwidth="8*" align="left"/>
26973 <colspec colwidth="6*" align="center"/>
26974 <colspec colwidth="6*" align="center"/>
26975 <colspec colwidth="6*" align="right"/>
26978 <entry><option>smtp_max_unknown_commands</option></entry>
26979 <entry>Use: <emphasis>main</emphasis></entry>
26980 <entry>Type: <emphasis>integer</emphasis></entry>
26981 <entry>Default: <emphasis>3</emphasis></entry>
26987 <indexterm role="concept">
26988 <primary>SMTP</primary>
26989 <secondary>limiting unknown commands</secondary>
26991 <indexterm role="concept">
26992 <primary>limit</primary>
26993 <secondary>unknown SMTP commands</secondary>
26995 If there are too many unrecognized commands in an incoming SMTP session, an
26996 Exim server drops the connection. This is a defence against some kinds of abuse
26999 into making connections to SMTP ports; in these circumstances, a number of
27000 non-SMTP command lines are sent first.
27003 <indexterm role="option">
27004 <primary><option>smtp_ratelimit_hosts</option></primary>
27007 <informaltable frame="all">
27008 <tgroup cols="4" colsep="0" rowsep="0">
27009 <colspec colwidth="8*" align="left"/>
27010 <colspec colwidth="6*" align="center"/>
27011 <colspec colwidth="6*" align="center"/>
27012 <colspec colwidth="6*" align="right"/>
27015 <entry><option>smtp_ratelimit_hosts</option></entry>
27016 <entry>Use: <emphasis>main</emphasis></entry>
27017 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27018 <entry>Default: <emphasis>unset</emphasis></entry>
27024 <indexterm role="concept">
27025 <primary>SMTP</primary>
27026 <secondary>rate limiting</secondary>
27028 <indexterm role="concept">
27029 <primary>limit</primary>
27030 <secondary>rate of message arrival</secondary>
27032 <indexterm role="concept">
27033 <primary>RCPT</primary>
27034 <secondary>rate limiting</secondary>
27036 Some sites find it helpful to be able to limit the rate at which certain hosts
27037 can send them messages, and the rate at which an individual message can specify
27041 Exim has two rate-limiting facilities. This section describes the older
27042 facility, which can limit rates within a single connection. The newer
27043 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
27044 <xref linkend="SECTratelimiting"/> for details of the newer facility.
27047 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
27048 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
27049 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
27050 respectively. Each option, if set, must contain a set of four comma-separated
27056 A threshold, before which there is no rate limiting.
27061 An initial time delay. Unlike other times in Exim, numbers with decimal
27062 fractional parts are allowed here.
27067 A factor by which to increase the delay each time.
27072 A maximum value for the delay. This should normally be less than 5 minutes,
27073 because after that time, the client is liable to timeout the SMTP command.
27078 For example, these settings have been used successfully at the site which
27079 first suggested this feature, for controlling mail from their customers:
27081 <literallayout class="monospaced">
27082 smtp_ratelimit_mail = 2,0.5s,1.05,4m
27083 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
27086 The first setting specifies delays that are applied to MAIL commands after
27087 two have been received over a single connection. The initial delay is 0.5
27088 seconds, increasing by a factor of 1.05 each time. The second setting applies
27089 delays to RCPT commands when more than four occur in a single message.
27092 <indexterm role="option">
27093 <primary><option>smtp_ratelimit_mail</option></primary>
27096 <informaltable frame="all">
27097 <tgroup cols="4" colsep="0" rowsep="0">
27098 <colspec colwidth="8*" align="left"/>
27099 <colspec colwidth="6*" align="center"/>
27100 <colspec colwidth="6*" align="center"/>
27101 <colspec colwidth="6*" align="right"/>
27104 <entry><option>smtp_ratelimit_mail</option></entry>
27105 <entry>Use: <emphasis>main</emphasis></entry>
27106 <entry>Type: <emphasis>string</emphasis></entry>
27107 <entry>Default: <emphasis>unset</emphasis></entry>
27113 See <option>smtp_ratelimit_hosts</option> above.
27116 <indexterm role="option">
27117 <primary><option>smtp_ratelimit_rcpt</option></primary>
27120 <informaltable frame="all">
27121 <tgroup cols="4" colsep="0" rowsep="0">
27122 <colspec colwidth="8*" align="left"/>
27123 <colspec colwidth="6*" align="center"/>
27124 <colspec colwidth="6*" align="center"/>
27125 <colspec colwidth="6*" align="right"/>
27128 <entry><option>smtp_ratelimit_rcpt</option></entry>
27129 <entry>Use: <emphasis>main</emphasis></entry>
27130 <entry>Type: <emphasis>string</emphasis></entry>
27131 <entry>Default: <emphasis>unset</emphasis></entry>
27137 See <option>smtp_ratelimit_hosts</option> above.
27140 <indexterm role="option">
27141 <primary><option>smtp_receive_timeout</option></primary>
27144 <informaltable frame="all">
27145 <tgroup cols="4" colsep="0" rowsep="0">
27146 <colspec colwidth="8*" align="left"/>
27147 <colspec colwidth="6*" align="center"/>
27148 <colspec colwidth="6*" align="center"/>
27149 <colspec colwidth="6*" align="right"/>
27152 <entry><option>smtp_receive_timeout</option></entry>
27153 <entry>Use: <emphasis>main</emphasis></entry>
27154 <entry>Type: <emphasis>time</emphasis></entry>
27155 <entry>Default: <emphasis>5m</emphasis></entry>
27161 <indexterm role="concept">
27162 <primary>timeout</primary>
27163 <secondary>for SMTP input</secondary>
27165 <indexterm role="concept">
27166 <primary>SMTP</primary>
27167 <secondary>input timeout</secondary>
27169 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
27170 input, including batch SMTP. If a line of input (either an SMTP command or a
27171 data line) is not received within this time, the SMTP connection is dropped and
27172 the message is abandoned.
27173 A line is written to the log containing one of the following messages:
27175 <literallayout class="monospaced">
27176 SMTP command timeout on connection from...
27177 SMTP data timeout on connection from...
27180 The former means that Exim was expecting to read an SMTP command; the latter
27181 means that it was in the DATA phase, reading the contents of a message.
27184 <indexterm role="option">
27185 <primary><option>-os</option></primary>
27187 The value set by this option can be overridden by the
27188 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
27189 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
27190 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
27191 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
27194 <indexterm role="option">
27195 <primary><option>smtp_reserve_hosts</option></primary>
27198 <informaltable frame="all">
27199 <tgroup cols="4" colsep="0" rowsep="0">
27200 <colspec colwidth="8*" align="left"/>
27201 <colspec colwidth="6*" align="center"/>
27202 <colspec colwidth="6*" align="center"/>
27203 <colspec colwidth="6*" align="right"/>
27206 <entry><option>smtp_reserve_hosts</option></entry>
27207 <entry>Use: <emphasis>main</emphasis></entry>
27208 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
27209 <entry>Default: <emphasis>unset</emphasis></entry>
27215 This option defines hosts for which SMTP connections are reserved; see
27216 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
27219 <indexterm role="option">
27220 <primary><option>smtp_return_error_details</option></primary>
27223 <informaltable frame="all">
27224 <tgroup cols="4" colsep="0" rowsep="0">
27225 <colspec colwidth="8*" align="left"/>
27226 <colspec colwidth="6*" align="center"/>
27227 <colspec colwidth="6*" align="center"/>
27228 <colspec colwidth="6*" align="right"/>
27231 <entry><option>smtp_return_error_details</option></entry>
27232 <entry>Use: <emphasis>main</emphasis></entry>
27233 <entry>Type: <emphasis>boolean</emphasis></entry>
27234 <entry>Default: <emphasis>false</emphasis></entry>
27240 <indexterm role="concept">
27241 <primary>SMTP</primary>
27242 <secondary>details policy failures</secondary>
27244 <indexterm role="concept">
27245 <primary>policy control</primary>
27246 <secondary>rejection, returning details</secondary>
27248 In the default state, Exim uses bland messages such as
27249 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
27250 reasons. Many sysadmins like this because it gives away little information
27251 to spammers. However, some other sysadmins who are applying strict checking
27252 policies want to give out much fuller information about failures. Setting
27253 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
27254 example, instead of <quote>Administrative prohibition</quote>, it might give:
27256 <literallayout class="monospaced">
27257 550-Rejected after DATA: '>' missing at end of address:
27258 550 failing address in "From" header is: <user@dom.ain
27261 <indexterm role="option">
27262 <primary><option>spamd_address</option></primary>
27265 <informaltable frame="all">
27266 <tgroup cols="4" colsep="0" rowsep="0">
27267 <colspec colwidth="8*" align="left"/>
27268 <colspec colwidth="6*" align="center"/>
27269 <colspec colwidth="6*" align="center"/>
27270 <colspec colwidth="6*" align="right"/>
27273 <entry><option>spamd_address</option></entry>
27274 <entry>Use: <emphasis>main</emphasis></entry>
27275 <entry>Type: <emphasis>string</emphasis></entry>
27276 <entry>Default: <emphasis>see below</emphasis></entry>
27282 This option is available when Exim is compiled with the content-scanning
27283 extension. It specifies how Exim connects to SpamAssassin’s <option>spamd</option> daemon.
27284 The default value is
27286 <literallayout class="monospaced">
27290 See section <xref linkend="SECTscanspamass"/> for more details.
27293 <indexterm role="option">
27294 <primary><option>split_spool_directory</option></primary>
27297 <informaltable frame="all">
27298 <tgroup cols="4" colsep="0" rowsep="0">
27299 <colspec colwidth="8*" align="left"/>
27300 <colspec colwidth="6*" align="center"/>
27301 <colspec colwidth="6*" align="center"/>
27302 <colspec colwidth="6*" align="right"/>
27305 <entry><option>split_spool_directory</option></entry>
27306 <entry>Use: <emphasis>main</emphasis></entry>
27307 <entry>Type: <emphasis>boolean</emphasis></entry>
27308 <entry>Default: <emphasis>false</emphasis></entry>
27314 <indexterm role="concept">
27315 <primary>multiple spool directories</primary>
27317 <indexterm role="concept">
27318 <primary>spool directory</primary>
27319 <secondary>split</secondary>
27321 <indexterm role="concept">
27322 <primary>directories, multiple</primary>
27324 If this option is set, it causes Exim to split its input directory into 62
27325 subdirectories, each with a single alphanumeric character as its name. The
27326 sixth character of the message id is used to allocate messages to
27327 subdirectories; this is the least significant base-62 digit of the time of
27328 arrival of the message.
27331 Splitting up the spool in this way may provide better performance on systems
27332 where there are long mail queues, by reducing the number of files in any one
27333 directory. The msglog directory is also split up in a similar way to the input
27334 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
27335 are still placed in the single directory <filename>msglog.OLD</filename>.
27338 It is not necessary to take any special action for existing messages when
27339 changing <option>split_spool_directory</option>. Exim notices messages that are in the
27340 <quote>wrong</quote> place, and continues to process them. If the option is turned off
27341 after a period of being on, the subdirectories will eventually empty and be
27342 automatically deleted.
27345 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
27346 changes. Instead of creating a list of all messages in the queue, and then
27347 trying to deliver each one in turn, it constructs a list of those in one
27348 sub-directory and tries to deliver them, before moving on to the next
27349 sub-directory. The sub-directories are processed in a random order. This
27350 spreads out the scanning of the input directories, and uses less memory. It is
27351 particularly beneficial when there are lots of messages on the queue. However,
27352 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
27353 entire queue has to be scanned and sorted before any deliveries can start.
27356 <indexterm role="option">
27357 <primary><option>spool_directory</option></primary>
27360 <informaltable frame="all">
27361 <tgroup cols="4" colsep="0" rowsep="0">
27362 <colspec colwidth="8*" align="left"/>
27363 <colspec colwidth="6*" align="center"/>
27364 <colspec colwidth="6*" align="center"/>
27365 <colspec colwidth="6*" align="right"/>
27368 <entry><option>spool_directory</option></entry>
27369 <entry>Use: <emphasis>main</emphasis></entry>
27370 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27371 <entry>Default: <emphasis>set at compile time</emphasis></entry>
27377 <indexterm role="concept">
27378 <primary>spool directory</primary>
27379 <secondary>path to</secondary>
27381 This defines the directory in which Exim keeps its spool, that is, the messages
27382 it is waiting to deliver. The default value is taken from the compile-time
27383 configuration setting, if there is one. If not, this option must be set. The
27384 string is expanded, so it can contain, for example, a reference to
27385 <varname>$primary_hostname</varname>.
27388 If the spool directory name is fixed on your installation, it is recommended
27389 that you set it at build time rather than from this option, particularly if the
27390 log files are being written to the spool directory (see <option>log_file_path</option>).
27391 Otherwise log files cannot be used for errors that are detected early on, such
27392 as failures in the configuration file.
27395 By using this option to override the compiled-in path, it is possible to run
27396 tests of Exim without using the standard spool.
27399 <indexterm role="option">
27400 <primary><option>sqlite_lock_timeout</option></primary>
27403 <informaltable frame="all">
27404 <tgroup cols="4" colsep="0" rowsep="0">
27405 <colspec colwidth="8*" align="left"/>
27406 <colspec colwidth="6*" align="center"/>
27407 <colspec colwidth="6*" align="center"/>
27408 <colspec colwidth="6*" align="right"/>
27411 <entry><option>sqlite_lock_timeout</option></entry>
27412 <entry>Use: <emphasis>main</emphasis></entry>
27413 <entry>Type: <emphasis>time</emphasis></entry>
27414 <entry>Default: <emphasis>5s</emphasis></entry>
27420 <indexterm role="concept">
27421 <primary>sqlite lookup type</primary>
27422 <secondary>lock timeout</secondary>
27424 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
27425 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
27428 <indexterm role="option">
27429 <primary><option>strict_acl_vars</option></primary>
27432 <informaltable frame="all">
27433 <tgroup cols="4" colsep="0" rowsep="0">
27434 <colspec colwidth="8*" align="left"/>
27435 <colspec colwidth="6*" align="center"/>
27436 <colspec colwidth="6*" align="center"/>
27437 <colspec colwidth="6*" align="right"/>
27440 <entry><option>strict_acl_vars</option></entry>
27441 <entry>Use: <emphasis>main</emphasis></entry>
27442 <entry>Type: <emphasis>boolean</emphasis></entry>
27443 <entry>Default: <emphasis>false</emphasis></entry>
27449 <indexterm role="concept">
27450 <primary>access control lists (ACLs)</primary>
27451 <secondary>variables, handling unset</secondary>
27453 This option controls what happens if a syntactically valid but undefined ACL
27454 variable is referenced. If it is false (the default), an empty string
27455 is substituted; if it is true, an error is generated. See section
27456 <xref linkend="SECTaclvariables"/> for details of ACL variables.
27459 <indexterm role="option">
27460 <primary><option>strip_excess_angle_brackets</option></primary>
27463 <informaltable frame="all">
27464 <tgroup cols="4" colsep="0" rowsep="0">
27465 <colspec colwidth="8*" align="left"/>
27466 <colspec colwidth="6*" align="center"/>
27467 <colspec colwidth="6*" align="center"/>
27468 <colspec colwidth="6*" align="right"/>
27471 <entry><option>strip_excess_angle_brackets</option></entry>
27472 <entry>Use: <emphasis>main</emphasis></entry>
27473 <entry>Type: <emphasis>boolean</emphasis></entry>
27474 <entry>Default: <emphasis>false</emphasis></entry>
27480 <indexterm role="concept">
27481 <primary>angle brackets, excess</primary>
27483 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
27484 items in addresses are stripped. For example, <emphasis><<xxx@a.b.c.d>></emphasis> is
27485 treated as <emphasis><xxx@a.b.c.d></emphasis>. If this is in the envelope and the message is
27486 passed on to another MTA, the excess angle brackets are not passed on. If this
27487 option is not set, multiple pairs of angle brackets cause a syntax error.
27490 <indexterm role="option">
27491 <primary><option>strip_trailing_dot</option></primary>
27494 <informaltable frame="all">
27495 <tgroup cols="4" colsep="0" rowsep="0">
27496 <colspec colwidth="8*" align="left"/>
27497 <colspec colwidth="6*" align="center"/>
27498 <colspec colwidth="6*" align="center"/>
27499 <colspec colwidth="6*" align="right"/>
27502 <entry><option>strip_trailing_dot</option></entry>
27503 <entry>Use: <emphasis>main</emphasis></entry>
27504 <entry>Type: <emphasis>boolean</emphasis></entry>
27505 <entry>Default: <emphasis>false</emphasis></entry>
27511 <indexterm role="concept">
27512 <primary>trailing dot on domain</primary>
27514 <indexterm role="concept">
27515 <primary>dot</primary>
27516 <secondary>trailing on domain</secondary>
27518 If this option is set, a trailing dot at the end of a domain in an address is
27519 ignored. If this is in the envelope and the message is passed on to another
27520 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
27521 domain causes a syntax error.
27522 However, addresses in header lines are checked only when an ACL requests header
27526 <indexterm role="option">
27527 <primary><option>syslog_duplication</option></primary>
27530 <informaltable frame="all">
27531 <tgroup cols="4" colsep="0" rowsep="0">
27532 <colspec colwidth="8*" align="left"/>
27533 <colspec colwidth="6*" align="center"/>
27534 <colspec colwidth="6*" align="center"/>
27535 <colspec colwidth="6*" align="right"/>
27538 <entry><option>syslog_duplication</option></entry>
27539 <entry>Use: <emphasis>main</emphasis></entry>
27540 <entry>Type: <emphasis>boolean</emphasis></entry>
27541 <entry>Default: <emphasis>true</emphasis></entry>
27547 <indexterm role="concept">
27548 <primary>syslog</primary>
27549 <secondary>duplicate log lines; suppressing</secondary>
27551 When Exim is logging to syslog, it writes the log lines for its three
27552 separate logs at different syslog priorities so that they can in principle
27553 be separated on the logging hosts. Some installations do not require this
27554 separation, and in those cases, the duplication of certain log lines is a
27555 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
27556 particular log line is written to syslog. For lines that normally go to
27557 both the main log and the reject log, the reject log version (possibly
27558 containing message header lines) is written, at LOG_NOTICE priority.
27559 Lines that normally go to both the main and the panic log are written at
27560 the LOG_ALERT priority.
27563 <indexterm role="option">
27564 <primary><option>syslog_facility</option></primary>
27567 <informaltable frame="all">
27568 <tgroup cols="4" colsep="0" rowsep="0">
27569 <colspec colwidth="8*" align="left"/>
27570 <colspec colwidth="6*" align="center"/>
27571 <colspec colwidth="6*" align="center"/>
27572 <colspec colwidth="6*" align="right"/>
27575 <entry><option>syslog_facility</option></entry>
27576 <entry>Use: <emphasis>main</emphasis></entry>
27577 <entry>Type: <emphasis>string</emphasis></entry>
27578 <entry>Default: <emphasis>unset</emphasis></entry>
27584 <indexterm role="concept">
27585 <primary>syslog</primary>
27586 <secondary>facility; setting</secondary>
27588 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
27589 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
27590 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
27591 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
27592 details of Exim’s logging.
27595 <indexterm role="option">
27596 <primary><option>syslog_processname</option></primary>
27599 <informaltable frame="all">
27600 <tgroup cols="4" colsep="0" rowsep="0">
27601 <colspec colwidth="8*" align="left"/>
27602 <colspec colwidth="6*" align="center"/>
27603 <colspec colwidth="6*" align="center"/>
27604 <colspec colwidth="6*" align="right"/>
27607 <entry><option>syslog_processname</option></entry>
27608 <entry>Use: <emphasis>main</emphasis></entry>
27609 <entry>Type: <emphasis>string</emphasis></entry>
27610 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
27616 <indexterm role="concept">
27617 <primary>syslog</primary>
27618 <secondary>process name; setting</secondary>
27620 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
27621 syslog. The value must be no longer than 32 characters. See chapter
27622 <xref linkend="CHAPlog"/> for details of Exim’s logging.
27625 <indexterm role="option">
27626 <primary><option>syslog_timestamp</option></primary>
27629 <informaltable frame="all">
27630 <tgroup cols="4" colsep="0" rowsep="0">
27631 <colspec colwidth="8*" align="left"/>
27632 <colspec colwidth="6*" align="center"/>
27633 <colspec colwidth="6*" align="center"/>
27634 <colspec colwidth="6*" align="right"/>
27637 <entry><option>syslog_timestamp</option></entry>
27638 <entry>Use: <emphasis>main</emphasis></entry>
27639 <entry>Type: <emphasis>boolean</emphasis></entry>
27640 <entry>Default: <emphasis>true</emphasis></entry>
27646 <indexterm role="concept">
27647 <primary>syslog</primary>
27648 <secondary>timestamps</secondary>
27650 If <option>syslog_timestamp</option> is set false, the timestamps on Exim’s log lines are
27651 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
27652 details of Exim’s logging.
27655 <indexterm role="option">
27656 <primary><option>system_filter</option></primary>
27659 <informaltable frame="all">
27660 <tgroup cols="4" colsep="0" rowsep="0">
27661 <colspec colwidth="8*" align="left"/>
27662 <colspec colwidth="6*" align="center"/>
27663 <colspec colwidth="6*" align="center"/>
27664 <colspec colwidth="6*" align="right"/>
27667 <entry><option>system_filter</option></entry>
27668 <entry>Use: <emphasis>main</emphasis></entry>
27669 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27670 <entry>Default: <emphasis>unset</emphasis></entry>
27676 <indexterm role="concept">
27677 <primary>filter</primary>
27678 <secondary>system filter</secondary>
27680 <indexterm role="concept">
27681 <primary>system filter</primary>
27682 <secondary>specifying</secondary>
27684 <indexterm role="concept">
27685 <primary>Sieve filter</primary>
27686 <secondary>not available for system filter</secondary>
27688 This option specifies an Exim filter file that is applied to all messages at
27689 the start of each delivery attempt, before any routing is done. System filters
27690 must be Exim filters; they cannot be Sieve filters. If the system filter
27691 generates any deliveries to files or pipes, or any new mail messages, the
27692 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
27693 which transports are to be used. Details of this facility are given in chapter
27694 <xref linkend="CHAPsystemfilter"/>.
27697 <indexterm role="option">
27698 <primary><option>system_filter_directory_transport</option></primary>
27701 <informaltable frame="all">
27702 <tgroup cols="4" colsep="0" rowsep="0">
27703 <colspec colwidth="8*" align="left"/>
27704 <colspec colwidth="6*" align="center"/>
27705 <colspec colwidth="6*" align="center"/>
27706 <colspec colwidth="6*" align="right"/>
27709 <entry><option>system_filter_directory_transport</option></entry>
27710 <entry>Use: <emphasis>main</emphasis></entry>
27711 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27712 <entry>Default: <emphasis>unset</emphasis></entry>
27718 <indexterm role="variable">
27719 <primary><varname>$address_file</varname></primary>
27721 This sets the name of the transport driver that is to be used when the
27722 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
27723 implying delivery of each message into a separate file in some directory.
27724 During the delivery, the variable <varname>$address_file</varname> contains the path name.
27727 <indexterm role="option">
27728 <primary><option>system_filter_file_transport</option></primary>
27731 <informaltable frame="all">
27732 <tgroup cols="4" colsep="0" rowsep="0">
27733 <colspec colwidth="8*" align="left"/>
27734 <colspec colwidth="6*" align="center"/>
27735 <colspec colwidth="6*" align="center"/>
27736 <colspec colwidth="6*" align="right"/>
27739 <entry><option>system_filter_file_transport</option></entry>
27740 <entry>Use: <emphasis>main</emphasis></entry>
27741 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27742 <entry>Default: <emphasis>unset</emphasis></entry>
27748 <indexterm role="concept">
27749 <primary>file</primary>
27750 <secondary>transport for system filter</secondary>
27752 This sets the name of the transport driver that is to be used when the <option>save</option>
27753 command in a system message filter specifies a path not ending in <quote>/</quote>. During
27754 the delivery, the variable <varname>$address_file</varname> contains the path name.
27757 <indexterm role="option">
27758 <primary><option>system_filter_group</option></primary>
27761 <informaltable frame="all">
27762 <tgroup cols="4" colsep="0" rowsep="0">
27763 <colspec colwidth="8*" align="left"/>
27764 <colspec colwidth="6*" align="center"/>
27765 <colspec colwidth="6*" align="center"/>
27766 <colspec colwidth="6*" align="right"/>
27769 <entry><option>system_filter_group</option></entry>
27770 <entry>Use: <emphasis>main</emphasis></entry>
27771 <entry>Type: <emphasis>string</emphasis></entry>
27772 <entry>Default: <emphasis>unset</emphasis></entry>
27778 <indexterm role="concept">
27779 <primary>gid (group id)</primary>
27780 <secondary>system filter</secondary>
27782 This option is used only when <option>system_filter_user</option> is also set. It sets the
27783 gid under which the system filter is run, overriding any gid that is associated
27784 with the user. The value may be numerical or symbolic.
27787 <indexterm role="option">
27788 <primary><option>system_filter_pipe_transport</option></primary>
27791 <informaltable frame="all">
27792 <tgroup cols="4" colsep="0" rowsep="0">
27793 <colspec colwidth="8*" align="left"/>
27794 <colspec colwidth="6*" align="center"/>
27795 <colspec colwidth="6*" align="center"/>
27796 <colspec colwidth="6*" align="right"/>
27799 <entry><option>system_filter_pipe_transport</option></entry>
27800 <entry>Use: <emphasis>main</emphasis></entry>
27801 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27802 <entry>Default: <emphasis>unset</emphasis></entry>
27808 <indexterm role="concept">
27809 <primary><command>pipe</command> transport</primary>
27810 <secondary>for system filter</secondary>
27812 <indexterm role="variable">
27813 <primary><varname>$address_pipe</varname></primary>
27815 This specifies the transport driver that is to be used when a <option>pipe</option> command
27816 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
27817 contains the pipe command.
27820 <indexterm role="option">
27821 <primary><option>system_filter_reply_transport</option></primary>
27824 <informaltable frame="all">
27825 <tgroup cols="4" colsep="0" rowsep="0">
27826 <colspec colwidth="8*" align="left"/>
27827 <colspec colwidth="6*" align="center"/>
27828 <colspec colwidth="6*" align="center"/>
27829 <colspec colwidth="6*" align="right"/>
27832 <entry><option>system_filter_reply_transport</option></entry>
27833 <entry>Use: <emphasis>main</emphasis></entry>
27834 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
27835 <entry>Default: <emphasis>unset</emphasis></entry>
27841 <indexterm role="concept">
27842 <primary><command>autoreply</command> transport</primary>
27843 <secondary>for system filter</secondary>
27845 This specifies the transport driver that is to be used when a <option>mail</option> command
27846 is used in a system filter.
27848 <para revisionflag="changed">
27849 <indexterm role="option">
27850 <primary><option>system_filter_user</option></primary>
27853 <informaltable frame="all" revisionflag="changed">
27854 <tgroup cols="4" colsep="0" rowsep="0">
27855 <colspec colwidth="8*" align="left"/>
27856 <colspec colwidth="6*" align="center"/>
27857 <colspec colwidth="6*" align="center"/>
27858 <colspec colwidth="6*" align="right"/>
27861 <entry><option>system_filter_user</option></entry>
27862 <entry>Use: <emphasis>main</emphasis></entry>
27863 <entry>Type: <emphasis>string</emphasis></entry>
27864 <entry>Default: <emphasis>unset</emphasis></entry>
27869 <para revisionflag="changed">
27870 <indexterm role="concept">
27871 <primary>uid (user id)</primary>
27872 <secondary>system filter</secondary>
27874 If this option is set to root, the system filter is run in the main Exim
27875 delivery process, as root. Otherwise, the system filter runs in a separate
27876 process, as the given user, defaulting to the Exim run-time user.
27877 Unless the string consists entirely of digits, it
27878 is looked up in the password data. Failure to find the named user causes a
27879 configuration error. The gid is either taken from the password data, or
27880 specified by <option>system_filter_group</option>. When the uid is specified numerically,
27881 <option>system_filter_group</option> is required to be set.
27883 <para revisionflag="changed">
27884 If the system filter generates any pipe, file, or reply deliveries, the uid
27885 under which the filter is run is used when transporting them, unless a
27886 transport option overrides.
27889 <indexterm role="option">
27890 <primary><option>tcp_nodelay</option></primary>
27893 <informaltable frame="all">
27894 <tgroup cols="4" colsep="0" rowsep="0">
27895 <colspec colwidth="8*" align="left"/>
27896 <colspec colwidth="6*" align="center"/>
27897 <colspec colwidth="6*" align="center"/>
27898 <colspec colwidth="6*" align="right"/>
27901 <entry><option>tcp_nodelay</option></entry>
27902 <entry>Use: <emphasis>main</emphasis></entry>
27903 <entry>Type: <emphasis>boolean</emphasis></entry>
27904 <entry>Default: <emphasis>true</emphasis></entry>
27910 <indexterm role="concept">
27911 <primary>daemon</primary>
27912 <secondary>TCP_NODELAY on sockets</secondary>
27914 <indexterm role="concept">
27915 <primary>Nagle algorithm</primary>
27917 <indexterm role="concept">
27918 <primary>TCP_NODELAY on listening sockets</primary>
27920 If this option is set false, it stops the Exim daemon setting the
27921 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
27922 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
27923 performance in interactive (character-by-character) situations. Turning it off
27924 should improve Exim’s performance a bit, so that is what happens by default.
27925 However, it appears that some broken clients cannot cope, and time out. Hence
27926 this option. It affects only those sockets that are set up for listening by the
27927 daemon. Sockets created by the smtp transport for delivering mail always set
27931 <indexterm role="option">
27932 <primary><option>timeout_frozen_after</option></primary>
27935 <informaltable frame="all">
27936 <tgroup cols="4" colsep="0" rowsep="0">
27937 <colspec colwidth="8*" align="left"/>
27938 <colspec colwidth="6*" align="center"/>
27939 <colspec colwidth="6*" align="center"/>
27940 <colspec colwidth="6*" align="right"/>
27943 <entry><option>timeout_frozen_after</option></entry>
27944 <entry>Use: <emphasis>main</emphasis></entry>
27945 <entry>Type: <emphasis>time</emphasis></entry>
27946 <entry>Default: <emphasis>0s</emphasis></entry>
27952 <indexterm role="concept">
27953 <primary>frozen messages</primary>
27954 <secondary>timing out</secondary>
27956 <indexterm role="concept">
27957 <primary>timeout</primary>
27958 <secondary>frozen messages</secondary>
27960 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
27961 message of any kind that has been on the queue for longer than the given time
27962 is automatically cancelled at the next queue run. If the frozen message is a
27963 bounce message, it is just discarded; otherwise, a bounce is sent to the
27964 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
27965 If you want to timeout frozen bounce messages earlier than other kinds of
27966 frozen message, see <option>ignore_bounce_errors_after</option>.
27969 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
27970 frozen messages remain on the queue forever (except for any frozen bounce
27971 messages that are released by <option>ignore_bounce_errors_after</option>).
27974 <indexterm role="option">
27975 <primary><option>timezone</option></primary>
27978 <informaltable frame="all">
27979 <tgroup cols="4" colsep="0" rowsep="0">
27980 <colspec colwidth="8*" align="left"/>
27981 <colspec colwidth="6*" align="center"/>
27982 <colspec colwidth="6*" align="center"/>
27983 <colspec colwidth="6*" align="right"/>
27986 <entry><option>timezone</option></entry>
27987 <entry>Use: <emphasis>main</emphasis></entry>
27988 <entry>Type: <emphasis>string</emphasis></entry>
27989 <entry>Default: <emphasis>unset</emphasis></entry>
27995 <indexterm role="concept">
27996 <primary>timezone, setting</primary>
27998 The value of <option>timezone</option> is used to set the environment variable TZ while
27999 running Exim (if it is different on entry). This ensures that all timestamps
28000 created by Exim are in the required timezone. If you want all your timestamps
28001 to be in UTC (aka GMT) you should set
28003 <literallayout class="monospaced">
28007 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
28008 or, if that is not set, from the value of the TZ environment variable when Exim
28009 is built. If <option>timezone</option> is set to the empty string, either at build or run
28010 time, any existing TZ variable is removed from the environment when Exim
28011 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
28012 unfortunately not all, operating systems.
28015 <indexterm role="option">
28016 <primary><option>tls_advertise_hosts</option></primary>
28019 <informaltable frame="all">
28020 <tgroup cols="4" colsep="0" rowsep="0">
28021 <colspec colwidth="8*" align="left"/>
28022 <colspec colwidth="6*" align="center"/>
28023 <colspec colwidth="6*" align="center"/>
28024 <colspec colwidth="6*" align="right"/>
28027 <entry><option>tls_advertise_hosts</option></entry>
28028 <entry>Use: <emphasis>main</emphasis></entry>
28029 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28030 <entry>Default: <emphasis>unset</emphasis></entry>
28036 <indexterm role="concept">
28037 <primary>TLS</primary>
28038 <secondary>advertising</secondary>
28040 <indexterm role="concept">
28041 <primary>encryption</primary>
28042 <secondary>on SMTP connection</secondary>
28044 <indexterm role="concept">
28045 <primary>SMTP</primary>
28046 <secondary>encrypted connection</secondary>
28048 When Exim is built with support for TLS encrypted connections, the availability
28049 of the STARTTLS command to set up an encrypted session is advertised in
28050 response to EHLO only to those client hosts that match this option. See
28051 chapter <xref linkend="CHAPTLS"/> for details of Exim’s support for TLS.
28054 <indexterm role="option">
28055 <primary><option>tls_certificate</option></primary>
28058 <informaltable frame="all">
28059 <tgroup cols="4" colsep="0" rowsep="0">
28060 <colspec colwidth="8*" align="left"/>
28061 <colspec colwidth="6*" align="center"/>
28062 <colspec colwidth="6*" align="center"/>
28063 <colspec colwidth="6*" align="right"/>
28066 <entry><option>tls_certificate</option></entry>
28067 <entry>Use: <emphasis>main</emphasis></entry>
28068 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28069 <entry>Default: <emphasis>unset</emphasis></entry>
28075 <indexterm role="concept">
28076 <primary>TLS</primary>
28077 <secondary>server certificate; location of</secondary>
28079 <indexterm role="concept">
28080 <primary>certificate</primary>
28081 <secondary>server, location of</secondary>
28083 The value of this option is expanded, and must then be the absolute path to a
28084 file which contains the server’s certificates. The server’s private key is also
28085 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
28086 <xref linkend="CHAPTLS"/> for further details.
28089 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
28090 receiving incoming messages as a server. If you want to supply certificates for
28091 use when sending messages as a client, you must set the <option>tls_certificate</option>
28092 option in the relevant <command>smtp</command> transport.
28095 <indexterm role="option">
28096 <primary><option>tls_crl</option></primary>
28099 <informaltable frame="all">
28100 <tgroup cols="4" colsep="0" rowsep="0">
28101 <colspec colwidth="8*" align="left"/>
28102 <colspec colwidth="6*" align="center"/>
28103 <colspec colwidth="6*" align="center"/>
28104 <colspec colwidth="6*" align="right"/>
28107 <entry><option>tls_crl</option></entry>
28108 <entry>Use: <emphasis>main</emphasis></entry>
28109 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28110 <entry>Default: <emphasis>unset</emphasis></entry>
28116 <indexterm role="concept">
28117 <primary>TLS</primary>
28118 <secondary>server certificate revocation list</secondary>
28120 <indexterm role="concept">
28121 <primary>certificate</primary>
28122 <secondary>revocation list for server</secondary>
28124 This option specifies a certificate revocation list. The expanded value must
28125 be the name of a file that contains a CRL in PEM format.
28128 <indexterm role="option">
28129 <primary><option>tls_dhparam</option></primary>
28132 <informaltable frame="all">
28133 <tgroup cols="4" colsep="0" rowsep="0">
28134 <colspec colwidth="8*" align="left"/>
28135 <colspec colwidth="6*" align="center"/>
28136 <colspec colwidth="6*" align="center"/>
28137 <colspec colwidth="6*" align="right"/>
28140 <entry><option>tls_dhparam</option></entry>
28141 <entry>Use: <emphasis>main</emphasis></entry>
28142 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28143 <entry>Default: <emphasis>unset</emphasis></entry>
28149 <indexterm role="concept">
28150 <primary>TLS</primary>
28151 <secondary>D-H parameters for server</secondary>
28153 The value of this option is expanded, and must then be the absolute path to
28154 a file which contains the server’s DH parameter values.
28155 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
28156 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
28159 <indexterm role="option">
28160 <primary><option>tls_on_connect_ports</option></primary>
28163 <informaltable frame="all">
28164 <tgroup cols="4" colsep="0" rowsep="0">
28165 <colspec colwidth="8*" align="left"/>
28166 <colspec colwidth="6*" align="center"/>
28167 <colspec colwidth="6*" align="center"/>
28168 <colspec colwidth="6*" align="right"/>
28171 <entry><option>tls_on_connect_ports</option></entry>
28172 <entry>Use: <emphasis>main</emphasis></entry>
28173 <entry>Type: <emphasis>string list</emphasis></entry>
28174 <entry>Default: <emphasis>unset</emphasis></entry>
28180 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
28181 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
28182 set up without waiting for the client to issue a STARTTLS command. For
28183 further details, see section <xref linkend="SECTsupobssmt"/>.
28186 <indexterm role="option">
28187 <primary><option>tls_privatekey</option></primary>
28190 <informaltable frame="all">
28191 <tgroup cols="4" colsep="0" rowsep="0">
28192 <colspec colwidth="8*" align="left"/>
28193 <colspec colwidth="6*" align="center"/>
28194 <colspec colwidth="6*" align="center"/>
28195 <colspec colwidth="6*" align="right"/>
28198 <entry><option>tls_privatekey</option></entry>
28199 <entry>Use: <emphasis>main</emphasis></entry>
28200 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28201 <entry>Default: <emphasis>unset</emphasis></entry>
28207 <indexterm role="concept">
28208 <primary>TLS</primary>
28209 <secondary>server private key; location of</secondary>
28211 The value of this option is expanded, and must then be the absolute path to a
28212 file which contains the server’s private key. If this option is unset, or if
28213 the expansion is forced to fail, or the result is an empty string, the private
28214 key is assumed to be in the same file as the server’s certificates. See chapter
28215 <xref linkend="CHAPTLS"/> for further details.
28218 <indexterm role="option">
28219 <primary><option>tls_remember_esmtp</option></primary>
28222 <informaltable frame="all">
28223 <tgroup cols="4" colsep="0" rowsep="0">
28224 <colspec colwidth="8*" align="left"/>
28225 <colspec colwidth="6*" align="center"/>
28226 <colspec colwidth="6*" align="center"/>
28227 <colspec colwidth="6*" align="right"/>
28230 <entry><option>tls_remember_esmtp</option></entry>
28231 <entry>Use: <emphasis>main</emphasis></entry>
28232 <entry>Type: <emphasis>boolean</emphasis></entry>
28233 <entry>Default: <emphasis>false</emphasis></entry>
28239 <indexterm role="concept">
28240 <primary>TLS</primary>
28241 <secondary>esmtp state; remembering</secondary>
28243 <indexterm role="concept">
28244 <primary>TLS</primary>
28245 <secondary>broken clients</secondary>
28247 If this option is set true, Exim violates the RFCs by remembering that it is in
28248 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
28249 support for broken clients that fail to send a new EHLO after starting a
28253 <indexterm role="option">
28254 <primary><option>tls_require_ciphers</option></primary>
28257 <informaltable frame="all">
28258 <tgroup cols="4" colsep="0" rowsep="0">
28259 <colspec colwidth="8*" align="left"/>
28260 <colspec colwidth="6*" align="center"/>
28261 <colspec colwidth="6*" align="center"/>
28262 <colspec colwidth="6*" align="right"/>
28265 <entry><option>tls_require_ciphers</option></entry>
28266 <entry>Use: <emphasis>main</emphasis></entry>
28267 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28268 <entry>Default: <emphasis>unset</emphasis></entry>
28274 <indexterm role="concept">
28275 <primary>TLS</primary>
28276 <secondary>requiring specific ciphers</secondary>
28278 <indexterm role="concept">
28279 <primary>cipher</primary>
28280 <secondary>requiring specific</secondary>
28282 This option controls which ciphers can be used for incoming TLS connections.
28283 The <command>smtp</command> transport has an option of the same name for controlling outgoing
28284 connections. This option is expanded for each connection, so can be varied for
28285 different clients if required. The value of this option must be a list of
28286 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
28287 in somewhat different ways. If GnuTLS is being used, the client controls the
28288 preference order of the available ciphers. Details are given in sections
28289 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
28292 <indexterm role="option">
28293 <primary><option>tls_try_verify_hosts</option></primary>
28296 <informaltable frame="all">
28297 <tgroup cols="4" colsep="0" rowsep="0">
28298 <colspec colwidth="8*" align="left"/>
28299 <colspec colwidth="6*" align="center"/>
28300 <colspec colwidth="6*" align="center"/>
28301 <colspec colwidth="6*" align="right"/>
28304 <entry><option>tls_try_verify_hosts</option></entry>
28305 <entry>Use: <emphasis>main</emphasis></entry>
28306 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28307 <entry>Default: <emphasis>unset</emphasis></entry>
28313 <indexterm role="concept">
28314 <primary>TLS</primary>
28315 <secondary>client certificate verification</secondary>
28317 <indexterm role="concept">
28318 <primary>certificate</primary>
28319 <secondary>verification of client</secondary>
28321 See <option>tls_verify_hosts</option> below.
28324 <indexterm role="option">
28325 <primary><option>tls_verify_certificates</option></primary>
28328 <informaltable frame="all">
28329 <tgroup cols="4" colsep="0" rowsep="0">
28330 <colspec colwidth="8*" align="left"/>
28331 <colspec colwidth="6*" align="center"/>
28332 <colspec colwidth="6*" align="center"/>
28333 <colspec colwidth="6*" align="right"/>
28336 <entry><option>tls_verify_certificates</option></entry>
28337 <entry>Use: <emphasis>main</emphasis></entry>
28338 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28339 <entry>Default: <emphasis>unset</emphasis></entry>
28345 <indexterm role="concept">
28346 <primary>TLS</primary>
28347 <secondary>client certificate verification</secondary>
28349 <indexterm role="concept">
28350 <primary>certificate</primary>
28351 <secondary>verification of client</secondary>
28353 The value of this option is expanded, and must then be the absolute path to
28354 a file containing permitted certificates for clients that
28355 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
28356 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
28357 directory containing certificate files. This does not work with GnuTLS; the
28358 option must be set to the name of a single file if you are using GnuTLS.
28360 <para revisionflag="changed">
28361 These certificates should be for the certificate authorities trusted, rather
28362 than the public cert of individual clients. With both OpenSSL and GnuTLS, if
28363 the value is a file then the certificates are sent by Exim as a server to
28364 connecting clients, defining the list of accepted certificate authorities.
28365 Thus the values defined should be considered public data. To avoid this,
28366 use OpenSSL with a directory.
28369 <indexterm role="option">
28370 <primary><option>tls_verify_hosts</option></primary>
28373 <informaltable frame="all">
28374 <tgroup cols="4" colsep="0" rowsep="0">
28375 <colspec colwidth="8*" align="left"/>
28376 <colspec colwidth="6*" align="center"/>
28377 <colspec colwidth="6*" align="center"/>
28378 <colspec colwidth="6*" align="right"/>
28381 <entry><option>tls_verify_hosts</option></entry>
28382 <entry>Use: <emphasis>main</emphasis></entry>
28383 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
28384 <entry>Default: <emphasis>unset</emphasis></entry>
28390 <indexterm role="concept">
28391 <primary>TLS</primary>
28392 <secondary>client certificate verification</secondary>
28394 <indexterm role="concept">
28395 <primary>certificate</primary>
28396 <secondary>verification of client</secondary>
28398 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
28399 certificates from clients. The expected certificates are defined by
28400 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
28401 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
28402 <option>tls_verify_certificates</option> is not set.
28405 Any client that matches <option>tls_verify_hosts</option> is constrained by
28406 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
28407 present one of the listed certificates. If it does not, the connection is
28408 aborted. <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
28409 the host to use TLS. It can still send SMTP commands through unencrypted
28410 connections. Forcing a client to use TLS has to be done separately using an
28411 ACL to reject inappropriate commands when the connection is not encrypted.
28414 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
28415 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
28416 certificate and checks it against <option>tls_verify_certificates</option>, but does not
28417 abort the connection if there is no certificate or if it does not match. This
28418 state can be detected in an ACL, which makes it possible to implement policies
28419 such as <quote>accept for relay only if a verified certificate has been received,
28420 but accept for local delivery if encrypted, even without a verified
28421 certificate</quote>.
28424 Client hosts that match neither of these lists are not asked to present
28428 <indexterm role="option">
28429 <primary><option>trusted_groups</option></primary>
28432 <informaltable frame="all">
28433 <tgroup cols="4" colsep="0" rowsep="0">
28434 <colspec colwidth="8*" align="left"/>
28435 <colspec colwidth="6*" align="center"/>
28436 <colspec colwidth="6*" align="center"/>
28437 <colspec colwidth="6*" align="right"/>
28440 <entry><option>trusted_groups</option></entry>
28441 <entry>Use: <emphasis>main</emphasis></entry>
28442 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28443 <entry>Default: <emphasis>unset</emphasis></entry>
28449 <indexterm role="concept">
28450 <primary>trusted groups</primary>
28452 <indexterm role="concept">
28453 <primary>groups</primary>
28454 <secondary>trusted</secondary>
28456 This option is expanded just once, at the start of Exim’s processing. If this
28457 option is set, any process that is running in one of the listed groups, or
28458 which has one of them as a supplementary group, is trusted. The groups can be
28459 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
28460 details of what trusted callers are permitted to do. If neither
28461 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
28465 <indexterm role="option">
28466 <primary><option>trusted_users</option></primary>
28469 <informaltable frame="all">
28470 <tgroup cols="4" colsep="0" rowsep="0">
28471 <colspec colwidth="8*" align="left"/>
28472 <colspec colwidth="6*" align="center"/>
28473 <colspec colwidth="6*" align="center"/>
28474 <colspec colwidth="6*" align="right"/>
28477 <entry><option>trusted_users</option></entry>
28478 <entry>Use: <emphasis>main</emphasis></entry>
28479 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
28480 <entry>Default: <emphasis>unset</emphasis></entry>
28486 <indexterm role="concept">
28487 <primary>trusted users</primary>
28489 <indexterm role="concept">
28490 <primary>user</primary>
28491 <secondary>trusted</secondary>
28493 This option is expanded just once, at the start of Exim’s processing. If this
28494 option is set, any process that is running as one of the listed users is
28495 trusted. The users can be specified numerically or by name. See section
28496 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
28497 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
28498 Exim user are trusted.
28501 <indexterm role="option">
28502 <primary><option>unknown_login</option></primary>
28505 <informaltable frame="all">
28506 <tgroup cols="4" colsep="0" rowsep="0">
28507 <colspec colwidth="8*" align="left"/>
28508 <colspec colwidth="6*" align="center"/>
28509 <colspec colwidth="6*" align="center"/>
28510 <colspec colwidth="6*" align="right"/>
28513 <entry><option>unknown_login</option></entry>
28514 <entry>Use: <emphasis>main</emphasis></entry>
28515 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28516 <entry>Default: <emphasis>unset</emphasis></entry>
28522 <indexterm role="concept">
28523 <primary>uid (user id)</primary>
28524 <secondary>unknown caller</secondary>
28526 <indexterm role="variable">
28527 <primary><varname>$caller_uid</varname></primary>
28529 This is a specialized feature for use in unusual configurations. By default, if
28530 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
28531 gives up. The <option>unknown_login</option> option can be used to set a login name to be
28532 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
28533 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
28534 is used for the user’s real name (gecos field), unless this has been set by the
28535 <option>-F</option> option.
28538 <indexterm role="option">
28539 <primary><option>unknown_username</option></primary>
28542 <informaltable frame="all">
28543 <tgroup cols="4" colsep="0" rowsep="0">
28544 <colspec colwidth="8*" align="left"/>
28545 <colspec colwidth="6*" align="center"/>
28546 <colspec colwidth="6*" align="center"/>
28547 <colspec colwidth="6*" align="right"/>
28550 <entry><option>unknown_username</option></entry>
28551 <entry>Use: <emphasis>main</emphasis></entry>
28552 <entry>Type: <emphasis>string</emphasis></entry>
28553 <entry>Default: <emphasis>unset</emphasis></entry>
28559 See <option>unknown_login</option>.
28562 <indexterm role="option">
28563 <primary><option>untrusted_set_sender</option></primary>
28566 <informaltable frame="all">
28567 <tgroup cols="4" colsep="0" rowsep="0">
28568 <colspec colwidth="8*" align="left"/>
28569 <colspec colwidth="6*" align="center"/>
28570 <colspec colwidth="6*" align="center"/>
28571 <colspec colwidth="6*" align="right"/>
28574 <entry><option>untrusted_set_sender</option></entry>
28575 <entry>Use: <emphasis>main</emphasis></entry>
28576 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
28577 <entry>Default: <emphasis>unset</emphasis></entry>
28583 <indexterm role="concept">
28584 <primary>trusted users</primary>
28586 <indexterm role="concept">
28587 <primary>sender</primary>
28588 <secondary>setting by untrusted user</secondary>
28590 <indexterm role="concept">
28591 <primary>untrusted user setting sender</primary>
28593 <indexterm role="concept">
28594 <primary>user</primary>
28595 <secondary>untrusted setting sender</secondary>
28597 <indexterm role="concept">
28598 <primary>envelope sender</primary>
28600 When an untrusted user submits a message to Exim using the standard input, Exim
28601 normally creates an envelope sender address from the user’s login and the
28602 default qualification domain. Data from the <option>-f</option> option (for setting envelope
28603 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
28604 is used) is ignored.
28607 However, untrusted users are permitted to set an empty envelope sender address,
28608 to declare that a message should never generate any bounces. For example:
28610 <literallayout class="monospaced">
28611 exim -f '<>' user@domain.example
28614 <indexterm role="variable">
28615 <primary><varname>$sender_ident</varname></primary>
28617 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
28618 other envelope sender addresses in a controlled way. When it is set, untrusted
28619 users are allowed to set envelope sender addresses that match any of the
28620 patterns in the list. Like all address lists, the string is expanded. The
28621 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
28622 users to setting senders that start with their login ids
28623 followed by a hyphen
28624 by a setting like this:
28626 <literallayout class="monospaced">
28627 untrusted_set_sender = ^$sender_ident-
28630 If you want to allow untrusted users to set envelope sender addresses without
28631 restriction, you can use
28633 <literallayout class="monospaced">
28634 untrusted_set_sender = *
28637 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
28638 only to the setting of the envelope sender. It does not permit untrusted users
28639 to use the other options which trusted user can use to override message
28640 parameters. Furthermore, it does not stop Exim from removing an existing
28641 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
28642 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
28643 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
28644 described in section <xref linkend="SECTthesenhea"/>.
28647 The log line for a message’s arrival shows the envelope sender following
28648 <quote><=</quote>. For local messages, the user’s login always follows, after <quote>U=</quote>. In
28649 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
28650 envelope sender address, the user’s login is shown in parentheses after the
28654 <indexterm role="option">
28655 <primary><option>uucp_from_pattern</option></primary>
28658 <informaltable frame="all">
28659 <tgroup cols="4" colsep="0" rowsep="0">
28660 <colspec colwidth="8*" align="left"/>
28661 <colspec colwidth="6*" align="center"/>
28662 <colspec colwidth="6*" align="center"/>
28663 <colspec colwidth="6*" align="right"/>
28666 <entry><option>uucp_from_pattern</option></entry>
28667 <entry>Use: <emphasis>main</emphasis></entry>
28668 <entry>Type: <emphasis>string</emphasis></entry>
28669 <entry>Default: <emphasis>see below</emphasis></entry>
28675 <indexterm role="concept">
28676 <primary><quote>From</quote> line</primary>
28678 <indexterm role="concept">
28679 <primary>UUCP</primary>
28680 <secondary><quote>From</quote> line</secondary>
28682 Some applications that pass messages to an MTA via a command line interface use
28683 an initial line starting with <quote>From </quote> to pass the envelope sender. In
28684 particular, this is used by UUCP software. Exim recognizes such a line by means
28685 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
28686 matches, the sender address is constructed by expanding the contents of
28687 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
28688 default pattern recognizes lines in the following two forms:
28690 <literallayout class="monospaced">
28691 From ph10 Fri Jan 5 12:35 GMT 1996
28692 From ph10 Fri, 7 Jan 97 14:00:00 GMT
28695 The pattern can be seen by running
28697 <literallayout class="monospaced">
28698 exim -bP uucp_from_pattern
28701 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
28702 year in the second case. The first word after <quote>From </quote> is matched in the
28703 regular expression by a parenthesized subpattern. The default value for
28704 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
28705 (<quote>ph10</quote> in the example above) as the message’s sender. See also
28706 <option>ignore_fromline_hosts</option>.
28709 <indexterm role="option">
28710 <primary><option>uucp_from_sender</option></primary>
28713 <informaltable frame="all">
28714 <tgroup cols="4" colsep="0" rowsep="0">
28715 <colspec colwidth="8*" align="left"/>
28716 <colspec colwidth="6*" align="center"/>
28717 <colspec colwidth="6*" align="center"/>
28718 <colspec colwidth="6*" align="right"/>
28721 <entry><option>uucp_from_sender</option></entry>
28722 <entry>Use: <emphasis>main</emphasis></entry>
28723 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28724 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
28730 See <option>uucp_from_pattern</option> above.
28733 <indexterm role="option">
28734 <primary><option>warn_message_file</option></primary>
28737 <informaltable frame="all">
28738 <tgroup cols="4" colsep="0" rowsep="0">
28739 <colspec colwidth="8*" align="left"/>
28740 <colspec colwidth="6*" align="center"/>
28741 <colspec colwidth="6*" align="center"/>
28742 <colspec colwidth="6*" align="right"/>
28745 <entry><option>warn_message_file</option></entry>
28746 <entry>Use: <emphasis>main</emphasis></entry>
28747 <entry>Type: <emphasis>string</emphasis></entry>
28748 <entry>Default: <emphasis>unset</emphasis></entry>
28754 <indexterm role="concept">
28755 <primary>warning of delay</primary>
28756 <secondary>customizing the message</secondary>
28758 <indexterm role="concept">
28759 <primary>customizing</primary>
28760 <secondary>warning message</secondary>
28762 This option defines a template file containing paragraphs of text to be used
28763 for constructing the warning message which is sent by Exim when a message has
28764 been on the queue for a specified amount of time, as specified by
28765 <option>delay_warning</option>. Details of the file’s contents are given in chapter
28766 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
28769 <indexterm role="option">
28770 <primary><option>write_rejectlog</option></primary>
28773 <informaltable frame="all">
28774 <tgroup cols="4" colsep="0" rowsep="0">
28775 <colspec colwidth="8*" align="left"/>
28776 <colspec colwidth="6*" align="center"/>
28777 <colspec colwidth="6*" align="center"/>
28778 <colspec colwidth="6*" align="right"/>
28781 <entry><option>write_rejectlog</option></entry>
28782 <entry>Use: <emphasis>main</emphasis></entry>
28783 <entry>Type: <emphasis>boolean</emphasis></entry>
28784 <entry>Default: <emphasis>true</emphasis></entry>
28790 <indexterm role="concept">
28791 <primary>reject log</primary>
28792 <secondary>disabling</secondary>
28794 If this option is set false, Exim no longer writes anything to the reject log.
28795 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
28796 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
28797 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
28802 <chapter id="CHAProutergeneric">
28803 <title>Generic options for routers</title>
28805 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
28806 <primary>options</primary>
28807 <secondary>generic; for routers</secondary>
28809 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
28810 <primary>generic options</primary>
28811 <secondary>router</secondary>
28813 This chapter describes the generic options that apply to all routers.
28814 Those that are preconditions are marked with ‡ in the <quote>use</quote> field.
28817 For a general description of how a router operates, see sections
28818 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
28819 which the preconditions are tested. The order of expansion of the options that
28820 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
28821 <option>headers_remove</option>, <option>transport</option>.
28824 <indexterm role="option">
28825 <primary><option>address_data</option></primary>
28828 <informaltable frame="all">
28829 <tgroup cols="4" colsep="0" rowsep="0">
28830 <colspec colwidth="8*" align="left"/>
28831 <colspec colwidth="6*" align="center"/>
28832 <colspec colwidth="6*" align="center"/>
28833 <colspec colwidth="6*" align="right"/>
28836 <entry><option>address_data</option></entry>
28837 <entry>Use: <emphasis>routers</emphasis></entry>
28838 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28839 <entry>Default: <emphasis>unset</emphasis></entry>
28845 <indexterm role="concept">
28846 <primary>router</primary>
28847 <secondary>data attached to address</secondary>
28849 The string is expanded just before the router is run, that is, after all the
28850 precondition tests have succeeded. If the expansion is forced to fail, the
28851 router declines, the value of <option>address_data</option> remains unchanged, and the
28852 <option>more</option> option controls what happens next. Other expansion failures cause
28853 delivery of the address to be deferred.
28856 <indexterm role="variable">
28857 <primary><varname>$address_data</varname></primary>
28859 When the expansion succeeds, the value is retained with the address, and can be
28860 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
28861 routers, and the eventual transport.
28864 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
28865 that runs a user’s filter file, the contents of <varname>$address_data</varname> are accessible
28866 in the filter. This is not normally a problem, because such data is usually
28867 either not confidential or it <quote>belongs</quote> to the current user, but if you do
28868 put confidential data into <varname>$address_data</varname> you need to remember this point.
28871 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
28872 with the address, though it can be changed by another <option>address_data</option> setting
28873 on a subsequent router. If a router generates child addresses, the value of
28874 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
28875 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
28878 The idea of <option>address_data</option> is that you can use it to look up a lot of data
28879 for the address once, and then pick out parts of the data later. For example,
28880 you could use a single LDAP lookup to return a string of the form
28882 <literallayout class="monospaced">
28883 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
28886 In the transport you could pick out the mailbox by a setting such as
28888 <literallayout class="monospaced">
28889 file = ${extract{mailbox}{$address_data}}
28892 This makes the configuration file less messy, and also reduces the number of
28893 lookups (though Exim does cache lookups).
28896 <indexterm role="variable">
28897 <primary><varname>$sender_address_data</varname></primary>
28899 <indexterm role="variable">
28900 <primary><varname>$address_data</varname></primary>
28902 The <option>address_data</option> facility is also useful as a means of passing information
28903 from one router to another, and from a router to a transport. In addition, if
28904 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
28905 ACL, it remains available for use in the rest of the ACL statement. After
28906 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
28909 <indexterm role="option">
28910 <primary><option>address_test</option></primary>
28913 <informaltable frame="all">
28914 <tgroup cols="4" colsep="0" rowsep="0">
28915 <colspec colwidth="8*" align="left"/>
28916 <colspec colwidth="6*" align="center"/>
28917 <colspec colwidth="6*" align="center"/>
28918 <colspec colwidth="6*" align="right"/>
28921 <entry><option>address_test</option></entry>
28922 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
28923 <entry>Type: <emphasis>boolean</emphasis></entry>
28924 <entry>Default: <emphasis>true</emphasis></entry>
28930 <indexterm role="option">
28931 <primary><option>-bt</option></primary>
28933 <indexterm role="concept">
28934 <primary>router</primary>
28935 <secondary>skipping when address testing</secondary>
28937 If this option is set false, the router is skipped when routing is being tested
28938 by means of the <option>-bt</option> command line option. This can be a convenience when
28939 your first router sends messages to an external scanner, because it saves you
28940 having to set the <quote>already scanned</quote> indicator when testing real address
28944 <indexterm role="option">
28945 <primary><option>cannot_route_message</option></primary>
28948 <informaltable frame="all">
28949 <tgroup cols="4" colsep="0" rowsep="0">
28950 <colspec colwidth="8*" align="left"/>
28951 <colspec colwidth="6*" align="center"/>
28952 <colspec colwidth="6*" align="center"/>
28953 <colspec colwidth="6*" align="right"/>
28956 <entry><option>cannot_route_message</option></entry>
28957 <entry>Use: <emphasis>routers</emphasis></entry>
28958 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
28959 <entry>Default: <emphasis>unset</emphasis></entry>
28965 <indexterm role="concept">
28966 <primary>router</primary>
28967 <secondary>customizing <quote>cannot route</quote> message</secondary>
28969 <indexterm role="concept">
28970 <primary>customizing</primary>
28971 <secondary><quote>cannot route</quote> message</secondary>
28973 This option specifies a text message that is used when an address cannot be
28974 routed because Exim has run out of routers. The default message is
28975 <quote>Unrouteable address</quote>. This option is useful only on routers that have
28976 <option>more</option> set false, or on the very last router in a configuration, because the
28977 value that is used is taken from the last router that is considered. This
28978 includes a router that is skipped because its preconditions are not met, as
28979 well as a router that declines. For example, using the default configuration,
28982 <literallayout class="monospaced">
28983 cannot_route_message = Remote domain not found in DNS
28986 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
28989 <literallayout class="monospaced">
28990 cannot_route_message = Unknown local user
28993 on the final router that checks for local users. If string expansion fails for
28994 this option, the default message is used. Unless the expansion failure was
28995 explicitly forced, a message about the failure is written to the main and panic
28996 logs, in addition to the normal message about the routing failure.
28999 <indexterm role="option">
29000 <primary><option>caseful_local_part</option></primary>
29003 <informaltable frame="all">
29004 <tgroup cols="4" colsep="0" rowsep="0">
29005 <colspec colwidth="8*" align="left"/>
29006 <colspec colwidth="6*" align="center"/>
29007 <colspec colwidth="6*" align="center"/>
29008 <colspec colwidth="6*" align="right"/>
29011 <entry><option>caseful_local_part</option></entry>
29012 <entry>Use: <emphasis>routers</emphasis></entry>
29013 <entry>Type: <emphasis>boolean</emphasis></entry>
29014 <entry>Default: <emphasis>false</emphasis></entry>
29020 <indexterm role="concept">
29021 <primary>case of local parts</primary>
29023 <indexterm role="concept">
29024 <primary>router</primary>
29025 <secondary>case of local parts</secondary>
29027 By default, routers handle the local parts of addresses in a case-insensitive
29028 manner, though the actual case is preserved for transmission with the message.
29029 If you want the case of letters to be significant in a router, you must set
29030 this option true. For individual router options that contain address or local
29031 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
29032 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
29036 <indexterm role="variable">
29037 <primary><varname>$local_part</varname></primary>
29039 <indexterm role="variable">
29040 <primary><varname>$original_local_part</varname></primary>
29042 <indexterm role="variable">
29043 <primary><varname>$parent_local_part</varname></primary>
29045 The value of the <varname>$local_part</varname> variable is forced to lower case while a
29046 router is running unless <option>caseful_local_part</option> is set. When a router assigns
29047 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
29048 is the same as it was in the router. Similarly, when a router generates child
29049 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
29050 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
29053 This option applies to the processing of an address by a router. When a
29054 recipient address is being processed in an ACL, there is a separate <option>control</option>
29055 modifier that can be used to specify case-sensitive processing within the ACL
29056 (see section <xref linkend="SECTcontrols"/>).
29059 <indexterm role="option">
29060 <primary><option>check_local_user</option></primary>
29063 <informaltable frame="all">
29064 <tgroup cols="4" colsep="0" rowsep="0">
29065 <colspec colwidth="8*" align="left"/>
29066 <colspec colwidth="6*" align="center"/>
29067 <colspec colwidth="6*" align="center"/>
29068 <colspec colwidth="6*" align="right"/>
29071 <entry><option>check_local_user</option></entry>
29072 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29073 <entry>Type: <emphasis>boolean</emphasis></entry>
29074 <entry>Default: <emphasis>false</emphasis></entry>
29080 <indexterm role="concept">
29081 <primary>local user, checking in router</primary>
29083 <indexterm role="concept">
29084 <primary>router</primary>
29085 <secondary>checking for local user</secondary>
29087 <indexterm role="concept">
29088 <primary><filename>/etc/passwd</filename></primary>
29090 <indexterm role="variable">
29091 <primary><varname>$home</varname></primary>
29093 When this option is true, Exim checks that the local part of the recipient
29094 address (with affixes removed if relevant) is the name of an account on the
29095 local system. The check is done by calling the <function>getpwnam()</function> function rather
29096 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
29097 holding password data (such as NIS) are supported. If the local part is a local
29098 user, <varname>$home</varname> is set from the password data, and can be tested in other
29099 preconditions that are evaluated after this one (the order of evaluation is
29100 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
29101 overridden by <option>router_home_directory</option>. If the local part is not a local user,
29102 the router is skipped.
29105 If you want to check that the local part is either the name of a local user
29106 or matches something else, you cannot combine <option>check_local_user</option> with a
29107 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
29108 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
29109 setting to achieve this. For example:
29111 <literallayout class="monospaced">
29112 local_parts = passwd;$local_part : lsearch;/etc/other/users
29115 Note, however, that the side effects of <option>check_local_user</option> (such as setting
29116 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
29117 <option>local_parts</option> (or any other) precondition.
29120 <indexterm role="option">
29121 <primary><option>condition</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>condition</option></entry>
29133 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29134 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29135 <entry>Default: <emphasis>unset</emphasis></entry>
29141 <indexterm role="concept">
29142 <primary>router</primary>
29143 <secondary>customized precondition</secondary>
29145 This option specifies a general precondition test that has to succeed for the
29146 router to be called. The <option>condition</option> option is the last precondition to be
29147 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
29148 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
29149 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
29150 router is skipped, and the address is offered to the next one.
29153 If the result is any other value, the router is run (as this is the last
29154 precondition to be evaluated, all the other preconditions must be true).
29156 <para revisionflag="changed">
29157 This option is unique in that multiple <option>condition</option> options may be present.
29158 All <option>condition</option> options must succeed.
29160 <para revisionflag="changed">
29161 The <option>condition</option> option provides a means of applying custom conditions to the
29162 running of routers. Note that in the case of a simple conditional expansion,
29163 the default expansion values are exactly what is wanted. For example:
29165 <literallayout class="monospaced" revisionflag="changed">
29166 condition = ${if >{$message_age}{600}}
29168 <para revisionflag="changed">
29169 Because of the default behaviour of the string expansion, this is equivalent to
29171 <literallayout class="monospaced" revisionflag="changed">
29172 condition = ${if >{$message_age}{600}{true}{}}
29174 <para revisionflag="changed">
29175 A multiple condition example, which succeeds:
29177 <literallayout class="monospaced" revisionflag="changed">
29178 condition = ${if >{$message_age}{600}}
29179 condition = ${if !eq{${lc:$local_part}}{postmaster}}
29182 <para revisionflag="changed">
29183 If the expansion fails (other than forced failure) delivery is deferred. Some
29184 of the other precondition options are common special cases that could in fact
29185 be specified using <option>condition</option>.
29188 <indexterm role="option">
29189 <primary><option>debug_print</option></primary>
29192 <informaltable frame="all">
29193 <tgroup cols="4" colsep="0" rowsep="0">
29194 <colspec colwidth="8*" align="left"/>
29195 <colspec colwidth="6*" align="center"/>
29196 <colspec colwidth="6*" align="center"/>
29197 <colspec colwidth="6*" align="right"/>
29200 <entry><option>debug_print</option></entry>
29201 <entry>Use: <emphasis>routers</emphasis></entry>
29202 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29203 <entry>Default: <emphasis>unset</emphasis></entry>
29209 <indexterm role="concept">
29210 <primary>testing</primary>
29211 <secondary>variables in drivers</secondary>
29213 If this option is set and debugging is enabled (see the <option>-d</option> command line
29214 option), the string is expanded and included in the debugging output.
29215 If expansion of the string fails, the error message is written to the debugging
29216 output, and Exim carries on processing.
29217 This option is provided to help with checking out the values of variables and
29218 so on when debugging router configurations. For example, if a <option>condition</option>
29219 option appears not to be working, <option>debug_print</option> can be used to output the
29220 variables it references. The output happens after checks for <option>domains</option>,
29221 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
29222 are tested. A newline is added to the text if it does not end with one.
29225 <indexterm role="option">
29226 <primary><option>disable_logging</option></primary>
29229 <informaltable frame="all">
29230 <tgroup cols="4" colsep="0" rowsep="0">
29231 <colspec colwidth="8*" align="left"/>
29232 <colspec colwidth="6*" align="center"/>
29233 <colspec colwidth="6*" align="center"/>
29234 <colspec colwidth="6*" align="right"/>
29237 <entry><option>disable_logging</option></entry>
29238 <entry>Use: <emphasis>routers</emphasis></entry>
29239 <entry>Type: <emphasis>boolean</emphasis></entry>
29240 <entry>Default: <emphasis>false</emphasis></entry>
29246 If this option is set true, nothing is logged for any routing errors
29247 or for any deliveries caused by this router. You should not set this option
29248 unless you really, really know what you are doing. See also the generic
29249 transport option of the same name.
29252 <indexterm role="option">
29253 <primary><option>domains</option></primary>
29256 <informaltable frame="all">
29257 <tgroup cols="4" colsep="0" rowsep="0">
29258 <colspec colwidth="8*" align="left"/>
29259 <colspec colwidth="6*" align="center"/>
29260 <colspec colwidth="6*" align="center"/>
29261 <colspec colwidth="6*" align="right"/>
29264 <entry><option>domains</option></entry>
29265 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29266 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
29267 <entry>Default: <emphasis>unset</emphasis></entry>
29273 <indexterm role="concept">
29274 <primary>router</primary>
29275 <secondary>restricting to specific domains</secondary>
29277 <indexterm role="variable">
29278 <primary><varname>$domain_data</varname></primary>
29280 If this option is set, the router is skipped unless the current domain matches
29281 the list. If the match is achieved by means of a file lookup, the data that the
29282 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
29283 expansions of the driver’s private options. See section <xref linkend="SECTrouprecon"/> for
29284 a list of the order in which preconditions are evaluated.
29287 <indexterm role="option">
29288 <primary><option>driver</option></primary>
29291 <informaltable frame="all">
29292 <tgroup cols="4" colsep="0" rowsep="0">
29293 <colspec colwidth="8*" align="left"/>
29294 <colspec colwidth="6*" align="center"/>
29295 <colspec colwidth="6*" align="center"/>
29296 <colspec colwidth="6*" align="right"/>
29299 <entry><option>driver</option></entry>
29300 <entry>Use: <emphasis>routers</emphasis></entry>
29301 <entry>Type: <emphasis>string</emphasis></entry>
29302 <entry>Default: <emphasis>unset</emphasis></entry>
29308 This option must always be set. It specifies which of the available routers is
29312 <indexterm role="option">
29313 <primary><option>errors_to</option></primary>
29316 <informaltable frame="all">
29317 <tgroup cols="4" colsep="0" rowsep="0">
29318 <colspec colwidth="8*" align="left"/>
29319 <colspec colwidth="6*" align="center"/>
29320 <colspec colwidth="6*" align="center"/>
29321 <colspec colwidth="6*" align="right"/>
29324 <entry><option>errors_to</option></entry>
29325 <entry>Use: <emphasis>routers</emphasis></entry>
29326 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29327 <entry>Default: <emphasis>unset</emphasis></entry>
29333 <indexterm role="concept">
29334 <primary>envelope sender</primary>
29336 <indexterm role="concept">
29337 <primary>router</primary>
29338 <secondary>changing address for errors</secondary>
29340 If a router successfully handles an address, it may assign the address to a
29341 transport for delivery or it may generate child addresses. In both cases, if
29342 there is a delivery problem during later processing, the resulting bounce
29343 message is sent to the address that results from expanding this string,
29344 provided that the address verifies successfully. The <option>errors_to</option> option is
29345 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
29348 The <option>errors_to</option> setting associated with an address can be overridden if it
29349 subsequently passes through other routers that have their own <option>errors_to</option>
29350 settings, or if the message is delivered by a transport with a <option>return_path</option>
29354 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
29355 the expansion fails to verify, the errors address associated with the incoming
29356 address is used. At top level, this is the envelope sender. A non-forced
29357 expansion failure causes delivery to be deferred.
29360 If an address for which <option>errors_to</option> has been set ends up being delivered over
29361 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
29362 any bounces that are generated by other MTAs on the delivery route are also
29363 sent there. You can set <option>errors_to</option> to the empty string by either of these
29366 <literallayout class="monospaced">
29371 An expansion item that yields an empty string has the same effect. If you do
29372 this, a locally detected delivery error for addresses processed by this router
29373 no longer gives rise to a bounce message; the error is discarded. If the
29374 address is delivered to a remote host, the return path is set to <literal><></literal>, unless
29375 overridden by the <option>return_path</option> option on the transport.
29378 <indexterm role="variable">
29379 <primary><varname>$address_data</varname></primary>
29381 If for some reason you want to discard local errors, but use a non-empty
29382 MAIL command for remote delivery, you can preserve the original return
29383 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
29384 setting <option>return_path</option>.
29387 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
29388 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
29389 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
29392 <indexterm role="option">
29393 <primary><option>expn</option></primary>
29396 <informaltable frame="all">
29397 <tgroup cols="4" colsep="0" rowsep="0">
29398 <colspec colwidth="8*" align="left"/>
29399 <colspec colwidth="6*" align="center"/>
29400 <colspec colwidth="6*" align="center"/>
29401 <colspec colwidth="6*" align="right"/>
29404 <entry><option>expn</option></entry>
29405 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29406 <entry>Type: <emphasis>boolean</emphasis></entry>
29407 <entry>Default: <emphasis>true</emphasis></entry>
29413 <indexterm role="concept">
29414 <primary>address</primary>
29415 <secondary>testing</secondary>
29417 <indexterm role="concept">
29418 <primary>testing</primary>
29419 <secondary>addresses</secondary>
29421 <indexterm role="concept">
29422 <primary>EXPN</primary>
29423 <secondary>router skipping</secondary>
29425 <indexterm role="concept">
29426 <primary>router</primary>
29427 <secondary>skipping for EXPN</secondary>
29429 If this option is turned off, the router is skipped when testing an address
29430 as a result of processing an SMTP EXPN command. You might, for example,
29431 want to turn it off on a router for users’ <filename>.forward</filename> files, while leaving it
29432 on for the system alias file.
29433 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29437 The use of the SMTP EXPN command is controlled by an ACL (see chapter
29438 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
29439 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
29442 <indexterm role="option">
29443 <primary><option>fail_verify</option></primary>
29446 <informaltable frame="all">
29447 <tgroup cols="4" colsep="0" rowsep="0">
29448 <colspec colwidth="8*" align="left"/>
29449 <colspec colwidth="6*" align="center"/>
29450 <colspec colwidth="6*" align="center"/>
29451 <colspec colwidth="6*" align="right"/>
29454 <entry><option>fail_verify</option></entry>
29455 <entry>Use: <emphasis>routers</emphasis></entry>
29456 <entry>Type: <emphasis>boolean</emphasis></entry>
29457 <entry>Default: <emphasis>false</emphasis></entry>
29463 <indexterm role="concept">
29464 <primary>router</primary>
29465 <secondary>forcing verification failure</secondary>
29467 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
29468 <option>fail_verify_recipient</option> to the same value.
29471 <indexterm role="option">
29472 <primary><option>fail_verify_recipient</option></primary>
29475 <informaltable frame="all">
29476 <tgroup cols="4" colsep="0" rowsep="0">
29477 <colspec colwidth="8*" align="left"/>
29478 <colspec colwidth="6*" align="center"/>
29479 <colspec colwidth="6*" align="center"/>
29480 <colspec colwidth="6*" align="right"/>
29483 <entry><option>fail_verify_recipient</option></entry>
29484 <entry>Use: <emphasis>routers</emphasis></entry>
29485 <entry>Type: <emphasis>boolean</emphasis></entry>
29486 <entry>Default: <emphasis>false</emphasis></entry>
29492 If this option is true and an address is accepted by this router when
29493 verifying a recipient, verification fails.
29496 <indexterm role="option">
29497 <primary><option>fail_verify_sender</option></primary>
29500 <informaltable frame="all">
29501 <tgroup cols="4" colsep="0" rowsep="0">
29502 <colspec colwidth="8*" align="left"/>
29503 <colspec colwidth="6*" align="center"/>
29504 <colspec colwidth="6*" align="center"/>
29505 <colspec colwidth="6*" align="right"/>
29508 <entry><option>fail_verify_sender</option></entry>
29509 <entry>Use: <emphasis>routers</emphasis></entry>
29510 <entry>Type: <emphasis>boolean</emphasis></entry>
29511 <entry>Default: <emphasis>false</emphasis></entry>
29517 If this option is true and an address is accepted by this router when
29518 verifying a sender, verification fails.
29521 <indexterm role="option">
29522 <primary><option>fallback_hosts</option></primary>
29525 <informaltable frame="all">
29526 <tgroup cols="4" colsep="0" rowsep="0">
29527 <colspec colwidth="8*" align="left"/>
29528 <colspec colwidth="6*" align="center"/>
29529 <colspec colwidth="6*" align="center"/>
29530 <colspec colwidth="6*" align="right"/>
29533 <entry><option>fallback_hosts</option></entry>
29534 <entry>Use: <emphasis>routers</emphasis></entry>
29535 <entry>Type: <emphasis>string list</emphasis></entry>
29536 <entry>Default: <emphasis>unset</emphasis></entry>
29542 <indexterm role="concept">
29543 <primary>router</primary>
29544 <secondary>fallback hosts</secondary>
29546 <indexterm role="concept">
29547 <primary>fallback</primary>
29548 <secondary>hosts specified on router</secondary>
29550 String expansion is not applied to this option. The argument must be a
29551 colon-separated list of host names or IP addresses. The list separator can be
29552 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
29553 each name or address. In fact, the format of each item is exactly the same as
29554 defined for the list of hosts in a <command>manualroute</command> router (see section
29555 <xref linkend="SECTformatonehostitem"/>).
29558 If a router queues an address for a remote transport, this host list is
29559 associated with the address, and used instead of the transport’s fallback host
29560 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
29561 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
29562 transport for further details.
29565 <indexterm role="option">
29566 <primary><option>group</option></primary>
29569 <informaltable frame="all">
29570 <tgroup cols="4" colsep="0" rowsep="0">
29571 <colspec colwidth="8*" align="left"/>
29572 <colspec colwidth="6*" align="center"/>
29573 <colspec colwidth="6*" align="center"/>
29574 <colspec colwidth="6*" align="right"/>
29577 <entry><option>group</option></entry>
29578 <entry>Use: <emphasis>routers</emphasis></entry>
29579 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29580 <entry>Default: <emphasis>see below</emphasis></entry>
29586 <indexterm role="concept">
29587 <primary>gid (group id)</primary>
29588 <secondary>local delivery</secondary>
29590 <indexterm role="concept">
29591 <primary>local transports</primary>
29592 <secondary>uid and gid</secondary>
29594 <indexterm role="concept">
29595 <primary>transport</primary>
29596 <secondary>local</secondary>
29598 <indexterm role="concept">
29599 <primary>router</primary>
29600 <secondary>setting group</secondary>
29602 When a router queues an address for a transport, and the transport does not
29603 specify a group, the group given here is used when running the delivery
29605 The group may be specified numerically or by name. If expansion fails, the
29606 error is logged and delivery is deferred.
29607 The default is unset, unless <option>check_local_user</option> is set, when the default
29608 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
29609 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29612 <indexterm role="option">
29613 <primary><option>headers_add</option></primary>
29616 <informaltable frame="all">
29617 <tgroup cols="4" colsep="0" rowsep="0">
29618 <colspec colwidth="8*" align="left"/>
29619 <colspec colwidth="6*" align="center"/>
29620 <colspec colwidth="6*" align="center"/>
29621 <colspec colwidth="6*" align="right"/>
29624 <entry><option>headers_add</option></entry>
29625 <entry>Use: <emphasis>routers</emphasis></entry>
29626 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29627 <entry>Default: <emphasis>unset</emphasis></entry>
29633 <indexterm role="concept">
29634 <primary>header lines</primary>
29635 <secondary>adding</secondary>
29637 <indexterm role="concept">
29638 <primary>router</primary>
29639 <secondary>adding header lines</secondary>
29641 This option specifies a string of text that is expanded at routing time, and
29642 associated with any addresses that are accepted by the router. However, this
29643 option has no effect when an address is just being verified. The way in which
29644 the text is used to add header lines at transport time is described in section
29645 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
29646 message is in the process of being transported. This means that references to
29647 header lines in string expansions in the transport’s configuration do not
29648 <quote>see</quote> the added header lines.
29651 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
29652 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
29653 the expansion is forced to fail, the option has no effect. Other expansion
29654 failures are treated as configuration errors.
29657 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
29658 router that has the <option>one_time</option> option set.
29661 <indexterm role="concept">
29662 <primary>duplicate addresses</primary>
29664 <indexterm role="option">
29665 <primary><option>unseen</option></primary>
29667 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29668 additions are deleted when the address is passed on to subsequent routers.
29669 For a <option>redirect</option> router, if a generated address is the same as the incoming
29670 address, this can lead to duplicate addresses with different header
29671 modifications. Exim does not do duplicate deliveries (except, in certain
29672 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
29673 which of the duplicates is discarded, so this ambiguous situation should be
29674 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
29677 <indexterm role="option">
29678 <primary><option>headers_remove</option></primary>
29681 <informaltable frame="all">
29682 <tgroup cols="4" colsep="0" rowsep="0">
29683 <colspec colwidth="8*" align="left"/>
29684 <colspec colwidth="6*" align="center"/>
29685 <colspec colwidth="6*" align="center"/>
29686 <colspec colwidth="6*" align="right"/>
29689 <entry><option>headers_remove</option></entry>
29690 <entry>Use: <emphasis>routers</emphasis></entry>
29691 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
29692 <entry>Default: <emphasis>unset</emphasis></entry>
29698 <indexterm role="concept">
29699 <primary>header lines</primary>
29700 <secondary>removing</secondary>
29702 <indexterm role="concept">
29703 <primary>router</primary>
29704 <secondary>removing header lines</secondary>
29706 This option specifies a string of text that is expanded at routing time, and
29707 associated with any addresses that are accepted by the router. However, this
29708 option has no effect when an address is just being verified. The way in which
29709 the text is used to remove header lines at transport time is described in
29710 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
29711 the message is in the process of being transported. This means that references
29712 to header lines in string expansions in the transport’s configuration still
29713 <quote>see</quote> the original header lines.
29716 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
29717 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
29718 the option has no effect. Other expansion failures are treated as configuration
29722 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
29723 router that has the <option>one_time</option> option set.
29726 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
29727 removal requests are deleted when the address is passed on to subsequent
29728 routers, and this can lead to problems with duplicates -- see the similar
29729 warning for <option>headers_add</option> above.
29732 <indexterm role="option">
29733 <primary><option>ignore_target_hosts</option></primary>
29736 <informaltable frame="all">
29737 <tgroup cols="4" colsep="0" rowsep="0">
29738 <colspec colwidth="8*" align="left"/>
29739 <colspec colwidth="6*" align="center"/>
29740 <colspec colwidth="6*" align="center"/>
29741 <colspec colwidth="6*" align="right"/>
29744 <entry><option>ignore_target_hosts</option></entry>
29745 <entry>Use: <emphasis>routers</emphasis></entry>
29746 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
29747 <entry>Default: <emphasis>unset</emphasis></entry>
29753 <indexterm role="concept">
29754 <primary>IP address</primary>
29755 <secondary>discarding</secondary>
29757 <indexterm role="concept">
29758 <primary>router</primary>
29759 <secondary>discarding IP addresses</secondary>
29761 Although this option is a host list, it should normally contain IP address
29762 entries rather than names. If any host that is looked up by the router has an
29763 IP address that matches an item in this list, Exim behaves as if that IP
29764 address did not exist. This option allows you to cope with rogue DNS entries
29767 <literallayout class="monospaced">
29768 remote.domain.example. A 127.0.0.1
29773 <literallayout class="monospaced">
29774 ignore_target_hosts = 127.0.0.1
29777 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
29778 discarded in this way, the router declines. In a conventional configuration, an
29779 attempt to mail to such a domain would normally provoke the <quote>unrouteable
29780 domain</quote> error, and an attempt to verify an address in the domain would fail.
29781 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
29782 router declines if presented with one of the listed addresses.
29785 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
29786 means of the first or the second of the following settings, respectively:
29788 <literallayout class="monospaced">
29789 ignore_target_hosts = 0.0.0.0/0
29790 ignore_target_hosts = <; 0::0/0
29793 The pattern in the first line matches all IPv4 addresses, whereas the pattern
29794 in the second line matches all IPv6 addresses.
29797 This option may also be useful for ignoring link-local and site-local IPv6
29798 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
29799 is expanded before use as a list, it is possible to make it dependent on the
29800 domain that is being routed.
29803 <indexterm role="variable">
29804 <primary><varname>$host_address</varname></primary>
29806 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
29810 <indexterm role="option">
29811 <primary><option>initgroups</option></primary>
29814 <informaltable frame="all">
29815 <tgroup cols="4" colsep="0" rowsep="0">
29816 <colspec colwidth="8*" align="left"/>
29817 <colspec colwidth="6*" align="center"/>
29818 <colspec colwidth="6*" align="center"/>
29819 <colspec colwidth="6*" align="right"/>
29822 <entry><option>initgroups</option></entry>
29823 <entry>Use: <emphasis>routers</emphasis></entry>
29824 <entry>Type: <emphasis>boolean</emphasis></entry>
29825 <entry>Default: <emphasis>false</emphasis></entry>
29831 <indexterm role="concept">
29832 <primary>additional groups</primary>
29834 <indexterm role="concept">
29835 <primary>groups</primary>
29836 <secondary>additional</secondary>
29838 <indexterm role="concept">
29839 <primary>local transports</primary>
29840 <secondary>uid and gid</secondary>
29842 <indexterm role="concept">
29843 <primary>transport</primary>
29844 <secondary>local</secondary>
29846 If the router queues an address for a transport, and this option is true, and
29847 the uid supplied by the router is not overridden by the transport, the
29848 <function>initgroups()</function> function is called when running the transport to ensure that
29849 any additional groups associated with the uid are set up. See also <option>group</option>
29850 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
29853 <indexterm role="option">
29854 <primary><option>local_part_prefix</option></primary>
29857 <informaltable frame="all">
29858 <tgroup cols="4" colsep="0" rowsep="0">
29859 <colspec colwidth="8*" align="left"/>
29860 <colspec colwidth="6*" align="center"/>
29861 <colspec colwidth="6*" align="center"/>
29862 <colspec colwidth="6*" align="right"/>
29865 <entry><option>local_part_prefix</option></entry>
29866 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29867 <entry>Type: <emphasis>string list</emphasis></entry>
29868 <entry>Default: <emphasis>unset</emphasis></entry>
29874 <indexterm role="concept">
29875 <primary>router</primary>
29876 <secondary>prefix for local part</secondary>
29878 <indexterm role="concept">
29879 <primary>prefix</primary>
29880 <secondary>for local part, used in router</secondary>
29882 If this option is set, the router is skipped unless the local part starts with
29883 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
29884 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
29888 The list is scanned from left to right, and the first prefix that matches is
29889 used. A limited form of wildcard is available; if the prefix begins with an
29890 asterisk, it matches the longest possible sequence of arbitrary characters at
29891 the start of the local part. An asterisk should therefore always be followed by
29892 some character that does not occur in normal local parts.
29893 <indexterm role="concept">
29894 <primary>multiple mailboxes</primary>
29896 <indexterm role="concept">
29897 <primary>mailbox</primary>
29898 <secondary>multiple</secondary>
29900 Wildcarding can be used to set up multiple user mailboxes, as described in
29901 section <xref linkend="SECTmulbox"/>.
29904 <indexterm role="variable">
29905 <primary><varname>$local_part</varname></primary>
29907 <indexterm role="variable">
29908 <primary><varname>$local_part_prefix</varname></primary>
29910 During the testing of the <option>local_parts</option> option, and while the router is
29911 running, the prefix is removed from the local part, and is available in the
29912 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
29913 the router accepts the address, this remains true during subsequent delivery by
29914 a transport. In particular, the local part that is transmitted in the RCPT
29915 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
29916 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
29917 the relevant transport.
29920 When an address is being verified, <option>local_part_prefix</option> affects only the
29921 behaviour of the router. If the callout feature of verification is in use, this
29922 means that the full address, including the prefix, will be used during the
29926 The prefix facility is commonly used to handle local parts of the form
29927 <option>owner-something</option>. Another common use is to support local parts of the form
29928 <option>real-username</option> to bypass a user’s <filename>.forward</filename> file – helpful when trying
29929 to tell a user their forwarding is broken – by placing a router like this one
29930 immediately before the router that handles <filename>.forward</filename> files:
29932 <literallayout class="monospaced">
29935 local_part_prefix = real-
29937 transport = local_delivery
29940 For security, it would probably be a good idea to restrict the use of this
29941 router to locally-generated messages, using a condition such as this:
29943 <literallayout class="monospaced">
29944 condition = ${if match {$sender_host_address}\
29945 {\N^(|127\.0\.0\.1)$\N}}
29948 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
29949 both conditions must be met if not optional. Care must be taken if wildcards
29950 are used in both a prefix and a suffix on the same router. Different
29951 separator characters must be used to avoid ambiguity.
29954 <indexterm role="option">
29955 <primary><option>local_part_prefix_optional</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>local_part_prefix_optional</option></entry>
29967 <entry>Use: <emphasis>routers</emphasis></entry>
29968 <entry>Type: <emphasis>boolean</emphasis></entry>
29969 <entry>Default: <emphasis>false</emphasis></entry>
29975 See <option>local_part_prefix</option> above.
29978 <indexterm role="option">
29979 <primary><option>local_part_suffix</option></primary>
29982 <informaltable frame="all">
29983 <tgroup cols="4" colsep="0" rowsep="0">
29984 <colspec colwidth="8*" align="left"/>
29985 <colspec colwidth="6*" align="center"/>
29986 <colspec colwidth="6*" align="center"/>
29987 <colspec colwidth="6*" align="right"/>
29990 <entry><option>local_part_suffix</option></entry>
29991 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
29992 <entry>Type: <emphasis>string list</emphasis></entry>
29993 <entry>Default: <emphasis>unset</emphasis></entry>
29999 <indexterm role="concept">
30000 <primary>router</primary>
30001 <secondary>suffix for local part</secondary>
30003 <indexterm role="concept">
30004 <primary>suffix for local part</primary>
30005 <secondary>used in router</secondary>
30007 This option operates in the same way as <option>local_part_prefix</option>, except that the
30008 local part must end (rather than start) with the given string, the
30009 <option>local_part_suffix_optional</option> option determines whether the suffix is
30010 mandatory, and the wildcard * character, if present, must be the last
30011 character of the suffix. This option facility is commonly used to handle local
30012 parts of the form <option>something-request</option> and multiple user mailboxes of the form
30013 <option>username-foo</option>.
30016 <indexterm role="option">
30017 <primary><option>local_part_suffix_optional</option></primary>
30020 <informaltable frame="all">
30021 <tgroup cols="4" colsep="0" rowsep="0">
30022 <colspec colwidth="8*" align="left"/>
30023 <colspec colwidth="6*" align="center"/>
30024 <colspec colwidth="6*" align="center"/>
30025 <colspec colwidth="6*" align="right"/>
30028 <entry><option>local_part_suffix_optional</option></entry>
30029 <entry>Use: <emphasis>routers</emphasis></entry>
30030 <entry>Type: <emphasis>boolean</emphasis></entry>
30031 <entry>Default: <emphasis>false</emphasis></entry>
30037 See <option>local_part_suffix</option> above.
30040 <indexterm role="option">
30041 <primary><option>local_parts</option></primary>
30044 <informaltable frame="all">
30045 <tgroup cols="4" colsep="0" rowsep="0">
30046 <colspec colwidth="8*" align="left"/>
30047 <colspec colwidth="6*" align="center"/>
30048 <colspec colwidth="6*" align="center"/>
30049 <colspec colwidth="6*" align="right"/>
30052 <entry><option>local_parts</option></entry>
30053 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30054 <entry>Type: <emphasis>local part list</emphasis>†<emphasis></emphasis></entry>
30055 <entry>Default: <emphasis>unset</emphasis></entry>
30061 <indexterm role="concept">
30062 <primary>router</primary>
30063 <secondary>restricting to specific local parts</secondary>
30065 <indexterm role="concept">
30066 <primary>local part</primary>
30067 <secondary>checking in router</secondary>
30069 The router is run only if the local part of the address matches the list.
30070 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30072 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
30073 string is expanded, it is possible to make it depend on the domain, for
30076 <literallayout class="monospaced">
30077 local_parts = dbm;/usr/local/specials/$domain
30080 <indexterm role="variable">
30081 <primary><varname>$local_part_data</varname></primary>
30083 If the match is achieved by a lookup, the data that the lookup returned
30084 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
30085 expansions of the router’s private options. You might use this option, for
30086 example, if you have a large number of local virtual domains, and you want to
30087 send all postmaster mail to the same place without having to set up an alias in
30088 each virtual domain:
30090 <literallayout class="monospaced">
30093 local_parts = postmaster
30094 data = postmaster@real.domain.example
30097 <indexterm role="option">
30098 <primary><option>log_as_local</option></primary>
30101 <informaltable frame="all">
30102 <tgroup cols="4" colsep="0" rowsep="0">
30103 <colspec colwidth="8*" align="left"/>
30104 <colspec colwidth="6*" align="center"/>
30105 <colspec colwidth="6*" align="center"/>
30106 <colspec colwidth="6*" align="right"/>
30109 <entry><option>log_as_local</option></entry>
30110 <entry>Use: <emphasis>routers</emphasis></entry>
30111 <entry>Type: <emphasis>boolean</emphasis></entry>
30112 <entry>Default: <emphasis>see below</emphasis></entry>
30118 <indexterm role="concept">
30119 <primary>log</primary>
30120 <secondary>delivery line</secondary>
30122 <indexterm role="concept">
30123 <primary>delivery</primary>
30124 <secondary>log line format</secondary>
30126 Exim has two logging styles for delivery, the idea being to make local
30127 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
30128 recipient address is given just as the local part, without a domain. The use of
30129 this style is controlled by this option. It defaults to true for the <command>accept</command>
30130 router, and false for all the others. This option applies only when a
30131 router assigns an address to a transport. It has no effect on routers that
30132 redirect addresses.
30135 <indexterm role="option">
30136 <primary><option>more</option></primary>
30139 <informaltable frame="all">
30140 <tgroup cols="4" colsep="0" rowsep="0">
30141 <colspec colwidth="8*" align="left"/>
30142 <colspec colwidth="6*" align="center"/>
30143 <colspec colwidth="6*" align="center"/>
30144 <colspec colwidth="6*" align="right"/>
30147 <entry><option>more</option></entry>
30148 <entry>Use: <emphasis>routers</emphasis></entry>
30149 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
30150 <entry>Default: <emphasis>true</emphasis></entry>
30156 The result of string expansion for this option must be a valid boolean value,
30157 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30158 result causes an error, and delivery is deferred. If the expansion is forced to
30159 fail, the default value for the option (true) is used. Other failures cause
30160 delivery to be deferred.
30163 If this option is set false, and the router declines to handle the address, no
30164 further routers are tried, routing fails, and the address is bounced.
30165 <indexterm role="option">
30166 <primary><option>self</option></primary>
30168 However, if the router explicitly passes an address to the following router by
30169 means of the setting
30171 <literallayout class="monospaced">
30175 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
30176 does not affect the behaviour if one of the precondition tests fails. In that
30177 case, the address is always passed to the next router.
30180 Note that <option>address_data</option> is not considered to be a precondition. If its
30181 expansion is forced to fail, the router declines, and the value of <option>more</option>
30182 controls what happens next.
30185 <indexterm role="option">
30186 <primary><option>pass_on_timeout</option></primary>
30189 <informaltable frame="all">
30190 <tgroup cols="4" colsep="0" rowsep="0">
30191 <colspec colwidth="8*" align="left"/>
30192 <colspec colwidth="6*" align="center"/>
30193 <colspec colwidth="6*" align="center"/>
30194 <colspec colwidth="6*" align="right"/>
30197 <entry><option>pass_on_timeout</option></entry>
30198 <entry>Use: <emphasis>routers</emphasis></entry>
30199 <entry>Type: <emphasis>boolean</emphasis></entry>
30200 <entry>Default: <emphasis>false</emphasis></entry>
30206 <indexterm role="concept">
30207 <primary>timeout</primary>
30208 <secondary>of router</secondary>
30210 <indexterm role="concept">
30211 <primary>router</primary>
30212 <secondary>timeout</secondary>
30214 If a router times out during a host lookup, it normally causes deferral of the
30215 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
30216 router, overriding <option>no_more</option>. This may be helpful for systems that are
30217 intermittently connected to the Internet, or those that want to pass to a smart
30218 host any messages that cannot immediately be delivered.
30221 There are occasional other temporary errors that can occur while doing DNS
30222 lookups. They are treated in the same way as a timeout, and this option
30223 applies to all of them.
30226 <indexterm role="option">
30227 <primary><option>pass_router</option></primary>
30230 <informaltable frame="all">
30231 <tgroup cols="4" colsep="0" rowsep="0">
30232 <colspec colwidth="8*" align="left"/>
30233 <colspec colwidth="6*" align="center"/>
30234 <colspec colwidth="6*" align="center"/>
30235 <colspec colwidth="6*" align="right"/>
30238 <entry><option>pass_router</option></entry>
30239 <entry>Use: <emphasis>routers</emphasis></entry>
30240 <entry>Type: <emphasis>string</emphasis></entry>
30241 <entry>Default: <emphasis>unset</emphasis></entry>
30247 <indexterm role="concept">
30248 <primary>router</primary>
30249 <secondary>go to after <quote>pass</quote></secondary>
30251 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
30252 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
30253 routing to continue, and overriding a false setting of <option>more</option>. When one of
30254 these routers returns <quote>pass</quote>, the address is normally handed on to the next
30255 router in sequence. This can be changed by setting <option>pass_router</option> to the name
30256 of another router. However (unlike <option>redirect_router</option>) the named router must
30257 be below the current router, to avoid loops. Note that this option applies only
30258 to the special case of <quote>pass</quote>. It does not apply when a router returns
30259 <quote>decline</quote> because it cannot handle an address.
30262 <indexterm role="option">
30263 <primary><option>redirect_router</option></primary>
30266 <informaltable frame="all">
30267 <tgroup cols="4" colsep="0" rowsep="0">
30268 <colspec colwidth="8*" align="left"/>
30269 <colspec colwidth="6*" align="center"/>
30270 <colspec colwidth="6*" align="center"/>
30271 <colspec colwidth="6*" align="right"/>
30274 <entry><option>redirect_router</option></entry>
30275 <entry>Use: <emphasis>routers</emphasis></entry>
30276 <entry>Type: <emphasis>string</emphasis></entry>
30277 <entry>Default: <emphasis>unset</emphasis></entry>
30283 <indexterm role="concept">
30284 <primary>router</primary>
30285 <secondary>start at after redirection</secondary>
30287 Sometimes an administrator knows that it is pointless to reprocess addresses
30288 generated from alias or forward files with the same router again. For
30289 example, if an alias file translates real names into login ids there is no
30290 point searching the alias file a second time, especially if it is a large file.
30293 The <option>redirect_router</option> option can be set to the name of any router instance.
30294 It causes the routing of any generated addresses to start at the named router
30295 instead of at the first router. This option has no effect if the router in
30296 which it is set does not generate new addresses.
30299 <indexterm role="option">
30300 <primary><option>require_files</option></primary>
30303 <informaltable frame="all">
30304 <tgroup cols="4" colsep="0" rowsep="0">
30305 <colspec colwidth="8*" align="left"/>
30306 <colspec colwidth="6*" align="center"/>
30307 <colspec colwidth="6*" align="center"/>
30308 <colspec colwidth="6*" align="right"/>
30311 <entry><option>require_files</option></entry>
30312 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30313 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
30314 <entry>Default: <emphasis>unset</emphasis></entry>
30320 <indexterm role="concept">
30321 <primary>file</primary>
30322 <secondary>requiring for router</secondary>
30324 <indexterm role="concept">
30325 <primary>router</primary>
30326 <secondary>requiring file existence</secondary>
30328 This option provides a general mechanism for predicating the running of a
30329 router on the existence or non-existence of certain files or directories.
30330 Before running a router, as one of its precondition tests, Exim works its way
30331 through the <option>require_files</option> list, expanding each item separately.
30334 Because the list is split before expansion, any colons in expansion items must
30335 be doubled, or the facility for using a different list separator must be used.
30336 If any expansion is forced to fail, the item is ignored. Other expansion
30337 failures cause routing of the address to be deferred.
30340 If any expanded string is empty, it is ignored. Otherwise, except as described
30341 below, each string must be a fully qualified file path, optionally preceded by
30342 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
30343 existence of the files or directories. The router is skipped if any paths not
30344 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
30347 <indexterm role="concept">
30348 <primary>NFS</primary>
30350 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
30351 the message is deferred. This can happen when NFS-mounted filesystems are
30355 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
30356 options, so you cannot use it to check for the existence of a file in which to
30357 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
30358 full list of the order in which preconditions are evaluated.) However, as
30359 these options are all expanded, you can use the <option>exists</option> expansion condition
30360 to make such tests. The <option>require_files</option> option is intended for checking files
30361 that the router may be going to use internally, or which are needed by a
30362 transport (for example <filename>.procmailrc</filename>).
30365 During delivery, the <function>stat()</function> function is run as root, but there is a
30366 facility for some checking of the accessibility of a file by another user.
30367 This is not a proper permissions check, but just a <quote>rough</quote> check that
30368 operates as follows:
30371 If an item in a <option>require_files</option> list does not contain any forward slash
30372 characters, it is taken to be the user (and optional group, separated by a
30373 comma) to be checked for subsequent files in the list. If no group is specified
30374 but the user is specified symbolically, the gid associated with the uid is
30377 <literallayout class="monospaced">
30378 require_files = mail:/some/file
30379 require_files = $local_part:$home/.procmailrc
30382 If a user or group name in a <option>require_files</option> list does not exist, the
30383 <option>require_files</option> condition fails.
30386 Exim performs the check by scanning along the components of the file path, and
30387 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
30388 directories, and <quote>r</quote> access on the final file. Note that this means that file
30389 access control lists, if the operating system has them, are ignored.
30392 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
30393 incoming SMTP message, Exim is not running as root, but under its own uid. This
30394 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
30395 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
30396 user is not permitted to read one of the directories on the file’s path.
30399 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
30400 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
30401 without root access. In this case, if a check for access by a particular user
30402 is requested, Exim creates a subprocess that runs as that user, and tries the
30403 check again in that process.
30406 The default action for handling an unresolved EACCES is to consider it to
30407 be caused by a configuration error, and routing is deferred because the
30408 existence or non-existence of the file cannot be determined. However, in some
30409 circumstances it may be desirable to treat this condition as if the file did
30410 not exist. If the file name (or the exclamation mark that precedes the file
30411 name for non-existence) is preceded by a plus sign, the EACCES error is treated
30412 as if the file did not exist. For example:
30414 <literallayout class="monospaced">
30415 require_files = +/some/file
30418 If the router is not an essential part of verification (for example, it
30419 handles users’ <filename>.forward</filename> files), another solution is to set the <option>verify</option>
30420 option false so that the router is skipped when verifying.
30423 <indexterm role="option">
30424 <primary><option>retry_use_local_part</option></primary>
30427 <informaltable frame="all">
30428 <tgroup cols="4" colsep="0" rowsep="0">
30429 <colspec colwidth="8*" align="left"/>
30430 <colspec colwidth="6*" align="center"/>
30431 <colspec colwidth="6*" align="center"/>
30432 <colspec colwidth="6*" align="right"/>
30435 <entry><option>retry_use_local_part</option></entry>
30436 <entry>Use: <emphasis>routers</emphasis></entry>
30437 <entry>Type: <emphasis>boolean</emphasis></entry>
30438 <entry>Default: <emphasis>see below</emphasis></entry>
30444 <indexterm role="concept">
30445 <primary>hints database</primary>
30446 <secondary>retry keys</secondary>
30448 <indexterm role="concept">
30449 <primary>local part</primary>
30450 <secondary>in retry keys</secondary>
30452 When a delivery suffers a temporary routing failure, a retry record is created
30453 in Exim’s hints database. For addresses whose routing depends only on the
30454 domain, the key for the retry record should not involve the local part, but for
30455 other addresses, both the domain and the local part should be included.
30456 Usually, remote routing is of the former kind, and local routing is of the
30460 This option controls whether the local part is used to form the key for retry
30461 hints for addresses that suffer temporary errors while being handled by this
30462 router. The default value is true for any router that has <option>check_local_user</option>
30463 set, and false otherwise. Note that this option does not apply to hints keys
30464 for transport delays; they are controlled by a generic transport option of the
30468 The setting of <option>retry_use_local_part</option> applies only to the router on which it
30469 appears. If the router generates child addresses, they are routed
30470 independently; this setting does not become attached to them.
30473 <indexterm role="option">
30474 <primary><option>router_home_directory</option></primary>
30477 <informaltable frame="all">
30478 <tgroup cols="4" colsep="0" rowsep="0">
30479 <colspec colwidth="8*" align="left"/>
30480 <colspec colwidth="6*" align="center"/>
30481 <colspec colwidth="6*" align="center"/>
30482 <colspec colwidth="6*" align="right"/>
30485 <entry><option>router_home_directory</option></entry>
30486 <entry>Use: <emphasis>routers</emphasis></entry>
30487 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30488 <entry>Default: <emphasis>unset</emphasis></entry>
30494 <indexterm role="concept">
30495 <primary>router</primary>
30496 <secondary>home directory for</secondary>
30498 <indexterm role="concept">
30499 <primary>home directory</primary>
30500 <secondary>for router</secondary>
30502 <indexterm role="variable">
30503 <primary><varname>$home</varname></primary>
30505 This option sets a home directory for use while the router is running. (Compare
30506 <option>transport_home_directory</option>, which sets a home directory for later
30507 transporting.) In particular, if used on a <command>redirect</command> router, this option
30508 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
30509 forced expansion failure causes the option to be ignored – other failures
30510 cause the router to defer.
30513 Expansion of <option>router_home_directory</option> happens immediately after the
30514 <option>check_local_user</option> test (if configured), before any further expansions take
30516 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30518 While the router is running, <option>router_home_directory</option> overrides the value of
30519 <varname>$home</varname> that came from <option>check_local_user</option>.
30522 When a router accepts an address and assigns it to a local transport (including
30523 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
30524 delivery), the home directory setting for the transport is taken from the first
30525 of these values that is set:
30530 The <option>home_directory</option> option on the transport;
30535 The <option>transport_home_directory</option> option on the router;
30540 The password data if <option>check_local_user</option> is set on the router;
30545 The <option>router_home_directory</option> option on the router.
30550 In other words, <option>router_home_directory</option> overrides the password data for the
30551 router, but not for the transport.
30554 <indexterm role="option">
30555 <primary><option>self</option></primary>
30558 <informaltable frame="all">
30559 <tgroup cols="4" colsep="0" rowsep="0">
30560 <colspec colwidth="8*" align="left"/>
30561 <colspec colwidth="6*" align="center"/>
30562 <colspec colwidth="6*" align="center"/>
30563 <colspec colwidth="6*" align="right"/>
30566 <entry><option>self</option></entry>
30567 <entry>Use: <emphasis>routers</emphasis></entry>
30568 <entry>Type: <emphasis>string</emphasis></entry>
30569 <entry>Default: <emphasis>freeze</emphasis></entry>
30575 <indexterm role="concept">
30576 <primary>MX record</primary>
30577 <secondary>pointing to local host</secondary>
30579 <indexterm role="concept">
30580 <primary>local host</primary>
30581 <secondary>MX pointing to</secondary>
30583 This option applies to those routers that use a recipient address to find a
30584 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
30585 and <command>manualroute</command> routers.
30586 Certain configurations of the <command>queryprogram</command> router can also specify a list
30588 Usually such routers are configured to send the message to a remote host via an
30589 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
30590 host on the list turns out to be the local host.
30591 The way in which Exim checks for the local host is described in section
30592 <xref linkend="SECTreclocipadd"/>.
30595 Normally this situation indicates either an error in Exim’s configuration (for
30596 example, the router should be configured not to process this domain), or an
30597 error in the DNS (for example, the MX should not point to this host). For this
30598 reason, the default action is to log the incident, defer the address, and
30599 freeze the message. The following alternatives are provided for use in special
30604 <term><option>defer</option></term>
30607 Delivery of the message is tried again later, but the message is not frozen.
30609 </listitem></varlistentry>
30611 <term><option>reroute</option>: <<emphasis>domain</emphasis>></term>
30614 The domain is changed to the given domain, and the address is passed back to
30615 be reprocessed by the routers. No rewriting of headers takes place. This
30616 behaviour is essentially a redirection.
30618 </listitem></varlistentry>
30620 <term><option>reroute: rewrite:</option> <<emphasis>domain</emphasis>></term>
30623 The domain is changed to the given domain, and the address is passed back to be
30624 reprocessed by the routers. Any headers that contain the original domain are
30627 </listitem></varlistentry>
30629 <term><option>pass</option></term>
30632 <indexterm role="option">
30633 <primary><option>more</option></primary>
30635 <indexterm role="variable">
30636 <primary><varname>$self_hostname</varname></primary>
30638 The router passes the address to the next router, or to the router named in the
30639 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
30640 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
30641 name of the local host that the router encountered. This can be used to
30642 distinguish between different cases for hosts with multiple names. The
30645 <literallayout class="monospaced">
30650 ensures that only those addresses that routed to the local host are passed on.
30651 Without <option>no_more</option>, addresses that were declined for other reasons would also
30652 be passed to the next router.
30654 </listitem></varlistentry>
30656 <term><option>fail</option></term>
30659 Delivery fails and an error report is generated.
30661 </listitem></varlistentry>
30663 <term><option>send</option></term>
30666 <indexterm role="concept">
30667 <primary>local host</primary>
30668 <secondary>sending to</secondary>
30670 The anomaly is ignored and the address is queued for the transport. This
30671 setting should be used with extreme caution. For an <command>smtp</command> transport, it
30672 makes sense only in cases where the program that is listening on the SMTP port
30673 is not this version of Exim. That is, it must be some other MTA, or Exim with a
30674 different configuration file that handles the domain in another way.
30676 </listitem></varlistentry>
30679 <indexterm role="option">
30680 <primary><option>senders</option></primary>
30683 <informaltable frame="all">
30684 <tgroup cols="4" colsep="0" rowsep="0">
30685 <colspec colwidth="8*" align="left"/>
30686 <colspec colwidth="6*" align="center"/>
30687 <colspec colwidth="6*" align="center"/>
30688 <colspec colwidth="6*" align="right"/>
30691 <entry><option>senders</option></entry>
30692 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
30693 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
30694 <entry>Default: <emphasis>unset</emphasis></entry>
30700 <indexterm role="concept">
30701 <primary>router</primary>
30702 <secondary>checking senders</secondary>
30704 If this option is set, the router is skipped unless the message’s sender
30705 address matches something on the list.
30706 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30710 There are issues concerning verification when the running of routers is
30711 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
30712 setting, it sets the sender to the null string. When using the <option>-bt</option> option
30713 to check a configuration file, it is necessary also to use the <option>-f</option> option to
30714 set an appropriate sender. For incoming mail, the sender is unset when
30715 verifying the sender, but is available when verifying any recipients. If the
30716 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
30720 <indexterm role="option">
30721 <primary><option>translate_ip_address</option></primary>
30724 <informaltable frame="all">
30725 <tgroup cols="4" colsep="0" rowsep="0">
30726 <colspec colwidth="8*" align="left"/>
30727 <colspec colwidth="6*" align="center"/>
30728 <colspec colwidth="6*" align="center"/>
30729 <colspec colwidth="6*" align="right"/>
30732 <entry><option>translate_ip_address</option></entry>
30733 <entry>Use: <emphasis>routers</emphasis></entry>
30734 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30735 <entry>Default: <emphasis>unset</emphasis></entry>
30741 <indexterm role="concept">
30742 <primary>IP address</primary>
30743 <secondary>translating</secondary>
30745 <indexterm role="concept">
30746 <primary>packet radio</primary>
30748 <indexterm role="concept">
30749 <primary>router</primary>
30750 <secondary>IP address translation</secondary>
30752 There exist some rare networking situations (for example, packet radio) where
30753 it is helpful to be able to translate IP addresses generated by normal routing
30754 mechanisms into other IP addresses, thus performing a kind of manual IP
30755 routing. This should be done only if the normal IP routing of the TCP/IP stack
30756 is inadequate or broken. Because this is an extremely uncommon requirement, the
30757 code to support this option is not included in the Exim binary unless
30758 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
30761 <indexterm role="variable">
30762 <primary><varname>$host_address</varname></primary>
30764 The <option>translate_ip_address</option> string is expanded for every IP address generated
30765 by the router, with the generated address set in <varname>$host_address</varname>. If the
30766 expansion is forced to fail, no action is taken.
30767 For any other expansion error, delivery of the message is deferred.
30768 If the result of the expansion is an IP address, that replaces the original
30769 address; otherwise the result is assumed to be a host name – this is looked
30770 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
30771 produce one or more replacement IP addresses. For example, to subvert all IP
30772 addresses in some specific networks, this could be added to a router:
30774 <literallayout class="monospaced">
30775 translate_ip_address = \
30776 ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
30780 The file would contain lines like
30782 <literallayout class="monospaced">
30783 10.2.3.128/26 some.host
30784 10.8.4.34/26 10.44.8.15
30787 You should not make use of this facility unless you really understand what you
30791 <indexterm role="option">
30792 <primary><option>transport</option></primary>
30795 <informaltable frame="all">
30796 <tgroup cols="4" colsep="0" rowsep="0">
30797 <colspec colwidth="8*" align="left"/>
30798 <colspec colwidth="6*" align="center"/>
30799 <colspec colwidth="6*" align="center"/>
30800 <colspec colwidth="6*" align="right"/>
30803 <entry><option>transport</option></entry>
30804 <entry>Use: <emphasis>routers</emphasis></entry>
30805 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30806 <entry>Default: <emphasis>unset</emphasis></entry>
30812 This option specifies the transport to be used when a router accepts an address
30813 and sets it up for delivery. A transport is never needed if a router is used
30814 only for verification. The value of the option is expanded at routing time,
30815 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
30816 and result must be the name of one of the configured transports. If it is not,
30817 delivery is deferred.
30820 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
30821 have some private options that set up transports for pipe and file deliveries
30822 (see chapter <xref linkend="CHAPredirect"/>).
30825 <indexterm role="option">
30826 <primary><option>transport_current_directory</option></primary>
30829 <informaltable frame="all">
30830 <tgroup cols="4" colsep="0" rowsep="0">
30831 <colspec colwidth="8*" align="left"/>
30832 <colspec colwidth="6*" align="center"/>
30833 <colspec colwidth="6*" align="center"/>
30834 <colspec colwidth="6*" align="right"/>
30837 <entry><option>transport_current_directory</option></entry>
30838 <entry>Use: <emphasis>routers</emphasis></entry>
30839 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30840 <entry>Default: <emphasis>unset</emphasis></entry>
30846 <indexterm role="concept">
30847 <primary>current directory for local transport</primary>
30849 This option associates a current directory with any address that is routed
30850 to a local transport. This can happen either because a transport is
30851 explicitly configured for the router, or because it generates a delivery to a
30852 file or a pipe. During the delivery process (that is, at transport time), this
30853 option string is expanded and is set as the current directory, unless
30854 overridden by a setting on the transport.
30855 If the expansion fails for any reason, including forced failure, an error is
30856 logged, and delivery is deferred.
30857 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
30861 <indexterm role="option">
30862 <primary><option>transport_home_directory</option></primary>
30865 <informaltable frame="all">
30866 <tgroup cols="4" colsep="0" rowsep="0">
30867 <colspec colwidth="8*" align="left"/>
30868 <colspec colwidth="6*" align="center"/>
30869 <colspec colwidth="6*" align="center"/>
30870 <colspec colwidth="6*" align="right"/>
30873 <entry><option>transport_home_directory</option></entry>
30874 <entry>Use: <emphasis>routers</emphasis></entry>
30875 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30876 <entry>Default: <emphasis>see below</emphasis></entry>
30882 <indexterm role="concept">
30883 <primary>home directory</primary>
30884 <secondary>for local transport</secondary>
30886 This option associates a home directory with any address that is routed to a
30887 local transport. This can happen either because a transport is explicitly
30888 configured for the router, or because it generates a delivery to a file or a
30889 pipe. During the delivery process (that is, at transport time), the option
30890 string is expanded and is set as the home directory, unless overridden by a
30891 setting of <option>home_directory</option> on the transport.
30892 If the expansion fails for any reason, including forced failure, an error is
30893 logged, and delivery is deferred.
30896 If the transport does not specify a home directory, and
30897 <option>transport_home_directory</option> is not set for the router, the home directory for
30898 the transport is taken from the password data if <option>check_local_user</option> is set for
30899 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
30900 is set; if not, no home directory is set for the transport.
30903 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
30907 <indexterm role="option">
30908 <primary><option>unseen</option></primary>
30911 <informaltable frame="all">
30912 <tgroup cols="4" colsep="0" rowsep="0">
30913 <colspec colwidth="8*" align="left"/>
30914 <colspec colwidth="6*" align="center"/>
30915 <colspec colwidth="6*" align="center"/>
30916 <colspec colwidth="6*" align="right"/>
30919 <entry><option>unseen</option></entry>
30920 <entry>Use: <emphasis>routers</emphasis></entry>
30921 <entry>Type: <emphasis>boolean</emphasis>†<emphasis></emphasis></entry>
30922 <entry>Default: <emphasis>false</emphasis></entry>
30928 <indexterm role="concept">
30929 <primary>router</primary>
30930 <secondary>carrying on after success</secondary>
30932 The result of string expansion for this option must be a valid boolean value,
30933 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
30934 result causes an error, and delivery is deferred. If the expansion is forced to
30935 fail, the default value for the option (false) is used. Other failures cause
30936 delivery to be deferred.
30939 When this option is set true, routing does not cease if the router accepts the
30940 address. Instead, a copy of the incoming address is passed to the next router,
30941 overriding a false setting of <option>more</option>. There is little point in setting
30942 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
30943 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
30944 sometimes true and sometimes false).
30947 <indexterm role="concept">
30948 <primary>copy of message (<option>unseen</option> option)</primary>
30950 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
30951 qualifier in filter files. It can be used to cause copies of messages to be
30952 delivered to some other destination, while also carrying out a normal delivery.
30953 In effect, the current address is made into a <quote>parent</quote> that has two children
30954 – one that is delivered as specified by this router, and a clone that goes on
30955 to be routed further. For this reason, <option>unseen</option> may not be combined with the
30956 <option>one_time</option> option in a <command>redirect</command> router.
30959 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
30960 this router or by previous routers affect the <quote>unseen</quote> copy of the message
30961 only. The clone that continues to be processed by further routers starts with
30962 no added headers and none specified for removal. For a <option>redirect</option> router, if
30963 a generated address is the same as the incoming address, this can lead to
30964 duplicate addresses with different header modifications. Exim does not do
30965 duplicate deliveries (except, in certain circumstances, to pipes -- see section
30966 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
30967 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
30968 <option>redirect</option> router may be of help.
30971 Unlike the handling of header modifications, any data that was set by the
30972 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
30973 subsequent routers.
30976 <indexterm role="option">
30977 <primary><option>user</option></primary>
30980 <informaltable frame="all">
30981 <tgroup cols="4" colsep="0" rowsep="0">
30982 <colspec colwidth="8*" align="left"/>
30983 <colspec colwidth="6*" align="center"/>
30984 <colspec colwidth="6*" align="center"/>
30985 <colspec colwidth="6*" align="right"/>
30988 <entry><option>user</option></entry>
30989 <entry>Use: <emphasis>routers</emphasis></entry>
30990 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
30991 <entry>Default: <emphasis>see below</emphasis></entry>
30997 <indexterm role="concept">
30998 <primary>uid (user id)</primary>
30999 <secondary>local delivery</secondary>
31001 <indexterm role="concept">
31002 <primary>local transports</primary>
31003 <secondary>uid and gid</secondary>
31005 <indexterm role="concept">
31006 <primary>transport</primary>
31007 <secondary>local</secondary>
31009 <indexterm role="concept">
31010 <primary>router</primary>
31011 <secondary>user for filter processing</secondary>
31013 <indexterm role="concept">
31014 <primary>filter</primary>
31015 <secondary>user for processing</secondary>
31017 When a router queues an address for a transport, and the transport does not
31018 specify a user, the user given here is used when running the delivery process.
31019 The user may be specified numerically or by name. If expansion fails, the
31020 error is logged and delivery is deferred.
31021 This user is also used by the <command>redirect</command> router when running a filter file.
31022 The default is unset, except when <option>check_local_user</option> is set. In this case,
31023 the default is taken from the password information. If the user is specified as
31024 a name, and <option>group</option> is not set, the group associated with the user is used.
31025 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
31026 <xref linkend="CHAPenvironment"/>.
31029 <indexterm role="option">
31030 <primary><option>verify</option></primary>
31033 <informaltable frame="all">
31034 <tgroup cols="4" colsep="0" rowsep="0">
31035 <colspec colwidth="8*" align="left"/>
31036 <colspec colwidth="6*" align="center"/>
31037 <colspec colwidth="6*" align="center"/>
31038 <colspec colwidth="6*" align="right"/>
31041 <entry><option>verify</option></entry>
31042 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31043 <entry>Type: <emphasis>boolean</emphasis></entry>
31044 <entry>Default: <emphasis>true</emphasis></entry>
31050 Setting this option has the effect of setting <option>verify_sender</option> and
31051 <option>verify_recipient</option> to the same value.
31054 <indexterm role="option">
31055 <primary><option>verify_only</option></primary>
31058 <informaltable frame="all">
31059 <tgroup cols="4" colsep="0" rowsep="0">
31060 <colspec colwidth="8*" align="left"/>
31061 <colspec colwidth="6*" align="center"/>
31062 <colspec colwidth="6*" align="center"/>
31063 <colspec colwidth="6*" align="right"/>
31066 <entry><option>verify_only</option></entry>
31067 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31068 <entry>Type: <emphasis>boolean</emphasis></entry>
31069 <entry>Default: <emphasis>false</emphasis></entry>
31075 <indexterm role="concept">
31076 <primary>EXPN</primary>
31077 <secondary>with <option>verify_only</option></secondary>
31079 <indexterm role="option">
31080 <primary><option>-bv</option></primary>
31082 <indexterm role="concept">
31083 <primary>router</primary>
31084 <secondary>used only when verifying</secondary>
31086 If this option is set, the router is used only when verifying an address or
31087 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
31088 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
31089 restricted to verifying only senders or recipients by means of
31090 <option>verify_sender</option> and <option>verify_recipient</option>.
31093 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
31094 SMTP message, Exim is not running as root, but under its own uid. If the router
31095 accesses any files, you need to make sure that they are accessible to the Exim
31099 <indexterm role="option">
31100 <primary><option>verify_recipient</option></primary>
31103 <informaltable frame="all">
31104 <tgroup cols="4" colsep="0" rowsep="0">
31105 <colspec colwidth="8*" align="left"/>
31106 <colspec colwidth="6*" align="center"/>
31107 <colspec colwidth="6*" align="center"/>
31108 <colspec colwidth="6*" align="right"/>
31111 <entry><option>verify_recipient</option></entry>
31112 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31113 <entry>Type: <emphasis>boolean</emphasis></entry>
31114 <entry>Default: <emphasis>true</emphasis></entry>
31120 If this option is false, the router is skipped when verifying recipient
31122 or testing recipient verification using <option>-bv</option>.
31123 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31127 <indexterm role="option">
31128 <primary><option>verify_sender</option></primary>
31131 <informaltable frame="all">
31132 <tgroup cols="4" colsep="0" rowsep="0">
31133 <colspec colwidth="8*" align="left"/>
31134 <colspec colwidth="6*" align="center"/>
31135 <colspec colwidth="6*" align="center"/>
31136 <colspec colwidth="6*" align="right"/>
31139 <entry><option>verify_sender</option></entry>
31140 <entry>Use: <emphasis>routers</emphasis>‡<emphasis></emphasis></entry>
31141 <entry>Type: <emphasis>boolean</emphasis></entry>
31142 <entry>Default: <emphasis>true</emphasis></entry>
31148 If this option is false, the router is skipped when verifying sender addresses
31149 or testing sender verification using <option>-bvs</option>.
31150 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
31152 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
31153 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
31157 <chapter id="CHID4">
31158 <title>The accept router</title>
31160 <indexterm role="concept">
31161 <primary><command>accept</command> router</primary>
31163 <indexterm role="concept">
31164 <primary>routers</primary>
31165 <secondary><command>accept</command></secondary>
31167 The <command>accept</command> router has no private options of its own. Unless it is being
31168 used purely for verification (see <option>verify_only</option>) a transport is required to
31169 be defined by the generic <option>transport</option> option. If the preconditions that are
31170 specified by generic options are met, the router accepts the address and queues
31171 it for the given transport. The most common use of this router is for setting
31172 up deliveries to local mailboxes. For example:
31174 <literallayout class="monospaced">
31177 domains = mydomain.example
31179 transport = local_delivery
31182 The <option>domains</option> condition in this example checks the domain of the address, and
31183 <option>check_local_user</option> checks that the local part is the login of a local user.
31184 When both preconditions are met, the <command>accept</command> router runs, and queues the
31185 address for the <command>local_delivery</command> transport.
31189 <chapter id="CHAPdnslookup">
31190 <title>The dnslookup router</title>
31192 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
31193 <primary><command>dnslookup</command> router</primary>
31195 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
31196 <primary>routers</primary>
31197 <secondary><command>dnslookup</command></secondary>
31199 The <command>dnslookup</command> router looks up the hosts that handle mail for the
31200 recipient’s domain in the DNS. A transport must always be set for this router,
31201 unless <option>verify_only</option> is set.
31204 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
31205 SRV records. If none are found, or if SRV support is not configured,
31206 MX records are looked up. If no MX records exist, address records are sought.
31207 However, <option>mx_domains</option> can be set to disable the direct use of address
31211 MX records of equal priority are sorted by Exim into a random order. Exim then
31212 looks for address records for the host names obtained from MX or SRV records.
31213 When a host has more than one IP address, they are sorted into a random order,
31214 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
31215 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
31216 generic option, the router declines.
31219 Unless they have the highest priority (lowest MX value), MX records that point
31220 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
31221 are discarded, together with any other MX records of equal or lower priority.
31224 <indexterm role="concept">
31225 <primary>MX record</primary>
31226 <secondary>pointing to local host</secondary>
31228 <indexterm role="concept">
31229 <primary>local host</primary>
31230 <secondary>MX pointing to</secondary>
31232 <indexterm role="option">
31233 <primary><option>self</option></primary>
31234 <secondary>in <command>dnslookup</command> router</secondary>
31236 If the host pointed to by the highest priority MX record, or looked up as an
31237 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
31238 happens is controlled by the generic <option>self</option> option.
31240 <section id="SECTprowitdnsloo">
31241 <title>Problems with DNS lookups</title>
31243 There have been problems with DNS servers when SRV records are looked up.
31244 Some mis-behaving servers return a DNS error or timeout when a non-existent
31245 SRV record is sought. Similar problems have in the past been reported for
31246 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
31247 problem, but it is heavy-handed because it is a global option.
31250 For this reason, there are two options, <option>srv_fail_domains</option> and
31251 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
31252 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
31253 an attempt to look up an SRV or MX record causes one of these results, and the
31254 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
31255 such record</quote>. In the case of an SRV lookup, this means that the router
31256 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
31257 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
31258 case routing fails.
31261 <section id="SECID118">
31262 <title>Private options for dnslookup</title>
31264 <indexterm role="concept">
31265 <primary>options</primary>
31266 <secondary><command>dnslookup</command> router</secondary>
31268 The private options for the <command>dnslookup</command> router are as follows:
31271 <indexterm role="option">
31272 <primary><option>check_secondary_mx</option></primary>
31275 <informaltable frame="all">
31276 <tgroup cols="4" colsep="0" rowsep="0">
31277 <colspec colwidth="8*" align="left"/>
31278 <colspec colwidth="6*" align="center"/>
31279 <colspec colwidth="6*" align="center"/>
31280 <colspec colwidth="6*" align="right"/>
31283 <entry><option>check_secondary_mx</option></entry>
31284 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31285 <entry>Type: <emphasis>boolean</emphasis></entry>
31286 <entry>Default: <emphasis>false</emphasis></entry>
31292 <indexterm role="concept">
31293 <primary>MX record</primary>
31294 <secondary>checking for secondary</secondary>
31296 If this option is set, the router declines unless the local host is found in
31297 (and removed from) the list of hosts obtained by MX lookup. This can be used to
31298 process domains for which the local host is a secondary mail exchanger
31299 differently to other domains. The way in which Exim decides whether a host is
31300 the local host is described in section <xref linkend="SECTreclocipadd"/>.
31303 <indexterm role="option">
31304 <primary><option>check_srv</option></primary>
31307 <informaltable frame="all">
31308 <tgroup cols="4" colsep="0" rowsep="0">
31309 <colspec colwidth="8*" align="left"/>
31310 <colspec colwidth="6*" align="center"/>
31311 <colspec colwidth="6*" align="center"/>
31312 <colspec colwidth="6*" align="right"/>
31315 <entry><option>check_srv</option></entry>
31316 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31317 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31318 <entry>Default: <emphasis>unset</emphasis></entry>
31324 <indexterm role="concept">
31325 <primary>SRV record</primary>
31326 <secondary>enabling use of</secondary>
31328 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
31329 addition to MX and address records. The support is disabled by default. To
31330 enable SRV support, set the <option>check_srv</option> option to the name of the service
31331 required. For example,
31333 <literallayout class="monospaced">
31337 looks for SRV records that refer to the normal smtp service. The option is
31338 expanded, so the service name can vary from message to message or address
31339 to address. This might be helpful if SRV records are being used for a
31340 submission service. If the expansion is forced to fail, the <option>check_srv</option>
31341 option is ignored, and the router proceeds to look for MX records in the
31345 When the expansion succeeds, the router searches first for SRV records for
31346 the given service (it assumes TCP protocol). A single SRV record with a
31347 host name that consists of just a single dot indicates <quote>no such service for
31348 this domain</quote>; if this is encountered, the router declines. If other kinds of
31349 SRV record are found, they are used to construct a host list for delivery
31350 according to the rules of RFC 2782. MX records are not sought in this case.
31353 When no SRV records are found, MX records (and address records) are sought in
31354 the traditional way. In other words, SRV records take precedence over MX
31355 records, just as MX records take precedence over address records. Note that
31356 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
31357 defined it. It is apparently believed that MX records are sufficient for email
31358 and that SRV records should not be used for this purpose. However, SRV records
31359 have an additional <quote>weight</quote> feature which some people might find useful when
31360 trying to split an SMTP load between hosts of different power.
31363 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim’s behaviour
31364 when there is a DNS lookup error.
31367 <indexterm role="option">
31368 <primary><option>mx_domains</option></primary>
31371 <informaltable frame="all">
31372 <tgroup cols="4" colsep="0" rowsep="0">
31373 <colspec colwidth="8*" align="left"/>
31374 <colspec colwidth="6*" align="center"/>
31375 <colspec colwidth="6*" align="center"/>
31376 <colspec colwidth="6*" align="right"/>
31379 <entry><option>mx_domains</option></entry>
31380 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31381 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31382 <entry>Default: <emphasis>unset</emphasis></entry>
31388 <indexterm role="concept">
31389 <primary>MX record</primary>
31390 <secondary>required to exist</secondary>
31392 <indexterm role="concept">
31393 <primary>SRV record</primary>
31394 <secondary>required to exist</secondary>
31396 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
31397 record in order to be recognized. (The name of this option could be improved.)
31398 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
31399 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
31402 <literallayout class="monospaced">
31403 mx_domains = ! *.discworld.fict.example : *.fict.example
31406 This specifies that messages addressed to a domain that matches the list but
31407 has no MX record should be bounced immediately instead of being routed using
31408 the address record.
31411 <indexterm role="option">
31412 <primary><option>mx_fail_domains</option></primary>
31415 <informaltable frame="all">
31416 <tgroup cols="4" colsep="0" rowsep="0">
31417 <colspec colwidth="8*" align="left"/>
31418 <colspec colwidth="6*" align="center"/>
31419 <colspec colwidth="6*" align="center"/>
31420 <colspec colwidth="6*" align="right"/>
31423 <entry><option>mx_fail_domains</option></entry>
31424 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31425 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31426 <entry>Default: <emphasis>unset</emphasis></entry>
31432 If the DNS lookup for MX records for one of the domains in this list causes a
31433 DNS lookup error, Exim behaves as if no MX records were found. See section
31434 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31437 <indexterm role="option">
31438 <primary><option>qualify_single</option></primary>
31441 <informaltable frame="all">
31442 <tgroup cols="4" colsep="0" rowsep="0">
31443 <colspec colwidth="8*" align="left"/>
31444 <colspec colwidth="6*" align="center"/>
31445 <colspec colwidth="6*" align="center"/>
31446 <colspec colwidth="6*" align="right"/>
31449 <entry><option>qualify_single</option></entry>
31450 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31451 <entry>Type: <emphasis>boolean</emphasis></entry>
31452 <entry>Default: <emphasis>true</emphasis></entry>
31458 <indexterm role="concept">
31459 <primary>DNS</primary>
31460 <secondary>resolver options</secondary>
31462 <indexterm role="concept">
31463 <primary>DNS</primary>
31464 <secondary>qualifying single-component names</secondary>
31466 When this option is true, the resolver option RES_DEFNAMES is set for DNS
31467 lookups. Typically, but not standardly, this causes the resolver to qualify
31468 single-component names with the default domain. For example, on a machine
31469 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
31470 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
31471 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
31472 <emphasis>resolv.conf</emphasis>.
31475 <indexterm role="option">
31476 <primary><option>rewrite_headers</option></primary>
31479 <informaltable frame="all">
31480 <tgroup cols="4" colsep="0" rowsep="0">
31481 <colspec colwidth="8*" align="left"/>
31482 <colspec colwidth="6*" align="center"/>
31483 <colspec colwidth="6*" align="center"/>
31484 <colspec colwidth="6*" align="right"/>
31487 <entry><option>rewrite_headers</option></entry>
31488 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31489 <entry>Type: <emphasis>boolean</emphasis></entry>
31490 <entry>Default: <emphasis>true</emphasis></entry>
31496 <indexterm role="concept">
31497 <primary>rewriting</primary>
31498 <secondary>header lines</secondary>
31500 <indexterm role="concept">
31501 <primary>header lines</primary>
31502 <secondary>rewriting</secondary>
31504 If the domain name in the address that is being processed is not fully
31505 qualified, it may be expanded to its full form by a DNS lookup. For example, if
31506 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
31507 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
31508 occur as a result of setting the <option>widen_domains</option> option. If
31509 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
31510 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
31511 header lines of the message are rewritten with the full domain name.
31514 This option should be turned off only when it is known that no message is
31515 ever going to be sent outside an environment where the abbreviation makes
31519 When an MX record is looked up in the DNS and matches a wildcard record, name
31520 servers normally return a record containing the name that has been looked up,
31521 making it impossible to detect whether a wildcard was present or not. However,
31522 some name servers have recently been seen to return the wildcard entry. If the
31523 name returned by a DNS lookup begins with an asterisk, it is not used for
31527 <indexterm role="option">
31528 <primary><option>same_domain_copy_routing</option></primary>
31531 <informaltable frame="all">
31532 <tgroup cols="4" colsep="0" rowsep="0">
31533 <colspec colwidth="8*" align="left"/>
31534 <colspec colwidth="6*" align="center"/>
31535 <colspec colwidth="6*" align="center"/>
31536 <colspec colwidth="6*" align="right"/>
31539 <entry><option>same_domain_copy_routing</option></entry>
31540 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31541 <entry>Type: <emphasis>boolean</emphasis></entry>
31542 <entry>Default: <emphasis>false</emphasis></entry>
31548 <indexterm role="concept">
31549 <primary>address</primary>
31550 <secondary>copying routing</secondary>
31552 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
31553 to the same list of hosts. However, this cannot be presumed, because the router
31554 options and preconditions may refer to the local part of the address. By
31555 default, therefore, Exim routes each address in a message independently. DNS
31556 servers run caches, so repeated DNS lookups are not normally expensive, and in
31557 any case, personal messages rarely have more than a few recipients.
31560 If you are running mailing lists with large numbers of subscribers at the same
31561 domain, and you are using a <command>dnslookup</command> router which is independent of the
31562 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31563 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
31564 routes an address to a remote transport, any other unrouted addresses in the
31565 message that have the same domain are automatically given the same routing
31566 without processing them independently,
31567 provided the following conditions are met:
31572 No router that processed the address specified <option>headers_add</option> or
31573 <option>headers_remove</option>.
31578 The router did not change the address in any way, for example, by <quote>widening</quote>
31584 <indexterm role="option">
31585 <primary><option>search_parents</option></primary>
31588 <informaltable frame="all">
31589 <tgroup cols="4" colsep="0" rowsep="0">
31590 <colspec colwidth="8*" align="left"/>
31591 <colspec colwidth="6*" align="center"/>
31592 <colspec colwidth="6*" align="center"/>
31593 <colspec colwidth="6*" align="right"/>
31596 <entry><option>search_parents</option></entry>
31597 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31598 <entry>Type: <emphasis>boolean</emphasis></entry>
31599 <entry>Default: <emphasis>false</emphasis></entry>
31605 <indexterm role="concept">
31606 <primary>DNS</primary>
31607 <secondary>resolver options</secondary>
31609 When this option is true, the resolver option RES_DNSRCH is set for DNS
31610 lookups. This is different from the <option>qualify_single</option> option in that it
31611 applies to domains containing dots. Typically, but not standardly, it causes
31612 the resolver to search for the name in the current domain and in parent
31613 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
31614 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
31615 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
31616 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
31619 Setting this option true can cause problems in domains that have a wildcard MX
31620 record, because any domain that does not have its own MX record matches the
31624 <indexterm role="option">
31625 <primary><option>srv_fail_domains</option></primary>
31628 <informaltable frame="all">
31629 <tgroup cols="4" colsep="0" rowsep="0">
31630 <colspec colwidth="8*" align="left"/>
31631 <colspec colwidth="6*" align="center"/>
31632 <colspec colwidth="6*" align="center"/>
31633 <colspec colwidth="6*" align="right"/>
31636 <entry><option>srv_fail_domains</option></entry>
31637 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31638 <entry>Type: <emphasis>domain list</emphasis>†<emphasis></emphasis></entry>
31639 <entry>Default: <emphasis>unset</emphasis></entry>
31645 If the DNS lookup for SRV records for one of the domains in this list causes a
31646 DNS lookup error, Exim behaves as if no SRV records were found. See section
31647 <xref linkend="SECTprowitdnsloo"/> for more discussion.
31650 <indexterm role="option">
31651 <primary><option>widen_domains</option></primary>
31654 <informaltable frame="all">
31655 <tgroup cols="4" colsep="0" rowsep="0">
31656 <colspec colwidth="8*" align="left"/>
31657 <colspec colwidth="6*" align="center"/>
31658 <colspec colwidth="6*" align="center"/>
31659 <colspec colwidth="6*" align="right"/>
31662 <entry><option>widen_domains</option></entry>
31663 <entry>Use: <emphasis>dnslookup</emphasis></entry>
31664 <entry>Type: <emphasis>string list</emphasis></entry>
31665 <entry>Default: <emphasis>unset</emphasis></entry>
31671 <indexterm role="concept">
31672 <primary>domain</primary>
31673 <secondary>partial; widening</secondary>
31675 If a DNS lookup fails and this option is set, each of its strings in turn is
31676 added onto the end of the domain, and the lookup is tried again. For example,
31679 <literallayout class="monospaced">
31680 widen_domains = fict.example:ref.example
31683 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
31684 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
31685 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
31686 and <option>search_parents</option> options can cause some widening to be undertaken inside
31687 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
31688 when verifying, unless <option>rewrite_headers</option> is false (not the default).
31691 <section id="SECID119">
31692 <title>Effect of qualify_single and search_parents</title>
31694 When a domain from an envelope recipient is changed by the resolver as a result
31695 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
31696 corresponding address in the message’s header lines unless <option>rewrite_headers</option>
31697 is set false. Exim then re-routes the address, using the full domain.
31700 These two options affect only the DNS lookup that takes place inside the router
31701 for the domain of the address that is being routed. They do not affect lookups
31702 such as that implied by
31704 <literallayout class="monospaced">
31708 that may happen while processing a router precondition before the router is
31709 entered. No widening ever takes place for these lookups.
31710 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
31711 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
31716 <chapter id="CHID5">
31717 <title>The ipliteral router</title>
31719 <indexterm role="concept">
31720 <primary><command>ipliteral</command> router</primary>
31722 <indexterm role="concept">
31723 <primary>domain literal</primary>
31724 <secondary>routing</secondary>
31726 <indexterm role="concept">
31727 <primary>routers</primary>
31728 <secondary><command>ipliteral</command></secondary>
31730 This router has no private options. Unless it is being used purely for
31731 verification (see <option>verify_only</option>) a transport is required to be defined by the
31732 generic <option>transport</option> option. The router accepts the address if its domain part
31733 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
31734 router handles the address
31736 <literallayout class="monospaced">
31740 by setting up delivery to the host with that IP address. IPv4 domain literals
31741 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
31742 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
31744 <literallayout class="monospaced">
31745 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
31748 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
31749 grounds that sooner or later somebody will try it.
31752 <indexterm role="option">
31753 <primary><option>self</option></primary>
31754 <secondary>in <command>ipliteral</command> router</secondary>
31756 If the IP address matches something in <option>ignore_target_hosts</option>, the router
31757 declines. If an IP literal turns out to refer to the local host, the generic
31758 <option>self</option> option determines what happens.
31761 The RFCs require support for domain literals; however, their use is
31762 controversial in today’s Internet. If you want to use this router, you must
31763 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
31764 Exim will not recognize the domain literal syntax in addresses.
31768 <chapter id="CHID6">
31769 <title>The iplookup router</title>
31771 <indexterm role="concept">
31772 <primary><command>iplookup</command> router</primary>
31774 <indexterm role="concept">
31775 <primary>routers</primary>
31776 <secondary><command>iplookup</command></secondary>
31778 The <command>iplookup</command> router was written to fulfil a specific requirement in
31779 Cambridge University (which in fact no longer exists). For this reason, it is
31780 not included in the binary of Exim by default. If you want to include it, you
31783 <literallayout class="monospaced">
31784 ROUTER_IPLOOKUP=yes
31787 in your <filename>Local/Makefile</filename> configuration file.
31790 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
31791 connection to one or more specific hosts. The host can then return the same or
31792 a different address – in effect rewriting the recipient address in the
31793 message’s envelope. The new address is then passed on to subsequent routers. If
31794 this process fails, the address can be passed on to other routers, or delivery
31795 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
31796 must not be specified for it.
31799 <indexterm role="concept">
31800 <primary>options</primary>
31801 <secondary><command>iplookup</command> router</secondary>
31803 <indexterm role="option">
31804 <primary><option>hosts</option></primary>
31807 <informaltable frame="all">
31808 <tgroup cols="4" colsep="0" rowsep="0">
31809 <colspec colwidth="8*" align="left"/>
31810 <colspec colwidth="6*" align="center"/>
31811 <colspec colwidth="6*" align="center"/>
31812 <colspec colwidth="6*" align="right"/>
31815 <entry><option>hosts</option></entry>
31816 <entry>Use: <emphasis>iplookup</emphasis></entry>
31817 <entry>Type: <emphasis>string</emphasis></entry>
31818 <entry>Default: <emphasis>unset</emphasis></entry>
31824 This option must be supplied. Its value is a colon-separated list of host
31825 names. The hosts are looked up using <function>gethostbyname()</function>
31826 (or <function>getipnodebyname()</function> when available)
31827 and are tried in order until one responds to the query. If none respond, what
31828 happens is controlled by <option>optional</option>.
31831 <indexterm role="option">
31832 <primary><option>optional</option></primary>
31835 <informaltable frame="all">
31836 <tgroup cols="4" colsep="0" rowsep="0">
31837 <colspec colwidth="8*" align="left"/>
31838 <colspec colwidth="6*" align="center"/>
31839 <colspec colwidth="6*" align="center"/>
31840 <colspec colwidth="6*" align="right"/>
31843 <entry><option>optional</option></entry>
31844 <entry>Use: <emphasis>iplookup</emphasis></entry>
31845 <entry>Type: <emphasis>boolean</emphasis></entry>
31846 <entry>Default: <emphasis>false</emphasis></entry>
31852 If <option>optional</option> is true, if no response is obtained from any host, the address
31853 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
31854 delivery to the address is deferred.
31857 <indexterm role="option">
31858 <primary><option>port</option></primary>
31861 <informaltable frame="all">
31862 <tgroup cols="4" colsep="0" rowsep="0">
31863 <colspec colwidth="8*" align="left"/>
31864 <colspec colwidth="6*" align="center"/>
31865 <colspec colwidth="6*" align="center"/>
31866 <colspec colwidth="6*" align="right"/>
31869 <entry><option>port</option></entry>
31870 <entry>Use: <emphasis>iplookup</emphasis></entry>
31871 <entry>Type: <emphasis>integer</emphasis></entry>
31872 <entry>Default: <emphasis>0</emphasis></entry>
31878 <indexterm role="concept">
31879 <primary>port</primary>
31880 <secondary><command>iplookup</command> router</secondary>
31882 This option must be supplied. It specifies the port number for the TCP or UDP
31886 <indexterm role="option">
31887 <primary><option>protocol</option></primary>
31890 <informaltable frame="all">
31891 <tgroup cols="4" colsep="0" rowsep="0">
31892 <colspec colwidth="8*" align="left"/>
31893 <colspec colwidth="6*" align="center"/>
31894 <colspec colwidth="6*" align="center"/>
31895 <colspec colwidth="6*" align="right"/>
31898 <entry><option>protocol</option></entry>
31899 <entry>Use: <emphasis>iplookup</emphasis></entry>
31900 <entry>Type: <emphasis>string</emphasis></entry>
31901 <entry>Default: <emphasis>udp</emphasis></entry>
31907 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
31908 protocols is to be used.
31911 <indexterm role="option">
31912 <primary><option>query</option></primary>
31915 <informaltable frame="all">
31916 <tgroup cols="4" colsep="0" rowsep="0">
31917 <colspec colwidth="8*" align="left"/>
31918 <colspec colwidth="6*" align="center"/>
31919 <colspec colwidth="6*" align="center"/>
31920 <colspec colwidth="6*" align="right"/>
31923 <entry><option>query</option></entry>
31924 <entry>Use: <emphasis>iplookup</emphasis></entry>
31925 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31926 <entry>Default: <emphasis>see below</emphasis></entry>
31932 This defines the content of the query that is sent to the remote hosts. The
31935 <literallayout class="monospaced">
31936 $local_part@$domain $local_part@$domain
31939 The repetition serves as a way of checking that a response is to the correct
31940 query in the default case (see <option>response_pattern</option> below).
31943 <indexterm role="option">
31944 <primary><option>reroute</option></primary>
31947 <informaltable frame="all">
31948 <tgroup cols="4" colsep="0" rowsep="0">
31949 <colspec colwidth="8*" align="left"/>
31950 <colspec colwidth="6*" align="center"/>
31951 <colspec colwidth="6*" align="center"/>
31952 <colspec colwidth="6*" align="right"/>
31955 <entry><option>reroute</option></entry>
31956 <entry>Use: <emphasis>iplookup</emphasis></entry>
31957 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
31958 <entry>Default: <emphasis>unset</emphasis></entry>
31964 If this option is not set, the rerouted address is precisely the byte string
31965 returned by the remote host, up to the first white space, if any. If set, the
31966 string is expanded to form the rerouted address. It can include parts matched
31967 in the response by <option>response_pattern</option> by means of numeric variables such as
31968 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
31969 whether or not a pattern is in use. In all cases, the rerouted address must end
31970 up in the form <emphasis>local_part@domain</emphasis>.
31973 <indexterm role="option">
31974 <primary><option>response_pattern</option></primary>
31977 <informaltable frame="all">
31978 <tgroup cols="4" colsep="0" rowsep="0">
31979 <colspec colwidth="8*" align="left"/>
31980 <colspec colwidth="6*" align="center"/>
31981 <colspec colwidth="6*" align="center"/>
31982 <colspec colwidth="6*" align="right"/>
31985 <entry><option>response_pattern</option></entry>
31986 <entry>Use: <emphasis>iplookup</emphasis></entry>
31987 <entry>Type: <emphasis>string</emphasis></entry>
31988 <entry>Default: <emphasis>unset</emphasis></entry>
31994 This option can be set to a regular expression that is applied to the string
31995 returned from the remote host. If the pattern does not match the response, the
31996 router declines. If <option>response_pattern</option> is not set, no checking of the
31997 response is done, unless the query was defaulted, in which case there is a
31998 check that the text returned after the first white space is the original
31999 address. This checks that the answer that has been received is in response to
32000 the correct question. For example, if the response is just a new domain, the
32001 following could be used:
32003 <literallayout class="monospaced">
32004 response_pattern = ^([^@]+)$
32005 reroute = $local_part@$1
32008 <indexterm role="option">
32009 <primary><option>timeout</option></primary>
32012 <informaltable frame="all">
32013 <tgroup cols="4" colsep="0" rowsep="0">
32014 <colspec colwidth="8*" align="left"/>
32015 <colspec colwidth="6*" align="center"/>
32016 <colspec colwidth="6*" align="center"/>
32017 <colspec colwidth="6*" align="right"/>
32020 <entry><option>timeout</option></entry>
32021 <entry>Use: <emphasis>iplookup</emphasis></entry>
32022 <entry>Type: <emphasis>time</emphasis></entry>
32023 <entry>Default: <emphasis>5s</emphasis></entry>
32029 This specifies the amount of time to wait for a response from the remote
32030 machine. The same timeout is used for the <function>connect()</function> function for a TCP
32031 call. It does not apply to UDP.
32035 <chapter id="CHID7">
32036 <title>The manualroute router</title>
32038 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
32039 <primary><command>manualroute</command> router</primary>
32041 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
32042 <primary>routers</primary>
32043 <secondary><command>manualroute</command></secondary>
32045 <indexterm role="concept">
32046 <primary>domain</primary>
32047 <secondary>manually routing</secondary>
32049 The <command>manualroute</command> router is so-called because it provides a way of manually
32050 routing an address according to its domain. It is mainly used when you want to
32051 route addresses to remote hosts according to your own rules, bypassing the
32052 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
32053 route to local transports, a facility that may be useful if you want to save
32054 messages for dial-in hosts in local files.
32057 The <command>manualroute</command> router compares a list of domain patterns with the domain
32058 it is trying to route. If there is no match, the router declines. Each pattern
32059 has associated with it a list of hosts and some other optional data, which may
32060 include a transport. The combination of a pattern and its data is called a
32061 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
32062 generic <option>transport</option> option must specify a transport, unless the router is
32063 being used purely for verification (see <option>verify_only</option>).
32066 <indexterm role="variable">
32067 <primary><varname>$host</varname></primary>
32069 In the case of verification, matching the domain pattern is sufficient for the
32070 router to accept the address. When actually routing an address for delivery,
32071 an address that matches a domain pattern is queued for the associated
32072 transport. If the transport is not a local one, a host list must be associated
32073 with the pattern; IP addresses are looked up for the hosts, and these are
32074 passed to the transport along with the mail address. For local transports, a
32075 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
32079 The list of routing rules can be provided as an inline string in
32080 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
32081 or database by setting <option>route_data</option>. Only one of these settings may appear in
32082 any one instance of <command>manualroute</command>. The format of routing rules is described
32083 below, following the list of private options.
32085 <section id="SECTprioptman">
32086 <title>Private options for manualroute</title>
32088 <indexterm role="concept">
32089 <primary>options</primary>
32090 <secondary><command>manualroute</command> router</secondary>
32092 The private options for the <command>manualroute</command> router are as follows:
32095 <indexterm role="option">
32096 <primary><option>host_all_ignored</option></primary>
32099 <informaltable frame="all">
32100 <tgroup cols="4" colsep="0" rowsep="0">
32101 <colspec colwidth="8*" align="left"/>
32102 <colspec colwidth="6*" align="center"/>
32103 <colspec colwidth="6*" align="center"/>
32104 <colspec colwidth="6*" align="right"/>
32107 <entry><option>host_all_ignored</option></entry>
32108 <entry>Use: <emphasis>manualroute</emphasis></entry>
32109 <entry>Type: <emphasis>string</emphasis></entry>
32110 <entry>Default: <emphasis>defer</emphasis></entry>
32116 See <option>host_find_failed</option>.
32119 <indexterm role="option">
32120 <primary><option>host_find_failed</option></primary>
32123 <informaltable frame="all">
32124 <tgroup cols="4" colsep="0" rowsep="0">
32125 <colspec colwidth="8*" align="left"/>
32126 <colspec colwidth="6*" align="center"/>
32127 <colspec colwidth="6*" align="center"/>
32128 <colspec colwidth="6*" align="right"/>
32131 <entry><option>host_find_failed</option></entry>
32132 <entry>Use: <emphasis>manualroute</emphasis></entry>
32133 <entry>Type: <emphasis>string</emphasis></entry>
32134 <entry>Default: <emphasis>freeze</emphasis></entry>
32140 This option controls what happens when <command>manualroute</command> tries to find an IP
32141 address for a host, and the host does not exist. The option can be set to one
32142 of the following values:
32144 <literallayout class="monospaced">
32153 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
32154 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
32155 forces the address to be passed to the next router (or the router defined by
32156 <option>pass_router</option>),
32157 <indexterm role="option">
32158 <primary><option>more</option></primary>
32160 overriding <option>no_more</option>, whereas the latter passes the address to the next
32161 router only if <option>more</option> is true.
32164 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
32165 cannot be found. If all the hosts in the list are ignored, the behaviour is
32166 controlled by the <option>host_all_ignored</option> option. This takes the same values
32167 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
32170 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
32171 state; if a host lookup gets a temporary error, delivery is deferred unless the
32172 generic <option>pass_on_timeout</option> option is set.
32175 <indexterm role="option">
32176 <primary><option>hosts_randomize</option></primary>
32179 <informaltable frame="all">
32180 <tgroup cols="4" colsep="0" rowsep="0">
32181 <colspec colwidth="8*" align="left"/>
32182 <colspec colwidth="6*" align="center"/>
32183 <colspec colwidth="6*" align="center"/>
32184 <colspec colwidth="6*" align="right"/>
32187 <entry><option>hosts_randomize</option></entry>
32188 <entry>Use: <emphasis>manualroute</emphasis></entry>
32189 <entry>Type: <emphasis>boolean</emphasis></entry>
32190 <entry>Default: <emphasis>false</emphasis></entry>
32196 <indexterm role="concept">
32197 <primary>randomized host list</primary>
32199 <indexterm role="concept">
32200 <primary>host</primary>
32201 <secondary>list of; randomized</secondary>
32203 If this option is set, the order of the items in a host list in a routing rule
32204 is randomized each time the list is used, unless an option in the routing rule
32205 overrides (see below). Randomizing the order of a host list can be used to do
32206 crude load sharing. However, if more than one mail address is routed by the
32207 same router to the same host list, the host lists are considered to be the same
32208 (even though they may be randomized into different orders) for the purpose of
32209 deciding whether to batch the deliveries into a single SMTP transaction.
32212 When <option>hosts_randomize</option> is true, a host list may be split
32213 into groups whose order is separately randomized. This makes it possible to
32214 set up MX-like behaviour. The boundaries between groups are indicated by an
32215 item that is just <literal>+</literal> in the host list. For example:
32217 <literallayout class="monospaced">
32218 route_list = * host1:host2:host3:+:host4:host5
32221 The order of the first three hosts and the order of the last two hosts is
32222 randomized for each use, but the first three always end up before the last two.
32223 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
32224 randomized host list is passed to an <command>smtp</command> transport that also has
32225 <option>hosts_randomize set</option>, the list is not re-randomized.
32228 <indexterm role="option">
32229 <primary><option>route_data</option></primary>
32232 <informaltable frame="all">
32233 <tgroup cols="4" colsep="0" rowsep="0">
32234 <colspec colwidth="8*" align="left"/>
32235 <colspec colwidth="6*" align="center"/>
32236 <colspec colwidth="6*" align="center"/>
32237 <colspec colwidth="6*" align="right"/>
32240 <entry><option>route_data</option></entry>
32241 <entry>Use: <emphasis>manualroute</emphasis></entry>
32242 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32243 <entry>Default: <emphasis>unset</emphasis></entry>
32249 If this option is set, it must expand to yield the data part of a routing rule.
32250 Typically, the expansion string includes a lookup based on the domain. For
32253 <literallayout class="monospaced">
32254 route_data = ${lookup{$domain}dbm{/etc/routes}}
32257 If the expansion is forced to fail, or the result is an empty string, the
32258 router declines. Other kinds of expansion failure cause delivery to be
32262 <indexterm role="option">
32263 <primary><option>route_list</option></primary>
32266 <informaltable frame="all">
32267 <tgroup cols="4" colsep="0" rowsep="0">
32268 <colspec colwidth="8*" align="left"/>
32269 <colspec colwidth="6*" align="center"/>
32270 <colspec colwidth="6*" align="center"/>
32271 <colspec colwidth="6*" align="right"/>
32274 <entry><option>route_list</option></entry>
32275 <entry>Use: <emphasis>manualroute</emphasis></entry>
32276 <entry>Type: <emphasis>string list</emphasis></entry>
32277 <entry>Default: <emphasis>unset</emphasis></entry>
32283 This string is a list of routing rules, in the form defined below. Note that,
32284 unlike most string lists, the items are separated by semicolons. This is so
32285 that they may contain colon-separated host lists.
32288 <indexterm role="option">
32289 <primary><option>same_domain_copy_routing</option></primary>
32292 <informaltable frame="all">
32293 <tgroup cols="4" colsep="0" rowsep="0">
32294 <colspec colwidth="8*" align="left"/>
32295 <colspec colwidth="6*" align="center"/>
32296 <colspec colwidth="6*" align="center"/>
32297 <colspec colwidth="6*" align="right"/>
32300 <entry><option>same_domain_copy_routing</option></entry>
32301 <entry>Use: <emphasis>manualroute</emphasis></entry>
32302 <entry>Type: <emphasis>boolean</emphasis></entry>
32303 <entry>Default: <emphasis>false</emphasis></entry>
32309 <indexterm role="concept">
32310 <primary>address</primary>
32311 <secondary>copying routing</secondary>
32313 Addresses with the same domain are normally routed by the <command>manualroute</command>
32314 router to the same list of hosts. However, this cannot be presumed, because the
32315 router options and preconditions may refer to the local part of the address. By
32316 default, therefore, Exim routes each address in a message independently. DNS
32317 servers run caches, so repeated DNS lookups are not normally expensive, and in
32318 any case, personal messages rarely have more than a few recipients.
32321 If you are running mailing lists with large numbers of subscribers at the same
32322 domain, and you are using a <command>manualroute</command> router which is independent of the
32323 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
32324 lookups for identical domains in one message. In this case, when
32325 <command>manualroute</command> routes an address to a remote transport, any other unrouted
32326 addresses in the message that have the same domain are automatically given the
32327 same routing without processing them independently. However, this is only done
32328 if <option>headers_add</option> and <option>headers_remove</option> are unset.
32331 <section id="SECID120">
32332 <title>Routing rules in route_list</title>
32334 The value of <option>route_list</option> is a string consisting of a sequence of routing
32335 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
32336 entered as two semicolons. Alternatively, the list separator can be changed as
32337 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
32338 Empty rules are ignored. The format of each rule is
32341 <<emphasis>domain pattern</emphasis>> <<emphasis>list of hosts</emphasis>> <<emphasis>options</emphasis>>
32344 The following example contains two rules, each with a simple domain pattern and
32347 <literallayout class="monospaced">
32349 dict.ref.example mail-1.ref.example:mail-2.ref.example ; \
32350 thes.ref.example mail-3.ref.example:mail-4.ref.example
32353 The three parts of a rule are separated by white space. The pattern and the
32354 list of hosts can be enclosed in quotes if necessary, and if they are, the
32355 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
32356 single domain pattern, which is the only mandatory item in the rule. The
32357 pattern is in the same format as one item in a domain list (see section
32358 <xref linkend="SECTdomainlist"/>),
32359 except that it may not be the name of an interpolated file.
32360 That is, it may be wildcarded, or a regular expression, or a file or database
32361 lookup (with semicolons doubled, because of the use of semicolon as a separator
32362 in a <option>route_list</option>).
32365 The rules in <option>route_list</option> are searched in order until one of the patterns
32366 matches the domain that is being routed. The list of hosts and then options are
32367 then used as described below. If there is no match, the router declines. When
32368 <option>route_list</option> is set, <option>route_data</option> must not be set.
32371 <section id="SECID121">
32372 <title>Routing rules in route_data</title>
32374 The use of <option>route_list</option> is convenient when there are only a small number of
32375 routing rules. For larger numbers, it is easier to use a file or database to
32376 hold the routing information, and use the <option>route_data</option> option instead.
32377 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
32378 Most commonly, <option>route_data</option> is set as a string that contains an
32379 expansion lookup. For example, suppose we place two routing rules in a file
32382 <literallayout class="monospaced">
32383 dict.ref.example: mail-1.ref.example:mail-2.ref.example
32384 thes.ref.example: mail-3.ref.example:mail-4.ref.example
32387 This data can be accessed by setting
32389 <literallayout class="monospaced">
32390 route_data = ${lookup{$domain}lsearch{/the/file/name}}
32393 Failure of the lookup results in an empty string, causing the router to
32394 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
32395 requirement is that the result of expanding the string is a list of hosts,
32396 possibly followed by options, separated by white space. The list of hosts must
32397 be enclosed in quotes if it contains white space.
32400 <section id="SECID122">
32401 <title>Format of the list of hosts</title>
32403 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
32404 always separately expanded before use. If the expansion fails, the router
32405 declines. The result of the expansion must be a colon-separated list of names
32406 and/or IP addresses, optionally also including ports. The format of each item
32407 in the list is described in the next section. The list separator can be changed
32408 as described in section <xref linkend="SECTlistconstruct"/>.
32411 If the list of hosts was obtained from a <option>route_list</option> item, the following
32412 variables are set during its expansion:
32417 <indexterm role="concept">
32418 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
32419 <secondary>in <command>manualroute</command> router</secondary>
32421 If the domain was matched against a regular expression, the numeric variables
32422 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
32424 <literallayout class="monospaced">
32425 route_list = ^domain(\d+) host-$1.text.example
32430 <varname>$0</varname> is always set to the entire domain.
32435 <varname>$1</varname> is also set when partial matching is done in a file lookup.
32440 <indexterm role="variable">
32441 <primary><varname>$value</varname></primary>
32443 If the pattern that matched the domain was a lookup item, the data that was
32444 looked up is available in the expansion variable <varname>$value</varname>. For example:
32446 <literallayout class="monospaced">
32447 route_list = lsearch;;/some/file.routes $value
32452 Note the doubling of the semicolon in the pattern that is necessary because
32453 semicolon is the default route list separator.
32456 <section id="SECTformatonehostitem">
32457 <title>Format of one host item</title>
32459 Each item in the list of hosts is either a host name or an IP address,
32460 optionally with an attached port number. When no port is given, an IP address
32461 is not enclosed in brackets. When a port is specified, it overrides the port
32462 specification on the transport. The port is separated from the name or address
32463 by a colon. This leads to some complications:
32468 Because colon is the default separator for the list of hosts, either
32469 the colon that specifies a port must be doubled, or the list separator must
32470 be changed. The following two examples have the same effect:
32472 <literallayout class="monospaced">
32473 route_list = * "host1.tld::1225 : host2.tld::1226"
32474 route_list = * "<+ host1.tld:1225 + host2.tld:1226"
32479 When IPv6 addresses are involved, it gets worse, because they contain
32480 colons of their own. To make this case easier, it is permitted to
32481 enclose an IP address (either v4 or v6) in square brackets if a port
32482 number follows. For example:
32484 <literallayout class="monospaced">
32485 route_list = * "</ [10.1.1.1]:1225 / [::1]:1226"
32490 <section id="SECThostshowused">
32491 <title>How the list of hosts is used</title>
32493 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
32494 the hosts is tried, in the order specified, when carrying out the SMTP
32495 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
32496 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
32500 Hosts may be listed by name or by IP address. An unadorned name in the list of
32501 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
32502 interpreted as an indirection to a sublist of hosts obtained by looking up MX
32503 records in the DNS. For example:
32505 <literallayout class="monospaced">
32506 route_list = * x.y.z:p.q.r/MX:e.f.g
32509 If this feature is used with a port specifier, the port must come last. For
32512 <literallayout class="monospaced">
32513 route_list = * dom1.tld/mx::1225
32516 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
32517 randomized before any lookups are done. Exim then scans the list; for any name
32518 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
32519 be an interface on the local host and the item is not the first in the list,
32520 Exim discards it and any subsequent items. If it is the first item, what
32521 happens is controlled by the
32522 <indexterm role="option">
32523 <primary><option>self</option></primary>
32524 <secondary>in <command>manualroute</command> router</secondary>
32526 <option>self</option> option of the router.
32529 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
32530 hosts obtained by looking up MX records for the name. This is always a DNS
32531 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
32532 below) are not relevant here. The order of these hosts is determined by the
32533 preference values in the MX records, according to the usual rules. Because
32534 randomizing happens before the MX lookup, it does not affect the order that is
32535 defined by MX preferences.
32538 If the local host is present in the sublist obtained from MX records, but is
32539 not the most preferred host in that list, it and any equally or less
32540 preferred hosts are removed before the sublist is inserted into the main list.
32543 If the local host is the most preferred host in the MX list, what happens
32544 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
32545 is not the first item (that is, there are previous hosts in the main list),
32546 Exim discards this name and any subsequent items in the main list.
32549 If the MX item is first in the list of hosts, and the local host is the
32550 most preferred host, what happens is controlled by the <option>self</option> option of the
32554 DNS failures when lookup up the MX records are treated in the same way as DNS
32555 failures when looking up IP addresses: <option>pass_on_timeout</option> and
32556 <option>host_find_failed</option> are used when relevant.
32559 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
32560 whether obtained from an MX lookup or not.
32563 <section id="SECThowoptused">
32564 <title>How the options are used</title>
32566 The options are a sequence of words; in practice no more than three are ever
32567 present. One of the words can be the name of a transport; this overrides the
32568 <option>transport</option> option on the router for this particular routing rule only. The
32569 other words (if present) control randomization of the list of hosts on a
32570 per-rule basis, and how the IP addresses of the hosts are to be found when
32571 routing to a remote transport. These options are as follows:
32576 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
32577 setting of <option>hosts_randomize</option> for this routing rule only.
32582 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
32583 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
32588 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
32589 find IP addresses. This function may ultimately cause a DNS lookup, but it may
32590 also look in <filename>/etc/hosts</filename> or other sources of information.
32595 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
32596 no address records are found. If there is a temporary DNS error (such as a
32597 timeout), delivery is deferred.
32604 <literallayout class="monospaced">
32605 route_list = domain1 host1:host2:host3 randomize bydns;\
32606 domain2 host4:host5
32609 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
32610 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
32611 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
32612 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
32616 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
32617 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
32618 instead of TRY_AGAIN. That is why the default action is to try a DNS
32619 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
32623 If no IP address for a host can be found, what happens is controlled by the
32624 <option>host_find_failed</option> option.
32627 <indexterm role="variable">
32628 <primary><varname>$host</varname></primary>
32630 When an address is routed to a local transport, IP addresses are not looked up.
32631 The host list is passed to the transport in the <varname>$host</varname> variable.
32634 <section id="SECID123">
32635 <title>Manualroute examples</title>
32637 In some of the examples that follow, the presence of the <option>remote_smtp</option>
32638 transport, as defined in the default configuration file, is assumed:
32643 <indexterm role="concept">
32644 <primary>smart host</primary>
32645 <secondary>example router</secondary>
32647 The <command>manualroute</command> router can be used to forward all external mail to a
32648 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
32649 named domain list that contains your local domains, for example:
32651 <literallayout class="monospaced">
32652 domainlist local_domains = my.domain.example
32655 You can arrange for all other domains to be routed to a smart host by making
32656 your first router something like this:
32658 <literallayout class="monospaced">
32660 driver = manualroute
32661 domains = !+local_domains
32662 transport = remote_smtp
32663 route_list = * smarthost.ref.example
32666 This causes all non-local addresses to be sent to the single host
32667 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
32668 they are tried in order
32669 (but you can use <option>hosts_randomize</option> to vary the order each time).
32670 Another way of configuring the same thing is this:
32672 <literallayout class="monospaced">
32674 driver = manualroute
32675 transport = remote_smtp
32676 route_list = !+local_domains smarthost.ref.example
32679 There is no difference in behaviour between these two routers as they stand.
32680 However, they behave differently if <option>no_more</option> is added to them. In the first
32681 example, the router is skipped if the domain does not match the <option>domains</option>
32682 precondition; the following router is always tried. If the router runs, it
32683 always matches the domain and so can never decline. Therefore, <option>no_more</option>
32684 would have no effect. In the second case, the router is never skipped; it
32685 always runs. However, if it doesn’t match the domain, it declines. In this case
32686 <option>no_more</option> would prevent subsequent routers from running.
32691 <indexterm role="concept">
32692 <primary>mail hub example</primary>
32694 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
32695 records in the DNS and delivers it via its own private routing mechanism. Often
32696 the final destinations are behind a firewall, with the mail hub being the one
32697 machine that can connect to machines both inside and outside the firewall. The
32698 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
32699 to the correct hosts. For a small number of domains, the routing can be inline,
32700 using the <option>route_list</option> option, but for a larger number a file or database
32701 lookup is easier to manage.
32704 If the domain names are in fact the names of the machines to which the mail is
32705 to be sent by the mail hub, the configuration can be quite simple. For
32708 <literallayout class="monospaced">
32710 driver = manualroute
32711 transport = remote_smtp
32712 route_list = *.rhodes.tvs.example $domain
32715 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
32716 whose names are the same as the mail domains. A similar approach can be taken
32717 if the host name can be obtained from the domain name by a string manipulation
32718 that the expansion facilities can handle. Otherwise, a lookup based on the
32719 domain can be used to find the host:
32721 <literallayout class="monospaced">
32723 driver = manualroute
32724 transport = remote_smtp
32725 route_data = ${lookup {$domain} cdb {/internal/host/routes}}
32728 The result of the lookup must be the name or IP address of the host (or
32729 hosts) to which the address is to be routed. If the lookup fails, the route
32730 data is empty, causing the router to decline. The address then passes to the
32736 <indexterm role="concept">
32737 <primary>batched SMTP output example</primary>
32739 <indexterm role="concept">
32740 <primary>SMTP</primary>
32741 <secondary>batched outgoing; example</secondary>
32743 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
32744 SMTP format for onward transportation by some other means. This is one way of
32745 storing mail for a dial-up host when it is not connected. The route list entry
32746 can be as simple as a single domain name in a configuration like this:
32748 <literallayout class="monospaced">
32750 driver = manualroute
32751 transport = batchsmtp_appendfile
32752 route_list = saved.domain.example
32755 though often a pattern is used to pick up more than one domain. If there are
32756 several domains or groups of domains with different transport requirements,
32757 different transports can be listed in the routing information:
32759 <literallayout class="monospaced">
32761 driver = manualroute
32763 *.saved.domain1.example $domain batch_appendfile; \
32764 *.saved.domain2.example \
32765 ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
32769 <indexterm role="variable">
32770 <primary><varname>$domain</varname></primary>
32772 <indexterm role="variable">
32773 <primary><varname>$host</varname></primary>
32775 The first of these just passes the domain in the <varname>$host</varname> variable, which
32776 doesn’t achieve much (since it is also in <varname>$domain</varname>), but the second does a
32777 file lookup to find a value to pass, causing the router to decline to handle
32778 the address if the lookup fails.
32783 <indexterm role="concept">
32784 <primary>UUCP</primary>
32785 <secondary>example of router for</secondary>
32787 Routing mail directly to UUCP software is a specific case of the use of
32788 <command>manualroute</command> in a gateway to another mail environment. This is an example of
32789 one way it can be done:
32791 <literallayout class="monospaced">
32796 command = /usr/local/bin/uux -r - \
32797 ${substr_-5:$host}!rmail ${local_part}
32798 return_fail_output = true
32803 driver = manualroute
32805 ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
32808 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
32810 <literallayout class="monospaced">
32811 darksite.ethereal.example: darksite.UUCP
32814 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
32815 makes clear the distinction between the domain name
32816 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
32821 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
32822 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
32827 <chapter id="CHAPdriverlast">
32828 <title>The queryprogram router</title>
32830 <indexterm role="concept" id="IIDquerou1" class="startofrange">
32831 <primary><command>queryprogram</command> router</primary>
32833 <indexterm role="concept" id="IIDquerou2" class="startofrange">
32834 <primary>routers</primary>
32835 <secondary><command>queryprogram</command></secondary>
32837 <indexterm role="concept">
32838 <primary>routing</primary>
32839 <secondary>by external program</secondary>
32841 The <command>queryprogram</command> router routes an address by running an external command
32842 and acting on its output. This is an expensive way to route, and is intended
32843 mainly for use in lightly-loaded systems, or for performing experiments.
32844 However, if it is possible to use the precondition options (<option>domains</option>,
32845 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
32846 be used in special cases, even on a busy host. There are the following private
32848 <indexterm role="concept">
32849 <primary>options</primary>
32850 <secondary><command>queryprogram</command> router</secondary>
32854 <indexterm role="option">
32855 <primary><option>command</option></primary>
32858 <informaltable frame="all">
32859 <tgroup cols="4" colsep="0" rowsep="0">
32860 <colspec colwidth="8*" align="left"/>
32861 <colspec colwidth="6*" align="center"/>
32862 <colspec colwidth="6*" align="center"/>
32863 <colspec colwidth="6*" align="right"/>
32866 <entry><option>command</option></entry>
32867 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32868 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
32869 <entry>Default: <emphasis>unset</emphasis></entry>
32875 This option must be set. It specifies the command that is to be run. The
32876 command is split up into a command name and arguments, and then each is
32877 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
32878 <xref linkend="CHAPpipetransport"/>).
32881 <indexterm role="option">
32882 <primary><option>command_group</option></primary>
32885 <informaltable frame="all">
32886 <tgroup cols="4" colsep="0" rowsep="0">
32887 <colspec colwidth="8*" align="left"/>
32888 <colspec colwidth="6*" align="center"/>
32889 <colspec colwidth="6*" align="center"/>
32890 <colspec colwidth="6*" align="right"/>
32893 <entry><option>command_group</option></entry>
32894 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32895 <entry>Type: <emphasis>string</emphasis></entry>
32896 <entry>Default: <emphasis>unset</emphasis></entry>
32902 <indexterm role="concept">
32903 <primary>gid (group id)</primary>
32904 <secondary>in <command>queryprogram</command> router</secondary>
32906 This option specifies a gid to be set when running the command while routing an
32907 address for deliver. It must be set if <option>command_user</option> specifies a numerical
32908 uid. If it begins with a digit, it is interpreted as the numerical value of the
32909 gid. Otherwise it is looked up using <function>getgrnam()</function>.
32912 <indexterm role="option">
32913 <primary><option>command_user</option></primary>
32916 <informaltable frame="all">
32917 <tgroup cols="4" colsep="0" rowsep="0">
32918 <colspec colwidth="8*" align="left"/>
32919 <colspec colwidth="6*" align="center"/>
32920 <colspec colwidth="6*" align="center"/>
32921 <colspec colwidth="6*" align="right"/>
32924 <entry><option>command_user</option></entry>
32925 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32926 <entry>Type: <emphasis>string</emphasis></entry>
32927 <entry>Default: <emphasis>unset</emphasis></entry>
32933 <indexterm role="concept">
32934 <primary>uid (user id)</primary>
32935 <secondary>for <command>queryprogram</command></secondary>
32937 This option must be set. It specifies the uid which is set when running the
32938 command while routing an address for delivery. If the value begins with a digit,
32939 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
32940 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
32941 not set, a value for the gid also.
32944 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
32945 root, which it does during a normal delivery in a conventional configuration.
32946 However, when an address is being verified during message reception, Exim is
32947 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
32948 is called from a non-root process, Exim cannot change uid or gid before running
32949 the command. In this circumstance the command runs under the current uid and
32953 <indexterm role="option">
32954 <primary><option>current_directory</option></primary>
32957 <informaltable frame="all">
32958 <tgroup cols="4" colsep="0" rowsep="0">
32959 <colspec colwidth="8*" align="left"/>
32960 <colspec colwidth="6*" align="center"/>
32961 <colspec colwidth="6*" align="center"/>
32962 <colspec colwidth="6*" align="right"/>
32965 <entry><option>current_directory</option></entry>
32966 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32967 <entry>Type: <emphasis>string</emphasis></entry>
32968 <entry>Default: <emphasis>/</emphasis></entry>
32974 This option specifies an absolute path which is made the current directory
32975 before running the command.
32978 <indexterm role="option">
32979 <primary><option>timeout</option></primary>
32982 <informaltable frame="all">
32983 <tgroup cols="4" colsep="0" rowsep="0">
32984 <colspec colwidth="8*" align="left"/>
32985 <colspec colwidth="6*" align="center"/>
32986 <colspec colwidth="6*" align="center"/>
32987 <colspec colwidth="6*" align="right"/>
32990 <entry><option>timeout</option></entry>
32991 <entry>Use: <emphasis>queryprogram</emphasis></entry>
32992 <entry>Type: <emphasis>time</emphasis></entry>
32993 <entry>Default: <emphasis>1h</emphasis></entry>
32999 If the command does not complete within the timeout period, its process group
33000 is killed and the message is frozen. A value of zero time specifies no
33004 The standard output of the command is connected to a pipe, which is read when
33005 the command terminates. It should consist of a single line of output,
33006 containing up to five fields, separated by white space. The maximum length of
33007 the line is 1023 characters. Longer lines are silently truncated. The first
33008 field is one of the following words (case-insensitive):
33013 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
33019 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
33020 <option>no_more</option> is set.
33025 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
33026 subsequent text on the line is an error message. If the router is run as part
33027 of address verification during an incoming SMTP message, the message is
33028 included in the SMTP response.
33033 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
33034 subsequent text on the line is an error message which is logged. It is not
33035 included in any SMTP response.
33040 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
33045 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
33046 <option>pass_router</option>), overriding <option>no_more</option>.
33051 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
33052 new addresses, which are routed independently, starting with the first router,
33053 or the router specified by <option>redirect_router</option>, if set.
33058 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
33059 number of keyed data values, as follows (split into two lines here, to fit on
33062 <literallayout class="monospaced">
33063 ACCEPT TRANSPORT=<transport> HOSTS=<list of hosts>
33064 LOOKUP=byname|bydns DATA=<text>
33067 The data items can be given in any order, and all are optional. If no transport
33068 is included, the transport specified by the generic <option>transport</option> option is
33069 used. The list of hosts and the lookup type are needed only if the transport is
33070 an <command>smtp</command> transport that does not itself supply a list of hosts.
33073 The format of the list of hosts is the same as for the <command>manualroute</command> router.
33074 As well as host names and IP addresses with optional port numbers, as described
33075 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
33076 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
33077 (see section <xref linkend="SECThostshowused"/>).
33080 If the lookup type is not specified, Exim behaves as follows when trying to
33081 find an IP address for each host: First, a DNS lookup is done. If this yields
33082 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
33083 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
33084 result of the lookup is the result of that call.
33087 <indexterm role="variable">
33088 <primary><varname>$address_data</varname></primary>
33090 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
33091 variable. For example, this return line
33093 <literallayout class="monospaced">
33094 accept hosts=x1.y.example:x2.y.example data="rule1"
33097 routes the address to the default transport, passing a list of two hosts. When
33098 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
33099 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
33100 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
33104 <chapter id="CHAPredirect">
33105 <title>The redirect router</title>
33107 <indexterm role="concept" id="IIDredrou1" class="startofrange">
33108 <primary><command>redirect</command> router</primary>
33110 <indexterm role="concept" id="IIDredrou2" class="startofrange">
33111 <primary>routers</primary>
33112 <secondary><command>redirect</command></secondary>
33114 <indexterm role="concept">
33115 <primary>alias file</primary>
33116 <secondary>in a <command>redirect</command> router</secondary>
33118 <indexterm role="concept">
33119 <primary>address redirection</primary>
33120 <secondary><command>redirect</command> router</secondary>
33122 The <command>redirect</command> router handles several kinds of address redirection. Its most
33123 common uses are for resolving local part aliases from a central alias file
33124 (usually called <filename>/etc/aliases</filename>) and for handling users’ personal <filename>.forward</filename>
33125 files, but it has many other potential uses. The incoming address can be
33126 redirected in several different ways:
33131 It can be replaced by one or more new addresses which are themselves routed
33137 It can be routed to be delivered to a given file or directory.
33142 It can be routed to be delivered to a specified pipe command.
33147 It can cause an automatic reply to be generated.
33152 It can be forced to fail, optionally with a custom error message.
33157 It can be temporarily deferred, optionally with a custom message.
33162 It can be discarded.
33167 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
33168 However, there are some private options which define transports for delivery to
33169 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
33170 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
33172 <section id="SECID124">
33173 <title>Redirection data</title>
33175 The router operates by interpreting a text string which it obtains either by
33176 expanding the contents of the <option>data</option> option, or by reading the entire
33177 contents of a file whose name is given in the <option>file</option> option. These two
33178 options are mutually exclusive. The first is commonly used for handling system
33179 aliases, in a configuration like this:
33181 <literallayout class="monospaced">
33184 data = ${lookup{$local_part}lsearch{/etc/aliases}}
33187 If the lookup fails, the expanded string in this example is empty. When the
33188 expansion of <option>data</option> results in an empty string, the router declines. A forced
33189 expansion failure also causes the router to decline; other expansion failures
33190 cause delivery to be deferred.
33193 A configuration using <option>file</option> is commonly used for handling users’
33194 <filename>.forward</filename> files, like this:
33196 <literallayout class="monospaced">
33200 file = $home/.forward
33204 If the file does not exist, or causes no action to be taken (for example, it is
33205 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
33206 is not the case when the file contains syntactically valid items that happen to
33207 yield empty addresses, for example, items containing only RFC 2822 address
33211 <section id="SECID125">
33212 <title>Forward files and address verification</title>
33214 <indexterm role="concept">
33215 <primary>address redirection</primary>
33216 <secondary>while verifying</secondary>
33218 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users’
33219 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
33224 When Exim is receiving an incoming SMTP message from a remote host, it is
33225 running under the Exim uid, not as root. Exim is unable to change uid to read
33226 the file as the user, and it may not be able to read it as the Exim user. So in
33227 practice the router may not be able to operate.
33232 However, even when the router can operate, the existence of a <filename>.forward</filename> file
33233 is unimportant when verifying an address. What should be checked is whether the
33234 local part is a valid user name or not. Cutting out the redirection processing
33235 saves some resources.
33240 <section id="SECID126">
33241 <title>Interpreting redirection data</title>
33243 <indexterm role="concept">
33244 <primary>Sieve filter</primary>
33245 <secondary>specifying in redirection data</secondary>
33247 <indexterm role="concept">
33248 <primary>filter</primary>
33249 <secondary>specifying in redirection data</secondary>
33251 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
33252 can be interpreted in two different ways:
33257 If the <option>allow_filter</option> option is set true, and the data begins with the text
33258 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
33259 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
33260 respectively. Details of the syntax and semantics of filter files are described
33261 in a separate document entitled <emphasis>Exim’s interfaces to mail filtering</emphasis>; this
33262 document is intended for use by end users.
33267 Otherwise, the data must be a comma-separated list of redirection items, as
33268 described in the next section.
33273 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
33274 in a non-filter redirection list must always be an absolute path. A filter may
33275 generate a relative path – how this is handled depends on the transport’s
33276 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
33277 for the <command>appendfile</command> transport.
33280 <section id="SECTitenonfilred">
33281 <title>Items in a non-filter redirection list</title>
33283 <indexterm role="concept">
33284 <primary>address redirection</primary>
33285 <secondary>non-filter list items</secondary>
33287 When the redirection data is not an Exim or Sieve filter, for example, if it
33288 comes from a conventional alias or forward file, it consists of a list of
33289 addresses, file names, pipe commands, or certain special items (see section
33290 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
33291 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
33292 depending on their default values. The items in the list are separated by
33293 commas or newlines.
33294 If a comma is required in an item, the entire item must be enclosed in double
33298 Lines starting with a # character are comments, and are ignored, and # may
33299 also appear following a comma, in which case everything between the # and the
33300 next newline character is ignored.
33303 If an item is entirely enclosed in double quotes, these are removed. Otherwise
33304 double quotes are retained because some forms of mail address require their use
33305 (but never to enclose the entire address). In the following description,
33306 <quote>item</quote> refers to what remains after any surrounding double quotes have been
33310 <indexterm role="variable">
33311 <primary><varname>$local_part</varname></primary>
33313 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
33314 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
33315 of the <option>quote_local_part</option> expansion operator, in case the local part contains
33316 special characters. For example, to redirect all mail for the domain
33317 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
33320 <literallayout class="monospaced">
33321 data = ${quote_local_part:$local_part}@newdomain.example
33324 <section id="SECTredlocmai">
33325 <title>Redirecting to a local mailbox</title>
33327 <indexterm role="concept">
33328 <primary>routing</primary>
33329 <secondary>loops in</secondary>
33331 <indexterm role="concept">
33332 <primary>loop</primary>
33333 <secondary>while routing, avoidance of</secondary>
33335 <indexterm role="concept">
33336 <primary>address redirection</primary>
33337 <secondary>to local mailbox</secondary>
33339 A redirection item may safely be the same as the address currently under
33340 consideration. This does not cause a routing loop, because a router is
33341 automatically skipped if any ancestor of the address that is being processed
33342 is the same as the current address and was processed by the current router.
33343 Such an address is therefore passed to the following routers, so it is handled
33344 as if there were no redirection. When making this loop-avoidance test, the
33345 complete local part, including any prefix or suffix, is used.
33348 <indexterm role="concept">
33349 <primary>address redirection</primary>
33350 <secondary>local part without domain</secondary>
33352 Specifying the same local part without a domain is a common usage in personal
33353 filter files when the user wants to have messages delivered to the local
33354 mailbox and also forwarded elsewhere. For example, the user whose login is
33355 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
33357 <literallayout class="monospaced">
33358 cleo, cleopatra@egypt.example
33361 <indexterm role="concept">
33362 <primary>backslash in alias file</primary>
33364 <indexterm role="concept">
33365 <primary>alias file</primary>
33366 <secondary>backslash in</secondary>
33368 For compatibility with other MTAs, such unqualified local parts may be
33369 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
33370 it does make a difference if more than one domain is being handled
33374 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
33375 2822 address that does not include a domain, the item is qualified using the
33376 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
33377 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
33378 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
33381 Care must be taken if there are alias names for local users.
33382 Consider an MTA handling a single local domain where the system alias file
33385 <literallayout class="monospaced">
33389 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
33390 messages in the local mailbox, and also forward copies elsewhere. He creates
33393 <literallayout class="monospaced">
33394 Sam.Reman, spqr@reme.elsewhere.example
33397 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
33398 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
33399 second time round, because it has previously routed it,
33400 and the following routers presumably cannot handle the alias. The forward file
33401 should really contain
33403 <literallayout class="monospaced">
33404 spqr, spqr@reme.elsewhere.example
33407 but because this is such a common error, the <option>check_ancestor</option> option (see
33408 below) exists to provide a way to get round it. This is normally set on a
33409 <command>redirect</command> router that is handling users’ <filename>.forward</filename> files.
33412 <section id="SECTspecitredli">
33413 <title>Special items in redirection lists</title>
33415 In addition to addresses, the following types of item may appear in redirection
33416 lists (that is, in non-filter redirection data):
33421 <indexterm role="concept">
33422 <primary>pipe</primary>
33423 <secondary>in redirection list</secondary>
33425 <indexterm role="concept">
33426 <primary>address redirection</primary>
33427 <secondary>to pipe</secondary>
33429 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
33430 as a valid RFC 2822 address that includes a domain. A transport for running the
33431 command must be specified by the <option>pipe_transport</option> option.
33432 Normally, either the router or the transport specifies a user and a group under
33433 which to run the delivery. The default is to use the Exim user and group.
33436 Single or double quotes can be used for enclosing the individual arguments of
33437 the pipe command; no interpretation of escapes is done for single quotes. If
33438 the command contains a comma character, it is necessary to put the whole item
33439 in double quotes, for example:
33441 <literallayout class="monospaced">
33442 "|/some/command ready,steady,go"
33445 since items in redirection lists are terminated by commas. Do not, however,
33446 quote just the command. An item such as
33448 <literallayout class="monospaced">
33449 |"/some/command ready,steady,go"
33452 is interpreted as a pipe with a rather strange command name, and no arguments.
33457 <indexterm role="concept">
33458 <primary>file</primary>
33459 <secondary>in redirection list</secondary>
33461 <indexterm role="concept">
33462 <primary>address redirection</primary>
33463 <secondary>to file</secondary>
33465 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
33466 parse as a valid RFC 2822 address that includes a domain. For example,
33468 <literallayout class="monospaced">
33469 /home/world/minbari
33472 is treated as a file name, but
33474 <literallayout class="monospaced">
33475 /s=molari/o=babylon/@x400gate.way
33478 is treated as an address. For a file name, a transport must be specified using
33479 the <option>file_transport</option> option. However, if the generated path name ends with a
33480 forward slash character, it is interpreted as a directory name rather than a
33481 file name, and <option>directory_transport</option> is used instead.
33484 Normally, either the router or the transport specifies a user and a group under
33485 which to run the delivery. The default is to use the Exim user and group.
33488 <indexterm role="concept">
33489 <primary><filename>/dev/null</filename></primary>
33491 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
33492 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
33493 instead of a transport name. In this case the user and group are not used.
33498 <indexterm role="concept">
33499 <primary>included address list</primary>
33501 <indexterm role="concept">
33502 <primary>address redirection</primary>
33503 <secondary>included external list</secondary>
33505 If an item is of the form
33507 <literallayout class="monospaced">
33508 :include:<path name>
33511 a list of further items is taken from the given file and included at that
33512 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
33513 out-of-line addition to the list. The items in the included list are separated
33514 by commas or newlines and are not subject to expansion. If this is the first
33515 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
33516 the alias name. This example is incorrect:
33518 <literallayout class="monospaced">
33519 list1 :include:/opt/lists/list1
33522 It must be given as
33524 <literallayout class="monospaced">
33525 list1: :include:/opt/lists/list1
33530 <indexterm role="concept">
33531 <primary>address redirection</primary>
33532 <secondary>to black hole</secondary>
33534 Sometimes you want to throw away mail to a particular local part. Making the
33535 <option>data</option> option expand to an empty string does not work, because that causes
33536 the router to decline. Instead, the alias item
33537 <indexterm role="concept">
33538 <primary>black hole</primary>
33540 <indexterm role="concept">
33541 <primary>abandoning mail</primary>
33543 <emphasis>:blackhole:</emphasis> can be used. It does what its name implies. No delivery is
33544 done, and no error message is generated. This has the same effect as specifing
33545 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
33548 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
33549 delivery is done for the original local part, even if other redirection items
33550 are present. If you are generating a multi-item list (for example, by reading a
33551 database) and need the ability to provide a no-op item, you must use
33552 <filename>/dev/null</filename>.
33557 <indexterm role="concept">
33558 <primary>delivery</primary>
33559 <secondary>forcing failure</secondary>
33561 <indexterm role="concept">
33562 <primary>delivery</primary>
33563 <secondary>forcing deferral</secondary>
33565 <indexterm role="concept">
33566 <primary>failing delivery</primary>
33567 <secondary>forcing</secondary>
33569 <indexterm role="concept">
33570 <primary>deferred delivery, forcing</primary>
33572 <indexterm role="concept">
33573 <primary>customizing</primary>
33574 <secondary>failure message</secondary>
33576 An attempt to deliver a particular address can be deferred or forced to fail by
33577 redirection items of the form
33579 <literallayout class="monospaced">
33584 respectively. When a redirection list contains such an item, it applies
33585 to the entire redirection; any other items in the list are ignored. Any
33586 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
33587 associated with the failure. For example, an alias file might contain:
33589 <literallayout class="monospaced">
33590 X.Employee: :fail: Gone away, no forwarding address
33593 In the case of an address that is being verified from an ACL or as the subject
33595 <indexterm role="concept">
33596 <primary>VRFY</primary>
33597 <secondary>error text, display of</secondary>
33599 VRFY command, the text is included in the SMTP error response by
33601 <indexterm role="concept">
33602 <primary>EXPN</primary>
33603 <secondary>error text, display of</secondary>
33605 The text is not included in the response to an EXPN command. In non-SMTP cases
33606 the text is included in the error message that Exim generates.
33609 <indexterm role="concept">
33610 <primary>SMTP</primary>
33611 <secondary>error codes</secondary>
33613 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
33614 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
33615 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
33616 followed by a space, and the very first digit is the same as the default error
33617 code, the code from the message is used instead. If the very first digit is
33618 incorrect, a panic error is logged, and the default code is used. You can
33619 suppress the use of the supplied code in a redirect router by setting the
33620 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
33624 <indexterm role="variable">
33625 <primary><varname>$acl_verify_message</varname></primary>
33627 In an ACL, an explicitly provided message overrides the default, but the
33628 default message is available in the variable <varname>$acl_verify_message</varname> and can
33629 therefore be included in a custom message if this is desired.
33632 Normally the error text is the rest of the redirection list – a comma does
33633 not terminate it – but a newline does act as a terminator. Newlines are not
33634 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
33635 as part of the continuation process, but they may exist in other kinds of
33636 lookup and in <emphasis>:include:</emphasis> files.
33639 During routing for message delivery (as opposed to verification), a redirection
33640 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
33641 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
33642 subsequent delivery attempt can happen at a later time. If an address is
33643 deferred for too long, it will ultimately fail, because the normal retry
33649 <indexterm role="concept">
33650 <primary>alias file</primary>
33651 <secondary>exception to default</secondary>
33653 Sometimes it is useful to use a single-key search type with a default (see
33654 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
33655 for exceptions to the default. These can be handled by aliasing them to
33656 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
33657 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
33658 results in an empty redirection list has the same effect.
33663 <section id="SECTdupaddr">
33664 <title>Duplicate addresses</title>
33666 <indexterm role="concept">
33667 <primary>duplicate addresses</primary>
33669 <indexterm role="concept">
33670 <primary>address duplicate, discarding</primary>
33672 <indexterm role="concept">
33673 <primary>pipe</primary>
33674 <secondary>duplicated</secondary>
33676 Exim removes duplicate addresses from the list to which it is delivering, so as
33677 to deliver just one copy to each address. This does not apply to deliveries
33678 routed to pipes by different immediate parent addresses, but an indirect
33679 aliasing scheme of the type
33681 <literallayout class="monospaced">
33682 pipe: |/some/command $local_part
33687 does not work with a message that is addressed to both local parts, because
33688 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
33689 discarded as being the same as a previously handled address. However, a scheme
33692 <literallayout class="monospaced">
33693 localpart1: |/some/command $local_part
33694 localpart2: |/some/command $local_part
33697 does result in two different pipe deliveries, because the immediate parents of
33698 the pipes are distinct.
33701 <section id="SECID128">
33702 <title>Repeated redirection expansion</title>
33704 <indexterm role="concept">
33705 <primary>repeated redirection expansion</primary>
33707 <indexterm role="concept">
33708 <primary>address redirection</primary>
33709 <secondary>repeated for each delivery attempt</secondary>
33711 When a message cannot be delivered to all of its recipients immediately,
33712 leading to two or more delivery attempts, redirection expansion is carried out
33713 afresh each time for those addresses whose children were not all previously
33714 delivered. If redirection is being used as a mailing list, this can lead to new
33715 members of the list receiving copies of old messages. The <option>one_time</option> option
33716 can be used to avoid this.
33719 <section id="SECID129">
33720 <title>Errors in redirection lists</title>
33722 <indexterm role="concept">
33723 <primary>address redirection</primary>
33724 <secondary>errors</secondary>
33726 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
33727 error is skipped, and an entry is written to the main log. This may be useful
33728 for mailing lists that are automatically managed. Otherwise, if an error is
33729 detected while generating the list of new addresses, the original address is
33730 deferred. See also <option>syntax_errors_to</option>.
33733 <section id="SECID130">
33734 <title>Private options for the redirect router</title>
33736 <indexterm role="concept">
33737 <primary>options</primary>
33738 <secondary><command>redirect</command> router</secondary>
33740 The private options for the <command>redirect</command> router are as follows:
33743 <indexterm role="option">
33744 <primary><option>allow_defer</option></primary>
33747 <informaltable frame="all">
33748 <tgroup cols="4" colsep="0" rowsep="0">
33749 <colspec colwidth="8*" align="left"/>
33750 <colspec colwidth="6*" align="center"/>
33751 <colspec colwidth="6*" align="center"/>
33752 <colspec colwidth="6*" align="right"/>
33755 <entry><option>allow_defer</option></entry>
33756 <entry>Use: <emphasis>redirect</emphasis></entry>
33757 <entry>Type: <emphasis>boolean</emphasis></entry>
33758 <entry>Default: <emphasis>false</emphasis></entry>
33764 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
33765 data, or the <option>defer</option> command in an Exim filter file.
33768 <indexterm role="option">
33769 <primary><option>allow_fail</option></primary>
33772 <informaltable frame="all">
33773 <tgroup cols="4" colsep="0" rowsep="0">
33774 <colspec colwidth="8*" align="left"/>
33775 <colspec colwidth="6*" align="center"/>
33776 <colspec colwidth="6*" align="center"/>
33777 <colspec colwidth="6*" align="right"/>
33780 <entry><option>allow_fail</option></entry>
33781 <entry>Use: <emphasis>redirect</emphasis></entry>
33782 <entry>Type: <emphasis>boolean</emphasis></entry>
33783 <entry>Default: <emphasis>false</emphasis></entry>
33789 <indexterm role="concept">
33790 <primary>failing delivery</primary>
33791 <secondary>from filter</secondary>
33793 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
33794 and the <option>fail</option> command may be used in an Exim filter file.
33797 <indexterm role="option">
33798 <primary><option>allow_filter</option></primary>
33801 <informaltable frame="all">
33802 <tgroup cols="4" colsep="0" rowsep="0">
33803 <colspec colwidth="8*" align="left"/>
33804 <colspec colwidth="6*" align="center"/>
33805 <colspec colwidth="6*" align="center"/>
33806 <colspec colwidth="6*" align="right"/>
33809 <entry><option>allow_filter</option></entry>
33810 <entry>Use: <emphasis>redirect</emphasis></entry>
33811 <entry>Type: <emphasis>boolean</emphasis></entry>
33812 <entry>Default: <emphasis>false</emphasis></entry>
33818 <indexterm role="concept">
33819 <primary>filter</primary>
33820 <secondary>enabling use of</secondary>
33822 <indexterm role="concept">
33823 <primary>Sieve filter</primary>
33824 <secondary>enabling use of</secondary>
33826 Setting this option allows Exim to interpret redirection data that starts with
33827 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
33828 are some features of Exim filter files that some administrators may wish to
33829 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
33832 It is also possible to lock out Exim filters or Sieve filters while allowing
33833 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
33836 The filter is run using the uid and gid set by the generic <option>user</option> and
33837 <option>group</option> options. These take their defaults from the password data if
33838 <option>check_local_user</option> is set, so in the normal case of users’ personal filter
33839 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
33840 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
33843 <indexterm role="option">
33844 <primary><option>allow_freeze</option></primary>
33847 <informaltable frame="all">
33848 <tgroup cols="4" colsep="0" rowsep="0">
33849 <colspec colwidth="8*" align="left"/>
33850 <colspec colwidth="6*" align="center"/>
33851 <colspec colwidth="6*" align="center"/>
33852 <colspec colwidth="6*" align="right"/>
33855 <entry><option>allow_freeze</option></entry>
33856 <entry>Use: <emphasis>redirect</emphasis></entry>
33857 <entry>Type: <emphasis>boolean</emphasis></entry>
33858 <entry>Default: <emphasis>false</emphasis></entry>
33864 <indexterm role="concept">
33865 <primary>freezing messages</primary>
33866 <secondary>allowing in filter</secondary>
33868 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
33869 This command is more normally encountered in system filters, and is disabled by
33870 default for redirection filters because it isn’t something you usually want to
33871 let ordinary users do.
33874 <indexterm role="option">
33875 <primary><option>check_ancestor</option></primary>
33878 <informaltable frame="all">
33879 <tgroup cols="4" colsep="0" rowsep="0">
33880 <colspec colwidth="8*" align="left"/>
33881 <colspec colwidth="6*" align="center"/>
33882 <colspec colwidth="6*" align="center"/>
33883 <colspec colwidth="6*" align="right"/>
33886 <entry><option>check_ancestor</option></entry>
33887 <entry>Use: <emphasis>redirect</emphasis></entry>
33888 <entry>Type: <emphasis>boolean</emphasis></entry>
33889 <entry>Default: <emphasis>false</emphasis></entry>
33895 This option is concerned with handling generated addresses that are the same
33896 as some address in the list of redirection ancestors of the current address.
33897 Although it is turned off by default in the code, it is set in the default
33898 configuration file for handling users’ <filename>.forward</filename> files. It is recommended
33899 for this use of the <command>redirect</command> router.
33902 When <option>check_ancestor</option> is set, if a generated address (including the domain)
33903 is the same as any ancestor of the current address, it is replaced by a copy of
33904 the current address. This helps in the case where local part A is aliased to B,
33905 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
33906 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
33907 <filename> jb/.forward</filename> contains:
33909 <literallayout class="monospaced">
33910 \Joe.Bloggs, <other item(s)>
33913 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
33914 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
33915 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
33916 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
33917 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
33918 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
33919 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
33920 original address. See also the <option>repeat_use</option> option below.
33923 <indexterm role="option">
33924 <primary><option>check_group</option></primary>
33927 <informaltable frame="all">
33928 <tgroup cols="4" colsep="0" rowsep="0">
33929 <colspec colwidth="8*" align="left"/>
33930 <colspec colwidth="6*" align="center"/>
33931 <colspec colwidth="6*" align="center"/>
33932 <colspec colwidth="6*" align="right"/>
33935 <entry><option>check_group</option></entry>
33936 <entry>Use: <emphasis>redirect</emphasis></entry>
33937 <entry>Type: <emphasis>boolean</emphasis></entry>
33938 <entry>Default: <emphasis>see below</emphasis></entry>
33944 When the <option>file</option> option is used, the group owner of the file is checked only
33945 when this option is set. The permitted groups are those listed in the
33946 <option>owngroups</option> option, together with the user’s default group if
33947 <option>check_local_user</option> is set. If the file has the wrong group, routing is
33948 deferred. The default setting for this option is true if <option>check_local_user</option>
33949 is set and the <option>modemask</option> option permits the group write bit, or if the
33950 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
33953 <indexterm role="option">
33954 <primary><option>check_owner</option></primary>
33957 <informaltable frame="all">
33958 <tgroup cols="4" colsep="0" rowsep="0">
33959 <colspec colwidth="8*" align="left"/>
33960 <colspec colwidth="6*" align="center"/>
33961 <colspec colwidth="6*" align="center"/>
33962 <colspec colwidth="6*" align="right"/>
33965 <entry><option>check_owner</option></entry>
33966 <entry>Use: <emphasis>redirect</emphasis></entry>
33967 <entry>Type: <emphasis>boolean</emphasis></entry>
33968 <entry>Default: <emphasis>see below</emphasis></entry>
33974 When the <option>file</option> option is used, the owner of the file is checked only when
33975 this option is set. If <option>check_local_user</option> is set, the local user is
33976 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
33977 option. The default value for this option is true if <option>check_local_user</option> or
33978 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
33981 <indexterm role="option">
33982 <primary><option>data</option></primary>
33985 <informaltable frame="all">
33986 <tgroup cols="4" colsep="0" rowsep="0">
33987 <colspec colwidth="8*" align="left"/>
33988 <colspec colwidth="6*" align="center"/>
33989 <colspec colwidth="6*" align="center"/>
33990 <colspec colwidth="6*" align="right"/>
33993 <entry><option>data</option></entry>
33994 <entry>Use: <emphasis>redirect</emphasis></entry>
33995 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
33996 <entry>Default: <emphasis>unset</emphasis></entry>
34002 This option is mutually exclusive with <option>file</option>. One or other of them must be
34003 set, but not both. The contents of <option>data</option> are expanded, and then used as the
34004 list of forwarding items, or as a set of filtering instructions. If the
34005 expansion is forced to fail, or the result is an empty string or a string that
34006 has no effect (consists entirely of comments), the router declines.
34009 When filtering instructions are used, the string must begin with <quote>#Exim
34010 filter</quote>, and all comments in the string, including this initial one, must be
34011 terminated with newline characters. For example:
34013 <literallayout class="monospaced">
34014 data = #Exim filter\n\
34015 if $h_to: contains Exim then save $home/mail/exim endif
34018 If you are reading the data from a database where newlines cannot be included,
34019 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
34020 choice into a newline.
34023 <indexterm role="option">
34024 <primary><option>directory_transport</option></primary>
34027 <informaltable frame="all">
34028 <tgroup cols="4" colsep="0" rowsep="0">
34029 <colspec colwidth="8*" align="left"/>
34030 <colspec colwidth="6*" align="center"/>
34031 <colspec colwidth="6*" align="center"/>
34032 <colspec colwidth="6*" align="right"/>
34035 <entry><option>directory_transport</option></entry>
34036 <entry>Use: <emphasis>redirect</emphasis></entry>
34037 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34038 <entry>Default: <emphasis>unset</emphasis></entry>
34044 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
34045 ending with a slash is specified as a new <quote>address</quote>. The transport used is
34046 specified by this option, which, after expansion, must be the name of a
34047 configured transport. This should normally be an <command>appendfile</command> transport.
34050 <indexterm role="option">
34051 <primary><option>file</option></primary>
34054 <informaltable frame="all">
34055 <tgroup cols="4" colsep="0" rowsep="0">
34056 <colspec colwidth="8*" align="left"/>
34057 <colspec colwidth="6*" align="center"/>
34058 <colspec colwidth="6*" align="center"/>
34059 <colspec colwidth="6*" align="right"/>
34062 <entry><option>file</option></entry>
34063 <entry>Use: <emphasis>redirect</emphasis></entry>
34064 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34065 <entry>Default: <emphasis>unset</emphasis></entry>
34071 This option specifies the name of a file that contains the redirection data. It
34072 is mutually exclusive with the <option>data</option> option. The string is expanded before
34073 use; if the expansion is forced to fail, the router declines. Other expansion
34074 failures cause delivery to be deferred. The result of a successful expansion
34075 must be an absolute path. The entire file is read and used as the redirection
34076 data. If the data is an empty string or a string that has no effect (consists
34077 entirely of comments), the router declines.
34080 <indexterm role="concept">
34081 <primary>NFS</primary>
34082 <secondary>checking for file existence</secondary>
34084 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
34085 runs a check on the containing directory,
34086 unless <option>ignore_enotdir</option> is true (see below).
34087 If the directory does not appear to exist, delivery is deferred. This can
34088 happen when users’ <filename>.forward</filename> files are in NFS-mounted directories, and there
34089 is a mount problem. If the containing directory does exist, but the file does
34090 not, the router declines.
34093 <indexterm role="option">
34094 <primary><option>file_transport</option></primary>
34097 <informaltable frame="all">
34098 <tgroup cols="4" colsep="0" rowsep="0">
34099 <colspec colwidth="8*" align="left"/>
34100 <colspec colwidth="6*" align="center"/>
34101 <colspec colwidth="6*" align="center"/>
34102 <colspec colwidth="6*" align="right"/>
34105 <entry><option>file_transport</option></entry>
34106 <entry>Use: <emphasis>redirect</emphasis></entry>
34107 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34108 <entry>Default: <emphasis>unset</emphasis></entry>
34114 <indexterm role="variable">
34115 <primary><varname>$address_file</varname></primary>
34117 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
34118 ending in a slash is specified as a new <quote>address</quote>. The transport used is
34119 specified by this option, which, after expansion, must be the name of a
34120 configured transport. This should normally be an <command>appendfile</command> transport. When
34121 it is running, the file name is in <varname>$address_file</varname>.
34124 <indexterm role="option">
34125 <primary><option>filter_prepend_home</option></primary>
34128 <informaltable frame="all">
34129 <tgroup cols="4" colsep="0" rowsep="0">
34130 <colspec colwidth="8*" align="left"/>
34131 <colspec colwidth="6*" align="center"/>
34132 <colspec colwidth="6*" align="center"/>
34133 <colspec colwidth="6*" align="right"/>
34136 <entry><option>filter_prepend_home</option></entry>
34137 <entry>Use: <emphasis>redirect</emphasis></entry>
34138 <entry>Type: <emphasis>boolean</emphasis></entry>
34139 <entry>Default: <emphasis>true</emphasis></entry>
34145 When this option is true, if a <command>save</command> command in an Exim filter specifies a
34146 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
34147 relative path. If this option is set false, this action does not happen. The
34148 relative path is then passed to the transport unmodified.
34151 <indexterm role="option">
34152 <primary><option>forbid_blackhole</option></primary>
34155 <informaltable frame="all">
34156 <tgroup cols="4" colsep="0" rowsep="0">
34157 <colspec colwidth="8*" align="left"/>
34158 <colspec colwidth="6*" align="center"/>
34159 <colspec colwidth="6*" align="center"/>
34160 <colspec colwidth="6*" align="right"/>
34163 <entry><option>forbid_blackhole</option></entry>
34164 <entry>Use: <emphasis>redirect</emphasis></entry>
34165 <entry>Type: <emphasis>boolean</emphasis></entry>
34166 <entry>Default: <emphasis>false</emphasis></entry>
34172 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
34176 <indexterm role="option">
34177 <primary><option>forbid_exim_filter</option></primary>
34180 <informaltable frame="all">
34181 <tgroup cols="4" colsep="0" rowsep="0">
34182 <colspec colwidth="8*" align="left"/>
34183 <colspec colwidth="6*" align="center"/>
34184 <colspec colwidth="6*" align="center"/>
34185 <colspec colwidth="6*" align="right"/>
34188 <entry><option>forbid_exim_filter</option></entry>
34189 <entry>Use: <emphasis>redirect</emphasis></entry>
34190 <entry>Type: <emphasis>boolean</emphasis></entry>
34191 <entry>Default: <emphasis>false</emphasis></entry>
34197 If this option is set true, only Sieve filters are permitted when
34198 <option>allow_filter</option> is true.
34201 <indexterm role="option">
34202 <primary><option>forbid_file</option></primary>
34205 <informaltable frame="all">
34206 <tgroup cols="4" colsep="0" rowsep="0">
34207 <colspec colwidth="8*" align="left"/>
34208 <colspec colwidth="6*" align="center"/>
34209 <colspec colwidth="6*" align="center"/>
34210 <colspec colwidth="6*" align="right"/>
34213 <entry><option>forbid_file</option></entry>
34214 <entry>Use: <emphasis>redirect</emphasis></entry>
34215 <entry>Type: <emphasis>boolean</emphasis></entry>
34216 <entry>Default: <emphasis>false</emphasis></entry>
34222 <indexterm role="concept">
34223 <primary>delivery</primary>
34224 <secondary>to file; forbidding</secondary>
34226 <indexterm role="concept">
34227 <primary>Sieve filter</primary>
34228 <secondary>forbidding delivery to a file</secondary>
34230 <indexterm role="concept">
34231 <primary>Sieve filter</primary>
34232 <secondary><quote>keep</quote> facility; disabling</secondary>
34234 If this option is true, this router may not generate a new address that
34235 specifies delivery to a local file or directory, either from a filter or from a
34236 conventional forward file. This option is forced to be true if <option>one_time</option> is
34237 set. It applies to Sieve filters as well as to Exim filters, but if true, it
34238 locks out the Sieve’s <quote>keep</quote> facility.
34241 <indexterm role="option">
34242 <primary><option>forbid_filter_dlfunc</option></primary>
34245 <informaltable frame="all">
34246 <tgroup cols="4" colsep="0" rowsep="0">
34247 <colspec colwidth="8*" align="left"/>
34248 <colspec colwidth="6*" align="center"/>
34249 <colspec colwidth="6*" align="center"/>
34250 <colspec colwidth="6*" align="right"/>
34253 <entry><option>forbid_filter_dlfunc</option></entry>
34254 <entry>Use: <emphasis>redirect</emphasis></entry>
34255 <entry>Type: <emphasis>boolean</emphasis></entry>
34256 <entry>Default: <emphasis>false</emphasis></entry>
34262 <indexterm role="concept">
34263 <primary>filter</primary>
34264 <secondary>locking out certain features</secondary>
34266 If this option is true, string expansions in Exim filters are not allowed to
34267 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
34271 <indexterm role="option">
34272 <primary><option>forbid_filter_existstest</option></primary>
34275 <informaltable frame="all">
34276 <tgroup cols="4" colsep="0" rowsep="0">
34277 <colspec colwidth="8*" align="left"/>
34278 <colspec colwidth="6*" align="center"/>
34279 <colspec colwidth="6*" align="center"/>
34280 <colspec colwidth="6*" align="right"/>
34283 <entry><option>forbid_filter_existstest</option></entry>
34284 <entry>Use: <emphasis>redirect</emphasis></entry>
34285 <entry>Type: <emphasis>boolean</emphasis></entry>
34286 <entry>Default: <emphasis>false</emphasis></entry>
34292 <indexterm role="concept">
34293 <primary>expansion</primary>
34294 <secondary>statting a file</secondary>
34296 If this option is true, string expansions in Exim filters are not allowed to
34297 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
34300 <indexterm role="option">
34301 <primary><option>forbid_filter_logwrite</option></primary>
34304 <informaltable frame="all">
34305 <tgroup cols="4" colsep="0" rowsep="0">
34306 <colspec colwidth="8*" align="left"/>
34307 <colspec colwidth="6*" align="center"/>
34308 <colspec colwidth="6*" align="center"/>
34309 <colspec colwidth="6*" align="right"/>
34312 <entry><option>forbid_filter_logwrite</option></entry>
34313 <entry>Use: <emphasis>redirect</emphasis></entry>
34314 <entry>Type: <emphasis>boolean</emphasis></entry>
34315 <entry>Default: <emphasis>false</emphasis></entry>
34321 If this option is true, use of the logging facility in Exim filters is not
34322 permitted. Logging is in any case available only if the filter is being run
34323 under some unprivileged uid (which is normally the case for ordinary users’
34324 <filename>.forward</filename> files).
34327 <indexterm role="option">
34328 <primary><option>forbid_filter_lookup</option></primary>
34331 <informaltable frame="all">
34332 <tgroup cols="4" colsep="0" rowsep="0">
34333 <colspec colwidth="8*" align="left"/>
34334 <colspec colwidth="6*" align="center"/>
34335 <colspec colwidth="6*" align="center"/>
34336 <colspec colwidth="6*" align="right"/>
34339 <entry><option>forbid_filter_lookup</option></entry>
34340 <entry>Use: <emphasis>redirect</emphasis></entry>
34341 <entry>Type: <emphasis>boolean</emphasis></entry>
34342 <entry>Default: <emphasis>false</emphasis></entry>
34348 If this option is true, string expansions in Exim filter files are not allowed
34349 to make use of <option>lookup</option> items.
34352 <indexterm role="option">
34353 <primary><option>forbid_filter_perl</option></primary>
34356 <informaltable frame="all">
34357 <tgroup cols="4" colsep="0" rowsep="0">
34358 <colspec colwidth="8*" align="left"/>
34359 <colspec colwidth="6*" align="center"/>
34360 <colspec colwidth="6*" align="center"/>
34361 <colspec colwidth="6*" align="right"/>
34364 <entry><option>forbid_filter_perl</option></entry>
34365 <entry>Use: <emphasis>redirect</emphasis></entry>
34366 <entry>Type: <emphasis>boolean</emphasis></entry>
34367 <entry>Default: <emphasis>false</emphasis></entry>
34373 This option has an effect only if Exim is built with embedded Perl support. If
34374 it is true, string expansions in Exim filter files are not allowed to make use
34375 of the embedded Perl support.
34378 <indexterm role="option">
34379 <primary><option>forbid_filter_readfile</option></primary>
34382 <informaltable frame="all">
34383 <tgroup cols="4" colsep="0" rowsep="0">
34384 <colspec colwidth="8*" align="left"/>
34385 <colspec colwidth="6*" align="center"/>
34386 <colspec colwidth="6*" align="center"/>
34387 <colspec colwidth="6*" align="right"/>
34390 <entry><option>forbid_filter_readfile</option></entry>
34391 <entry>Use: <emphasis>redirect</emphasis></entry>
34392 <entry>Type: <emphasis>boolean</emphasis></entry>
34393 <entry>Default: <emphasis>false</emphasis></entry>
34399 If this option is true, string expansions in Exim filter files are not allowed
34400 to make use of <option>readfile</option> items.
34403 <indexterm role="option">
34404 <primary><option>forbid_filter_readsocket</option></primary>
34407 <informaltable frame="all">
34408 <tgroup cols="4" colsep="0" rowsep="0">
34409 <colspec colwidth="8*" align="left"/>
34410 <colspec colwidth="6*" align="center"/>
34411 <colspec colwidth="6*" align="center"/>
34412 <colspec colwidth="6*" align="right"/>
34415 <entry><option>forbid_filter_readsocket</option></entry>
34416 <entry>Use: <emphasis>redirect</emphasis></entry>
34417 <entry>Type: <emphasis>boolean</emphasis></entry>
34418 <entry>Default: <emphasis>false</emphasis></entry>
34424 If this option is true, string expansions in Exim filter files are not allowed
34425 to make use of <option>readsocket</option> items.
34428 <indexterm role="option">
34429 <primary><option>forbid_filter_reply</option></primary>
34432 <informaltable frame="all">
34433 <tgroup cols="4" colsep="0" rowsep="0">
34434 <colspec colwidth="8*" align="left"/>
34435 <colspec colwidth="6*" align="center"/>
34436 <colspec colwidth="6*" align="center"/>
34437 <colspec colwidth="6*" align="right"/>
34440 <entry><option>forbid_filter_reply</option></entry>
34441 <entry>Use: <emphasis>redirect</emphasis></entry>
34442 <entry>Type: <emphasis>boolean</emphasis></entry>
34443 <entry>Default: <emphasis>false</emphasis></entry>
34449 If this option is true, this router may not generate an automatic reply
34450 message. Automatic replies can be generated only from Exim or Sieve filter
34451 files, not from traditional forward files. This option is forced to be true if
34452 <option>one_time</option> is set.
34455 <indexterm role="option">
34456 <primary><option>forbid_filter_run</option></primary>
34459 <informaltable frame="all">
34460 <tgroup cols="4" colsep="0" rowsep="0">
34461 <colspec colwidth="8*" align="left"/>
34462 <colspec colwidth="6*" align="center"/>
34463 <colspec colwidth="6*" align="center"/>
34464 <colspec colwidth="6*" align="right"/>
34467 <entry><option>forbid_filter_run</option></entry>
34468 <entry>Use: <emphasis>redirect</emphasis></entry>
34469 <entry>Type: <emphasis>boolean</emphasis></entry>
34470 <entry>Default: <emphasis>false</emphasis></entry>
34476 If this option is true, string expansions in Exim filter files are not allowed
34477 to make use of <option>run</option> items.
34480 <indexterm role="option">
34481 <primary><option>forbid_include</option></primary>
34484 <informaltable frame="all">
34485 <tgroup cols="4" colsep="0" rowsep="0">
34486 <colspec colwidth="8*" align="left"/>
34487 <colspec colwidth="6*" align="center"/>
34488 <colspec colwidth="6*" align="center"/>
34489 <colspec colwidth="6*" align="right"/>
34492 <entry><option>forbid_include</option></entry>
34493 <entry>Use: <emphasis>redirect</emphasis></entry>
34494 <entry>Type: <emphasis>boolean</emphasis></entry>
34495 <entry>Default: <emphasis>false</emphasis></entry>
34501 If this option is true, items of the form
34503 <literallayout class="monospaced">
34504 :include:<path name>
34507 are not permitted in non-filter redirection lists.
34510 <indexterm role="option">
34511 <primary><option>forbid_pipe</option></primary>
34514 <informaltable frame="all">
34515 <tgroup cols="4" colsep="0" rowsep="0">
34516 <colspec colwidth="8*" align="left"/>
34517 <colspec colwidth="6*" align="center"/>
34518 <colspec colwidth="6*" align="center"/>
34519 <colspec colwidth="6*" align="right"/>
34522 <entry><option>forbid_pipe</option></entry>
34523 <entry>Use: <emphasis>redirect</emphasis></entry>
34524 <entry>Type: <emphasis>boolean</emphasis></entry>
34525 <entry>Default: <emphasis>false</emphasis></entry>
34531 <indexterm role="concept">
34532 <primary>delivery</primary>
34533 <secondary>to pipe; forbidding</secondary>
34535 If this option is true, this router may not generate a new address which
34536 specifies delivery to a pipe, either from an Exim filter or from a conventional
34537 forward file. This option is forced to be true if <option>one_time</option> is set.
34540 <indexterm role="option">
34541 <primary><option>forbid_sieve_filter</option></primary>
34544 <informaltable frame="all">
34545 <tgroup cols="4" colsep="0" rowsep="0">
34546 <colspec colwidth="8*" align="left"/>
34547 <colspec colwidth="6*" align="center"/>
34548 <colspec colwidth="6*" align="center"/>
34549 <colspec colwidth="6*" align="right"/>
34552 <entry><option>forbid_sieve_filter</option></entry>
34553 <entry>Use: <emphasis>redirect</emphasis></entry>
34554 <entry>Type: <emphasis>boolean</emphasis></entry>
34555 <entry>Default: <emphasis>false</emphasis></entry>
34561 If this option is set true, only Exim filters are permitted when
34562 <option>allow_filter</option> is true.
34565 <indexterm role="concept">
34566 <primary>SMTP</primary>
34567 <secondary>error codes</secondary>
34569 <indexterm role="option">
34570 <primary><option>forbid_smtp_code</option></primary>
34573 <informaltable frame="all">
34574 <tgroup cols="4" colsep="0" rowsep="0">
34575 <colspec colwidth="8*" align="left"/>
34576 <colspec colwidth="6*" align="center"/>
34577 <colspec colwidth="6*" align="center"/>
34578 <colspec colwidth="6*" align="right"/>
34581 <entry><option>forbid_smtp_code</option></entry>
34582 <entry>Use: <emphasis>redirect</emphasis></entry>
34583 <entry>Type: <emphasis>boolean</emphasis></entry>
34584 <entry>Default: <emphasis>false</emphasis></entry>
34590 If this option is set true, any SMTP error codes that are present at the start
34591 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
34592 the default codes (451 and 550, respectively) are always used.
34595 <indexterm role="option">
34596 <primary><option>hide_child_in_errmsg</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>hide_child_in_errmsg</option></entry>
34608 <entry>Use: <emphasis>redirect</emphasis></entry>
34609 <entry>Type: <emphasis>boolean</emphasis></entry>
34610 <entry>Default: <emphasis>false</emphasis></entry>
34616 <indexterm role="concept">
34617 <primary>bounce message</primary>
34618 <secondary>redirection details; suppressing</secondary>
34620 If this option is true, it prevents Exim from quoting a child address if it
34621 generates a bounce or delay message for it. Instead it says <quote>an address
34622 generated from <<emphasis>the top level address</emphasis>></quote>. Of course, this applies only to
34623 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
34624 bounce may well quote the generated address.
34627 <indexterm role="option">
34628 <primary><option>ignore_eacces</option></primary>
34631 <informaltable frame="all">
34632 <tgroup cols="4" colsep="0" rowsep="0">
34633 <colspec colwidth="8*" align="left"/>
34634 <colspec colwidth="6*" align="center"/>
34635 <colspec colwidth="6*" align="center"/>
34636 <colspec colwidth="6*" align="right"/>
34639 <entry><option>ignore_eacces</option></entry>
34640 <entry>Use: <emphasis>redirect</emphasis></entry>
34641 <entry>Type: <emphasis>boolean</emphasis></entry>
34642 <entry>Default: <emphasis>false</emphasis></entry>
34648 <indexterm role="concept">
34649 <primary>EACCES</primary>
34651 If this option is set and an attempt to open a redirection file yields the
34652 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
34653 file did not exist.
34656 <indexterm role="option">
34657 <primary><option>ignore_enotdir</option></primary>
34660 <informaltable frame="all">
34661 <tgroup cols="4" colsep="0" rowsep="0">
34662 <colspec colwidth="8*" align="left"/>
34663 <colspec colwidth="6*" align="center"/>
34664 <colspec colwidth="6*" align="center"/>
34665 <colspec colwidth="6*" align="right"/>
34668 <entry><option>ignore_enotdir</option></entry>
34669 <entry>Use: <emphasis>redirect</emphasis></entry>
34670 <entry>Type: <emphasis>boolean</emphasis></entry>
34671 <entry>Default: <emphasis>false</emphasis></entry>
34677 <indexterm role="concept">
34678 <primary>ENOTDIR</primary>
34680 If this option is set and an attempt to open a redirection file yields the
34681 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
34682 router behaves as if the file did not exist.
34685 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
34686 router that has the <option>file</option> option set discovers that the file does not exist
34687 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
34688 against unmounted NFS directories. If the parent can not be statted, delivery
34689 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
34690 is set, because that option tells Exim to ignore <quote>something on the path is not
34691 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
34692 that some operating systems give ENOENT where others give ENOTDIR.
34695 <indexterm role="option">
34696 <primary><option>include_directory</option></primary>
34699 <informaltable frame="all">
34700 <tgroup cols="4" colsep="0" rowsep="0">
34701 <colspec colwidth="8*" align="left"/>
34702 <colspec colwidth="6*" align="center"/>
34703 <colspec colwidth="6*" align="center"/>
34704 <colspec colwidth="6*" align="right"/>
34707 <entry><option>include_directory</option></entry>
34708 <entry>Use: <emphasis>redirect</emphasis></entry>
34709 <entry>Type: <emphasis>string</emphasis></entry>
34710 <entry>Default: <emphasis>unset</emphasis></entry>
34716 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
34717 redirection list must start with this directory.
34720 <indexterm role="option">
34721 <primary><option>modemask</option></primary>
34724 <informaltable frame="all">
34725 <tgroup cols="4" colsep="0" rowsep="0">
34726 <colspec colwidth="8*" align="left"/>
34727 <colspec colwidth="6*" align="center"/>
34728 <colspec colwidth="6*" align="center"/>
34729 <colspec colwidth="6*" align="right"/>
34732 <entry><option>modemask</option></entry>
34733 <entry>Use: <emphasis>redirect</emphasis></entry>
34734 <entry>Type: <emphasis>octal integer</emphasis></entry>
34735 <entry>Default: <emphasis>022</emphasis></entry>
34741 This specifies mode bits which must not be set for a file specified by the
34742 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
34745 <indexterm role="option">
34746 <primary><option>one_time</option></primary>
34749 <informaltable frame="all">
34750 <tgroup cols="4" colsep="0" rowsep="0">
34751 <colspec colwidth="8*" align="left"/>
34752 <colspec colwidth="6*" align="center"/>
34753 <colspec colwidth="6*" align="center"/>
34754 <colspec colwidth="6*" align="right"/>
34757 <entry><option>one_time</option></entry>
34758 <entry>Use: <emphasis>redirect</emphasis></entry>
34759 <entry>Type: <emphasis>boolean</emphasis></entry>
34760 <entry>Default: <emphasis>false</emphasis></entry>
34766 <indexterm role="concept">
34767 <primary>one-time aliasing/forwarding expansion</primary>
34769 <indexterm role="concept">
34770 <primary>alias file</primary>
34771 <secondary>one-time expansion</secondary>
34773 <indexterm role="concept">
34774 <primary>forward file</primary>
34775 <secondary>one-time expansion</secondary>
34777 <indexterm role="concept">
34778 <primary>mailing lists</primary>
34779 <secondary>one-time expansion</secondary>
34781 <indexterm role="concept">
34782 <primary>address redirection</primary>
34783 <secondary>one-time expansion</secondary>
34785 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
34786 files each time it tries to deliver a message causes a problem when one or more
34787 of the generated addresses fails be delivered at the first attempt. The problem
34788 is not one of duplicate delivery – Exim is clever enough to handle that –
34789 but of what happens when the redirection list changes during the time that the
34790 message is on Exim’s queue. This is particularly true in the case of mailing
34791 lists, where new subscribers might receive copies of messages that were posted
34792 before they subscribed.
34795 If <option>one_time</option> is set and any addresses generated by the router fail to
34796 deliver at the first attempt, the failing addresses are added to the message as
34797 <quote>top level</quote> addresses, and the parent address that generated them is marked
34798 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
34802 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
34803 router would be lost if delivery did not succeed at the first attempt. For this
34804 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
34805 permitted when <option>one_time</option> is set.
34808 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
34809 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
34810 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
34813 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
34814 <option>one_time</option>.
34817 The original top-level address is remembered with each of the generated
34818 addresses, and is output in any log messages. However, any intermediate parent
34819 addresses are not recorded. This makes a difference to the log only if
34820 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
34821 typically be used for mailing lists, where there is normally just one level of
34825 <indexterm role="option">
34826 <primary><option>owners</option></primary>
34829 <informaltable frame="all">
34830 <tgroup cols="4" colsep="0" rowsep="0">
34831 <colspec colwidth="8*" align="left"/>
34832 <colspec colwidth="6*" align="center"/>
34833 <colspec colwidth="6*" align="center"/>
34834 <colspec colwidth="6*" align="right"/>
34837 <entry><option>owners</option></entry>
34838 <entry>Use: <emphasis>redirect</emphasis></entry>
34839 <entry>Type: <emphasis>string list</emphasis></entry>
34840 <entry>Default: <emphasis>unset</emphasis></entry>
34846 <indexterm role="concept">
34847 <primary>ownership</primary>
34848 <secondary>alias file</secondary>
34850 <indexterm role="concept">
34851 <primary>ownership</primary>
34852 <secondary>forward file</secondary>
34854 <indexterm role="concept">
34855 <primary>alias file</primary>
34856 <secondary>ownership</secondary>
34858 <indexterm role="concept">
34859 <primary>forward file</primary>
34860 <secondary>ownership</secondary>
34862 This specifies a list of permitted owners for the file specified by <option>file</option>.
34863 This list is in addition to the local user when <option>check_local_user</option> is set.
34864 See <option>check_owner</option> above.
34867 <indexterm role="option">
34868 <primary><option>owngroups</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>owngroups</option></entry>
34880 <entry>Use: <emphasis>redirect</emphasis></entry>
34881 <entry>Type: <emphasis>string list</emphasis></entry>
34882 <entry>Default: <emphasis>unset</emphasis></entry>
34888 This specifies a list of permitted groups for the file specified by <option>file</option>.
34889 The list is in addition to the local user’s primary group when
34890 <option>check_local_user</option> is set. See <option>check_group</option> above.
34893 <indexterm role="option">
34894 <primary><option>pipe_transport</option></primary>
34897 <informaltable frame="all">
34898 <tgroup cols="4" colsep="0" rowsep="0">
34899 <colspec colwidth="8*" align="left"/>
34900 <colspec colwidth="6*" align="center"/>
34901 <colspec colwidth="6*" align="center"/>
34902 <colspec colwidth="6*" align="right"/>
34905 <entry><option>pipe_transport</option></entry>
34906 <entry>Use: <emphasis>redirect</emphasis></entry>
34907 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34908 <entry>Default: <emphasis>unset</emphasis></entry>
34914 <indexterm role="variable">
34915 <primary><varname>$address_pipe</varname></primary>
34917 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
34918 starting with a vertical bar character is specified as a new <quote>address</quote>. The
34919 transport used is specified by this option, which, after expansion, must be the
34920 name of a configured transport. This should normally be a <command>pipe</command> transport.
34921 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
34924 <indexterm role="option">
34925 <primary><option>qualify_domain</option></primary>
34928 <informaltable frame="all">
34929 <tgroup cols="4" colsep="0" rowsep="0">
34930 <colspec colwidth="8*" align="left"/>
34931 <colspec colwidth="6*" align="center"/>
34932 <colspec colwidth="6*" align="center"/>
34933 <colspec colwidth="6*" align="right"/>
34936 <entry><option>qualify_domain</option></entry>
34937 <entry>Use: <emphasis>redirect</emphasis></entry>
34938 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
34939 <entry>Default: <emphasis>unset</emphasis></entry>
34945 <indexterm role="variable">
34946 <primary><varname>$qualify_recipient</varname></primary>
34948 If this option is set, and an unqualified address (one without a domain) is
34949 generated, and that address would normally be qualified by the global setting
34950 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
34951 expanding this string. If the expansion fails, the router declines. If you want
34952 to revert to the default, you can have the expansion generate
34953 <varname>$qualify_recipient</varname>.
34956 This option applies to all unqualified addresses generated by Exim filters,
34957 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
34958 not preceded by a backslash. Sieve filters cannot generate unqualified
34962 <indexterm role="option">
34963 <primary><option>qualify_preserve_domain</option></primary>
34966 <informaltable frame="all">
34967 <tgroup cols="4" colsep="0" rowsep="0">
34968 <colspec colwidth="8*" align="left"/>
34969 <colspec colwidth="6*" align="center"/>
34970 <colspec colwidth="6*" align="center"/>
34971 <colspec colwidth="6*" align="right"/>
34974 <entry><option>qualify_preserve_domain</option></entry>
34975 <entry>Use: <emphasis>redirect</emphasis></entry>
34976 <entry>Type: <emphasis>boolean</emphasis></entry>
34977 <entry>Default: <emphasis>false</emphasis></entry>
34983 <indexterm role="concept">
34984 <primary>domain</primary>
34985 <secondary>in redirection; preserving</secondary>
34987 <indexterm role="concept">
34988 <primary>preserving domain in redirection</primary>
34990 <indexterm role="concept">
34991 <primary>address redirection</primary>
34992 <secondary>domain; preserving</secondary>
34994 If this option is set, the router’s local <option>qualify_domain</option> option must not be
34995 set (a configuration error occurs if it is). If an unqualified address (one
34996 without a domain) is generated, it is qualified with the domain of the parent
34997 address (the immediately preceding ancestor) instead of the global
34998 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
34999 this applies whether or not the address is preceded by a backslash.
35002 <indexterm role="option">
35003 <primary><option>repeat_use</option></primary>
35006 <informaltable frame="all">
35007 <tgroup cols="4" colsep="0" rowsep="0">
35008 <colspec colwidth="8*" align="left"/>
35009 <colspec colwidth="6*" align="center"/>
35010 <colspec colwidth="6*" align="center"/>
35011 <colspec colwidth="6*" align="right"/>
35014 <entry><option>repeat_use</option></entry>
35015 <entry>Use: <emphasis>redirect</emphasis></entry>
35016 <entry>Type: <emphasis>boolean</emphasis></entry>
35017 <entry>Default: <emphasis>true</emphasis></entry>
35023 If this option is set false, the router is skipped for a child address that has
35024 any ancestor that was routed by this router. This test happens before any of
35025 the other preconditions are tested. Exim’s default anti-looping rules skip
35026 only when the ancestor is the same as the current address. See also
35027 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
35030 <indexterm role="option">
35031 <primary><option>reply_transport</option></primary>
35034 <informaltable frame="all">
35035 <tgroup cols="4" colsep="0" rowsep="0">
35036 <colspec colwidth="8*" align="left"/>
35037 <colspec colwidth="6*" align="center"/>
35038 <colspec colwidth="6*" align="center"/>
35039 <colspec colwidth="6*" align="right"/>
35042 <entry><option>reply_transport</option></entry>
35043 <entry>Use: <emphasis>redirect</emphasis></entry>
35044 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35045 <entry>Default: <emphasis>unset</emphasis></entry>
35051 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
35052 <option>vacation</option> command is used in a filter file. The transport used is specified
35053 by this option, which, after expansion, must be the name of a configured
35054 transport. This should normally be an <command>autoreply</command> transport. Other transports
35055 are unlikely to do anything sensible or useful.
35058 <indexterm role="option">
35059 <primary><option>rewrite</option></primary>
35062 <informaltable frame="all">
35063 <tgroup cols="4" colsep="0" rowsep="0">
35064 <colspec colwidth="8*" align="left"/>
35065 <colspec colwidth="6*" align="center"/>
35066 <colspec colwidth="6*" align="center"/>
35067 <colspec colwidth="6*" align="right"/>
35070 <entry><option>rewrite</option></entry>
35071 <entry>Use: <emphasis>redirect</emphasis></entry>
35072 <entry>Type: <emphasis>boolean</emphasis></entry>
35073 <entry>Default: <emphasis>true</emphasis></entry>
35079 <indexterm role="concept">
35080 <primary>address redirection</primary>
35081 <secondary>disabling rewriting</secondary>
35083 If this option is set false, addresses generated by the router are not
35084 subject to address rewriting. Otherwise, they are treated like new addresses
35085 and are rewritten according to the global rewriting rules.
35088 <indexterm role="option">
35089 <primary><option>sieve_subaddress</option></primary>
35092 <informaltable frame="all">
35093 <tgroup cols="4" colsep="0" rowsep="0">
35094 <colspec colwidth="8*" align="left"/>
35095 <colspec colwidth="6*" align="center"/>
35096 <colspec colwidth="6*" align="center"/>
35097 <colspec colwidth="6*" align="right"/>
35100 <entry><option>sieve_subaddress</option></entry>
35101 <entry>Use: <emphasis>redirect</emphasis></entry>
35102 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35103 <entry>Default: <emphasis>unset</emphasis></entry>
35109 The value of this option is passed to a Sieve filter to specify the
35110 :subaddress part of an address.
35113 <indexterm role="option">
35114 <primary><option>sieve_useraddress</option></primary>
35117 <informaltable frame="all">
35118 <tgroup cols="4" colsep="0" rowsep="0">
35119 <colspec colwidth="8*" align="left"/>
35120 <colspec colwidth="6*" align="center"/>
35121 <colspec colwidth="6*" align="center"/>
35122 <colspec colwidth="6*" align="right"/>
35125 <entry><option>sieve_useraddress</option></entry>
35126 <entry>Use: <emphasis>redirect</emphasis></entry>
35127 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35128 <entry>Default: <emphasis>unset</emphasis></entry>
35134 The value of this option is passed to a Sieve filter to specify the :user part
35135 of an address. However, if it is unset, the entire original local part
35136 (including any prefix or suffix) is used for :user.
35139 <indexterm role="option">
35140 <primary><option>sieve_vacation_directory</option></primary>
35143 <informaltable frame="all">
35144 <tgroup cols="4" colsep="0" rowsep="0">
35145 <colspec colwidth="8*" align="left"/>
35146 <colspec colwidth="6*" align="center"/>
35147 <colspec colwidth="6*" align="center"/>
35148 <colspec colwidth="6*" align="right"/>
35151 <entry><option>sieve_vacation_directory</option></entry>
35152 <entry>Use: <emphasis>redirect</emphasis></entry>
35153 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35154 <entry>Default: <emphasis>unset</emphasis></entry>
35160 <indexterm role="concept">
35161 <primary>Sieve filter</primary>
35162 <secondary>vacation directory</secondary>
35164 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
35165 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
35166 (do not put anything else in that directory), and ensure that the
35167 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
35168 needs their own directory; Exim will create it if necessary.
35171 <indexterm role="option">
35172 <primary><option>skip_syntax_errors</option></primary>
35175 <informaltable frame="all">
35176 <tgroup cols="4" colsep="0" rowsep="0">
35177 <colspec colwidth="8*" align="left"/>
35178 <colspec colwidth="6*" align="center"/>
35179 <colspec colwidth="6*" align="center"/>
35180 <colspec colwidth="6*" align="right"/>
35183 <entry><option>skip_syntax_errors</option></entry>
35184 <entry>Use: <emphasis>redirect</emphasis></entry>
35185 <entry>Type: <emphasis>boolean</emphasis></entry>
35186 <entry>Default: <emphasis>false</emphasis></entry>
35192 <indexterm role="concept">
35193 <primary>forward file</primary>
35194 <secondary>broken</secondary>
35196 <indexterm role="concept">
35197 <primary>address redirection</primary>
35198 <secondary>broken files</secondary>
35200 <indexterm role="concept">
35201 <primary>alias file</primary>
35202 <secondary>broken</secondary>
35204 <indexterm role="concept">
35205 <primary>broken alias or forward files</primary>
35207 <indexterm role="concept">
35208 <primary>ignoring faulty addresses</primary>
35210 <indexterm role="concept">
35211 <primary>skipping faulty addresses</primary>
35213 <indexterm role="concept">
35214 <primary>error</primary>
35215 <secondary>skipping bad syntax</secondary>
35217 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
35218 non-filter redirection data are skipped, and each failing address is logged. If
35219 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
35220 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
35221 are expanded and placed at the head of the error message generated by
35222 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
35223 be the same address as the generic <option>errors_to</option> option. The
35224 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
35227 If all the addresses in a redirection list are skipped because of syntax
35228 errors, the router declines to handle the original address, and it is passed to
35229 the following routers.
35232 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
35233 error in the filter causes filtering to be abandoned without any action being
35234 taken. The incident is logged, and the router declines to handle the address,
35235 so it is passed to the following routers.
35238 <indexterm role="concept">
35239 <primary>Sieve filter</primary>
35240 <secondary>syntax errors in</secondary>
35242 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
35243 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
35244 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
35247 <option>skip_syntax_errors</option> can be used to specify that errors in users’ forward
35248 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
35249 option, used with an address that does not get redirected, can be used to
35250 notify users of these errors, by means of a router like this:
35252 <literallayout class="monospaced">
35257 file = $home/.forward
35258 file_transport = address_file
35259 pipe_transport = address_pipe
35260 reply_transport = address_reply
35263 syntax_errors_to = real-$local_part@$domain
35264 syntax_errors_text = \
35265 This is an automatically generated message. An error has\n\
35266 been found in your .forward file. Details of the error are\n\
35267 reported below. While this error persists, you will receive\n\
35268 a copy of this message for every message that is addressed\n\
35269 to you. If your .forward file is a filter file, or if it is\n\
35270 a non-filter file containing no valid forwarding addresses,\n\
35271 a copy of each incoming message will be put in your normal\n\
35272 mailbox. If a non-filter file contains at least one valid\n\
35273 forwarding address, forwarding to the valid addresses will\n\
35274 happen, and those will be the only deliveries that occur.
35277 You also need a router to ensure that local addresses that are prefixed by
35278 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
35279 put this immediately before the <command>userforward</command> router:
35281 <literallayout class="monospaced">
35285 local_part_prefix = real-
35286 transport = local_delivery
35289 For security, it would probably be a good idea to restrict the use of this
35290 router to locally-generated messages, using a condition such as this:
35292 <literallayout class="monospaced">
35293 condition = ${if match {$sender_host_address}\
35294 {\N^(|127\.0\.0\.1)$\N}}
35297 <indexterm role="option">
35298 <primary><option>syntax_errors_text</option></primary>
35301 <informaltable frame="all">
35302 <tgroup cols="4" colsep="0" rowsep="0">
35303 <colspec colwidth="8*" align="left"/>
35304 <colspec colwidth="6*" align="center"/>
35305 <colspec colwidth="6*" align="center"/>
35306 <colspec colwidth="6*" align="right"/>
35309 <entry><option>syntax_errors_text</option></entry>
35310 <entry>Use: <emphasis>redirect</emphasis></entry>
35311 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35312 <entry>Default: <emphasis>unset</emphasis></entry>
35318 See <option>skip_syntax_errors</option> above.
35321 <indexterm role="option">
35322 <primary><option>syntax_errors_to</option></primary>
35325 <informaltable frame="all">
35326 <tgroup cols="4" colsep="0" rowsep="0">
35327 <colspec colwidth="8*" align="left"/>
35328 <colspec colwidth="6*" align="center"/>
35329 <colspec colwidth="6*" align="center"/>
35330 <colspec colwidth="6*" align="right"/>
35333 <entry><option>syntax_errors_to</option></entry>
35334 <entry>Use: <emphasis>redirect</emphasis></entry>
35335 <entry>Type: <emphasis>string</emphasis></entry>
35336 <entry>Default: <emphasis>unset</emphasis></entry>
35342 See <option>skip_syntax_errors</option> above.
35343 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
35344 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
35349 <chapter id="CHAPenvironment">
35350 <title>Environment for running local transports</title>
35351 <titleabbrev>Environment for local transports</titleabbrev>
35353 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
35354 <primary>local transports</primary>
35355 <secondary>environment for</secondary>
35357 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
35358 <primary>environment for local transports</primary>
35360 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
35361 <primary>transport</primary>
35362 <secondary>local; environment for</secondary>
35364 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
35365 transport can be thought of as similar to a pipe.) Exim always runs transports
35366 in subprocesses, under specified uids and gids. Typical deliveries to local
35367 mailboxes run under the uid and gid of the local user.
35370 Exim also sets a specific current directory while running the transport; for
35371 some transports a home directory setting is also relevant. The <command>pipe</command>
35372 transport is the only one that sets up environment variables; see section
35373 <xref linkend="SECTpipeenv"/> for details.
35376 The values used for the uid, gid, and the directories may come from several
35377 different places. In many cases, the router that handles the address associates
35378 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
35379 or <option>user</option> options. However, values may also be given in the transport’s own
35380 configuration, and these override anything that comes from the router.
35382 <section id="SECID131">
35383 <title>Concurrent deliveries</title>
35385 <indexterm role="concept">
35386 <primary>concurrent deliveries</primary>
35388 <indexterm role="concept">
35389 <primary>simultaneous deliveries</primary>
35391 If two different messages for the same local recipient arrive more or less
35392 simultaneously, the two delivery processes are likely to run concurrently. When
35393 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
35394 rules to stop concurrent processes from writing to the same file at the same
35398 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
35399 locking that is needed. Here is a silly example:
35401 <literallayout class="monospaced">
35404 command = /bin/sh -c 'cat >>/some/file'
35407 This is supposed to write the message at the end of the file. However, if two
35408 messages arrive at the same time, the file will be scrambled. You can use the
35409 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
35410 file using the same algorithm that Exim itself uses.
35413 <section id="SECTenvuidgid">
35414 <title>Uids and gids</title>
35416 <indexterm role="concept">
35417 <primary>local transports</primary>
35418 <secondary>uid and gid</secondary>
35420 <indexterm role="concept">
35421 <primary>transport</primary>
35422 <secondary>local; uid and gid</secondary>
35424 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
35425 overrides any group that the router set in the address, even if <option>user</option> is not
35426 set for the transport. This makes it possible, for example, to run local mail
35427 delivery under the uid of the recipient (set by the router), but in a special
35428 group (set by the transport). For example:
35430 <literallayout class="monospaced">
35432 # User/group are set by check_local_user in this router
35436 transport = group_delivery
35439 # This transport overrides the group
35441 driver = appendfile
35442 file = /var/spool/mail/$local_part
35446 If <option>user</option> is set for a transport, its value overrides what is set in the
35447 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
35448 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
35452 <indexterm role="option">
35453 <primary><option>initgroups</option></primary>
35455 When the uid is taken from the transport’s configuration, the <function>initgroups()</function>
35456 function is called for the groups associated with that uid if the
35457 <option>initgroups</option> option is set for the transport. When the uid is not specified
35458 by the transport, but is associated with the address by a router, the option
35459 for calling <function>initgroups()</function> is taken from the router configuration.
35462 <indexterm role="concept">
35463 <primary><command>pipe</command> transport</primary>
35464 <secondary>uid for</secondary>
35466 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
35467 is set and <option>user</option> is not set, the uid of the process that called Exim to
35468 receive the message is used, and if <option>group</option> is not set, the corresponding
35469 original gid is also used.
35472 This is the detailed preference order for obtaining a gid; the first of the
35473 following that is set is used:
35478 A <option>group</option> setting of the transport;
35483 A <option>group</option> setting of the router;
35488 A gid associated with a user setting of the router, either as a result of
35489 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
35494 The group associated with a non-numeric <option>user</option> setting of the transport;
35499 In a <command>pipe</command> transport, the creator’s gid if <option>deliver_as_creator</option> is set and
35500 the uid is the creator’s uid;
35505 The Exim gid if the Exim uid is being used as a default.
35510 If, for example, the user is specified numerically on the router and there are
35511 no group settings, no gid is available. In this situation, an error occurs.
35512 This is different for the uid, for which there always is an ultimate default.
35513 The first of the following that is set is used:
35518 A <option>user</option> setting of the transport;
35523 In a <command>pipe</command> transport, the creator’s uid if <option>deliver_as_creator</option> is set;
35528 A <option>user</option> setting of the router;
35533 A <option>check_local_user</option> setting of the router;
35543 Of course, an error will still occur if the uid that is chosen is on the
35544 <option>never_users</option> list.
35547 <section id="SECID132">
35548 <title>Current and home directories</title>
35550 <indexterm role="concept">
35551 <primary>current directory for local transport</primary>
35553 <indexterm role="concept">
35554 <primary>home directory</primary>
35555 <secondary>for local transport</secondary>
35557 <indexterm role="concept">
35558 <primary>transport</primary>
35559 <secondary>local; home directory for</secondary>
35561 <indexterm role="concept">
35562 <primary>transport</primary>
35563 <secondary>local; current directory for</secondary>
35565 Routers may set current and home directories for local transports by means of
35566 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
35567 However, if the transport’s <option>current_directory</option> or <option>home_directory</option> options
35568 are set, they override the router’s values. In detail, the home directory
35569 for a local transport is taken from the first of these values that is set:
35574 The <option>home_directory</option> option on the transport;
35579 The <option>transport_home_directory</option> option on the router;
35584 The password data if <option>check_local_user</option> is set on the router;
35589 The <option>router_home_directory</option> option on the router.
35594 The current directory is taken from the first of these values that is set:
35599 The <option>current_directory</option> option on the transport;
35604 The <option>transport_current_directory</option> option on the router.
35609 If neither the router nor the transport sets a current directory, Exim uses the
35610 value of the home directory, if it is set. Otherwise it sets the current
35611 directory to <filename>/</filename> before running a local transport.
35614 <section id="SECID133">
35615 <title>Expansion variables derived from the address</title>
35617 <indexterm role="variable">
35618 <primary><varname>$domain</varname></primary>
35620 <indexterm role="variable">
35621 <primary><varname>$local_part</varname></primary>
35623 <indexterm role="variable">
35624 <primary><varname>$original_domain</varname></primary>
35626 Normally a local delivery is handling a single address, and in that case the
35627 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
35628 deliveries. However, in some circumstances more than one address may be handled
35629 at once (for example, while writing batch SMTP for onward transmission by some
35630 other means). In this case, the variables associated with the local part are
35631 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
35632 and <varname>$original_domain</varname> is never set.
35633 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
35634 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
35635 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
35640 <chapter id="CHAPtransportgeneric">
35641 <title>Generic options for transports</title>
35643 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
35644 <primary>generic options</primary>
35645 <secondary>transport</secondary>
35647 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
35648 <primary>options</primary>
35649 <secondary>generic; for transports</secondary>
35651 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
35652 <primary>transport</primary>
35653 <secondary>generic options for</secondary>
35655 The following generic options apply to all transports:
35658 <indexterm role="option">
35659 <primary><option>body_only</option></primary>
35662 <informaltable frame="all">
35663 <tgroup cols="4" colsep="0" rowsep="0">
35664 <colspec colwidth="8*" align="left"/>
35665 <colspec colwidth="6*" align="center"/>
35666 <colspec colwidth="6*" align="center"/>
35667 <colspec colwidth="6*" align="right"/>
35670 <entry><option>body_only</option></entry>
35671 <entry>Use: <emphasis>transports</emphasis></entry>
35672 <entry>Type: <emphasis>boolean</emphasis></entry>
35673 <entry>Default: <emphasis>false</emphasis></entry>
35679 <indexterm role="concept">
35680 <primary>transport</primary>
35681 <secondary>body only</secondary>
35683 <indexterm role="concept">
35684 <primary>message</primary>
35685 <secondary>transporting body only</secondary>
35687 <indexterm role="concept">
35688 <primary>body of message</primary>
35689 <secondary>transporting</secondary>
35691 If this option is set, the message’s headers are not transported. It is
35692 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
35693 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
35694 <option>message_suffix</option> should be checked, because this option does not
35695 automatically suppress them.
35698 <indexterm role="option">
35699 <primary><option>current_directory</option></primary>
35702 <informaltable frame="all">
35703 <tgroup cols="4" colsep="0" rowsep="0">
35704 <colspec colwidth="8*" align="left"/>
35705 <colspec colwidth="6*" align="center"/>
35706 <colspec colwidth="6*" align="center"/>
35707 <colspec colwidth="6*" align="right"/>
35710 <entry><option>current_directory</option></entry>
35711 <entry>Use: <emphasis>transports</emphasis></entry>
35712 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35713 <entry>Default: <emphasis>unset</emphasis></entry>
35719 <indexterm role="concept">
35720 <primary>transport</primary>
35721 <secondary>current directory for</secondary>
35723 This specifies the current directory that is to be set while running the
35724 transport, overriding any value that may have been set by the router.
35725 If the expansion fails for any reason, including forced failure, an error is
35726 logged, and delivery is deferred.
35729 <indexterm role="option">
35730 <primary><option>disable_logging</option></primary>
35733 <informaltable frame="all">
35734 <tgroup cols="4" colsep="0" rowsep="0">
35735 <colspec colwidth="8*" align="left"/>
35736 <colspec colwidth="6*" align="center"/>
35737 <colspec colwidth="6*" align="center"/>
35738 <colspec colwidth="6*" align="right"/>
35741 <entry><option>disable_logging</option></entry>
35742 <entry>Use: <emphasis>transports</emphasis></entry>
35743 <entry>Type: <emphasis>boolean</emphasis></entry>
35744 <entry>Default: <emphasis>false</emphasis></entry>
35750 If this option is set true, nothing is logged for any
35751 deliveries by the transport or for any
35752 transport errors. You should not set this option unless you really, really know
35753 what you are doing.
35756 <indexterm role="option">
35757 <primary><option>debug_print</option></primary>
35760 <informaltable frame="all">
35761 <tgroup cols="4" colsep="0" rowsep="0">
35762 <colspec colwidth="8*" align="left"/>
35763 <colspec colwidth="6*" align="center"/>
35764 <colspec colwidth="6*" align="center"/>
35765 <colspec colwidth="6*" align="right"/>
35768 <entry><option>debug_print</option></entry>
35769 <entry>Use: <emphasis>transports</emphasis></entry>
35770 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35771 <entry>Default: <emphasis>unset</emphasis></entry>
35777 <indexterm role="concept">
35778 <primary>testing</primary>
35779 <secondary>variables in drivers</secondary>
35781 If this option is set and debugging is enabled (see the <option>-d</option> command line
35782 option), the string is expanded and included in the debugging output when the
35784 If expansion of the string fails, the error message is written to the debugging
35785 output, and Exim carries on processing.
35786 This facility is provided to help with checking out the values of variables and
35787 so on when debugging driver configurations. For example, if a <option>headers_add</option>
35788 option is not working properly, <option>debug_print</option> could be used to output the
35789 variables it references. A newline is added to the text if it does not end with
35793 <indexterm role="option">
35794 <primary><option>delivery_date_add</option></primary>
35797 <informaltable frame="all">
35798 <tgroup cols="4" colsep="0" rowsep="0">
35799 <colspec colwidth="8*" align="left"/>
35800 <colspec colwidth="6*" align="center"/>
35801 <colspec colwidth="6*" align="center"/>
35802 <colspec colwidth="6*" align="right"/>
35805 <entry><option>delivery_date_add</option></entry>
35806 <entry>Use: <emphasis>transports</emphasis></entry>
35807 <entry>Type: <emphasis>boolean</emphasis></entry>
35808 <entry>Default: <emphasis>false</emphasis></entry>
35814 <indexterm role="concept">
35815 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
35817 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
35818 This gives the actual time the delivery was made. As this is not a standard
35819 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
35820 requests its removal from incoming messages, so that delivered messages can
35821 safely be resent to other recipients.
35824 <indexterm role="option">
35825 <primary><option>driver</option></primary>
35828 <informaltable frame="all">
35829 <tgroup cols="4" colsep="0" rowsep="0">
35830 <colspec colwidth="8*" align="left"/>
35831 <colspec colwidth="6*" align="center"/>
35832 <colspec colwidth="6*" align="center"/>
35833 <colspec colwidth="6*" align="right"/>
35836 <entry><option>driver</option></entry>
35837 <entry>Use: <emphasis>transports</emphasis></entry>
35838 <entry>Type: <emphasis>string</emphasis></entry>
35839 <entry>Default: <emphasis>unset</emphasis></entry>
35845 This specifies which of the available transport drivers is to be used.
35846 There is no default, and this option must be set for every transport.
35849 <indexterm role="option">
35850 <primary><option>envelope_to_add</option></primary>
35853 <informaltable frame="all">
35854 <tgroup cols="4" colsep="0" rowsep="0">
35855 <colspec colwidth="8*" align="left"/>
35856 <colspec colwidth="6*" align="center"/>
35857 <colspec colwidth="6*" align="center"/>
35858 <colspec colwidth="6*" align="right"/>
35861 <entry><option>envelope_to_add</option></entry>
35862 <entry>Use: <emphasis>transports</emphasis></entry>
35863 <entry>Type: <emphasis>boolean</emphasis></entry>
35864 <entry>Default: <emphasis>false</emphasis></entry>
35870 <indexterm role="concept">
35871 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35873 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
35874 This gives the original address(es) in the incoming envelope that caused this
35875 delivery to happen. More than one address may be present if the transport is
35876 configured to handle several addresses at once, or if more than one original
35877 address was redirected to the same final address. As this is not a standard
35878 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
35879 its removal from incoming messages, so that delivered messages can safely be
35880 resent to other recipients.
35883 <indexterm role="option">
35884 <primary><option>group</option></primary>
35887 <informaltable frame="all">
35888 <tgroup cols="4" colsep="0" rowsep="0">
35889 <colspec colwidth="8*" align="left"/>
35890 <colspec colwidth="6*" align="center"/>
35891 <colspec colwidth="6*" align="center"/>
35892 <colspec colwidth="6*" align="right"/>
35895 <entry><option>group</option></entry>
35896 <entry>Use: <emphasis>transports</emphasis></entry>
35897 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35898 <entry>Default: <emphasis>Exim group</emphasis></entry>
35904 <indexterm role="concept">
35905 <primary>transport</primary>
35906 <secondary>group; specifying</secondary>
35908 This option specifies a gid for running the transport process, overriding any
35909 value that the router supplies, and also overriding any value associated with
35910 <option>user</option> (see below).
35913 <indexterm role="option">
35914 <primary><option>headers_add</option></primary>
35917 <informaltable frame="all">
35918 <tgroup cols="4" colsep="0" rowsep="0">
35919 <colspec colwidth="8*" align="left"/>
35920 <colspec colwidth="6*" align="center"/>
35921 <colspec colwidth="6*" align="center"/>
35922 <colspec colwidth="6*" align="right"/>
35925 <entry><option>headers_add</option></entry>
35926 <entry>Use: <emphasis>transports</emphasis></entry>
35927 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
35928 <entry>Default: <emphasis>unset</emphasis></entry>
35934 <indexterm role="concept">
35935 <primary>header lines</primary>
35936 <secondary>adding in transport</secondary>
35938 <indexterm role="concept">
35939 <primary>transport</primary>
35940 <secondary>header lines; adding</secondary>
35942 This option specifies a string of text that is expanded and added to the header
35943 portion of a message as it is transported, as described in section
35944 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
35945 routers. If the result of the expansion is an empty string, or if the expansion
35946 is forced to fail, no action is taken. Other expansion failures are treated as
35947 errors and cause the delivery to be deferred.
35950 <indexterm role="option">
35951 <primary><option>headers_only</option></primary>
35954 <informaltable frame="all">
35955 <tgroup cols="4" colsep="0" rowsep="0">
35956 <colspec colwidth="8*" align="left"/>
35957 <colspec colwidth="6*" align="center"/>
35958 <colspec colwidth="6*" align="center"/>
35959 <colspec colwidth="6*" align="right"/>
35962 <entry><option>headers_only</option></entry>
35963 <entry>Use: <emphasis>transports</emphasis></entry>
35964 <entry>Type: <emphasis>boolean</emphasis></entry>
35965 <entry>Default: <emphasis>false</emphasis></entry>
35971 <indexterm role="concept">
35972 <primary>transport</primary>
35973 <secondary>header lines only</secondary>
35975 <indexterm role="concept">
35976 <primary>message</primary>
35977 <secondary>transporting headers only</secondary>
35979 <indexterm role="concept">
35980 <primary>header lines</primary>
35981 <secondary>transporting</secondary>
35983 If this option is set, the message’s body is not transported. It is mutually
35984 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
35985 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
35986 checked, since this option does not automatically suppress them.
35989 <indexterm role="option">
35990 <primary><option>headers_remove</option></primary>
35993 <informaltable frame="all">
35994 <tgroup cols="4" colsep="0" rowsep="0">
35995 <colspec colwidth="8*" align="left"/>
35996 <colspec colwidth="6*" align="center"/>
35997 <colspec colwidth="6*" align="center"/>
35998 <colspec colwidth="6*" align="right"/>
36001 <entry><option>headers_remove</option></entry>
36002 <entry>Use: <emphasis>transports</emphasis></entry>
36003 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36004 <entry>Default: <emphasis>unset</emphasis></entry>
36010 <indexterm role="concept">
36011 <primary>header lines</primary>
36012 <secondary>removing</secondary>
36014 <indexterm role="concept">
36015 <primary>transport</primary>
36016 <secondary>header lines; removing</secondary>
36018 This option specifies a string that is expanded into a list of header names;
36019 these headers are omitted from the message as it is transported, as described
36020 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
36021 routers. If the result of the expansion is an empty string, or if the expansion
36022 is forced to fail, no action is taken. Other expansion failures are treated as
36023 errors and cause the delivery to be deferred.
36026 <indexterm role="option">
36027 <primary><option>headers_rewrite</option></primary>
36030 <informaltable frame="all">
36031 <tgroup cols="4" colsep="0" rowsep="0">
36032 <colspec colwidth="8*" align="left"/>
36033 <colspec colwidth="6*" align="center"/>
36034 <colspec colwidth="6*" align="center"/>
36035 <colspec colwidth="6*" align="right"/>
36038 <entry><option>headers_rewrite</option></entry>
36039 <entry>Use: <emphasis>transports</emphasis></entry>
36040 <entry>Type: <emphasis>string</emphasis></entry>
36041 <entry>Default: <emphasis>unset</emphasis></entry>
36047 <indexterm role="concept">
36048 <primary>transport</primary>
36049 <secondary>header lines; rewriting</secondary>
36051 <indexterm role="concept">
36052 <primary>rewriting</primary>
36053 <secondary>at transport time</secondary>
36055 This option allows addresses in header lines to be rewritten at transport time,
36056 that is, as the message is being copied to its destination. The contents of the
36057 option are a colon-separated list of rewriting rules. Each rule is in exactly
36058 the same form as one of the general rewriting rules that are applied when a
36059 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
36062 <literallayout class="monospaced">
36063 headers_rewrite = a@b c@d f : \
36067 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
36068 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
36069 header lines just before they are written out at transport time, so they affect
36070 only those copies of the message that pass through the transport. However, only
36071 the message’s original header lines, and any that were added by a system
36072 filter, are rewritten. If a router or transport adds header lines, they are not
36073 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
36074 envelope. You can change the return path using <option>return_path</option>, but you cannot
36075 change envelope recipients at this time.
36078 <indexterm role="option">
36079 <primary><option>home_directory</option></primary>
36082 <informaltable frame="all">
36083 <tgroup cols="4" colsep="0" rowsep="0">
36084 <colspec colwidth="8*" align="left"/>
36085 <colspec colwidth="6*" align="center"/>
36086 <colspec colwidth="6*" align="center"/>
36087 <colspec colwidth="6*" align="right"/>
36090 <entry><option>home_directory</option></entry>
36091 <entry>Use: <emphasis>transports</emphasis></entry>
36092 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36093 <entry>Default: <emphasis>unset</emphasis></entry>
36099 <indexterm role="concept">
36100 <primary>transport</primary>
36101 <secondary>home directory for</secondary>
36103 <indexterm role="variable">
36104 <primary><varname>$home</varname></primary>
36106 This option specifies a home directory setting for a local transport,
36107 overriding any value that may be set by the router. The home directory is
36108 placed in <varname>$home</varname> while expanding the transport’s private options. It is also
36109 used as the current directory if no current directory is set by the
36110 <option>current_directory</option> option on the transport or the
36111 <option>transport_current_directory</option> option on the router. If the expansion fails
36112 for any reason, including forced failure, an error is logged, and delivery is
36116 <indexterm role="option">
36117 <primary><option>initgroups</option></primary>
36120 <informaltable frame="all">
36121 <tgroup cols="4" colsep="0" rowsep="0">
36122 <colspec colwidth="8*" align="left"/>
36123 <colspec colwidth="6*" align="center"/>
36124 <colspec colwidth="6*" align="center"/>
36125 <colspec colwidth="6*" align="right"/>
36128 <entry><option>initgroups</option></entry>
36129 <entry>Use: <emphasis>transports</emphasis></entry>
36130 <entry>Type: <emphasis>boolean</emphasis></entry>
36131 <entry>Default: <emphasis>false</emphasis></entry>
36137 <indexterm role="concept">
36138 <primary>additional groups</primary>
36140 <indexterm role="concept">
36141 <primary>groups</primary>
36142 <secondary>additional</secondary>
36144 <indexterm role="concept">
36145 <primary>transport</primary>
36146 <secondary>group; additional</secondary>
36148 If this option is true and the uid for the delivery process is provided by the
36149 transport, the <function>initgroups()</function> function is called when running the transport
36150 to ensure that any additional groups associated with the uid are set up.
36153 <indexterm role="option">
36154 <primary><option>message_size_limit</option></primary>
36157 <informaltable frame="all">
36158 <tgroup cols="4" colsep="0" rowsep="0">
36159 <colspec colwidth="8*" align="left"/>
36160 <colspec colwidth="6*" align="center"/>
36161 <colspec colwidth="6*" align="center"/>
36162 <colspec colwidth="6*" align="right"/>
36165 <entry><option>message_size_limit</option></entry>
36166 <entry>Use: <emphasis>transports</emphasis></entry>
36167 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36168 <entry>Default: <emphasis>0</emphasis></entry>
36174 <indexterm role="concept">
36175 <primary>limit</primary>
36176 <secondary>message size per transport</secondary>
36178 <indexterm role="concept">
36179 <primary>size</primary>
36180 <secondary>of message, limit</secondary>
36182 <indexterm role="concept">
36183 <primary>transport</primary>
36184 <secondary>message size; limiting</secondary>
36186 This option controls the size of messages passed through the transport. It is
36187 expanded before use; the result of the expansion must be a sequence of decimal
36188 digits, optionally followed by K or M. If the expansion fails for any reason,
36189 including forced failure, or if the result is not of the required form,
36190 delivery is deferred. If the value is greater than zero and the size of a
36191 message exceeds this limit, the address is failed. If there is any chance that
36192 the resulting bounce message could be routed to the same transport, you should
36193 ensure that <option>return_size_limit</option> is less than the transport’s
36194 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
36198 <indexterm role="option">
36199 <primary><option>rcpt_include_affixes</option></primary>
36202 <informaltable frame="all">
36203 <tgroup cols="4" colsep="0" rowsep="0">
36204 <colspec colwidth="8*" align="left"/>
36205 <colspec colwidth="6*" align="center"/>
36206 <colspec colwidth="6*" align="center"/>
36207 <colspec colwidth="6*" align="right"/>
36210 <entry><option>rcpt_include_affixes</option></entry>
36211 <entry>Use: <emphasis>transports</emphasis></entry>
36212 <entry>Type: <emphasis>boolean</emphasis></entry>
36213 <entry>Default: <emphasis>false</emphasis></entry>
36219 <indexterm role="concept">
36220 <primary>prefix</primary>
36221 <secondary>for local part, including in envelope</secondary>
36223 <indexterm role="concept">
36224 <primary>suffix for local part</primary>
36225 <secondary>including in envelope</secondary>
36227 <indexterm role="concept">
36228 <primary>local part</primary>
36229 <secondary>prefix</secondary>
36231 <indexterm role="concept">
36232 <primary>local part</primary>
36233 <secondary>suffix</secondary>
36235 When this option is false (the default), and an address that has had any
36236 affixes (prefixes or suffixes) removed from the local part is delivered by any
36237 form of SMTP or LMTP, the affixes are not included. For example, if a router
36240 <literallayout class="monospaced">
36241 local_part_prefix = *-
36244 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
36247 <literallayout class="monospaced">
36248 RCPT TO:<xyz@some.domain>
36251 This is also the case when an ACL-time callout is being used to verify a
36252 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
36253 whole local part is included in the RCPT command. This option applies to BSMTP
36254 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
36255 <command>lmtp</command> and <command>smtp</command> transports.
36258 <indexterm role="option">
36259 <primary><option>retry_use_local_part</option></primary>
36262 <informaltable frame="all">
36263 <tgroup cols="4" colsep="0" rowsep="0">
36264 <colspec colwidth="8*" align="left"/>
36265 <colspec colwidth="6*" align="center"/>
36266 <colspec colwidth="6*" align="center"/>
36267 <colspec colwidth="6*" align="right"/>
36270 <entry><option>retry_use_local_part</option></entry>
36271 <entry>Use: <emphasis>transports</emphasis></entry>
36272 <entry>Type: <emphasis>boolean</emphasis></entry>
36273 <entry>Default: <emphasis>see below</emphasis></entry>
36279 <indexterm role="concept">
36280 <primary>hints database</primary>
36281 <secondary>retry keys</secondary>
36283 When a delivery suffers a temporary failure, a retry record is created
36284 in Exim’s hints database. For remote deliveries, the key for the retry record
36285 is based on the name and/or IP address of the failing remote host. For local
36286 deliveries, the key is normally the entire address, including both the local
36287 part and the domain. This is suitable for most common cases of local delivery
36288 temporary failure – for example, exceeding a mailbox quota should delay only
36289 deliveries to that mailbox, not to the whole domain.
36292 However, in some special cases you may want to treat a temporary local delivery
36293 as a failure associated with the domain, and not with a particular local part.
36294 (For example, if you are storing all mail for some domain in files.) You can do
36295 this by setting <option>retry_use_local_part</option> false.
36298 For all the local transports, its default value is true. For remote transports,
36299 the default value is false for tidiness, but changing the value has no effect
36300 on a remote transport in the current implementation.
36303 <indexterm role="option">
36304 <primary><option>return_path</option></primary>
36307 <informaltable frame="all">
36308 <tgroup cols="4" colsep="0" rowsep="0">
36309 <colspec colwidth="8*" align="left"/>
36310 <colspec colwidth="6*" align="center"/>
36311 <colspec colwidth="6*" align="center"/>
36312 <colspec colwidth="6*" align="right"/>
36315 <entry><option>return_path</option></entry>
36316 <entry>Use: <emphasis>transports</emphasis></entry>
36317 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36318 <entry>Default: <emphasis>unset</emphasis></entry>
36324 <indexterm role="concept">
36325 <primary>envelope sender</primary>
36327 <indexterm role="concept">
36328 <primary>transport</primary>
36329 <secondary>return path; changing</secondary>
36331 <indexterm role="concept">
36332 <primary>return path</primary>
36333 <secondary>changing in transport</secondary>
36335 If this option is set, the string is expanded at transport time and replaces
36336 the existing return path (envelope sender) value in the copy of the message
36337 that is being delivered. An empty return path is permitted. This feature is
36338 designed for remote deliveries, where the value of this option is used in the
36339 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
36340 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
36341 header line, if one is added to the message (see the next option).
36344 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
36345 <option>return_path_on_delivery</option> to the log selector.
36348 <indexterm role="variable">
36349 <primary><varname>$return_path</varname></primary>
36351 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
36352 either the message’s envelope sender, or an address set by the
36353 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
36354 replacement occurs; if it fails for another reason, delivery is deferred. This
36355 option can be used to support VERP (Variable Envelope Return Paths) – see
36356 section <xref linkend="SECTverp"/>.
36359 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
36360 remote server rejects a message at SMTP time, the bounce message is not sent to
36361 the value of this option. It is sent to the previously set errors address.
36362 This defaults to the incoming sender address, but can be changed by setting
36363 <option>errors_to</option> in a router.
36366 <indexterm role="option">
36367 <primary><option>return_path_add</option></primary>
36370 <informaltable frame="all">
36371 <tgroup cols="4" colsep="0" rowsep="0">
36372 <colspec colwidth="8*" align="left"/>
36373 <colspec colwidth="6*" align="center"/>
36374 <colspec colwidth="6*" align="center"/>
36375 <colspec colwidth="6*" align="right"/>
36378 <entry><option>return_path_add</option></entry>
36379 <entry>Use: <emphasis>transports</emphasis></entry>
36380 <entry>Type: <emphasis>boolean</emphasis></entry>
36381 <entry>Default: <emphasis>false</emphasis></entry>
36387 <indexterm role="concept">
36388 <primary><emphasis>Return-path:</emphasis> header line</primary>
36390 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
36391 Although the return path is normally available in the prefix line of BSD
36392 mailboxes, this is commonly not displayed by MUAs, and so the user does not
36393 have easy access to it.
36396 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
36397 the delivery SMTP server makes the final delivery</quote>. This implies that this
36398 header should not be present in incoming messages. Exim has a configuration
36399 option, <option>return_path_remove</option>, which requests removal of this header from
36400 incoming messages, so that delivered messages can safely be resent to other
36404 <indexterm role="option">
36405 <primary><option>shadow_condition</option></primary>
36408 <informaltable frame="all">
36409 <tgroup cols="4" colsep="0" rowsep="0">
36410 <colspec colwidth="8*" align="left"/>
36411 <colspec colwidth="6*" align="center"/>
36412 <colspec colwidth="6*" align="center"/>
36413 <colspec colwidth="6*" align="right"/>
36416 <entry><option>shadow_condition</option></entry>
36417 <entry>Use: <emphasis>transports</emphasis></entry>
36418 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36419 <entry>Default: <emphasis>unset</emphasis></entry>
36425 See <option>shadow_transport</option> below.
36428 <indexterm role="option">
36429 <primary><option>shadow_transport</option></primary>
36432 <informaltable frame="all">
36433 <tgroup cols="4" colsep="0" rowsep="0">
36434 <colspec colwidth="8*" align="left"/>
36435 <colspec colwidth="6*" align="center"/>
36436 <colspec colwidth="6*" align="center"/>
36437 <colspec colwidth="6*" align="right"/>
36440 <entry><option>shadow_transport</option></entry>
36441 <entry>Use: <emphasis>transports</emphasis></entry>
36442 <entry>Type: <emphasis>string</emphasis></entry>
36443 <entry>Default: <emphasis>unset</emphasis></entry>
36449 <indexterm role="concept">
36450 <primary>shadow transport</primary>
36452 <indexterm role="concept">
36453 <primary>transport</primary>
36454 <secondary>shadow</secondary>
36456 A local transport may set the <option>shadow_transport</option> option to the name of
36457 another local transport. Shadow remote transports are not supported.
36460 Whenever a delivery to the main transport succeeds, and either
36461 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
36462 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
36463 passed to the shadow transport, with the same delivery address or addresses. If
36464 expansion fails, no action is taken except that non-forced expansion failures
36465 cause a log line to be written.
36468 The result of the shadow transport is discarded and does not affect the
36469 subsequent processing of the message. Only a single level of shadowing is
36470 provided; the <option>shadow_transport</option> option is ignored on any transport when it
36471 is running as a shadow. Options concerned with output from pipes are also
36472 ignored. The log line for the successful delivery has an item added on the end,
36475 <literallayout class="monospaced">
36476 ST=<shadow transport name>
36479 If the shadow transport did not succeed, the error message is put in
36480 parentheses afterwards. Shadow transports can be used for a number of different
36481 purposes, including keeping more detailed log information than Exim normally
36482 provides, and implementing automatic acknowledgment policies based on message
36483 headers that some sites insist on.
36486 <indexterm role="option">
36487 <primary><option>transport_filter</option></primary>
36490 <informaltable frame="all">
36491 <tgroup cols="4" colsep="0" rowsep="0">
36492 <colspec colwidth="8*" align="left"/>
36493 <colspec colwidth="6*" align="center"/>
36494 <colspec colwidth="6*" align="center"/>
36495 <colspec colwidth="6*" align="right"/>
36498 <entry><option>transport_filter</option></entry>
36499 <entry>Use: <emphasis>transports</emphasis></entry>
36500 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36501 <entry>Default: <emphasis>unset</emphasis></entry>
36507 <indexterm role="concept">
36508 <primary>transport</primary>
36509 <secondary>filter</secondary>
36511 <indexterm role="concept">
36512 <primary>filter</primary>
36513 <secondary>transport filter</secondary>
36515 This option sets up a filtering (in the Unix shell sense) process for messages
36516 at transport time. It should not be confused with mail filtering as set up by
36517 individual users or via a system filter.
36520 When the message is about to be written out, the command specified by
36521 <option>transport_filter</option> is started up in a separate, parallel process, and
36522 the entire message, including the header lines, is passed to it on its standard
36523 input (this in fact is done from a third process, to avoid deadlock). The
36524 command must be specified as an absolute path.
36527 The lines of the message that are written to the transport filter are
36528 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
36529 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
36530 lines beginning with a dot, and also before any processing implied by the
36531 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
36532 <command>pipe</command> transports.
36535 The standard error for the filter process is set to the same destination as its
36536 standard output; this is read and written to the message’s ultimate
36537 destination. The process that writes the message to the filter, the
36538 filter itself, and the original process that reads the result and delivers it
36539 are all run in parallel, like a shell pipeline.
36542 The filter can perform any transformations it likes, but of course should take
36543 care not to break RFC 2822 syntax. Exim does not check the result, except to
36544 test for a final newline when SMTP is in use. All messages transmitted over
36545 SMTP must end with a newline, so Exim supplies one if it is missing.
36548 <indexterm role="concept">
36549 <primary>content scanning</primary>
36550 <secondary>per user</secondary>
36552 A transport filter can be used to provide content-scanning on a per-user basis
36553 at delivery time if the only required effect of the scan is to modify the
36554 message. For example, a content scan could insert a new header line containing
36555 a spam score. This could be interpreted by a filter in the user’s MUA. It is
36556 not possible to discard a message at this stage.
36559 <indexterm role="concept">
36560 <primary>SMTP</primary>
36561 <secondary>SIZE</secondary>
36563 A problem might arise if the filter increases the size of a message that is
36564 being sent down an SMTP connection. If the receiving SMTP server has indicated
36565 support for the SIZE parameter, Exim will have sent the size of the message
36566 at the start of the SMTP session. If what is actually sent is substantially
36567 more, the server might reject the message. This can be worked round by setting
36568 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
36569 additions to the message, or to disable the use of SIZE altogether.
36572 <indexterm role="variable">
36573 <primary><varname>$pipe_addresses</varname></primary>
36575 The value of the <option>transport_filter</option> option is the command string for starting
36576 the filter, which is run directly from Exim, not under a shell. The string is
36577 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
36578 Exim breaks it up into arguments and then expands each argument separately (see
36579 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
36580 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
36581 of arguments, one for each address that applies to this delivery. (This isn’t
36582 an ideal name for this feature here, but as it was already implemented for the
36583 <command>pipe</command> transport, it seemed sensible not to change it.)
36586 <indexterm role="variable">
36587 <primary><varname>$host</varname></primary>
36589 <indexterm role="variable">
36590 <primary><varname>$host_address</varname></primary>
36592 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
36593 transport is a remote one. They contain the name and IP address of the host to
36594 which the message is being sent. For example:
36596 <literallayout class="monospaced">
36597 transport_filter = /some/directory/transport-filter.pl \
36598 $host $host_address $sender_address $pipe_addresses
36601 Two problems arise if you want to use more complicated expansion items to
36602 generate transport filter commands, both of which due to the fact that the
36603 command is split up <emphasis>before</emphasis> expansion.
36608 If an expansion item contains white space, you must quote it, so that it is all
36609 part of the same command item. If the entire option setting is one such
36610 expansion item, you have to take care what kind of quoting you use. For
36613 <literallayout class="monospaced">
36614 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
36617 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
36618 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
36619 stripped by Exim when it read the option’s value. When the value is used, if
36620 the single quotes were missing, the line would be split into two items,
36621 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
36622 Exim tried to expand the first one.
36627 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
36628 expansion cannot generate multiple arguments, or a command name followed by
36629 arguments. Consider this example:
36631 <literallayout class="monospaced">
36632 transport_filter = ${lookup{$host}lsearch{/a/file}\
36633 {$value}{/bin/cat}}
36636 The result of the lookup is interpreted as the name of the command, even
36637 if it contains white space. The simplest way round this is to use a shell:
36639 <literallayout class="monospaced">
36640 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
36641 {$value}{/bin/cat}}
36646 The filter process is run under the same uid and gid as the normal delivery.
36647 For remote deliveries this is the Exim uid/gid by default. The command should
36648 normally yield a zero return code. Transport filters are not supposed to fail.
36649 A non-zero code is taken to mean that the transport filter encountered some
36650 serious problem. Delivery of the message is deferred; the message remains on
36651 the queue and is tried again later. It is not possible to cause a message to be
36652 bounced from a transport filter.
36655 If a transport filter is set on an autoreply transport, the original message is
36656 passed through the filter as it is being copied into the newly generated
36657 message, which happens if the <option>return_message</option> option is set.
36660 <indexterm role="option">
36661 <primary><option>transport_filter_timeout</option></primary>
36664 <informaltable frame="all">
36665 <tgroup cols="4" colsep="0" rowsep="0">
36666 <colspec colwidth="8*" align="left"/>
36667 <colspec colwidth="6*" align="center"/>
36668 <colspec colwidth="6*" align="center"/>
36669 <colspec colwidth="6*" align="right"/>
36672 <entry><option>transport_filter_timeout</option></entry>
36673 <entry>Use: <emphasis>transports</emphasis></entry>
36674 <entry>Type: <emphasis>time</emphasis></entry>
36675 <entry>Default: <emphasis>5m</emphasis></entry>
36681 <indexterm role="concept">
36682 <primary>transport</primary>
36683 <secondary>filter, timeout</secondary>
36685 When Exim is reading the output of a transport filter, it a applies a timeout
36686 that can be set by this option. Exceeding the timeout is normally treated as a
36687 temporary delivery failure. However, if a transport filter is used with a
36688 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
36689 way as a timeout in the pipe command itself. By default, a timeout is a hard
36690 error, but if the <command>pipe</command> transport’s <option>timeout_defer</option> option is set true, it
36691 becomes a temporary error.
36694 <indexterm role="option">
36695 <primary><option>user</option></primary>
36698 <informaltable frame="all">
36699 <tgroup cols="4" colsep="0" rowsep="0">
36700 <colspec colwidth="8*" align="left"/>
36701 <colspec colwidth="6*" align="center"/>
36702 <colspec colwidth="6*" align="center"/>
36703 <colspec colwidth="6*" align="right"/>
36706 <entry><option>user</option></entry>
36707 <entry>Use: <emphasis>transports</emphasis></entry>
36708 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
36709 <entry>Default: <emphasis>Exim user</emphasis></entry>
36715 <indexterm role="concept">
36716 <primary>uid (user id)</primary>
36717 <secondary>local delivery</secondary>
36719 <indexterm role="concept">
36720 <primary>transport</primary>
36721 <secondary>user, specifying</secondary>
36723 This option specifies the user under whose uid the delivery process is to be
36724 run, overriding any uid that may have been set by the router. If the user is
36725 given as a name, the uid is looked up from the password data, and the
36726 associated group is taken as the value of the gid to be used if the <option>group</option>
36730 For deliveries that use local transports, a user and group are normally
36731 specified explicitly or implicitly (for example, as a result of
36732 <option>check_local_user</option>) by the router or transport.
36735 <indexterm role="concept">
36736 <primary>hints database</primary>
36737 <secondary>access by remote transport</secondary>
36739 For remote transports, you should leave this option unset unless you really are
36740 sure you know what you are doing. When a remote transport is running, it needs
36741 to be able to access Exim’s hints databases, because each host may have its own
36743 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
36744 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
36745 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
36749 <chapter id="CHAPbatching">
36750 <title>Address batching in local transports</title>
36751 <titleabbrev>Address batching</titleabbrev>
36753 <indexterm role="concept">
36754 <primary>transport</primary>
36755 <secondary>local; address batching in</secondary>
36757 The only remote transport (<command>smtp</command>) is normally configured to handle more than
36758 one address at a time, so that when several addresses are routed to the same
36759 remote host, just one copy of the message is sent. Local transports, however,
36760 normally handle one address at a time. That is, a separate instance of the
36761 transport is run for each address that is routed to the transport. A separate
36762 copy of the message is delivered each time.
36765 <indexterm role="concept">
36766 <primary>batched local delivery</primary>
36768 <indexterm role="option">
36769 <primary><option>batch_max</option></primary>
36771 <indexterm role="option">
36772 <primary><option>batch_id</option></primary>
36774 In special cases, it may be desirable to handle several addresses at once in a
36775 local transport, for example:
36780 In an <command>appendfile</command> transport, when storing messages in files for later
36781 delivery by some other means, a single copy of the message with multiple
36782 recipients saves space.
36787 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
36788 a single copy saves time, and is the normal way LMTP is expected to work.
36793 In a <command>pipe</command> transport, when passing the message
36794 to a scanner program or
36795 to some other delivery mechanism such as UUCP, multiple recipients may be
36801 These three local transports all have the same options for controlling multiple
36802 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
36803 repeating the information for each transport, these options are described here.
36806 The <option>batch_max</option> option specifies the maximum number of addresses that can be
36807 delivered together in a single run of the transport. Its default value is one
36808 (no batching). When more than one address is routed to a transport that has a
36809 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
36810 (that is, in a single run of the transport with multiple recipients), subject
36811 to certain conditions:
36816 <indexterm role="variable">
36817 <primary><varname>$local_part</varname></primary>
36819 If any of the transport’s options contain a reference to <varname>$local_part</varname>, no
36820 batching is possible.
36825 <indexterm role="variable">
36826 <primary><varname>$domain</varname></primary>
36828 If any of the transport’s options contain a reference to <varname>$domain</varname>, only
36829 addresses with the same domain are batched.
36834 <indexterm role="concept">
36835 <primary>customizing</primary>
36836 <secondary>batching condition</secondary>
36838 If <option>batch_id</option> is set, it is expanded for each address, and only those
36839 addresses with the same expanded value are batched. This allows you to specify
36840 customized batching conditions. Failure of the expansion for any reason,
36841 including forced failure, disables batching, but it does not stop the delivery
36847 Batched addresses must also have the same errors address (where to send
36848 delivery errors), the same header additions and removals, the same user and
36849 group for the transport, and if a host list is present, the first host must
36855 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
36856 both when the file or pipe command is specified in the transport, and when it
36857 is specified by a <command>redirect</command> router, but all the batched addresses must of
36858 course be routed to the same file or pipe command. These two transports have an
36859 option called <option>use_bsmtp</option>, which causes them to deliver the message in
36860 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
36861 <option>check_string</option> and <option>escape_string</option> options are forced to the values
36863 <literallayout class="monospaced">
36865 escape_string = ".."
36868 when batched SMTP is in use. A full description of the batch SMTP mechanism is
36869 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
36870 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
36873 <indexterm role="concept">
36874 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
36876 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
36877 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
36878 that are being processed together. If you are using a batching <command>appendfile</command>
36879 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
36880 addresses is to set the <option>envelope_to_add</option> option.
36883 <indexterm role="concept">
36884 <primary><command>pipe</command> transport</primary>
36885 <secondary>with multiple addresses</secondary>
36887 <indexterm role="variable">
36888 <primary><varname>$pipe_addresses</varname></primary>
36890 If you are using a <command>pipe</command> transport without BSMTP, and setting the
36891 transport’s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
36892 the command. This is not a true variable; it is a bit of magic that causes each
36893 of the recipient addresses to be inserted into the command as a separate
36894 argument. This provides a way of accessing all the addresses that are being
36895 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
36896 are specified by a <command>redirect</command> router.
36900 <chapter id="CHAPappendfile">
36901 <title>The appendfile transport</title>
36903 <indexterm role="concept" id="IIDapptra1" class="startofrange">
36904 <primary><command>appendfile</command> transport</primary>
36906 <indexterm role="concept" id="IIDapptra2" class="startofrange">
36907 <primary>transports</primary>
36908 <secondary><command>appendfile</command></secondary>
36910 <indexterm role="concept">
36911 <primary>directory creation</primary>
36913 <indexterm role="concept">
36914 <primary>creating directories</primary>
36916 The <command>appendfile</command> transport delivers a message by appending it to an existing
36917 file, or by creating an entirely new file in a specified directory. Single
36918 files to which messages are appended can be in the traditional Unix mailbox
36919 format, or optionally in the MBX format supported by the Pine MUA and
36920 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
36921 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
36922 to give added protection against failures that happen part-way through the
36923 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
36924 supported. For all file formats, Exim attempts to create as many levels of
36925 directory as necessary, provided that <option>create_directory</option> is set.
36928 The code for the optional formats is not included in the Exim binary by
36929 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
36930 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
36934 <indexterm role="concept">
36935 <primary>quota</primary>
36936 <secondary>system</secondary>
36938 Exim recognizes system quota errors, and generates an appropriate message. Exim
36939 also supports its own quota control within the transport, for use when the
36940 system facility is unavailable or cannot be used for some reason.
36943 If there is an error while appending to a file (for example, quota exceeded or
36944 partition filled), Exim attempts to reset the file’s length and last
36945 modification time back to what they were before. If there is an error while
36946 creating an entirely new file, the new file is removed.
36949 Before appending to a file, a number of security checks are made, and the
36950 file is locked. A detailed description is given below, after the list of
36954 The <command>appendfile</command> transport is most commonly used for local deliveries to
36955 users’ mailboxes. However, it can also be used as a pseudo-remote transport for
36956 putting messages into files for remote delivery by some means other than Exim.
36957 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
36960 <section id="SECTfildiropt">
36961 <title>The file and directory options</title>
36963 The <option>file</option> option specifies a single file, to which the message is appended;
36964 the <option>directory</option> option specifies a directory, in which a new file containing
36965 the message is created. Only one of these two options can be set, and for
36966 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
36969 <indexterm role="variable">
36970 <primary><varname>$address_file</varname></primary>
36972 <indexterm role="variable">
36973 <primary><varname>$local_part</varname></primary>
36975 However, <command>appendfile</command> is also used for delivering messages to files or
36976 directories whose names (or parts of names) are obtained from alias,
36977 forwarding, or filtering operations (for example, a <option>save</option> command in a
36978 user’s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
36979 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
36980 name (or partial name) of the file or directory generated by the redirection
36981 operation. There are two cases:
36986 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
36987 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
36988 common case when users with local accounts use filtering to sort mail into
36989 different folders. See for example, the <command>address_file</command> transport in the
36990 default configuration. If the path ends with a slash, it is assumed to be the
36991 name of a directory. A delivery to a directory can also be forced by setting
36992 <option>maildir_format</option> or <option>mailstore_format</option>.
36997 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
36998 used to determine the file or directory name for the delivery. Normally, the
36999 contents of <varname>$address_file</varname> are used in some way in the string expansion.
37004 <indexterm role="concept">
37005 <primary>Sieve filter</primary>
37006 <secondary>configuring <command>appendfile</command></secondary>
37008 <indexterm role="concept">
37009 <primary>Sieve filter</primary>
37010 <secondary>relative mailbox path handling</secondary>
37012 As an example of the second case, consider an environment where users do not
37013 have home directories. They may be permitted to use Exim filter commands of the
37016 <literallayout class="monospaced">
37020 or Sieve filter commands of the form:
37022 <literallayout class="monospaced">
37023 require "fileinto";
37024 fileinto "folder23";
37027 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
37028 must transform the relative path into an appropriate absolute file name. In the
37029 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
37030 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
37031 way of handling this requirement:
37033 <literallayout class="monospaced">
37034 file = ${if eq{$address_file}{inbox} \
37035 {/var/mail/$local_part} \
37036 {${if eq{${substr_0_1:$address_file}}{/} \
37038 {$home/mail/$address_file} \
37043 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
37044 location, absolute paths are used without change, and other folders are in the
37045 <filename>mail</filename> directory within the home directory.
37048 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
37049 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
37050 the router. In particular, this is the case if <option>check_local_user</option> is set. If
37051 you want to prevent this happening at routing time, you can set
37052 <option>router_home_directory</option> empty. This forces the router to pass the relative
37053 path to the transport.
37056 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
37057 the <option>file</option> or <option>directory</option> option is still used if it is set.
37060 <section id="SECID134">
37061 <title>Private options for appendfile</title>
37063 <indexterm role="concept">
37064 <primary>options</primary>
37065 <secondary><command>appendfile</command> transport</secondary>
37069 <indexterm role="option">
37070 <primary><option>allow_fifo</option></primary>
37073 <informaltable frame="all">
37074 <tgroup cols="4" colsep="0" rowsep="0">
37075 <colspec colwidth="8*" align="left"/>
37076 <colspec colwidth="6*" align="center"/>
37077 <colspec colwidth="6*" align="center"/>
37078 <colspec colwidth="6*" align="right"/>
37081 <entry><option>allow_fifo</option></entry>
37082 <entry>Use: <emphasis>appendfile</emphasis></entry>
37083 <entry>Type: <emphasis>boolean</emphasis></entry>
37084 <entry>Default: <emphasis>false</emphasis></entry>
37090 <indexterm role="concept">
37091 <primary>fifo (named pipe)</primary>
37093 <indexterm role="concept">
37094 <primary>named pipe (fifo)</primary>
37096 <indexterm role="concept">
37097 <primary>pipe</primary>
37098 <secondary>named (fifo)</secondary>
37100 Setting this option permits delivery to named pipes (FIFOs) as well as to
37101 regular files. If no process is reading the named pipe at delivery time, the
37102 delivery is deferred.
37105 <indexterm role="option">
37106 <primary><option>allow_symlink</option></primary>
37109 <informaltable frame="all">
37110 <tgroup cols="4" colsep="0" rowsep="0">
37111 <colspec colwidth="8*" align="left"/>
37112 <colspec colwidth="6*" align="center"/>
37113 <colspec colwidth="6*" align="center"/>
37114 <colspec colwidth="6*" align="right"/>
37117 <entry><option>allow_symlink</option></entry>
37118 <entry>Use: <emphasis>appendfile</emphasis></entry>
37119 <entry>Type: <emphasis>boolean</emphasis></entry>
37120 <entry>Default: <emphasis>false</emphasis></entry>
37126 <indexterm role="concept">
37127 <primary>symbolic link</primary>
37128 <secondary>to mailbox</secondary>
37130 <indexterm role="concept">
37131 <primary>mailbox</primary>
37132 <secondary>symbolic link</secondary>
37134 By default, <command>appendfile</command> will not deliver if the path name for the file is
37135 that of a symbolic link. Setting this option relaxes that constraint, but there
37136 are security issues involved in the use of symbolic links. Be sure you know
37137 what you are doing if you set this. Details of exactly what this option affects
37138 are included in the discussion which follows this list of options.
37141 <indexterm role="option">
37142 <primary><option>batch_id</option></primary>
37145 <informaltable frame="all">
37146 <tgroup cols="4" colsep="0" rowsep="0">
37147 <colspec colwidth="8*" align="left"/>
37148 <colspec colwidth="6*" align="center"/>
37149 <colspec colwidth="6*" align="center"/>
37150 <colspec colwidth="6*" align="right"/>
37153 <entry><option>batch_id</option></entry>
37154 <entry>Use: <emphasis>appendfile</emphasis></entry>
37155 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37156 <entry>Default: <emphasis>unset</emphasis></entry>
37162 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37163 However, batching is automatically disabled for <command>appendfile</command> deliveries that
37164 happen as a result of forwarding or aliasing or other redirection directly to a
37168 <indexterm role="option">
37169 <primary><option>batch_max</option></primary>
37172 <informaltable frame="all">
37173 <tgroup cols="4" colsep="0" rowsep="0">
37174 <colspec colwidth="8*" align="left"/>
37175 <colspec colwidth="6*" align="center"/>
37176 <colspec colwidth="6*" align="center"/>
37177 <colspec colwidth="6*" align="right"/>
37180 <entry><option>batch_max</option></entry>
37181 <entry>Use: <emphasis>appendfile</emphasis></entry>
37182 <entry>Type: <emphasis>integer</emphasis></entry>
37183 <entry>Default: <emphasis>1</emphasis></entry>
37189 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
37192 <indexterm role="option">
37193 <primary><option>check_group</option></primary>
37196 <informaltable frame="all">
37197 <tgroup cols="4" colsep="0" rowsep="0">
37198 <colspec colwidth="8*" align="left"/>
37199 <colspec colwidth="6*" align="center"/>
37200 <colspec colwidth="6*" align="center"/>
37201 <colspec colwidth="6*" align="right"/>
37204 <entry><option>check_group</option></entry>
37205 <entry>Use: <emphasis>appendfile</emphasis></entry>
37206 <entry>Type: <emphasis>boolean</emphasis></entry>
37207 <entry>Default: <emphasis>false</emphasis></entry>
37213 When this option is set, the group owner of the file defined by the <option>file</option>
37214 option is checked to see that it is the same as the group under which the
37215 delivery process is running. The default setting is false because the default
37216 file mode is 0600, which means that the group is irrelevant.
37219 <indexterm role="option">
37220 <primary><option>check_owner</option></primary>
37223 <informaltable frame="all">
37224 <tgroup cols="4" colsep="0" rowsep="0">
37225 <colspec colwidth="8*" align="left"/>
37226 <colspec colwidth="6*" align="center"/>
37227 <colspec colwidth="6*" align="center"/>
37228 <colspec colwidth="6*" align="right"/>
37231 <entry><option>check_owner</option></entry>
37232 <entry>Use: <emphasis>appendfile</emphasis></entry>
37233 <entry>Type: <emphasis>boolean</emphasis></entry>
37234 <entry>Default: <emphasis>true</emphasis></entry>
37240 When this option is set, the owner of the file defined by the <option>file</option> option
37241 is checked to ensure that it is the same as the user under which the delivery
37242 process is running.
37245 <indexterm role="option">
37246 <primary><option>check_string</option></primary>
37249 <informaltable frame="all">
37250 <tgroup cols="4" colsep="0" rowsep="0">
37251 <colspec colwidth="8*" align="left"/>
37252 <colspec colwidth="6*" align="center"/>
37253 <colspec colwidth="6*" align="center"/>
37254 <colspec colwidth="6*" align="right"/>
37257 <entry><option>check_string</option></entry>
37258 <entry>Use: <emphasis>appendfile</emphasis></entry>
37259 <entry>Type: <emphasis>string</emphasis></entry>
37260 <entry>Default: <emphasis>see below</emphasis></entry>
37266 <indexterm role="concept">
37267 <primary><quote>From</quote> line</primary>
37269 As <command>appendfile</command> writes the message, the start of each line is tested for
37270 matching <option>check_string</option>, and if it does, the initial matching characters are
37271 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
37272 a literal string, not a regular expression, and the case of any letters it
37273 contains is significant.
37276 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
37277 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
37278 configuration are ignored. Otherwise, they default to <quote>From </quote> and
37279 <quote>>From </quote> when the <option>file</option> option is set, and unset when any of the
37280 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
37283 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
37284 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
37285 <quote>From </quote> indicates the start of a new message. All four options need changing
37286 if another format is used. For example, to deliver to mailboxes in MMDF format:
37287 <indexterm role="concept">
37288 <primary>MMDF format mailbox</primary>
37290 <indexterm role="concept">
37291 <primary>mailbox</primary>
37292 <secondary>MMDF format</secondary>
37295 <literallayout class="monospaced">
37296 check_string = "\1\1\1\1\n"
37297 escape_string = "\1\1\1\1 \n"
37298 message_prefix = "\1\1\1\1\n"
37299 message_suffix = "\1\1\1\1\n"
37302 <indexterm role="option">
37303 <primary><option>create_directory</option></primary>
37306 <informaltable frame="all">
37307 <tgroup cols="4" colsep="0" rowsep="0">
37308 <colspec colwidth="8*" align="left"/>
37309 <colspec colwidth="6*" align="center"/>
37310 <colspec colwidth="6*" align="center"/>
37311 <colspec colwidth="6*" align="right"/>
37314 <entry><option>create_directory</option></entry>
37315 <entry>Use: <emphasis>appendfile</emphasis></entry>
37316 <entry>Type: <emphasis>boolean</emphasis></entry>
37317 <entry>Default: <emphasis>true</emphasis></entry>
37323 <indexterm role="concept">
37324 <primary>directory creation</primary>
37326 When this option is true, Exim attempts to create any missing superior
37327 directories for the file that it is about to write. A created directory’s mode
37328 is given by the <option>directory_mode</option> option.
37331 The group ownership of a newly created directory is highly dependent on the
37332 operating system (and possibly the file system) that is being used. For
37333 example, in Solaris, if the parent directory has the setgid bit set, its group
37334 is propagated to the child; if not, the currently set group is used. However,
37335 in FreeBSD, the parent’s group is always used.
37338 <indexterm role="option">
37339 <primary><option>create_file</option></primary>
37342 <informaltable frame="all">
37343 <tgroup cols="4" colsep="0" rowsep="0">
37344 <colspec colwidth="8*" align="left"/>
37345 <colspec colwidth="6*" align="center"/>
37346 <colspec colwidth="6*" align="center"/>
37347 <colspec colwidth="6*" align="right"/>
37350 <entry><option>create_file</option></entry>
37351 <entry>Use: <emphasis>appendfile</emphasis></entry>
37352 <entry>Type: <emphasis>string</emphasis></entry>
37353 <entry>Default: <emphasis>anywhere</emphasis></entry>
37359 This option constrains the location of files and directories that are created
37360 by this transport. It applies to files defined by the <option>file</option> option and
37361 directories defined by the <option>directory</option> option. In the case of maildir
37362 delivery, it applies to the top level directory, not the maildir directories
37366 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
37367 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
37368 set for the transport. This option is not useful when an explicit file name is
37369 given for normal mailbox deliveries. It is intended for the case when file
37370 names are generated from users’ <filename>.forward</filename> files. These are usually handled
37371 by an <command>appendfile</command> transport called <option>address_file</option>. See also
37372 <option>file_must_exist</option>.
37375 <indexterm role="option">
37376 <primary><option>directory</option></primary>
37379 <informaltable frame="all">
37380 <tgroup cols="4" colsep="0" rowsep="0">
37381 <colspec colwidth="8*" align="left"/>
37382 <colspec colwidth="6*" align="center"/>
37383 <colspec colwidth="6*" align="center"/>
37384 <colspec colwidth="6*" align="right"/>
37387 <entry><option>directory</option></entry>
37388 <entry>Use: <emphasis>appendfile</emphasis></entry>
37389 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37390 <entry>Default: <emphasis>unset</emphasis></entry>
37396 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
37397 or <option>directory</option> must be set, unless the delivery is the direct result of a
37398 redirection (see section <xref linkend="SECTfildiropt"/>).
37401 When <option>directory</option> is set, the string is expanded, and the message is delivered
37402 into a new file or files in or below the given directory, instead of being
37403 appended to a single mailbox file. A number of different formats are provided
37404 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
37405 <xref linkend="SECTopdir"/> for further details of this form of delivery.
37408 <indexterm role="option">
37409 <primary><option>directory_file</option></primary>
37412 <informaltable frame="all">
37413 <tgroup cols="4" colsep="0" rowsep="0">
37414 <colspec colwidth="8*" align="left"/>
37415 <colspec colwidth="6*" align="center"/>
37416 <colspec colwidth="6*" align="center"/>
37417 <colspec colwidth="6*" align="right"/>
37420 <entry><option>directory_file</option></entry>
37421 <entry>Use: <emphasis>appendfile</emphasis></entry>
37422 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37423 <entry>Default: <emphasis>see below</emphasis></entry>
37429 <indexterm role="concept">
37430 <primary>base62</primary>
37432 <indexterm role="variable">
37433 <primary><varname>$inode</varname></primary>
37435 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
37436 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
37437 whose name is obtained by expanding this string. The default value is:
37439 <literallayout class="monospaced">
37440 q${base62:$tod_epoch}-$inode
37443 This generates a unique name from the current time, in base 62 form, and the
37444 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
37448 <indexterm role="option">
37449 <primary><option>directory_mode</option></primary>
37452 <informaltable frame="all">
37453 <tgroup cols="4" colsep="0" rowsep="0">
37454 <colspec colwidth="8*" align="left"/>
37455 <colspec colwidth="6*" align="center"/>
37456 <colspec colwidth="6*" align="center"/>
37457 <colspec colwidth="6*" align="right"/>
37460 <entry><option>directory_mode</option></entry>
37461 <entry>Use: <emphasis>appendfile</emphasis></entry>
37462 <entry>Type: <emphasis>octal integer</emphasis></entry>
37463 <entry>Default: <emphasis>0700</emphasis></entry>
37469 If <command>appendfile</command> creates any directories as a result of the
37470 <option>create_directory</option> option, their mode is specified by this option.
37473 <indexterm role="option">
37474 <primary><option>escape_string</option></primary>
37477 <informaltable frame="all">
37478 <tgroup cols="4" colsep="0" rowsep="0">
37479 <colspec colwidth="8*" align="left"/>
37480 <colspec colwidth="6*" align="center"/>
37481 <colspec colwidth="6*" align="center"/>
37482 <colspec colwidth="6*" align="right"/>
37485 <entry><option>escape_string</option></entry>
37486 <entry>Use: <emphasis>appendfile</emphasis></entry>
37487 <entry>Type: <emphasis>string</emphasis></entry>
37488 <entry>Default: <emphasis>see description</emphasis></entry>
37494 See <option>check_string</option> above.
37497 <indexterm role="option">
37498 <primary><option>file</option></primary>
37501 <informaltable frame="all">
37502 <tgroup cols="4" colsep="0" rowsep="0">
37503 <colspec colwidth="8*" align="left"/>
37504 <colspec colwidth="6*" align="center"/>
37505 <colspec colwidth="6*" align="center"/>
37506 <colspec colwidth="6*" align="right"/>
37509 <entry><option>file</option></entry>
37510 <entry>Use: <emphasis>appendfile</emphasis></entry>
37511 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37512 <entry>Default: <emphasis>unset</emphasis></entry>
37518 This option is mutually exclusive with the <option>directory</option> option, but one of
37519 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
37520 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
37521 specifies a single file, to which the message is appended. One or more of
37522 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
37523 <option>file</option>.
37526 <indexterm role="concept">
37527 <primary>NFS</primary>
37528 <secondary>lock file</secondary>
37530 <indexterm role="concept">
37531 <primary>locking files</primary>
37533 <indexterm role="concept">
37534 <primary>lock files</primary>
37536 If you are using more than one host to deliver over NFS into the same
37537 mailboxes, you should always use lock files.
37540 The string value is expanded for each delivery, and must yield an absolute
37541 path. The most common settings of this option are variations on one of these
37544 <literallayout class="monospaced">
37545 file = /var/spool/mail/$local_part
37546 file = /home/$local_part/inbox
37550 <indexterm role="concept">
37551 <primary><quote>sticky</quote> bit</primary>
37553 In the first example, all deliveries are done into the same directory. If Exim
37554 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
37555 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
37556 deliveries to be possible, or alternatively the <option>group</option> option can be used to
37557 run the delivery under a group id which has write access to the directory.
37560 <indexterm role="option">
37561 <primary><option>file_format</option></primary>
37564 <informaltable frame="all">
37565 <tgroup cols="4" colsep="0" rowsep="0">
37566 <colspec colwidth="8*" align="left"/>
37567 <colspec colwidth="6*" align="center"/>
37568 <colspec colwidth="6*" align="center"/>
37569 <colspec colwidth="6*" align="right"/>
37572 <entry><option>file_format</option></entry>
37573 <entry>Use: <emphasis>appendfile</emphasis></entry>
37574 <entry>Type: <emphasis>string</emphasis></entry>
37575 <entry>Default: <emphasis>unset</emphasis></entry>
37581 <indexterm role="concept">
37582 <primary>file</primary>
37583 <secondary>mailbox; checking existing format</secondary>
37585 This option requests the transport to check the format of an existing file
37586 before adding to it. The check consists of matching a specific string at the
37587 start of the file. The value of the option consists of an even number of
37588 colon-separated strings. The first of each pair is the test string, and the
37589 second is the name of a transport. If the transport associated with a matched
37590 string is not the current transport, control is passed over to the other
37591 transport. For example, suppose the standard <command>local_delivery</command> transport has
37594 <literallayout class="monospaced">
37595 file_format = "From : local_delivery :\
37596 \1\1\1\1\n : local_mmdf_delivery"
37599 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
37600 a mailbox begins with four binary ones followed by a newline, control is passed
37601 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
37602 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
37603 is assumed to match the current transport. If the start of a mailbox doesn’t
37604 match any string, or if the transport named for a given string is not defined,
37605 delivery is deferred.
37608 <indexterm role="option">
37609 <primary><option>file_must_exist</option></primary>
37612 <informaltable frame="all">
37613 <tgroup cols="4" colsep="0" rowsep="0">
37614 <colspec colwidth="8*" align="left"/>
37615 <colspec colwidth="6*" align="center"/>
37616 <colspec colwidth="6*" align="center"/>
37617 <colspec colwidth="6*" align="right"/>
37620 <entry><option>file_must_exist</option></entry>
37621 <entry>Use: <emphasis>appendfile</emphasis></entry>
37622 <entry>Type: <emphasis>boolean</emphasis></entry>
37623 <entry>Default: <emphasis>false</emphasis></entry>
37629 If this option is true, the file specified by the <option>file</option> option must exist.
37630 A temporary error occurs if it does not, causing delivery to be deferred.
37631 If this option is false, the file is created if it does not exist.
37634 <indexterm role="option">
37635 <primary><option>lock_fcntl_timeout</option></primary>
37638 <informaltable frame="all">
37639 <tgroup cols="4" colsep="0" rowsep="0">
37640 <colspec colwidth="8*" align="left"/>
37641 <colspec colwidth="6*" align="center"/>
37642 <colspec colwidth="6*" align="center"/>
37643 <colspec colwidth="6*" align="right"/>
37646 <entry><option>lock_fcntl_timeout</option></entry>
37647 <entry>Use: <emphasis>appendfile</emphasis></entry>
37648 <entry>Type: <emphasis>time</emphasis></entry>
37649 <entry>Default: <emphasis>0s</emphasis></entry>
37655 <indexterm role="concept">
37656 <primary>timeout</primary>
37657 <secondary>mailbox locking</secondary>
37659 <indexterm role="concept">
37660 <primary>mailbox</primary>
37661 <secondary>locking, blocking and non-blocking</secondary>
37663 <indexterm role="concept">
37664 <primary>locking files</primary>
37666 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
37667 when locking an open mailbox file. If the call fails, the delivery process
37668 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
37669 Non-blocking calls are used so that the file is not kept open during the wait
37670 for the lock; the reason for this is to make it as safe as possible for
37671 deliveries over NFS in the case when processes might be accessing an NFS
37672 mailbox without using a lock file. This should not be done, but
37673 misunderstandings and hence misconfigurations are not unknown.
37676 On a busy system, however, the performance of a non-blocking lock approach is
37677 not as good as using a blocking lock with a timeout. In this case, the waiting
37678 is done inside the system call, and Exim’s delivery process acquires the lock
37679 and can proceed as soon as the previous lock holder releases it.
37682 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
37683 timeout, are used. There may still be some retrying: the maximum number of
37686 <literallayout class="monospaced">
37687 (lock_retries * lock_interval) / lock_fcntl_timeout
37690 rounded up to the next whole number. In other words, the total time during
37691 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
37692 <option>lock_fcntl_timeout</option> is set very large.
37695 You should consider setting this option if you are getting a lot of delayed
37696 local deliveries because of errors of the form
37698 <literallayout class="monospaced">
37699 failed to lock mailbox /some/file (fcntl)
37702 <indexterm role="option">
37703 <primary><option>lock_flock_timeout</option></primary>
37706 <informaltable frame="all">
37707 <tgroup cols="4" colsep="0" rowsep="0">
37708 <colspec colwidth="8*" align="left"/>
37709 <colspec colwidth="6*" align="center"/>
37710 <colspec colwidth="6*" align="center"/>
37711 <colspec colwidth="6*" align="right"/>
37714 <entry><option>lock_flock_timeout</option></entry>
37715 <entry>Use: <emphasis>appendfile</emphasis></entry>
37716 <entry>Type: <emphasis>time</emphasis></entry>
37717 <entry>Default: <emphasis>0s</emphasis></entry>
37723 This timeout applies to file locking when using <function>flock()</function> (see
37724 <option>use_flock</option>); the timeout operates in a similar manner to
37725 <option>lock_fcntl_timeout</option>.
37728 <indexterm role="option">
37729 <primary><option>lock_interval</option></primary>
37732 <informaltable frame="all">
37733 <tgroup cols="4" colsep="0" rowsep="0">
37734 <colspec colwidth="8*" align="left"/>
37735 <colspec colwidth="6*" align="center"/>
37736 <colspec colwidth="6*" align="center"/>
37737 <colspec colwidth="6*" align="right"/>
37740 <entry><option>lock_interval</option></entry>
37741 <entry>Use: <emphasis>appendfile</emphasis></entry>
37742 <entry>Type: <emphasis>time</emphasis></entry>
37743 <entry>Default: <emphasis>3s</emphasis></entry>
37749 This specifies the time to wait between attempts to lock the file. See below
37750 for details of locking.
37753 <indexterm role="option">
37754 <primary><option>lock_retries</option></primary>
37757 <informaltable frame="all">
37758 <tgroup cols="4" colsep="0" rowsep="0">
37759 <colspec colwidth="8*" align="left"/>
37760 <colspec colwidth="6*" align="center"/>
37761 <colspec colwidth="6*" align="center"/>
37762 <colspec colwidth="6*" align="right"/>
37765 <entry><option>lock_retries</option></entry>
37766 <entry>Use: <emphasis>appendfile</emphasis></entry>
37767 <entry>Type: <emphasis>integer</emphasis></entry>
37768 <entry>Default: <emphasis>10</emphasis></entry>
37774 This specifies the maximum number of attempts to lock the file. A value of zero
37775 is treated as 1. See below for details of locking.
37778 <indexterm role="option">
37779 <primary><option>lockfile_mode</option></primary>
37782 <informaltable frame="all">
37783 <tgroup cols="4" colsep="0" rowsep="0">
37784 <colspec colwidth="8*" align="left"/>
37785 <colspec colwidth="6*" align="center"/>
37786 <colspec colwidth="6*" align="center"/>
37787 <colspec colwidth="6*" align="right"/>
37790 <entry><option>lockfile_mode</option></entry>
37791 <entry>Use: <emphasis>appendfile</emphasis></entry>
37792 <entry>Type: <emphasis>octal integer</emphasis></entry>
37793 <entry>Default: <emphasis>0600</emphasis></entry>
37799 This specifies the mode of the created lock file, when a lock file is being
37800 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
37803 <indexterm role="option">
37804 <primary><option>lockfile_timeout</option></primary>
37807 <informaltable frame="all">
37808 <tgroup cols="4" colsep="0" rowsep="0">
37809 <colspec colwidth="8*" align="left"/>
37810 <colspec colwidth="6*" align="center"/>
37811 <colspec colwidth="6*" align="center"/>
37812 <colspec colwidth="6*" align="right"/>
37815 <entry><option>lockfile_timeout</option></entry>
37816 <entry>Use: <emphasis>appendfile</emphasis></entry>
37817 <entry>Type: <emphasis>time</emphasis></entry>
37818 <entry>Default: <emphasis>30m</emphasis></entry>
37824 <indexterm role="concept">
37825 <primary>timeout</primary>
37826 <secondary>mailbox locking</secondary>
37828 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
37829 exists and is older than this value, it is assumed to have been left behind by
37830 accident, and Exim attempts to remove it.
37833 <indexterm role="option">
37834 <primary><option>mailbox_filecount</option></primary>
37837 <informaltable frame="all">
37838 <tgroup cols="4" colsep="0" rowsep="0">
37839 <colspec colwidth="8*" align="left"/>
37840 <colspec colwidth="6*" align="center"/>
37841 <colspec colwidth="6*" align="center"/>
37842 <colspec colwidth="6*" align="right"/>
37845 <entry><option>mailbox_filecount</option></entry>
37846 <entry>Use: <emphasis>appendfile</emphasis></entry>
37847 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37848 <entry>Default: <emphasis>unset</emphasis></entry>
37854 <indexterm role="concept">
37855 <primary>mailbox</primary>
37856 <secondary>specifying size of</secondary>
37858 <indexterm role="concept">
37859 <primary>size</primary>
37860 <secondary>of mailbox</secondary>
37862 If this option is set, it is expanded, and the result is taken as the current
37863 number of files in the mailbox. It must be a decimal number, optionally
37864 followed by K or M. This provides a way of obtaining this information from an
37865 external source that maintains the data.
37868 <indexterm role="option">
37869 <primary><option>mailbox_size</option></primary>
37872 <informaltable frame="all">
37873 <tgroup cols="4" colsep="0" rowsep="0">
37874 <colspec colwidth="8*" align="left"/>
37875 <colspec colwidth="6*" align="center"/>
37876 <colspec colwidth="6*" align="center"/>
37877 <colspec colwidth="6*" align="right"/>
37880 <entry><option>mailbox_size</option></entry>
37881 <entry>Use: <emphasis>appendfile</emphasis></entry>
37882 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
37883 <entry>Default: <emphasis>unset</emphasis></entry>
37889 <indexterm role="concept">
37890 <primary>mailbox</primary>
37891 <secondary>specifying size of</secondary>
37893 <indexterm role="concept">
37894 <primary>size</primary>
37895 <secondary>of mailbox</secondary>
37897 If this option is set, it is expanded, and the result is taken as the current
37898 size the mailbox. It must be a decimal number, optionally followed by K or M.
37899 This provides a way of obtaining this information from an external source that
37900 maintains the data. This is likely to be helpful for maildir deliveries where
37901 it is computationally expensive to compute the size of a mailbox.
37904 <indexterm role="option">
37905 <primary><option>maildir_format</option></primary>
37908 <informaltable frame="all">
37909 <tgroup cols="4" colsep="0" rowsep="0">
37910 <colspec colwidth="8*" align="left"/>
37911 <colspec colwidth="6*" align="center"/>
37912 <colspec colwidth="6*" align="center"/>
37913 <colspec colwidth="6*" align="right"/>
37916 <entry><option>maildir_format</option></entry>
37917 <entry>Use: <emphasis>appendfile</emphasis></entry>
37918 <entry>Type: <emphasis>boolean</emphasis></entry>
37919 <entry>Default: <emphasis>false</emphasis></entry>
37925 <indexterm role="concept">
37926 <primary>maildir format</primary>
37927 <secondary>specifying</secondary>
37929 If this option is set with the <option>directory</option> option, the delivery is into a new
37930 file, in the <quote>maildir</quote> format that is used by other mail software. When the
37931 transport is activated directly from a <command>redirect</command> router (for example, the
37932 <command>address_file</command> transport in the default configuration), setting
37933 <option>maildir_format</option> causes the path received from the router to be treated as a
37934 directory, whether or not it ends with <literal>/</literal>. This option is available only if
37935 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
37936 <xref linkend="SECTmaildirdelivery"/> below for further details.
37939 <indexterm role="option">
37940 <primary><option>maildir_quota_directory_regex</option></primary>
37943 <informaltable frame="all">
37944 <tgroup cols="4" colsep="0" rowsep="0">
37945 <colspec colwidth="8*" align="left"/>
37946 <colspec colwidth="6*" align="center"/>
37947 <colspec colwidth="6*" align="center"/>
37948 <colspec colwidth="6*" align="right"/>
37951 <entry><option>maildir_quota_directory_regex</option></entry>
37952 <entry>Use: <emphasis>appendfile</emphasis></entry>
37953 <entry>Type: <emphasis>string</emphasis></entry>
37954 <entry>Default: <emphasis>See below</emphasis></entry>
37960 <indexterm role="concept">
37961 <primary>maildir format</primary>
37962 <secondary>quota; directories included in</secondary>
37964 <indexterm role="concept">
37965 <primary>quota</primary>
37966 <secondary>maildir; directories included in</secondary>
37968 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
37969 a regular expression for specifying directories, relative to the quota
37970 directory (see <option>quota_directory</option>), that should be included in the quota
37971 calculation. The default value is:
37973 <literallayout class="monospaced">
37974 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
37977 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
37978 (directories whose names begin with a dot). If you want to exclude the
37979 <filename>Trash</filename>
37980 folder from the count (as some sites do), you need to change this setting to
37982 <literallayout class="monospaced">
37983 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
37986 This uses a negative lookahead in the regular expression to exclude the
37987 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
37988 calculations, quota processing is bypassed for any messages that are delivered
37989 directly into that directory.
37992 <indexterm role="option">
37993 <primary><option>maildir_retries</option></primary>
37996 <informaltable frame="all">
37997 <tgroup cols="4" colsep="0" rowsep="0">
37998 <colspec colwidth="8*" align="left"/>
37999 <colspec colwidth="6*" align="center"/>
38000 <colspec colwidth="6*" align="center"/>
38001 <colspec colwidth="6*" align="right"/>
38004 <entry><option>maildir_retries</option></entry>
38005 <entry>Use: <emphasis>appendfile</emphasis></entry>
38006 <entry>Type: <emphasis>integer</emphasis></entry>
38007 <entry>Default: <emphasis>10</emphasis></entry>
38013 This option specifies the number of times to retry when writing a file in
38014 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
38017 <indexterm role="option">
38018 <primary><option>maildir_tag</option></primary>
38021 <informaltable frame="all">
38022 <tgroup cols="4" colsep="0" rowsep="0">
38023 <colspec colwidth="8*" align="left"/>
38024 <colspec colwidth="6*" align="center"/>
38025 <colspec colwidth="6*" align="center"/>
38026 <colspec colwidth="6*" align="right"/>
38029 <entry><option>maildir_tag</option></entry>
38030 <entry>Use: <emphasis>appendfile</emphasis></entry>
38031 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38032 <entry>Default: <emphasis>unset</emphasis></entry>
38038 This option applies only to deliveries in maildir format, and is described in
38039 section <xref linkend="SECTmaildirdelivery"/> below.
38042 <indexterm role="option">
38043 <primary><option>maildir_use_size_file</option></primary>
38046 <informaltable frame="all">
38047 <tgroup cols="4" colsep="0" rowsep="0">
38048 <colspec colwidth="8*" align="left"/>
38049 <colspec colwidth="6*" align="center"/>
38050 <colspec colwidth="6*" align="center"/>
38051 <colspec colwidth="6*" align="right"/>
38054 <entry><option>maildir_use_size_file</option></entry>
38055 <entry>Use: <emphasis>appendfile</emphasis></entry>
38056 <entry>Type: <emphasis>boolean</emphasis></entry>
38057 <entry>Default: <emphasis>false</emphasis></entry>
38063 <indexterm role="concept">
38064 <primary>maildir format</primary>
38065 <secondary><filename>maildirsize</filename> file</secondary>
38067 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
38068 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
38069 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
38070 value is zero. See <option>maildir_quota_directory_regex</option> above and section
38071 <xref linkend="SECTmaildirdelivery"/> below for further details.
38074 <indexterm role="option">
38075 <primary><option>maildirfolder_create_regex</option></primary>
38078 <informaltable frame="all">
38079 <tgroup cols="4" colsep="0" rowsep="0">
38080 <colspec colwidth="8*" align="left"/>
38081 <colspec colwidth="6*" align="center"/>
38082 <colspec colwidth="6*" align="center"/>
38083 <colspec colwidth="6*" align="right"/>
38086 <entry><option>maildirfolder_create_regex</option></entry>
38087 <entry>Use: <emphasis>appendfile</emphasis></entry>
38088 <entry>Type: <emphasis>string</emphasis></entry>
38089 <entry>Default: <emphasis>unset</emphasis></entry>
38095 <indexterm role="concept">
38096 <primary>maildir format</primary>
38097 <secondary><filename>maildirfolder</filename> file</secondary>
38099 <indexterm role="concept">
38100 <primary><filename>maildirfolder</filename>, creating</primary>
38102 The value of this option is a regular expression. If it is unset, it has no
38103 effect. Otherwise, before a maildir delivery takes place, the pattern is
38104 matched against the name of the maildir directory, that is, the directory
38105 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
38106 delivery. If there is a match, Exim checks for the existence of a file called
38107 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
38108 See section <xref linkend="SECTmaildirdelivery"/> for more details.
38111 <indexterm role="option">
38112 <primary><option>mailstore_format</option></primary>
38115 <informaltable frame="all">
38116 <tgroup cols="4" colsep="0" rowsep="0">
38117 <colspec colwidth="8*" align="left"/>
38118 <colspec colwidth="6*" align="center"/>
38119 <colspec colwidth="6*" align="center"/>
38120 <colspec colwidth="6*" align="right"/>
38123 <entry><option>mailstore_format</option></entry>
38124 <entry>Use: <emphasis>appendfile</emphasis></entry>
38125 <entry>Type: <emphasis>boolean</emphasis></entry>
38126 <entry>Default: <emphasis>false</emphasis></entry>
38132 <indexterm role="concept">
38133 <primary>mailstore format</primary>
38134 <secondary>specifying</secondary>
38136 If this option is set with the <option>directory</option> option, the delivery is into two
38137 new files in <quote>mailstore</quote> format. The option is available only if
38138 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
38139 below for further details.
38142 <indexterm role="option">
38143 <primary><option>mailstore_prefix</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>mailstore_prefix</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 This option applies only to deliveries in mailstore format, and is described in
38164 section <xref linkend="SECTopdir"/> below.
38167 <indexterm role="option">
38168 <primary><option>mailstore_suffix</option></primary>
38171 <informaltable frame="all">
38172 <tgroup cols="4" colsep="0" rowsep="0">
38173 <colspec colwidth="8*" align="left"/>
38174 <colspec colwidth="6*" align="center"/>
38175 <colspec colwidth="6*" align="center"/>
38176 <colspec colwidth="6*" align="right"/>
38179 <entry><option>mailstore_suffix</option></entry>
38180 <entry>Use: <emphasis>appendfile</emphasis></entry>
38181 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38182 <entry>Default: <emphasis>unset</emphasis></entry>
38188 This option applies only to deliveries in mailstore format, and is described in
38189 section <xref linkend="SECTopdir"/> below.
38192 <indexterm role="option">
38193 <primary><option>mbx_format</option></primary>
38196 <informaltable frame="all">
38197 <tgroup cols="4" colsep="0" rowsep="0">
38198 <colspec colwidth="8*" align="left"/>
38199 <colspec colwidth="6*" align="center"/>
38200 <colspec colwidth="6*" align="center"/>
38201 <colspec colwidth="6*" align="right"/>
38204 <entry><option>mbx_format</option></entry>
38205 <entry>Use: <emphasis>appendfile</emphasis></entry>
38206 <entry>Type: <emphasis>boolean</emphasis></entry>
38207 <entry>Default: <emphasis>false</emphasis></entry>
38213 <indexterm role="concept">
38214 <primary>locking files</primary>
38216 <indexterm role="concept">
38217 <primary>file</primary>
38218 <secondary>locking</secondary>
38220 <indexterm role="concept">
38221 <primary>file</primary>
38222 <secondary>MBX format</secondary>
38224 <indexterm role="concept">
38225 <primary>MBX format, specifying</primary>
38227 This option is available only if Exim has been compiled with SUPPORT_MBX
38228 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
38229 the message is appended to the mailbox file in MBX format instead of
38230 traditional Unix format. This format is supported by Pine4 and its associated
38231 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
38234 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
38235 automatically changed by the use of <option>mbx_format</option>. They should normally be set
38236 empty when using MBX format, so this option almost always appears in this
38239 <literallayout class="monospaced">
38245 If none of the locking options are mentioned in the configuration,
38246 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
38247 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
38248 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
38249 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
38250 should not be used if any program that does not use this form of locking is
38251 going to access the mailbox, nor should it be used if the mailbox file is NFS
38252 mounted, because it works only when the mailbox is accessed from a single host.
38255 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
38256 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
38257 (this means for the whole of a Pine or IMAP session), Exim will not be able to
38258 append messages to it.
38261 <indexterm role="option">
38262 <primary><option>message_prefix</option></primary>
38265 <informaltable frame="all">
38266 <tgroup cols="4" colsep="0" rowsep="0">
38267 <colspec colwidth="8*" align="left"/>
38268 <colspec colwidth="6*" align="center"/>
38269 <colspec colwidth="6*" align="center"/>
38270 <colspec colwidth="6*" align="right"/>
38273 <entry><option>message_prefix</option></entry>
38274 <entry>Use: <emphasis>appendfile</emphasis></entry>
38275 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38276 <entry>Default: <emphasis>see below</emphasis></entry>
38282 <indexterm role="concept">
38283 <primary><quote>From</quote> line</primary>
38285 The string specified here is expanded and output at the start of every message.
38286 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38287 in which case it is:
38289 <literallayout class="monospaced">
38290 message_prefix = "From ${if def:return_path{$return_path}\
38291 {MAILER-DAEMON}} $tod_bsdinbox\n"
38294 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38295 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
38298 <indexterm role="option">
38299 <primary><option>message_suffix</option></primary>
38302 <informaltable frame="all">
38303 <tgroup cols="4" colsep="0" rowsep="0">
38304 <colspec colwidth="8*" align="left"/>
38305 <colspec colwidth="6*" align="center"/>
38306 <colspec colwidth="6*" align="center"/>
38307 <colspec colwidth="6*" align="right"/>
38310 <entry><option>message_suffix</option></entry>
38311 <entry>Use: <emphasis>appendfile</emphasis></entry>
38312 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38313 <entry>Default: <emphasis>see below</emphasis></entry>
38319 The string specified here is expanded and output at the end of every message.
38320 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
38321 in which case it is a single newline character. The suffix can be suppressed by
38324 <literallayout class="monospaced">
38328 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
38329 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
38332 <indexterm role="option">
38333 <primary><option>mode</option></primary>
38336 <informaltable frame="all">
38337 <tgroup cols="4" colsep="0" rowsep="0">
38338 <colspec colwidth="8*" align="left"/>
38339 <colspec colwidth="6*" align="center"/>
38340 <colspec colwidth="6*" align="center"/>
38341 <colspec colwidth="6*" align="right"/>
38344 <entry><option>mode</option></entry>
38345 <entry>Use: <emphasis>appendfile</emphasis></entry>
38346 <entry>Type: <emphasis>octal integer</emphasis></entry>
38347 <entry>Default: <emphasis>0600</emphasis></entry>
38353 If the output file is created, it is given this mode. If it already exists and
38354 has wider permissions, they are reduced to this mode. If it has narrower
38355 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
38356 if the delivery is the result of a <option>save</option> command in a filter file specifying
38357 a particular mode, the mode of the output file is always forced to take that
38358 value, and this option is ignored.
38361 <indexterm role="option">
38362 <primary><option>mode_fail_narrower</option></primary>
38365 <informaltable frame="all">
38366 <tgroup cols="4" colsep="0" rowsep="0">
38367 <colspec colwidth="8*" align="left"/>
38368 <colspec colwidth="6*" align="center"/>
38369 <colspec colwidth="6*" align="center"/>
38370 <colspec colwidth="6*" align="right"/>
38373 <entry><option>mode_fail_narrower</option></entry>
38374 <entry>Use: <emphasis>appendfile</emphasis></entry>
38375 <entry>Type: <emphasis>boolean</emphasis></entry>
38376 <entry>Default: <emphasis>true</emphasis></entry>
38382 This option applies in the case when an existing mailbox file has a narrower
38383 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
38384 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
38385 continues with the delivery attempt, using the existing mode of the file.
38388 <indexterm role="option">
38389 <primary><option>notify_comsat</option></primary>
38392 <informaltable frame="all">
38393 <tgroup cols="4" colsep="0" rowsep="0">
38394 <colspec colwidth="8*" align="left"/>
38395 <colspec colwidth="6*" align="center"/>
38396 <colspec colwidth="6*" align="center"/>
38397 <colspec colwidth="6*" align="right"/>
38400 <entry><option>notify_comsat</option></entry>
38401 <entry>Use: <emphasis>appendfile</emphasis></entry>
38402 <entry>Type: <emphasis>boolean</emphasis></entry>
38403 <entry>Default: <emphasis>false</emphasis></entry>
38409 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
38410 successful delivery to a user mailbox. This is the daemon that notifies logged
38411 on users about incoming mail.
38414 <indexterm role="option">
38415 <primary><option>quota</option></primary>
38418 <informaltable frame="all">
38419 <tgroup cols="4" colsep="0" rowsep="0">
38420 <colspec colwidth="8*" align="left"/>
38421 <colspec colwidth="6*" align="center"/>
38422 <colspec colwidth="6*" align="center"/>
38423 <colspec colwidth="6*" align="right"/>
38426 <entry><option>quota</option></entry>
38427 <entry>Use: <emphasis>appendfile</emphasis></entry>
38428 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38429 <entry>Default: <emphasis>unset</emphasis></entry>
38435 <indexterm role="concept">
38436 <primary>quota</primary>
38437 <secondary>imposed by Exim</secondary>
38439 This option imposes a limit on the size of the file to which Exim is appending,
38440 or to the total space used in the directory tree when the <option>directory</option> option
38441 is set. In the latter case, computation of the space used is expensive, because
38442 all the files in the directory (and any sub-directories) have to be
38443 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
38444 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
38445 have no shell access to their mailboxes).
38448 As there is no interlock against two simultaneous deliveries into a
38449 multi-file mailbox, it is possible for the quota to be overrun in this case.
38450 For single-file mailboxes, of course, an interlock is a necessity.
38453 A file’s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
38454 may be a lot less than the actual amount of disk space allocated to the file.
38455 If the sizes of a number of files are being added up, the rounding effect can
38456 become quite noticeable, especially on systems that have large block sizes.
38457 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
38458 the obvious value which users understand most easily.
38461 The value of the option is expanded, and must then be a numerical value
38462 (decimal point allowed), optionally followed by one of the letters K, M, or G,
38463 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
38464 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
38468 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
38471 The expansion happens while Exim is running as root, before it changes uid for
38472 the delivery. This means that files that are inaccessible to the end user can
38473 be used to hold quota values that are looked up in the expansion. When delivery
38474 fails because this quota is exceeded, the handling of the error is as for
38475 system quota failures.
38478 By default, Exim’s quota checking mimics system quotas, and restricts the
38479 mailbox to the specified maximum size, though the value is not accurate to the
38480 last byte, owing to separator lines and additional headers that may get added
38481 during message delivery. When a mailbox is nearly full, large messages may get
38482 refused even though small ones are accepted, because the size of the current
38483 message is added to the quota when the check is made. This behaviour can be
38484 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
38485 for exceeding the quota does not include the current message. Thus, deliveries
38486 continue until the quota has been exceeded; thereafter, no further messages are
38487 delivered. See also <option>quota_warn_threshold</option>.
38490 <indexterm role="option">
38491 <primary><option>quota_directory</option></primary>
38494 <informaltable frame="all">
38495 <tgroup cols="4" colsep="0" rowsep="0">
38496 <colspec colwidth="8*" align="left"/>
38497 <colspec colwidth="6*" align="center"/>
38498 <colspec colwidth="6*" align="center"/>
38499 <colspec colwidth="6*" align="right"/>
38502 <entry><option>quota_directory</option></entry>
38503 <entry>Use: <emphasis>appendfile</emphasis></entry>
38504 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38505 <entry>Default: <emphasis>unset</emphasis></entry>
38511 This option defines the directory to check for quota purposes when delivering
38512 into individual files. The default is the delivery directory, or, if a file
38513 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
38514 delivery directory.
38517 <indexterm role="option">
38518 <primary><option>quota_filecount</option></primary>
38521 <informaltable frame="all">
38522 <tgroup cols="4" colsep="0" rowsep="0">
38523 <colspec colwidth="8*" align="left"/>
38524 <colspec colwidth="6*" align="center"/>
38525 <colspec colwidth="6*" align="center"/>
38526 <colspec colwidth="6*" align="right"/>
38529 <entry><option>quota_filecount</option></entry>
38530 <entry>Use: <emphasis>appendfile</emphasis></entry>
38531 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38532 <entry>Default: <emphasis>0</emphasis></entry>
38538 This option applies when the <option>directory</option> option is set. It limits the total
38539 number of files in the directory (compare the inode limit in system quotas). It
38540 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
38541 failure causes delivery to be deferred. A value of zero is interpreted as
38542 <quote>no quota</quote>.
38545 <indexterm role="option">
38546 <primary><option>quota_is_inclusive</option></primary>
38549 <informaltable frame="all">
38550 <tgroup cols="4" colsep="0" rowsep="0">
38551 <colspec colwidth="8*" align="left"/>
38552 <colspec colwidth="6*" align="center"/>
38553 <colspec colwidth="6*" align="center"/>
38554 <colspec colwidth="6*" align="right"/>
38557 <entry><option>quota_is_inclusive</option></entry>
38558 <entry>Use: <emphasis>appendfile</emphasis></entry>
38559 <entry>Type: <emphasis>boolean</emphasis></entry>
38560 <entry>Default: <emphasis>true</emphasis></entry>
38566 See <option>quota</option> above.
38569 <indexterm role="option">
38570 <primary><option>quota_size_regex</option></primary>
38573 <informaltable frame="all">
38574 <tgroup cols="4" colsep="0" rowsep="0">
38575 <colspec colwidth="8*" align="left"/>
38576 <colspec colwidth="6*" align="center"/>
38577 <colspec colwidth="6*" align="center"/>
38578 <colspec colwidth="6*" align="right"/>
38581 <entry><option>quota_size_regex</option></entry>
38582 <entry>Use: <emphasis>appendfile</emphasis></entry>
38583 <entry>Type: <emphasis>string</emphasis></entry>
38584 <entry>Default: <emphasis>unset</emphasis></entry>
38590 This option applies when one of the delivery modes that writes a separate file
38591 for each message is being used. When Exim wants to find the size of one of
38592 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
38593 If this is set to a regular expression that matches the file name, and it
38594 captures one string, that string is interpreted as a representation of the
38595 file’s size. The value of <option>quota_size_regex</option> is not expanded.
38598 This feature is useful only when users have no shell access to their mailboxes
38599 – otherwise they could defeat the quota simply by renaming the files. This
38600 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
38601 the file length to the file name. For example:
38603 <literallayout class="monospaced">
38604 maildir_tag = ,S=$message_size
38605 quota_size_regex = ,S=(\d+)
38608 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
38609 number of lines in the message.
38612 The regular expression should not assume that the length is at the end of the
38613 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
38614 sometimes add other information onto the ends of message file names.
38617 <indexterm role="option">
38618 <primary><option>quota_warn_message</option></primary>
38621 <informaltable frame="all">
38622 <tgroup cols="4" colsep="0" rowsep="0">
38623 <colspec colwidth="8*" align="left"/>
38624 <colspec colwidth="6*" align="center"/>
38625 <colspec colwidth="6*" align="center"/>
38626 <colspec colwidth="6*" align="right"/>
38629 <entry><option>quota_warn_message</option></entry>
38630 <entry>Use: <emphasis>appendfile</emphasis></entry>
38631 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38632 <entry>Default: <emphasis>see below</emphasis></entry>
38638 See below for the use of this option. If it is not set when
38639 <option>quota_warn_threshold</option> is set, it defaults to
38641 <literallayout class="monospaced">
38642 quota_warn_message = "\
38643 To: $local_part@$domain\n\
38644 Subject: Your mailbox\n\n\
38645 This message is automatically created \
38646 by mail delivery software.\n\n\
38647 The size of your mailbox has exceeded \
38648 a warning threshold that is\n\
38649 set by the system administrator.\n"
38652 <indexterm role="option">
38653 <primary><option>quota_warn_threshold</option></primary>
38656 <informaltable frame="all">
38657 <tgroup cols="4" colsep="0" rowsep="0">
38658 <colspec colwidth="8*" align="left"/>
38659 <colspec colwidth="6*" align="center"/>
38660 <colspec colwidth="6*" align="center"/>
38661 <colspec colwidth="6*" align="right"/>
38664 <entry><option>quota_warn_threshold</option></entry>
38665 <entry>Use: <emphasis>appendfile</emphasis></entry>
38666 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
38667 <entry>Default: <emphasis>0</emphasis></entry>
38673 <indexterm role="concept">
38674 <primary>quota</primary>
38675 <secondary>warning threshold</secondary>
38677 <indexterm role="concept">
38678 <primary>mailbox</primary>
38679 <secondary>size warning</secondary>
38681 <indexterm role="concept">
38682 <primary>size</primary>
38683 <secondary>of mailbox</secondary>
38685 This option is expanded in the same way as <option>quota</option> (see above). If the
38686 resulting value is greater than zero, and delivery of the message causes the
38687 size of the file or total space in the directory tree to cross the given
38688 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
38689 may be specified as a percentage of it by following the value with a percent
38692 <literallayout class="monospaced">
38694 quota_warn_threshold = 75%
38697 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
38698 percent sign is ignored.
38701 The warning message itself is specified by the <option>quota_warn_message</option> option,
38702 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
38703 warning message. These do not necessarily have to include the recipient(s) of
38704 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
38705 can include any other header lines that you want. If you do not include a
38706 <emphasis>From:</emphasis> line, the default is:
38708 <literallayout class="monospaced">
38709 From: Mail Delivery System <mailer-daemon@$qualify_domain_sender>
38712 <indexterm role="option">
38713 <primary><option>errors_reply_to</option></primary>
38715 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
38719 The <option>quota</option> option does not have to be set in order to use this option; they
38720 are independent of one another except when the threshold is specified as a
38724 <indexterm role="option">
38725 <primary><option>use_bsmtp</option></primary>
38728 <informaltable frame="all">
38729 <tgroup cols="4" colsep="0" rowsep="0">
38730 <colspec colwidth="8*" align="left"/>
38731 <colspec colwidth="6*" align="center"/>
38732 <colspec colwidth="6*" align="center"/>
38733 <colspec colwidth="6*" align="right"/>
38736 <entry><option>use_bsmtp</option></entry>
38737 <entry>Use: <emphasis>appendfile</emphasis></entry>
38738 <entry>Type: <emphasis>boolean</emphasis></entry>
38739 <entry>Default: <emphasis>false</emphasis></entry>
38745 <indexterm role="concept">
38746 <primary>envelope sender</primary>
38748 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
38749 format, with the envelope sender and recipient(s) included as SMTP commands. If
38750 you want to include a leading HELO command with such messages, you can do
38751 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
38752 for details of batch SMTP.
38755 <indexterm role="option">
38756 <primary><option>use_crlf</option></primary>
38759 <informaltable frame="all">
38760 <tgroup cols="4" colsep="0" rowsep="0">
38761 <colspec colwidth="8*" align="left"/>
38762 <colspec colwidth="6*" align="center"/>
38763 <colspec colwidth="6*" align="center"/>
38764 <colspec colwidth="6*" align="right"/>
38767 <entry><option>use_crlf</option></entry>
38768 <entry>Use: <emphasis>appendfile</emphasis></entry>
38769 <entry>Type: <emphasis>boolean</emphasis></entry>
38770 <entry>Default: <emphasis>false</emphasis></entry>
38776 <indexterm role="concept">
38777 <primary>carriage return</primary>
38779 <indexterm role="concept">
38780 <primary>linefeed</primary>
38782 This option causes lines to be terminated with the two-character CRLF sequence
38783 (carriage return, linefeed) instead of just a linefeed character. In the case
38784 of batched SMTP, the byte sequence written to the file is then an exact image
38785 of what would be sent down a real SMTP connection.
38788 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
38789 (which are used to supply the traditional <quote>From </quote> and blank line separators
38790 in Berkeley-style mailboxes) are written verbatim, so must contain their own
38791 carriage return characters if these are needed. In cases where these options
38792 have non-empty defaults, the values end with a single linefeed, so they must be
38793 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
38796 <indexterm role="option">
38797 <primary><option>use_fcntl_lock</option></primary>
38800 <informaltable frame="all">
38801 <tgroup cols="4" colsep="0" rowsep="0">
38802 <colspec colwidth="8*" align="left"/>
38803 <colspec colwidth="6*" align="center"/>
38804 <colspec colwidth="6*" align="center"/>
38805 <colspec colwidth="6*" align="right"/>
38808 <entry><option>use_fcntl_lock</option></entry>
38809 <entry>Use: <emphasis>appendfile</emphasis></entry>
38810 <entry>Type: <emphasis>boolean</emphasis></entry>
38811 <entry>Default: <emphasis>see below</emphasis></entry>
38817 This option controls the use of the <function>fcntl()</function> function to lock a file for
38818 exclusive use when a message is being appended. It is set by default unless
38819 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
38820 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
38821 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
38824 <indexterm role="option">
38825 <primary><option>use_flock_lock</option></primary>
38828 <informaltable frame="all">
38829 <tgroup cols="4" colsep="0" rowsep="0">
38830 <colspec colwidth="8*" align="left"/>
38831 <colspec colwidth="6*" align="center"/>
38832 <colspec colwidth="6*" align="center"/>
38833 <colspec colwidth="6*" align="right"/>
38836 <entry><option>use_flock_lock</option></entry>
38837 <entry>Use: <emphasis>appendfile</emphasis></entry>
38838 <entry>Type: <emphasis>boolean</emphasis></entry>
38839 <entry>Default: <emphasis>false</emphasis></entry>
38845 This option is provided to support the use of <function>flock()</function> for file locking, for
38846 the few situations where it is needed. Most modern operating systems support
38847 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
38848 each other. Exim uses <function>fcntl()</function> locking by default.
38851 This option is required only if you are using an operating system where
38852 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
38853 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
38854 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
38857 <indexterm role="concept">
38858 <primary>Solaris</primary>
38859 <secondary><function>flock()</function> support</secondary>
38861 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
38862 have it (and some, I think, provide a not quite right version built on top of
38863 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
38864 the ability to use it, and any attempt to do so will cause a configuration
38868 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
38869 is just being mapped onto <function>fcntl()</function> by the OS).
38872 <indexterm role="option">
38873 <primary><option>use_lockfile</option></primary>
38876 <informaltable frame="all">
38877 <tgroup cols="4" colsep="0" rowsep="0">
38878 <colspec colwidth="8*" align="left"/>
38879 <colspec colwidth="6*" align="center"/>
38880 <colspec colwidth="6*" align="center"/>
38881 <colspec colwidth="6*" align="right"/>
38884 <entry><option>use_lockfile</option></entry>
38885 <entry>Use: <emphasis>appendfile</emphasis></entry>
38886 <entry>Type: <emphasis>boolean</emphasis></entry>
38887 <entry>Default: <emphasis>see below</emphasis></entry>
38893 If this option is turned off, Exim does not attempt to create a lock file when
38894 appending to a mailbox file. In this situation, the only locking is by
38895 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
38896 sure that every MUA that is ever going to look at your users’ mailboxes uses
38897 <function>fcntl()</function> rather than a lock file, and even then only when you are not
38898 delivering over NFS from more than one host.
38901 <indexterm role="concept">
38902 <primary>NFS</primary>
38903 <secondary>lock file</secondary>
38905 In order to append to an NFS file safely from more than one host, it is
38906 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
38907 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
38911 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
38912 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
38913 except when <option>mbx_format</option> is set.
38916 <indexterm role="option">
38917 <primary><option>use_mbx_lock</option></primary>
38920 <informaltable frame="all">
38921 <tgroup cols="4" colsep="0" rowsep="0">
38922 <colspec colwidth="8*" align="left"/>
38923 <colspec colwidth="6*" align="center"/>
38924 <colspec colwidth="6*" align="center"/>
38925 <colspec colwidth="6*" align="right"/>
38928 <entry><option>use_mbx_lock</option></entry>
38929 <entry>Use: <emphasis>appendfile</emphasis></entry>
38930 <entry>Type: <emphasis>boolean</emphasis></entry>
38931 <entry>Default: <emphasis>see below</emphasis></entry>
38937 This option is available only if Exim has been compiled with SUPPORT_MBX
38938 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
38939 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
38940 of the locking options are mentioned in the configuration. The locking rules
38941 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
38942 the IMAP4 and POP daemons that come with it (see the discussion below). The
38943 rules allow for shared access to the mailbox. However, this kind of locking
38944 does not work when the mailbox is NFS mounted.
38947 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
38948 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
38949 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
38950 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
38953 <section id="SECTopappend">
38954 <title>Operational details for appending</title>
38956 <indexterm role="concept">
38957 <primary>appending to a file</primary>
38959 <indexterm role="concept">
38960 <primary>file</primary>
38961 <secondary>appending</secondary>
38963 Before appending to a file, the following preparations are made:
38968 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
38974 <indexterm role="concept">
38975 <primary>directory creation</primary>
38977 If any directories on the file’s path are missing, Exim creates them if the
38978 <option>create_directory</option> option is set. A created directory’s mode is given by the
38979 <option>directory_mode</option> option.
38984 If <option>file_format</option> is set, the format of an existing file is checked. If this
38985 indicates that a different transport should be used, control is passed to that
38991 <indexterm role="concept">
38992 <primary>file</primary>
38993 <secondary>locking</secondary>
38995 <indexterm role="concept">
38996 <primary>locking files</primary>
38998 <indexterm role="concept">
38999 <primary>NFS</primary>
39000 <secondary>lock file</secondary>
39002 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
39003 reliably over NFS, as follows:
39005 <orderedlist numeration="arabic">
39008 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
39009 current time, primary host name, and process id added, by opening for writing
39010 as a new file. If this fails with an access error, delivery is deferred.
39015 Close the hitching post file, and hard link it to the lock file name.
39020 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
39021 Unlink the hitching post name.
39026 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
39027 then unlink hitching post name. If the number of links is exactly two, creation
39028 of the lock file succeeded but something (for example, an NFS server crash and
39029 restart) caused this fact not to be communicated to the <function>link()</function> call.
39034 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
39035 up to <option>lock_retries</option> times. However, since any program that writes to a
39036 mailbox should complete its task very quickly, it is reasonable to time out old
39037 lock files that are normally the result of user agent and system crashes. If an
39038 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
39039 it before trying again.
39046 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
39047 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
39048 than non-existence, delivery is deferred.
39053 <indexterm role="concept">
39054 <primary>symbolic link</primary>
39055 <secondary>to mailbox</secondary>
39057 <indexterm role="concept">
39058 <primary>mailbox</primary>
39059 <secondary>symbolic link</secondary>
39061 If the file does exist and is a symbolic link, delivery is deferred, unless the
39062 <option>allow_symlink</option> option is set, in which case the ownership of the link is
39063 checked, and then <function>stat()</function> is called to find out about the real file, which
39064 is then subjected to the checks below. The check on the top-level link
39065 ownership prevents one user creating a link for another’s mailbox in a sticky
39066 directory, though allowing symbolic links in this case is definitely not a good
39067 idea. If there is a chain of symbolic links, the intermediate ones are not
39073 If the file already exists but is not a regular file, or if the file’s owner
39074 and group (if the group is being checked – see <option>check_group</option> above) are
39075 different from the user and group under which the delivery is running,
39076 delivery is deferred.
39081 If the file’s permissions are more generous than specified, they are reduced.
39082 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
39083 is set false, in which case the delivery is tried using the existing
39089 The file’s inode number is saved, and the file is then opened for appending.
39090 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
39091 hadn’t existed (see below). For any other failures, delivery is deferred.
39096 If the file is opened successfully, check that the inode number hasn’t
39097 changed, that it is still a regular file, and that the owner and permissions
39098 have not changed. If anything is wrong, defer delivery and freeze the message.
39103 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
39104 option is set. Otherwise, check that the file is being created in a permitted
39105 directory if the <option>create_file</option> option is set (deferring on failure), and then
39106 open for writing as a new file, with the O_EXCL and O_CREAT options,
39107 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
39108 set). In this case, which can happen if the link points to a non-existent file,
39109 the file is opened for writing using O_CREAT but not O_EXCL, because
39110 that prevents link following.
39115 <indexterm role="concept">
39116 <primary>loop</primary>
39117 <secondary>while file testing</secondary>
39119 If opening fails because the file exists, obey the tests given above for
39120 existing files. However, to avoid looping in a situation where the file is
39121 being continuously created and destroyed, the exists/not-exists loop is broken
39122 after 10 repetitions, and the message is then frozen.
39127 If opening fails with any other error, defer delivery.
39132 <indexterm role="concept">
39133 <primary>file</primary>
39134 <secondary>locking</secondary>
39136 <indexterm role="concept">
39137 <primary>locking files</primary>
39139 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
39140 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
39141 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
39142 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
39143 file, and an exclusive lock on the file whose name is
39145 <literallayout class="monospaced">
39146 /tmp/.<device-number>.<inode-number>
39149 using the device and inode numbers of the open mailbox file, in accordance with
39150 the MBX locking rules. This file is created with a mode that is specified by
39151 the <option>lockfile_mode</option> option.
39154 If Exim fails to lock the file, there are two possible courses of action,
39155 depending on the value of the locking timeout. This is obtained from
39156 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
39159 If the timeout value is zero, the file is closed, Exim waits for
39160 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
39161 to lock it again. This happens up to <option>lock_retries</option> times, after which the
39162 delivery is deferred.
39165 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
39166 <function>flock()</function> are used (with the given timeout), so there has already been some
39167 waiting involved by the time locking fails. Nevertheless, Exim does not give up
39168 immediately. It retries up to
39170 <literallayout class="monospaced">
39171 (lock_retries * lock_interval) / <timeout>
39174 times (rounded up).
39179 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
39180 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
39183 <section id="SECTopdir">
39184 <title>Operational details for delivery to a new file</title>
39186 <indexterm role="concept">
39187 <primary>delivery</primary>
39188 <secondary>to single file</secondary>
39190 <indexterm role="concept">
39191 <primary><quote>From</quote> line</primary>
39193 When the <option>directory</option> option is set instead of <option>file</option>, each message is
39194 delivered into a newly-created file or set of files. When <command>appendfile</command> is
39195 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
39196 <option>directory</option> is normally set, because the path for delivery is supplied by the
39197 router. (See for example, the <command>address_file</command> transport in the default
39198 configuration.) In this case, delivery is to a new file if either the path name
39199 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
39202 No locking is required while writing the message to a new file, so the various
39203 locking options of the transport are ignored. The <quote>From</quote> line that by default
39204 separates messages in a single file is not normally needed, nor is the escaping
39205 of message lines that start with <quote>From</quote>, and there is no need to ensure a
39206 newline at the end of each message. Consequently, the default values for
39207 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
39208 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
39211 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
39212 the files in the delivery directory by default. However, you can specify a
39213 different directory by setting <option>quota_directory</option>. Also, for maildir
39214 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
39217 <indexterm role="concept">
39218 <primary>maildir format</primary>
39220 <indexterm role="concept">
39221 <primary>mailstore format</primary>
39223 There are three different ways in which delivery to individual files can be
39224 done, controlled by the settings of the <option>maildir_format</option> and
39225 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
39226 formats is not included in the binary unless SUPPORT_MAILDIR or
39227 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
39230 <indexterm role="concept">
39231 <primary>directory creation</primary>
39233 In all three cases an attempt is made to create the directory and any necessary
39234 sub-directories if they do not exist, provided that the <option>create_directory</option>
39235 option is set (the default). The location of a created directory can be
39236 constrained by setting <option>create_file</option>. A created directory’s mode is given by
39237 the <option>directory_mode</option> option. If creation fails, or if the
39238 <option>create_directory</option> option is not set when creation is required, delivery is
39242 <section id="SECTmaildirdelivery">
39243 <title>Maildir delivery</title>
39245 <indexterm role="concept">
39246 <primary>maildir format</primary>
39247 <secondary>description of</secondary>
39249 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
39250 it to a file whose name is <filename>tmp/<stime>.H<mtime>P<pid>.<host></filename> in the
39251 directory that is defined by the <option>directory</option> option (the <quote>delivery
39252 directory</quote>). If the delivery is successful, the file is renamed into the
39253 <filename>new</filename> subdirectory.
39256 In the file name, <<emphasis>stime</emphasis>> is the current time of day in seconds, and
39257 <<emphasis>mtime</emphasis>> is the microsecond fraction of the time. After a maildir delivery,
39258 Exim checks that the time-of-day clock has moved on by at least one microsecond
39259 before terminating the delivery process. This guarantees uniqueness for the
39260 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
39261 opening it. If any response other than ENOENT (does not exist) is given,
39262 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
39265 Before Exim carries out a maildir delivery, it ensures that subdirectories
39266 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
39267 do not exist, Exim tries to create them and any superior directories in their
39268 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
39269 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
39270 contains matches the delivery directory, Exim also ensures that a file called
39271 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
39272 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
39275 These features make it possible to use Exim to create all the necessary files
39276 and directories in a maildir mailbox, including subdirectories for maildir++
39277 folders. Consider this example:
39279 <literallayout class="monospaced">
39280 maildir_format = true
39281 directory = /var/mail/$local_part\
39282 ${if eq{$local_part_suffix}{}{}\
39283 {/.${substr_1:$local_part_suffix}}}
39284 maildirfolder_create_regex = /\.[^/]+$
39287 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
39288 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
39289 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
39290 not match this name, so Exim will not look for or create the file
39291 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
39292 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
39295 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
39296 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
39297 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
39298 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
39299 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
39302 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
39303 not inadvertently match the toplevel maildir directory, because a
39304 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
39307 <indexterm role="concept">
39308 <primary>quota</primary>
39309 <secondary>in maildir delivery</secondary>
39311 <indexterm role="concept">
39312 <primary>maildir++</primary>
39314 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
39315 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
39316 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
39317 Exim assumes the directory is a maildir++ folder directory, which is one level
39318 down from the user’s top level mailbox directory. This causes it to start at
39319 the parent directory instead of the current directory when calculating the
39320 amount of space used.
39323 One problem with delivering into a multi-file mailbox is that it is
39324 computationally expensive to compute the size of the mailbox for quota
39325 checking. Various approaches have been taken to reduce the amount of work
39326 needed. The next two sections describe two of them. A third alternative is to
39327 use some external process for maintaining the size data, and use the expansion
39328 of the <option>mailbox_size</option> option as a way of importing it into Exim.
39331 <section id="SECID135">
39332 <title>Using tags to record message sizes</title>
39334 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
39335 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
39336 tag is added to its name. However, if adding the tag takes the length of the
39337 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
39338 the tag is dropped and the maildir file is created with no tag.
39341 <indexterm role="variable">
39342 <primary><varname>$message_size</varname></primary>
39344 Tags can be used to encode the size of files in their names; see
39345 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
39346 happens after the message has been written. The value of the <varname>$message_size</varname>
39347 variable is set to the number of bytes actually written. If the expansion is
39348 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
39349 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
39350 Non-printing characters in the string are ignored; if the resulting string is
39351 empty, it is ignored. If it starts with an alphanumeric character, a leading
39355 <section id="SECID136">
39356 <title>Using a maildirsize file</title>
39358 <indexterm role="concept">
39359 <primary>quota</primary>
39360 <secondary>in maildir delivery</secondary>
39362 <indexterm role="concept">
39363 <primary>maildir format</primary>
39364 <secondary><filename>maildirsize</filename> file</secondary>
39366 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
39367 storing quota and message size information in a file called <filename>maildirsize</filename>
39368 within the toplevel maildir directory. If this file does not exist, Exim
39369 creates it, setting the quota from the <option>quota</option> option of the transport. If
39370 the maildir directory itself does not exist, it is created before any attempt
39371 to write a <filename>maildirsize</filename> file.
39374 The <filename>maildirsize</filename> file is used to hold information about the sizes of
39375 messages in the maildir, thus speeding up quota calculations. The quota value
39376 in the file is just a cache; if the quota is changed in the transport, the new
39377 value overrides the cached value when the next message is delivered. The cache
39378 is maintained for the benefit of other programs that access the maildir and
39379 need to know the quota.
39382 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
39383 file is maintained (with a zero quota setting), but no quota is imposed.
39386 A regular expression is available for controlling which directories in the
39387 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
39388 See the description of the <option>maildir_quota_directory_regex</option> option above for
39392 <section id="SECID137">
39393 <title>Mailstore delivery</title>
39395 <indexterm role="concept">
39396 <primary>mailstore format</primary>
39397 <secondary>description of</secondary>
39399 If the <option>mailstore_format</option> option is true, each message is written as two
39400 files in the given directory. A unique base name is constructed from the
39401 message id and the current delivery process, and the files that are written use
39402 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
39403 contains the message’s envelope, and the <filename>.msg</filename> file contains the message
39404 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
39407 During delivery, the envelope is first written to a file with the suffix
39408 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
39409 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
39410 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
39411 file before accessing either of them. An alternative approach is to wait for
39412 the absence of a <filename>.tmp</filename> file.
39415 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
39416 option, expanded and terminated by a newline if there isn’t one. Then follows
39417 the sender address on one line, then all the recipient addresses, one per line.
39418 There can be more than one recipient only if the <option>batch_max</option> option is set
39419 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
39420 appended to the file, followed by a newline if it does not end with one.
39423 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
39424 failure, it is ignored. Other expansion errors are treated as serious
39425 configuration errors, and delivery is deferred. The variable
39426 <varname>$mailstore_basename</varname> is available for use during these expansions.
39429 <section id="SECID138">
39430 <title>Non-special new file delivery</title>
39432 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
39433 file is created directly in the named directory. For example, when delivering
39434 messages into files in batched SMTP format for later delivery to some host (see
39435 section <xref linkend="SECTbatchSMTP"/>), a setting such as
39437 <literallayout class="monospaced">
39438 directory = /var/bsmtp/$host
39441 might be used. A message is written to a file with a temporary name, which is
39442 then renamed when the delivery is complete. The final name is obtained by
39443 expanding the contents of the <option>directory_file</option> option.
39444 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
39445 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
39450 <chapter id="CHID8">
39451 <title>The autoreply transport</title>
39453 <indexterm role="concept" id="IIDauttra1" class="startofrange">
39454 <primary>transports</primary>
39455 <secondary><command>autoreply</command></secondary>
39457 <indexterm role="concept" id="IIDauttra2" class="startofrange">
39458 <primary><command>autoreply</command> transport</primary>
39460 The <command>autoreply</command> transport is not a true transport in that it does not cause
39461 the message to be transmitted. Instead, it generates a new mail message as an
39462 automatic reply to the incoming message. <emphasis>References:</emphasis> and
39463 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
39464 to the rules in RFCs 2822 and 3834, respectively.
39467 If the router that passes the message to this transport does not have the
39468 <option>unseen</option> option set, the original message (for the current recipient) is not
39469 delivered anywhere. However, when the <option>unseen</option> option is set on the router
39470 that passes the message to this transport, routing of the address continues, so
39471 another router can set up a normal message delivery.
39474 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
39475 <quote>vacation</quote> message being the standard example. However, it can also be run
39476 directly from a router like any other transport. To reduce the possibility of
39477 message cascades, messages created by the <command>autoreply</command> transport always have
39478 empty envelope sender addresses, like bounce messages.
39481 The parameters of the message to be sent can be specified in the configuration
39482 by options described below. However, these are used only when the address
39483 passed to the transport does not contain its own reply information. When the
39484 transport is run as a consequence of a
39485 <option>mail</option>
39486 or <option>vacation</option> command in a filter file, the parameters of the message are
39487 supplied by the filter, and passed with the address. The transport’s options
39488 that define the message are then ignored (so they are not usually set in this
39489 case). The message is specified entirely by the filter or by the transport; it
39490 is never built from a mixture of options. However, the <option>file_optional</option>,
39491 <option>mode</option>, and <option>return_message</option> options apply in all cases.
39494 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
39495 command in a user’s filter file, <command>autoreply</command> normally runs under the uid and
39496 gid of the user, and with appropriate current and home directories (see chapter
39497 <xref linkend="CHAPenvironment"/>).
39500 There is a subtle difference between routing a message to a <command>pipe</command> transport
39501 that generates some text to be returned to the sender, and routing it to an
39502 <command>autoreply</command> transport. This difference is noticeable only if more than one
39503 address from the same message is so handled. In the case of a pipe, the
39504 separate outputs from the different addresses are gathered up and returned to
39505 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
39506 message is generated for each address that is passed to it.
39509 Non-printing characters are not permitted in the header lines generated for the
39510 message that <command>autoreply</command> creates, with the exception of newlines that are
39511 immediately followed by white space. If any non-printing characters are found,
39512 the transport defers.
39513 Whether characters with the top bit set count as printing characters or not is
39514 controlled by the <option>print_topbitchars</option> global option.
39517 If any of the generic options for manipulating headers (for example,
39518 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
39519 of the original message that is included in the generated message when
39520 <option>return_message</option> is set. They do not apply to the generated message itself.
39523 <indexterm role="variable">
39524 <primary><varname>$sender_address</varname></primary>
39526 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
39527 the message, indicating that there were no recipients, it does not treat this
39528 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
39529 is empty (because the incoming message is a bounce message) do not cause
39530 problems. They are just discarded.
39532 <section id="SECID139">
39533 <title>Private options for autoreply</title>
39535 <indexterm role="concept">
39536 <primary>options</primary>
39537 <secondary><command>autoreply</command> transport</secondary>
39541 <indexterm role="option">
39542 <primary><option>bcc</option></primary>
39545 <informaltable frame="all">
39546 <tgroup cols="4" colsep="0" rowsep="0">
39547 <colspec colwidth="8*" align="left"/>
39548 <colspec colwidth="6*" align="center"/>
39549 <colspec colwidth="6*" align="center"/>
39550 <colspec colwidth="6*" align="right"/>
39553 <entry><option>bcc</option></entry>
39554 <entry>Use: <emphasis>autoreply</emphasis></entry>
39555 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39556 <entry>Default: <emphasis>unset</emphasis></entry>
39562 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
39563 message when the message is specified by the transport.
39566 <indexterm role="option">
39567 <primary><option>cc</option></primary>
39570 <informaltable frame="all">
39571 <tgroup cols="4" colsep="0" rowsep="0">
39572 <colspec colwidth="8*" align="left"/>
39573 <colspec colwidth="6*" align="center"/>
39574 <colspec colwidth="6*" align="center"/>
39575 <colspec colwidth="6*" align="right"/>
39578 <entry><option>cc</option></entry>
39579 <entry>Use: <emphasis>autoreply</emphasis></entry>
39580 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39581 <entry>Default: <emphasis>unset</emphasis></entry>
39587 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
39588 when the message is specified by the transport.
39591 <indexterm role="option">
39592 <primary><option>file</option></primary>
39595 <informaltable frame="all">
39596 <tgroup cols="4" colsep="0" rowsep="0">
39597 <colspec colwidth="8*" align="left"/>
39598 <colspec colwidth="6*" align="center"/>
39599 <colspec colwidth="6*" align="center"/>
39600 <colspec colwidth="6*" align="right"/>
39603 <entry><option>file</option></entry>
39604 <entry>Use: <emphasis>autoreply</emphasis></entry>
39605 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39606 <entry>Default: <emphasis>unset</emphasis></entry>
39612 The contents of the file are sent as the body of the message when the message
39613 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
39614 string comes first.
39617 <indexterm role="option">
39618 <primary><option>file_expand</option></primary>
39621 <informaltable frame="all">
39622 <tgroup cols="4" colsep="0" rowsep="0">
39623 <colspec colwidth="8*" align="left"/>
39624 <colspec colwidth="6*" align="center"/>
39625 <colspec colwidth="6*" align="center"/>
39626 <colspec colwidth="6*" align="right"/>
39629 <entry><option>file_expand</option></entry>
39630 <entry>Use: <emphasis>autoreply</emphasis></entry>
39631 <entry>Type: <emphasis>boolean</emphasis></entry>
39632 <entry>Default: <emphasis>false</emphasis></entry>
39638 If this is set, the contents of the file named by the <option>file</option> option are
39639 subjected to string expansion as they are added to the message.
39642 <indexterm role="option">
39643 <primary><option>file_optional</option></primary>
39646 <informaltable frame="all">
39647 <tgroup cols="4" colsep="0" rowsep="0">
39648 <colspec colwidth="8*" align="left"/>
39649 <colspec colwidth="6*" align="center"/>
39650 <colspec colwidth="6*" align="center"/>
39651 <colspec colwidth="6*" align="right"/>
39654 <entry><option>file_optional</option></entry>
39655 <entry>Use: <emphasis>autoreply</emphasis></entry>
39656 <entry>Type: <emphasis>boolean</emphasis></entry>
39657 <entry>Default: <emphasis>false</emphasis></entry>
39663 If this option is true, no error is generated if the file named by the <option>file</option>
39664 option or passed with the address does not exist or cannot be read.
39667 <indexterm role="option">
39668 <primary><option>from</option></primary>
39671 <informaltable frame="all">
39672 <tgroup cols="4" colsep="0" rowsep="0">
39673 <colspec colwidth="8*" align="left"/>
39674 <colspec colwidth="6*" align="center"/>
39675 <colspec colwidth="6*" align="center"/>
39676 <colspec colwidth="6*" align="right"/>
39679 <entry><option>from</option></entry>
39680 <entry>Use: <emphasis>autoreply</emphasis></entry>
39681 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39682 <entry>Default: <emphasis>unset</emphasis></entry>
39688 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
39689 specified by the transport.
39692 <indexterm role="option">
39693 <primary><option>headers</option></primary>
39696 <informaltable frame="all">
39697 <tgroup cols="4" colsep="0" rowsep="0">
39698 <colspec colwidth="8*" align="left"/>
39699 <colspec colwidth="6*" align="center"/>
39700 <colspec colwidth="6*" align="center"/>
39701 <colspec colwidth="6*" align="right"/>
39704 <entry><option>headers</option></entry>
39705 <entry>Use: <emphasis>autoreply</emphasis></entry>
39706 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39707 <entry>Default: <emphasis>unset</emphasis></entry>
39713 This specifies additional RFC 2822 headers that are to be added to the message
39714 when the message is specified by the transport. Several can be given by using
39715 <quote>\n</quote> to separate them. There is no check on the format.
39718 <indexterm role="option">
39719 <primary><option>log</option></primary>
39722 <informaltable frame="all">
39723 <tgroup cols="4" colsep="0" rowsep="0">
39724 <colspec colwidth="8*" align="left"/>
39725 <colspec colwidth="6*" align="center"/>
39726 <colspec colwidth="6*" align="center"/>
39727 <colspec colwidth="6*" align="right"/>
39730 <entry><option>log</option></entry>
39731 <entry>Use: <emphasis>autoreply</emphasis></entry>
39732 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39733 <entry>Default: <emphasis>unset</emphasis></entry>
39739 This option names a file in which a record of every message sent is logged when
39740 the message is specified by the transport.
39743 <indexterm role="option">
39744 <primary><option>mode</option></primary>
39747 <informaltable frame="all">
39748 <tgroup cols="4" colsep="0" rowsep="0">
39749 <colspec colwidth="8*" align="left"/>
39750 <colspec colwidth="6*" align="center"/>
39751 <colspec colwidth="6*" align="center"/>
39752 <colspec colwidth="6*" align="right"/>
39755 <entry><option>mode</option></entry>
39756 <entry>Use: <emphasis>autoreply</emphasis></entry>
39757 <entry>Type: <emphasis>octal integer</emphasis></entry>
39758 <entry>Default: <emphasis>0600</emphasis></entry>
39764 If either the log file or the <quote>once</quote> file has to be created, this mode is
39768 <indexterm role="option">
39769 <primary><option>never_mail</option></primary>
39772 <informaltable frame="all">
39773 <tgroup cols="4" colsep="0" rowsep="0">
39774 <colspec colwidth="8*" align="left"/>
39775 <colspec colwidth="6*" align="center"/>
39776 <colspec colwidth="6*" align="center"/>
39777 <colspec colwidth="6*" align="right"/>
39780 <entry><option>never_mail</option></entry>
39781 <entry>Use: <emphasis>autoreply</emphasis></entry>
39782 <entry>Type: <emphasis>address list</emphasis>†<emphasis></emphasis></entry>
39783 <entry>Default: <emphasis>unset</emphasis></entry>
39789 If any run of the transport creates a message with a recipient that matches any
39790 item in the list, that recipient is quietly discarded. If all recipients are
39791 discarded, no message is created. This applies both when the recipients are
39792 generated by a filter and when they are specified in the transport.
39795 <indexterm role="option">
39796 <primary><option>once</option></primary>
39799 <informaltable frame="all">
39800 <tgroup cols="4" colsep="0" rowsep="0">
39801 <colspec colwidth="8*" align="left"/>
39802 <colspec colwidth="6*" align="center"/>
39803 <colspec colwidth="6*" align="center"/>
39804 <colspec colwidth="6*" align="right"/>
39807 <entry><option>once</option></entry>
39808 <entry>Use: <emphasis>autoreply</emphasis></entry>
39809 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39810 <entry>Default: <emphasis>unset</emphasis></entry>
39816 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
39817 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
39818 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
39821 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
39822 By default, if <option>once</option> is set to a non-empty file name, the message
39823 is not sent if a potential recipient is already listed in the database.
39824 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
39825 message is sent if that much time has elapsed since a message was last sent to
39826 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
39827 prevents a message from being sent a second time – in this case, zero means
39831 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
39832 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
39833 greater than zero, it changes the way Exim implements the <option>once</option> option.
39834 Instead of using a DBM file to record every recipient it sends to, it uses a
39835 regular file, whose size will never get larger than the given value.
39838 In the file, Exim keeps a linear list of recipient addresses and the times at
39839 which they were sent messages. If the file is full when a new address needs to
39840 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
39841 means that a given recipient may receive multiple messages, but at
39842 unpredictable intervals that depend on the rate of turnover of addresses in the
39843 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
39846 <indexterm role="option">
39847 <primary><option>once_file_size</option></primary>
39850 <informaltable frame="all">
39851 <tgroup cols="4" colsep="0" rowsep="0">
39852 <colspec colwidth="8*" align="left"/>
39853 <colspec colwidth="6*" align="center"/>
39854 <colspec colwidth="6*" align="center"/>
39855 <colspec colwidth="6*" align="right"/>
39858 <entry><option>once_file_size</option></entry>
39859 <entry>Use: <emphasis>autoreply</emphasis></entry>
39860 <entry>Type: <emphasis>integer</emphasis></entry>
39861 <entry>Default: <emphasis>0</emphasis></entry>
39867 See <option>once</option> above.
39870 <indexterm role="option">
39871 <primary><option>once_repeat</option></primary>
39874 <informaltable frame="all">
39875 <tgroup cols="4" colsep="0" rowsep="0">
39876 <colspec colwidth="8*" align="left"/>
39877 <colspec colwidth="6*" align="center"/>
39878 <colspec colwidth="6*" align="center"/>
39879 <colspec colwidth="6*" align="right"/>
39882 <entry><option>once_repeat</option></entry>
39883 <entry>Use: <emphasis>autoreply</emphasis></entry>
39884 <entry>Type: <emphasis>time</emphasis>†<emphasis></emphasis></entry>
39885 <entry>Default: <emphasis>0s</emphasis></entry>
39891 See <option>once</option> above.
39892 After expansion, the value of this option must be a valid time value.
39895 <indexterm role="option">
39896 <primary><option>reply_to</option></primary>
39899 <informaltable frame="all">
39900 <tgroup cols="4" colsep="0" rowsep="0">
39901 <colspec colwidth="8*" align="left"/>
39902 <colspec colwidth="6*" align="center"/>
39903 <colspec colwidth="6*" align="center"/>
39904 <colspec colwidth="6*" align="right"/>
39907 <entry><option>reply_to</option></entry>
39908 <entry>Use: <emphasis>autoreply</emphasis></entry>
39909 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39910 <entry>Default: <emphasis>unset</emphasis></entry>
39916 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
39917 specified by the transport.
39920 <indexterm role="option">
39921 <primary><option>return_message</option></primary>
39924 <informaltable frame="all">
39925 <tgroup cols="4" colsep="0" rowsep="0">
39926 <colspec colwidth="8*" align="left"/>
39927 <colspec colwidth="6*" align="center"/>
39928 <colspec colwidth="6*" align="center"/>
39929 <colspec colwidth="6*" align="right"/>
39932 <entry><option>return_message</option></entry>
39933 <entry>Use: <emphasis>autoreply</emphasis></entry>
39934 <entry>Type: <emphasis>boolean</emphasis></entry>
39935 <entry>Default: <emphasis>false</emphasis></entry>
39941 If this is set, a copy of the original message is returned with the new
39942 message, subject to the maximum size set in the <option>return_size_limit</option> global
39943 configuration option.
39946 <indexterm role="option">
39947 <primary><option>subject</option></primary>
39950 <informaltable frame="all">
39951 <tgroup cols="4" colsep="0" rowsep="0">
39952 <colspec colwidth="8*" align="left"/>
39953 <colspec colwidth="6*" align="center"/>
39954 <colspec colwidth="6*" align="center"/>
39955 <colspec colwidth="6*" align="right"/>
39958 <entry><option>subject</option></entry>
39959 <entry>Use: <emphasis>autoreply</emphasis></entry>
39960 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39961 <entry>Default: <emphasis>unset</emphasis></entry>
39967 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
39968 specified by the transport. It is tempting to quote the original subject in
39969 automatic responses. For example:
39971 <literallayout class="monospaced">
39972 subject = Re: $h_subject:
39975 There is a danger in doing this, however. It may allow a third party to
39976 subscribe your users to an opt-in mailing list, provided that the list accepts
39977 bounce messages as subscription confirmations. Well-managed lists require a
39978 non-bounce message to confirm a subscription, so the danger is relatively
39982 <indexterm role="option">
39983 <primary><option>text</option></primary>
39986 <informaltable frame="all">
39987 <tgroup cols="4" colsep="0" rowsep="0">
39988 <colspec colwidth="8*" align="left"/>
39989 <colspec colwidth="6*" align="center"/>
39990 <colspec colwidth="6*" align="center"/>
39991 <colspec colwidth="6*" align="right"/>
39994 <entry><option>text</option></entry>
39995 <entry>Use: <emphasis>autoreply</emphasis></entry>
39996 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
39997 <entry>Default: <emphasis>unset</emphasis></entry>
40003 This specifies a single string to be used as the body of the message when the
40004 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
40005 the text comes first.
40008 <indexterm role="option">
40009 <primary><option>to</option></primary>
40012 <informaltable frame="all">
40013 <tgroup cols="4" colsep="0" rowsep="0">
40014 <colspec colwidth="8*" align="left"/>
40015 <colspec colwidth="6*" align="center"/>
40016 <colspec colwidth="6*" align="center"/>
40017 <colspec colwidth="6*" align="right"/>
40020 <entry><option>to</option></entry>
40021 <entry>Use: <emphasis>autoreply</emphasis></entry>
40022 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40023 <entry>Default: <emphasis>unset</emphasis></entry>
40029 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
40030 when the message is specified by the transport.
40031 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
40032 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
40037 <chapter id="CHAPLMTP">
40038 <title>The lmtp transport</title>
40040 <indexterm role="concept">
40041 <primary>transports</primary>
40042 <secondary><command>lmtp</command></secondary>
40044 <indexterm role="concept">
40045 <primary><command>lmtp</command> transport</primary>
40047 <indexterm role="concept">
40048 <primary>LMTP</primary>
40049 <secondary>over a pipe</secondary>
40051 <indexterm role="concept">
40052 <primary>LMTP</primary>
40053 <secondary>over a socket</secondary>
40055 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
40057 or by interacting with a Unix domain socket.
40058 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
40059 transports. Exim also has support for using LMTP over TCP/IP; this is
40060 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
40061 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
40062 has it commented out. You need to ensure that
40064 <literallayout class="monospaced">
40068 <indexterm role="concept">
40069 <primary>options</primary>
40070 <secondary><command>lmtp</command> transport</secondary>
40072 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
40073 included in the Exim binary. The private options of the <command>lmtp</command> transport are
40077 <indexterm role="option">
40078 <primary><option>batch_id</option></primary>
40081 <informaltable frame="all">
40082 <tgroup cols="4" colsep="0" rowsep="0">
40083 <colspec colwidth="8*" align="left"/>
40084 <colspec colwidth="6*" align="center"/>
40085 <colspec colwidth="6*" align="center"/>
40086 <colspec colwidth="6*" align="right"/>
40089 <entry><option>batch_id</option></entry>
40090 <entry>Use: <emphasis>lmtp</emphasis></entry>
40091 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40092 <entry>Default: <emphasis>unset</emphasis></entry>
40098 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40101 <indexterm role="option">
40102 <primary><option>batch_max</option></primary>
40105 <informaltable frame="all">
40106 <tgroup cols="4" colsep="0" rowsep="0">
40107 <colspec colwidth="8*" align="left"/>
40108 <colspec colwidth="6*" align="center"/>
40109 <colspec colwidth="6*" align="center"/>
40110 <colspec colwidth="6*" align="right"/>
40113 <entry><option>batch_max</option></entry>
40114 <entry>Use: <emphasis>lmtp</emphasis></entry>
40115 <entry>Type: <emphasis>integer</emphasis></entry>
40116 <entry>Default: <emphasis>1</emphasis></entry>
40122 This limits the number of addresses that can be handled in a single delivery.
40123 Most LMTP servers can handle several addresses at once, so it is normally a
40124 good idea to increase this value. See the description of local delivery
40125 batching in chapter <xref linkend="CHAPbatching"/>.
40128 <indexterm role="option">
40129 <primary><option>command</option></primary>
40132 <informaltable frame="all">
40133 <tgroup cols="4" colsep="0" rowsep="0">
40134 <colspec colwidth="8*" align="left"/>
40135 <colspec colwidth="6*" align="center"/>
40136 <colspec colwidth="6*" align="center"/>
40137 <colspec colwidth="6*" align="right"/>
40140 <entry><option>command</option></entry>
40141 <entry>Use: <emphasis>lmtp</emphasis></entry>
40142 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40143 <entry>Default: <emphasis>unset</emphasis></entry>
40149 This option must be set if <option>socket</option> is not set. The string is a command which
40150 is run in a separate process. It is split up into a command name and list of
40151 arguments, each of which is separately expanded (so expansion cannot change the
40152 number of arguments). The command is run directly, not via a shell. The message
40153 is passed to the new process using the standard input and output to operate the
40157 <indexterm role="option">
40158 <primary><option>ignore_quota</option></primary>
40161 <informaltable frame="all">
40162 <tgroup cols="4" colsep="0" rowsep="0">
40163 <colspec colwidth="8*" align="left"/>
40164 <colspec colwidth="6*" align="center"/>
40165 <colspec colwidth="6*" align="center"/>
40166 <colspec colwidth="6*" align="right"/>
40169 <entry><option>ignore_quota</option></entry>
40170 <entry>Use: <emphasis>lmtp</emphasis></entry>
40171 <entry>Type: <emphasis>boolean</emphasis></entry>
40172 <entry>Default: <emphasis>false</emphasis></entry>
40178 <indexterm role="concept">
40179 <primary>LMTP</primary>
40180 <secondary>ignoring quota errors</secondary>
40182 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
40183 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
40184 in its response to the LHLO command.
40187 <indexterm role="option">
40188 <primary><option>socket</option></primary>
40191 <informaltable frame="all">
40192 <tgroup cols="4" colsep="0" rowsep="0">
40193 <colspec colwidth="8*" align="left"/>
40194 <colspec colwidth="6*" align="center"/>
40195 <colspec colwidth="6*" align="center"/>
40196 <colspec colwidth="6*" align="right"/>
40199 <entry><option>socket</option></entry>
40200 <entry>Use: <emphasis>lmtp</emphasis></entry>
40201 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40202 <entry>Default: <emphasis>unset</emphasis></entry>
40208 This option must be set if <option>command</option> is not set. The result of expansion must
40209 be the name of a Unix domain socket. The transport connects to the socket and
40210 delivers the message to it using the LMTP protocol.
40213 <indexterm role="option">
40214 <primary><option>timeout</option></primary>
40217 <informaltable frame="all">
40218 <tgroup cols="4" colsep="0" rowsep="0">
40219 <colspec colwidth="8*" align="left"/>
40220 <colspec colwidth="6*" align="center"/>
40221 <colspec colwidth="6*" align="center"/>
40222 <colspec colwidth="6*" align="right"/>
40225 <entry><option>timeout</option></entry>
40226 <entry>Use: <emphasis>lmtp</emphasis></entry>
40227 <entry>Type: <emphasis>time</emphasis></entry>
40228 <entry>Default: <emphasis>5m</emphasis></entry>
40234 The transport is aborted if the created process or Unix domain socket does not
40235 respond to LMTP commands or message input within this timeout. Delivery
40236 is deferred, and will be tried again later. Here is an example of a typical
40239 <literallayout class="monospaced">
40242 command = /some/local/lmtp/delivery/program
40247 This delivers up to 20 addresses at a time, in a mixture of domains if
40248 necessary, running as the user <emphasis>exim</emphasis>.
40252 <chapter id="CHAPpipetransport">
40253 <title>The pipe transport</title>
40255 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
40256 <primary>transports</primary>
40257 <secondary><command>pipe</command></secondary>
40259 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
40260 <primary><command>pipe</command> transport</primary>
40262 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
40263 running in another process. One example is the use of <command>pipe</command> as a
40264 pseudo-remote transport for passing messages to some other delivery mechanism
40265 (such as UUCP). Another is the use by individual users to automatically process
40266 their incoming messages. The <command>pipe</command> transport can be used in one of the
40272 <indexterm role="variable">
40273 <primary><varname>$local_part</varname></primary>
40275 A router routes one address to a transport in the normal way, and the
40276 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
40277 contains the local part of the address (as usual), and the command that is run
40278 is specified by the <option>command</option> option on the transport.
40283 <indexterm role="variable">
40284 <primary><varname>$pipe_addresses</varname></primary>
40286 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
40287 transport can handle more than one address in a single run. In this case, when
40288 more than one address is routed to the transport, <varname>$local_part</varname> is not set
40289 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
40290 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
40291 that are routed to the transport.
40296 <indexterm role="variable">
40297 <primary><varname>$address_pipe</varname></primary>
40299 A router redirects an address directly to a pipe command (for example, from an
40300 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
40301 pipe command, and the <option>command</option> option on the transport is ignored. If only
40302 one address is being transported (<option>batch_max</option> is not greater than one, or
40303 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
40304 the local part that was redirected.
40309 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
40310 deliver messages over pipes using the LMTP interactive protocol. This is
40311 implemented by the <command>lmtp</command> transport.
40314 In the case when <command>pipe</command> is run as a consequence of an entry in a local user’s
40315 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
40316 other cases, the uid and gid have to be specified explicitly, either on the
40317 transport or on the router that handles the address. Current and <quote>home</quote>
40318 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
40319 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
40320 for a discussion of local delivery batching.
40322 <section id="SECID140">
40323 <title>Concurrent delivery</title>
40325 If two messages arrive at almost the same time, and both are routed to a pipe
40326 delivery, the two pipe transports may be run concurrently. You must ensure that
40327 any pipe commands you set up are robust against this happening. If the commands
40328 write to a file, the <option>exim_lock</option> utility might be of use.
40331 <section id="SECID141">
40332 <title>Returned status and data</title>
40334 <indexterm role="concept">
40335 <primary><command>pipe</command> transport</primary>
40336 <secondary>returned data</secondary>
40338 If the command exits with a non-zero return code, the delivery is deemed to
40339 have failed, unless either the <option>ignore_status</option> option is set (in which case
40340 the return code is treated as zero), or the return code is one of those listed
40341 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
40342 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
40343 logged, but are not included in the bounce message, which merely contains
40344 <quote>local delivery failed</quote>.
40347 If the return code is greater than 128 and the command being run is a shell
40348 script, it normally means that the script was terminated by a signal whose
40349 value is the return code minus 128.
40352 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
40353 return code is set to 127. This is the value that a shell returns if it is
40354 asked to run a non-existent command. The wording for the log line suggests that
40355 a non-existent command may be the problem.
40358 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
40359 set and the command produces any output on its standard output or standard
40360 error streams, the command is considered to have failed, even if it gave a zero
40361 return code or if <option>ignore_status</option> is set. The output from the command is
40362 included as part of the bounce message. The <option>return_fail_output</option> option is
40363 similar, except that output is returned only when the command exits with a
40364 failure return code, that is, a value other than zero or a code that matches
40365 <option>temp_errors</option>.
40368 <section id="SECThowcommandrun">
40369 <title>How the command is run</title>
40371 <indexterm role="concept">
40372 <primary><command>pipe</command> transport</primary>
40373 <secondary>path for command</secondary>
40375 The command line is (by default) broken down into a command name and arguments
40376 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
40377 <option>restrict_to_path</option> options can be used to restrict the commands that may be
40381 <indexterm role="concept">
40382 <primary>quoting</primary>
40383 <secondary>in pipe command</secondary>
40385 Unquoted arguments are delimited by white space. If an argument appears in
40386 double quotes, backslash is interpreted as an escape character in the usual
40387 way. If an argument appears in single quotes, no escaping is done.
40390 String expansion is applied to the command line except when it comes from a
40391 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
40392 expansion is applied to each argument in turn rather than to the whole line.
40393 For this reason, any string expansion item that contains white space must be
40394 quoted so as to be contained within a single argument. A setting such as
40396 <literallayout class="monospaced">
40397 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
40400 will not work, because the expansion item gets split between several
40401 arguments. You have to write
40403 <literallayout class="monospaced">
40404 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
40407 to ensure that it is all in one argument. The expansion is done in this way,
40408 argument by argument, so that the number of arguments cannot be changed as a
40409 result of expansion, and quotes or backslashes in inserted variables do not
40410 interact with external quoting. However, this leads to problems if you want to
40411 generate multiple arguments (or the command name plus arguments) from a single
40412 expansion. In this situation, the simplest solution is to use a shell. For
40415 <literallayout class="monospaced">
40416 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
40419 <indexterm role="concept">
40420 <primary>transport</primary>
40421 <secondary>filter</secondary>
40423 <indexterm role="concept">
40424 <primary>filter</primary>
40425 <secondary>transport filter</secondary>
40427 <indexterm role="variable">
40428 <primary><varname>$pipe_addresses</varname></primary>
40430 Special handling takes place when an argument consists of precisely the text
40431 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
40432 place this string is recognized is when it appears as an argument for a pipe or
40433 transport filter command. It causes each address that is being handled to be
40434 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
40435 avoids any problems with spaces or shell metacharacters, and is of use when a
40436 <command>pipe</command> transport is handling groups of addresses in a batch.
40439 After splitting up into arguments and expansion, the resulting command is run
40440 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
40441 message that is being delivered is supplied on the standard input, and the
40442 standard output and standard error are both connected to a single pipe that is
40443 read by Exim. The <option>max_output</option> option controls how much output the command
40444 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
40445 control what is done with it.
40448 Not running the command under a shell (by default) lessens the security risks
40449 in cases when a command from a user’s filter file is built out of data that was
40450 taken from an incoming message. If a shell is required, it can of course be
40451 explicitly specified as the command to be run. However, there are circumstances
40452 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
40453 under a shell and cannot easily be modified. To allow for these cases, there is
40454 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
40455 works. Instead of breaking up the command line as just described, it expands it
40456 as a single string and passes the result to <filename>/bin/sh</filename>. The
40457 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
40458 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
40461 <section id="SECTpipeenv">
40462 <title>Environment variables</title>
40464 <indexterm role="concept">
40465 <primary><command>pipe</command> transport</primary>
40466 <secondary>environment for command</secondary>
40468 <indexterm role="concept">
40469 <primary>environment for pipe transport</primary>
40471 The environment variables listed below are set up when the command is invoked.
40472 This list is a compromise for maximum compatibility with other MTAs. Note that
40473 the <option>environment</option> option can be used to add additional variables to this
40477 <literal>DOMAIN </literal> the domain of the address
40478 <literal>HOME </literal> the home directory, if set
40479 <literal>HOST </literal> the host name when called from a router (see below)
40480 <literal>LOCAL_PART </literal> see below
40481 <literal>LOCAL_PART_PREFIX </literal> see below
40482 <literal>LOCAL_PART_SUFFIX </literal> see below
40483 <literal>LOGNAME </literal> see below
40484 <literal>MESSAGE_ID </literal> Exim’s local ID for the message
40485 <literal>PATH </literal> as specified by the <option>path</option> option below
40486 <literal>QUALIFY_DOMAIN </literal> the sender qualification domain
40487 <literal>RECIPIENT </literal> the complete recipient address
40488 <literal>SENDER </literal> the sender of the message (empty if a bounce)
40489 <literal>SHELL </literal> <literal>/bin/sh</literal>
40490 <literal>TZ </literal> the value of the <option>timezone</option> option, if set
40491 <literal>USER </literal> see below
40494 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
40495 router, LOCAL_PART is set to the local part of the address. When it is
40496 called as a result of a forward or alias expansion, LOCAL_PART is set to
40497 the local part of the address that was expanded. In both cases, any affixes are
40498 removed from the local part, and made available in LOCAL_PART_PREFIX and
40499 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
40500 same value as LOCAL_PART for compatibility with other MTAs.
40503 <indexterm role="concept">
40504 <primary>HOST</primary>
40506 HOST is set only when a <command>pipe</command> transport is called from a router that
40507 associates hosts with an address, typically when using <command>pipe</command> as a
40508 pseudo-remote transport. HOST is set to the first host name specified by
40512 <indexterm role="concept">
40513 <primary>HOME</primary>
40515 If the transport’s generic <option>home_directory</option> option is set, its value is used
40516 for the HOME environment variable. Otherwise, a home directory may be set
40517 by the router’s <option>transport_home_directory</option> option, which defaults to the
40518 user’s home directory if <option>check_local_user</option> is set.
40521 <section id="SECID142">
40522 <title>Private options for pipe</title>
40524 <indexterm role="concept">
40525 <primary>options</primary>
40526 <secondary><command>pipe</command> transport</secondary>
40530 <indexterm role="option">
40531 <primary><option>allow_commands</option></primary>
40534 <informaltable frame="all">
40535 <tgroup cols="4" colsep="0" rowsep="0">
40536 <colspec colwidth="8*" align="left"/>
40537 <colspec colwidth="6*" align="center"/>
40538 <colspec colwidth="6*" align="center"/>
40539 <colspec colwidth="6*" align="right"/>
40542 <entry><option>allow_commands</option></entry>
40543 <entry>Use: <emphasis>pipe</emphasis></entry>
40544 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
40545 <entry>Default: <emphasis>unset</emphasis></entry>
40551 <indexterm role="concept">
40552 <primary><command>pipe</command> transport</primary>
40553 <secondary>permitted commands</secondary>
40555 The string is expanded, and is then interpreted as a colon-separated list of
40556 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
40557 permitted are those in the <option>allow_commands</option> list. They need not be absolute
40558 paths; the <option>path</option> option is still used for relative paths. If
40559 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
40560 in the <option>allow_commands</option> list, or a name without any slashes that is found on
40561 the path. In other words, if neither <option>allow_commands</option> nor
40562 <option>restrict_to_path</option> is set, there is no restriction on the command, but
40563 otherwise only commands that are permitted by one or the other are allowed. For
40566 <literallayout class="monospaced">
40567 allow_commands = /usr/bin/vacation
40570 and <option>restrict_to_path</option> is not set, the only permitted command is
40571 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
40572 <option>use_shell</option> is set.
40575 <indexterm role="option">
40576 <primary><option>batch_id</option></primary>
40579 <informaltable frame="all">
40580 <tgroup cols="4" colsep="0" rowsep="0">
40581 <colspec colwidth="8*" align="left"/>
40582 <colspec colwidth="6*" align="center"/>
40583 <colspec colwidth="6*" align="center"/>
40584 <colspec colwidth="6*" align="right"/>
40587 <entry><option>batch_id</option></entry>
40588 <entry>Use: <emphasis>pipe</emphasis></entry>
40589 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40590 <entry>Default: <emphasis>unset</emphasis></entry>
40596 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40599 <indexterm role="option">
40600 <primary><option>batch_max</option></primary>
40603 <informaltable frame="all">
40604 <tgroup cols="4" colsep="0" rowsep="0">
40605 <colspec colwidth="8*" align="left"/>
40606 <colspec colwidth="6*" align="center"/>
40607 <colspec colwidth="6*" align="center"/>
40608 <colspec colwidth="6*" align="right"/>
40611 <entry><option>batch_max</option></entry>
40612 <entry>Use: <emphasis>pipe</emphasis></entry>
40613 <entry>Type: <emphasis>integer</emphasis></entry>
40614 <entry>Default: <emphasis>1</emphasis></entry>
40620 This limits the number of addresses that can be handled in a single delivery.
40621 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
40624 <indexterm role="option">
40625 <primary><option>check_string</option></primary>
40628 <informaltable frame="all">
40629 <tgroup cols="4" colsep="0" rowsep="0">
40630 <colspec colwidth="8*" align="left"/>
40631 <colspec colwidth="6*" align="center"/>
40632 <colspec colwidth="6*" align="center"/>
40633 <colspec colwidth="6*" align="right"/>
40636 <entry><option>check_string</option></entry>
40637 <entry>Use: <emphasis>pipe</emphasis></entry>
40638 <entry>Type: <emphasis>string</emphasis></entry>
40639 <entry>Default: <emphasis>unset</emphasis></entry>
40645 As <command>pipe</command> writes the message, the start of each line is tested for matching
40646 <option>check_string</option>, and if it does, the initial matching characters are replaced
40647 by the contents of <option>escape_string</option>, provided both are set. The value of
40648 <option>check_string</option> is a literal string, not a regular expression, and the case of
40649 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
40650 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
40651 the SMTP escaping protocol. Any settings made in the configuration file are
40655 <indexterm role="option">
40656 <primary><option>command</option></primary>
40659 <informaltable frame="all">
40660 <tgroup cols="4" colsep="0" rowsep="0">
40661 <colspec colwidth="8*" align="left"/>
40662 <colspec colwidth="6*" align="center"/>
40663 <colspec colwidth="6*" align="center"/>
40664 <colspec colwidth="6*" align="right"/>
40667 <entry><option>command</option></entry>
40668 <entry>Use: <emphasis>pipe</emphasis></entry>
40669 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40670 <entry>Default: <emphasis>unset</emphasis></entry>
40676 This option need not be set when <command>pipe</command> is being used to deliver to pipes
40677 obtained directly from address redirections. In other cases, the option must be
40678 set, to provide a command to be run. It need not yield an absolute path (see
40679 the <option>path</option> option below). The command is split up into separate arguments by
40680 Exim, and each argument is separately expanded, as described in section
40681 <xref linkend="SECThowcommandrun"/> above.
40684 <indexterm role="option">
40685 <primary><option>environment</option></primary>
40688 <informaltable frame="all">
40689 <tgroup cols="4" colsep="0" rowsep="0">
40690 <colspec colwidth="8*" align="left"/>
40691 <colspec colwidth="6*" align="center"/>
40692 <colspec colwidth="6*" align="center"/>
40693 <colspec colwidth="6*" align="right"/>
40696 <entry><option>environment</option></entry>
40697 <entry>Use: <emphasis>pipe</emphasis></entry>
40698 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40699 <entry>Default: <emphasis>unset</emphasis></entry>
40705 <indexterm role="concept">
40706 <primary><command>pipe</command> transport</primary>
40707 <secondary>environment for command</secondary>
40709 <indexterm role="concept">
40710 <primary>environment for <command>pipe</command> transport</primary>
40712 This option is used to add additional variables to the environment in which the
40713 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
40714 a string which is expanded, and then interpreted as a colon-separated list of
40715 environment settings of the form <<emphasis>name</emphasis>>=<<emphasis>value</emphasis>>.
40718 <indexterm role="option">
40719 <primary><option>escape_string</option></primary>
40722 <informaltable frame="all">
40723 <tgroup cols="4" colsep="0" rowsep="0">
40724 <colspec colwidth="8*" align="left"/>
40725 <colspec colwidth="6*" align="center"/>
40726 <colspec colwidth="6*" align="center"/>
40727 <colspec colwidth="6*" align="right"/>
40730 <entry><option>escape_string</option></entry>
40731 <entry>Use: <emphasis>pipe</emphasis></entry>
40732 <entry>Type: <emphasis>string</emphasis></entry>
40733 <entry>Default: <emphasis>unset</emphasis></entry>
40739 See <option>check_string</option> above.
40742 <indexterm role="option">
40743 <primary><option>freeze_exec_fail</option></primary>
40746 <informaltable frame="all">
40747 <tgroup cols="4" colsep="0" rowsep="0">
40748 <colspec colwidth="8*" align="left"/>
40749 <colspec colwidth="6*" align="center"/>
40750 <colspec colwidth="6*" align="center"/>
40751 <colspec colwidth="6*" align="right"/>
40754 <entry><option>freeze_exec_fail</option></entry>
40755 <entry>Use: <emphasis>pipe</emphasis></entry>
40756 <entry>Type: <emphasis>boolean</emphasis></entry>
40757 <entry>Default: <emphasis>false</emphasis></entry>
40763 <indexterm role="concept">
40764 <primary>exec failure</primary>
40766 <indexterm role="concept">
40767 <primary>failure of exec</primary>
40769 <indexterm role="concept">
40770 <primary><command>pipe</command> transport</primary>
40771 <secondary>failure of exec</secondary>
40773 Failure to exec the command in a pipe transport is by default treated like
40774 any other failure while running the command. However, if <option>freeze_exec_fail</option>
40775 is set, failure to exec is treated specially, and causes the message to be
40776 frozen, whatever the setting of <option>ignore_status</option>.
40779 <indexterm role="option">
40780 <primary><option>ignore_status</option></primary>
40783 <informaltable frame="all">
40784 <tgroup cols="4" colsep="0" rowsep="0">
40785 <colspec colwidth="8*" align="left"/>
40786 <colspec colwidth="6*" align="center"/>
40787 <colspec colwidth="6*" align="center"/>
40788 <colspec colwidth="6*" align="right"/>
40791 <entry><option>ignore_status</option></entry>
40792 <entry>Use: <emphasis>pipe</emphasis></entry>
40793 <entry>Type: <emphasis>boolean</emphasis></entry>
40794 <entry>Default: <emphasis>false</emphasis></entry>
40800 If this option is true, the status returned by the subprocess that is set up to
40801 run the command is ignored, and Exim behaves as if zero had been returned.
40802 Otherwise, a non-zero status or termination by signal causes an error return
40803 from the transport unless the status value is one of those listed in
40804 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
40807 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
40808 See the <option>timeout_defer</option> option for how timeouts are handled.
40811 <indexterm role="option">
40812 <primary><option>log_defer_output</option></primary>
40815 <informaltable frame="all">
40816 <tgroup cols="4" colsep="0" rowsep="0">
40817 <colspec colwidth="8*" align="left"/>
40818 <colspec colwidth="6*" align="center"/>
40819 <colspec colwidth="6*" align="center"/>
40820 <colspec colwidth="6*" align="right"/>
40823 <entry><option>log_defer_output</option></entry>
40824 <entry>Use: <emphasis>pipe</emphasis></entry>
40825 <entry>Type: <emphasis>boolean</emphasis></entry>
40826 <entry>Default: <emphasis>false</emphasis></entry>
40832 <indexterm role="concept">
40833 <primary><command>pipe</command> transport</primary>
40834 <secondary>logging output</secondary>
40836 If this option is set, and the status returned by the command is
40837 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
40838 and any output was produced, the first line of it is written to the main log.
40841 <indexterm role="option">
40842 <primary><option>log_fail_output</option></primary>
40845 <informaltable frame="all">
40846 <tgroup cols="4" colsep="0" rowsep="0">
40847 <colspec colwidth="8*" align="left"/>
40848 <colspec colwidth="6*" align="center"/>
40849 <colspec colwidth="6*" align="center"/>
40850 <colspec colwidth="6*" align="right"/>
40853 <entry><option>log_fail_output</option></entry>
40854 <entry>Use: <emphasis>pipe</emphasis></entry>
40855 <entry>Type: <emphasis>boolean</emphasis></entry>
40856 <entry>Default: <emphasis>false</emphasis></entry>
40862 If this option is set, and the command returns any output, and also ends with a
40863 return code that is neither zero nor one of the return codes listed in
40864 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
40865 written to the main log. This option and <option>log_output</option> are mutually exclusive.
40866 Only one of them may be set.
40869 <indexterm role="option">
40870 <primary><option>log_output</option></primary>
40873 <informaltable frame="all">
40874 <tgroup cols="4" colsep="0" rowsep="0">
40875 <colspec colwidth="8*" align="left"/>
40876 <colspec colwidth="6*" align="center"/>
40877 <colspec colwidth="6*" align="center"/>
40878 <colspec colwidth="6*" align="right"/>
40881 <entry><option>log_output</option></entry>
40882 <entry>Use: <emphasis>pipe</emphasis></entry>
40883 <entry>Type: <emphasis>boolean</emphasis></entry>
40884 <entry>Default: <emphasis>false</emphasis></entry>
40890 If this option is set and the command returns any output, the first line of
40891 output is written to the main log, whatever the return code. This option and
40892 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
40895 <indexterm role="option">
40896 <primary><option>max_output</option></primary>
40899 <informaltable frame="all">
40900 <tgroup cols="4" colsep="0" rowsep="0">
40901 <colspec colwidth="8*" align="left"/>
40902 <colspec colwidth="6*" align="center"/>
40903 <colspec colwidth="6*" align="center"/>
40904 <colspec colwidth="6*" align="right"/>
40907 <entry><option>max_output</option></entry>
40908 <entry>Use: <emphasis>pipe</emphasis></entry>
40909 <entry>Type: <emphasis>integer</emphasis></entry>
40910 <entry>Default: <emphasis>20K</emphasis></entry>
40916 This specifies the maximum amount of output that the command may produce on its
40917 standard output and standard error file combined. If the limit is exceeded, the
40918 process running the command is killed. This is intended as a safety measure to
40919 catch runaway processes. The limit is applied independently of the settings of
40920 the options that control what is done with such output (for example,
40921 <option>return_output</option>). Because of buffering effects, the amount of output may
40922 exceed the limit by a small amount before Exim notices.
40925 <indexterm role="option">
40926 <primary><option>message_prefix</option></primary>
40929 <informaltable frame="all">
40930 <tgroup cols="4" colsep="0" rowsep="0">
40931 <colspec colwidth="8*" align="left"/>
40932 <colspec colwidth="6*" align="center"/>
40933 <colspec colwidth="6*" align="center"/>
40934 <colspec colwidth="6*" align="right"/>
40937 <entry><option>message_prefix</option></entry>
40938 <entry>Use: <emphasis>pipe</emphasis></entry>
40939 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40940 <entry>Default: <emphasis>see below</emphasis></entry>
40946 The string specified here is expanded and output at the start of every message.
40947 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
40949 <literallayout class="monospaced">
40951 From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
40955 <indexterm role="concept">
40956 <primary>Cyrus</primary>
40958 <indexterm role="concept">
40959 <primary><option>tmail</option></primary>
40961 <indexterm role="concept">
40962 <primary><quote>From</quote> line</primary>
40964 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
40965 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
40966 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
40969 <literallayout class="monospaced">
40973 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
40974 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
40977 <indexterm role="option">
40978 <primary><option>message_suffix</option></primary>
40981 <informaltable frame="all">
40982 <tgroup cols="4" colsep="0" rowsep="0">
40983 <colspec colwidth="8*" align="left"/>
40984 <colspec colwidth="6*" align="center"/>
40985 <colspec colwidth="6*" align="center"/>
40986 <colspec colwidth="6*" align="right"/>
40989 <entry><option>message_suffix</option></entry>
40990 <entry>Use: <emphasis>pipe</emphasis></entry>
40991 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
40992 <entry>Default: <emphasis>see below</emphasis></entry>
40998 The string specified here is expanded and output at the end of every message.
40999 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
41000 The suffix can be suppressed by setting
41002 <literallayout class="monospaced">
41006 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
41007 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
41010 <indexterm role="option">
41011 <primary><option>path</option></primary>
41014 <informaltable frame="all">
41015 <tgroup cols="4" colsep="0" rowsep="0">
41016 <colspec colwidth="8*" align="left"/>
41017 <colspec colwidth="6*" align="center"/>
41018 <colspec colwidth="6*" align="center"/>
41019 <colspec colwidth="6*" align="right"/>
41022 <entry><option>path</option></entry>
41023 <entry>Use: <emphasis>pipe</emphasis></entry>
41024 <entry>Type: <emphasis>string</emphasis></entry>
41025 <entry>Default: <emphasis>see below</emphasis></entry>
41031 This option specifies the string that is set up in the PATH environment
41032 variable of the subprocess. The default is:
41034 <literallayout class="monospaced">
41038 If the <option>command</option> option does not yield an absolute path name, the command is
41039 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
41040 apply to a command specified as a transport filter.
41042 <para revisionflag="changed">
41043 <indexterm role="option">
41044 <primary><option>permit_coredump</option></primary>
41047 <informaltable frame="all" revisionflag="changed">
41048 <tgroup cols="4" colsep="0" rowsep="0">
41049 <colspec colwidth="8*" align="left"/>
41050 <colspec colwidth="6*" align="center"/>
41051 <colspec colwidth="6*" align="center"/>
41052 <colspec colwidth="6*" align="right"/>
41055 <entry><option>permit_coredump</option></entry>
41056 <entry>Use: <emphasis>pipe</emphasis></entry>
41057 <entry>Type: <emphasis>boolean</emphasis></entry>
41058 <entry>Default: <emphasis>false</emphasis></entry>
41063 <para revisionflag="changed">
41064 Normally Exim inhibits core-dumps during delivery. If you have a need to get
41065 a core-dump of a pipe command, enable this command. This enables core-dumps
41066 during delivery and affects both the Exim binary and the pipe command run.
41067 It is recommended that this option remain off unless and until you have a need
41068 for it and that this only be enabled when needed, as the risk of excessive
41069 resource consumption can be quite high. Note also that Exim is typically
41070 installed as a setuid binary and most operating systems will inhibit coredumps
41071 of these by default, so further OS-specific action may be required.
41074 <indexterm role="option">
41075 <primary><option>pipe_as_creator</option></primary>
41078 <informaltable frame="all">
41079 <tgroup cols="4" colsep="0" rowsep="0">
41080 <colspec colwidth="8*" align="left"/>
41081 <colspec colwidth="6*" align="center"/>
41082 <colspec colwidth="6*" align="center"/>
41083 <colspec colwidth="6*" align="right"/>
41086 <entry><option>pipe_as_creator</option></entry>
41087 <entry>Use: <emphasis>pipe</emphasis></entry>
41088 <entry>Type: <emphasis>boolean</emphasis></entry>
41089 <entry>Default: <emphasis>false</emphasis></entry>
41095 <indexterm role="concept">
41096 <primary>uid (user id)</primary>
41097 <secondary>local delivery</secondary>
41099 If the generic <option>user</option> option is not set and this option is true, the delivery
41100 process is run under the uid that was in force when Exim was originally called
41101 to accept the message. If the group id is not otherwise set (via the generic
41102 <option>group</option> option), the gid that was in force when Exim was originally called to
41103 accept the message is used.
41106 <indexterm role="option">
41107 <primary><option>restrict_to_path</option></primary>
41110 <informaltable frame="all">
41111 <tgroup cols="4" colsep="0" rowsep="0">
41112 <colspec colwidth="8*" align="left"/>
41113 <colspec colwidth="6*" align="center"/>
41114 <colspec colwidth="6*" align="center"/>
41115 <colspec colwidth="6*" align="right"/>
41118 <entry><option>restrict_to_path</option></entry>
41119 <entry>Use: <emphasis>pipe</emphasis></entry>
41120 <entry>Type: <emphasis>boolean</emphasis></entry>
41121 <entry>Default: <emphasis>false</emphasis></entry>
41127 When this option is set, any command name not listed in <option>allow_commands</option> must
41128 contain no slashes. The command is searched for only in the directories listed
41129 in the <option>path</option> option. This option is intended for use in the case when a pipe
41130 command has been generated from a user’s <filename>.forward</filename> file. This is usually
41131 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
41134 <indexterm role="option">
41135 <primary><option>return_fail_output</option></primary>
41138 <informaltable frame="all">
41139 <tgroup cols="4" colsep="0" rowsep="0">
41140 <colspec colwidth="8*" align="left"/>
41141 <colspec colwidth="6*" align="center"/>
41142 <colspec colwidth="6*" align="center"/>
41143 <colspec colwidth="6*" align="right"/>
41146 <entry><option>return_fail_output</option></entry>
41147 <entry>Use: <emphasis>pipe</emphasis></entry>
41148 <entry>Type: <emphasis>boolean</emphasis></entry>
41149 <entry>Default: <emphasis>false</emphasis></entry>
41155 If this option is true, and the command produced any output and ended with a
41156 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
41157 is, the delivery failed), the output is returned in the bounce message.
41158 However, if the message has a null sender (that is, it is itself a bounce
41159 message), output from the command is discarded. This option and
41160 <option>return_output</option> are mutually exclusive. Only one of them may be set.
41163 <indexterm role="option">
41164 <primary><option>return_output</option></primary>
41167 <informaltable frame="all">
41168 <tgroup cols="4" colsep="0" rowsep="0">
41169 <colspec colwidth="8*" align="left"/>
41170 <colspec colwidth="6*" align="center"/>
41171 <colspec colwidth="6*" align="center"/>
41172 <colspec colwidth="6*" align="right"/>
41175 <entry><option>return_output</option></entry>
41176 <entry>Use: <emphasis>pipe</emphasis></entry>
41177 <entry>Type: <emphasis>boolean</emphasis></entry>
41178 <entry>Default: <emphasis>false</emphasis></entry>
41184 If this option is true, and the command produced any output, the delivery is
41185 deemed to have failed whatever the return code from the command, and the output
41186 is returned in the bounce message. Otherwise, the output is just discarded.
41187 However, if the message has a null sender (that is, it is a bounce message),
41188 output from the command is always discarded, whatever the setting of this
41189 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
41190 of them may be set.
41193 <indexterm role="option">
41194 <primary><option>temp_errors</option></primary>
41197 <informaltable frame="all">
41198 <tgroup cols="4" colsep="0" rowsep="0">
41199 <colspec colwidth="8*" align="left"/>
41200 <colspec colwidth="6*" align="center"/>
41201 <colspec colwidth="6*" align="center"/>
41202 <colspec colwidth="6*" align="right"/>
41205 <entry><option>temp_errors</option></entry>
41206 <entry>Use: <emphasis>pipe</emphasis></entry>
41207 <entry>Type: <emphasis>string list</emphasis></entry>
41208 <entry>Default: <emphasis>see below</emphasis></entry>
41214 <indexterm role="concept">
41215 <primary><command>pipe</command> transport</primary>
41216 <secondary>temporary failure</secondary>
41218 This option contains either a colon-separated list of numbers, or a single
41219 asterisk. If <option>ignore_status</option> is false
41220 and <option>return_output</option> is not set,
41221 and the command exits with a non-zero return code, the failure is treated as
41222 temporary and the delivery is deferred if the return code matches one of the
41223 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
41224 codes are treated as permanent errors. The default setting contains the codes
41225 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
41226 compiled on a system that does not define these macros, it assumes values of 75
41227 and 73, respectively.
41230 <indexterm role="option">
41231 <primary><option>timeout</option></primary>
41234 <informaltable frame="all">
41235 <tgroup cols="4" colsep="0" rowsep="0">
41236 <colspec colwidth="8*" align="left"/>
41237 <colspec colwidth="6*" align="center"/>
41238 <colspec colwidth="6*" align="center"/>
41239 <colspec colwidth="6*" align="right"/>
41242 <entry><option>timeout</option></entry>
41243 <entry>Use: <emphasis>pipe</emphasis></entry>
41244 <entry>Type: <emphasis>time</emphasis></entry>
41245 <entry>Default: <emphasis>1h</emphasis></entry>
41251 If the command fails to complete within this time, it is killed. This normally
41252 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
41253 specifies no timeout. In order to ensure that any subprocesses created by the
41254 command are also killed, Exim makes the initial process a process group leader,
41255 and kills the whole process group on a timeout. However, this can be defeated
41256 if one of the processes starts a new process group.
41259 <indexterm role="option">
41260 <primary><option>timeout_defer</option></primary>
41263 <informaltable frame="all">
41264 <tgroup cols="4" colsep="0" rowsep="0">
41265 <colspec colwidth="8*" align="left"/>
41266 <colspec colwidth="6*" align="center"/>
41267 <colspec colwidth="6*" align="center"/>
41268 <colspec colwidth="6*" align="right"/>
41271 <entry><option>timeout_defer</option></entry>
41272 <entry>Use: <emphasis>pipe</emphasis></entry>
41273 <entry>Type: <emphasis>boolean</emphasis></entry>
41274 <entry>Default: <emphasis>false</emphasis></entry>
41280 A timeout in a <command>pipe</command> transport, either in the command that the transport
41281 runs, or in a transport filter that is associated with it, is by default
41282 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
41283 is set true, both kinds of timeout become temporary errors, causing the
41284 delivery to be deferred.
41287 <indexterm role="option">
41288 <primary><option>umask</option></primary>
41291 <informaltable frame="all">
41292 <tgroup cols="4" colsep="0" rowsep="0">
41293 <colspec colwidth="8*" align="left"/>
41294 <colspec colwidth="6*" align="center"/>
41295 <colspec colwidth="6*" align="center"/>
41296 <colspec colwidth="6*" align="right"/>
41299 <entry><option>umask</option></entry>
41300 <entry>Use: <emphasis>pipe</emphasis></entry>
41301 <entry>Type: <emphasis>octal integer</emphasis></entry>
41302 <entry>Default: <emphasis>022</emphasis></entry>
41308 This specifies the umask setting for the subprocess that runs the command.
41311 <indexterm role="option">
41312 <primary><option>use_bsmtp</option></primary>
41315 <informaltable frame="all">
41316 <tgroup cols="4" colsep="0" rowsep="0">
41317 <colspec colwidth="8*" align="left"/>
41318 <colspec colwidth="6*" align="center"/>
41319 <colspec colwidth="6*" align="center"/>
41320 <colspec colwidth="6*" align="right"/>
41323 <entry><option>use_bsmtp</option></entry>
41324 <entry>Use: <emphasis>pipe</emphasis></entry>
41325 <entry>Type: <emphasis>boolean</emphasis></entry>
41326 <entry>Default: <emphasis>false</emphasis></entry>
41332 <indexterm role="concept">
41333 <primary>envelope sender</primary>
41335 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
41336 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
41337 commands. If you want to include a leading HELO command with such messages,
41338 you can do so by setting the <option>message_prefix</option> option. See section
41339 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
41342 <indexterm role="option">
41343 <primary><option>use_classresources</option></primary>
41346 <informaltable frame="all">
41347 <tgroup cols="4" colsep="0" rowsep="0">
41348 <colspec colwidth="8*" align="left"/>
41349 <colspec colwidth="6*" align="center"/>
41350 <colspec colwidth="6*" align="center"/>
41351 <colspec colwidth="6*" align="right"/>
41354 <entry><option>use_classresources</option></entry>
41355 <entry>Use: <emphasis>pipe</emphasis></entry>
41356 <entry>Type: <emphasis>boolean</emphasis></entry>
41357 <entry>Default: <emphasis>false</emphasis></entry>
41363 <indexterm role="concept">
41364 <primary>class resources (BSD)</primary>
41366 This option is available only when Exim is running on FreeBSD, NetBSD, or
41367 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
41368 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
41369 limits for the uid under which the pipe is to run are obtained from the login
41373 <indexterm role="option">
41374 <primary><option>use_crlf</option></primary>
41377 <informaltable frame="all">
41378 <tgroup cols="4" colsep="0" rowsep="0">
41379 <colspec colwidth="8*" align="left"/>
41380 <colspec colwidth="6*" align="center"/>
41381 <colspec colwidth="6*" align="center"/>
41382 <colspec colwidth="6*" align="right"/>
41385 <entry><option>use_crlf</option></entry>
41386 <entry>Use: <emphasis>pipe</emphasis></entry>
41387 <entry>Type: <emphasis>boolean</emphasis></entry>
41388 <entry>Default: <emphasis>false</emphasis></entry>
41394 <indexterm role="concept">
41395 <primary>carriage return</primary>
41397 <indexterm role="concept">
41398 <primary>linefeed</primary>
41400 This option causes lines to be terminated with the two-character CRLF sequence
41401 (carriage return, linefeed) instead of just a linefeed character. In the case
41402 of batched SMTP, the byte sequence written to the pipe is then an exact image
41403 of what would be sent down a real SMTP connection.
41406 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
41407 written verbatim, so must contain their own carriage return characters if these
41408 are needed. When <option>use_bsmtp</option> is not set, the default values for both
41409 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
41410 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
41413 <indexterm role="option">
41414 <primary><option>use_shell</option></primary>
41417 <informaltable frame="all">
41418 <tgroup cols="4" colsep="0" rowsep="0">
41419 <colspec colwidth="8*" align="left"/>
41420 <colspec colwidth="6*" align="center"/>
41421 <colspec colwidth="6*" align="center"/>
41422 <colspec colwidth="6*" align="right"/>
41425 <entry><option>use_shell</option></entry>
41426 <entry>Use: <emphasis>pipe</emphasis></entry>
41427 <entry>Type: <emphasis>boolean</emphasis></entry>
41428 <entry>Default: <emphasis>false</emphasis></entry>
41434 <indexterm role="variable">
41435 <primary><varname>$pipe_addresses</varname></primary>
41437 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
41438 instead of being run directly from the transport, as described in section
41439 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
41440 where the command is expected to be run under a shell and cannot easily be
41441 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
41442 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
41443 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
41444 its <option>-c</option> option.
41447 <section id="SECID143">
41448 <title>Using an external local delivery agent</title>
41450 <indexterm role="concept">
41451 <primary>local delivery</primary>
41452 <secondary>using an external agent</secondary>
41454 <indexterm role="concept">
41455 <primary><emphasis>procmail</emphasis></primary>
41457 <indexterm role="concept">
41458 <primary>external local delivery</primary>
41460 <indexterm role="concept">
41461 <primary>delivery</primary>
41462 <secondary><emphasis>procmail</emphasis></secondary>
41464 <indexterm role="concept">
41465 <primary>delivery</primary>
41466 <secondary>by external agent</secondary>
41468 The <command>pipe</command> transport can be used to pass all messages that require local
41469 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
41470 this, care must be taken to ensure that the pipe is run under an appropriate
41471 uid and gid. In some configurations one wants this to be a uid that is trusted
41472 by the delivery agent to supply the correct sender of the message. It may be
41473 necessary to recompile or reconfigure the delivery agent so that it trusts an
41474 appropriate user. The following is an example transport and router
41475 configuration for <option>procmail</option>:
41477 <literallayout class="monospaced">
41481 command = /usr/local/bin/procmail -d $local_part
41485 check_string = "From "
41486 escape_string = ">From "
41495 transport = procmail_pipe
41498 In this example, the pipe is run as the local user, but with the group set to
41499 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
41500 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
41501 user to supply a correct sender address. If you do not specify either a
41502 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
41503 home directory is the user’s home directory by default.
41506 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
41508 <literallayout class="monospaced">
41512 as shown in some <option>procmail</option> documentation, because Exim does not by default
41513 use a shell to run pipe commands.
41516 <indexterm role="concept">
41517 <primary>Cyrus</primary>
41519 The next example shows a transport and a router for a system where local
41520 deliveries are handled by the Cyrus IMAP server.
41522 <literallayout class="monospaced">
41524 local_delivery_cyrus:
41526 command = /usr/cyrus/bin/deliver \
41527 -m ${substr_1:$local_part_suffix} -- $local_part
41539 local_part_suffix = .*
41540 transport = local_delivery_cyrus
41543 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
41544 <option>return_output</option> to cause any text written by Cyrus to be returned to the
41546 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
41547 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
41552 <chapter id="CHAPsmtptrans">
41553 <title>The smtp transport</title>
41555 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
41556 <primary>transports</primary>
41557 <secondary><command>smtp</command></secondary>
41559 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
41560 <primary><command>smtp</command> transport</primary>
41562 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
41563 or LMTP protocol. The list of hosts to try can either be taken from the address
41564 that is being processed (having been set up by the router), or specified
41565 explicitly for the transport. Timeout and retry processing (see chapter
41566 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
41568 <section id="SECID144">
41569 <title>Multiple messages on a single connection</title>
41571 The sending of multiple messages over a single TCP/IP connection can arise in
41577 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
41578 routed to the same host, more than one copy of the message has to be sent to
41579 that host. In this situation, multiple copies may be sent in a single run of
41580 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
41581 does when it has too many addresses to send in one message also depends on the
41582 value of the global <option>remote_max_parallel</option> option. Details are given in
41583 section <xref linkend="SECToutSMTPTCP"/>.)
41588 <indexterm role="concept">
41589 <primary>hints database</primary>
41590 <secondary>remembering routing</secondary>
41592 When a message has been successfully delivered over a TCP/IP connection, Exim
41593 looks in its hints database to see if there are any other messages awaiting a
41594 connection to the same host. If there are, a new delivery process is started
41595 for one of them, and the current TCP/IP connection is passed on to it. The new
41596 process may in turn send multiple copies and possibly create yet another
41602 For each copy sent over the same TCP/IP connection, a sequence counter is
41603 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
41604 no further messages are sent over that connection.
41607 <section id="SECID145">
41608 <title>Use of the $host and $host_address variables</title>
41610 <indexterm role="variable">
41611 <primary><varname>$host</varname></primary>
41613 <indexterm role="variable">
41614 <primary><varname>$host_address</varname></primary>
41616 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
41617 <varname>$host_address</varname> are the name and IP address of the first host on the host list
41618 passed by the router. However, when the transport is about to connect to a
41619 specific host, and while it is connected to that host, <varname>$host</varname> and
41620 <varname>$host_address</varname> are set to the values for that host. These are the values
41621 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
41622 <option>serialize_hosts</option>, and the various TLS options are expanded.
41625 <section id="usecippeer">
41626 <title>Use of $tls_cipher and $tls_peerdn</title>
41628 <indexterm role="variable">
41629 <primary><varname>$tls_cipher</varname></primary>
41631 <indexterm role="variable">
41632 <primary><varname>$tls_peerdn</varname></primary>
41634 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_cipher</varname>
41635 and <varname>$tls_peerdn</varname> are the values that were set when the message was received.
41636 These are the values that are used for options that are expanded before any
41637 SMTP connections are made. Just before each connection is made, these two
41638 variables are emptied. If TLS is subsequently started, they are set to the
41639 appropriate values for the outgoing connection, and these are the values that
41640 are in force when any authenticators are run and when the
41641 <option>authenticated_sender</option> option is expanded.
41644 <section id="SECID146">
41645 <title>Private options for smtp</title>
41647 <indexterm role="concept">
41648 <primary>options</primary>
41649 <secondary><command>smtp</command> transport</secondary>
41651 The private options of the <command>smtp</command> transport are as follows:
41654 <indexterm role="option">
41655 <primary><option>address_retry_include_sender</option></primary>
41658 <informaltable frame="all">
41659 <tgroup cols="4" colsep="0" rowsep="0">
41660 <colspec colwidth="8*" align="left"/>
41661 <colspec colwidth="6*" align="center"/>
41662 <colspec colwidth="6*" align="center"/>
41663 <colspec colwidth="6*" align="right"/>
41666 <entry><option>address_retry_include_sender</option></entry>
41667 <entry>Use: <emphasis>smtp</emphasis></entry>
41668 <entry>Type: <emphasis>boolean</emphasis></entry>
41669 <entry>Default: <emphasis>true</emphasis></entry>
41675 <indexterm role="concept">
41676 <primary>4<emphasis>xx</emphasis> responses</primary>
41677 <secondary>retrying after</secondary>
41679 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
41680 is the combination of sender and recipient that is delayed in subsequent queue
41681 runs until the retry time is reached. You can delay the recipient without
41682 reference to the sender (which is what earlier versions of Exim did), by
41683 setting <option>address_retry_include_sender</option> false. However, this can lead to
41684 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
41687 <indexterm role="option">
41688 <primary><option>allow_localhost</option></primary>
41691 <informaltable frame="all">
41692 <tgroup cols="4" colsep="0" rowsep="0">
41693 <colspec colwidth="8*" align="left"/>
41694 <colspec colwidth="6*" align="center"/>
41695 <colspec colwidth="6*" align="center"/>
41696 <colspec colwidth="6*" align="right"/>
41699 <entry><option>allow_localhost</option></entry>
41700 <entry>Use: <emphasis>smtp</emphasis></entry>
41701 <entry>Type: <emphasis>boolean</emphasis></entry>
41702 <entry>Default: <emphasis>false</emphasis></entry>
41708 <indexterm role="concept">
41709 <primary>local host</primary>
41710 <secondary>sending to</secondary>
41712 <indexterm role="concept">
41713 <primary>fallback</primary>
41714 <secondary>hosts specified on transport</secondary>
41716 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
41717 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
41718 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
41719 the delivery anyway. This should be used only in special cases when the
41720 configuration ensures that no looping will result (for example, a differently
41721 configured Exim is listening on the port to which the message is sent).
41724 <indexterm role="option">
41725 <primary><option>authenticated_sender</option></primary>
41728 <informaltable frame="all">
41729 <tgroup cols="4" colsep="0" rowsep="0">
41730 <colspec colwidth="8*" align="left"/>
41731 <colspec colwidth="6*" align="center"/>
41732 <colspec colwidth="6*" align="center"/>
41733 <colspec colwidth="6*" align="right"/>
41736 <entry><option>authenticated_sender</option></entry>
41737 <entry>Use: <emphasis>smtp</emphasis></entry>
41738 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
41739 <entry>Default: <emphasis>unset</emphasis></entry>
41745 <indexterm role="concept">
41746 <primary>Cyrus</primary>
41748 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
41749 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
41750 overriding any existing authenticated sender value. If the string expansion is
41751 forced to fail, the option is ignored. Other expansion failures cause delivery
41752 to be deferred. If the result of expansion is an empty string, that is also
41756 The expansion happens after the outgoing connection has been made and TLS
41757 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
41758 <varname>$tls_cipher</varname>, and <varname>$tls_peerdn</varname> variables are set according to the
41759 particular connection.
41762 If the SMTP session is not authenticated, the expansion of
41763 <option>authenticated_sender</option> still happens (and can cause the delivery to be
41764 deferred if it fails), but no AUTH= item is added to MAIL commands
41765 unless <option>authenticated_sender_force</option> is true.
41768 This option allows you to use the <command>smtp</command> transport in LMTP mode to
41769 deliver mail to Cyrus IMAP and provide the proper local part as the
41770 <quote>authenticated sender</quote>, via a setting such as:
41772 <literallayout class="monospaced">
41773 authenticated_sender = $local_part
41776 This removes the need for IMAP subfolders to be assigned special ACLs to
41777 allow direct delivery to those subfolders.
41780 Because of expected uses such as that just described for Cyrus (when no
41781 domain is involved), there is no checking on the syntax of the provided
41785 <indexterm role="option">
41786 <primary><option>authenticated_sender_force</option></primary>
41789 <informaltable frame="all">
41790 <tgroup cols="4" colsep="0" rowsep="0">
41791 <colspec colwidth="8*" align="left"/>
41792 <colspec colwidth="6*" align="center"/>
41793 <colspec colwidth="6*" align="center"/>
41794 <colspec colwidth="6*" align="right"/>
41797 <entry><option>authenticated_sender_force</option></entry>
41798 <entry>Use: <emphasis>smtp</emphasis></entry>
41799 <entry>Type: <emphasis>boolean</emphasis></entry>
41800 <entry>Default: <emphasis>false</emphasis></entry>
41806 If this option is set true, the <option>authenticated_sender</option> option’s value
41807 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
41808 authenticated as a client.
41811 <indexterm role="option">
41812 <primary><option>command_timeout</option></primary>
41815 <informaltable frame="all">
41816 <tgroup cols="4" colsep="0" rowsep="0">
41817 <colspec colwidth="8*" align="left"/>
41818 <colspec colwidth="6*" align="center"/>
41819 <colspec colwidth="6*" align="center"/>
41820 <colspec colwidth="6*" align="right"/>
41823 <entry><option>command_timeout</option></entry>
41824 <entry>Use: <emphasis>smtp</emphasis></entry>
41825 <entry>Type: <emphasis>time</emphasis></entry>
41826 <entry>Default: <emphasis>5m</emphasis></entry>
41832 This sets a timeout for receiving a response to an SMTP command that has been
41833 sent out. It is also used when waiting for the initial banner line from the
41834 remote host. Its value must not be zero.
41837 <indexterm role="option">
41838 <primary><option>connect_timeout</option></primary>
41841 <informaltable frame="all">
41842 <tgroup cols="4" colsep="0" rowsep="0">
41843 <colspec colwidth="8*" align="left"/>
41844 <colspec colwidth="6*" align="center"/>
41845 <colspec colwidth="6*" align="center"/>
41846 <colspec colwidth="6*" align="right"/>
41849 <entry><option>connect_timeout</option></entry>
41850 <entry>Use: <emphasis>smtp</emphasis></entry>
41851 <entry>Type: <emphasis>time</emphasis></entry>
41852 <entry>Default: <emphasis>5m</emphasis></entry>
41858 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
41859 to a remote host. A setting of zero allows the system timeout (typically
41860 several minutes) to act. To have any effect, the value of this option must be
41861 less than the system timeout. However, it has been observed that on some
41862 systems there is no system timeout, which is why the default value for this
41863 option is 5 minutes, a value recommended by RFC 1123.
41866 <indexterm role="option">
41867 <primary><option>connection_max_messages</option></primary>
41870 <informaltable frame="all">
41871 <tgroup cols="4" colsep="0" rowsep="0">
41872 <colspec colwidth="8*" align="left"/>
41873 <colspec colwidth="6*" align="center"/>
41874 <colspec colwidth="6*" align="center"/>
41875 <colspec colwidth="6*" align="right"/>
41878 <entry><option>connection_max_messages</option></entry>
41879 <entry>Use: <emphasis>smtp</emphasis></entry>
41880 <entry>Type: <emphasis>integer</emphasis></entry>
41881 <entry>Default: <emphasis>500</emphasis></entry>
41887 <indexterm role="concept">
41888 <primary>SMTP</primary>
41889 <secondary>passed connection</secondary>
41891 <indexterm role="concept">
41892 <primary>SMTP</primary>
41893 <secondary>multiple deliveries</secondary>
41895 <indexterm role="concept">
41896 <primary>multiple SMTP deliveries</primary>
41898 This controls the maximum number of separate message deliveries that are sent
41899 over a single TCP/IP connection. If the value is zero, there is no limit.
41900 For testing purposes, this value can be overridden by the <option>-oB</option> command line
41904 <indexterm role="option">
41905 <primary><option>data_timeout</option></primary>
41908 <informaltable frame="all">
41909 <tgroup cols="4" colsep="0" rowsep="0">
41910 <colspec colwidth="8*" align="left"/>
41911 <colspec colwidth="6*" align="center"/>
41912 <colspec colwidth="6*" align="center"/>
41913 <colspec colwidth="6*" align="right"/>
41916 <entry><option>data_timeout</option></entry>
41917 <entry>Use: <emphasis>smtp</emphasis></entry>
41918 <entry>Type: <emphasis>time</emphasis></entry>
41919 <entry>Default: <emphasis>5m</emphasis></entry>
41925 This sets a timeout for the transmission of each block in the data portion of
41926 the message. As a result, the overall timeout for a message depends on the size
41927 of the message. Its value must not be zero. See also <option>final_timeout</option>.
41930 <indexterm role="option">
41931 <primary><option>delay_after_cutoff</option></primary>
41934 <informaltable frame="all">
41935 <tgroup cols="4" colsep="0" rowsep="0">
41936 <colspec colwidth="8*" align="left"/>
41937 <colspec colwidth="6*" align="center"/>
41938 <colspec colwidth="6*" align="center"/>
41939 <colspec colwidth="6*" align="right"/>
41942 <entry><option>delay_after_cutoff</option></entry>
41943 <entry>Use: <emphasis>smtp</emphasis></entry>
41944 <entry>Type: <emphasis>boolean</emphasis></entry>
41945 <entry>Default: <emphasis>true</emphasis></entry>
41951 This option controls what happens when all remote IP addresses for a given
41952 domain have been inaccessible for so long that they have passed their retry
41956 In the default state, if the next retry time has not been reached for any of
41957 them, the address is bounced without trying any deliveries. In other words,
41958 Exim delays retrying an IP address after the final cutoff time until a new
41959 retry time is reached, and can therefore bounce an address without ever trying
41960 a delivery, when machines have been down for a long time. Some people are
41961 unhappy at this prospect, so...
41964 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
41965 addresses are past their final cutoff time, Exim tries to deliver to those
41966 IP addresses that have not been tried since the message arrived. If there are
41967 none, of if they all fail, the address is bounced. In other words, it does not
41968 delay when a new message arrives, but immediately tries those expired IP
41969 addresses that haven’t been tried since the message arrived. If there is a
41970 continuous stream of messages for the dead hosts, unsetting
41971 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
41975 <indexterm role="option">
41976 <primary><option>dns_qualify_single</option></primary>
41979 <informaltable frame="all">
41980 <tgroup cols="4" colsep="0" rowsep="0">
41981 <colspec colwidth="8*" align="left"/>
41982 <colspec colwidth="6*" align="center"/>
41983 <colspec colwidth="6*" align="center"/>
41984 <colspec colwidth="6*" align="right"/>
41987 <entry><option>dns_qualify_single</option></entry>
41988 <entry>Use: <emphasis>smtp</emphasis></entry>
41989 <entry>Type: <emphasis>boolean</emphasis></entry>
41990 <entry>Default: <emphasis>true</emphasis></entry>
41996 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
41997 and the <option>gethostbyname</option> option is false,
41998 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
41999 in chapter <xref linkend="CHAPdnslookup"/> for more details.
42002 <indexterm role="option">
42003 <primary><option>dns_search_parents</option></primary>
42006 <informaltable frame="all">
42007 <tgroup cols="4" colsep="0" rowsep="0">
42008 <colspec colwidth="8*" align="left"/>
42009 <colspec colwidth="6*" align="center"/>
42010 <colspec colwidth="6*" align="center"/>
42011 <colspec colwidth="6*" align="right"/>
42014 <entry><option>dns_search_parents</option></entry>
42015 <entry>Use: <emphasis>smtp</emphasis></entry>
42016 <entry>Type: <emphasis>boolean</emphasis></entry>
42017 <entry>Default: <emphasis>false</emphasis></entry>
42023 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
42024 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
42025 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
42029 <indexterm role="option">
42030 <primary><option>fallback_hosts</option></primary>
42033 <informaltable frame="all">
42034 <tgroup cols="4" colsep="0" rowsep="0">
42035 <colspec colwidth="8*" align="left"/>
42036 <colspec colwidth="6*" align="center"/>
42037 <colspec colwidth="6*" align="center"/>
42038 <colspec colwidth="6*" align="right"/>
42041 <entry><option>fallback_hosts</option></entry>
42042 <entry>Use: <emphasis>smtp</emphasis></entry>
42043 <entry>Type: <emphasis>string list</emphasis></entry>
42044 <entry>Default: <emphasis>unset</emphasis></entry>
42050 <indexterm role="concept">
42051 <primary>fallback</primary>
42052 <secondary>hosts specified on transport</secondary>
42054 String expansion is not applied to this option. The argument must be a
42055 colon-separated list of host names or IP addresses, optionally also including
42056 port numbers, though the separator can be changed, as described in section
42057 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42058 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42059 in section <xref linkend="SECTformatonehostitem"/>.
42062 Fallback hosts can also be specified on routers, which associate them with the
42063 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
42064 <option>fallback_hosts</option> specified on the transport is used only if the address does
42065 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
42066 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
42067 However, <option>hosts_randomize</option> does apply to fallback host lists.
42070 If Exim is unable to deliver to any of the hosts for a particular address, and
42071 the errors are not permanent rejections, the address is put on a separate
42072 transport queue with its host list replaced by the fallback hosts, unless the
42073 address was routed via MX records and the current host was in the original MX
42074 list. In that situation, the fallback host list is not used.
42077 Once normal deliveries are complete, the fallback queue is delivered by
42078 re-running the same transports with the new host lists. If several failing
42079 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
42080 copy of the message is sent.
42083 The resolution of the host names on the fallback list is controlled by the
42084 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
42085 both to cases when the host list comes with the address and when it is taken
42086 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
42087 fails</quote> facility.
42090 <indexterm role="option">
42091 <primary><option>final_timeout</option></primary>
42094 <informaltable frame="all">
42095 <tgroup cols="4" colsep="0" rowsep="0">
42096 <colspec colwidth="8*" align="left"/>
42097 <colspec colwidth="6*" align="center"/>
42098 <colspec colwidth="6*" align="center"/>
42099 <colspec colwidth="6*" align="right"/>
42102 <entry><option>final_timeout</option></entry>
42103 <entry>Use: <emphasis>smtp</emphasis></entry>
42104 <entry>Type: <emphasis>time</emphasis></entry>
42105 <entry>Default: <emphasis>10m</emphasis></entry>
42111 This is the timeout that applies while waiting for the response to the final
42112 line containing just <quote>.</quote> that terminates a message. Its value must not be
42116 <indexterm role="option">
42117 <primary><option>gethostbyname</option></primary>
42120 <informaltable frame="all">
42121 <tgroup cols="4" colsep="0" rowsep="0">
42122 <colspec colwidth="8*" align="left"/>
42123 <colspec colwidth="6*" align="center"/>
42124 <colspec colwidth="6*" align="center"/>
42125 <colspec colwidth="6*" align="right"/>
42128 <entry><option>gethostbyname</option></entry>
42129 <entry>Use: <emphasis>smtp</emphasis></entry>
42130 <entry>Type: <emphasis>boolean</emphasis></entry>
42131 <entry>Default: <emphasis>false</emphasis></entry>
42137 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
42138 being used, names are looked up using <function>gethostbyname()</function>
42139 (or <function>getipnodebyname()</function> when available)
42140 instead of using the DNS. Of course, that function may in fact use the DNS, but
42141 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
42144 <indexterm role="option">
42145 <primary><option>gnutls_require_kx</option></primary>
42148 <informaltable frame="all">
42149 <tgroup cols="4" colsep="0" rowsep="0">
42150 <colspec colwidth="8*" align="left"/>
42151 <colspec colwidth="6*" align="center"/>
42152 <colspec colwidth="6*" align="center"/>
42153 <colspec colwidth="6*" align="right"/>
42156 <entry><option>gnutls_require_kx</option></entry>
42157 <entry>Use: <emphasis>smtp</emphasis></entry>
42158 <entry>Type: <emphasis>string</emphasis></entry>
42159 <entry>Default: <emphasis>unset</emphasis></entry>
42165 This option controls the key exchange mechanisms when GnuTLS is used in an Exim
42166 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42169 <indexterm role="option">
42170 <primary><option>gnutls_require_mac</option></primary>
42173 <informaltable frame="all">
42174 <tgroup cols="4" colsep="0" rowsep="0">
42175 <colspec colwidth="8*" align="left"/>
42176 <colspec colwidth="6*" align="center"/>
42177 <colspec colwidth="6*" align="center"/>
42178 <colspec colwidth="6*" align="right"/>
42181 <entry><option>gnutls_require_mac</option></entry>
42182 <entry>Use: <emphasis>smtp</emphasis></entry>
42183 <entry>Type: <emphasis>string</emphasis></entry>
42184 <entry>Default: <emphasis>unset</emphasis></entry>
42190 This option controls the MAC algorithms when GnuTLS is used in an Exim
42191 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42194 <indexterm role="option">
42195 <primary><option>gnutls_require_protocols</option></primary>
42198 <informaltable frame="all">
42199 <tgroup cols="4" colsep="0" rowsep="0">
42200 <colspec colwidth="8*" align="left"/>
42201 <colspec colwidth="6*" align="center"/>
42202 <colspec colwidth="6*" align="center"/>
42203 <colspec colwidth="6*" align="right"/>
42206 <entry><option>gnutls_require_protocols</option></entry>
42207 <entry>Use: <emphasis>smtp</emphasis></entry>
42208 <entry>Type: <emphasis>string</emphasis></entry>
42209 <entry>Default: <emphasis>unset</emphasis></entry>
42215 This option controls the protocols when GnuTLS is used in an Exim
42216 client. For details, see section <xref linkend="SECTreqciphgnu"/>.
42219 <indexterm role="option">
42220 <primary><option>gnutls_compat_mode</option></primary>
42223 <informaltable frame="all">
42224 <tgroup cols="4" colsep="0" rowsep="0">
42225 <colspec colwidth="8*" align="left"/>
42226 <colspec colwidth="6*" align="center"/>
42227 <colspec colwidth="6*" align="center"/>
42228 <colspec colwidth="6*" align="right"/>
42231 <entry><option>gnutls_compat_mode</option></entry>
42232 <entry>Use: <emphasis>smtp</emphasis></entry>
42233 <entry>Type: <emphasis>boolean</emphasis></entry>
42234 <entry>Default: <emphasis>unset</emphasis></entry>
42240 This option controls whether GnuTLS is used in compatibility mode in an Exim
42241 server. This reduces security slightly, but improves interworking with older
42242 implementations of TLS.
42245 <indexterm role="option">
42246 <primary><option>helo_data</option></primary>
42249 <informaltable frame="all">
42250 <tgroup cols="4" colsep="0" rowsep="0">
42251 <colspec colwidth="8*" align="left"/>
42252 <colspec colwidth="6*" align="center"/>
42253 <colspec colwidth="6*" align="center"/>
42254 <colspec colwidth="6*" align="right"/>
42257 <entry><option>helo_data</option></entry>
42258 <entry>Use: <emphasis>smtp</emphasis></entry>
42259 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42260 <entry>Default: <emphasis>see below</emphasis></entry>
42266 <indexterm role="concept">
42267 <primary>HELO</primary>
42268 <secondary>argument, setting</secondary>
42270 <indexterm role="concept">
42271 <primary>EHLO</primary>
42272 <secondary>argument, setting</secondary>
42274 <indexterm role="concept">
42275 <primary>LHLO argument setting</primary>
42277 The value of this option is expanded after a connection to a another host has
42278 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
42279 command that starts the outgoing SMTP or LMTP session. The default value of the
42282 <literallayout class="monospaced">
42286 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
42287 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
42288 <varname>$sending_port</varname> are set to the local IP address and port number that are being
42289 used. These variables can be used to generate different values for different
42290 servers or different local IP addresses. For example, if you want the string
42291 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
42292 interface address, you could use this:
42294 <literallayout class="monospaced">
42295 helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
42296 {$primary_hostname}}
42299 The use of <option>helo_data</option> applies both to sending messages and when doing
42303 <indexterm role="option">
42304 <primary><option>hosts</option></primary>
42307 <informaltable frame="all">
42308 <tgroup cols="4" colsep="0" rowsep="0">
42309 <colspec colwidth="8*" align="left"/>
42310 <colspec colwidth="6*" align="center"/>
42311 <colspec colwidth="6*" align="center"/>
42312 <colspec colwidth="6*" align="right"/>
42315 <entry><option>hosts</option></entry>
42316 <entry>Use: <emphasis>smtp</emphasis></entry>
42317 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42318 <entry>Default: <emphasis>unset</emphasis></entry>
42324 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
42325 finds the hosts by looking up the address domain in the DNS, or by
42326 <command>manualroute</command>, which has lists of hosts in its configuration. However,
42327 email addresses can be passed to the <command>smtp</command> transport by any router, and not
42328 all of them can provide an associated list of hosts.
42331 The <option>hosts</option> option specifies a list of hosts to be used if the address being
42332 processed does not have any hosts associated with it. The hosts specified by
42333 <option>hosts</option> are also used, whether or not the address has its own hosts, if
42334 <option>hosts_override</option> is set.
42337 The string is first expanded, before being interpreted as a colon-separated
42338 list of host names or IP addresses, possibly including port numbers. The
42339 separator may be changed to something other than colon, as described in section
42340 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
42341 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
42342 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
42343 of the <command>manualroute</command> router is not available here.
42346 If the expansion fails, delivery is deferred. Unless the failure was caused by
42347 the inability to complete a lookup, the error is logged to the panic log as
42348 well as the main log. Host names are looked up either by searching directly for
42349 address records in the DNS or by calling <function>gethostbyname()</function> (or
42350 <function>getipnodebyname()</function> when available), depending on the setting of the
42351 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
42352 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
42356 During delivery, the hosts are tried in order, subject to their retry status,
42357 unless <option>hosts_randomize</option> is set.
42360 <indexterm role="option">
42361 <primary><option>hosts_avoid_esmtp</option></primary>
42364 <informaltable frame="all">
42365 <tgroup cols="4" colsep="0" rowsep="0">
42366 <colspec colwidth="8*" align="left"/>
42367 <colspec colwidth="6*" align="center"/>
42368 <colspec colwidth="6*" align="center"/>
42369 <colspec colwidth="6*" align="right"/>
42372 <entry><option>hosts_avoid_esmtp</option></entry>
42373 <entry>Use: <emphasis>smtp</emphasis></entry>
42374 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42375 <entry>Default: <emphasis>unset</emphasis></entry>
42381 <indexterm role="concept">
42382 <primary>ESMTP, avoiding use of</primary>
42384 <indexterm role="concept">
42385 <primary>HELO</primary>
42386 <secondary>forcing use of</secondary>
42388 <indexterm role="concept">
42389 <primary>EHLO</primary>
42390 <secondary>avoiding use of</secondary>
42392 <indexterm role="concept">
42393 <primary>PIPELINING</primary>
42394 <secondary>avoiding the use of</secondary>
42396 This option is for use with broken hosts that announce ESMTP facilities (for
42397 example, PIPELINING) and then fail to implement them properly. When a host
42398 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
42399 start of the SMTP session. This means that it cannot use any of the ESMTP
42400 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
42403 <indexterm role="option">
42404 <primary><option>hosts_avoid_pipelining</option></primary>
42407 <informaltable frame="all">
42408 <tgroup cols="4" colsep="0" rowsep="0">
42409 <colspec colwidth="8*" align="left"/>
42410 <colspec colwidth="6*" align="center"/>
42411 <colspec colwidth="6*" align="center"/>
42412 <colspec colwidth="6*" align="right"/>
42415 <entry><option>hosts_avoid_pipelining</option></entry>
42416 <entry>Use: <emphasis>smtp</emphasis></entry>
42417 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42418 <entry>Default: <emphasis>unset</emphasis></entry>
42424 <indexterm role="concept">
42425 <primary>PIPELINING</primary>
42426 <secondary>avoiding the use of</secondary>
42428 Exim will not use the SMTP PIPELINING extension when delivering to any host
42429 that matches this list, even if the server host advertises PIPELINING support.
42432 <indexterm role="option">
42433 <primary><option>hosts_avoid_tls</option></primary>
42436 <informaltable frame="all">
42437 <tgroup cols="4" colsep="0" rowsep="0">
42438 <colspec colwidth="8*" align="left"/>
42439 <colspec colwidth="6*" align="center"/>
42440 <colspec colwidth="6*" align="center"/>
42441 <colspec colwidth="6*" align="right"/>
42444 <entry><option>hosts_avoid_tls</option></entry>
42445 <entry>Use: <emphasis>smtp</emphasis></entry>
42446 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42447 <entry>Default: <emphasis>unset</emphasis></entry>
42453 <indexterm role="concept">
42454 <primary>TLS</primary>
42455 <secondary>avoiding for certain hosts</secondary>
42457 Exim will not try to start a TLS session when delivering to any host that
42458 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42461 <indexterm role="option">
42462 <primary><option>hosts_max_try</option></primary>
42465 <informaltable frame="all">
42466 <tgroup cols="4" colsep="0" rowsep="0">
42467 <colspec colwidth="8*" align="left"/>
42468 <colspec colwidth="6*" align="center"/>
42469 <colspec colwidth="6*" align="center"/>
42470 <colspec colwidth="6*" align="right"/>
42473 <entry><option>hosts_max_try</option></entry>
42474 <entry>Use: <emphasis>smtp</emphasis></entry>
42475 <entry>Type: <emphasis>integer</emphasis></entry>
42476 <entry>Default: <emphasis>5</emphasis></entry>
42482 <indexterm role="concept">
42483 <primary>host</primary>
42484 <secondary>maximum number to try</secondary>
42486 <indexterm role="concept">
42487 <primary>limit</primary>
42488 <secondary>number of hosts tried</secondary>
42490 <indexterm role="concept">
42491 <primary>limit</primary>
42492 <secondary>number of MX tried</secondary>
42494 <indexterm role="concept">
42495 <primary>MX record</primary>
42496 <secondary>maximum tried</secondary>
42498 This option limits the number of IP addresses that are tried for any one
42499 delivery in cases where there are temporary delivery errors. Section
42500 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
42503 <indexterm role="option">
42504 <primary><option>hosts_max_try_hardlimit</option></primary>
42507 <informaltable frame="all">
42508 <tgroup cols="4" colsep="0" rowsep="0">
42509 <colspec colwidth="8*" align="left"/>
42510 <colspec colwidth="6*" align="center"/>
42511 <colspec colwidth="6*" align="center"/>
42512 <colspec colwidth="6*" align="right"/>
42515 <entry><option>hosts_max_try_hardlimit</option></entry>
42516 <entry>Use: <emphasis>smtp</emphasis></entry>
42517 <entry>Type: <emphasis>integer</emphasis></entry>
42518 <entry>Default: <emphasis>50</emphasis></entry>
42524 This is an additional check on the maximum number of IP addresses that Exim
42525 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
42529 <indexterm role="option">
42530 <primary><option>hosts_nopass_tls</option></primary>
42533 <informaltable frame="all">
42534 <tgroup cols="4" colsep="0" rowsep="0">
42535 <colspec colwidth="8*" align="left"/>
42536 <colspec colwidth="6*" align="center"/>
42537 <colspec colwidth="6*" align="center"/>
42538 <colspec colwidth="6*" align="right"/>
42541 <entry><option>hosts_nopass_tls</option></entry>
42542 <entry>Use: <emphasis>smtp</emphasis></entry>
42543 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42544 <entry>Default: <emphasis>unset</emphasis></entry>
42550 <indexterm role="concept">
42551 <primary>TLS</primary>
42552 <secondary>passing connection</secondary>
42554 <indexterm role="concept">
42555 <primary>multiple SMTP deliveries</primary>
42557 <indexterm role="concept">
42558 <primary>TLS</primary>
42559 <secondary>multiple message deliveries</secondary>
42561 For any host that matches this list, a connection on which a TLS session has
42562 been started will not be passed to a new delivery process for sending another
42563 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
42564 explanation of when this might be needed.
42567 <indexterm role="option">
42568 <primary><option>hosts_override</option></primary>
42571 <informaltable frame="all">
42572 <tgroup cols="4" colsep="0" rowsep="0">
42573 <colspec colwidth="8*" align="left"/>
42574 <colspec colwidth="6*" align="center"/>
42575 <colspec colwidth="6*" align="center"/>
42576 <colspec colwidth="6*" align="right"/>
42579 <entry><option>hosts_override</option></entry>
42580 <entry>Use: <emphasis>smtp</emphasis></entry>
42581 <entry>Type: <emphasis>boolean</emphasis></entry>
42582 <entry>Default: <emphasis>false</emphasis></entry>
42588 If this option is set and the <option>hosts</option> option is also set, any hosts that are
42589 attached to the address are ignored, and instead the hosts specified by the
42590 <option>hosts</option> option are always used. This option does not apply to
42591 <option>fallback_hosts</option>.
42594 <indexterm role="option">
42595 <primary><option>hosts_randomize</option></primary>
42598 <informaltable frame="all">
42599 <tgroup cols="4" colsep="0" rowsep="0">
42600 <colspec colwidth="8*" align="left"/>
42601 <colspec colwidth="6*" align="center"/>
42602 <colspec colwidth="6*" align="center"/>
42603 <colspec colwidth="6*" align="right"/>
42606 <entry><option>hosts_randomize</option></entry>
42607 <entry>Use: <emphasis>smtp</emphasis></entry>
42608 <entry>Type: <emphasis>boolean</emphasis></entry>
42609 <entry>Default: <emphasis>false</emphasis></entry>
42615 <indexterm role="concept">
42616 <primary>randomized host list</primary>
42618 <indexterm role="concept">
42619 <primary>host</primary>
42620 <secondary>list of; randomized</secondary>
42622 <indexterm role="concept">
42623 <primary>fallback</primary>
42624 <secondary>randomized hosts</secondary>
42626 If this option is set, and either the list of hosts is taken from the
42627 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
42628 were not obtained from MX records (this includes fallback hosts from the
42629 router), and were not randomized by the router, the order of trying the hosts
42630 is randomized each time the transport runs. Randomizing the order of a host
42631 list can be used to do crude load sharing.
42634 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
42635 order is separately randomized. This makes it possible to set up MX-like
42636 behaviour. The boundaries between groups are indicated by an item that is just
42637 <literal>+</literal> in the host list. For example:
42639 <literallayout class="monospaced">
42640 hosts = host1:host2:host3:+:host4:host5
42643 The order of the first three hosts and the order of the last two hosts is
42644 randomized for each use, but the first three always end up before the last two.
42645 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
42648 <indexterm role="option">
42649 <primary><option>hosts_require_auth</option></primary>
42652 <informaltable frame="all">
42653 <tgroup cols="4" colsep="0" rowsep="0">
42654 <colspec colwidth="8*" align="left"/>
42655 <colspec colwidth="6*" align="center"/>
42656 <colspec colwidth="6*" align="center"/>
42657 <colspec colwidth="6*" align="right"/>
42660 <entry><option>hosts_require_auth</option></entry>
42661 <entry>Use: <emphasis>smtp</emphasis></entry>
42662 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42663 <entry>Default: <emphasis>unset</emphasis></entry>
42669 <indexterm role="concept">
42670 <primary>authentication</primary>
42671 <secondary>required by client</secondary>
42673 This option provides a list of servers for which authentication must succeed
42674 before Exim will try to transfer a message. If authentication fails for
42675 servers which are not in this list, Exim tries to send unauthenticated. If
42676 authentication fails for one of these servers, delivery is deferred. This
42677 temporary error is detectable in the retry rules, so it can be turned into a
42678 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
42679 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42682 <indexterm role="option">
42683 <primary><option>hosts_require_tls</option></primary>
42686 <informaltable frame="all">
42687 <tgroup cols="4" colsep="0" rowsep="0">
42688 <colspec colwidth="8*" align="left"/>
42689 <colspec colwidth="6*" align="center"/>
42690 <colspec colwidth="6*" align="center"/>
42691 <colspec colwidth="6*" align="right"/>
42694 <entry><option>hosts_require_tls</option></entry>
42695 <entry>Use: <emphasis>smtp</emphasis></entry>
42696 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42697 <entry>Default: <emphasis>unset</emphasis></entry>
42703 <indexterm role="concept">
42704 <primary>TLS</primary>
42705 <secondary>requiring for certain servers</secondary>
42707 Exim will insist on using a TLS session when delivering to any host that
42708 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42709 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
42710 incoming messages, use an appropriate ACL.
42713 <indexterm role="option">
42714 <primary><option>hosts_try_auth</option></primary>
42717 <informaltable frame="all">
42718 <tgroup cols="4" colsep="0" rowsep="0">
42719 <colspec colwidth="8*" align="left"/>
42720 <colspec colwidth="6*" align="center"/>
42721 <colspec colwidth="6*" align="center"/>
42722 <colspec colwidth="6*" align="right"/>
42725 <entry><option>hosts_try_auth</option></entry>
42726 <entry>Use: <emphasis>smtp</emphasis></entry>
42727 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
42728 <entry>Default: <emphasis>unset</emphasis></entry>
42734 <indexterm role="concept">
42735 <primary>authentication</primary>
42736 <secondary>optional in client</secondary>
42738 This option provides a list of servers to which, provided they announce
42739 authentication support, Exim will attempt to authenticate as a client when it
42740 connects. If authentication fails, Exim will try to transfer the message
42741 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
42742 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
42745 <indexterm role="option">
42746 <primary><option>interface</option></primary>
42749 <informaltable frame="all">
42750 <tgroup cols="4" colsep="0" rowsep="0">
42751 <colspec colwidth="8*" align="left"/>
42752 <colspec colwidth="6*" align="center"/>
42753 <colspec colwidth="6*" align="center"/>
42754 <colspec colwidth="6*" align="right"/>
42757 <entry><option>interface</option></entry>
42758 <entry>Use: <emphasis>smtp</emphasis></entry>
42759 <entry>Type: <emphasis>string list</emphasis>†<emphasis></emphasis></entry>
42760 <entry>Default: <emphasis>unset</emphasis></entry>
42766 <indexterm role="concept">
42767 <primary>bind IP address</primary>
42769 <indexterm role="concept">
42770 <primary>IP address</primary>
42771 <secondary>binding</secondary>
42773 <indexterm role="variable">
42774 <primary><varname>$host</varname></primary>
42776 <indexterm role="variable">
42777 <primary><varname>$host_address</varname></primary>
42779 This option specifies which interface to bind to when making an outgoing SMTP
42780 call. The value is an IP address, not an interface name such as
42781 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
42782 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
42783 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
42784 outgoing interface address. There is no variable that contains an outgoing
42785 interface address because, unless it is set by this option, its value is
42789 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
42790 <varname>$host_address</varname> refer to the host to which a connection is about to be made
42791 during the expansion of the string. Forced expansion failure, or an empty
42792 string result causes the option to be ignored. Otherwise, after expansion, the
42793 string must be a list of IP addresses, colon-separated by default, but the
42794 separator can be changed in the usual way. For example:
42796 <literallayout class="monospaced">
42797 interface = <; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
42800 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
42801 connection. If none of them are the correct type, the option is ignored. If
42802 <option>interface</option> is not set, or is ignored, the system’s IP functions choose which
42803 interface to use if the host has more than one.
42806 <indexterm role="option">
42807 <primary><option>keepalive</option></primary>
42810 <informaltable frame="all">
42811 <tgroup cols="4" colsep="0" rowsep="0">
42812 <colspec colwidth="8*" align="left"/>
42813 <colspec colwidth="6*" align="center"/>
42814 <colspec colwidth="6*" align="center"/>
42815 <colspec colwidth="6*" align="right"/>
42818 <entry><option>keepalive</option></entry>
42819 <entry>Use: <emphasis>smtp</emphasis></entry>
42820 <entry>Type: <emphasis>boolean</emphasis></entry>
42821 <entry>Default: <emphasis>true</emphasis></entry>
42827 <indexterm role="concept">
42828 <primary>keepalive</primary>
42829 <secondary>on outgoing connection</secondary>
42831 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
42832 connections. When set, it causes the kernel to probe idle connections
42833 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
42834 of the connection should send a acknowledgment if the connection is still okay
42835 or a reset if the connection has been aborted. The reason for doing this is
42836 that it has the beneficial effect of freeing up certain types of connection
42837 that can get stuck when the remote host is disconnected without tidying up the
42838 TCP/IP call properly. The keepalive mechanism takes several hours to detect
42842 <indexterm role="option">
42843 <primary><option>lmtp_ignore_quota</option></primary>
42846 <informaltable frame="all">
42847 <tgroup cols="4" colsep="0" rowsep="0">
42848 <colspec colwidth="8*" align="left"/>
42849 <colspec colwidth="6*" align="center"/>
42850 <colspec colwidth="6*" align="center"/>
42851 <colspec colwidth="6*" align="right"/>
42854 <entry><option>lmtp_ignore_quota</option></entry>
42855 <entry>Use: <emphasis>smtp</emphasis></entry>
42856 <entry>Type: <emphasis>boolean</emphasis></entry>
42857 <entry>Default: <emphasis>false</emphasis></entry>
42863 <indexterm role="concept">
42864 <primary>LMTP</primary>
42865 <secondary>ignoring quota errors</secondary>
42867 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
42868 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
42869 has advertised support for IGNOREQUOTA in its response to the LHLO command.
42872 <indexterm role="option">
42873 <primary><option>max_rcpt</option></primary>
42876 <informaltable frame="all">
42877 <tgroup cols="4" colsep="0" rowsep="0">
42878 <colspec colwidth="8*" align="left"/>
42879 <colspec colwidth="6*" align="center"/>
42880 <colspec colwidth="6*" align="center"/>
42881 <colspec colwidth="6*" align="right"/>
42884 <entry><option>max_rcpt</option></entry>
42885 <entry>Use: <emphasis>smtp</emphasis></entry>
42886 <entry>Type: <emphasis>integer</emphasis></entry>
42887 <entry>Default: <emphasis>100</emphasis></entry>
42893 <indexterm role="concept">
42894 <primary>RCPT</primary>
42895 <secondary>maximum number of outgoing</secondary>
42897 This option limits the number of RCPT commands that are sent in a single
42898 SMTP message transaction. Each set of addresses is treated independently, and
42899 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
42903 <indexterm role="option">
42904 <primary><option>multi_domain</option></primary>
42907 <informaltable frame="all">
42908 <tgroup cols="4" colsep="0" rowsep="0">
42909 <colspec colwidth="8*" align="left"/>
42910 <colspec colwidth="6*" align="center"/>
42911 <colspec colwidth="6*" align="center"/>
42912 <colspec colwidth="6*" align="right"/>
42915 <entry><option>multi_domain</option></entry>
42916 <entry>Use: <emphasis>smtp</emphasis></entry>
42917 <entry>Type: <emphasis>boolean</emphasis></entry>
42918 <entry>Default: <emphasis>true</emphasis></entry>
42924 <indexterm role="variable">
42925 <primary><varname>$domain</varname></primary>
42927 When this option is set, the <command>smtp</command> transport can handle a number of
42928 addresses containing a mixture of different domains provided they all resolve
42929 to the same list of hosts. Turning the option off restricts the transport to
42930 handling only one domain at a time. This is useful if you want to use
42931 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
42932 is a single domain involved in a remote delivery.
42935 <indexterm role="option">
42936 <primary><option>port</option></primary>
42939 <informaltable frame="all">
42940 <tgroup cols="4" colsep="0" rowsep="0">
42941 <colspec colwidth="8*" align="left"/>
42942 <colspec colwidth="6*" align="center"/>
42943 <colspec colwidth="6*" align="center"/>
42944 <colspec colwidth="6*" align="right"/>
42947 <entry><option>port</option></entry>
42948 <entry>Use: <emphasis>smtp</emphasis></entry>
42949 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
42950 <entry>Default: <emphasis>see below</emphasis></entry>
42956 <indexterm role="concept">
42957 <primary>port</primary>
42958 <secondary>sending TCP/IP</secondary>
42960 <indexterm role="concept">
42961 <primary>TCP/IP</primary>
42962 <secondary>setting outgoing port</secondary>
42964 This option specifies the TCP/IP port on the server to which Exim connects.
42965 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
42966 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
42967 The name was changed to minimize confusion with the outgoing port. There is no
42968 variable that contains an outgoing port.
42971 If the value of this option begins with a digit it is taken as a port number;
42972 otherwise it is looked up using <function>getservbyname()</function>. The default value is
42973 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
42974 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
42978 <indexterm role="option">
42979 <primary><option>protocol</option></primary>
42982 <informaltable frame="all">
42983 <tgroup cols="4" colsep="0" rowsep="0">
42984 <colspec colwidth="8*" align="left"/>
42985 <colspec colwidth="6*" align="center"/>
42986 <colspec colwidth="6*" align="center"/>
42987 <colspec colwidth="6*" align="right"/>
42990 <entry><option>protocol</option></entry>
42991 <entry>Use: <emphasis>smtp</emphasis></entry>
42992 <entry>Type: <emphasis>string</emphasis></entry>
42993 <entry>Default: <emphasis>smtp</emphasis></entry>
42999 <indexterm role="concept">
43000 <primary>LMTP</primary>
43001 <secondary>over TCP/IP</secondary>
43003 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
43004 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
43005 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
43006 deliveries into closed message stores. Exim also has support for running LMTP
43007 over a pipe to a local process – see chapter <xref linkend="CHAPLMTP"/>.
43010 <indexterm role="option">
43011 <primary><option>retry_include_ip_address</option></primary>
43014 <informaltable frame="all">
43015 <tgroup cols="4" colsep="0" rowsep="0">
43016 <colspec colwidth="8*" align="left"/>
43017 <colspec colwidth="6*" align="center"/>
43018 <colspec colwidth="6*" align="center"/>
43019 <colspec colwidth="6*" align="right"/>
43022 <entry><option>retry_include_ip_address</option></entry>
43023 <entry>Use: <emphasis>smtp</emphasis></entry>
43024 <entry>Type: <emphasis>boolean</emphasis></entry>
43025 <entry>Default: <emphasis>true</emphasis></entry>
43031 Exim normally includes both the host name and the IP address in the key it
43032 constructs for indexing retry data after a temporary delivery failure. This
43033 means that when one of several IP addresses for a host is failing, it gets
43034 tried periodically (controlled by the retry rules), but use of the other IP
43035 addresses is not affected.
43038 However, in some dialup environments hosts are assigned a different IP address
43039 each time they connect. In this situation the use of the IP address as part of
43040 the retry key leads to undesirable behaviour. Setting this option false causes
43041 Exim to use only the host name. This should normally be done on a separate
43042 instance of the <command>smtp</command> transport, set up specially to handle the dialup
43046 <indexterm role="option">
43047 <primary><option>serialize_hosts</option></primary>
43050 <informaltable frame="all">
43051 <tgroup cols="4" colsep="0" rowsep="0">
43052 <colspec colwidth="8*" align="left"/>
43053 <colspec colwidth="6*" align="center"/>
43054 <colspec colwidth="6*" align="center"/>
43055 <colspec colwidth="6*" align="right"/>
43058 <entry><option>serialize_hosts</option></entry>
43059 <entry>Use: <emphasis>smtp</emphasis></entry>
43060 <entry>Type: <emphasis>host list</emphasis>†<emphasis></emphasis></entry>
43061 <entry>Default: <emphasis>unset</emphasis></entry>
43067 <indexterm role="concept">
43068 <primary>serializing connections</primary>
43070 <indexterm role="concept">
43071 <primary>host</primary>
43072 <secondary>serializing connections</secondary>
43074 Because Exim operates in a distributed manner, if several messages for the same
43075 host arrive at around the same time, more than one simultaneous connection to
43076 the remote host can occur. This is not usually a problem except when there is a
43077 slow link between the hosts. In that situation it may be helpful to restrict
43078 Exim to one connection at a time. This can be done by setting
43079 <option>serialize_hosts</option> to match the relevant hosts.
43082 <indexterm role="concept">
43083 <primary>hints database</primary>
43084 <secondary>serializing deliveries to a host</secondary>
43086 Exim implements serialization by means of a hints database in which a record is
43087 written whenever a process connects to one of the restricted hosts. The record
43088 is deleted when the connection is completed. Obviously there is scope for
43089 records to get left lying around if there is a system or program crash. To
43090 guard against this, Exim ignores any records that are more than six hours old.
43093 If you set up this kind of serialization, you should also arrange to delete the
43094 relevant hints database whenever your system reboots. The names of the files
43095 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43096 may be one or two files, depending on the type of DBM in use. The same files
43097 are used for ETRN serialization.
43100 <indexterm role="option">
43101 <primary><option>size_addition</option></primary>
43104 <informaltable frame="all">
43105 <tgroup cols="4" colsep="0" rowsep="0">
43106 <colspec colwidth="8*" align="left"/>
43107 <colspec colwidth="6*" align="center"/>
43108 <colspec colwidth="6*" align="center"/>
43109 <colspec colwidth="6*" align="right"/>
43112 <entry><option>size_addition</option></entry>
43113 <entry>Use: <emphasis>smtp</emphasis></entry>
43114 <entry>Type: <emphasis>integer</emphasis></entry>
43115 <entry>Default: <emphasis>1024</emphasis></entry>
43121 <indexterm role="concept">
43122 <primary>SMTP</primary>
43123 <secondary>SIZE</secondary>
43125 <indexterm role="concept">
43126 <primary>message</primary>
43127 <secondary>size issue for transport filter</secondary>
43129 <indexterm role="concept">
43130 <primary>size</primary>
43131 <secondary>of message</secondary>
43133 <indexterm role="concept">
43134 <primary>transport</primary>
43135 <secondary>filter</secondary>
43137 <indexterm role="concept">
43138 <primary>filter</primary>
43139 <secondary>transport filter</secondary>
43141 If a remote SMTP server indicates that it supports the SIZE option of the
43142 MAIL command, Exim uses this to pass over the message size at the start of
43143 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
43144 sends, to allow for headers and other text that may be added during delivery by
43145 configuration options or in a transport filter. It may be necessary to increase
43146 this if a lot of text is added to messages.
43149 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
43150 the use of the SIZE option altogether.
43153 <indexterm role="option">
43154 <primary><option>tls_certificate</option></primary>
43157 <informaltable frame="all">
43158 <tgroup cols="4" colsep="0" rowsep="0">
43159 <colspec colwidth="8*" align="left"/>
43160 <colspec colwidth="6*" align="center"/>
43161 <colspec colwidth="6*" align="center"/>
43162 <colspec colwidth="6*" align="right"/>
43165 <entry><option>tls_certificate</option></entry>
43166 <entry>Use: <emphasis>smtp</emphasis></entry>
43167 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43168 <entry>Default: <emphasis>unset</emphasis></entry>
43174 <indexterm role="concept">
43175 <primary>TLS</primary>
43176 <secondary>client certificate, location of</secondary>
43178 <indexterm role="concept">
43179 <primary>certificate</primary>
43180 <secondary>client, location of</secondary>
43182 <indexterm role="variable">
43183 <primary><varname>$host</varname></primary>
43185 <indexterm role="variable">
43186 <primary><varname>$host_address</varname></primary>
43188 The value of this option must be the absolute path to a file which contains the
43189 client’s certificate, for possible use when sending a message over an encrypted
43190 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
43191 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
43195 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
43196 certificate when sending messages as a client. The global option of the same
43197 name specifies the certificate for Exim as a server; it is not automatically
43198 assumed that the same certificate should be used when Exim is operating as a
43202 <indexterm role="option">
43203 <primary><option>tls_crl</option></primary>
43206 <informaltable frame="all">
43207 <tgroup cols="4" colsep="0" rowsep="0">
43208 <colspec colwidth="8*" align="left"/>
43209 <colspec colwidth="6*" align="center"/>
43210 <colspec colwidth="6*" align="center"/>
43211 <colspec colwidth="6*" align="right"/>
43214 <entry><option>tls_crl</option></entry>
43215 <entry>Use: <emphasis>smtp</emphasis></entry>
43216 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43217 <entry>Default: <emphasis>unset</emphasis></entry>
43223 <indexterm role="concept">
43224 <primary>TLS</primary>
43225 <secondary>client certificate revocation list</secondary>
43227 <indexterm role="concept">
43228 <primary>certificate</primary>
43229 <secondary>revocation list for client</secondary>
43231 This option specifies a certificate revocation list. The expanded value must
43232 be the name of a file that contains a CRL in PEM format.
43235 <indexterm role="option">
43236 <primary><option>tls_privatekey</option></primary>
43239 <informaltable frame="all">
43240 <tgroup cols="4" colsep="0" rowsep="0">
43241 <colspec colwidth="8*" align="left"/>
43242 <colspec colwidth="6*" align="center"/>
43243 <colspec colwidth="6*" align="center"/>
43244 <colspec colwidth="6*" align="right"/>
43247 <entry><option>tls_privatekey</option></entry>
43248 <entry>Use: <emphasis>smtp</emphasis></entry>
43249 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43250 <entry>Default: <emphasis>unset</emphasis></entry>
43256 <indexterm role="concept">
43257 <primary>TLS</primary>
43258 <secondary>client private key, location of</secondary>
43260 <indexterm role="variable">
43261 <primary><varname>$host</varname></primary>
43263 <indexterm role="variable">
43264 <primary><varname>$host_address</varname></primary>
43266 The value of this option must be the absolute path to a file which contains the
43267 client’s private key. This is used when sending a message over an encrypted
43268 connection using a client certificate. The values of <varname>$host</varname> and
43269 <varname>$host_address</varname> are set to the name and address of the server during the
43270 expansion. If this option is unset, or the expansion is forced to fail, or the
43271 result is an empty string, the private key is assumed to be in the same file as
43272 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43275 <indexterm role="option">
43276 <primary><option>tls_require_ciphers</option></primary>
43279 <informaltable frame="all">
43280 <tgroup cols="4" colsep="0" rowsep="0">
43281 <colspec colwidth="8*" align="left"/>
43282 <colspec colwidth="6*" align="center"/>
43283 <colspec colwidth="6*" align="center"/>
43284 <colspec colwidth="6*" align="right"/>
43287 <entry><option>tls_require_ciphers</option></entry>
43288 <entry>Use: <emphasis>smtp</emphasis></entry>
43289 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43290 <entry>Default: <emphasis>unset</emphasis></entry>
43296 <indexterm role="concept">
43297 <primary>TLS</primary>
43298 <secondary>requiring specific ciphers</secondary>
43300 <indexterm role="concept">
43301 <primary>cipher</primary>
43302 <secondary>requiring specific</secondary>
43304 <indexterm role="variable">
43305 <primary><varname>$host</varname></primary>
43307 <indexterm role="variable">
43308 <primary><varname>$host_address</varname></primary>
43310 The value of this option must be a list of permitted cipher suites, for use
43311 when setting up an outgoing encrypted connection. (There is a global option of
43312 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
43313 <varname>$host_address</varname> are set to the name and address of the server during the
43314 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
43315 is used in different ways by OpenSSL and GnuTLS (see sections
43316 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
43317 ciphers is a preference order.
43320 <indexterm role="option">
43321 <primary><option>tls_tempfail_tryclear</option></primary>
43324 <informaltable frame="all">
43325 <tgroup cols="4" colsep="0" rowsep="0">
43326 <colspec colwidth="8*" align="left"/>
43327 <colspec colwidth="6*" align="center"/>
43328 <colspec colwidth="6*" align="center"/>
43329 <colspec colwidth="6*" align="right"/>
43332 <entry><option>tls_tempfail_tryclear</option></entry>
43333 <entry>Use: <emphasis>smtp</emphasis></entry>
43334 <entry>Type: <emphasis>boolean</emphasis></entry>
43335 <entry>Default: <emphasis>true</emphasis></entry>
43341 <indexterm role="concept">
43342 <primary>4<emphasis>xx</emphasis> responses</primary>
43343 <secondary>to STARTTLS</secondary>
43345 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
43346 setting up a TLS session, this option determines whether or not Exim should try
43347 to deliver the message unencrypted. If it is set false, delivery to the
43348 current host is deferred; if there are other hosts, they are tried. If this
43349 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
43350 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
43351 TLS negotiation fails, Exim closes the current connection (because it is in an
43352 unknown state), opens a new one to the same host, and then tries the delivery
43356 <indexterm role="option">
43357 <primary><option>tls_verify_certificates</option></primary>
43360 <informaltable frame="all">
43361 <tgroup cols="4" colsep="0" rowsep="0">
43362 <colspec colwidth="8*" align="left"/>
43363 <colspec colwidth="6*" align="center"/>
43364 <colspec colwidth="6*" align="center"/>
43365 <colspec colwidth="6*" align="right"/>
43368 <entry><option>tls_verify_certificates</option></entry>
43369 <entry>Use: <emphasis>smtp</emphasis></entry>
43370 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
43371 <entry>Default: <emphasis>unset</emphasis></entry>
43377 <indexterm role="concept">
43378 <primary>TLS</primary>
43379 <secondary>server certificate verification</secondary>
43381 <indexterm role="concept">
43382 <primary>certificate</primary>
43383 <secondary>verification of server</secondary>
43385 <indexterm role="variable">
43386 <primary><varname>$host</varname></primary>
43388 <indexterm role="variable">
43389 <primary><varname>$host_address</varname></primary>
43391 The value of this option must be the absolute path to a file containing
43392 permitted server certificates, for use when setting up an encrypted connection.
43393 Alternatively, if you are using OpenSSL, you can set
43394 <option>tls_verify_certificates</option> to the name of a directory containing certificate
43395 files. This does not work with GnuTLS; the option must be set to the name of a
43396 single file if you are using GnuTLS. The values of <varname>$host</varname> and
43397 <varname>$host_address</varname> are set to the name and address of the server during the
43398 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
43401 <section id="SECTvalhosmax">
43402 <title>How the limits for the number of hosts to try are used</title>
43404 <indexterm role="concept">
43405 <primary>host</primary>
43406 <secondary>maximum number to try</secondary>
43408 <indexterm role="concept">
43409 <primary>limit</primary>
43410 <secondary>hosts; maximum number tried</secondary>
43412 There are two options that are concerned with the number of hosts that are
43413 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
43414 <option>hosts_max_try_hardlimit</option>.
43417 The <option>hosts_max_try</option> option limits the number of hosts that are tried
43418 for a single delivery. However, despite the term <quote>host</quote> in its name, the
43419 option actually applies to each IP address independently. In other words, a
43420 multihomed host is treated as several independent hosts, just as it is for
43424 Many of the larger ISPs have multiple MX records which often point to
43425 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
43426 created as a result of routing one of these domains.
43429 Trying every single IP address on such a long list does not seem sensible; if
43430 several at the top of the list fail, it is reasonable to assume there is some
43431 problem that is likely to affect all of them. Roughly speaking, the value of
43432 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
43433 delivery. However, the logic cannot be quite that simple.
43436 Firstly, IP addresses that are skipped because their retry times have not
43437 arrived do not count, and in addition, addresses that are past their retry
43438 limits are also not counted, even when they are tried. This means that when
43439 some IP addresses are past their retry limits, more than the value of
43440 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
43441 that all IP addresses are considered before timing out an email address (but
43442 see below for an exception).
43445 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
43446 list to see if there is a subsequent host with a different (higher valued) MX.
43447 If there is, that host is considered next, and the current IP address is used
43448 but not counted. This behaviour helps in the case of a domain with a retry rule
43449 that hardly ever delays any hosts, as is now explained:
43452 Consider the case of a long list of hosts with one MX value, and a few with a
43453 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
43454 hosts at the top of the list are tried at first. With the default retry rule,
43455 which specifies increasing retry times, the higher MX hosts are eventually
43456 tried when those at the top of the list are skipped because they have not
43457 reached their retry times.
43460 However, it is common practice to put a fixed short retry time on domains for
43461 large ISPs, on the grounds that their servers are rarely down for very long.
43462 Unfortunately, these are exactly the domains that tend to resolve to long lists
43463 of hosts. The short retry time means that the lowest MX hosts are tried every
43464 time. The attempts may be in a different order because of random sorting, but
43465 without the special MX check, the higher MX hosts would never be tried until
43466 all the lower MX hosts had timed out (which might be several days), because
43467 there are always some lower MX hosts that have reached their retry times. With
43468 the special check, Exim considers at least one IP address from each MX value at
43469 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
43473 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
43474 particular, Exim normally eventually tries all the IP addresses before timing
43475 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
43476 reasonable thing to do. Recently, however, some lunatic DNS configurations have
43477 been set up with hundreds of IP addresses for some domains. It can
43478 take a very long time indeed for an address to time out in these cases.
43481 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
43482 Exim never tries more than this number of IP addresses; if it hits this limit
43483 and they are all timed out, the email address is bounced, even though not all
43484 possible IP addresses have been tried.
43485 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
43486 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
43491 <chapter id="CHAPrewrite">
43492 <title>Address rewriting</title>
43494 <indexterm role="concept" id="IIDaddrew" class="startofrange">
43495 <primary>rewriting</primary>
43496 <secondary>addresses</secondary>
43498 There are some circumstances in which Exim automatically rewrites domains in
43499 addresses. The two most common are when an address is given without a domain
43500 (referred to as an <quote>unqualified address</quote>) or when an address contains an
43501 abbreviated domain that is expanded by DNS lookup.
43504 Unqualified envelope addresses are accepted only for locally submitted
43505 messages, or for messages that are received from hosts matching
43506 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
43507 appropriate. Unqualified addresses in header lines are qualified if they are in
43508 locally submitted messages, or messages from hosts that are permitted to send
43509 unqualified envelope addresses. Otherwise, unqualified addresses in header
43510 lines are neither qualified nor rewritten.
43513 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
43514 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
43515 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
43516 do this. The new RFCs do not contain this suggestion.
43518 <section id="SECID147">
43519 <title>Explicitly configured address rewriting</title>
43521 This chapter describes the rewriting rules that can be used in the
43522 main rewrite section of the configuration file, and also in the generic
43523 <option>headers_rewrite</option> option that can be set on any transport.
43526 Some people believe that configured address rewriting is a Mortal Sin.
43527 Others believe that life is not possible without it. Exim provides the
43528 facility; you do not have to use it.
43531 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
43532 configuration file are applied to addresses in incoming messages, both envelope
43533 addresses and addresses in header lines. Each rule specifies the types of
43534 address to which it applies.
43537 Whether or not addresses in header lines are rewritten depends on the origin of
43538 the headers and the type of rewriting. Global rewriting, that is, rewriting
43539 rules from the rewrite section of the configuration file, is applied only to
43540 those headers that were received with the message. Header lines that are added
43541 by ACLs or by a system filter or by individual routers or transports (which
43542 are specific to individual recipient addresses) are not rewritten by the global
43546 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
43547 applies all headers except those added by routers and transports. That is, as
43548 well as the headers that were received with the message, it also applies to
43549 headers that were added by an ACL or a system filter.
43552 In general, rewriting addresses from your own system or domain has some
43553 legitimacy. Rewriting other addresses should be done only with great care and
43554 in special circumstances. The author of Exim believes that rewriting should be
43555 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
43556 Although it can sometimes be used as a routing tool, this is very strongly
43560 There are two commonly encountered circumstances where rewriting is used, as
43561 illustrated by these examples:
43566 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
43567 exchange mail with each other behind a firewall, but there is only a single
43568 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
43569 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
43574 A host rewrites the local parts of its own users so that, for example,
43575 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
43580 <section id="SECID148">
43581 <title>When does rewriting happen?</title>
43583 <indexterm role="concept">
43584 <primary>rewriting</primary>
43585 <secondary>timing of</secondary>
43587 <indexterm role="concept">
43588 <primary>access control lists (ACLs)</primary>
43589 <secondary>rewriting addresses in</secondary>
43591 Configured address rewriting can take place at several different stages of a
43592 message’s processing.
43595 <indexterm role="variable">
43596 <primary><varname>$sender_address</varname></primary>
43598 At the start of an ACL for MAIL, the sender address may have been rewritten
43599 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
43600 ordinary rewrite rules have yet been applied. If, however, the sender address
43601 is verified in the ACL, it is rewritten before verification, and remains
43602 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
43603 rewritten address. This also applies if sender verification happens in a
43604 RCPT ACL. Otherwise, when the sender address is not verified, it is
43605 rewritten as soon as a message’s header lines have been received.
43608 <indexterm role="variable">
43609 <primary><varname>$domain</varname></primary>
43611 <indexterm role="variable">
43612 <primary><varname>$local_part</varname></primary>
43614 Similarly, at the start of an ACL for RCPT, the current recipient’s address
43615 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
43616 rewrite rules have yet been applied to it. However, the behaviour is different
43617 from the sender address when a recipient is verified. The address is rewritten
43618 for the verification, but the rewriting is not remembered at this stage. The
43619 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
43620 as they were before (that is, they contain the unrewritten – except for
43621 SMTP-time rewriting – address).
43624 As soon as a message’s header lines have been received, all the envelope
43625 recipient addresses are permanently rewritten, and rewriting is also applied to
43626 the addresses in the header lines (if configured). This happens before adding
43627 any header lines that were specified in MAIL or RCPT ACLs, and
43628 <indexterm role="concept">
43629 <primary><function>local_scan()</function> function</primary>
43630 <secondary>address rewriting; timing of</secondary>
43632 before the DATA ACL and <function>local_scan()</function> functions are run.
43635 When an address is being routed, either for delivery or for verification,
43636 rewriting is applied immediately to child addresses that are generated by
43637 redirection, unless <option>no_rewrite</option> is set on the router.
43640 <indexterm role="concept">
43641 <primary>envelope sender</primary>
43642 <secondary>rewriting at transport time</secondary>
43644 <indexterm role="concept">
43645 <primary>rewriting</primary>
43646 <secondary>at transport time</secondary>
43648 <indexterm role="concept">
43649 <primary>header lines</primary>
43650 <secondary>rewriting at transport time</secondary>
43652 At transport time, additional rewriting of addresses in header lines can be
43653 specified by setting the generic <option>headers_rewrite</option> option on a transport.
43654 This option contains rules that are identical in form to those in the rewrite
43655 section of the configuration file. They are applied to the original message
43656 header lines and any that were added by ACLs or a system filter. They are not
43657 applied to header lines that are added by routers or the transport.
43660 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
43661 transport option. However, it is not possible to rewrite envelope recipients at
43665 <section id="SECID149">
43666 <title>Testing the rewriting rules that apply on input</title>
43668 <indexterm role="concept">
43669 <primary>rewriting</primary>
43670 <secondary>testing</secondary>
43672 <indexterm role="concept">
43673 <primary>testing</primary>
43674 <secondary>rewriting</secondary>
43676 Exim’s input rewriting configuration appears in a part of the run time
43677 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
43678 <option>-brw</option> command line option. This takes an address (which can be a full RFC
43679 2822 address) as its argument. The output is a list of how the address would be
43680 transformed by the rewriting rules for each of the different places it might
43681 appear in an incoming message, that is, for each different header and for the
43682 envelope sender and recipient fields. For example,
43684 <literallayout class="monospaced">
43685 exim -brw ph10@exim.workshop.example
43688 might produce the output
43690 <literallayout class="monospaced">
43691 sender: Philip.Hazel@exim.workshop.example
43692 from: Philip.Hazel@exim.workshop.example
43693 to: ph10@exim.workshop.example
43694 cc: ph10@exim.workshop.example
43695 bcc: ph10@exim.workshop.example
43696 reply-to: Philip.Hazel@exim.workshop.example
43697 env-from: Philip.Hazel@exim.workshop.example
43698 env-to: ph10@exim.workshop.example
43701 which shows that rewriting has been set up for that address when used in any of
43702 the source fields, but not when it appears as a recipient address. At the
43703 present time, there is no equivalent way of testing rewriting rules that are
43704 set for a particular transport.
43707 <section id="SECID150">
43708 <title>Rewriting rules</title>
43710 <indexterm role="concept">
43711 <primary>rewriting</primary>
43712 <secondary>rules</secondary>
43714 The rewrite section of the configuration file consists of lines of rewriting
43718 <<emphasis>source pattern</emphasis>> <<emphasis>replacement</emphasis>> <<emphasis>flags</emphasis>>
43721 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
43722 transport option are given as a colon-separated list. Each item in the list
43723 takes the same form as a line in the main rewriting configuration (except that
43724 any colons must be doubled, of course).
43727 The formats of source patterns and replacement strings are described below.
43728 Each is terminated by white space, unless enclosed in double quotes, in which
43729 case normal quoting conventions apply inside the quotes. The flags are single
43730 characters which may appear in any order. Spaces and tabs between them are
43734 For each address that could potentially be rewritten, the rules are scanned in
43735 order, and replacements for the address from earlier rules can themselves be
43736 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
43739 The order in which addresses are rewritten is undefined, may change between
43740 releases, and must not be relied on, with one exception: when a message is
43741 received, the envelope sender is always rewritten first, before any header
43742 lines are rewritten. For example, the replacement string for a rewrite of an
43743 address in <emphasis>To:</emphasis> must not assume that the message’s address in <emphasis>From:</emphasis> has
43744 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
43745 that the envelope sender has already been rewritten.
43748 <indexterm role="variable">
43749 <primary><varname>$domain</varname></primary>
43751 <indexterm role="variable">
43752 <primary><varname>$local_part</varname></primary>
43754 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
43755 string to refer to the address that is being rewritten. Note that lookup-driven
43756 rewriting can be done by a rule of the form
43758 <literallayout class="monospaced">
43762 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
43763 refer to the address that is being rewritten.
43766 <section id="SECID151">
43767 <title>Rewriting patterns</title>
43769 <indexterm role="concept">
43770 <primary>rewriting</primary>
43771 <secondary>patterns</secondary>
43773 <indexterm role="concept">
43774 <primary>address list</primary>
43775 <secondary>in a rewriting pattern</secondary>
43777 The source pattern in a rewriting rule is any item which may appear in an
43778 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
43779 single-item address list, which means that it is expanded before being tested
43780 against the address. As always, if you use a regular expression as a pattern,
43781 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
43782 facility to suppress string expansion within the regular expression.
43785 Domains in patterns should be given in lower case. Local parts in patterns are
43786 case-sensitive. If you want to do case-insensitive matching of local parts, you
43787 can use a regular expression that starts with <literal>^(?i)</literal>.
43790 <indexterm role="concept">
43791 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43792 <secondary>in rewriting rules</secondary>
43794 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
43795 depending on the type of match which occurred. These can be used in the
43796 replacement string to insert portions of the incoming address. <varname>$0</varname> always
43797 refers to the complete incoming address. When a regular expression is used, the
43798 numerical variables are set from its capturing subexpressions. For other types
43799 of pattern they are set as follows:
43804 If a local part or domain starts with an asterisk, the numerical variables
43805 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
43806 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
43809 <literallayout class="monospaced">
43810 *queen@*.fict.example
43813 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
43815 <literallayout class="monospaced">
43816 $0 = hearts-queen@wonderland.fict.example
43821 Note that if the local part does not start with an asterisk, but the domain
43822 does, it is <varname>$1</varname> that contains the wild part of the domain.
43827 If the domain part of the pattern is a partial lookup, the wild and fixed parts
43828 of the domain are placed in the next available numerical variables. Suppose,
43829 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
43830 rewriting rule of the form
43833 <literal>*@partial-dbm;/some/dbm/file</literal> <<emphasis>replacement string</emphasis>>
43836 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
43838 <literallayout class="monospaced">
43844 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
43845 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
43846 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
43847 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
43848 whole domain. For non-partial domain lookups, no numerical variables are set.
43853 <section id="SECID152">
43854 <title>Rewriting replacements</title>
43856 <indexterm role="concept">
43857 <primary>rewriting</primary>
43858 <secondary>replacements</secondary>
43860 If the replacement string for a rule is a single asterisk, addresses that
43861 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
43862 rewriting rules are scanned. For example,
43864 <literallayout class="monospaced">
43865 hatta@lookingglass.fict.example * f
43868 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
43869 <emphasis>From:</emphasis> headers.
43872 <indexterm role="variable">
43873 <primary><varname>$domain</varname></primary>
43875 <indexterm role="variable">
43876 <primary><varname>$local_part</varname></primary>
43878 If the replacement string is not a single asterisk, it is expanded, and must
43879 yield a fully qualified address. Within the expansion, the variables
43880 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
43881 Any letters they contain retain their original case – they are not lower
43882 cased. The numerical variables are set up according to the type of pattern that
43883 matched the address, as described above. If the expansion is forced to fail by
43884 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
43885 current rule is abandoned, but subsequent rules may take effect. Any other
43886 expansion failure causes the entire rewriting operation to be abandoned, and an
43887 entry written to the panic log.
43890 <section id="SECID153">
43891 <title>Rewriting flags</title>
43893 There are three different kinds of flag that may appear on rewriting rules:
43898 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
43904 A flag that specifies rewriting at SMTP time: S.
43909 Flags that control the rewriting process: Q, q, R, w.
43914 For rules that are part of the <option>headers_rewrite</option> generic transport option,
43915 E, F, T, and S are not permitted.
43918 <section id="SECID154">
43919 <title>Flags specifying which headers and envelope addresses to rewrite</title>
43921 <indexterm role="concept">
43922 <primary>rewriting</primary>
43923 <secondary>flags</secondary>
43925 If none of the following flag letters, nor the <quote>S</quote> flag (see section
43926 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
43927 and to both the sender and recipient fields of the envelope, whereas a
43928 transport-time rewriting rule just applies to all headers. Otherwise, the
43929 rewriting rule is skipped unless the relevant addresses are being processed.
43932 <literal>E</literal> rewrite all envelope fields
43933 <literal>F</literal> rewrite the envelope From field
43934 <literal>T</literal> rewrite the envelope To field
43935 <literal>b</literal> rewrite the <emphasis>Bcc:</emphasis> header
43936 <literal>c</literal> rewrite the <emphasis>Cc:</emphasis> header
43937 <literal>f</literal> rewrite the <emphasis>From:</emphasis> header
43938 <literal>h</literal> rewrite all headers
43939 <literal>r</literal> rewrite the <emphasis>Reply-To:</emphasis> header
43940 <literal>s</literal> rewrite the <emphasis>Sender:</emphasis> header
43941 <literal>t</literal> rewrite the <emphasis>To:</emphasis> header
43944 "All headers" means all of the headers listed above that can be selected
43945 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
43946 other headers such as <emphasis>Subject:</emphasis> etc.
43949 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
43950 restrict this to special known cases in your own domains.
43953 <section id="SECTrewriteS">
43954 <title>The SMTP-time rewriting flag</title>
43956 <indexterm role="concept">
43957 <primary>SMTP</primary>
43958 <secondary>rewriting malformed addresses</secondary>
43960 <indexterm role="concept">
43961 <primary>RCPT</primary>
43962 <secondary>rewriting argument of</secondary>
43964 <indexterm role="concept">
43965 <primary>MAIL</primary>
43966 <secondary>rewriting argument of</secondary>
43968 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
43969 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
43970 before any other processing; even before syntax checking. The pattern is
43971 required to be a regular expression, and it is matched against the whole of the
43972 data for the command, including any surrounding angle brackets.
43975 <indexterm role="variable">
43976 <primary><varname>$domain</varname></primary>
43978 <indexterm role="variable">
43979 <primary><varname>$local_part</varname></primary>
43981 This form of rewrite rule allows for the handling of addresses that are not
43982 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
43983 input). Because the input is not required to be a syntactically valid address,
43984 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
43985 expansion of the replacement string. The result of rewriting replaces the
43986 original address in the MAIL or RCPT command.
43989 <section id="SECID155">
43990 <title>Flags controlling the rewriting process</title>
43992 There are four flags which control the way the rewriting process works. These
43993 take effect only when a rule is invoked, that is, when the address is of the
43994 correct type (matches the flags) and matches the pattern:
43999 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
44000 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
44001 absence of <quote>Q</quote> the rewritten address must always include a domain.
44006 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
44007 even if no rewriting actually takes place because of a <quote>fail</quote> in the
44008 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
44009 (does not match the flags) or does not match the pattern.
44014 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
44015 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
44016 rewriting once it fails to match (after at least one successful rewrite).
44021 <indexterm role="concept">
44022 <primary>rewriting</primary>
44023 <secondary>whole addresses</secondary>
44025 When an address in a header is rewritten, the rewriting normally applies only
44026 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
44027 left unchanged. For example, rewriting might change
44029 <literallayout class="monospaced">
44030 From: Ford Prefect <fp42@restaurant.hitch.fict.example>
44035 <literallayout class="monospaced">
44036 From: Ford Prefect <prefectf@hitch.fict.example>
44039 <indexterm role="concept">
44040 <primary>RFC 2047</primary>
44042 Sometimes there is a need to replace the whole address item, and this can be
44043 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
44044 causes an address in a header line to be rewritten, the entire address is
44045 replaced, not just the working part. The replacement must be a complete RFC
44046 2822 address, including the angle brackets if necessary. If text outside angle
44047 brackets contains a character whose value is greater than 126 or less than 32
44048 (except for tab), the text is encoded according to RFC 2047. The character set
44049 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
44052 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
44053 rewritten, all but the working part of the replacement address is discarded.
44058 <section id="SECID156">
44059 <title>Rewriting examples</title>
44061 Here is an example of the two common rewriting paradigms:
44063 <literallayout class="monospaced">
44064 *@*.hitch.fict.example $1@hitch.fict.example
44065 *@hitch.fict.example ${lookup{$1}dbm{/etc/realnames}\
44066 {$value}fail}@hitch.fict.example bctfrF
44069 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
44070 the string expansion to fail if the lookup does not succeed. In this context it
44071 has the effect of leaving the original address unchanged, but Exim goes on to
44072 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
44073 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
44074 explicitly, which would cause the rewritten address to be the same as before,
44075 at the cost of a small bit of processing. Not supplying either of these is an
44076 error, since the rewritten address would then contain no local part.
44079 The first example above replaces the domain with a superior, more general
44080 domain. This may not be desirable for certain local parts. If the rule
44082 <literallayout class="monospaced">
44083 root@*.hitch.fict.example *
44086 were inserted before the first rule, rewriting would be suppressed for the
44087 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
44090 Rewriting can be made conditional on a number of tests, by making use of
44091 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
44092 messages that originate outside the local host:
44094 <literallayout class="monospaced">
44095 *@*.hitch.fict.example "${if !eq {$sender_host_address}{}\
44096 {$1@hitch.fict.example}fail}"
44099 The replacement string is quoted in this example because it contains white
44103 <indexterm role="concept">
44104 <primary>rewriting</primary>
44105 <secondary>bang paths</secondary>
44107 <indexterm role="concept">
44108 <primary>bang paths</primary>
44109 <secondary>rewriting</secondary>
44111 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
44112 an address it treats it as an unqualified local part which it qualifies with
44113 the local qualification domain (if the source of the message is local or if the
44114 remote host is permitted to send unqualified addresses). Rewriting can
44115 sometimes be used to handle simple bang paths with a fixed number of
44116 components. For example, the rule
44118 <literallayout class="monospaced">
44119 \N^([^!]+)!(.*)@your.domain.example$\N $2@$1
44122 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
44123 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
44124 a global rewriting rule for envelope addresses. It can provide a backdoor
44125 method for using your system as a relay, because the incoming addresses appear
44126 to be local. If the bang path addresses are received via SMTP, it is safer to
44127 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
44128 can be done on the rewritten addresses.
44129 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
44134 <chapter id="CHAPretry">
44135 <title>Retry configuration</title>
44137 <indexterm role="concept" id="IIDretconf1" class="startofrange">
44138 <primary>retry</primary>
44139 <secondary>configuration, description of</secondary>
44141 <indexterm role="concept" id="IIDregconf2" class="startofrange">
44142 <primary>configuration file</primary>
44143 <secondary>retry section</secondary>
44145 The <quote>retry</quote> section of the runtime configuration file contains a list of
44146 retry rules that control how often Exim tries to deliver messages that cannot
44147 be delivered at the first attempt. If there are no retry rules (the section is
44148 empty or not present), there are no retries. In this situation, temporary
44149 errors are treated as permanent. The default configuration contains a single,
44150 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
44151 line option can be used to test which retry rule will be used for a given
44152 address, domain and error.
44155 The most common cause of retries is temporary failure to deliver to a remote
44156 host because the host is down, or inaccessible because of a network problem.
44157 Exim’s retry processing in this case is applied on a per-host (strictly, per IP
44158 address) basis, not on a per-message basis. Thus, if one message has recently
44159 been delayed, delivery of a new message to the same host is not immediately
44160 tried, but waits for the host’s retry time to arrive. If the <option>retry_defer</option>
44161 log selector is set, the message
44162 <indexterm role="concept">
44163 <primary>retry</primary>
44164 <secondary>time not reached</secondary>
44166 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
44167 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
44168 the handling of errors during remote deliveries.
44171 Retry processing applies to routing as well as to delivering, except as covered
44172 in the next paragraph. The retry rules do not distinguish between these
44173 actions. It is not possible, for example, to specify different behaviour for
44174 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
44175 the host <emphasis>snark.fict.example</emphasis>. I didn’t think anyone would ever need this
44176 added complication, so did not implement it. However, although they share the
44177 same retry rule, the actual retry times for routing and transporting a given
44178 domain are maintained independently.
44181 When a delivery is not part of a queue run (typically an immediate delivery on
44182 receipt of a message), the routers are always run, and local deliveries are
44183 always attempted, even if retry times are set for them. This makes for better
44184 behaviour if one particular message is causing problems (for example, causing
44185 quota overflow, or provoking an error in a filter file). If such a delivery
44186 suffers a temporary failure, the retry data is updated as normal, and
44187 subsequent delivery attempts from queue runs occur only when the retry time for
44188 the local address is reached.
44190 <section id="SECID157">
44191 <title>Changing retry rules</title>
44193 If you change the retry rules in your configuration, you should consider
44194 whether or not to delete the retry data that is stored in Exim’s spool area in
44195 files with names like <filename>db/retry</filename>. Deleting any of Exim’s hints files is
44196 always safe; that is why they are called <quote>hints</quote>.
44199 The hints retry data contains suggested retry times based on the previous
44200 rules. In the case of a long-running problem with a remote host, it might
44201 record the fact that the host has timed out. If your new rules increase the
44202 timeout time for such a host, you should definitely remove the old retry data
44203 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
44204 messages that it should now be retaining.
44207 <section id="SECID158">
44208 <title>Format of retry rules</title>
44210 <indexterm role="concept">
44211 <primary>retry</primary>
44212 <secondary>rules</secondary>
44214 Each retry rule occupies one line and consists of three or four parts,
44215 separated by white space: a pattern, an error name, an optional list of sender
44216 addresses, and a list of retry parameters. The pattern and sender lists must be
44217 enclosed in double quotes if they contain white space. The rules are searched
44218 in order until one is found where the pattern, error name, and sender list (if
44219 present) match the failing host or address, the error that occurred, and the
44220 message’s sender, respectively.
44223 The pattern is any single item that may appear in an address list (see section
44224 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
44225 which means that it is expanded before being tested against the address that
44226 has been delayed. A negated address list item is permitted. Address
44227 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
44228 which makes it possible for many retry rules to start with just a domain. For
44231 <literallayout class="monospaced">
44232 lookingglass.fict.example * F,24h,30m;
44235 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
44238 <literallayout class="monospaced">
44239 alice@lookingglass.fict.example * F,24h,30m;
44242 applies only to temporary failures involving the local part <option>alice</option>.
44243 In practice, almost all rules start with a domain name pattern without a local
44247 <indexterm role="concept">
44248 <primary>regular expressions</primary>
44249 <secondary>in retry rules</secondary>
44251 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
44252 must match a complete address, not just a domain, because that is how regular
44253 expressions work in address lists.
44256 <literal>^\Nxyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Wrong</option>
44257 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N * G,1h,10m,2</literal> <option>Right</option>
44260 <section id="SECID159">
44261 <title>Choosing which retry rule to use for address errors</title>
44263 When Exim is looking for a retry rule after a routing attempt has failed (for
44264 example, after a DNS timeout), each line in the retry configuration is tested
44265 against the complete address only if <option>retry_use_local_part</option> is set for the
44266 router. Otherwise, only the domain is used, except when matching against a
44267 regular expression, when the local part of the address is replaced with <quote>*</quote>.
44268 A domain on its own can match a domain pattern, or a pattern that starts with
44269 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
44270 <option>check_local_user</option> is true, and false for other routers.
44273 Similarly, when Exim is looking for a retry rule after a local delivery has
44274 failed (for example, after a mailbox full error), each line in the retry
44275 configuration is tested against the complete address only if
44276 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
44280 <indexterm role="concept">
44281 <primary>4<emphasis>xx</emphasis> responses</primary>
44282 <secondary>retry rules for</secondary>
44284 However, when Exim is looking for a retry rule after a remote delivery attempt
44285 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
44286 whole address is always used as the key when searching the retry rules. The
44287 rule that is found is used to create a retry time for the combination of the
44288 failing address and the message’s sender. It is the combination of sender and
44289 recipient that is delayed in subsequent queue runs until its retry time is
44290 reached. You can delay the recipient without regard to the sender by setting
44291 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
44292 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
44296 <section id="SECID160">
44297 <title>Choosing which retry rule to use for host and message errors</title>
44299 For a temporary error that is not related to an individual address (for
44300 example, a connection timeout), each line in the retry configuration is checked
44301 twice. First, the name of the remote host is used as a domain name (preceded by
44302 <quote>*@</quote> when matching a regular expression). If this does not match the line,
44303 the domain from the email address is tried in a similar fashion. For example,
44304 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
44306 <literallayout class="monospaced">
44307 a.b.c.example MX 5 x.y.z.example
44312 and the retry rules are
44314 <literallayout class="monospaced">
44315 p.q.r.example * F,24h,30m;
44316 a.b.c.example * F,4d,45m;
44319 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
44320 first rule matches neither the host nor the domain, so Exim looks at the second
44321 rule. This does not match the host, but it does match the domain, so it is used
44322 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
44323 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
44324 first retry rule is used, because it matches the host.
44327 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
44328 first rule to determine retry times, but for all the other hosts for the domain
44329 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
44330 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
44333 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
44334 However, if a message is routed directly to an IP address without the use of a
44335 host name, for example, if a <command>manualroute</command> router contains a setting such as:
44337 <literallayout class="monospaced">
44338 route_list = *.a.example 192.168.34.23
44341 then the <quote>host name</quote> that is used when searching for a retry rule is the
44342 textual form of the IP address.
44345 <section id="SECID161">
44346 <title>Retry rules for specific errors</title>
44348 <indexterm role="concept">
44349 <primary>retry</primary>
44350 <secondary>specific errors; specifying</secondary>
44352 The second field in a retry rule is the name of a particular error, or an
44353 asterisk, which matches any error. The errors that can be tested for are:
44357 <term><option>auth_failed</option></term>
44360 Authentication failed when trying to send to a host in the
44361 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
44363 </listitem></varlistentry>
44365 <term><option>data_4xx</option></term>
44368 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
44369 after the command, or after sending the message’s data.
44371 </listitem></varlistentry>
44373 <term><option>mail_4xx</option></term>
44376 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
44378 </listitem></varlistentry>
44380 <term><option>rcpt_4xx</option></term>
44383 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
44385 </listitem></varlistentry>
44388 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x’s can be given
44389 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
44390 recognize 452 errors given to RCPT commands for addresses in a certain domain,
44391 and have retries every ten minutes with a one-hour timeout, you could set up a
44392 retry rule of this form:
44394 <literallayout class="monospaced">
44395 the.domain.name rcpt_452 F,1h,10m
44398 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
44399 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
44403 <term><option>lost_connection</option></term>
44406 A server unexpectedly closed the SMTP connection. There may, of course,
44407 legitimate reasons for this (host died, network died), but if it repeats a lot
44408 for the same host, it indicates something odd.
44410 </listitem></varlistentry>
44412 <term><option>refused_MX</option></term>
44415 A connection to a host obtained from an MX record was refused.
44417 </listitem></varlistentry>
44419 <term><option>refused_A</option></term>
44422 A connection to a host not obtained from an MX record was refused.
44424 </listitem></varlistentry>
44426 <term><option>refused</option></term>
44429 A connection was refused.
44431 </listitem></varlistentry>
44433 <term><option>timeout_connect_MX</option></term>
44436 A connection attempt to a host obtained from an MX record timed out.
44438 </listitem></varlistentry>
44440 <term><option>timeout_connect_A</option></term>
44443 A connection attempt to a host not obtained from an MX record timed out.
44445 </listitem></varlistentry>
44447 <term><option>timeout_connect</option></term>
44450 A connection attempt timed out.
44452 </listitem></varlistentry>
44454 <term><option>timeout_MX</option></term>
44457 There was a timeout while connecting or during an SMTP session with a host
44458 obtained from an MX record.
44460 </listitem></varlistentry>
44462 <term><option>timeout_A</option></term>
44465 There was a timeout while connecting or during an SMTP session with a host not
44466 obtained from an MX record.
44468 </listitem></varlistentry>
44470 <term><option>timeout</option></term>
44473 There was a timeout while connecting or during an SMTP session.
44475 </listitem></varlistentry>
44477 <term><option>tls_required</option></term>
44480 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
44481 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
44482 to STARTTLS, or there was a problem setting up the TLS connection.
44484 </listitem></varlistentry>
44486 <term><option>quota</option></term>
44489 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44492 </listitem></varlistentry>
44494 <term><option>quota_</option><<emphasis>time</emphasis>></term>
44497 <indexterm role="concept">
44498 <primary>quota</primary>
44499 <secondary>error testing in retry rule</secondary>
44501 <indexterm role="concept">
44502 <primary>retry</primary>
44503 <secondary>quota error testing</secondary>
44505 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
44506 transport, and the mailbox has not been accessed for <<emphasis>time</emphasis>>. For example,
44507 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
44510 </listitem></varlistentry>
44513 <indexterm role="concept">
44514 <primary>mailbox</primary>
44515 <secondary>time of last read</secondary>
44517 The idea of <option>quota_</option><<emphasis>time</emphasis>> is to make it possible to have shorter
44518 timeouts when the mailbox is full and is not being read by its owner. Ideally,
44519 it should be based on the last time that the user accessed the mailbox.
44520 However, it is not always possible to determine this. Exim uses the following
44526 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
44527 used. As no new messages are being delivered (because the mailbox is over
44528 quota), Exim does not access the file, so this is the time of last user access.
44533 <indexterm role="concept">
44534 <primary>maildir format</primary>
44535 <secondary>time of last read</secondary>
44537 For a maildir delivery, the time of last modification of the <filename>new</filename>
44538 subdirectory is used. As the mailbox is over quota, no new files are created in
44539 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
44540 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
44541 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
44542 time that is used is therefore the last time that the user read a new message.
44547 For other kinds of multi-file mailbox, the time of last access cannot be
44548 obtained, so a retry rule that uses this type of error field is never matched.
44553 The quota errors apply both to system-enforced quotas and to Exim’s own quota
44554 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
44555 when a local delivery is deferred because a partition is full (the ENOSPC
44559 <section id="SECID162">
44560 <title>Retry rules for specified senders</title>
44562 <indexterm role="concept">
44563 <primary>retry</primary>
44564 <secondary>rules; sender-specific</secondary>
44566 You can specify retry rules that apply only when the failing message has a
44567 specific sender. In particular, this can be used to define retry rules that
44568 apply only to bounce messages. The third item in a retry rule can be of this
44572 <literal>senders=</literal><<emphasis>address list</emphasis>>
44575 The retry timings themselves are then the fourth item. For example:
44577 <literallayout class="monospaced">
44578 * rcpt_4xx senders=: F,1h,30m
44581 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
44582 host. If the address list contains white space, it must be enclosed in quotes.
44585 <literallayout class="monospaced">
44586 a.domain rcpt_452 senders="xb.dom : yc.dom" G,8h,10m,1.5
44589 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
44590 (which do not depend on the recipient). The reason is that the sender is used
44591 only to match the retry rule. Once the rule has been found for a host error,
44592 its contents are used to set a retry time for the host, and this will apply to
44593 all messages, not just those with specific senders.
44596 When testing retry rules using <option>-brt</option>, you can supply a sender using the
44597 <option>-f</option> command line option, like this:
44599 <literallayout class="monospaced">
44600 exim -f "" -brt user@dom.ain
44603 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
44604 list is never matched.
44607 <section id="SECID163">
44608 <title>Retry parameters</title>
44610 <indexterm role="concept">
44611 <primary>retry</primary>
44612 <secondary>parameters in rules</secondary>
44614 The third (or fourth, if a senders list is present) field in a retry rule is a
44615 sequence of retry parameter sets, separated by semicolons. Each set consists of
44618 <<emphasis>letter</emphasis>>,<<emphasis>cutoff time</emphasis>>,<<emphasis>arguments</emphasis>>
44621 The letter identifies the algorithm for computing a new retry time; the cutoff
44622 time is the time beyond which this algorithm no longer applies, and the
44623 arguments vary the algorithm’s action. The cutoff time is measured from the
44624 time that the first failure for the domain (combined with the local part if
44625 relevant) was detected, not from the time the message was received.
44628 <indexterm role="concept">
44629 <primary>retry</primary>
44630 <secondary>algorithms</secondary>
44632 <indexterm role="concept">
44633 <primary>retry</primary>
44634 <secondary>fixed intervals</secondary>
44636 <indexterm role="concept">
44637 <primary>retry</primary>
44638 <secondary>increasing intervals</secondary>
44640 <indexterm role="concept">
44641 <primary>retry</primary>
44642 <secondary>random intervals</secondary>
44644 The available algorithms are:
44649 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
44655 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
44656 specifies a starting value for the interval, and the second a multiplier, which
44657 is used to increase the size of the interval at each retry.
44662 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
44663 retry, the previous interval is multiplied by the factor in order to get a
44664 maximum for the next interval. The minimum interval is the first argument of
44665 the parameter, and an actual interval is chosen randomly between them. Such a
44666 rule has been found to be helpful in cluster configurations when all the
44667 members of the cluster restart at once, and may therefore synchronize their
44668 queue processing times.
44673 When computing the next retry time, the algorithm definitions are scanned in
44674 order until one whose cutoff time has not yet passed is reached. This is then
44675 used to compute a new retry time that is later than the current time. In the
44676 case of fixed interval retries, this simply means adding the interval to the
44677 current time. For geometrically increasing intervals, retry intervals are
44678 computed from the rule’s parameters until one that is greater than the previous
44679 interval is found. The main configuration variable
44680 <indexterm role="concept">
44681 <primary>limit</primary>
44682 <secondary>retry interval</secondary>
44684 <indexterm role="concept">
44685 <primary>retry</primary>
44686 <secondary>interval, maximum</secondary>
44688 <indexterm role="option">
44689 <primary><option>retry_interval_max</option></primary>
44691 <option>retry_interval_max</option> limits the maximum interval between retries. It
44692 cannot be set greater than <literal>24h</literal>, which is its default value.
44695 A single remote domain may have a number of hosts associated with it, and each
44696 host may have more than one IP address. Retry algorithms are selected on the
44697 basis of the domain name, but are applied to each IP address independently. If,
44698 for example, a host has two IP addresses and one is unusable, Exim will
44699 generate retry times for it and will not try to use it until its next retry
44700 time comes. Thus the good IP address is likely to be tried first most of the
44704 <indexterm role="concept">
44705 <primary>hints database</primary>
44706 <secondary>use for retrying</secondary>
44708 Retry times are hints rather than promises. Exim does not make any attempt to
44709 run deliveries exactly at the computed times. Instead, a queue runner process
44710 starts delivery processes for delayed messages periodically, and these attempt
44711 new deliveries only for those addresses that have passed their next retry time.
44712 If a new message arrives for a deferred address, an immediate delivery attempt
44713 occurs only if the address has passed its retry time. In the absence of new
44714 messages, the minimum time between retries is the interval between queue runner
44715 processes. There is not much point in setting retry times of five minutes if
44716 your queue runners happen only once an hour, unless there are a significant
44717 number of incoming messages (which might be the case on a system that is
44718 sending everything to a smart host, for example).
44721 The data in the retry hints database can be inspected by using the
44722 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
44723 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
44724 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
44725 are for the hosts associated with a particular mail domain, and also for local
44726 deliveries that have been deferred.
44729 <section id="SECID164">
44730 <title>Retry rule examples</title>
44732 Here are some example retry rules:
44734 <literallayout class="monospaced">
44735 alice@wonderland.fict.example quota_5d F,7d,3h
44736 wonderland.fict.example quota_5d
44737 wonderland.fict.example * F,1h,15m; G,2d,1h,2;
44738 lookingglass.fict.example * F,24h,30m;
44739 * refused_A F,2h,20m;
44740 * * F,2h,15m; G,16h,1h,1.5; F,5d,8h
44743 The first rule sets up special handling for mail to
44744 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
44745 mailbox has not been read for at least 5 days. Retries continue every three
44746 hours for 7 days. The second rule handles over-quota errors for all other local
44747 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
44748 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
44749 fail are bounced immediately if the mailbox has not been read for at least 5
44753 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
44754 happen every 15 minutes for an hour, then with geometrically increasing
44755 intervals until two days have passed since a delivery first failed. After the
44756 first hour there is a delay of one hour, then two hours, then four hours, and
44757 so on (this is a rather extreme example).
44760 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
44761 They happen every 30 minutes for 24 hours only. The remaining two rules handle
44762 all other domains, with special action for connection refusal from hosts that
44763 were not obtained from an MX record.
44766 The final rule in a retry configuration should always have asterisks in the
44767 first two fields so as to provide a general catch-all for any addresses that do
44768 not have their own special handling. This example tries every 15 minutes for 2
44769 hours, then with intervals starting at one hour and increasing by a factor of
44770 1.5 up to 16 hours, then every 8 hours up to 5 days.
44773 <section id="SECID165">
44774 <title>Timeout of retry data</title>
44776 <indexterm role="concept">
44777 <primary>timeout</primary>
44778 <secondary>of retry data</secondary>
44780 <indexterm role="option">
44781 <primary><option>retry_data_expire</option></primary>
44783 <indexterm role="concept">
44784 <primary>hints database</primary>
44785 <secondary>data expiry</secondary>
44787 <indexterm role="concept">
44788 <primary>retry</primary>
44789 <secondary>timeout of data</secondary>
44791 Exim timestamps the data that it writes to its retry hints database. When it
44792 consults the data during a delivery it ignores any that is older than the value
44793 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn’t
44794 been tried for 7 days, Exim will try to deliver to it immediately a message
44795 arrives, and if that fails, it will calculate a retry time as if it were
44796 failing for the first time.
44799 This improves the behaviour for messages routed to rarely-used hosts such as MX
44800 backups. If such a host was down at one time, and happens to be down again when
44801 Exim tries a month later, using the old retry data would imply that it had been
44802 down all the time, which is not a justified assumption.
44805 If a host really is permanently dead, this behaviour causes a burst of retries
44806 every now and again, but only if messages routed to it are rare. If there is a
44807 message at least once every 7 days the retry data never expires.
44810 <section id="SECID166">
44811 <title>Long-term failures</title>
44813 <indexterm role="concept">
44814 <primary>delivery failure, long-term</primary>
44816 <indexterm role="concept">
44817 <primary>retry</primary>
44818 <secondary>after long-term failure</secondary>
44820 Special processing happens when an email address has been failing for so long
44821 that the cutoff time for the last algorithm is reached. For example, using the
44822 default retry rule:
44824 <literallayout class="monospaced">
44825 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
44828 the cutoff time is four days. Reaching the retry cutoff is independent of how
44829 long any specific message has been failing; it is the length of continuous
44830 failure for the recipient address that counts.
44833 When the cutoff time is reached for a local delivery, or for all the IP
44834 addresses associated with a remote delivery, a subsequent delivery failure
44835 causes Exim to give up on the address, and a bounce message is generated.
44836 In order to cater for new messages that use the failing address, a next retry
44837 time is still computed from the final algorithm, and is used as follows:
44840 For local deliveries, one delivery attempt is always made for any subsequent
44841 messages. If this delivery fails, the address fails immediately. The
44842 post-cutoff retry time is not used.
44845 If the delivery is remote, there are two possibilities, controlled by the
44846 <indexterm role="option">
44847 <primary><option>delay_after_cutoff</option></primary>
44849 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
44850 default. Until the post-cutoff retry time for one of the IP addresses is
44851 reached, the failing email address is bounced immediately, without a delivery
44852 attempt taking place. After that time, one new delivery attempt is made to
44853 those IP addresses that are past their retry times, and if that still fails,
44854 the address is bounced and new retry times are computed.
44857 In other words, when all the hosts for a given email address have been failing
44858 for a long time, Exim bounces rather then defers until one of the hosts’ retry
44859 times is reached. Then it tries once, and bounces if that attempt fails. This
44860 behaviour ensures that few resources are wasted in repeatedly trying to deliver
44861 to a broken destination, but if the host does recover, Exim will eventually
44865 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
44866 addresses are past their final cutoff time, Exim tries to deliver to those IP
44867 addresses that have not been tried since the message arrived. If there are
44868 no suitable IP addresses, or if they all fail, the address is bounced. In other
44869 words, it does not delay when a new message arrives, but tries the expired
44870 addresses immediately, unless they have been tried since the message arrived.
44871 If there is a continuous stream of messages for the failing domains, setting
44872 <option>delay_after_cutoff</option> false means that there will be many more attempts to
44873 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
44877 <section id="SECID167">
44878 <title>Deliveries that work intermittently</title>
44880 <indexterm role="concept">
44881 <primary>retry</primary>
44882 <secondary>intermittently working deliveries</secondary>
44884 Some additional logic is needed to cope with cases where a host is
44885 intermittently available, or when a message has some attribute that prevents
44886 its delivery when others to the same address get through. In this situation,
44887 because some messages are successfully delivered, the <quote>retry clock</quote> for the
44888 host or address keeps getting reset by the successful deliveries, and so
44889 failing messages remain on the queue for ever because the cutoff time is never
44893 Two exceptional actions are applied to prevent this happening. The first
44894 applies to errors that are related to a message rather than a remote host.
44895 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
44896 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
44897 commands, and quota failures. For this type of error, if a message’s arrival
44898 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
44899 is used when scanning the retry rules to decide when to try next and when to
44900 time out the address.
44903 The exceptional second action applies in all cases. If a message has been on
44904 the queue for longer than the cutoff time of any applicable retry rule for a
44905 given address, a delivery is attempted for that address, even if it is not yet
44906 time, and if this delivery fails, the address is timed out. A new retry time is
44907 not computed in this case, so that other messages for the same address are
44908 considered immediately.
44909 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
44910 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
44915 <chapter id="CHAPSMTPAUTH">
44916 <title>SMTP authentication</title>
44918 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
44919 <primary>SMTP</primary>
44920 <secondary>authentication configuration</secondary>
44922 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
44923 <primary>authentication</primary>
44925 The <quote>authenticators</quote> section of Exim’s run time configuration is concerned
44926 with SMTP authentication. This facility is an extension to the SMTP protocol,
44927 described in RFC 2554, which allows a client SMTP host to authenticate itself
44928 to a server. This is a common way for a server to recognize clients that are
44929 permitted to use it as a relay. SMTP authentication is not of relevance to the
44930 transfer of mail between servers that have no managerial connection with each
44934 <indexterm role="concept">
44935 <primary>AUTH</primary>
44936 <secondary>description of</secondary>
44938 Very briefly, the way SMTP authentication works is as follows:
44943 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
44944 the client’s EHLO command.
44949 The client issues an AUTH command, naming a specific mechanism. The command
44950 may, optionally, contain some authentication data.
44955 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
44956 appropriate responses. In simple authentication mechanisms, the challenges are
44957 just prompts for user names and passwords. The server does not have to issue
44958 any challenges – in some mechanisms the relevant data may all be transmitted
44959 with the AUTH command.
44964 The server either accepts or denies authentication.
44969 If authentication succeeds, the client may optionally make use of the AUTH
44970 option on the MAIL command to pass an authenticated sender in subsequent
44971 mail transactions. Authentication lasts for the remainder of the SMTP
44977 If authentication fails, the client may give up, or it may try a different
44978 authentication mechanism, or it may try transferring mail over the
44979 unauthenticated connection.
44984 If you are setting up a client, and want to know which authentication
44985 mechanisms the server supports, you can use Telnet to connect to port 25 (the
44986 SMTP port) on the server, and issue an EHLO command. The response to this
44987 includes the list of supported mechanisms. For example:
44990 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
44991 <literal>Trying 192.168.34.25...</literal>
44992 <literal>Connected to server.example.</literal>
44993 <literal>Escape character is '^]'.</literal>
44994 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
44995 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
44996 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
44997 <literal>250-SIZE 52428800</literal>
44998 <literal>250-PIPELINING</literal>
44999 <literal>250-AUTH PLAIN</literal>
45000 <literal>250 HELP</literal>
45003 The second-last line of this example output shows that the server supports
45004 authentication using the PLAIN mechanism. In Exim, the different authentication
45005 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
45006 routers and transports, which authenticators are included in the binary is
45007 controlled by build-time definitions. The following are currently available,
45008 included by setting
45010 <literallayout class="monospaced">
45012 AUTH_CYRUS_SASL=yes
45017 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
45018 authentication mechanism (RFC 2195), and the second provides an interface to
45019 the Cyrus SASL authentication library. The third can be configured to support
45020 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
45021 not formally documented, but used by several MUAs. The fourth authenticator
45022 supports Microsoft’s <emphasis>Secure Password Authentication</emphasis> mechanism.
45025 The authenticators are configured using the same syntax as other drivers (see
45026 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
45027 authentication section need be present in the configuration file. Each
45028 authenticator can in principle have both server and client functions. When Exim
45029 is receiving SMTP mail, it is acting as a server; when it is sending out
45030 messages over SMTP, it is acting as a client. Authenticator configuration
45031 options are provided for use in both these circumstances.
45034 To make it clear which options apply to which situation, the prefixes
45035 <option>server_</option> and <option>client_</option> are used on option names that are specific to
45036 either the server or the client function, respectively. Server and client
45037 functions are disabled if none of their options are set. If an authenticator is
45038 to be used for both server and client functions, a single definition, using
45039 both sets of options, is required. For example:
45041 <literallayout class="monospaced">
45044 public_name = CRAM-MD5
45045 server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
45047 client_secret = secret2
45050 The <option>server_</option> option is used when Exim is acting as a server, and the
45051 <option>client_</option> options when it is acting as a client.
45054 Descriptions of the individual authenticators are given in subsequent chapters.
45055 The remainder of this chapter covers the generic options for the
45056 authenticators, followed by general discussion of the way authentication works
45059 <section id="SECID168">
45060 <title>Generic options for authenticators</title>
45062 <indexterm role="concept">
45063 <primary>authentication</primary>
45064 <secondary>generic options</secondary>
45066 <indexterm role="concept">
45067 <primary>options</primary>
45068 <secondary>generic; for authenticators</secondary>
45072 <indexterm role="option">
45073 <primary><option>client_condition</option></primary>
45076 <informaltable frame="all">
45077 <tgroup cols="4" colsep="0" rowsep="0">
45078 <colspec colwidth="8*" align="left"/>
45079 <colspec colwidth="6*" align="center"/>
45080 <colspec colwidth="6*" align="center"/>
45081 <colspec colwidth="6*" align="right"/>
45084 <entry><option>client_condition</option></entry>
45085 <entry>Use: <emphasis>authenticators</emphasis></entry>
45086 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45087 <entry>Default: <emphasis>unset</emphasis></entry>
45093 When Exim is authenticating as a client, it skips any authenticator whose
45094 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
45095 used, for example, to skip plain text authenticators when the connection is not
45096 encrypted by a setting such as:
45098 <literallayout class="monospaced">
45099 client_condition = ${if !eq{$tls_cipher}{}}
45102 (Older documentation incorrectly states that <varname>$tls_cipher</varname> contains the cipher
45103 used for incoming messages. In fact, during SMTP delivery, it contains the
45104 cipher used for the delivery.)
45107 <indexterm role="option">
45108 <primary><option>driver</option></primary>
45111 <informaltable frame="all">
45112 <tgroup cols="4" colsep="0" rowsep="0">
45113 <colspec colwidth="8*" align="left"/>
45114 <colspec colwidth="6*" align="center"/>
45115 <colspec colwidth="6*" align="center"/>
45116 <colspec colwidth="6*" align="right"/>
45119 <entry><option>driver</option></entry>
45120 <entry>Use: <emphasis>authenticators</emphasis></entry>
45121 <entry>Type: <emphasis>string</emphasis></entry>
45122 <entry>Default: <emphasis>unset</emphasis></entry>
45128 This option must always be set. It specifies which of the available
45129 authenticators is to be used.
45132 <indexterm role="option">
45133 <primary><option>public_name</option></primary>
45136 <informaltable frame="all">
45137 <tgroup cols="4" colsep="0" rowsep="0">
45138 <colspec colwidth="8*" align="left"/>
45139 <colspec colwidth="6*" align="center"/>
45140 <colspec colwidth="6*" align="center"/>
45141 <colspec colwidth="6*" align="right"/>
45144 <entry><option>public_name</option></entry>
45145 <entry>Use: <emphasis>authenticators</emphasis></entry>
45146 <entry>Type: <emphasis>string</emphasis></entry>
45147 <entry>Default: <emphasis>unset</emphasis></entry>
45153 This option specifies the name of the authentication mechanism that the driver
45154 implements, and by which it is known to the outside world. These names should
45155 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
45156 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
45157 defaults to the driver’s instance name.
45160 <indexterm role="option">
45161 <primary><option>server_advertise_condition</option></primary>
45164 <informaltable frame="all">
45165 <tgroup cols="4" colsep="0" rowsep="0">
45166 <colspec colwidth="8*" align="left"/>
45167 <colspec colwidth="6*" align="center"/>
45168 <colspec colwidth="6*" align="center"/>
45169 <colspec colwidth="6*" align="right"/>
45172 <entry><option>server_advertise_condition</option></entry>
45173 <entry>Use: <emphasis>authenticators</emphasis></entry>
45174 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45175 <entry>Default: <emphasis>unset</emphasis></entry>
45181 When a server is about to advertise an authentication mechanism, the condition
45182 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
45183 mechanism is not advertised.
45184 If the expansion fails, the mechanism is not advertised. If the failure was not
45185 forced, and was not caused by a lookup defer, the incident is logged.
45186 See section <xref linkend="SECTauthexiser"/> below for further discussion.
45189 <indexterm role="option">
45190 <primary><option>server_condition</option></primary>
45193 <informaltable frame="all">
45194 <tgroup cols="4" colsep="0" rowsep="0">
45195 <colspec colwidth="8*" align="left"/>
45196 <colspec colwidth="6*" align="center"/>
45197 <colspec colwidth="6*" align="center"/>
45198 <colspec colwidth="6*" align="right"/>
45201 <entry><option>server_condition</option></entry>
45202 <entry>Use: <emphasis>authenticators</emphasis></entry>
45203 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45204 <entry>Default: <emphasis>unset</emphasis></entry>
45210 This option must be set for a <option>plaintext</option> server authenticator, where it
45211 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
45215 For the other authenticators, <option>server_condition</option> can be used as an additional
45216 authentication or authorization mechanism that is applied after the other
45217 authenticator conditions succeed. If it is set, it is expanded when the
45218 authenticator would otherwise return a success code. If the expansion is forced
45219 to fail, authentication fails. Any other expansion failure causes a temporary
45220 error code to be returned. If the result of a successful expansion is an empty
45221 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45222 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
45223 other result, a temporary error code is returned, with the expanded string as
45227 <indexterm role="option">
45228 <primary><option>server_debug_print</option></primary>
45231 <informaltable frame="all">
45232 <tgroup cols="4" colsep="0" rowsep="0">
45233 <colspec colwidth="8*" align="left"/>
45234 <colspec colwidth="6*" align="center"/>
45235 <colspec colwidth="6*" align="center"/>
45236 <colspec colwidth="6*" align="right"/>
45239 <entry><option>server_debug_print</option></entry>
45240 <entry>Use: <emphasis>authenticators</emphasis></entry>
45241 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45242 <entry>Default: <emphasis>unset</emphasis></entry>
45248 If this option is set and authentication debugging is enabled (see the <option>-d</option>
45249 command line option), the string is expanded and included in the debugging
45250 output when the authenticator is run as a server. This can help with checking
45251 out the values of variables.
45252 If expansion of the string fails, the error message is written to the debugging
45253 output, and Exim carries on processing.
45256 <indexterm role="option">
45257 <primary><option>server_set_id</option></primary>
45260 <informaltable frame="all">
45261 <tgroup cols="4" colsep="0" rowsep="0">
45262 <colspec colwidth="8*" align="left"/>
45263 <colspec colwidth="6*" align="center"/>
45264 <colspec colwidth="6*" align="center"/>
45265 <colspec colwidth="6*" align="right"/>
45268 <entry><option>server_set_id</option></entry>
45269 <entry>Use: <emphasis>authenticators</emphasis></entry>
45270 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45271 <entry>Default: <emphasis>unset</emphasis></entry>
45277 <indexterm role="variable">
45278 <primary><varname>$authenticated_id</varname></primary>
45280 When an Exim server successfully authenticates a client, this string is
45281 expanded using data from the authentication, and preserved for any incoming
45282 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
45283 lines for incoming messages. For example, a user/password authenticator
45284 configuration might preserve the user name that was used to authenticate, and
45285 refer to it subsequently during delivery of the message.
45286 If expansion fails, the option is ignored.
45289 <indexterm role="option">
45290 <primary><option>server_mail_auth_condition</option></primary>
45293 <informaltable frame="all">
45294 <tgroup cols="4" colsep="0" rowsep="0">
45295 <colspec colwidth="8*" align="left"/>
45296 <colspec colwidth="6*" align="center"/>
45297 <colspec colwidth="6*" align="center"/>
45298 <colspec colwidth="6*" align="right"/>
45301 <entry><option>server_mail_auth_condition</option></entry>
45302 <entry>Use: <emphasis>authenticators</emphasis></entry>
45303 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45304 <entry>Default: <emphasis>unset</emphasis></entry>
45310 This option allows a server to discard authenticated sender addresses supplied
45311 as part of MAIL commands in SMTP connections that are authenticated by the
45312 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
45313 as part of the authentication process; instead its (unexpanded) value is
45314 remembered for later use.
45315 How it is used is described in the following section.
45318 <section id="SECTauthparamail">
45319 <title>The AUTH parameter on MAIL commands</title>
45321 <indexterm role="concept">
45322 <primary>authentication</primary>
45323 <secondary>sender; authenticated</secondary>
45325 <indexterm role="concept">
45326 <primary>AUTH</primary>
45327 <secondary>on MAIL command</secondary>
45329 When a client supplied an AUTH= item on a MAIL command, Exim applies
45330 the following checks before accepting it as the authenticated sender of the
45336 If the connection is not using extended SMTP (that is, HELO was used rather
45337 than EHLO), the use of AUTH= is a syntax error.
45342 If the value of the AUTH= parameter is <quote><></quote>, it is ignored.
45347 <indexterm role="variable">
45348 <primary><varname>$authenticated_sender</varname></primary>
45350 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
45351 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
45352 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
45353 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
45354 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
45355 given for the MAIL command.
45360 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
45361 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
45367 If the AUTH= value was accepted by either of the two previous rules, and
45368 the client has authenticated, and the authenticator has a setting for the
45369 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
45370 valued that was saved from the authenticator is expanded. If the expansion
45371 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
45372 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
45373 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
45379 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
45380 hosts to which Exim authenticates as a client. Do not confuse this value with
45381 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
45382 process, and which is not usually a complete email address.
45385 <indexterm role="variable">
45386 <primary><varname>$sender_address</varname></primary>
45388 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
45389 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
45390 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
45391 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
45395 <section id="SECTauthexiser">
45396 <title>Authentication on an Exim server</title>
45398 <indexterm role="concept">
45399 <primary>authentication</primary>
45400 <secondary>on an Exim server</secondary>
45402 When Exim receives an EHLO command, it advertises the public names of those
45403 authenticators that are configured as servers, subject to the following
45409 The client host must match <option>auth_advertise_hosts</option> (default *).
45414 It the <option>server_advertise_condition</option> option is set, its expansion must not
45415 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
45420 The order in which the authenticators are defined controls the order in which
45421 the mechanisms are advertised.
45424 Some mail clients (for example, some versions of Netscape) require the user to
45425 provide a name and password for authentication whenever AUTH is advertised,
45426 even though authentication may not in fact be needed (for example, Exim may be
45427 set up to allow unconditional relaying from the client by an IP address check).
45428 You can make such clients more friendly by not advertising AUTH to them.
45429 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
45430 that runs for RCPT) to relay without authentication, you should set
45432 <literallayout class="monospaced">
45433 auth_advertise_hosts = ! 10.9.8.0/24
45436 so that no authentication mechanisms are advertised to them.
45439 The <option>server_advertise_condition</option> controls the advertisement of individual
45440 authentication mechanisms. For example, it can be used to restrict the
45441 advertisement of a particular mechanism to encrypted connections, by a setting
45444 <literallayout class="monospaced">
45445 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
45448 <indexterm role="variable">
45449 <primary><varname>$tls_cipher</varname></primary>
45451 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
45452 yields <quote>yes</quote>, which allows the advertisement to happen.
45455 When an Exim server receives an AUTH command from a client, it rejects it
45456 immediately if AUTH was not advertised in response to an earlier EHLO
45457 command. This is the case if
45462 The client host does not match <option>auth_advertise_hosts</option>; or
45467 No authenticators are configured with server options; or
45472 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
45473 server authenticators.
45478 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
45479 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
45480 AUTH is accepted from any client host.
45483 If AUTH is not rejected by the ACL, Exim searches its configuration for a
45484 server authentication mechanism that was advertised in response to EHLO and
45485 that matches the one named in the AUTH command. If it finds one, it runs
45486 the appropriate authentication protocol, and authentication either succeeds or
45487 fails. If there is no matching advertised mechanism, the AUTH command is
45488 rejected with a 504 error.
45491 <indexterm role="variable">
45492 <primary><varname>$received_protocol</varname></primary>
45494 <indexterm role="variable">
45495 <primary><varname>$sender_host_authenticated</varname></primary>
45497 When a message is received from an authenticated host, the value of
45498 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
45499 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
45500 public name) of the authenticator driver that successfully authenticated the
45501 client from which the message was received. This variable is empty if there was
45502 no successful authentication.
45505 <section id="SECID169">
45506 <title>Testing server authentication</title>
45508 <indexterm role="concept">
45509 <primary>authentication</primary>
45510 <secondary>testing a server</secondary>
45512 <indexterm role="concept">
45513 <primary>AUTH</primary>
45514 <secondary>testing a server</secondary>
45516 <indexterm role="concept">
45517 <primary>base64 encoding</primary>
45518 <secondary>creating authentication test data</secondary>
45520 Exim’s <option>-bh</option> option can be useful for testing server authentication
45521 configurations. The data for the AUTH command has to be sent using base64
45522 encoding. A quick way to produce such data for testing is the following Perl
45525 <literallayout class="monospaced">
45527 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
45530 <indexterm role="concept">
45531 <primary>binary zero</primary>
45532 <secondary>in authentication data</secondary>
45534 This interprets its argument as a Perl string, and then encodes it. The
45535 interpretation as a Perl string allows binary zeros, which are required for
45536 some kinds of authentication, to be included in the data. For example, a
45537 command line to run this script on such data might be
45539 <literallayout class="monospaced">
45540 encode '\0user\0password'
45543 Note the use of single quotes to prevent the shell interpreting the
45544 backslashes, so that they can be interpreted by Perl to specify characters
45545 whose code value is zero.
45548 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
45549 digit, you must use three zeros instead of one after the leading backslash. If
45550 you do not, the octal digit that starts your string will be incorrectly
45551 interpreted as part of the code for the first character.
45554 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
45555 specially, you must use a Perl escape to prevent them being misinterpreted. For
45556 example, a command such as
45558 <literallayout class="monospaced">
45559 encode '\0user@domain.com\0pas$$word'
45562 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
45565 If you have the <option>mimencode</option> command installed, another way to do produce
45566 base64-encoded strings is to run the command
45568 <literallayout class="monospaced">
45569 echo -e -n `\0user\0password' | mimencode
45572 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
45573 in the argument, and the <option>-n</option> option specifies no newline at the end of its
45574 output. However, not all versions of <option>echo</option> recognize these options, so you
45575 should check your version before relying on this suggestion.
45578 <section id="SECID170">
45579 <title>Authentication by an Exim client</title>
45581 <indexterm role="concept">
45582 <primary>authentication</primary>
45583 <secondary>on an Exim client</secondary>
45585 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
45586 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
45587 announces support for authentication, and the host matches an entry in either
45588 of these options, Exim (as a client) tries to authenticate as follows:
45593 For each authenticator that is configured as a client, in the order in which
45594 they are defined in the configuration, it searches the authentication
45595 mechanisms announced by the server for one whose name matches the public name
45596 of the authenticator.
45601 <indexterm role="variable">
45602 <primary><varname>$host</varname></primary>
45604 <indexterm role="variable">
45605 <primary><varname>$host_address</varname></primary>
45607 When it finds one that matches, it runs the authenticator’s client code. The
45608 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
45609 that the client might do. They are set to the server’s name and IP address. If
45610 any expansion is forced to fail, the authentication attempt is abandoned, and
45611 Exim moves on to the next authenticator. Otherwise an expansion failure causes
45612 delivery to be deferred.
45617 If the result of the authentication attempt is a temporary error or a timeout,
45618 Exim abandons trying to send the message to the host for the moment. It will
45619 try again later. If there are any backup hosts available, they are tried in the
45625 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
45626 carries on searching the list of authenticators and tries another one if
45627 possible. If all authentication attempts give permanent errors, or if there are
45628 no attempts because no mechanisms match (or option expansions force failure),
45629 what happens depends on whether the host matches <option>hosts_require_auth</option> or
45630 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
45631 delivery is deferred. The error can be detected in the retry rules, and thereby
45632 turned into a permanent error if you wish. In the second case, Exim tries to
45633 deliver the message unauthenticated.
45638 <indexterm role="concept">
45639 <primary>AUTH</primary>
45640 <secondary>on MAIL command</secondary>
45642 When Exim has authenticated itself to a remote server, it adds the AUTH
45643 parameter to the MAIL commands it sends, if it has an authenticated sender for
45644 the message. If the message came from a remote host, the authenticated sender
45645 is the one that was receiving on an incoming MAIL command, provided that the
45646 incoming connection was authenticated and the <option>server_mail_auth</option> condition
45647 allowed the authenticated sender to be retained. If a local process calls Exim
45648 to send a message, the sender address that is built from the login name and
45649 <option>qualify_domain</option> is treated as authenticated. However, if the
45650 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
45651 the authenticated sender that was received with the message.
45652 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
45653 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
45658 <chapter id="CHAPplaintext">
45659 <title>The plaintext authenticator</title>
45661 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
45662 <primary><command>plaintext</command> authenticator</primary>
45664 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
45665 <primary>authenticators</primary>
45666 <secondary><command>plaintext</command></secondary>
45668 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
45669 LOGIN authentication mechanisms, both of which transfer authentication data as
45670 plain (unencrypted) text (though base64 encoded). The use of plain text is a
45671 security risk; you are strongly advised to insist on the use of SMTP encryption
45672 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
45673 use unencrypted plain text, you should not use the same passwords for SMTP
45674 connections as you do for login accounts.
45676 <section id="SECID171">
45677 <title>Plaintext options</title>
45679 <indexterm role="concept">
45680 <primary>options</primary>
45681 <secondary><command>plaintext</command> authenticator (server)</secondary>
45683 When configured as a server, <command>plaintext</command> uses the following options:
45686 <indexterm role="option">
45687 <primary><option>server_condition</option></primary>
45690 <informaltable frame="all">
45691 <tgroup cols="4" colsep="0" rowsep="0">
45692 <colspec colwidth="8*" align="left"/>
45693 <colspec colwidth="6*" align="center"/>
45694 <colspec colwidth="6*" align="center"/>
45695 <colspec colwidth="6*" align="right"/>
45698 <entry><option>server_condition</option></entry>
45699 <entry>Use: <emphasis>authenticators</emphasis></entry>
45700 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
45701 <entry>Default: <emphasis>unset</emphasis></entry>
45707 This is actually a global authentication option, but it must be set in order to
45708 configure the <command>plaintext</command> driver as a server. Its use is described below.
45711 <indexterm role="option">
45712 <primary><option>server_prompts</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>server_prompts</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 contents of this option, after expansion, must be a colon-separated list of
45733 prompt strings. If expansion fails, a temporary authentication rejection is
45737 <section id="SECTplainserver">
45738 <title>Using plaintext in a server</title>
45740 <indexterm role="concept">
45741 <primary>AUTH</primary>
45742 <secondary>in <command>plaintext</command> authenticator</secondary>
45744 <indexterm role="concept">
45745 <primary>binary zero</primary>
45746 <secondary>in <command>plaintext</command> authenticator</secondary>
45748 <indexterm role="concept">
45749 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45750 <secondary>in <command>plaintext</command> authenticator</secondary>
45752 <indexterm role="variable">
45753 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
45755 <indexterm role="concept">
45756 <primary>base64 encoding</primary>
45757 <secondary>in <command>plaintext</command> authenticator</secondary>
45761 When running as a server, <command>plaintext</command> performs the authentication test by
45762 expanding a string. The data sent by the client with the AUTH command, or in
45763 response to subsequent prompts, is base64 encoded, and so may contain any byte
45764 values when decoded. If any data is supplied with the command, it is treated as
45765 a list of strings, separated by NULs (binary zeros), the first three of which
45766 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
45767 (neither LOGIN nor PLAIN uses more than three strings).
45770 For compatibility with previous releases of Exim, the values are also placed in
45771 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
45772 variables for this purpose is now deprecated, as it can lead to confusion in
45773 string expansions that also use them for other things.
45776 If there are more strings in <option>server_prompts</option> than the number of strings
45777 supplied with the AUTH command, the remaining prompts are used to obtain more
45778 data. Each response from the client may be a list of NUL-separated strings.
45781 <indexterm role="variable">
45782 <primary><varname>$authenticated_id</varname></primary>
45784 Once a sufficient number of data strings have been received,
45785 <option>server_condition</option> is expanded. If the expansion is forced to fail,
45786 authentication fails. Any other expansion failure causes a temporary error code
45787 to be returned. If the result of a successful expansion is an empty string,
45788 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
45789 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
45790 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
45791 For any other result, a temporary error code is returned, with the expanded
45792 string as the error text.
45795 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user’s
45796 password, be sure to make the authentication fail if the user is unknown.
45797 There are good and bad examples at the end of the next section.
45800 <section id="SECID172">
45801 <title>The PLAIN authentication mechanism</title>
45803 <indexterm role="concept">
45804 <primary>PLAIN authentication mechanism</primary>
45806 <indexterm role="concept">
45807 <primary>authentication</primary>
45808 <secondary>PLAIN mechanism</secondary>
45810 <indexterm role="concept">
45811 <primary>binary zero</primary>
45812 <secondary>in <command>plaintext</command> authenticator</secondary>
45814 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
45815 sent as one item of data (that is, one combined string containing two NUL
45816 separators). The data is sent either as part of the AUTH command, or
45817 subsequently in response to an empty prompt from the server.
45820 The second and third strings are a user name and a corresponding password.
45821 Using a single fixed user name and password as an example, this could be
45822 configured as follows:
45824 <literallayout class="monospaced">
45827 public_name = PLAIN
45829 server_condition = \
45830 ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
45831 server_set_id = $auth2
45834 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
45835 are exactly what we want here, so they need not be specified. Obviously, if the
45836 password contains expansion-significant characters such as dollar, backslash,
45837 or closing brace, they have to be escaped.
45840 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
45841 the end of a string list are ignored). If all the data comes as part of the
45842 AUTH command, as is commonly the case, the prompt is not used. This
45843 authenticator is advertised in the response to EHLO as
45845 <literallayout class="monospaced">
45849 and a client host can authenticate itself by sending the command
45851 <literallayout class="monospaced">
45852 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
45855 As this contains three strings (more than the number of prompts), no further
45856 data is required from the client. Alternatively, the client may just send
45858 <literallayout class="monospaced">
45862 to initiate authentication, in which case the server replies with an empty
45863 prompt. The client must respond with the combined data string.
45866 The data string is base64 encoded, as required by the RFC. This example,
45867 when decoded, is <<emphasis>NUL</emphasis>><literal>username</literal><<emphasis>NUL</emphasis>><literal>mysecret</literal>, where <<emphasis>NUL</emphasis>>
45868 represents a zero byte. This is split up into three strings, the first of which
45869 is empty. The <option>server_condition</option> option in the authenticator checks that the
45870 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
45873 Having just one fixed user name and password, as in this example, is not very
45874 realistic, though for a small organization with only a handful of
45875 authenticating clients it could make sense.
45878 A more sophisticated instance of this authenticator could use the user name in
45879 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
45880 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
45881 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
45882 This is an incorrect example:
45884 <literallayout class="monospaced">
45885 server_condition = \
45886 ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
45889 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
45890 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
45891 incorrect? It works fine for existing users, but consider what happens if a
45892 non-existent user name is given. The lookup fails, but as no success/failure
45893 strings are given for the lookup, it yields an empty string. Thus, to defeat
45894 the authentication, all a client has to do is to supply a non-existent user
45895 name and an empty password. The correct way of writing this test is:
45897 <literallayout class="monospaced">
45898 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
45899 {${if eq{$value}{$auth3}}} {false}}
45902 In this case, if the lookup succeeds, the result is checked; if the lookup
45903 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
45904 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
45905 always fails if its second argument is empty. However, the second way of
45906 writing the test makes the logic clearer.
45909 <section id="SECID173">
45910 <title>The LOGIN authentication mechanism</title>
45912 <indexterm role="concept">
45913 <primary>LOGIN authentication mechanism</primary>
45915 <indexterm role="concept">
45916 <primary>authentication</primary>
45917 <secondary>LOGIN mechanism</secondary>
45919 The LOGIN authentication mechanism is not documented in any RFC, but is in use
45920 in a number of programs. No data is sent with the AUTH command. Instead, a
45921 user name and password are supplied separately, in response to prompts. The
45922 plaintext authenticator can be configured to support this as in this example:
45924 <literallayout class="monospaced">
45927 public_name = LOGIN
45928 server_prompts = User Name : Password
45929 server_condition = \
45930 ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
45931 server_set_id = $auth1
45934 Because of the way plaintext operates, this authenticator accepts data supplied
45935 with the AUTH command (in contravention of the specification of LOGIN), but
45936 if the client does not supply it (as is the case for LOGIN clients), the prompt
45937 strings are used to obtain two data items.
45939 <para revisionflag="changed">
45940 Some clients are very particular about the precise text of the prompts. For
45941 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
45942 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
45943 strings. It uses the <option>ldapauth</option> expansion condition to check the user
45944 name and password by binding to an LDAP server:
45946 <literallayout class="monospaced" revisionflag="changed">
45949 public_name = LOGIN
45950 server_prompts = Username:: : Password::
45951 server_condition = ${if and{{ \
45953 ldapauth{user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
45954 pass=${quote:$auth2} \
45955 ldap://ldap.example.org/} }} }
45956 server_set_id = uid=$auth1,ou=people,o=example.org
45958 <para revisionflag="changed">
45959 We have to check that the username is not empty before using it, because LDAP
45960 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
45961 operator to correctly quote the DN for authentication. However, the basic
45962 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
45963 correct one to use for the password, because quoting is needed only to make
45964 the password conform to the Exim syntax. At the LDAP level, the password is an
45965 uninterpreted string.
45968 <section id="SECID174">
45969 <title>Support for different kinds of authentication</title>
45971 A number of string expansion features are provided for the purpose of
45972 interfacing to different ways of user authentication. These include checking
45973 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
45974 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
45975 <xref linkend="SECTexpcond"/>.
45978 <section id="SECID175">
45979 <title>Using plaintext in a client</title>
45981 <indexterm role="concept">
45982 <primary>options</primary>
45983 <secondary><command>plaintext</command> authenticator (client)</secondary>
45985 The <command>plaintext</command> authenticator has two client options:
45988 <indexterm role="option">
45989 <primary><option>client_ignore_invalid_base64</option></primary>
45992 <informaltable frame="all">
45993 <tgroup cols="4" colsep="0" rowsep="0">
45994 <colspec colwidth="8*" align="left"/>
45995 <colspec colwidth="6*" align="center"/>
45996 <colspec colwidth="6*" align="center"/>
45997 <colspec colwidth="6*" align="right"/>
46000 <entry><option>client_ignore_invalid_base64</option></entry>
46001 <entry>Use: <emphasis>plaintext</emphasis></entry>
46002 <entry>Type: <emphasis>boolean</emphasis></entry>
46003 <entry>Default: <emphasis>false</emphasis></entry>
46009 If the client receives a server prompt that is not a valid base64 string,
46010 authentication is abandoned by default. However, if this option is set true,
46011 the error in the challenge is ignored and the client sends the response as
46015 <indexterm role="option">
46016 <primary><option>client_send</option></primary>
46019 <informaltable frame="all">
46020 <tgroup cols="4" colsep="0" rowsep="0">
46021 <colspec colwidth="8*" align="left"/>
46022 <colspec colwidth="6*" align="center"/>
46023 <colspec colwidth="6*" align="center"/>
46024 <colspec colwidth="6*" align="right"/>
46027 <entry><option>client_send</option></entry>
46028 <entry>Use: <emphasis>plaintext</emphasis></entry>
46029 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46030 <entry>Default: <emphasis>unset</emphasis></entry>
46036 The string is a colon-separated list of authentication data strings. Each
46037 string is independently expanded before being sent to the server. The first
46038 string is sent with the AUTH command; any more strings are sent in response
46039 to prompts from the server. Before each string is expanded, the value of the
46040 most recent prompt is placed in the next <varname>$auth</varname><<emphasis>n</emphasis>> variable, starting
46041 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
46042 way. Thus, the prompt that is received in response to sending the first string
46043 (with the AUTH command) can be used in the expansion of the second string, and
46044 so on. If an invalid base64 string is received when
46045 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
46046 <varname>$auth</varname><<emphasis>n</emphasis>> variable.
46049 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
46050 splitting takes priority and happens first.
46053 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
46054 the data, further processing is applied to each string before it is sent. If
46055 there are any single circumflex characters in the string, they are converted to
46056 NULs. Should an actual circumflex be required as data, it must be doubled in
46060 This is an example of a client configuration that implements the PLAIN
46061 authentication mechanism with a fixed user name and password:
46063 <literallayout class="monospaced">
46066 public_name = PLAIN
46067 client_send = ^username^mysecret
46070 The lack of colons means that the entire text is sent with the AUTH
46071 command, with the circumflex characters converted to NULs. A similar example
46072 that uses the LOGIN mechanism is:
46074 <literallayout class="monospaced">
46077 public_name = LOGIN
46078 client_send = : username : mysecret
46081 The initial colon means that the first string is empty, so no data is sent with
46082 the AUTH command itself. The remaining strings are sent in response to
46084 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
46085 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
46090 <chapter id="CHID9">
46091 <title>The cram_md5 authenticator</title>
46093 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
46094 <primary><command>cram_md5</command> authenticator</primary>
46096 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
46097 <primary>authenticators</primary>
46098 <secondary><command>cram_md5</command></secondary>
46100 <indexterm role="concept">
46101 <primary>CRAM-MD5 authentication mechanism</primary>
46103 <indexterm role="concept">
46104 <primary>authentication</primary>
46105 <secondary>CRAM-MD5 mechanism</secondary>
46107 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
46108 sends a challenge string to the client, and the response consists of a user
46109 name and the CRAM-MD5 digest of the challenge string combined with a secret
46110 string (password) which is known to both server and client. Thus, the secret
46111 is not sent over the network as plain text, which makes this authenticator more
46112 secure than <command>plaintext</command>. However, the downside is that the secret has to be
46113 available in plain text at either end.
46115 <section id="SECID176">
46116 <title>Using cram_md5 as a server</title>
46118 <indexterm role="concept">
46119 <primary>options</primary>
46120 <secondary><command>cram_md5</command> authenticator (server)</secondary>
46122 This authenticator has one server option, which must be set to configure the
46123 authenticator as a server:
46126 <indexterm role="option">
46127 <primary><option>server_secret</option></primary>
46130 <informaltable frame="all">
46131 <tgroup cols="4" colsep="0" rowsep="0">
46132 <colspec colwidth="8*" align="left"/>
46133 <colspec colwidth="6*" align="center"/>
46134 <colspec colwidth="6*" align="center"/>
46135 <colspec colwidth="6*" align="right"/>
46138 <entry><option>server_secret</option></entry>
46139 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46140 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46141 <entry>Default: <emphasis>unset</emphasis></entry>
46147 <indexterm role="concept">
46148 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46149 <secondary>in <command>cram_md5</command> authenticator</secondary>
46151 When the server receives the client’s response, the user name is placed in
46152 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
46153 obtain the password for that user. The server then computes the CRAM-MD5 digest
46154 that the client should have sent, and checks that it received the correct
46155 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
46156 fails. If the expansion fails for some other reason, a temporary error code is
46157 returned to the client.
46160 For compatibility with previous releases of Exim, the user name is also placed
46161 in <varname>$1</varname>. However, the use of this variables for this purpose is now
46162 deprecated, as it can lead to confusion in string expansions that also use
46163 numeric variables for other things.
46166 For example, the following authenticator checks that the user name given by the
46167 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
46168 user name, authentication fails.
46170 <literallayout class="monospaced">
46173 public_name = CRAM-MD5
46174 server_secret = ${if eq{$auth1}{ph10}{secret}fail}
46175 server_set_id = $auth1
46178 <indexterm role="variable">
46179 <primary><varname>$authenticated_id</varname></primary>
46181 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
46182 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
46183 secret string in a file, using the user name as the key. For example:
46185 <literallayout class="monospaced">
46188 public_name = CRAM-MD5
46189 server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
46191 server_set_id = $auth1
46194 Note that this expansion explicitly forces failure if the lookup fails
46195 because <varname>$auth1</varname> contains an unknown user name.
46198 <section id="SECID177">
46199 <title>Using cram_md5 as a client</title>
46201 <indexterm role="concept">
46202 <primary>options</primary>
46203 <secondary><command>cram_md5</command> authenticator (client)</secondary>
46205 When used as a client, the <command>cram_md5</command> authenticator has two options:
46208 <indexterm role="option">
46209 <primary><option>client_name</option></primary>
46212 <informaltable frame="all">
46213 <tgroup cols="4" colsep="0" rowsep="0">
46214 <colspec colwidth="8*" align="left"/>
46215 <colspec colwidth="6*" align="center"/>
46216 <colspec colwidth="6*" align="center"/>
46217 <colspec colwidth="6*" align="right"/>
46220 <entry><option>client_name</option></entry>
46221 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46222 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46223 <entry>Default: <emphasis>the primary host name</emphasis></entry>
46229 This string is expanded, and the result used as the user name data when
46230 computing the response to the server’s challenge.
46233 <indexterm role="option">
46234 <primary><option>client_secret</option></primary>
46237 <informaltable frame="all">
46238 <tgroup cols="4" colsep="0" rowsep="0">
46239 <colspec colwidth="8*" align="left"/>
46240 <colspec colwidth="6*" align="center"/>
46241 <colspec colwidth="6*" align="center"/>
46242 <colspec colwidth="6*" align="right"/>
46245 <entry><option>client_secret</option></entry>
46246 <entry>Use: <emphasis>cram_md5</emphasis></entry>
46247 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46248 <entry>Default: <emphasis>unset</emphasis></entry>
46254 This option must be set for the authenticator to work as a client. Its value is
46255 expanded and the result used as the secret string when computing the response.
46258 <indexterm role="variable">
46259 <primary><varname>$host</varname></primary>
46261 <indexterm role="variable">
46262 <primary><varname>$host_address</varname></primary>
46264 Different user names and secrets can be used for different servers by referring
46265 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
46266 expansion string is treated as an indication that this authenticator is not
46267 prepared to handle this case. Exim moves on to the next configured client
46268 authenticator. Any other expansion failure causes Exim to give up trying to
46269 send the message to the current server.
46272 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
46275 <literallayout class="monospaced">
46278 public_name = CRAM-MD5
46280 client_secret = secret
46283 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
46284 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
46289 <chapter id="CHID10">
46290 <title>The cyrus_sasl authenticator</title>
46292 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
46293 <primary><command>cyrus_sasl</command> authenticator</primary>
46295 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
46296 <primary>authenticators</primary>
46297 <secondary><command>cyrus_sasl</command></secondary>
46299 <indexterm role="concept">
46300 <primary>Cyrus</primary>
46301 <secondary>SASL library</secondary>
46303 <indexterm role="concept">
46304 <primary>Kerberos</primary>
46306 The code for this authenticator was provided by Matthew Byng-Maddick of A L
46307 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
46310 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
46311 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
46312 Layer</quote>). This library supports a number of authentication mechanisms,
46313 including PLAIN and LOGIN, but also several others that Exim does not support
46314 directly. In particular, there is support for Kerberos authentication.
46317 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
46318 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
46319 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
46320 name of the driver to determine which mechanism to support.
46323 Where access to some kind of secret file is required, for example in GSSAPI
46324 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
46325 user, and that the Cyrus SASL library has no way of escalating privileges
46326 by default. You may also find you need to set environment variables,
46327 depending on the driver you are using.
46330 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
46331 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
46332 Kerberos, note that because of limitations in the GSSAPI interface,
46333 changing the server keytab might need to be communicated down to the Kerberos
46334 layer independently. The mechanism for doing so is dependent upon the Kerberos
46335 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
46336 may be set to point to an alternative keytab file. Exim will pass this
46337 variable through from its own inherited environment when started as root or the
46338 Exim user. The keytab file needs to be readable by the Exim user.
46340 <section id="SECID178">
46341 <title>Using cyrus_sasl as a server</title>
46343 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
46344 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
46345 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
46346 use of this variable for this purpose is now deprecated, as it can lead to
46347 confusion in string expansions that also use numeric variables for other
46351 <indexterm role="option">
46352 <primary><option>server_hostname</option></primary>
46355 <informaltable frame="all">
46356 <tgroup cols="4" colsep="0" rowsep="0">
46357 <colspec colwidth="8*" align="left"/>
46358 <colspec colwidth="6*" align="center"/>
46359 <colspec colwidth="6*" align="center"/>
46360 <colspec colwidth="6*" align="right"/>
46363 <entry><option>server_hostname</option></entry>
46364 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46365 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46366 <entry>Default: <emphasis>see below</emphasis></entry>
46372 This option selects the hostname that is used when communicating with the
46373 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
46374 SASL plug-in what it does with this data.
46377 <indexterm role="option">
46378 <primary><option>server_mech</option></primary>
46381 <informaltable frame="all">
46382 <tgroup cols="4" colsep="0" rowsep="0">
46383 <colspec colwidth="8*" align="left"/>
46384 <colspec colwidth="6*" align="center"/>
46385 <colspec colwidth="6*" align="center"/>
46386 <colspec colwidth="6*" align="right"/>
46389 <entry><option>server_mech</option></entry>
46390 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46391 <entry>Type: <emphasis>string</emphasis></entry>
46392 <entry>Default: <emphasis>see below</emphasis></entry>
46398 This option selects the authentication mechanism this driver should use. The
46399 default is the value of the generic <option>public_name</option> option. This option allows
46400 you to use a different underlying mechanism from the advertised name. For
46403 <literallayout class="monospaced">
46405 driver = cyrus_sasl
46406 public_name = X-ANYTHING
46407 server_mech = CRAM-MD5
46408 server_set_id = $auth1
46411 <indexterm role="option">
46412 <primary><option>server_realm</option></primary>
46415 <informaltable frame="all">
46416 <tgroup cols="4" colsep="0" rowsep="0">
46417 <colspec colwidth="8*" align="left"/>
46418 <colspec colwidth="6*" align="center"/>
46419 <colspec colwidth="6*" align="center"/>
46420 <colspec colwidth="6*" align="right"/>
46423 <entry><option>server_realm</option></entry>
46424 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46425 <entry>Type: <emphasis>string</emphasis></entry>
46426 <entry>Default: <emphasis>unset</emphasis></entry>
46432 This specifies the SASL realm that the server claims to be in.
46435 <indexterm role="option">
46436 <primary><option>server_service</option></primary>
46439 <informaltable frame="all">
46440 <tgroup cols="4" colsep="0" rowsep="0">
46441 <colspec colwidth="8*" align="left"/>
46442 <colspec colwidth="6*" align="center"/>
46443 <colspec colwidth="6*" align="center"/>
46444 <colspec colwidth="6*" align="right"/>
46447 <entry><option>server_service</option></entry>
46448 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
46449 <entry>Type: <emphasis>string</emphasis></entry>
46450 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
46456 This is the SASL service that the server claims to implement.
46459 For straightforward cases, you do not need to set any of the authenticator’s
46460 private options. All you need to do is to specify an appropriate mechanism as
46461 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
46462 PLAIN, you could have two authenticators as follows:
46464 <literallayout class="monospaced">
46466 driver = cyrus_sasl
46467 public_name = CRAM-MD5
46468 server_set_id = $auth1
46471 driver = cyrus_sasl
46472 public_name = PLAIN
46473 server_set_id = $auth2
46476 Cyrus SASL does implement the LOGIN authentication method, even though it is
46477 not a standard method. It is disabled by default in the source distribution,
46478 but it is present in many binary distributions.
46479 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
46480 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
46485 <chapter id="CHAPdovecot">
46486 <title>The dovecot authenticator</title>
46488 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
46489 <primary><command>dovecot</command> authenticator</primary>
46491 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
46492 <primary>authenticators</primary>
46493 <secondary><command>dovecot</command></secondary>
46495 This authenticator is an interface to the authentication facility of the
46496 Dovecot POP/IMAP server, which can support a number of authentication methods.
46497 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
46498 to use the same mechanisms for SMTP authentication. This is a server
46499 authenticator only. There is only one option:
46502 <indexterm role="option">
46503 <primary><option>server_socket</option></primary>
46506 <informaltable frame="all">
46507 <tgroup cols="4" colsep="0" rowsep="0">
46508 <colspec colwidth="8*" align="left"/>
46509 <colspec colwidth="6*" align="center"/>
46510 <colspec colwidth="6*" align="center"/>
46511 <colspec colwidth="6*" align="right"/>
46514 <entry><option>server_socket</option></entry>
46515 <entry>Use: <emphasis>dovecot</emphasis></entry>
46516 <entry>Type: <emphasis>string</emphasis></entry>
46517 <entry>Default: <emphasis>unset</emphasis></entry>
46523 This option must specify the socket that is the interface to Dovecot
46524 authentication. The <option>public_name</option> option must specify an authentication
46525 mechanism that Dovecot is configured to support. You can have several
46526 authenticators for different mechanisms. For example:
46528 <literallayout class="monospaced">
46531 public_name = PLAIN
46532 server_socket = /var/run/dovecot/auth-client
46533 server_set_id = $auth2
46538 server_socket = /var/run/dovecot/auth-client
46539 server_set_id = $auth1
46542 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
46543 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
46544 option is passed in the Dovecot authentication command. If, for a TLS
46545 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
46546 option is passed. When authentication succeeds, the identity of the user
46547 who authenticated is placed in <varname>$auth1</varname>.
46548 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
46549 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
46553 <chapter id="CHAPspa">
46554 <title>The spa authenticator</title>
46556 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
46557 <primary><command>spa</command> authenticator</primary>
46559 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
46560 <primary>authenticators</primary>
46561 <secondary><command>spa</command></secondary>
46563 <indexterm role="concept">
46564 <primary>authentication</primary>
46565 <secondary>Microsoft Secure Password</secondary>
46567 <indexterm role="concept">
46568 <primary>authentication</primary>
46569 <secondary>NTLM</secondary>
46571 <indexterm role="concept">
46572 <primary>Microsoft Secure Password Authentication</primary>
46574 <indexterm role="concept">
46575 <primary>NTLM authentication</primary>
46577 The <command>spa</command> authenticator provides client support for Microsoft’s <emphasis>Secure
46578 Password Authentication</emphasis> mechanism,
46579 which is also sometimes known as NTLM (NT LanMan). The code for client side of
46580 this authenticator was contributed by Marc Prud’hommeaux, and much of it is
46581 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
46582 server side was subsequently contributed by Tom Kistner. The mechanism works as
46588 After the AUTH command has been accepted, the client sends an SPA
46589 authentication request based on the user name and optional domain.
46594 The server sends back a challenge.
46599 The client builds a challenge response which makes use of the user’s password
46600 and sends it to the server, which then accepts or rejects it.
46605 Encryption is used to protect the password in transit.
46607 <section id="SECID179">
46608 <title>Using spa as a server</title>
46610 <indexterm role="concept">
46611 <primary>options</primary>
46612 <secondary><command>spa</command> authenticator (server)</secondary>
46614 The <command>spa</command> authenticator has just one server option:
46617 <indexterm role="option">
46618 <primary><option>server_password</option></primary>
46621 <informaltable frame="all">
46622 <tgroup cols="4" colsep="0" rowsep="0">
46623 <colspec colwidth="8*" align="left"/>
46624 <colspec colwidth="6*" align="center"/>
46625 <colspec colwidth="6*" align="center"/>
46626 <colspec colwidth="6*" align="right"/>
46629 <entry><option>server_password</option></entry>
46630 <entry>Use: <emphasis>spa</emphasis></entry>
46631 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46632 <entry>Default: <emphasis>unset</emphasis></entry>
46638 <indexterm role="concept">
46639 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
46640 <secondary>in <command>spa</command> authenticator</secondary>
46642 This option is expanded, and the result must be the cleartext password for the
46643 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
46644 compatibility with previous releases of Exim, the user name is also placed in
46645 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
46646 it can lead to confusion in string expansions that also use numeric variables
46647 for other things. For example:
46649 <literallayout class="monospaced">
46653 server_password = \
46654 ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
46657 If the expansion is forced to fail, authentication fails. Any other expansion
46658 failure causes a temporary error code to be returned.
46661 <section id="SECID180">
46662 <title>Using spa as a client</title>
46664 <indexterm role="concept">
46665 <primary>options</primary>
46666 <secondary><command>spa</command> authenticator (client)</secondary>
46668 The <command>spa</command> authenticator has the following client options:
46671 <indexterm role="option">
46672 <primary><option>client_domain</option></primary>
46675 <informaltable frame="all">
46676 <tgroup cols="4" colsep="0" rowsep="0">
46677 <colspec colwidth="8*" align="left"/>
46678 <colspec colwidth="6*" align="center"/>
46679 <colspec colwidth="6*" align="center"/>
46680 <colspec colwidth="6*" align="right"/>
46683 <entry><option>client_domain</option></entry>
46684 <entry>Use: <emphasis>spa</emphasis></entry>
46685 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46686 <entry>Default: <emphasis>unset</emphasis></entry>
46692 This option specifies an optional domain for the authentication.
46695 <indexterm role="option">
46696 <primary><option>client_password</option></primary>
46699 <informaltable frame="all">
46700 <tgroup cols="4" colsep="0" rowsep="0">
46701 <colspec colwidth="8*" align="left"/>
46702 <colspec colwidth="6*" align="center"/>
46703 <colspec colwidth="6*" align="center"/>
46704 <colspec colwidth="6*" align="right"/>
46707 <entry><option>client_password</option></entry>
46708 <entry>Use: <emphasis>spa</emphasis></entry>
46709 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46710 <entry>Default: <emphasis>unset</emphasis></entry>
46716 This option specifies the user’s password, and must be set.
46719 <indexterm role="option">
46720 <primary><option>client_username</option></primary>
46723 <informaltable frame="all">
46724 <tgroup cols="4" colsep="0" rowsep="0">
46725 <colspec colwidth="8*" align="left"/>
46726 <colspec colwidth="6*" align="center"/>
46727 <colspec colwidth="6*" align="center"/>
46728 <colspec colwidth="6*" align="right"/>
46731 <entry><option>client_username</option></entry>
46732 <entry>Use: <emphasis>spa</emphasis></entry>
46733 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
46734 <entry>Default: <emphasis>unset</emphasis></entry>
46740 This option specifies the user name, and must be set. Here is an example of a
46741 configuration of this authenticator for use with the mail servers at
46742 <emphasis>msn.com</emphasis>:
46744 <literallayout class="monospaced">
46748 client_username = msn/msn_username
46749 client_password = msn_plaintext_password
46750 client_domain = DOMAIN_OR_UNSET
46753 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
46754 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
46759 <chapter id="CHAPTLS">
46760 <title>Encrypted SMTP connections using TLS/SSL</title>
46761 <titleabbrev>Encrypted SMTP connections</titleabbrev>
46763 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
46764 <primary>encryption</primary>
46765 <secondary>on SMTP connection</secondary>
46767 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
46768 <primary>SMTP</primary>
46769 <secondary>encryption</secondary>
46771 <indexterm role="concept">
46772 <primary>TLS</primary>
46773 <secondary>on SMTP connection</secondary>
46775 <indexterm role="concept">
46776 <primary>OpenSSL</primary>
46778 <indexterm role="concept">
46779 <primary>GnuTLS</primary>
46781 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
46782 Sockets Layer), is implemented by making use of the OpenSSL library or the
46783 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
46784 cryptographic code in the Exim distribution itself for implementing TLS. In
46785 order to use this feature you must install OpenSSL or GnuTLS, and then build a
46786 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
46787 You also need to understand the basic concepts of encryption at a managerial
46788 level, and in particular, the way that public keys, private keys, and
46789 certificates are used.
46792 RFC 3207 defines how SMTP connections can make use of encryption. Once a
46793 connection is established, the client issues a STARTTLS command. If the
46794 server accepts this, the client and the server negotiate an encryption
46795 mechanism. If the negotiation succeeds, the data that subsequently passes
46796 between them is encrypted.
46799 Exim’s ACLs can detect whether the current SMTP session is encrypted or not,
46800 and if so, what cipher suite is in use, whether the client supplied a
46801 certificate, and whether or not that certificate was verified. This makes it
46802 possible for an Exim server to deny or accept certain commands based on the
46806 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
46807 disrupt TLS connections. You need to turn off SMTP scanning for these products
46808 in order to get TLS to work.
46810 <section id="SECID284">
46811 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
46813 <indexterm role="concept">
46814 <primary>ssmtp protocol</primary>
46816 <indexterm role="concept">
46817 <primary>smtps protocol</primary>
46819 <indexterm role="concept">
46820 <primary>SMTP</primary>
46821 <secondary>ssmtp protocol</secondary>
46823 <indexterm role="concept">
46824 <primary>SMTP</primary>
46825 <secondary>smtps protocol</secondary>
46827 Early implementations of encrypted SMTP used a different TCP port from normal
46828 SMTP, and expected an encryption negotiation to start immediately, instead of
46829 waiting for a STARTTLS command from the client using the standard SMTP
46830 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
46831 allocated for this purpose.
46834 This approach was abandoned when encrypted SMTP was standardized, but there are
46835 still some legacy clients that use it. Exim supports these clients by means of
46836 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
46837 numbers; the most common use is expected to be:
46839 <literallayout class="monospaced">
46840 tls_on_connect_ports = 465
46843 The port numbers specified by this option apply to all SMTP connections, both
46844 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
46845 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
46846 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
46847 an extra port – rather, it specifies different behaviour on a port that is
46851 There is also a <option>-tls-on-connect</option> command line option. This overrides
46852 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
46855 <section id="SECTopenvsgnu">
46856 <title>OpenSSL vs GnuTLS</title>
46858 <indexterm role="concept">
46859 <primary>TLS</primary>
46860 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
46862 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
46863 followed later, when the first versions of GnuTLS were released. To build Exim
46864 to use GnuTLS, you need to set
46866 <literallayout class="monospaced">
46870 in Local/Makefile, in addition to
46872 <literallayout class="monospaced">
46876 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
46877 include files and libraries for GnuTLS can be found.
46880 There are some differences in usage when using GnuTLS instead of OpenSSL:
46885 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
46886 name of a directory (for OpenSSL it can be either).
46891 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
46892 facility for varying its Diffie-Hellman parameters. I understand that this has
46893 changed, but Exim has not been updated to provide this facility.
46898 <indexterm role="variable">
46899 <primary><varname>$tls_peerdn</varname></primary>
46901 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
46902 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
46903 affects the value of the <varname>$tls_peerdn</varname> variable.
46908 OpenSSL identifies cipher suites using hyphens as separators, for example:
46909 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
46910 more, OpenSSL complains if underscores are present in a cipher list. To make
46911 life simpler, Exim changes underscores to hyphens for OpenSSL and hyphens to
46912 underscores for GnuTLS when processing lists of cipher suites in the
46913 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
46919 The <option>tls_require_ciphers</option> options operate differently, as described in the
46920 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
46925 <section id="SECID181">
46926 <title>GnuTLS parameter computation</title>
46928 GnuTLS uses D-H parameters that may take a substantial amount of time
46929 to compute. It is unreasonable to re-compute them for every TLS session.
46930 Therefore, Exim keeps this data in a file in its spool directory, called
46931 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
46932 its owner. Every Exim process that start up GnuTLS reads the D-H
46933 parameters from this file. If the file does not exist, the first Exim process
46934 that needs it computes the data and writes it to a temporary file which is
46935 renamed once it is complete. It does not matter if several Exim processes do
46936 this simultaneously (apart from wasting a few resources). Once a file is in
46937 place, new Exim processes immediately start using it.
46940 For maximum security, the parameters that are stored in this file should be
46941 recalculated periodically, the frequency depending on your paranoia level.
46942 Arranging this is easy in principle; just delete the file when you want new
46943 values to be computed. However, there may be a problem. The calculation of new
46944 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
46945 If the system is not very active, <filename>/dev/random</filename> may delay returning data
46946 until enough randomness (entropy) is available. This may cause Exim to hang for
46947 a substantial amount of time, causing timeouts on incoming connections.
46950 The solution is to generate the parameters externally to Exim. They are stored
46951 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
46952 externally using the <command>certtool</command> command that is part of GnuTLS.
46955 To replace the parameters with new ones, instead of deleting the file
46956 and letting Exim re-create it, you can generate new parameters using
46957 <command>certtool</command> and, when this has been done, replace Exim’s cache file by
46958 renaming. The relevant commands are something like this:
46960 <literallayout class="monospaced">
46963 # chown exim:exim new-params
46964 # chmod 0400 new-params
46965 # certtool --generate-privkey --bits 512 >new-params
46966 # echo "" >>new-params
46967 # certtool --generate-dh-params --bits 1024 >> new-params
46968 # mv new-params gnutls-params
46971 If Exim never has to generate the parameters itself, the possibility of
46972 stalling is removed.
46975 <section id="SECTreqciphssl">
46976 <title>Requiring specific ciphers in OpenSSL</title>
46978 <indexterm role="concept">
46979 <primary>TLS</primary>
46980 <secondary>requiring specific ciphers (OpenSSL)</secondary>
46982 <indexterm role="option">
46983 <primary><option>tls_require_ciphers</option></primary>
46984 <secondary>OpenSSL</secondary>
46986 There is a function in the OpenSSL library that can be passed a list of cipher
46987 suites before the cipher negotiation takes place. This specifies which ciphers
46988 are acceptable. The list is colon separated and may contain names like
46989 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
46990 directly to this function call. The following quotation from the OpenSSL
46991 documentation specifies what forms of item are allowed in the cipher string:
46996 It can consist of a single cipher suite such as RC4-SHA.
47001 It can represent a list of cipher suites containing a certain algorithm,
47002 or cipher suites of a certain type. For example SHA1 represents all
47003 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
47009 Lists of cipher suites can be combined in a single cipher string using
47010 the + character. This is used as a logical and operation. For example
47011 SHA1+DES represents all cipher suites containing the SHA1 and the DES
47017 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
47018 <literal>-</literal> or <literal>+</literal>.
47023 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
47024 ciphers deleted can never reappear in the list even if they are explicitly
47030 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
47031 of the ciphers can be added again by later options.
47036 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
47037 option does not add any new ciphers; it just moves matching existing ones.
47042 If none of these characters is present, the string is interpreted as
47043 a list of ciphers to be appended to the current preference list. If the list
47044 includes any ciphers already present they will be ignored: that is, they will
47045 not be moved to the end of the list.
47048 <section id="SECTreqciphgnu">
47049 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
47051 <indexterm role="concept">
47052 <primary>GnuTLS</primary>
47053 <secondary>specifying parameters for</secondary>
47055 <indexterm role="concept">
47056 <primary>TLS</primary>
47057 <secondary>specifying ciphers (GnuTLS)</secondary>
47059 <indexterm role="concept">
47060 <primary>TLS</primary>
47061 <secondary>specifying key exchange methods (GnuTLS)</secondary>
47063 <indexterm role="concept">
47064 <primary>TLS</primary>
47065 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
47067 <indexterm role="concept">
47068 <primary>TLS</primary>
47069 <secondary>specifying protocols (GnuTLS)</secondary>
47071 <indexterm role="option">
47072 <primary><option>tls_require_ciphers</option></primary>
47073 <secondary>GnuTLS</secondary>
47075 The GnuTLS library allows the caller to specify separate lists of permitted key
47076 exchange methods, main cipher algorithms, MAC algorithms, and protocols.
47077 Unfortunately, these lists are numerical, and the library does not have a
47078 function for turning names into numbers. Consequently, lists of recognized
47079 names have to be built into the application. The permitted key exchange
47080 methods, ciphers, and MAC algorithms may be used in any combination to form a
47081 cipher suite. This is unlike OpenSSL, where complete cipher suite names are
47082 passed to its control function.
47085 For compatibility with OpenSSL, the <option>tls_require_ciphers</option> option can be set
47086 to complete cipher suite names such as RSA_ARCFOUR_SHA, but for GnuTLS this
47087 option controls only the cipher algorithms. Exim searches each item in the
47088 list for the name of an available algorithm. For example, if the list
47089 contains RSA_AES_SHA, then AES is recognized, and the behaviour is exactly
47090 the same as if just AES were given.
47093 <indexterm role="option">
47094 <primary><option>gnutls_require_kx</option></primary>
47096 <indexterm role="option">
47097 <primary><option>gnutls_require_mac</option></primary>
47099 <indexterm role="option">
47100 <primary><option>gnutls_require_protocols</option></primary>
47102 There are additional options called <option>gnutls_require_kx</option>,
47103 <option>gnutls_require_mac</option>, and <option>gnutls_require_protocols</option> that can be used to
47104 restrict the key exchange methods, MAC algorithms, and protocols, respectively.
47105 These options are ignored if OpenSSL is in use.
47108 All four options are available as global options, controlling how Exim
47109 behaves as a server, and also as options of the <command>smtp</command> transport, controlling
47110 how Exim behaves as a client. All the values are string expanded. After
47111 expansion, the values must be colon-separated lists, though the separator
47112 can be changed in the usual way.
47115 Each of the four lists starts out with a default set of algorithms. If the
47116 first item in a list does <emphasis>not</emphasis> start with an exclamation mark, all the
47117 default items are deleted. In this case, only those that are explicitly
47118 specified can be used. If the first item in a list <emphasis>does</emphasis> start with an
47119 exclamation mark, the defaults are left on the list.
47122 Then, any item that starts with an exclamation mark causes the relevant
47123 entry to be removed from the list, and any item that does not start with an
47124 exclamation mark causes a new entry to be added to the list. Unrecognized
47125 items in the list are ignored. Thus:
47127 <literallayout class="monospaced">
47128 tls_require_ciphers = !ARCFOUR
47131 allows all the defaults except ARCFOUR, whereas
47133 <literallayout class="monospaced">
47134 tls_require_ciphers = AES : 3DES
47137 allows only cipher suites that use AES or 3DES.
47140 For <option>tls_require_ciphers</option> the recognized names are AES_256, AES_128, AES
47141 (both of the preceding), 3DES, ARCFOUR_128, ARCFOUR_40, and ARCFOUR (both of
47142 the preceding). The default list does not contain all of these; it just has
47143 AES_256, AES_128, 3DES, and ARCFOUR_128.
47146 For <option>gnutls_require_kx</option>, the recognized names are DHE_RSA, RSA (which
47147 includes DHE_RSA), DHE_DSS, and DHE (which includes both DHE_RSA and
47148 DHE_DSS). The default list contains RSA, DHE_DSS, DHE_RSA.
47151 For <option>gnutls_require_mac</option>, the recognized names are SHA (synonym SHA1), and
47152 MD5. The default list contains SHA, MD5.
47155 For <option>gnutls_require_protocols</option>, the recognized names are TLS1 and SSL3.
47156 The default list contains TLS1, SSL3.
47159 In a server, the order of items in these lists is unimportant. The server
47160 advertises the availability of all the relevant cipher suites. However, in a
47161 client, the order in the <option>tls_require_ciphers</option> list specifies a preference
47162 order for the cipher algorithms. The first one in the client’s list that is
47163 also advertised by the server is tried first. The default order is as listed
47167 <section id="SECID182">
47168 <title>Configuring an Exim server to use TLS</title>
47170 <indexterm role="concept">
47171 <primary>TLS</primary>
47172 <secondary>configuring an Exim server</secondary>
47174 When Exim has been built with TLS support, it advertises the availability of
47175 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
47176 but not to any others. The default value of this option is unset, which means
47177 that STARTTLS is not advertised at all. This default is chosen because you
47178 need to set some other options in order to make TLS available, and also it is
47179 sensible for systems that want to use TLS only as a client.
47182 If a client issues a STARTTLS command and there is some configuration
47183 problem in the server, the command is rejected with a 454 error. If the client
47184 persists in trying to issue SMTP commands, all except QUIT are rejected
47187 <literallayout class="monospaced">
47188 554 Security failure
47191 If a STARTTLS command is issued within an existing TLS session, it is
47192 rejected with a 554 error code.
47195 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
47196 match some hosts. You can, of course, set it to * to match all hosts.
47197 However, this is not all you need to do. TLS sessions to a server won’t work
47198 without some further configuration at the server end.
47201 It is rumoured that all existing clients that support TLS/SSL use RSA
47202 encryption. To make this work you need to set, in the server,
47204 <literallayout class="monospaced">
47205 tls_certificate = /some/file/name
47206 tls_privatekey = /some/file/name
47209 These options are, in fact, expanded strings, so you can make them depend on
47210 the identity of the client that is connected if you wish. The first file
47211 contains the server’s X509 certificate, and the second contains the private key
47212 that goes with it. These files need to be readable by the Exim user, and must
47213 always be given as full path names. They can be the same file if both the
47214 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
47215 set, or if its expansion is forced to fail or results in an empty string, this
47216 is assumed to be the case. The certificate file may also contain intermediate
47217 certificates that need to be sent to the client to enable it to authenticate
47218 the server’s certificate.
47221 If you do not understand about certificates and keys, please try to find a
47222 source of this background information, which is not Exim-specific. (There are a
47223 few comments below in section <xref linkend="SECTcerandall"/>.)
47226 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client –
47227 they apply only in the case of a server. If you need to use a certificate in an
47228 Exim client, you must set the options of the same names in an <command>smtp</command>
47232 With just these options, an Exim server will be able to use TLS. It does not
47233 require the client to have a certificate (but see below for how to insist on
47234 this). There is one other option that may be needed in other situations. If
47236 <literallayout class="monospaced">
47237 tls_dhparam = /some/file/name
47240 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
47241 with the parameters contained in the file. This increases the set of cipher
47242 suites that the server supports. See the command
47244 <literallayout class="monospaced">
47248 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
47249 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
47252 The strings supplied for these three options are expanded every time a client
47253 host connects. It is therefore possible to use different certificates and keys
47254 for different hosts, if you so wish, by making use of the client’s IP address
47255 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
47256 forced to fail, Exim behaves as if the option is not set.
47259 <indexterm role="concept">
47260 <primary>cipher</primary>
47261 <secondary>logging</secondary>
47263 <indexterm role="concept">
47264 <primary>log</primary>
47265 <secondary>TLS cipher</secondary>
47267 <indexterm role="variable">
47268 <primary><varname>$tls_cipher</varname></primary>
47270 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
47271 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
47272 incoming message (by default – you can, of course, change this), and it is
47273 also included in the log line that records a message’s arrival, keyed by
47274 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
47275 condition can be used to test for specific cipher suites in ACLs.
47276 (For outgoing SMTP deliveries, <varname>$tls_cipher</varname> is reset – see section
47277 <xref linkend="SECID185"/>.)
47280 Once TLS has been established, the ACLs that run for subsequent SMTP commands
47281 can check the name of the cipher suite and vary their actions accordingly. The
47282 cipher suite names vary, depending on which TLS library is being used. For
47283 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
47284 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
47285 documentation for more details.
47288 <section id="SECID183">
47289 <title>Requesting and verifying client certificates</title>
47291 <indexterm role="concept">
47292 <primary>certificate</primary>
47293 <secondary>verification of client</secondary>
47295 <indexterm role="concept">
47296 <primary>TLS</primary>
47297 <secondary>client certificate verification</secondary>
47299 If you want an Exim server to request a certificate when negotiating a TLS
47300 session with a client, you must set either <option>tls_verify_hosts</option> or
47301 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
47302 apply to all TLS connections. For any host that matches one of these options,
47303 Exim requests a certificate as part of the setup of the TLS session. The
47304 contents of the certificate are verified by comparing it with a list of
47305 expected certificates. These must be available in a file or,
47306 for OpenSSL only (not GnuTLS), a directory, identified by
47307 <option>tls_verify_certificates</option>.
47310 A file can contain multiple certificates, concatenated end to end. If a
47313 each certificate must be in a separate file, with a name (or a symbolic link)
47314 of the form <<emphasis>hash</emphasis>>.0, where <<emphasis>hash</emphasis>> is a hash value constructed from the
47315 certificate. You can compute the relevant hash by running the command
47317 <literallayout class="monospaced">
47318 openssl x509 -hash -noout -in /cert/file
47321 where <filename>/cert/file</filename> contains a single certificate.
47324 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
47325 what happens if the client does not supply a certificate, or if the certificate
47326 does not match any of the certificates in the collection named by
47327 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
47328 attempt to set up a TLS session is aborted, and the incoming connection is
47329 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
47330 session continues. ACLs that run for subsequent SMTP commands can detect the
47331 fact that no certificate was verified, and vary their actions accordingly. For
47332 example, you can insist on a certificate before accepting a message for
47333 relaying, but not when the message is destined for local delivery.
47336 <indexterm role="variable">
47337 <primary><varname>$tls_peerdn</varname></primary>
47339 When a client supplies a certificate (whether it verifies or not), the value of
47340 the Distinguished Name of the certificate is made available in the variable
47341 <varname>$tls_peerdn</varname> during subsequent processing of the message.
47344 <indexterm role="concept">
47345 <primary>log</primary>
47346 <secondary>distinguished name</secondary>
47348 Because it is often a long text string, it is not included in the log line or
47349 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
47350 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
47351 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
47352 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
47355 <section id="SECID184">
47356 <title>Revoked certificates</title>
47358 <indexterm role="concept">
47359 <primary>TLS</primary>
47360 <secondary>revoked certificates</secondary>
47362 <indexterm role="concept">
47363 <primary>revocation list</primary>
47365 <indexterm role="concept">
47366 <primary>certificate</primary>
47367 <secondary>revocation list</secondary>
47369 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
47370 certificates are revoked. If you have such a list, you can pass it to an Exim
47371 server using the global option called <option>tls_crl</option> and to an Exim client using
47372 an identically named option for the <command>smtp</command> transport. In each case, the value
47373 of the option is expanded and must then be the name of a file that contains a
47377 <section id="SECID185">
47378 <title>Configuring an Exim client to use TLS</title>
47380 <indexterm role="concept">
47381 <primary>cipher</primary>
47382 <secondary>logging</secondary>
47384 <indexterm role="concept">
47385 <primary>log</primary>
47386 <secondary>TLS cipher</secondary>
47388 <indexterm role="concept">
47389 <primary>log</primary>
47390 <secondary>distinguished name</secondary>
47392 <indexterm role="concept">
47393 <primary>TLS</primary>
47394 <secondary>configuring an Exim client</secondary>
47396 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
47397 deliveries as well as to incoming, the latter one causing logging of the
47398 server certificate’s DN. The remaining client configuration for TLS is all
47399 within the <command>smtp</command> transport.
47402 It is not necessary to set any options to have TLS work in the <command>smtp</command>
47403 transport. If Exim is built with TLS support, and TLS is advertised by a
47404 server, the <command>smtp</command> transport always tries to start a TLS session. However,
47405 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
47406 transport) to a list of server hosts for which TLS should not be used.
47409 If you do not want Exim to attempt to send messages unencrypted when an attempt
47410 to set up an encrypted connection fails in any way, you can set
47411 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
47412 those hosts, delivery is always deferred if an encrypted connection cannot be
47413 set up. If there are any other hosts for the address, they are tried in the
47417 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
47418 the message unencrypted. It always does this if the response to STARTTLS is
47419 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
47420 session after a success response code, what happens is controlled by the
47421 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
47422 delivery to this host is deferred, and other hosts (if available) are tried. If
47423 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
47424 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
47425 negotiation fails, Exim closes the current connection (because it is in an
47426 unknown state), opens a new one to the same host, and then tries the delivery
47430 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
47431 transport provide the client with a certificate, which is passed to the server
47432 if it requests it. If the server is Exim, it will request a certificate only if
47433 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
47436 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
47437 must name a file or,
47438 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
47439 expected server certificates. The client verifies the server’s certificate
47440 against this collection, taking into account any revoked certificates that are
47441 in the list defined by <option>tls_crl</option>.
47445 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
47446 list of permitted cipher suites. If either of these checks fails, delivery to
47447 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
47448 alternative hosts, if any.
47451 <emphasis role="bold">Note</emphasis>:
47452 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
47453 is operating as a client. Exim does not assume that a server certificate (set
47454 by the global options of the same name) should also be used when operating as a
47458 <indexterm role="variable">
47459 <primary><varname>$host</varname></primary>
47461 <indexterm role="variable">
47462 <primary><varname>$host_address</varname></primary>
47464 All the TLS options in the <command>smtp</command> transport are expanded before use, with
47465 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
47466 which the client is connected. Forced failure of an expansion causes Exim to
47467 behave as if the relevant option were unset.
47470 <indexterm role="variable">
47471 <primary><varname>$tls_cipher</varname></primary>
47473 <indexterm role="variable">
47474 <primary><varname>$tls_peerdn</varname></primary>
47476 Before an SMTP connection is established, the <varname>$tls_cipher</varname> and <varname>$tls_peerdn</varname>
47477 variables are emptied. (Until the first connection, they contain the values
47478 that were set when the message was received.) If STARTTLS is subsequently
47479 successfully obeyed, these variables are set to the relevant values for the
47480 outgoing connection.
47483 <section id="SECTmulmessam">
47484 <title>Multiple messages on the same encrypted TCP/IP connection</title>
47486 <indexterm role="concept">
47487 <primary>multiple SMTP deliveries with TLS</primary>
47489 <indexterm role="concept">
47490 <primary>TLS</primary>
47491 <secondary>multiple message deliveries</secondary>
47493 Exim sends multiple messages down the same TCP/IP connection by starting up
47494 an entirely new delivery process for each message, passing the socket from
47495 one process to the next. This implementation does not fit well with the use
47496 of TLS, because there is quite a lot of state information associated with a TLS
47497 connection, not just a socket identification. Passing all the state information
47498 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
47499 session before passing the socket to a new process. The new process may then
47500 try to start a new TLS session, and if successful, may try to re-authenticate
47501 if AUTH is in use, before sending the next message.
47504 The RFC is not clear as to whether or not an SMTP session continues in clear
47505 after TLS has been shut down, or whether TLS may be restarted again later, as
47506 just described. However, if the server is Exim, this shutdown and
47507 reinitialization works. It is not known which (if any) other servers operate
47508 successfully if the client closes a TLS session and continues with unencrypted
47509 SMTP, but there are certainly some that do not work. For such servers, Exim
47510 should not pass the socket to another process, because the failure of the
47511 subsequent attempt to use it would cause Exim to record a temporary host error,
47512 and delay other deliveries to that host.
47515 To test for this case, Exim sends an EHLO command to the server after
47516 closing down the TLS session. If this fails in any way, the connection is
47517 closed instead of being passed to a new delivery process, but no retry
47518 information is recorded.
47521 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
47522 <command>smtp</command> transport to match those hosts for which Exim should not pass
47523 connections to new processes if TLS has been used.
47526 <section id="SECTcerandall">
47527 <title>Certificates and all that</title>
47529 <indexterm role="concept">
47530 <primary>certificate</primary>
47531 <secondary>references to discussion</secondary>
47533 In order to understand fully how TLS works, you need to know about
47534 certificates, certificate signing, and certificate authorities. This is not the
47535 place to give a tutorial, especially as I do not know very much about it
47536 myself. Some helpful introduction can be found in the FAQ for the SSL addition
47537 to Apache, currently at
47540 <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>
47543 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
47544 links to further files.
47545 Eric Rescorla’s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
47546 0-201-61598-3), contains both introductory and more in-depth descriptions.
47547 Some sample programs taken from the book are available from
47550 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
47553 <section id="SECID186">
47554 <title>Certificate chains</title>
47556 The file named by <option>tls_certificate</option> may contain more than one
47557 certificate. This is useful in the case where the certificate that is being
47558 sent is validated by an intermediate certificate which the other end does
47559 not have. Multiple certificates must be in the correct order in the file.
47560 First the host’s certificate itself, then the first intermediate
47561 certificate to validate the issuer of the host certificate, then the next
47562 intermediate certificate to validate the issuer of the first intermediate
47563 certificate, and so on, until finally (optionally) the root certificate.
47564 The root certificate must already be trusted by the recipient for
47565 validation to succeed, of course, but if it’s not preinstalled, sending the
47566 root certificate along with the rest makes it available for the user to
47567 install if the receiving end is a client MUA that can interact with a user.
47570 <section id="SECID187">
47571 <title>Self-signed certificates</title>
47573 <indexterm role="concept">
47574 <primary>certificate</primary>
47575 <secondary>self-signed</secondary>
47577 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
47578 with OpenSSL, like this:
47580 <literallayout class="monospaced">
47581 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
47585 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
47586 delimited and so can be identified independently. The <option>-days</option> option
47587 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
47588 important: if you do not set it, the key is encrypted with a passphrase
47589 that you are prompted for, and any use that is made of the key causes more
47590 prompting for the passphrase. This is not helpful if you are going to use
47591 this certificate and key in an MTA, where prompting is not possible.
47594 A self-signed certificate made in this way is sufficient for testing, and
47595 may be adequate for all your requirements if you are mainly interested in
47596 encrypting transfers, and not in secure identification.
47599 However, many clients require that the certificate presented by the server be a
47600 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
47601 certificate. In this situation, the self-signed certificate described above
47602 must be installed on the client host as a trusted root <emphasis>certification
47603 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
47604 signed with that self-signed certificate.
47607 For information on creating self-signed CA certificates and using them to sign
47608 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
47609 Open-source PKI book, available online at
47610 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
47611 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
47612 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
47617 <chapter id="CHAPACL">
47618 <title>Access control lists</title>
47620 <indexterm role="concept" id="IIDacl" class="startofrange">
47621 <primary>access control lists (ACLs)</primary>
47622 <secondary>description</secondary>
47624 <indexterm role="concept">
47625 <primary>control of incoming mail</primary>
47627 <indexterm role="concept">
47628 <primary>message</primary>
47629 <secondary>controlling incoming</secondary>
47631 <indexterm role="concept">
47632 <primary>policy control</primary>
47633 <secondary>access control lists</secondary>
47635 Access Control Lists (ACLs) are defined in a separate section of the run time
47636 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
47637 name, terminated by a colon. Here is a complete ACL section that contains just
47638 one very small ACL:
47640 <literallayout class="monospaced">
47643 accept hosts = one.host.only
47646 You can have as many lists as you like in the ACL section, and the order in
47647 which they appear does not matter. The lists are self-terminating.
47650 The majority of ACLs are used to control Exim’s behaviour when it receives
47651 certain SMTP commands. This applies both to incoming TCP/IP connections, and
47652 when a local process submits a message using SMTP by specifying the <option>-bs</option>
47653 option. The most common use is for controlling which recipients are accepted
47654 in incoming messages. In addition, you can define an ACL that is used to check
47655 local non-SMTP messages. The default configuration file contains an example of
47656 a realistic ACL for checking RCPT commands. This is discussed in chapter
47657 <xref linkend="CHAPdefconfil"/>.
47659 <section id="SECID188">
47660 <title>Testing ACLs</title>
47662 The <option>-bh</option> command line option provides a way of testing your ACL
47663 configuration locally by running a fake SMTP session with which you interact.
47664 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
47665 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
47668 <section id="SECID189">
47669 <title>Specifying when ACLs are used</title>
47671 <indexterm role="concept">
47672 <primary>access control lists (ACLs)</primary>
47673 <secondary>options for specifying</secondary>
47675 In order to cause an ACL to be used, you have to name it in one of the relevant
47676 options in the main part of the configuration. These options are:
47677 <indexterm role="concept">
47678 <primary>AUTH</primary>
47679 <secondary>ACL for</secondary>
47681 <indexterm role="concept">
47682 <primary>DATA</primary>
47683 <secondary>ACLs for</secondary>
47685 <indexterm role="concept">
47686 <primary>ETRN</primary>
47687 <secondary>ACL for</secondary>
47689 <indexterm role="concept">
47690 <primary>EXPN</primary>
47691 <secondary>ACL for</secondary>
47693 <indexterm role="concept">
47694 <primary>HELO</primary>
47695 <secondary>ACL for</secondary>
47697 <indexterm role="concept">
47698 <primary>EHLO</primary>
47699 <secondary>ACL for</secondary>
47701 <indexterm role="concept">
47702 <primary>MAIL</primary>
47703 <secondary>ACL for</secondary>
47705 <indexterm role="concept">
47706 <primary>QUIT, ACL for</primary>
47708 <indexterm role="concept">
47709 <primary>RCPT</primary>
47710 <secondary>ACL for</secondary>
47712 <indexterm role="concept">
47713 <primary>STARTTLS, ACL for</primary>
47715 <indexterm role="concept">
47716 <primary>VRFY</primary>
47717 <secondary>ACL for</secondary>
47719 <indexterm role="concept">
47720 <primary>SMTP</primary>
47721 <secondary>connection, ACL for</secondary>
47723 <indexterm role="concept">
47724 <primary>non-SMTP messages</primary>
47725 <secondary>ACLs for</secondary>
47727 <indexterm role="concept">
47728 <primary>MIME content scanning</primary>
47729 <secondary>ACL for</secondary>
47732 <informaltable frame="none">
47733 <tgroup cols="2" colsep="0" rowsep="0">
47734 <colspec colwidth="140pt" align="left"/>
47735 <colspec colwidth="254pt" align="left"/>
47738 <entry> <option>acl_not_smtp</option></entry>
47739 <entry>ACL for non-SMTP messages</entry>
47742 <entry> <option>acl_not_smtp_mime</option></entry>
47743 <entry>ACL for non-SMTP MIME parts</entry>
47746 <entry> <option>acl_not_smtp_start</option></entry>
47747 <entry>ACL at start of non-SMTP message</entry>
47750 <entry> <option>acl_smtp_auth</option></entry>
47751 <entry>ACL for AUTH</entry>
47754 <entry> <option>acl_smtp_connect</option></entry>
47755 <entry>ACL for start of SMTP connection</entry>
47758 <entry> <option>acl_smtp_data</option></entry>
47759 <entry>ACL after DATA is complete</entry>
47762 <entry> <option>acl_smtp_etrn</option></entry>
47763 <entry>ACL for ETRN</entry>
47766 <entry> <option>acl_smtp_expn</option></entry>
47767 <entry>ACL for EXPN</entry>
47770 <entry> <option>acl_smtp_helo</option></entry>
47771 <entry>ACL for HELO or EHLO</entry>
47774 <entry> <option>acl_smtp_mail</option></entry>
47775 <entry>ACL for MAIL</entry>
47778 <entry> <option>acl_smtp_mailauth</option></entry>
47779 <entry>ACL for the AUTH parameter of MAIL</entry>
47782 <entry> <option>acl_smtp_mime</option></entry>
47783 <entry>ACL for content-scanning MIME parts</entry>
47786 <entry> <option>acl_smtp_notquit</option></entry>
47787 <entry>ACL for non-QUIT terminations</entry>
47790 <entry> <option>acl_smtp_predata</option></entry>
47791 <entry>ACL at start of DATA command</entry>
47794 <entry> <option>acl_smtp_quit</option></entry>
47795 <entry>ACL for QUIT</entry>
47798 <entry> <option>acl_smtp_rcpt</option></entry>
47799 <entry>ACL for RCPT</entry>
47802 <entry> <option>acl_smtp_starttls</option></entry>
47803 <entry>ACL for STARTTLS</entry>
47806 <entry> <option>acl_smtp_vrfy</option></entry>
47807 <entry>ACL for VRFY</entry>
47813 For example, if you set
47815 <literallayout class="monospaced">
47816 acl_smtp_rcpt = small_acl
47819 the little ACL defined above is used whenever Exim receives a RCPT command
47820 in an SMTP dialogue. The majority of policy tests on incoming messages can be
47821 done when RCPT commands arrive. A rejection of RCPT should cause the
47822 sending MTA to give up on the recipient address contained in the RCPT
47823 command, whereas rejection at other times may cause the client MTA to keep on
47824 trying to deliver the message. It is therefore recommended that you do as much
47825 testing as possible at RCPT time.
47828 <section id="SECID190">
47829 <title>The non-SMTP ACLs</title>
47831 <indexterm role="concept">
47832 <primary>non-SMTP messages</primary>
47833 <secondary>ACLs for</secondary>
47835 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
47836 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
47837 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
47838 the state of the SMTP connection such as encryption and authentication) are not
47839 relevant and are forbidden in these ACLs. However, the sender and recipients
47840 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
47841 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
47842 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
47843 in any of these ACLs.
47846 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
47847 non-SMTP message, before any of the message has been read. (This is the
47848 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
47849 batched SMTP input, it runs after the DATA command has been reached. The
47850 result of this ACL is ignored; it cannot be used to reject a message. If you
47851 really need to, you could set a value in an ACL variable here and reject based
47852 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
47853 controls, and in particular, it can be used to set
47855 <literallayout class="monospaced">
47856 control = suppress_local_fixups
47859 This cannot be used in the other non-SMTP ACLs because by the time they are
47860 run, it is too late.
47863 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
47864 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47867 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
47868 kind of rejection is treated as permanent, because there is no way of sending a
47869 temporary error for these kinds of message.
47872 <section id="SECID191">
47873 <title>The SMTP connect ACL</title>
47875 <indexterm role="concept">
47876 <primary>SMTP</primary>
47877 <secondary>connection, ACL for</secondary>
47879 <indexterm role="option">
47880 <primary><option>smtp_banner</option></primary>
47882 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
47883 session, after the test specified by <option>host_reject_connection</option> (which is now
47884 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
47885 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
47886 the message override the banner message that is otherwise specified by the
47887 <option>smtp_banner</option> option.
47890 <section id="SECID192">
47891 <title>The EHLO/HELO ACL</title>
47893 <indexterm role="concept">
47894 <primary>EHLO</primary>
47895 <secondary>ACL for</secondary>
47897 <indexterm role="concept">
47898 <primary>HELO</primary>
47899 <secondary>ACL for</secondary>
47901 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
47902 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
47903 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
47904 Note that a client may issue more than one EHLO or HELO command in an SMTP
47905 session, and indeed is required to issue a new EHLO or HELO after successfully
47906 setting up encryption following a STARTTLS command.
47909 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
47910 modifier, the message may not contain more than one line (it will be truncated
47911 at the first newline and a panic logged if it does). Such a message cannot
47912 affect the EHLO options that are listed on the second and subsequent lines of
47916 <section id="SECID193">
47917 <title>The DATA ACLs</title>
47919 <indexterm role="concept">
47920 <primary>DATA</primary>
47921 <secondary>ACLs for</secondary>
47923 Two ACLs are associated with the DATA command, because it is two-stage
47924 command, with two responses being sent to the client.
47925 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
47926 is obeyed. This gives you control after all the RCPT commands, but before
47927 the message itself is received. It offers the opportunity to give a negative
47928 response to the DATA command before the data is transmitted. Header lines
47929 added by MAIL or RCPT ACLs are not visible at this time, but any that
47930 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
47933 You cannot test the contents of the message, for example, to verify addresses
47934 in the headers, at RCPT time or when the DATA command is received. Such
47935 tests have to appear in the ACL that is run after the message itself has been
47936 received, before the final response to the DATA command is sent. This is
47937 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
47938 associated with the DATA command.
47941 For both of these ACLs, it is not possible to reject individual recipients. An
47942 error response rejects the entire message. Unfortunately, it is known that some
47943 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
47944 before or after the data) correctly – they keep the message on their queues
47945 and try again later, but that is their problem, though it does waste some of
47949 <section id="SECTDKIMACL" revisionflag="changed">
47950 <title>The SMTP DKIM ACL</title>
47951 <para revisionflag="changed">
47952 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
47953 enabled (which is the default).
47955 <para revisionflag="changed">
47956 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
47957 received, and is executed for each DKIM signature found in a message. If not
47958 otherwise specified, the default action is to accept.
47960 <para revisionflag="changed">
47961 For details on the operation of DKIM, see chapter <xref linkend="CHID12"/>.
47964 <section id="SECID194">
47965 <title>The SMTP MIME ACL</title>
47967 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
47968 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
47971 <section id="SECTQUITACL">
47972 <title>The QUIT ACL</title>
47974 <indexterm role="concept">
47975 <primary>QUIT, ACL for</primary>
47977 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
47978 does not affect the response code to QUIT, which is always 221. Thus, the ACL
47979 does not in fact control any access. For this reason, the only verbs that are
47980 permitted are <option>accept</option> and <option>warn</option>.
47983 This ACL can be used for tasks such as custom logging at the end of an SMTP
47984 session. For example, you can use ACL variables in other ACLs to count
47985 messages, recipients, etc., and log the totals at QUIT time using one or
47986 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
47989 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
47990 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
47993 You do not need to have a final <option>accept</option>, but if you do, you can use a
47994 <option>message</option> modifier to specify custom text that is sent as part of the 221
47998 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
47999 failure (for example, failure to open a log file, or when Exim is bombing out
48000 because it has detected an unrecoverable error), all SMTP commands from the
48001 client are given temporary error responses until QUIT is received or the
48002 connection is closed. In these special cases, the QUIT ACL does not run.
48005 <section id="SECTNOTQUITACL">
48006 <title>The not-QUIT ACL</title>
48008 <indexterm role="variable">
48009 <primary><varname>$acl_smtp_notquit</varname></primary>
48011 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
48012 an SMTP session ends without sending QUIT. However, when Exim itself is is bad
48013 trouble, such as being unable to write to its log files, this ACL is not run,
48014 because it might try to do things (such as write to log files) that make the
48015 situation even worse.
48018 Like the QUIT ACL, this ACL is provided to make it possible to do customized
48019 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
48020 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
48021 and <option>warn</option>.
48024 <indexterm role="variable">
48025 <primary><varname>$smtp_notquit_reason</varname></primary>
48027 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
48028 to a string that indicates the reason for the termination of the SMTP
48029 connection. The possible values are:
48031 <informaltable frame="none">
48032 <tgroup cols="2" colsep="0" rowsep="0">
48033 <colspec colwidth="196pt" align="left"/>
48034 <colspec colwidth="254pt" align="left"/>
48037 <entry> <literal>acl-drop</literal></entry>
48038 <entry>Another ACL issued a <option>drop</option> command</entry>
48041 <entry> <literal>bad-commands</literal></entry>
48042 <entry>Too many unknown or non-mail commands</entry>
48045 <entry> <literal>command-timeout</literal></entry>
48046 <entry>Timeout while reading SMTP commands</entry>
48049 <entry> <literal>connection-lost</literal></entry>
48050 <entry>The SMTP connection has been lost</entry>
48053 <entry> <literal>data-timeout</literal></entry>
48054 <entry>Timeout while reading message data</entry>
48057 <entry> <literal>local-scan-error</literal></entry>
48058 <entry>The <function>local_scan()</function> function crashed</entry>
48061 <entry> <literal>local-scan-timeout</literal></entry>
48062 <entry>The <function>local_scan()</function> function timed out</entry>
48065 <entry> <literal>signal-exit</literal></entry>
48066 <entry>SIGTERM or SIGINT</entry>
48069 <entry> <literal>synchronization-error</literal></entry>
48070 <entry>SMTP synchronization error</entry>
48073 <entry> <literal>tls-failed</literal></entry>
48074 <entry>TLS failed to start</entry>
48080 In most cases when an SMTP connection is closed without having received QUIT,
48081 Exim sends an SMTP response message before actually closing the connection.
48082 With the exception of the <literal>acl-drop</literal> case, the default message can be
48083 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
48084 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
48088 <section id="SECID195">
48089 <title>Finding an ACL to use</title>
48091 <indexterm role="concept">
48092 <primary>access control lists (ACLs)</primary>
48093 <secondary>finding which to use</secondary>
48095 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
48096 you can use different ACLs in different circumstances. For example,
48098 <literallayout class="monospaced">
48099 acl_smtp_rcpt = ${if ={25}{$interface_port} \
48100 {acl_check_rcpt} {acl_check_rcpt_submit} }
48103 In the default configuration file there are some example settings for
48104 providing an RFC 4409 message submission service on port 587 and a
48105 non-standard <quote>smtps</quote> service on port 465. You can use a string
48106 expansion like this to choose an ACL for MUAs on these ports which is
48107 more appropriate for this purpose than the default ACL on port 25.
48110 The expanded string does not have to be the name of an ACL in the
48111 configuration file; there are other possibilities. Having expanded the
48112 string, Exim searches for an ACL as follows:
48117 If the string begins with a slash, Exim uses it as a file name, and reads its
48118 contents as an ACL. The lines are processed in the same way as lines in the
48119 Exim configuration file. In particular, continuation lines are supported, blank
48120 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
48121 If the file does not exist or cannot be read, an error occurs (typically
48122 causing a temporary failure of whatever caused the ACL to be run). For example:
48124 <literallayout class="monospaced">
48125 acl_smtp_data = /etc/acls/\
48126 ${lookup{$sender_host_address}lsearch\
48127 {/etc/acllist}{$value}{default}}
48130 This looks up an ACL file to use on the basis of the host’s IP address, falling
48131 back to a default if the lookup fails. If an ACL is successfully read from a
48132 file, it is retained in memory for the duration of the Exim process, so that it
48133 can be re-used without having to re-read the file.
48138 If the string does not start with a slash, and does not contain any spaces,
48139 Exim searches the ACL section of the configuration for an ACL whose name
48140 matches the string.
48145 If no named ACL is found, or if the string contains spaces, Exim parses
48146 the string as an inline ACL. This can save typing in cases where you just
48147 want to have something like
48149 <literallayout class="monospaced">
48150 acl_smtp_vrfy = accept
48153 in order to allow free use of the VRFY command. Such a string may contain
48154 newlines; it is processed in the same way as an ACL that is read from a file.
48159 <section id="SECID196">
48160 <title>ACL return codes</title>
48162 <indexterm role="concept">
48163 <primary>access control lists (ACLs)</primary>
48164 <secondary>return codes</secondary>
48166 Except for the QUIT ACL, which does not affect the SMTP return code (see
48167 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
48168 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
48169 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
48170 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
48171 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
48172 This also causes a 4<emphasis>xx</emphasis> return code.
48175 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
48176 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
48177 submitters of non-SMTP messages.
48180 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
48181 has the effect of <quote>accept</quote>, but causes either the entire message or an
48182 individual recipient address to be discarded. In other words, it is a
48183 blackholing facility. Use it with care.
48186 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
48187 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
48188 RCPT ACL is to discard just the one recipient address. If there are no
48189 recipients left when the message’s data is received, the DATA ACL is not
48190 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
48191 remaining recipients. The <quote>discard</quote> return is not permitted for the
48192 <option>acl_smtp_predata</option> ACL.
48195 <indexterm role="concept">
48196 <primary><function>local_scan()</function> function</primary>
48197 <secondary>when all recipients discarded</secondary>
48199 The <function>local_scan()</function> function is always run, even if there are no remaining
48200 recipients; it may create new recipients.
48203 <section id="SECID197">
48204 <title>Unset ACL options</title>
48206 <indexterm role="concept">
48207 <primary>access control lists (ACLs)</primary>
48208 <secondary>unset options</secondary>
48210 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
48211 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
48212 not defined at all. For any defined ACL, the default action when control
48213 reaches the end of the ACL statements is <quote>deny</quote>.
48216 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
48217 these two are ACLs that are used only for their side effects. They cannot be
48218 used to accept or reject anything.
48221 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
48222 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
48223 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
48224 when the ACL is not defined is <quote>accept</quote>.
48227 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
48228 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
48229 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
48230 messages over an SMTP connection. For an example, see the ACL in the default
48231 configuration file.
48234 <section id="SECID198">
48235 <title>Data for message ACLs</title>
48237 <indexterm role="concept">
48238 <primary>access control lists (ACLs)</primary>
48239 <secondary>data for message ACL</secondary>
48241 <indexterm role="variable">
48242 <primary><varname>$domain</varname></primary>
48244 <indexterm role="variable">
48245 <primary><varname>$local_part</varname></primary>
48247 <indexterm role="variable">
48248 <primary><varname>$sender_address</varname></primary>
48250 <indexterm role="variable">
48251 <primary><varname>$sender_host_address</varname></primary>
48253 <indexterm role="variable">
48254 <primary><varname>$smtp_command</varname></primary>
48256 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
48257 that contain information about the host and the message’s sender (for example,
48258 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
48259 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
48260 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
48261 is available in <varname>$smtp_command</varname>.
48264 When an ACL for the AUTH parameter of MAIL is running, the variables that
48265 contain information about the host are set, but <varname>$sender_address</varname> is not yet
48266 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
48270 <indexterm role="variable">
48271 <primary><varname>$message_size</varname></primary>
48273 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
48274 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
48275 that parameter is not given. The value is updated to the true message size by
48276 the time the final DATA ACL is run (after the message data has been
48280 <indexterm role="variable">
48281 <primary><varname>$rcpt_count</varname></primary>
48283 <indexterm role="variable">
48284 <primary><varname>$recipients_count</varname></primary>
48286 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
48287 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
48288 accepted, so while an ACL for RCPT is being processed, it contains the number
48289 of previously accepted recipients. At DATA time (for both the DATA ACLs),
48290 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
48291 <varname>$recipients_count</varname> contains the total number of accepted recipients.
48294 <section id="SECTdatfornon">
48295 <title>Data for non-message ACLs</title>
48297 <indexterm role="concept">
48298 <primary>access control lists (ACLs)</primary>
48299 <secondary>data for non-message ACL</secondary>
48301 <indexterm role="variable">
48302 <primary><varname>$smtp_command_argument</varname></primary>
48304 <indexterm role="variable">
48305 <primary><varname>$smtp_command</varname></primary>
48307 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
48308 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
48309 and the entire SMTP command is available in <varname>$smtp_command</varname>.
48310 These variables can be tested using a <option>condition</option> condition. For example,
48311 here is an ACL for use with AUTH, which insists that either the session is
48312 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
48313 does not permit authentication methods that use cleartext passwords on
48314 unencrypted connections.
48316 <literallayout class="monospaced">
48318 accept encrypted = *
48319 accept condition = ${if eq{${uc:$smtp_command_argument}}\
48321 deny message = TLS encryption or CRAM-MD5 required
48324 (Another way of applying this restriction is to arrange for the authenticators
48325 that use cleartext passwords not to be advertised when the connection is not
48326 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
48327 option to do this.)
48330 <section id="SECID199">
48331 <title>Format of an ACL</title>
48333 <indexterm role="concept">
48334 <primary>access control lists (ACLs)</primary>
48335 <secondary>format of</secondary>
48337 <indexterm role="concept">
48338 <primary>access control lists (ACLs)</primary>
48339 <secondary>verbs, definition of</secondary>
48341 An individual ACL consists of a number of statements. Each statement starts
48342 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
48343 Modifiers can change the way the verb operates, define error and log messages,
48344 set variables, insert delays, and vary the processing of accepted messages.
48347 If all the conditions are met, the verb is obeyed. The same condition may be
48348 used (with different arguments) more than once in the same statement. This
48349 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
48352 <literallayout class="monospaced">
48353 deny dnslists = list1.example
48354 dnslists = list2.example
48357 If there are no conditions, the verb is always obeyed. Exim stops evaluating
48358 the conditions and modifiers when it reaches a condition that fails. What
48359 happens then depends on the verb (and in one case, on a special modifier). Not
48360 all the conditions make sense at every testing point. For example, you cannot
48361 test a sender address in the ACL that is run for a VRFY command.
48364 <section id="SECID200">
48365 <title>ACL verbs</title>
48367 The ACL verbs are as follows:
48372 <indexterm role="concept">
48373 <primary><option>accept</option> ACL verb</primary>
48375 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
48376 of the conditions are not met, what happens depends on whether <option>endpass</option>
48377 appears among the conditions (for syntax see below). If the failing condition
48378 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
48379 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
48380 check a RCPT command:
48382 <literallayout class="monospaced">
48383 accept domains = +local_domains
48388 If the recipient domain does not match the <option>domains</option> condition, control
48389 passes to the next statement. If it does match, the recipient is verified, and
48390 the command is accepted if verification succeeds. However, if verification
48391 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
48392 <option>endpass</option>.
48395 The <option>endpass</option> feature has turned out to be confusing to many people, so its
48396 use is not recommended nowadays. It is always possible to rewrite an ACL so
48397 that <option>endpass</option> is not needed, and it is no longer used in the default
48401 <indexterm role="concept">
48402 <primary><option>message</option> ACL modifier</primary>
48403 <secondary>with <option>accept</option></secondary>
48405 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
48406 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
48407 (when an <option>accept</option> verb either accepts or passes control to the next
48408 statement), <option>message</option> can be used to vary the message that is sent when an
48409 SMTP command is accepted. For example, in a RCPT ACL you could have:
48412 <literal>accept </literal><<emphasis>some conditions</emphasis>>
48413 <literal> message = OK, I will allow you through today</literal>
48416 You can specify an SMTP response code, optionally followed by an <quote>extended
48417 response code</quote> at the start of the message, but the first digit must be the
48418 same as would be sent by default, which is 2 for an <option>accept</option> verb.
48421 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
48422 an error message that is used when access is denied. This behaviour is retained
48423 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
48424 of <option>endpass</option>.
48429 <indexterm role="concept">
48430 <primary><option>defer</option> ACL verb</primary>
48432 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
48433 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
48434 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
48435 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
48436 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
48437 be used in any ACL, and even for a recipient it might be a simpler approach.
48442 <indexterm role="concept">
48443 <primary><option>deny</option> ACL verb</primary>
48445 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
48446 the conditions are not met, control is passed to the next ACL statement. For
48449 <literallayout class="monospaced">
48450 deny dnslists = blackholes.mail-abuse.org
48453 rejects commands from hosts that are on a DNS black list.
48458 <indexterm role="concept">
48459 <primary><option>discard</option> ACL verb</primary>
48461 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
48462 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
48463 that are concerned with receiving messages. When all the conditions are true,
48464 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
48465 recipients to be discarded. If it is used in an ACL for RCPT, just the one
48466 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
48467 message’s recipients are discarded. Recipients that are discarded before DATA
48468 do not appear in the log line when the <option>received_recipients</option> log selector is set.
48471 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
48472 its contents are added to the line that is automatically written to the log.
48473 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
48478 <indexterm role="concept">
48479 <primary><option>drop</option> ACL verb</primary>
48481 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
48482 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
48484 <literallayout class="monospaced">
48485 drop message = I don't take more than 20 RCPTs
48486 condition = ${if > {$rcpt_count}{20}}
48489 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
48490 The connection is always dropped after sending a 550 response.
48495 <indexterm role="concept">
48496 <primary><option>require</option> ACL verb</primary>
48498 <option>require</option>: If all the conditions are met, control is passed to the next ACL
48499 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
48500 example, when checking a RCPT command,
48502 <literallayout class="monospaced">
48503 require message = Sender did not verify
48507 passes control to subsequent statements only if the message’s sender can be
48508 verified. Otherwise, it rejects the command. Note the positioning of the
48509 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
48510 discussed in section <xref linkend="SECTcondmodproc"/>.
48515 <indexterm role="concept">
48516 <primary><option>warn</option> ACL verb</primary>
48518 <option>warn</option>: If all the conditions are true, a line specified by the
48519 <option>log_message</option> modifier is written to Exim’s main log. Control always passes
48520 to the next ACL statement. If any condition is false, the log line is not
48521 written. If an identical log line is requested several times in the same
48522 message, only one copy is actually written to the log. If you want to force
48523 duplicates to be written, use the <option>logwrite</option> modifier instead.
48526 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
48527 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
48528 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
48529 condition. There is more about adding header lines in section
48530 <xref linkend="SECTaddheadacl"/>.
48533 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
48534 some sort of defer), the log line specified by <option>log_message</option> is not written.
48535 This does not include the case of a forced failure from a lookup, which
48536 is considered to be a successful completion. After a defer, no further
48537 conditions or modifiers in the <option>warn</option> statement are processed. The incident
48538 is logged, and the ACL continues to be processed, from the next statement
48542 <indexterm role="variable">
48543 <primary><varname>$acl_verify_message</varname></primary>
48545 When one of the <option>warn</option> conditions is an address verification that fails, the
48546 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
48547 want this logged, you must set it up explicitly. For example:
48549 <literallayout class="monospaced">
48550 warn !verify = sender
48551 log_message = sender verify failed: $acl_verify_message
48556 At the end of each ACL there is an implicit unconditional <option>deny</option>.
48559 As you can see from the examples above, the conditions and modifiers are
48560 written one to a line, with the first one on the same line as the verb, and
48561 subsequent ones on following lines. If you have a very long condition, you can
48562 continue it onto several physical lines by the usual backslash continuation
48563 mechanism. It is conventional to align the conditions vertically.
48566 <section id="SECTaclvariables">
48567 <title>ACL variables</title>
48569 <indexterm role="concept">
48570 <primary>access control lists (ACLs)</primary>
48571 <secondary>variables</secondary>
48573 There are some special variables that can be set during ACL processing. They
48574 can be used to pass information between different ACLs, different invocations
48575 of the same ACL in the same SMTP connection, and between ACLs and the routers,
48576 transports, and filters that are used to deliver a message. The names of these
48577 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
48578 an underscore, but the remainder of the name can be any sequence of
48579 alphanumeric characters and underscores that you choose. There is no limit on
48580 the number of ACL variables. The two sets act as follows:
48585 The values of those variables whose names begin with <varname>$acl_c</varname> persist
48586 throughout an SMTP connection. They are never reset. Thus, a value that is set
48587 while receiving one message is still available when receiving the next message
48588 on the same SMTP connection.
48593 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
48594 while a message is being received. They are reset afterwards. They are also
48595 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
48600 When a message is accepted, the current values of all the ACL variables are
48601 preserved with the message and are subsequently made available at delivery
48602 time. The ACL variables are set by a modifier called <option>set</option>. For example:
48604 <literallayout class="monospaced">
48605 accept hosts = whatever
48606 set acl_m4 = some value
48607 accept authenticated = *
48608 set acl_c_auth = yes
48611 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
48612 be set. If you want to set a variable without taking any action, you can use a
48613 <option>warn</option> verb without any other modifiers or conditions.
48616 <indexterm role="option">
48617 <primary><option>strict_acl_vars</option></primary>
48619 What happens if a syntactically valid but undefined ACL variable is
48620 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
48621 false (the default), an empty string is substituted; if it is true, an
48622 error is generated.
48625 Versions of Exim before 4.64 have a limited set of numbered variables, but
48626 their names are compatible, so there is no problem with upgrading.
48629 <section id="SECTcondmodproc">
48630 <title>Condition and modifier processing</title>
48632 <indexterm role="concept">
48633 <primary>access control lists (ACLs)</primary>
48634 <secondary>conditions; processing</secondary>
48636 <indexterm role="concept">
48637 <primary>access control lists (ACLs)</primary>
48638 <secondary>modifiers; processing</secondary>
48640 An exclamation mark preceding a condition negates its result. For example:
48642 <literallayout class="monospaced">
48643 deny domains = *.dom.example
48644 !verify = recipient
48647 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
48648 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
48649 negation can be used on the right-hand side of a condition. For example, these
48650 two statements are equivalent:
48652 <literallayout class="monospaced">
48653 deny hosts = !192.168.3.4
48654 deny !hosts = 192.168.3.4
48657 However, for many conditions (<option>verify</option> being a good example), only left-hand
48658 side negation of the whole condition is possible.
48661 The arguments of conditions and modifiers are expanded. A forced failure
48662 of an expansion causes a condition to be ignored, that is, it behaves as if the
48663 condition is true. Consider these two statements:
48665 <literallayout class="monospaced">
48666 accept senders = ${lookup{$host_name}lsearch\
48667 {/some/file}{$value}fail}
48668 accept senders = ${lookup{$host_name}lsearch\
48669 {/some/file}{$value}{}}
48672 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
48673 the returned list is searched, but if the lookup fails the behaviour is
48674 different in the two cases. The <option>fail</option> in the first statement causes the
48675 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
48676 therefore succeeds. The second statement, however, generates an empty list when
48677 the lookup fails. No sender can match an empty list, so the condition fails,
48678 and therefore the <option>accept</option> also fails.
48681 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
48682 specify actions that are taken as the conditions for a statement are checked;
48683 others specify text for messages that are used when access is denied or a
48684 warning is generated. The <option>control</option> modifier affects the way an incoming
48685 message is handled.
48688 The positioning of the modifiers in an ACL statement important, because the
48689 processing of a verb ceases as soon as its outcome is known. Only those
48690 modifiers that have already been encountered will take effect. For example,
48691 consider this use of the <option>message</option> modifier:
48693 <literallayout class="monospaced">
48694 require message = Can't verify sender
48696 message = Can't verify recipient
48698 message = This message cannot be used
48701 If sender verification fails, Exim knows that the result of the statement is
48702 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
48703 so its text is used as the error message. If sender verification succeeds, but
48704 recipient verification fails, the second message is used. If recipient
48705 verification succeeds, the third message becomes <quote>current</quote>, but is never used
48706 because there are no more conditions to cause failure.
48709 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
48710 modifier that is used, because all the conditions must be true for rejection to
48711 happen. Specifying more than one <option>message</option> modifier does not make sense, and
48712 the message can even be specified after all the conditions. For example:
48714 <literallayout class="monospaced">
48716 !senders = *@my.domain.example
48717 message = Invalid sender from client host
48720 The <quote>deny</quote> result does not happen until the end of the statement is reached,
48721 by which time Exim has set up the message.
48724 <section id="SECTACLmodi">
48725 <title>ACL modifiers</title>
48727 <indexterm role="concept">
48728 <primary>access control lists (ACLs)</primary>
48729 <secondary>modifiers; list of</secondary>
48731 The ACL modifiers are as follows:
48735 <term><emphasis role="bold">add_header</emphasis> = <<emphasis>text</emphasis>></term>
48738 This modifier specifies one or more header lines that are to be added to an
48739 incoming message, assuming, of course, that the message is ultimately
48740 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
48742 </listitem></varlistentry>
48744 <term><emphasis role="bold">continue</emphasis> = <<emphasis>text</emphasis>></term>
48747 <indexterm role="concept">
48748 <primary><option>continue</option> ACL modifier</primary>
48750 <indexterm role="concept">
48751 <primary>database</primary>
48752 <secondary>updating in ACL</secondary>
48754 This modifier does nothing of itself, and processing of the ACL always
48755 continues with the next condition or modifier. The value of <option>continue</option> is in
48756 the side effects of expanding its argument. Typically this could be used to
48757 update a database. It is really just a syntactic tidiness, to avoid having to
48758 write rather ugly lines like this:
48761 <literal>condition = ${if eq{0}{</literal><<emphasis>some expansion</emphasis>><literal>}{true}{true}}</literal>
48764 Instead, all you need is
48767 <literal>continue = </literal><<emphasis>some expansion</emphasis>>
48769 </listitem></varlistentry>
48771 <term><emphasis role="bold">control</emphasis> = <<emphasis>text</emphasis>></term>
48774 <indexterm role="concept">
48775 <primary><option>control</option> ACL modifier</primary>
48777 This modifier affects the subsequent processing of the SMTP connection or of an
48778 incoming message that is accepted. The effect of the first type of control
48779 lasts for the duration of the connection, whereas the effect of the second type
48780 lasts only until the current message has been received. The message-specific
48781 controls always apply to the whole message, not to individual recipients,
48782 even if the <option>control</option> modifier appears in a RCPT ACL.
48785 As there are now quite a few controls that can be applied, they are described
48786 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
48787 in several different ways. For example:
48792 It can be at the end of an <option>accept</option> statement:
48794 <literallayout class="monospaced">
48795 accept ...some conditions
48796 control = queue_only
48799 In this case, the control is applied when this statement yields <quote>accept</quote>, in
48800 other words, when the conditions are all true.
48805 It can be in the middle of an <option>accept</option> statement:
48807 <literallayout class="monospaced">
48808 accept ...some conditions...
48809 control = queue_only
48810 ...some more conditions...
48813 If the first set of conditions are true, the control is applied, even if the
48814 statement does not accept because one of the second set of conditions is false.
48815 In this case, some subsequent statement must yield <quote>accept</quote> for the control
48821 It can be used with <option>warn</option> to apply the control, leaving the
48822 decision about accepting or denying to a subsequent verb. For
48825 <literallayout class="monospaced">
48826 warn ...some conditions...
48831 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
48832 <option>logwrite</option>, so it does not add anything to the message and does not write a
48838 If you want to apply a control unconditionally, you can use it with a
48839 <option>require</option> verb. For example:
48841 <literallayout class="monospaced">
48842 require control = no_multiline_responses
48846 </listitem></varlistentry>
48848 <term><emphasis role="bold">delay</emphasis> = <<emphasis>time</emphasis>></term>
48851 <indexterm role="concept">
48852 <primary><option>delay</option> ACL modifier</primary>
48854 <indexterm role="option">
48855 <primary><option>-bh</option></primary>
48857 This modifier may appear in any ACL. It causes Exim to wait for the time
48858 interval before proceeding. However, when testing Exim using the <option>-bh</option>
48859 option, the delay is not actually imposed (an appropriate message is output
48860 instead). The time is given in the usual Exim notation, and the delay happens
48861 as soon as the modifier is processed. In an SMTP session, pending output is
48862 flushed before the delay is imposed.
48865 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
48868 <literallayout class="monospaced">
48869 deny ...some conditions...
48873 The delay happens if all the conditions are true, before the statement returns
48874 <quote>deny</quote>. Compare this with:
48876 <literallayout class="monospaced">
48878 ...some conditions...
48881 which waits for 30s before processing the conditions. The <option>delay</option> modifier
48882 can also be used with <option>warn</option> and together with <option>control</option>:
48884 <literallayout class="monospaced">
48885 warn ...some conditions...
48891 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
48892 responses to several commands are no longer buffered and sent in one packet (as
48893 they would normally be) because all output is flushed before imposing the
48894 delay. This optimization is disabled so that a number of small delays do not
48895 appear to the client as one large aggregated delay that might provoke an
48896 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
48897 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
48899 </listitem></varlistentry>
48901 <term><emphasis role="bold">endpass</emphasis></term>
48904 <indexterm role="concept">
48905 <primary><option>endpass</option> ACL modifier</primary>
48907 This modifier, which has no argument, is recognized only in <option>accept</option> and
48908 <option>discard</option> statements. It marks the boundary between the conditions whose
48909 failure causes control to pass to the next statement, and the conditions whose
48910 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
48911 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
48912 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
48914 </listitem></varlistentry>
48916 <term><emphasis role="bold">log_message</emphasis> = <<emphasis>text</emphasis>></term>
48919 <indexterm role="concept">
48920 <primary><option>log_message</option> ACL modifier</primary>
48922 This modifier sets up a message that is used as part of the log message if the
48923 ACL denies access or a <option>warn</option> statement’s conditions are true. For example:
48925 <literallayout class="monospaced">
48926 require log_message = wrong cipher suite $tls_cipher
48927 encrypted = DES-CBC3-SHA
48930 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
48934 <literal>discard </literal><<emphasis>some conditions</emphasis>>
48935 <literal> log_message = Discarded $local_part@$domain because...</literal>
48938 When access is denied, <option>log_message</option> adds to any underlying error message
48939 that may exist because of a condition failure. For example, while verifying a
48940 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
48944 The message may be defined before the conditions to which it applies, because
48945 the string expansion does not happen until Exim decides that access is to be
48946 denied. This means that any variables that are set by the condition are
48947 available for inclusion in the message. For example, the <varname>$dnslist_</varname><<emphasis>xxx</emphasis>>
48948 variables are set after a DNS black list lookup succeeds. If the expansion of
48949 <option>log_message</option> fails, or if the result is an empty string, the modifier is
48953 <indexterm role="variable">
48954 <primary><varname>$acl_verify_message</varname></primary>
48956 If you want to use a <option>warn</option> statement to log the result of an address
48957 verification, you can use <varname>$acl_verify_message</varname> to include the verification
48961 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
48962 the start of the logged message. If the same warning log message is requested
48963 more than once while receiving a single email message, only one copy is
48964 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
48965 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
48966 is logged for a successful <option>warn</option> statement.
48969 If <option>log_message</option> is not present and there is no underlying error message (for
48970 example, from the failure of address verification), but <option>message</option> is present,
48971 the <option>message</option> text is used for logging rejections. However, if any text for
48972 logging contains newlines, only the first line is logged. In the absence of
48973 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
48974 logging rejections.
48976 </listitem></varlistentry>
48978 <term><emphasis role="bold">log_reject_target</emphasis> = <<emphasis>log name list</emphasis>></term>
48981 <indexterm role="concept">
48982 <primary><option>log_reject_target</option> ACL modifier</primary>
48984 <indexterm role="concept">
48985 <primary>logging in ACL</primary>
48986 <secondary>specifying which log</secondary>
48988 This modifier makes it possible to specify which logs are used for messages
48989 about ACL rejections. Its argument is a colon-separated list of words that can
48990 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
48991 may be empty, in which case a rejection is not logged at all. For example, this
48992 ACL fragment writes no logging information when access is denied:
48995 <literal>deny </literal><<emphasis>some conditions</emphasis>>
48996 <literal> log_reject_target =</literal>
48999 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
49000 permanent and temporary rejections. Its effect lasts for the rest of the
49003 </listitem></varlistentry>
49005 <term><emphasis role="bold">logwrite</emphasis> = <<emphasis>text</emphasis>></term>
49008 <indexterm role="concept">
49009 <primary><option>logwrite</option> ACL modifier</primary>
49011 <indexterm role="concept">
49012 <primary>logging in ACL</primary>
49013 <secondary>immediate</secondary>
49015 This modifier writes a message to a log file as soon as it is encountered when
49016 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
49017 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
49018 access.) The <option>logwrite</option> modifier can be used to log special incidents in
49022 <literal>accept </literal><<emphasis>some special conditions</emphasis>>
49023 <literal> control = freeze</literal>
49024 <literal> logwrite = froze message because ...</literal>
49027 By default, the message is written to the main log. However, it may begin
49028 with a colon, followed by a comma-separated list of log names, and then
49029 another colon, to specify exactly which logs are to be written. For
49032 <literallayout class="monospaced">
49033 logwrite = :main,reject: text for main and reject logs
49034 logwrite = :panic: text for panic log only
49036 </listitem></varlistentry>
49038 <term><emphasis role="bold">message</emphasis> = <<emphasis>text</emphasis>></term>
49041 <indexterm role="concept">
49042 <primary><option>message</option> ACL modifier</primary>
49044 This modifier sets up a text string that is expanded and used as a response
49045 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
49046 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
49047 there is some complication if <option>endpass</option> is involved; see the description of
49048 <option>accept</option> for details.)
49051 The expansion of the message happens at the time Exim decides that the ACL is
49052 to end, not at the time it processes <option>message</option>. If the expansion fails, or
49053 generates an empty string, the modifier is ignored. Here is an example where
49054 <option>message</option> must be specified first, because the ACL ends with a rejection if
49055 the <option>hosts</option> condition fails:
49057 <literallayout class="monospaced">
49058 require message = Host not recognized
49062 (Once a condition has failed, no further conditions or modifiers are
49066 <indexterm role="concept">
49067 <primary>SMTP</primary>
49068 <secondary>error codes</secondary>
49070 <indexterm role="option">
49071 <primary><option>smtp_banner</option></primary>
49073 For ACLs that are triggered by SMTP commands, the message is returned as part
49074 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
49075 is meaningful only for SMTP, as no message is returned when a non-SMTP message
49076 is accepted. In the case of the connect ACL, accepting with a message modifier
49077 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
49078 accept message may not contain more than one line (otherwise it will be
49079 truncated at the first newline and a panic logged), and it cannot affect the
49083 When SMTP is involved, the message may begin with an overriding response code,
49084 consisting of three digits optionally followed by an <quote>extended response code</quote>
49085 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
49087 <literallayout class="monospaced">
49088 deny message = 599 1.2.3 Host not welcome
49089 hosts = 192.168.34.0/24
49092 The first digit of the supplied response code must be the same as would be sent
49093 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
49094 access, but for the predata ACL, note that the default success code is 354, not
49095 2<emphasis>xx</emphasis>.
49098 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
49099 the message modifier cannot override the 221 response code.
49102 The text in a <option>message</option> modifier is literal; any quotes are taken as
49103 literals, but because the string is expanded, backslash escapes are processed
49104 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
49108 <indexterm role="variable">
49109 <primary><varname>$acl_verify_message</varname></primary>
49111 If <option>message</option> is used on a statement that verifies an address, the message
49112 specified overrides any message that is generated by the verification process.
49113 However, the original message is available in the variable
49114 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
49115 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
49116 routers to be passed back as part of the SMTP response, you should either not
49117 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
49120 For compatibility with previous releases of Exim, a <option>message</option> modifier that
49121 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
49122 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
49123 all the conditions are true, wherever it appears in an ACL command, whereas
49124 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
49125 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
49128 </listitem></varlistentry>
49130 <term><emphasis role="bold">set</emphasis> <<emphasis>acl_name</emphasis>> = <<emphasis>value</emphasis>></term>
49133 <indexterm role="concept">
49134 <primary><option>set</option> ACL modifier</primary>
49136 This modifier puts a value into one of the ACL variables (see section
49137 <xref linkend="SECTaclvariables"/>).
49139 </listitem></varlistentry>
49142 <section id="SECTcontrols">
49143 <title>Use of the control modifier</title>
49145 <indexterm role="concept">
49146 <primary><option>control</option> ACL modifier</primary>
49148 The <option>control</option> modifier supports the following settings:
49152 <term><emphasis role="bold">control = allow_auth_unadvertised</emphasis></term>
49155 This modifier allows a client host to use the SMTP AUTH command even when it
49156 has not been advertised in response to EHLO. Furthermore, because there are
49157 apparently some really broken clients that do this, Exim will accept AUTH after
49158 HELO (rather than EHLO) when this control is set. It should be used only if you
49159 really need it, and you should limit its use to those broken clients that do
49160 not work without it. For example:
49162 <literallayout class="monospaced">
49163 warn hosts = 192.168.34.25
49164 control = allow_auth_unadvertised
49167 Normally, when an Exim server receives an AUTH command, it checks the name of
49168 the authentication mechanism that is given in the command to ensure that it
49169 matches an advertised mechanism. When this control is set, the check that a
49170 mechanism has been advertised is bypassed. Any configured mechanism can be used
49171 by the client. This control is permitted only in the connection and HELO ACLs.
49173 </listitem></varlistentry>
49175 <term><emphasis role="bold">control = caseful_local_part</emphasis></term>
49176 <term><emphasis role="bold">control = caselower_local_part</emphasis></term>
49179 <indexterm role="concept">
49180 <primary>access control lists (ACLs)</primary>
49181 <secondary>case of local part in</secondary>
49183 <indexterm role="concept">
49184 <primary>case of local parts</primary>
49186 <indexterm role="variable">
49187 <primary><varname>$local_part</varname></primary>
49189 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
49190 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
49191 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
49192 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
49193 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
49197 These controls affect only the current recipient. Moreover, they apply only to
49198 local part handling that takes place directly in the ACL (for example, as a key
49199 in lookups). If a test to verify the recipient is obeyed, the case-related
49200 handling of the local part during the verification is controlled by the router
49201 configuration (see the <option>caseful_local_part</option> generic router option).
49204 This facility could be used, for example, to add a spam score to local parts
49205 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
49208 <literallayout class="monospaced">
49209 warn control = caseful_local_part
49210 set acl_m4 = ${eval:\
49212 ${if match{$local_part}{[A-Z]}{1}{0}}\
49214 control = caselower_local_part
49217 Notice that we put back the lower cased version afterwards, assuming that
49218 is what is wanted for subsequent tests.
49220 </listitem></varlistentry>
49221 <varlistentry revisionflag="changed">
49222 <term><emphasis role="bold">control = debug/</emphasis><<emphasis>options</emphasis>></term>
49224 <para revisionflag="changed">
49225 <indexterm role="concept">
49226 <primary>access control lists (ACLs)</primary>
49227 <secondary>enabling debug logging</secondary>
49229 <indexterm role="concept">
49230 <primary>debugging</primary>
49231 <secondary>enabling from an ACL</secondary>
49233 This control turns on debug logging, almost as though Exim had been invoked
49234 with <literal>-d</literal>, with the output going to a new logfile, by default called
49235 <emphasis>debuglog</emphasis>. The filename can be adjusted with the <emphasis>tag</emphasis> option, which
49236 may access any variables already defined. The logging may be adjusted with
49237 the <emphasis>opts</emphasis> option, which takes the same values as the <literal>-d</literal> command-line
49238 option. Some examples (which depend on variables that don’t exist in all
49241 <literallayout class="monospaced" revisionflag="changed">
49243 control = debug/tag=.$sender_host_address
49244 control = debug/opts=+expand+acl
49245 control = debug/tag=.$message_exim_id/opts=+expand
49247 </listitem></varlistentry>
49249 <term><emphasis role="bold">control = enforce_sync</emphasis></term>
49250 <term><emphasis role="bold">control = no_enforce_sync</emphasis></term>
49253 <indexterm role="concept">
49254 <primary>SMTP</primary>
49255 <secondary>synchronization checking</secondary>
49257 <indexterm role="concept">
49258 <primary>synchronization checking in SMTP</primary>
49260 These controls make it possible to be selective about when SMTP synchronization
49261 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
49262 state of the switch (it is true by default). See the description of this option
49263 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
49266 The effect of these two controls lasts for the remainder of the SMTP
49267 connection. They can appear in any ACL except the one for the non-SMTP
49268 messages. The most straightforward place to put them is in the ACL defined by
49269 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
49270 before the first synchronization check. The expected use is to turn off the
49271 synchronization checks for badly-behaved hosts that you nevertheless need to
49274 </listitem></varlistentry>
49276 <term><emphasis role="bold">control = fakedefer/</emphasis><<emphasis>message</emphasis>></term>
49279 <indexterm role="concept">
49280 <primary>fake defer</primary>
49282 <indexterm role="concept">
49283 <primary>defer, fake</primary>
49285 This control works in exactly the same way as <option>fakereject</option> (described below)
49286 except that it causes an SMTP 450 response after the message data instead of a
49287 550 response. You must take care when using <option>fakedefer</option> because it causes the
49288 messages to be duplicated when the sender retries. Therefore, you should not
49289 use <option>fakedefer</option> if the message is to be delivered normally.
49291 </listitem></varlistentry>
49293 <term><emphasis role="bold">control = fakereject/</emphasis><<emphasis>message</emphasis>></term>
49296 <indexterm role="concept">
49297 <primary>fake rejection</primary>
49299 <indexterm role="concept">
49300 <primary>rejection, fake</primary>
49302 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
49303 words, only when an SMTP message is being received. If Exim accepts the
49304 message, instead the final 250 response, a 550 rejection message is sent.
49305 However, Exim proceeds to deliver the message as normal. The control applies
49306 only to the current message, not to any subsequent ones that may be received in
49307 the same SMTP connection.
49310 The text for the 550 response is taken from the <option>control</option> modifier. If no
49311 message is supplied, the following is used:
49313 <literallayout class="monospaced">
49314 550-Your message has been rejected but is being
49315 550-kept for evaluation.
49316 550-If it was a legitimate message, it may still be
49317 550 delivered to the target recipient(s).
49320 This facility should be used with extreme caution.
49322 </listitem></varlistentry>
49324 <term><emphasis role="bold">control = freeze</emphasis></term>
49327 <indexterm role="concept">
49328 <primary>frozen messages</primary>
49329 <secondary>forcing in ACL</secondary>
49331 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49332 other words, only when a message is being received. If the message is accepted,
49333 it is placed on Exim’s queue and frozen. The control applies only to the
49334 current message, not to any subsequent ones that may be received in the same
49338 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
49339 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
49340 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
49341 are obeyed for the current message have the <literal>/no_tell</literal> option.
49343 </listitem></varlistentry>
49345 <term><emphasis role="bold">control = no_delay_flush</emphasis></term>
49348 <indexterm role="concept">
49349 <primary>SMTP</primary>
49350 <secondary>output flushing, disabling for delay</secondary>
49352 Exim normally flushes SMTP output before implementing a delay in an ACL, to
49353 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49354 use. This control, as long as it is encountered before the <option>delay</option> modifier,
49355 disables such output flushing.
49357 </listitem></varlistentry>
49359 <term><emphasis role="bold">control = no_callout_flush</emphasis></term>
49362 <indexterm role="concept">
49363 <primary>SMTP</primary>
49364 <secondary>output flushing, disabling for callout</secondary>
49366 Exim normally flushes SMTP output before performing a callout in an ACL, to
49367 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
49368 use. This control, as long as it is encountered before the <option>verify</option> condition
49369 that causes the callout, disables such output flushing.
49371 </listitem></varlistentry>
49373 <term><emphasis role="bold">control = no_mbox_unspool</emphasis></term>
49376 This control is available when Exim is compiled with the content scanning
49377 extension. Content scanning may require a copy of the current message, or parts
49378 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
49379 or spam scanner. Normally, such copies are deleted when they are no longer
49380 needed. If this control is set, the copies are not deleted. The control applies
49381 only to the current message, not to any subsequent ones that may be received in
49382 the same SMTP connection. It is provided for debugging purposes and is unlikely
49383 to be useful in production.
49385 </listitem></varlistentry>
49387 <term><emphasis role="bold">control = no_multiline_responses</emphasis></term>
49390 <indexterm role="concept">
49391 <primary>multiline responses, suppressing</primary>
49393 This control is permitted for any ACL except the one for non-SMTP messages.
49394 It seems that there are broken clients in use that cannot handle multiline
49395 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
49398 If this control is set, multiline SMTP responses from ACL rejections are
49399 suppressed. One way of doing this would have been to put out these responses as
49400 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
49401 (<quote>use multiline responses for more</quote> it says – ha!), and some of the
49402 responses might get close to that. So this facility, which is after all only a
49403 sop to broken clients, is implemented by doing two very easy things:
49408 Extra information that is normally output as part of a rejection caused by
49409 sender verification failure is omitted. Only the final line (typically <quote>sender
49410 verification failed</quote>) is sent.
49415 If a <option>message</option> modifier supplies a multiline response, only the first
49421 The setting of the switch can, of course, be made conditional on the
49422 calling host. Its effect lasts until the end of the SMTP connection.
49424 </listitem></varlistentry>
49426 <term><emphasis role="bold">control = no_pipelining</emphasis></term>
49429 <indexterm role="concept">
49430 <primary>PIPELINING</primary>
49431 <secondary>suppressing advertising</secondary>
49433 This control turns off the advertising of the PIPELINING extension to SMTP in
49434 the current session. To be useful, it must be obeyed before Exim sends its
49435 response to an EHLO command. Therefore, it should normally appear in an ACL
49436 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
49437 <option>pipelining_advertise_hosts</option>.
49439 </listitem></varlistentry>
49441 <term><emphasis role="bold">control = queue_only</emphasis></term>
49444 <indexterm role="option">
49445 <primary><option>queue_only</option></primary>
49447 <indexterm role="concept">
49448 <primary>queueing incoming messages</primary>
49450 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
49451 other words, only when a message is being received. If the message is accepted,
49452 it is placed on Exim’s queue and left there for delivery by a subsequent queue
49453 runner. No immediate delivery process is started. In other words, it has the
49454 effect as the <option>queue_only</option> global option. However, the control applies only
49455 to the current message, not to any subsequent ones that may be received in the
49456 same SMTP connection.
49458 </listitem></varlistentry>
49460 <term><emphasis role="bold">control = submission/</emphasis><<emphasis>options</emphasis>></term>
49463 <indexterm role="concept">
49464 <primary>message</primary>
49465 <secondary>submission</secondary>
49467 <indexterm role="concept">
49468 <primary>submission mode</primary>
49470 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
49471 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
49472 the current message is a submission from a local MUA. In this case, Exim
49473 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
49474 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
49475 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
49476 late (the message has already been created).
49479 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
49480 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
49481 submission mode; the available options for this control are described there.
49482 The control applies only to the current message, not to any subsequent ones
49483 that may be received in the same SMTP connection.
49485 </listitem></varlistentry>
49487 <term><emphasis role="bold">control = suppress_local_fixups</emphasis></term>
49490 <indexterm role="concept">
49491 <primary>submission fixups, suppressing</primary>
49493 This control applies to locally submitted (non TCP/IP) messages, and is the
49494 complement of <literal>control = submission</literal>. It disables the fixups that are
49495 normally applied to locally-submitted messages. Specifically:
49500 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
49501 dynamic version of <option>local_sender_retain</option>).
49506 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
49511 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
49516 This control may be useful when a remotely-originated message is accepted,
49517 passed to some scanning program, and then re-submitted for delivery. It can be
49518 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
49519 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message’s
49523 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
49524 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
49526 </listitem></varlistentry>
49529 <section id="SECTsummesfix">
49530 <title>Summary of message fixup control</title>
49532 All four possibilities for message fixups can be specified:
49537 Locally submitted, fixups applied: the default.
49542 Locally submitted, no fixups applied: use
49543 <literal>control = suppress_local_fixups</literal>.
49548 Remotely submitted, no fixups applied: the default.
49553 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
49558 <section id="SECTaddheadacl">
49559 <title>Adding header lines in ACLs</title>
49561 <indexterm role="concept">
49562 <primary>header lines</primary>
49563 <secondary>adding in an ACL</secondary>
49565 <indexterm role="concept">
49566 <primary>header lines</primary>
49567 <secondary>position of added lines</secondary>
49569 <indexterm role="concept">
49570 <primary><option>message</option> ACL modifier</primary>
49572 The <option>add_header</option> modifier can be used to add one or more extra header lines
49573 to an incoming message, as in this example:
49575 <literallayout class="monospaced">
49576 warn dnslists = sbl.spamhaus.org : \
49577 dialup.mail-abuse.org
49578 add_header = X-blacklisted-at: $dnslist_domain
49581 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
49582 MIME, and non-SMTP ACLs (in other words, those that are concerned with
49583 receiving a message). The message must ultimately be accepted for
49584 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
49585 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
49589 If the data for the <option>add_header</option> modifier contains one or more newlines that
49590 are not followed by a space or a tab, it is assumed to contain multiple header
49591 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
49592 front of any line that is not a valid header line.
49595 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
49596 They are added to the message before processing the DATA and MIME ACLs.
49597 However, if an identical header line is requested more than once, only one copy
49598 is actually added to the message. Further header lines may be accumulated
49599 during the DATA and MIME ACLs, after which they are added to the message, again
49600 with duplicates suppressed. Thus, it is possible to add two identical header
49601 lines to an SMTP message, but only if one is added before DATA and one after.
49602 In the case of non-SMTP messages, new headers are accumulated during the
49603 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
49604 message is rejected after DATA or by the non-SMTP ACL, all added header lines
49605 are included in the entry that is written to the reject log.
49608 <indexterm role="concept">
49609 <primary>header lines</primary>
49610 <secondary>added; visibility of</secondary>
49612 Header lines are not visible in string expansions until they are added to the
49613 message. It follows that header lines defined in the MAIL, RCPT, and predata
49614 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
49615 header lines that are added by the DATA or MIME ACLs are not visible in those
49616 ACLs. Because of this restriction, you cannot use header lines as a way of
49617 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
49618 this, you can use ACL variables, as described in section
49619 <xref linkend="SECTaclvariables"/>.
49622 The <option>add_header</option> modifier acts immediately it is encountered during the
49623 processing of an ACL. Notice the difference between these two cases:
49626 <literal>accept add_header = ADDED: some text</literal>
49627 <literal> </literal><<emphasis>some condition</emphasis>>
49629 <literal>accept </literal><<emphasis>some condition</emphasis>>
49630 <literal> add_header = ADDED: some text</literal>
49633 In the first case, the header line is always added, whether or not the
49634 condition is true. In the second case, the header line is added only if the
49635 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
49636 ACL statement. All those that are encountered before a condition fails are
49640 <indexterm role="concept">
49641 <primary><option>warn</option> ACL verb</primary>
49643 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
49644 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
49645 effect only if all the conditions are true, even if it appears before some of
49646 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
49647 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
49648 are present on a <option>warn</option> verb, both are processed according to their
49652 By default, new header lines are added to a message at the end of the existing
49653 header lines. However, you can specify that any particular header line should
49654 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
49655 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
49656 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
49659 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
49660 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
49661 header line, respectively. (Header text cannot start with a colon, as there has
49662 to be a header name first.) For example:
49664 <literallayout class="monospaced">
49665 warn add_header = \
49666 :after_received:X-My-Header: something or other...
49669 If more than one header line is supplied in a single <option>add_header</option> modifier,
49670 each one is treated independently and can therefore be placed differently. If
49671 you add more than one line at the start, or after the Received: block, they end
49672 up in reverse order.
49675 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
49676 added in an ACL. It does NOT work for header lines that are added in a
49677 system filter or in a router or transport.
49680 <section id="SECTaclconditions">
49681 <title>ACL conditions</title>
49683 <indexterm role="concept">
49684 <primary>access control lists (ACLs)</primary>
49685 <secondary>conditions; list of</secondary>
49687 Some of conditions listed in this section are available only when Exim is
49688 compiled with the content-scanning extension. They are included here briefly
49689 for completeness. More detailed descriptions can be found in the discussion on
49690 content scanning in chapter <xref linkend="CHAPexiscan"/>.
49693 Not all conditions are relevant in all circumstances. For example, testing
49694 senders and recipients does not make sense in an ACL that is being run as the
49695 result of the arrival of an ETRN command, and checks on message headers can be
49696 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
49697 can use the same condition (with different parameters) more than once in the
49698 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
49699 The conditions are as follows:
49703 <term><emphasis role="bold">acl = </emphasis><<emphasis>name of acl or ACL string or file name </emphasis>></term>
49706 <indexterm role="concept">
49707 <primary>access control lists (ACLs)</primary>
49708 <secondary>nested</secondary>
49710 <indexterm role="concept">
49711 <primary>access control lists (ACLs)</primary>
49712 <secondary>indirect</secondary>
49714 <indexterm role="concept">
49715 <primary><option>acl</option> ACL condition</primary>
49717 The possible values of the argument are the same as for the
49718 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
49719 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
49720 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
49721 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
49722 condition false. This means that further processing of the <option>warn</option> verb
49723 ceases, but processing of the ACL continues.
49726 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
49727 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
49728 <option>accept</option> or <option>discard</option>, and the action is taken immediately – no further
49729 conditions are tested.
49732 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
49733 loops. This condition allows you to use different ACLs in different
49734 circumstances. For example, different ACLs can be used to handle RCPT commands
49735 for different local users or different local domains.
49737 </listitem></varlistentry>
49739 <term><emphasis role="bold">authenticated = </emphasis><<emphasis>string list</emphasis>></term>
49742 <indexterm role="concept">
49743 <primary><option>authenticated</option> ACL condition</primary>
49745 <indexterm role="concept">
49746 <primary>authentication</primary>
49747 <secondary>ACL checking</secondary>
49749 <indexterm role="concept">
49750 <primary>access control lists (ACLs)</primary>
49751 <secondary>testing for authentication</secondary>
49753 If the SMTP connection is not authenticated, the condition is false. Otherwise,
49754 the name of the authenticator is tested against the list. To test for
49755 authentication by any authenticator, you can set
49757 <literallayout class="monospaced">
49760 </listitem></varlistentry>
49762 <term><emphasis role="bold">condition = </emphasis><<emphasis>string</emphasis>></term>
49765 <indexterm role="concept">
49766 <primary><option>condition</option> ACL condition</primary>
49768 <indexterm role="concept">
49769 <primary>customizing</primary>
49770 <secondary>ACL condition</secondary>
49772 <indexterm role="concept">
49773 <primary>access control lists (ACLs)</primary>
49774 <secondary>customized test</secondary>
49776 <indexterm role="concept">
49777 <primary>access control lists (ACLs)</primary>
49778 <secondary>testing, customized</secondary>
49780 This feature allows you to make up custom conditions. If the result of
49781 expanding the string is an empty string, the number zero, or one of the strings
49782 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
49783 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
49784 any other value, some error is assumed to have occurred, and the ACL returns
49785 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
49786 ignored. The effect is to treat it as true, whether it is positive or
49789 </listitem></varlistentry>
49791 <term><emphasis role="bold">decode = </emphasis><<emphasis>location</emphasis>></term>
49794 <indexterm role="concept">
49795 <primary><option>decode</option> ACL condition</primary>
49797 This condition is available only when Exim is compiled with the
49798 content-scanning extension, and it is allowed only in the ACL defined by
49799 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
49800 If all goes well, the condition is true. It is false only if there are
49801 problems such as a syntax error or a memory shortage. For more details, see
49802 chapter <xref linkend="CHAPexiscan"/>.
49804 </listitem></varlistentry>
49806 <term><emphasis role="bold">demime = </emphasis><<emphasis>extension list</emphasis>></term>
49809 <indexterm role="concept">
49810 <primary><option>demime</option> ACL condition</primary>
49812 This condition is available only when Exim is compiled with the
49813 content-scanning extension. Its use is described in section
49814 <xref linkend="SECTdemimecond"/>.
49816 </listitem></varlistentry>
49818 <term><emphasis role="bold">dnslists = </emphasis><<emphasis>list of domain names and other data</emphasis>></term>
49821 <indexterm role="concept">
49822 <primary><option>dnslists</option> ACL condition</primary>
49824 <indexterm role="concept">
49825 <primary>DNS list</primary>
49826 <secondary>in ACL</secondary>
49828 <indexterm role="concept">
49829 <primary>black list (DNS)</primary>
49831 <indexterm role="concept">
49832 <primary>access control lists (ACLs)</primary>
49833 <secondary>testing a DNS list</secondary>
49835 This condition checks for entries in DNS black lists. These are also known as
49836 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
49837 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
49838 different variants of this condition to describe briefly here. See sections
49839 <xref linkend="SECTmorednslists"/>–<xref linkend="SECTmorednslistslast"/> for details.
49841 </listitem></varlistentry>
49843 <term><emphasis role="bold">domains = </emphasis><<emphasis>domain list</emphasis>></term>
49846 <indexterm role="concept">
49847 <primary><option>domains</option> ACL condition</primary>
49849 <indexterm role="concept">
49850 <primary>domain</primary>
49851 <secondary>ACL checking</secondary>
49853 <indexterm role="concept">
49854 <primary>access control lists (ACLs)</primary>
49855 <secondary>testing a recipient domain</secondary>
49857 <indexterm role="variable">
49858 <primary><varname>$domain_data</varname></primary>
49860 This condition is relevant only after a RCPT command. It checks that the domain
49861 of the recipient address is in the domain list. If percent-hack processing is
49862 enabled, it is done before this test is done. If the check succeeds with a
49863 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
49864 <option>domains</option> test.
49867 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
49868 use <option>domains</option> in a DATA ACL.
49870 </listitem></varlistentry>
49872 <term><emphasis role="bold">encrypted = </emphasis><<emphasis>string list</emphasis>></term>
49875 <indexterm role="concept">
49876 <primary><option>encrypted</option> ACL condition</primary>
49878 <indexterm role="concept">
49879 <primary>encryption</primary>
49880 <secondary>checking in an ACL</secondary>
49882 <indexterm role="concept">
49883 <primary>access control lists (ACLs)</primary>
49884 <secondary>testing for encryption</secondary>
49886 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
49887 name of the cipher suite in use is tested against the list. To test for
49888 encryption without testing for any specific cipher suite(s), set
49890 <literallayout class="monospaced">
49893 </listitem></varlistentry>
49895 <term><emphasis role="bold">hosts = </emphasis><<emphasis> host list</emphasis>></term>
49898 <indexterm role="concept">
49899 <primary><option>hosts</option> ACL condition</primary>
49901 <indexterm role="concept">
49902 <primary>host</primary>
49903 <secondary>ACL checking</secondary>
49905 <indexterm role="concept">
49906 <primary>access control lists (ACLs)</primary>
49907 <secondary>testing the client host</secondary>
49909 This condition tests that the calling host matches the host list. If you have
49910 name lookups or wildcarded host names and IP addresses in the same host list,
49911 you should normally put the IP addresses first. For example, you could have:
49913 <literallayout class="monospaced">
49914 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
49917 The lookup in this example uses the host name for its key. This is implied by
49918 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
49919 and it wouldn’t matter which way round you had these two items.)
49922 The reason for the problem with host names lies in the left-to-right way that
49923 Exim processes lists. It can test IP addresses without doing any DNS lookups,
49924 but when it reaches an item that requires a host name, it fails if it cannot
49925 find a host name to compare with the pattern. If the above list is given in the
49926 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
49927 found, even if its IP address is 10.9.8.7.
49930 If you really do want to do the name check first, and still recognize the IP
49931 address even if the name lookup fails, you can rewrite the ACL like this:
49933 <literallayout class="monospaced">
49934 accept hosts = dbm;/etc/friendly/hosts
49935 accept hosts = 10.9.8.7
49938 The default action on failing to find the host name is to assume that the host
49939 is not in the list, so the first <option>accept</option> statement fails. The second
49940 statement can then check the IP address.
49943 <indexterm role="variable">
49944 <primary><varname>$host_data</varname></primary>
49946 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
49947 of the lookup is made available in the <varname>$host_data</varname> variable. This
49948 allows you, for example, to set up a statement like this:
49950 <literallayout class="monospaced">
49951 deny hosts = net-lsearch;/some/file
49952 message = $host_data
49955 which gives a custom error message for each denied host.
49957 </listitem></varlistentry>
49959 <term><emphasis role="bold">local_parts = </emphasis><<emphasis>local part list</emphasis>></term>
49962 <indexterm role="concept">
49963 <primary><option>local_parts</option> ACL condition</primary>
49965 <indexterm role="concept">
49966 <primary>local part</primary>
49967 <secondary>ACL checking</secondary>
49969 <indexterm role="concept">
49970 <primary>access control lists (ACLs)</primary>
49971 <secondary>testing a local part</secondary>
49973 <indexterm role="variable">
49974 <primary><varname>$local_part_data</varname></primary>
49976 This condition is relevant only after a RCPT command. It checks that the local
49977 part of the recipient address is in the list. If percent-hack processing is
49978 enabled, it is done before this test. If the check succeeds with a lookup, the
49979 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
49980 the next <option>local_parts</option> test.
49982 </listitem></varlistentry>
49984 <term><emphasis role="bold">malware = </emphasis><<emphasis>option</emphasis>></term>
49987 <indexterm role="concept">
49988 <primary><option>malware</option> ACL condition</primary>
49990 <indexterm role="concept">
49991 <primary>access control lists (ACLs)</primary>
49992 <secondary>virus scanning</secondary>
49994 <indexterm role="concept">
49995 <primary>access control lists (ACLs)</primary>
49996 <secondary>scanning for viruses</secondary>
49998 This condition is available only when Exim is compiled with the
49999 content-scanning extension. It causes the incoming message to be scanned for
50000 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
50002 </listitem></varlistentry>
50004 <term><emphasis role="bold">mime_regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
50007 <indexterm role="concept">
50008 <primary><option>mime_regex</option> ACL condition</primary>
50010 <indexterm role="concept">
50011 <primary>access control lists (ACLs)</primary>
50012 <secondary>testing by regex matching</secondary>
50014 This condition is available only when Exim is compiled with the
50015 content-scanning extension, and it is allowed only in the ACL defined by
50016 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
50017 with any of the regular expressions. For details, see chapter
50018 <xref linkend="CHAPexiscan"/>.
50020 </listitem></varlistentry>
50022 <term><emphasis role="bold">ratelimit = </emphasis><<emphasis>parameters</emphasis>></term>
50025 <indexterm role="concept">
50026 <primary>rate limiting</primary>
50028 This condition can be used to limit the rate at which a user or host submits
50029 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
50031 </listitem></varlistentry>
50033 <term><emphasis role="bold">recipients = </emphasis><<emphasis>address list</emphasis>></term>
50036 <indexterm role="concept">
50037 <primary><option>recipients</option> ACL condition</primary>
50039 <indexterm role="concept">
50040 <primary>recipient</primary>
50041 <secondary>ACL checking</secondary>
50043 <indexterm role="concept">
50044 <primary>access control lists (ACLs)</primary>
50045 <secondary>testing a recipient</secondary>
50047 This condition is relevant only after a RCPT command. It checks the entire
50048 recipient address against a list of recipients.
50050 </listitem></varlistentry>
50052 <term><emphasis role="bold">regex = </emphasis><<emphasis>list of regular expressions</emphasis>></term>
50055 <indexterm role="concept">
50056 <primary><option>regex</option> ACL condition</primary>
50058 <indexterm role="concept">
50059 <primary>access control lists (ACLs)</primary>
50060 <secondary>testing by regex matching</secondary>
50062 This condition is available only when Exim is compiled with the
50063 content-scanning extension, and is available only in the DATA, MIME, and
50064 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
50065 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
50067 </listitem></varlistentry>
50069 <term><emphasis role="bold">sender_domains = </emphasis><<emphasis>domain list</emphasis>></term>
50072 <indexterm role="concept">
50073 <primary><option>sender_domains</option> ACL condition</primary>
50075 <indexterm role="concept">
50076 <primary>sender</primary>
50077 <secondary>ACL checking</secondary>
50079 <indexterm role="concept">
50080 <primary>access control lists (ACLs)</primary>
50081 <secondary>testing a sender domain</secondary>
50083 <indexterm role="variable">
50084 <primary><varname>$domain</varname></primary>
50086 <indexterm role="variable">
50087 <primary><varname>$sender_address_domain</varname></primary>
50089 This condition tests the domain of the sender of the message against the given
50090 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
50091 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
50092 of this condition. This is an exception to the general rule for testing domain
50093 lists. It is done this way so that, if this condition is used in an ACL for a
50094 RCPT command, the recipient’s domain (which is in <varname>$domain</varname>) can be used to
50095 influence the sender checking.
50098 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50099 relaying, because sender addresses are easily, and commonly, forged.
50101 </listitem></varlistentry>
50103 <term><emphasis role="bold">senders = </emphasis><<emphasis>address list</emphasis>></term>
50106 <indexterm role="concept">
50107 <primary><option>senders</option> ACL condition</primary>
50109 <indexterm role="concept">
50110 <primary>sender</primary>
50111 <secondary>ACL checking</secondary>
50113 <indexterm role="concept">
50114 <primary>access control lists (ACLs)</primary>
50115 <secondary>testing a sender</secondary>
50117 This condition tests the sender of the message against the given list. To test
50118 for a bounce message, which has an empty sender, set
50120 <literallayout class="monospaced">
50124 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
50125 relaying, because sender addresses are easily, and commonly, forged.
50127 </listitem></varlistentry>
50129 <term><emphasis role="bold">spam = </emphasis><<emphasis>username</emphasis>></term>
50132 <indexterm role="concept">
50133 <primary><option>spam</option> ACL condition</primary>
50135 <indexterm role="concept">
50136 <primary>access control lists (ACLs)</primary>
50137 <secondary>scanning for spam</secondary>
50139 This condition is available only when Exim is compiled with the
50140 content-scanning extension. It causes the incoming message to be scanned by
50141 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
50143 </listitem></varlistentry>
50145 <term><emphasis role="bold">verify = certificate</emphasis></term>
50148 <indexterm role="concept">
50149 <primary><option>verify</option> ACL condition</primary>
50151 <indexterm role="concept">
50152 <primary>TLS</primary>
50153 <secondary>client certificate verification</secondary>
50155 <indexterm role="concept">
50156 <primary>certificate</primary>
50157 <secondary>verification of client</secondary>
50159 <indexterm role="concept">
50160 <primary>access control lists (ACLs)</primary>
50161 <secondary>certificate verification</secondary>
50163 <indexterm role="concept">
50164 <primary>access control lists (ACLs)</primary>
50165 <secondary>testing a TLS certificate</secondary>
50167 This condition is true in an SMTP session if the session is encrypted, and a
50168 certificate was received from the client, and the certificate was verified. The
50169 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
50170 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
50172 </listitem></varlistentry>
50174 <term><emphasis role="bold">verify = csa</emphasis></term>
50177 <indexterm role="concept">
50178 <primary>CSA verification</primary>
50180 This condition checks whether the sending host (the client) is authorized to
50181 send email. Details of how this works are given in section
50182 <xref linkend="SECTverifyCSA"/>.
50184 </listitem></varlistentry>
50186 <term><emphasis role="bold">verify = header_sender/</emphasis><<emphasis>options</emphasis>></term>
50189 <indexterm role="concept">
50190 <primary><option>verify</option> ACL condition</primary>
50192 <indexterm role="concept">
50193 <primary>access control lists (ACLs)</primary>
50194 <secondary>verifying sender in the header</secondary>
50196 <indexterm role="concept">
50197 <primary>header lines</primary>
50198 <secondary>verifying the sender in</secondary>
50200 <indexterm role="concept">
50201 <primary>sender</primary>
50202 <secondary>verifying in header</secondary>
50204 <indexterm role="concept">
50205 <primary>verifying</primary>
50206 <secondary>sender in header</secondary>
50208 This condition is relevant only in an ACL that is run after a message has been
50209 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50210 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
50211 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
50212 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
50213 However, an address that appears in one of these headers need not be an address
50214 that accepts bounce messages; only sender addresses in envelopes are required
50215 to accept bounces. Therefore, if you use the callout option on this check, you
50216 might want to arrange for a non-empty address in the MAIL command.
50219 Details of address verification and the options are given later, starting at
50220 section <xref linkend="SECTaddressverification"/> (callouts are described in section
50221 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
50222 condition to restrict it to bounce messages only:
50224 <literallayout class="monospaced">
50226 message = A valid sender header is required for bounces
50227 !verify = header_sender
50229 </listitem></varlistentry>
50231 <term><emphasis role="bold">verify = header_syntax</emphasis></term>
50234 <indexterm role="concept">
50235 <primary><option>verify</option> ACL condition</primary>
50237 <indexterm role="concept">
50238 <primary>access control lists (ACLs)</primary>
50239 <secondary>verifying header syntax</secondary>
50241 <indexterm role="concept">
50242 <primary>header lines</primary>
50243 <secondary>verifying syntax</secondary>
50245 <indexterm role="concept">
50246 <primary>verifying</primary>
50247 <secondary>header syntax</secondary>
50249 This condition is relevant only in an ACL that is run after a message has been
50250 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
50251 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
50252 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
50253 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
50254 permitted only in locally generated messages and from hosts that match
50255 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
50259 Note that this condition is a syntax check only. However, a common spamming
50260 ploy used to be to send syntactically invalid headers such as
50262 <literallayout class="monospaced">
50266 and this condition can be used to reject such messages, though they are not as
50267 common as they used to be.
50269 </listitem></varlistentry>
50271 <term><emphasis role="bold">verify = helo</emphasis></term>
50274 <indexterm role="concept">
50275 <primary><option>verify</option> ACL condition</primary>
50277 <indexterm role="concept">
50278 <primary>access control lists (ACLs)</primary>
50279 <secondary>verifying HELO/EHLO</secondary>
50281 <indexterm role="concept">
50282 <primary>HELO</primary>
50283 <secondary>verifying</secondary>
50285 <indexterm role="concept">
50286 <primary>EHLO</primary>
50287 <secondary>verifying</secondary>
50289 <indexterm role="concept">
50290 <primary>verifying</primary>
50291 <secondary>EHLO</secondary>
50293 <indexterm role="concept">
50294 <primary>verifying</primary>
50295 <secondary>HELO</secondary>
50297 This condition is true if a HELO or EHLO command has been received from the
50298 client host, and its contents have been verified. If there has been no previous
50299 attempt to verify the HELO/EHLO contents, it is carried out when this
50300 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
50301 <option>helo_try_verify_hosts</option> options for details of how to request verification
50302 independently of this condition.
50305 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
50306 option), this condition is always true.
50308 </listitem></varlistentry>
50310 <term><emphasis role="bold">verify = not_blind</emphasis></term>
50313 <indexterm role="concept">
50314 <primary>verifying</primary>
50315 <secondary>not blind</secondary>
50317 <indexterm role="concept">
50318 <primary>bcc recipients, verifying none</primary>
50320 This condition checks that there are no blind (bcc) recipients in the message.
50321 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
50322 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
50323 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
50324 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
50325 used only in a DATA or non-SMTP ACL.
50328 There are, of course, many legitimate messages that make use of blind (bcc)
50329 recipients. This check should not be used on its own for blocking messages.
50331 </listitem></varlistentry>
50333 <term><emphasis role="bold">verify = recipient/</emphasis><<emphasis>options</emphasis>></term>
50336 <indexterm role="concept">
50337 <primary><option>verify</option> ACL condition</primary>
50339 <indexterm role="concept">
50340 <primary>access control lists (ACLs)</primary>
50341 <secondary>verifying recipient</secondary>
50343 <indexterm role="concept">
50344 <primary>recipient</primary>
50345 <secondary>verifying</secondary>
50347 <indexterm role="concept">
50348 <primary>verifying</primary>
50349 <secondary>recipient</secondary>
50351 <indexterm role="variable">
50352 <primary><varname>$address_data</varname></primary>
50354 This condition is relevant only after a RCPT command. It verifies the current
50355 recipient. Details of address verification are given later, starting at section
50356 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
50357 of <varname>$address_data</varname> is the last value that was set while routing the address.
50358 This applies even if the verification fails. When an address that is being
50359 verified is redirected to a single address, verification continues with the new
50360 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
50361 value for the child address.
50363 </listitem></varlistentry>
50365 <term><emphasis role="bold">verify = reverse_host_lookup</emphasis></term>
50368 <indexterm role="concept">
50369 <primary><option>verify</option> ACL condition</primary>
50371 <indexterm role="concept">
50372 <primary>access control lists (ACLs)</primary>
50373 <secondary>verifying host reverse lookup</secondary>
50375 <indexterm role="concept">
50376 <primary>host</primary>
50377 <secondary>verifying reverse lookup</secondary>
50379 This condition ensures that a verified host name has been looked up from the IP
50380 address of the client host. (This may have happened already if the host name
50381 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
50382 Verification ensures that the host name obtained from a reverse DNS lookup, or
50383 one of its aliases, does, when it is itself looked up in the DNS, yield the
50384 original IP address.
50387 If this condition is used for a locally generated message (that is, when there
50388 is no client host involved), it always succeeds.
50390 </listitem></varlistentry>
50392 <term><emphasis role="bold">verify = sender/</emphasis><<emphasis>options</emphasis>></term>
50395 <indexterm role="concept">
50396 <primary><option>verify</option> ACL condition</primary>
50398 <indexterm role="concept">
50399 <primary>access control lists (ACLs)</primary>
50400 <secondary>verifying sender</secondary>
50402 <indexterm role="concept">
50403 <primary>sender</primary>
50404 <secondary>verifying</secondary>
50406 <indexterm role="concept">
50407 <primary>verifying</primary>
50408 <secondary>sender</secondary>
50410 This condition is relevant only after a MAIL or RCPT command, or after a
50411 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
50412 the message’s sender is empty (that is, this is a bounce message), the
50413 condition is true. Otherwise, the sender address is verified.
50416 <indexterm role="variable">
50417 <primary><varname>$address_data</varname></primary>
50419 <indexterm role="variable">
50420 <primary><varname>$sender_address_data</varname></primary>
50422 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
50423 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
50424 value can be used in subsequent conditions and modifiers in the same ACL
50425 statement. It does not persist after the end of the current statement. If you
50426 want to preserve the value for longer, you can save it in an ACL variable.
50429 Details of verification are given later, starting at section
50430 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
50431 to avoid doing it more than once per message.
50433 </listitem></varlistentry>
50435 <term><emphasis role="bold">verify = sender=</emphasis><<emphasis>address</emphasis>><emphasis role="bold">/</emphasis><<emphasis>options</emphasis>></term>
50438 <indexterm role="concept">
50439 <primary><option>verify</option> ACL condition</primary>
50441 This is a variation of the previous option, in which a modified address is
50442 verified as a sender.
50444 </listitem></varlistentry>
50447 <section id="SECTmorednslists">
50448 <title>Using DNS lists</title>
50450 <indexterm role="concept">
50451 <primary>DNS list</primary>
50452 <secondary>in ACL</secondary>
50454 <indexterm role="concept">
50455 <primary>black list (DNS)</primary>
50457 <indexterm role="concept">
50458 <primary>access control lists (ACLs)</primary>
50459 <secondary>testing a DNS list</secondary>
50461 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
50462 is on at least one of a number of DNS lists by looking up the inverted IP
50463 address in one or more DNS domains. (Note that DNS list domains are not mail
50464 domains, so the <literal>+</literal> syntax for named lists doesn’t work - it is used for
50465 special options instead.) For example, if the calling host’s IP
50466 address is 192.168.62.43, and the ACL statement is
50468 <literallayout class="monospaced">
50469 deny dnslists = blackholes.mail-abuse.org : \
50470 dialups.mail-abuse.org
50473 the following records are looked up:
50475 <literallayout class="monospaced">
50476 43.62.168.192.blackholes.mail-abuse.org
50477 43.62.168.192.dialups.mail-abuse.org
50480 As soon as Exim finds an existing DNS record, processing of the list stops.
50481 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
50482 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
50483 use two separate conditions:
50485 <literallayout class="monospaced">
50486 deny dnslists = blackholes.mail-abuse.org
50487 dnslists = dialups.mail-abuse.org
50490 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
50491 behaves as if the host does not match the list item, that is, as if the DNS
50492 record does not exist. If there are further items in the DNS list, they are
50496 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
50497 (which is the most common usage), because it prevents a DNS failure from
50498 blocking mail. However, you can change this behaviour by putting one of the
50499 following special items in the list:
50502 <literal>+include_unknown </literal> behave as if the item is on the list
50503 <literal>+exclude_unknown </literal> behave as if the item is not on the list (default)
50504 <literal>+defer_unknown </literal> give a temporary error
50507 <indexterm role="concept">
50508 <primary><literal>+include_unknown</literal></primary>
50510 <indexterm role="concept">
50511 <primary><literal>+exclude_unknown</literal></primary>
50513 <indexterm role="concept">
50514 <primary><literal>+defer_unknown</literal></primary>
50516 Each of these applies to any subsequent items on the list. For example:
50518 <literallayout class="monospaced">
50519 deny dnslists = +defer_unknown : foo.bar.example
50522 Testing the list of domains stops as soon as a match is found. If you want to
50523 warn for one list and block for another, you can use two different statements:
50525 <literallayout class="monospaced">
50526 deny dnslists = blackholes.mail-abuse.org
50527 warn message = X-Warn: sending host is on dialups list
50528 dnslists = dialups.mail-abuse.org
50531 DNS list lookups are cached by Exim for the duration of the SMTP session,
50532 so a lookup based on the IP address is done at most once for any incoming
50533 connection. Exim does not share information between multiple incoming
50534 connections (but your local name server cache should be active).
50537 <section id="SECID201">
50538 <title>Specifying the IP address for a DNS list lookup</title>
50540 <indexterm role="concept">
50541 <primary>DNS list</primary>
50542 <secondary>keyed by explicit IP address</secondary>
50544 By default, the IP address that is used in a DNS list lookup is the IP address
50545 of the calling host. However, you can specify another IP address by listing it
50546 after the domain name, introduced by a slash. For example:
50548 <literallayout class="monospaced">
50549 deny dnslists = black.list.tld/192.168.1.2
50552 This feature is not very helpful with explicit IP addresses; it is intended for
50553 use with IP addresses that are looked up, for example, the IP addresses of the
50554 MX hosts or nameservers of an email sender address. For an example, see section
50555 <xref linkend="SECTmulkeyfor"/> below.
50558 <section id="SECID202">
50559 <title>DNS lists keyed on domain names</title>
50561 <indexterm role="concept">
50562 <primary>DNS list</primary>
50563 <secondary>keyed by domain name</secondary>
50565 There are some lists that are keyed on domain names rather than inverted IP
50566 addresses (see for example the <emphasis>domain based zones</emphasis> link at
50567 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
50568 with these lists. You can change the name that is looked up in a DNS list by
50569 listing it after the domain name, introduced by a slash. For example,
50571 <literallayout class="monospaced">
50572 deny message = Sender's domain is listed at $dnslist_domain
50573 dnslists = dsn.rfc-ignorant.org/$sender_address_domain
50576 This particular example is useful only in ACLs that are obeyed after the
50577 RCPT or DATA commands, when a sender address is available. If (for
50578 example) the message’s sender is <emphasis>user@tld.example</emphasis> the name that is looked
50579 up by this example is
50581 <literallayout class="monospaced">
50582 tld.example.dsn.rfc-ignorant.org
50585 A single <option>dnslists</option> condition can contain entries for both names and IP
50586 addresses. For example:
50588 <literallayout class="monospaced">
50589 deny dnslists = sbl.spamhaus.org : \
50590 dsn.rfc-ignorant.org/$sender_address_domain
50593 The first item checks the sending host’s IP address; the second checks a domain
50594 name. The whole condition is true if either of the DNS lookups succeeds.
50597 <section id="SECTmulkeyfor">
50598 <title>Multiple explicit keys for a DNS list</title>
50600 <indexterm role="concept">
50601 <primary>DNS list</primary>
50602 <secondary>multiple keys for</secondary>
50604 The syntax described above for looking up explicitly-defined values (either
50605 names or IP addresses) in a DNS blacklist is a simplification. After the domain
50606 name for the DNS list, what follows the slash can in fact be a list of items.
50607 As with all lists in Exim, the default separator is a colon. However, because
50608 this is a sublist within the list of DNS blacklist domains, it is necessary
50609 either to double the separators like this:
50611 <literallayout class="monospaced">
50612 dnslists = black.list.tld/name.1::name.2
50615 or to change the separator character, like this:
50617 <literallayout class="monospaced">
50618 dnslists = black.list.tld/<;name.1;name.2
50621 If an item in the list is an IP address, it is inverted before the DNS
50622 blacklist domain is appended. If it is not an IP address, no inversion
50623 occurs. Consider this condition:
50625 <literallayout class="monospaced">
50626 dnslists = black.list.tld/<;192.168.1.2;a.domain
50629 The DNS lookups that occur are:
50631 <literallayout class="monospaced">
50632 2.1.168.192.black.list.tld
50633 a.domain.black.list.tld
50636 Once a DNS record has been found (that matches a specific IP return
50637 address, if specified – see section <xref linkend="SECTaddmatcon"/>), no further lookups
50638 are done. If there is a temporary DNS error, the rest of the sublist of domains
50639 or IP addresses is tried. A temporary error for the whole dnslists item occurs
50640 only if no other DNS lookup in this sublist succeeds. In other words, a
50641 successful lookup for any of the items in the sublist overrides a temporary
50642 error for a previous item.
50645 The ability to supply a list of items after the slash is in some sense just a
50646 syntactic convenience. These two examples have the same effect:
50648 <literallayout class="monospaced">
50649 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
50650 dnslists = black.list.tld/a.domain::b.domain
50653 However, when the data for the list is obtained from a lookup, the second form
50654 is usually much more convenient. Consider this example:
50656 <literallayout class="monospaced">
50657 deny message = The mail servers for the domain \
50658 $sender_address_domain \
50659 are listed at $dnslist_domain ($dnslist_value); \
50661 dnslists = sbl.spamhaus.org/<|${lookup dnsdb {>|a=<|\
50662 ${lookup dnsdb {>|mxh=\
50663 $sender_address_domain} }} }
50666 Note the use of <literal>>|</literal> in the dnsdb lookup to specify the separator for
50667 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
50668 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
50669 of expanding the condition might be something like this:
50671 <literallayout class="monospaced">
50672 dnslists = sbl.spahmaus.org/<|192.168.2.3|192.168.5.6|...
50675 Thus, this example checks whether or not the IP addresses of the sender
50676 domain’s mail servers are on the Spamhaus black list.
50679 The key that was used for a successful DNS list lookup is put into the variable
50680 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
50683 <section id="SECID203">
50684 <title>Data returned by DNS lists</title>
50686 <indexterm role="concept">
50687 <primary>DNS list</primary>
50688 <secondary>data returned from</secondary>
50690 DNS lists are constructed using address records in the DNS. The original RBL
50691 just used the address 127.0.0.1 on the right hand side of each record, but the
50692 RBL+ list and some other lists use a number of values with different meanings.
50693 The values used on the RBL+ list are:
50698 127.1.0.3 DUL and RBL
50700 127.1.0.5 RSS and RBL
50701 127.1.0.6 RSS and DUL
50702 127.1.0.7 RSS and DUL and RBL
50705 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
50706 different values. Some DNS lists may return more than one address record;
50707 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
50710 <section id="SECID204">
50711 <title>Variables set from DNS lists</title>
50713 <indexterm role="concept">
50714 <primary>expansion</primary>
50715 <secondary>variables, set from DNS list</secondary>
50717 <indexterm role="concept">
50718 <primary>DNS list</primary>
50719 <secondary>variables set from</secondary>
50721 <indexterm role="variable">
50722 <primary><varname>$dnslist_domain</varname></primary>
50724 <indexterm role="variable">
50725 <primary><varname>$dnslist_matched</varname></primary>
50727 <indexterm role="variable">
50728 <primary><varname>$dnslist_text</varname></primary>
50730 <indexterm role="variable">
50731 <primary><varname>$dnslist_value</varname></primary>
50733 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
50734 the name of the overall domain that matched (for example,
50735 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
50736 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
50737 the DNS record. When the key is an IP address, it is not reversed in
50738 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
50739 cases, for example:
50741 <literallayout class="monospaced">
50742 deny dnslists = spamhaus.example
50745 the key is also available in another variable (in this case,
50746 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
50747 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
50748 might generate a dnslists lookup like this:
50750 <literallayout class="monospaced">
50751 deny dnslists = spamhaus.example/<|192.168.1.2|192.168.6.7|...
50754 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
50755 <literal>192.168.6.7</literal> (for example).
50758 If more than one address record is returned by the DNS lookup, all the IP
50759 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
50760 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
50761 record. For lists such as RBL+ the TXT record for a merged entry is often not
50762 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
50766 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
50767 – although these appear before the condition in the ACL, they are not
50768 expanded until after it has failed. For example:
50770 <literallayout class="monospaced">
50771 deny hosts = !+local_networks
50772 message = $sender_host_address is listed \
50774 dnslists = rbl-plus.mail-abuse.example
50777 <section id="SECTaddmatcon">
50778 <title>Additional matching conditions for DNS lists</title>
50780 <indexterm role="concept">
50781 <primary>DNS list</primary>
50782 <secondary>matching specific returned data</secondary>
50784 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
50785 in order to restrict its action to DNS records with a matching right hand side.
50788 <literallayout class="monospaced">
50789 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
50792 rejects only those hosts that yield 127.0.0.2. Without this additional data,
50793 any address record is considered to be a match. For the moment, we assume
50794 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
50795 describes how multiple records are handled.
50798 More than one IP address may be given for checking, using a comma as a
50799 separator. These are alternatives – if any one of them matches, the
50800 <option>dnslists</option> condition is true. For example:
50802 <literallayout class="monospaced">
50803 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50806 If you want to specify a constraining address list and also specify names or IP
50807 addresses to be looked up, the constraining address list must be specified
50808 first. For example:
50810 <literallayout class="monospaced">
50811 deny dnslists = dsn.rfc-ignorant.org\
50812 =127.0.0.2/$sender_address_domain
50815 If the character <literal>&</literal> is used instead of <literal>=</literal>, the comparison for each
50816 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
50817 In other words, the listed addresses are used as bit masks. The comparison is
50818 true if all the bits in the mask are present in the address that is being
50819 tested. For example:
50821 <literallayout class="monospaced">
50822 dnslists = a.b.c&0.0.0.3
50825 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
50826 want to test whether one bit or another bit is present (as opposed to both
50827 being present), you must use multiple values. For example:
50829 <literallayout class="monospaced">
50830 dnslists = a.b.c&0.0.0.1,0.0.0.2
50833 matches if the final component of the address is an odd number or two times
50837 <section id="SECID205">
50838 <title>Negated DNS matching conditions</title>
50840 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
50843 <literallayout class="monospaced">
50844 deny dnslists = a.b.c=127.0.0.2,127.0.0.3
50847 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50848 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
50850 <literallayout class="monospaced">
50851 deny dnslists = a.b.c!=127.0.0.2,127.0.0.3
50854 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
50855 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
50856 words, the result of the test is inverted if an exclamation mark appears before
50857 the <literal>=</literal> (or the <literal>&</literal>) sign.
50860 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
50861 host, or address list (which is why the syntax is different).
50864 If you are using just one list, the negation syntax does not gain you much. The
50865 previous example is precisely equivalent to
50867 <literallayout class="monospaced">
50868 deny dnslists = a.b.c
50869 !dnslists = a.b.c=127.0.0.2,127.0.0.3
50872 However, if you are using multiple lists, the negation syntax is clearer.
50873 Consider this example:
50875 <literallayout class="monospaced">
50876 deny dnslists = sbl.spamhaus.org : \
50878 dnsbl.njabl.org!=127.0.0.3 : \
50882 Using only positive lists, this would have to be:
50884 <literallayout class="monospaced">
50885 deny dnslists = sbl.spamhaus.org : \
50887 deny dnslists = dnsbl.njabl.org
50888 !dnslists = dnsbl.njabl.org=127.0.0.3
50889 deny dnslists = relays.ordb.org
50892 which is less clear, and harder to maintain.
50895 <section id="SECThanmuldnsrec">
50896 <title>Handling multiple DNS records from a DNS list</title>
50898 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
50899 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
50900 is followed by <literal>=</literal> or <literal>&</literal> and a list of IP addresses, in order to restrict
50901 the match to specific results from the DNS lookup, there are two ways in which
50902 the checking can be handled. For example, consider the condition:
50904 <literallayout class="monospaced">
50905 dnslists = a.b.c=127.0.0.1
50908 What happens if the DNS lookup for the incoming IP address yields both
50909 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
50910 condition true because at least one given value was found, or is it false
50911 because at least one of the found values was not listed? And how does this
50912 affect negated conditions? Both possibilities are provided for with the help of
50913 additional separators <literal>==</literal> and <literal>=&</literal>.
50918 If <literal>=</literal> or <literal>&</literal> is used, the condition is true if any one of the looked up
50919 IP addresses matches one of the listed addresses. For the example above, the
50920 condition is true because 127.0.0.1 matches.
50925 If <literal>==</literal> or <literal>=&</literal> is used, the condition is true only if every one of the
50926 looked up IP addresses matches one of the listed addresses. If the condition is
50929 <literallayout class="monospaced">
50930 dnslists = a.b.c==127.0.0.1
50933 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50934 false because 127.0.0.2 is not listed. You would need to have:
50936 <literallayout class="monospaced">
50937 dnslists = a.b.c==127.0.0.1,127.0.0.2
50940 for the condition to be true.
50945 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
50946 the precise opposite of the behaviour above. Thus:
50951 If <literal>!=</literal> or <literal>!&</literal> is used, the condition is true if none of the looked up IP
50952 addresses matches one of the listed addresses. Consider:
50954 <literallayout class="monospaced">
50955 dnslists = a.b.c!&0.0.0.1
50958 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50959 false because 127.0.0.1 matches.
50964 If <literal>!==</literal> or <literal>!=&</literal> is used, the condition is true there is at least one
50965 looked up IP address that does not match. Consider:
50967 <literallayout class="monospaced">
50968 dnslists = a.b.c!=&0.0.0.1
50971 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
50972 true, because 127.0.0.2 does not match. You would need to have:
50974 <literallayout class="monospaced">
50975 dnslists = a.b.c!=&0.0.0.1,0.0.0.2
50978 for the condition to be false.
50983 When the DNS lookup yields only a single IP address, there is no difference
50984 between <literal>=</literal> and <literal>==</literal> and between <literal>&</literal> and <literal>=&</literal>.
50987 <section id="SECTmordetinf">
50988 <title>Detailed information from merged DNS lists</title>
50990 <indexterm role="concept">
50991 <primary>DNS list</primary>
50992 <secondary>information from merged</secondary>
50994 When the facility for restricting the matching IP values in a DNS list is used,
50995 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
50996 the true reason for rejection. This happens when lists are merged and the IP
50997 address in the A record is used to distinguish them; unfortunately there is
50998 only one TXT record. One way round this is not to use merged lists, but that
50999 can be inefficient because it requires multiple DNS lookups where one would do
51000 in the vast majority of cases when the host of interest is not on any of the
51004 A less inefficient way of solving this problem is available. If
51005 two domain names, comma-separated, are given, the second is used first to
51006 do an initial check, making use of any IP value restrictions that are set.
51007 If there is a match, the first domain is used, without any IP value
51008 restrictions, to get the TXT record. As a byproduct of this, there is also
51009 a check that the IP being tested is indeed on the first list. The first
51010 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
51012 <literallayout class="monospaced">
51014 rejected because $sender_host_address is blacklisted \
51015 at $dnslist_domain\n$dnslist_text
51017 sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
51018 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51021 For the first blacklist item, this starts by doing a lookup in
51022 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
51023 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
51024 value, and as long as something is found, it looks for the corresponding TXT
51025 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
51026 The second blacklist item is processed similarly.
51029 If you are interested in more than one merged list, the same list must be
51030 given several times, but because the results of the DNS lookups are cached,
51031 the DNS calls themselves are not repeated. For example:
51033 <literallayout class="monospaced">
51034 reject dnslists = \
51035 http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
51036 socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
51037 misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
51038 dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
51041 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
51042 values matches (or if no record is found), this is the only lookup that is
51043 done. Only if there is a match is one of the more specific lists consulted.
51046 <section id="SECTmorednslistslast">
51047 <title>DNS lists and IPv6</title>
51049 <indexterm role="concept">
51050 <primary>IPv6</primary>
51051 <secondary>DNS black lists</secondary>
51053 <indexterm role="concept">
51054 <primary>DNS list</primary>
51055 <secondary>IPv6 usage</secondary>
51057 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
51058 nibble by nibble. For example, if the calling host’s IP address is
51059 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
51061 <literallayout class="monospaced">
51062 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
51063 f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
51066 (split over two lines here to fit on the page). Unfortunately, some of the DNS
51067 lists contain wildcard records, intended for IPv4, that interact badly with
51068 IPv6. For example, the DNS entry
51070 <literallayout class="monospaced">
51071 *.3.some.list.example. A 127.0.0.1
51074 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
51075 Unfortunately, it also matches the entire 3::/4 IPv6 network.
51078 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
51079 <option>condition</option> condition, as in this example:
51081 <literallayout class="monospaced">
51082 deny condition = ${if isip4{$sender_host_address}}
51083 dnslists = some.list.example
51086 <section id="SECTratelimiting">
51087 <title>Rate limiting incoming messages</title>
51089 <indexterm role="concept">
51090 <primary>rate limiting</primary>
51091 <secondary>client sending</secondary>
51093 <indexterm role="concept">
51094 <primary>limiting client sending rates</primary>
51096 <indexterm role="option">
51097 <primary><option>smtp_ratelimit_*</option></primary>
51099 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
51100 which clients can send email. This is more powerful than the
51101 <option>smtp_ratelimit_*</option> options, because those options control the rate of
51102 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
51103 works across all connections (concurrent and sequential) from the same client
51104 host. The syntax of the <option>ratelimit</option> condition is:
51107 <literal>ratelimit =</literal> <<emphasis>m</emphasis>> <literal>/</literal> <<emphasis>p</emphasis>> <literal>/</literal> <<emphasis>options</emphasis>> <literal>/</literal> <<emphasis>key</emphasis>>
51110 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
51111 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
51114 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
51115 <varname>$sender_rate</varname> to the client’s computed rate, <varname>$sender_rate_limit</varname> to the
51116 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
51117 of <emphasis>p</emphasis>.
51120 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
51121 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
51122 means that it takes Exim longer to forget a client’s past behaviour. The
51123 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
51124 send in each time interval. It also specifies the number of messages permitted
51125 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
51126 constant, you can allow a client to send more messages in a burst without
51127 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
51128 both small, messages must be sent at an even rate.
51131 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
51132 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
51133 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
51134 instructions when it is run with no arguments.
51137 The key is used to look up the data for calculating the client’s average
51138 sending rate. This data is stored in Exim’s spool directory, alongside the
51139 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
51140 which means Exim computes the sending rate of each client host IP address.
51141 By changing the key you can change how Exim identifies clients for the purpose
51142 of ratelimiting. For example, to limit the sending rate of each authenticated
51143 user, independent of the computer they are sending from, set the key to
51144 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
51145 example, <varname>$authenticated_id</varname> is only meaningful if the client has
51146 authenticated (which you can check with the <option>authenticated</option> ACL condition).
51149 The lookup key does not have to identify clients: If you want to limit the
51150 rate at which a recipient receives messages, you can use the key
51151 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
51155 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> and the options onto the
51156 lookup key because they alter the meaning of the stored data. This is not true
51157 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
51158 still remember clients’ past behaviour, but if you alter the other ratelimit
51159 parameters Exim forgets past behaviour.
51162 Each <option>ratelimit</option> condition can have up to three options. One option
51163 specifies what Exim measures the rate of, and the second specifies how Exim
51164 handles excessively fast clients. The third option can be <literal>noupdate</literal>, to
51165 disable updating of the ratelimiting database (see section <xref linkend="rearatdat"/>).
51166 The options are separated by a slash, like the other parameters. They may
51167 appear in any order.
51170 <section id="ratoptmea">
51171 <title>Ratelimit options for what is being measured</title>
51173 The <option>per_conn</option> option limits the client’s connection rate.
51176 The <option>per_mail</option> option limits the client’s rate of sending messages. This is
51177 the default if none of the <option>per_*</option> options is specified.
51180 The <option>per_byte</option> option limits the sender’s email bandwidth. Note that it is
51181 best to use this option in the DATA ACL; if it is used in an earlier ACL it
51182 relies on the SIZE parameter specified by the client in its MAIL command,
51183 which may be inaccurate or completely missing. You can follow the limit <emphasis>m</emphasis>
51184 in the configuration with K, M, or G to specify limits in kilobytes,
51185 megabytes, or gigabytes, respectively.
51188 The <option>per_rcpt</option> option causes Exim to limit the rate at which
51189 recipients are accepted. To be effective, it would need to be used in
51190 either the <option>acl_smtp_rcpt</option> or the <option>acl_not_smtp</option> ACL. In the
51191 <option>acl_smtp_rcpt</option> ACL, the number of recipients is incremented by one.
51192 In the case of a locally submitted message in the <option>acl_not_smtp</option> ACL,
51193 the number of recipients is incremented by the <option>$recipients_count</option>
51194 for the entire message. Note that in either case the rate limiting
51195 engine will see a message with many recipients as a large high-speed
51199 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
51200 condition is processed. This can be used to limit the SMTP command rate.
51201 This command is essentially an alias of <option>per_rcpt</option> to make it clear
51202 that the effect is to limit the rate at which individual commands,
51203 rather than recipients, are accepted.
51206 <section id="ratophanfas">
51207 <title>Ratelimit options for handling fast clients</title>
51209 If a client’s average rate is greater than the maximum, the rate limiting
51210 engine can react in two possible ways, depending on the presence of the
51211 <option>strict</option> or <option>leaky</option> options. This is independent of the other
51212 counter-measures (such as rejecting the message) that may be specified by the
51213 rest of the ACL. The default mode is leaky, which avoids a sender’s
51214 over-aggressive retry rate preventing it from getting any email through.
51217 The <option>strict</option> option means that the client’s recorded rate is always
51218 updated. The effect of this is that Exim measures the client’s average rate
51219 of attempts to send email, which can be much higher than the maximum it is
51220 actually allowed. If the client is over the limit it may be subjected to
51221 counter-measures by the ACL until it slows down below the maximum rate. If
51222 the client stops attempting to send email for the time specified in the <emphasis>p</emphasis>
51223 parameter then its computed rate will decay exponentially to 37% of its peak
51224 value. You can work out the time (the number of smoothing periods) that a
51225 client is subjected to counter-measures after an over-limit burst with this
51228 <literallayout class="monospaced">
51229 ln(peakrate/maxrate)
51232 The <option>leaky</option> (default) option means that the client’s recorded rate is not
51233 updated if it is above the limit. The effect of this is that Exim measures the
51234 client’s average rate of successfully sent email, which cannot be greater than
51235 the maximum allowed. If the client is over the limit it may suffer some
51236 counter-measures (as specified in the ACL), but it will still be able to send
51237 email at the configured maximum rate, whatever the rate of its attempts. This
51238 is generally the better choice if you have clients that retry automatically.
51241 <section id="useratlim">
51242 <title>Using rate limiting</title>
51244 Exim’s other ACL facilities are used to define what counter-measures are taken
51245 when the rate limit is exceeded. This might be anything from logging a warning
51246 (for example, while measuring existing sending rates in order to define
51247 policy), through time delays to slow down fast senders, up to rejecting the
51248 message. For example:
51250 <literallayout class="monospaced">
51251 # Log all senders' rates
51252 warn ratelimit = 0 / 1h / strict
51253 log_message = Sender rate $sender_rate / $sender_rate_period
51255 # Slow down fast senders; note the need to truncate $sender_rate
51256 # at the decimal point.
51257 warn ratelimit = 100 / 1h / per_rcpt / strict
51258 delay = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
51259 $sender_rate_limit }s
51261 # Keep authenticated users under control
51262 deny authenticated = *
51263 ratelimit = 100 / 1d / strict / $authenticated_id
51265 # System-wide rate limit
51266 defer message = Sorry, too busy. Try again later.
51267 ratelimit = 10 / 1s / $primary_hostname
51269 # Restrict incoming rate from each host, with a default
51270 # set using a macro and special cases looked up in a table.
51271 defer message = Sender rate exceeds $sender_rate_limit \
51272 messages per $sender_rate_period
51273 ratelimit = ${lookup {$sender_host_address} \
51274 cdb {DB/ratelimits.cdb} \
51275 {$value} {RATELIMIT} }
51278 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
51279 especially with the <option>per_rcpt</option> option, you may suffer from a performance
51280 bottleneck caused by locking on the ratelimit hints database. Apart from
51281 making your ACLs less complicated, you can reduce the problem by using a
51282 RAM disk for Exim’s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
51283 this means that Exim will lose its hints data after a reboot (including retry
51284 hints, the callout cache, and ratelimit data).
51287 <section id="rearatdat">
51288 <title>Reading ratelimit data without updating</title>
51290 <indexterm role="concept">
51291 <primary>rate limitint</primary>
51292 <secondary>reading data without updating</secondary>
51294 If the <option>noupdate</option> option is present on a <option>ratelimit</option> ACL condition, Exim
51295 computes the rate and checks the limit as normal, but it does not update the
51296 saved data. This means that, in relevant ACLs, it is possible to lookup the
51297 existence of a specified (or auto-generated) ratelimit key without incrementing
51298 the ratelimit counter for that key. In order for this to be useful, another ACL
51299 entry must set the rate for the same key (otherwise it will always be zero).
51302 <literallayout class="monospaced">
51304 deny ratelimit = 100 / 5m / strict / per_cmd / noupdate
51305 log_message = RATE: $sender_rate/$sender_rate_period \
51306 (max $sender_rate_limit)
51309 <emphasis>... some other logic and tests...</emphasis>
51311 <literallayout class="monospaced">
51313 warn ratelimit = 100 / 5m / strict / per_cmd
51314 condition = ${if le{$sender_rate}{$sender_rate_limit}}
51315 logwrite = RATE UPDATE: $sender_rate/$sender_rate_period \
51316 (max $sender_rate_limit)
51319 In this example, the rate is tested and used to deny access (when it is too
51320 high) in the connect ACL, but the actual computation of the remembered rate
51321 happens later, on a per-command basis, in another ACL.
51324 <section id="SECTaddressverification">
51325 <title>Address verification</title>
51327 <indexterm role="concept">
51328 <primary>verifying address</primary>
51329 <secondary>options for</secondary>
51331 <indexterm role="concept">
51332 <primary>policy control</primary>
51333 <secondary>address verification</secondary>
51335 Several of the <option>verify</option> conditions described in section
51336 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
51337 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
51338 The verification conditions can be followed by options that modify the
51339 verification process. The options are separated from the keyword and from each
51340 other by slashes, and some of them contain parameters. For example:
51342 <literallayout class="monospaced">
51343 verify = sender/callout
51344 verify = recipient/defer_ok/callout=10s,defer_ok
51347 The first stage of address verification, which always happens, is to run the
51348 address through the routers, in <quote>verify mode</quote>. Routers can detect the
51349 difference between verification and routing for delivery, and their actions can
51350 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
51351 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
51352 The available options are as follows:
51357 If the <option>callout</option> option is specified, successful routing to one or more
51358 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
51359 check. Callouts and their sub-options are discussed in the next section.
51364 If there is a defer error while doing verification routing, the ACL
51365 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
51366 options, the condition is forced to be true instead. Note that this is a main
51367 verification option as well as a suboption for callouts.
51372 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
51373 discusses the reporting of sender address verification failures.
51378 The <option>success_on_redirect</option> option causes verification always to succeed
51379 immediately after a successful redirection. By default, if a redirection
51380 generates just one address, that address is also verified. See further
51381 discussion in section <xref linkend="SECTredirwhilveri"/>.
51386 <indexterm role="concept">
51387 <primary>verifying address</primary>
51388 <secondary>differentiating failures</secondary>
51390 <indexterm role="variable">
51391 <primary><varname>$recipient_verify_failure</varname></primary>
51393 <indexterm role="variable">
51394 <primary><varname>$sender_verify_failure</varname></primary>
51396 <indexterm role="variable">
51397 <primary><varname>$acl_verify_message</varname></primary>
51399 After an address verification failure, <varname>$acl_verify_message</varname> contains the
51400 error message that is associated with the failure. It can be preserved by
51403 <literallayout class="monospaced">
51404 warn !verify = sender
51405 set acl_m0 = $acl_verify_message
51408 If you are writing your own custom rejection message or log message when
51409 denying access, you can use this variable to include information about the
51410 verification failure.
51413 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
51414 appropriate) contains one of the following words:
51419 <option>qualify</option>: The address was unqualified (no domain), and the message
51420 was neither local nor came from an exempted host.
51425 <option>route</option>: Routing failed.
51430 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
51431 occurred at or before the MAIL command (that is, on initial
51432 connection, HELO, or MAIL).
51437 <option>recipient</option>: The RCPT command in a callout was rejected.
51442 <option>postmaster</option>: The postmaster check in a callout was rejected.
51447 The main use of these variables is expected to be to distinguish between
51448 rejections of MAIL and rejections of RCPT in callouts.
51451 <section id="SECTcallver">
51452 <title>Callout verification</title>
51454 <indexterm role="concept">
51455 <primary>verifying address</primary>
51456 <secondary>by callout</secondary>
51458 <indexterm role="concept">
51459 <primary>callout</primary>
51460 <secondary>verification</secondary>
51462 <indexterm role="concept">
51463 <primary>SMTP</primary>
51464 <secondary>callout verification</secondary>
51466 For non-local addresses, routing verifies the domain, but is unable to do any
51467 checking of the local part. There are situations where some means of verifying
51468 the local part is desirable. One way this can be done is to make an SMTP
51469 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
51470 a subsequent host for a recipient address, to see if the host accepts the
51471 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
51472 sender address, the callback is not to the client host that is trying to
51473 deliver the message, but to one of the hosts that accepts incoming mail for the
51474 sender’s domain.
51477 Exim does not do callouts by default. If you want them to happen, you must
51478 request them by setting appropriate options on the <option>verify</option> condition, as
51479 described below. This facility should be used with care, because it can add a
51480 lot of resource usage to the cost of verifying an address. However, Exim does
51481 cache the results of callouts, which helps to reduce the cost. Details of
51482 caching are in section <xref linkend="SECTcallvercache"/>.
51485 Recipient callouts are usually used only between hosts that are controlled by
51486 the same administration. For example, a corporate gateway host could use
51487 callouts to check for valid recipients on an internal mailserver. A successful
51488 callout does not guarantee that a real delivery to the address would succeed;
51489 on the other hand, a failing callout does guarantee that a delivery would fail.
51492 If the <option>callout</option> option is present on a condition that verifies an address, a
51493 second stage of verification occurs if the address is successfully routed to
51494 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
51495 <command>manualroute</command> router, where the router specifies the hosts. However, if a
51496 router that does not set up hosts routes to an <command>smtp</command> transport with a
51497 <option>hosts</option> setting, the transport’s hosts are used. If an <command>smtp</command> transport has
51498 <option>hosts_override</option> set, its hosts are always used, whether or not the router
51499 supplies a host list.
51502 The port that is used is taken from the transport, if it is specified and is a
51503 remote transport. (For routers that do verification only, no transport need be
51504 specified.) Otherwise, the default SMTP port is used. If a remote transport
51505 specifies an outgoing interface, this is used; otherwise the interface is not
51506 specified. Likewise, the text that is used for the HELO command is taken from
51507 the transport’s <option>helo_data</option> option; if there is no transport, the value of
51508 <varname>$smtp_active_hostname</varname> is used.
51511 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
51512 test whether a bounce message could be delivered to the sender address. The
51513 following SMTP commands are sent:
51516 <literal>HELO </literal><<emphasis>local host name</emphasis>>
51517 <literal>MAIL FROM:<></literal>
51518 <literal>RCPT TO:</literal><<emphasis>the address to be tested</emphasis>>
51519 <literal>QUIT</literal>
51522 LHLO is used instead of HELO if the transport’s <option>protocol</option> option is
51523 set to <quote>lmtp</quote>.
51526 A recipient callout check is similar. By default, it also uses an empty address
51527 for the sender. This default is chosen because most hosts do not make use of
51528 the sender address when verifying a recipient. Using the same address means
51529 that a single cache entry can be used for each recipient. Some sites, however,
51530 do make use of the sender address when verifying. These are catered for by the
51531 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
51534 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
51535 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
51536 Exim tries the next host, if any. If there is a problem with all the remote
51537 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
51538 <option>callout</option> option is given, in which case the condition is forced to succeed.
51541 <indexterm role="concept">
51542 <primary>SMTP</primary>
51543 <secondary>output flushing, disabling for callout</secondary>
51545 A callout may take a little time. For this reason, Exim normally flushes SMTP
51546 output before performing a callout in an ACL, to avoid unexpected timeouts in
51547 clients when the SMTP PIPELINING extension is in use. The flushing can be
51548 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
51551 <section id="CALLaddparcall">
51552 <title>Additional parameters for callouts</title>
51554 <indexterm role="concept">
51555 <primary>callout</primary>
51556 <secondary>additional parameters for</secondary>
51558 The <option>callout</option> option can be followed by an equals sign and a number of
51559 optional parameters, separated by commas. For example:
51561 <literallayout class="monospaced">
51562 verify = recipient/callout=10s,defer_ok
51565 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
51566 separate verify options, is retained for backwards compatibility, but is now
51567 deprecated. The additional parameters for <option>callout</option> are as follows:
51571 <term><<emphasis>a time interval</emphasis>></term>
51574 <indexterm role="concept">
51575 <primary>callout</primary>
51576 <secondary>timeout, specifying</secondary>
51578 This specifies the timeout that applies for the callout attempt to each host.
51581 <literallayout class="monospaced">
51582 verify = sender/callout=5s
51585 The default is 30 seconds. The timeout is used for each response from the
51586 remote host. It is also used for the initial connection, unless overridden by
51587 the <option>connect</option> parameter.
51589 </listitem></varlistentry>
51591 <term><emphasis role="bold">connect = </emphasis><<emphasis>time interval</emphasis>></term>
51594 <indexterm role="concept">
51595 <primary>callout</primary>
51596 <secondary>connection timeout, specifying</secondary>
51598 This parameter makes it possible to set a different (usually smaller) timeout
51599 for making the SMTP connection. For example:
51601 <literallayout class="monospaced">
51602 verify = sender/callout=5s,connect=1s
51605 If not specified, this timeout defaults to the general timeout value.
51607 </listitem></varlistentry>
51609 <term><emphasis role="bold">defer_ok</emphasis></term>
51612 <indexterm role="concept">
51613 <primary>callout</primary>
51614 <secondary>defer, action on</secondary>
51616 When this parameter is present, failure to contact any host, or any other kind
51617 of temporary error, is treated as success by the ACL. However, the cache is not
51618 updated in this circumstance.
51620 </listitem></varlistentry>
51622 <term><emphasis role="bold">fullpostmaster</emphasis></term>
51625 <indexterm role="concept">
51626 <primary>callout</primary>
51627 <secondary>full postmaster check</secondary>
51629 This operates like the <option>postmaster</option> option (see below), but if the check for
51630 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
51631 accordance with the specification in RFC 2821. The RFC states that the
51632 unqualified address <emphasis>postmaster</emphasis> should be accepted.
51634 </listitem></varlistentry>
51636 <term><emphasis role="bold">mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51639 <indexterm role="concept">
51640 <primary>callout</primary>
51641 <secondary>sender when verifying header</secondary>
51643 When verifying addresses in header lines using the <option>header_sender</option>
51644 verification option, Exim behaves by default as if the addresses are envelope
51645 sender addresses from a message. Callout verification therefore tests to see
51646 whether a bounce message could be delivered, by using an empty address in the
51647 MAIL command. However, it is arguable that these addresses might never be used
51648 as envelope senders, and could therefore justifiably reject bounce messages
51649 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
51650 address to use in the MAIL command. For example:
51652 <literallayout class="monospaced">
51653 require verify = header_sender/callout=mailfrom=abcd@x.y.z
51656 This parameter is available only for the <option>header_sender</option> verification option.
51658 </listitem></varlistentry>
51660 <term><emphasis role="bold">maxwait = </emphasis><<emphasis>time interval</emphasis>></term>
51663 <indexterm role="concept">
51664 <primary>callout</primary>
51665 <secondary>overall timeout, specifying</secondary>
51667 This parameter sets an overall timeout for performing a callout verification.
51670 <literallayout class="monospaced">
51671 verify = sender/callout=5s,maxwait=30s
51674 This timeout defaults to four times the callout timeout for individual SMTP
51675 commands. The overall timeout applies when there is more than one host that can
51676 be tried. The timeout is checked before trying the next host. This prevents
51677 very long delays if there are a large number of hosts and all are timing out
51678 (for example, when network connections are timing out).
51680 </listitem></varlistentry>
51682 <term><emphasis role="bold">no_cache</emphasis></term>
51685 <indexterm role="concept">
51686 <primary>callout</primary>
51687 <secondary>cache, suppressing</secondary>
51689 <indexterm role="concept">
51690 <primary>caching callout, suppressing</primary>
51692 When this parameter is given, the callout cache is neither read nor updated.
51694 </listitem></varlistentry>
51696 <term><emphasis role="bold">postmaster</emphasis></term>
51699 <indexterm role="concept">
51700 <primary>callout</primary>
51701 <secondary>postmaster; checking</secondary>
51703 When this parameter is set, a successful callout check is followed by a similar
51704 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
51705 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
51706 the postmaster check is recorded in a cache record; if it is a failure, this is
51707 used to fail subsequent callouts for the domain without a connection being
51708 made, until the cache record expires.
51710 </listitem></varlistentry>
51712 <term><emphasis role="bold">postmaster_mailfrom = </emphasis><<emphasis>email address</emphasis>></term>
51715 The postmaster check uses an empty sender in the MAIL command by default.
51716 You can use this parameter to do a postmaster check using a different address.
51719 <literallayout class="monospaced">
51720 require verify = sender/callout=postmaster_mailfrom=abc@x.y.z
51723 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
51724 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
51726 <literallayout class="monospaced">
51727 require verify = sender/callout=postmaster_mailfrom=
51730 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
51731 account of the sender address. It is assumed that either the empty address or
51732 a fixed non-empty address will be used. All that Exim remembers is that the
51733 postmaster check for the domain succeeded or failed.
51735 </listitem></varlistentry>
51737 <term><emphasis role="bold">random</emphasis></term>
51740 <indexterm role="concept">
51741 <primary>callout</primary>
51742 <secondary><quote>random</quote> check</secondary>
51744 When this parameter is set, before doing the normal callout check, Exim does a
51745 check for a <quote>random</quote> local part at the same domain. The local part is not
51746 really random – it is defined by the expansion of the option
51747 <option>callout_random_local_part</option>, which defaults to
51749 <literallayout class="monospaced">
51750 $primary_host_name-$tod_epoch-testing
51753 The idea here is to try to determine whether the remote host accepts all local
51754 parts without checking. If it does, there is no point in doing callouts for
51755 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
51756 a cache record, and used to force the current and subsequent callout checks to
51757 succeed without a connection being made, until the cache record expires.
51759 </listitem></varlistentry>
51761 <term><emphasis role="bold">use_postmaster</emphasis></term>
51764 <indexterm role="concept">
51765 <primary>callout</primary>
51766 <secondary>sender for recipient check</secondary>
51768 This parameter applies to recipient callouts only. For example:
51770 <literallayout class="monospaced">
51771 deny !verify = recipient/callout=use_postmaster
51774 <indexterm role="variable">
51775 <primary><varname>$qualify_domain</varname></primary>
51777 It causes a non-empty postmaster address to be used in the MAIL command when
51778 performing the callout for the recipient, and also for a <quote>random</quote> check if
51779 that is configured. The local part of the address is <literal>postmaster</literal> and the
51780 domain is the contents of <varname>$qualify_domain</varname>.
51782 </listitem></varlistentry>
51784 <term><emphasis role="bold">use_sender</emphasis></term>
51787 This option applies to recipient callouts only. For example:
51789 <literallayout class="monospaced">
51790 require verify = recipient/callout=use_sender
51793 It causes the message’s actual sender address to be used in the MAIL
51794 command when performing the callout, instead of an empty address. There is no
51795 need to use this option unless you know that the called hosts make use of the
51796 sender when checking recipients. If used indiscriminately, it reduces the
51797 usefulness of callout caching.
51799 </listitem></varlistentry>
51802 If you use any of the parameters that set a non-empty sender for the MAIL
51803 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
51804 <option>use_sender</option>), you should think about possible loops. Recipient checking is
51805 usually done between two hosts that are under the same management, and the host
51806 that receives the callouts is not normally configured to do callouts itself.
51807 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
51808 these circumstances.
51811 However, if you use a non-empty sender address for a callout to an arbitrary
51812 host, there is the likelihood that the remote host will itself initiate a
51813 callout check back to your host. As it is checking what appears to be a message
51814 sender, it is likely to use an empty address in MAIL, thus avoiding a
51815 callout loop. However, to be on the safe side it would be best to set up your
51816 own ACLs so that they do not do sender verification checks when the recipient
51817 is the address you use for header sender or postmaster callout checking.
51820 Another issue to think about when using non-empty senders for callouts is
51821 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
51822 by the sender/recipient combination; thus, for any given recipient, many more
51823 actual callouts are performed than when an empty sender or postmaster is used.
51826 <section id="SECTcallvercache">
51827 <title>Callout caching</title>
51829 <indexterm role="concept">
51830 <primary>hints database</primary>
51831 <secondary>callout cache</secondary>
51833 <indexterm role="concept">
51834 <primary>callout</primary>
51835 <secondary>cache, description of</secondary>
51837 <indexterm role="concept">
51838 <primary>caching</primary>
51839 <secondary>callout</secondary>
51841 Exim caches the results of callouts in order to reduce the amount of resources
51842 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
51843 option. A hints database called <quote>callout</quote> is used for the cache. Two
51844 different record types are used: one records the result of a callout check for
51845 a specific address, and the other records information that applies to the
51846 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
51849 When an original callout fails, a detailed SMTP error message is given about
51850 the failure. However, for subsequent failures use the cache data, this message
51854 The expiry times for negative and positive address cache records are
51855 independent, and can be set by the global options <option>callout_negative_expire</option>
51856 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
51859 If a host gives a negative response to an SMTP connection, or rejects any
51860 commands up to and including
51862 <literallayout class="monospaced">
51866 (but not including the MAIL command with a non-empty address),
51867 any callout attempt is bound to fail. Exim remembers such failures in a
51868 domain cache record, which it uses to fail callouts for the domain without
51869 making new connections, until the domain record times out. There are two
51870 separate expiry times for domain cache records:
51871 <option>callout_domain_negative_expire</option> (default 3h) and
51872 <option>callout_domain_positive_expire</option> (default 7d).
51875 Domain records expire when the negative expiry time is reached if callouts
51876 cannot be made for the domain, or if the postmaster check failed.
51877 Otherwise, they expire when the positive expiry time is reached. This
51878 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
51879 will eventually be noticed.
51882 The callout caching mechanism is based on the domain of the address that is
51883 being tested. If the domain routes to several hosts, it is assumed that their
51884 behaviour will be the same.
51887 <section id="SECTsenaddver">
51888 <title>Sender address verification reporting</title>
51890 <indexterm role="concept">
51891 <primary>verifying</primary>
51892 <secondary>suppressing error details</secondary>
51894 See section <xref linkend="SECTaddressverification"/> for a general discussion of
51895 verification. When sender verification fails in an ACL, the details of the
51896 failure are given as additional output lines before the 550 response to the
51897 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
51900 <literallayout class="monospaced">
51901 MAIL FROM:<xyz@abc.example>
51903 RCPT TO:<pqr@def.example>
51904 550-Verification failed for <xyz@abc.example>
51905 550-Called: 192.168.34.43
51906 550-Sent: RCPT TO:<xyz@abc.example>
51907 550-Response: 550 Unknown local part xyz in <xyz@abc.example>
51908 550 Sender verification failed
51911 If more than one RCPT command fails in the same way, the details are given
51912 only for the first of them. However, some administrators do not want to send
51913 out this much information. You can suppress the details by adding
51914 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
51917 <literallayout class="monospaced">
51918 verify = sender/no_details
51921 <section id="SECTredirwhilveri">
51922 <title>Redirection while verifying</title>
51924 <indexterm role="concept">
51925 <primary>verifying</primary>
51926 <secondary>redirection while</secondary>
51928 <indexterm role="concept">
51929 <primary>address redirection</primary>
51930 <secondary>while verifying</secondary>
51932 A dilemma arises when a local address is redirected by aliasing or forwarding
51933 during verification: should the generated addresses themselves be verified,
51934 or should the successful expansion of the original address be enough to verify
51935 it? By default, Exim takes the following pragmatic approach:
51940 When an incoming address is redirected to just one child address, verification
51941 continues with the child address, and if that fails to verify, the original
51942 verification also fails.
51947 When an incoming address is redirected to more than one child address,
51948 verification does not continue. A success result is returned.
51953 This seems the most reasonable behaviour for the common use of aliasing as a
51954 way of redirecting different local parts to the same mailbox. It means, for
51955 example, that a pair of alias entries of the form
51957 <literallayout class="monospaced">
51959 aw123: :fail: Gone away, no forwarding address
51962 work as expected, with both local parts causing verification failure. When a
51963 redirection generates more than one address, the behaviour is more like a
51964 mailing list, where the existence of the alias itself is sufficient for
51965 verification to succeed.
51968 It is possible, however, to change the default behaviour so that all successful
51969 redirections count as successful verifications, however many new addresses are
51970 generated. This is specified by the <option>success_on_redirect</option> verification
51971 option. For example:
51973 <literallayout class="monospaced">
51974 require verify = recipient/success_on_redirect/callout=10s
51977 In this example, verification succeeds if a router generates a new address, and
51978 the callout does not occur, because no address was routed to a remote host.
51981 When verification is being tested via the <option>-bv</option> option, the treatment of
51982 redirections is as just described, unless the <option>-v</option> or any debugging option is
51983 also specified. In that case, full verification is done for every generated
51984 address and a report is output for each of them.
51987 <section id="SECTverifyCSA">
51988 <title>Client SMTP authorization (CSA)</title>
51990 <indexterm role="concept">
51991 <primary>CSA</primary>
51992 <secondary>verifying</secondary>
51994 Client SMTP Authorization is a system that allows a site to advertise
51995 which machines are and are not permitted to send email. This is done by placing
51996 special SRV records in the DNS; these are looked up using the client’s HELO
51997 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
51998 Authorization checks in Exim are performed by the ACL condition:
52000 <literallayout class="monospaced">
52004 This fails if the client is not authorized. If there is a DNS problem, or if no
52005 valid CSA SRV record is found, or if the client is authorized, the condition
52006 succeeds. These three cases can be distinguished using the expansion variable
52007 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
52008 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
52009 be likely to cause problems for legitimate email.
52012 The error messages produced by the CSA code include slightly more
52013 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
52014 looking up the CSA SRV record, or problems looking up the CSA target
52015 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
52020 The client’s host name is explicitly not authorized.
52025 The client’s IP address does not match any of the CSA target IP addresses.
52030 The client’s host name is authorized but it has no valid target IP addresses
52031 (for example, the target’s addresses are IPv6 and the client is using IPv4).
52036 The client’s host name has no CSA SRV record but a parent domain has asserted
52037 that all subdomains must be explicitly authorized.
52042 The <option>csa</option> verification condition can take an argument which is the domain to
52043 use for the DNS query. The default is:
52045 <literallayout class="monospaced">
52046 verify = csa/$sender_helo_name
52049 This implementation includes an extension to CSA. If the query domain
52050 is an address literal such as [192.0.2.95], or if it is a bare IP
52051 address, Exim searches for CSA SRV records in the reverse DNS as if
52052 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
52055 <literallayout class="monospaced">
52056 verify = csa/$sender_host_address
52059 In fact, this is the check that Exim performs if the client does not say HELO.
52060 This extension can be turned off by setting the main configuration option
52061 <option>dns_csa_use_reverse</option> to be false.
52064 If a CSA SRV record is not found for the domain itself, a search
52065 is performed through its parent domains for a record which might be
52066 making assertions about subdomains. The maximum depth of this search is limited
52067 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
52068 default. Exim does not look for CSA SRV records in a top level domain, so the
52069 default settings handle HELO domains as long as seven
52070 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
52071 of legitimate HELO domains.
52074 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
52075 direct SRV lookups, this is not sufficient because of the extra parent domain
52076 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
52077 addresses into lookups in the reverse DNS space. The result of a successful
52080 <literallayout class="monospaced">
52081 ${lookup dnsdb {csa=$sender_helo_name}}
52084 has two space-separated fields: an authorization code and a target host name.
52085 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
52086 authorization required but absent, or <quote>?</quote> for unknown.
52089 <section id="SECTverifyPRVS">
52090 <title>Bounce address tag validation</title>
52092 <indexterm role="concept">
52093 <primary>BATV, verifying</primary>
52095 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
52096 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
52097 Genuine incoming bounce messages should therefore always be addressed to
52098 recipients that have a valid tag. This scheme is a way of detecting unwanted
52099 bounce messages caused by sender address forgeries (often called <quote>collateral
52100 spam</quote>), because the recipients of such messages do not include valid tags.
52103 There are two expansion items to help with the implementation of the BATV
52104 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
52105 the original envelope sender address by using a simple key to add a hash of the
52106 address and some time-based randomizing information. The <option>prvs</option> expansion
52107 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
52108 The syntax of these expansion items is described in section
52109 <xref linkend="SECTexpansionitems"/>.
52112 As an example, suppose the secret per-address keys are stored in an MySQL
52113 database. A query to look up the key for an address could be defined as a macro
52116 <literallayout class="monospaced">
52117 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
52118 WHERE sender='${quote_mysql:$prvscheck_address}'\
52122 Suppose also that the senders who make use of BATV are defined by an address
52123 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
52126 <literallayout class="monospaced">
52127 # Bounces: drop unsigned addresses for BATV senders
52128 deny message = This address does not send an unsigned reverse path
52130 recipients = +batv_senders
52132 # Bounces: In case of prvs-signed address, check signature.
52133 deny message = Invalid reverse path signature.
52135 condition = ${prvscheck {$local_part@$domain}\
52136 {PRVSCHECK_SQL}{1}}
52137 !condition = $prvscheck_result
52140 The first statement rejects recipients for bounce messages that are addressed
52141 to plain BATV sender addresses, because it is known that BATV senders do not
52142 send out messages with plain sender addresses. The second statement rejects
52143 recipients that are prvs-signed, but with invalid signatures (either because
52144 the key is wrong, or the signature has timed out).
52147 A non-prvs-signed address is not rejected by the second statement, because the
52148 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
52149 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
52150 the first argument is a syntactically valid prvs-signed address, the yield is
52151 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
52152 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
52153 of the checks (empty for failure, <quote>1</quote> for success).
52156 There is one more issue you must consider when implementing prvs-signing:
52157 you have to ensure that the routers accept prvs-signed addresses and
52158 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
52159 router to remove the signature with a configuration along these lines:
52161 <literallayout class="monospaced">
52164 data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
52167 This works because, if the third argument of <option>prvscheck</option> is empty, the result
52168 of the expansion of a prvs-signed address is the decoded value of the original
52169 address. This router should probably be the first of your routers that handles
52173 To create BATV-signed addresses in the first place, a transport of this form
52176 <literallayout class="monospaced">
52177 external_smtp_batv:
52179 return_path = ${prvs {$return_path} \
52180 {${lookup mysql{SELECT \
52181 secret FROM batv_prvs WHERE \
52182 sender='${quote_mysql:$sender_address}'} \
52186 If no key can be found for the existing return path, no signing takes place.
52189 <section id="SECTrelaycontrol">
52190 <title>Using an ACL to control relaying</title>
52192 <indexterm role="concept">
52193 <primary>access control lists (ACLs)</primary>
52194 <secondary>relay control</secondary>
52196 <indexterm role="concept">
52197 <primary>relaying</primary>
52198 <secondary>control by ACL</secondary>
52200 <indexterm role="concept">
52201 <primary>policy control</primary>
52202 <secondary>relay control</secondary>
52204 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
52205 delivers it directly to another host as a result of a remote address contained
52206 within it. Redirecting a local address via an alias or forward file and then
52207 passing the message on to another host is not relaying,
52208 <indexterm role="concept">
52209 <primary><quote>percent hack</quote></primary>
52211 but a redirection as a result of the <quote>percent hack</quote> is.
52214 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
52215 A host which is acting as a gateway or an MX backup is concerned with incoming
52216 relaying from arbitrary hosts to a specific set of domains. On the other hand,
52217 a host which is acting as a smart host for a number of clients is concerned
52218 with outgoing relaying from those clients to the Internet at large. Often the
52219 same host is fulfilling both functions,
52220 but in principle these two kinds of relaying are entirely independent. What is
52221 not wanted is the transmission of mail from arbitrary remote hosts through your
52222 system to arbitrary domains.
52225 You can implement relay control by means of suitable statements in the ACL that
52226 runs for each RCPT command. For convenience, it is often easiest to use
52227 Exim’s named list facility to define the domains and hosts involved. For
52228 example, suppose you want to do the following:
52233 Deliver a number of domains to mailboxes on the local host (or process them
52234 locally in some other way). Let’s say these are <emphasis>my.dom1.example</emphasis> and
52235 <emphasis>my.dom2.example</emphasis>.
52240 Relay mail for a number of other domains for which you are the secondary MX.
52241 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
52246 Relay mail from the hosts on your local LAN, to whatever domains are involved.
52247 Suppose your LAN is 192.168.45.0/24.
52252 In the main part of the configuration, you put the following definitions:
52254 <literallayout class="monospaced">
52255 domainlist local_domains = my.dom1.example : my.dom2.example
52256 domainlist relay_domains = friend1.example : friend2.example
52257 hostlist relay_hosts = 192.168.45.0/24
52260 Now you can use these definitions in the ACL that is run for every RCPT
52263 <literallayout class="monospaced">
52265 accept domains = +local_domains : +relay_domains
52266 accept hosts = +relay_hosts
52269 The first statement accepts any RCPT command that contains an address in
52270 the local or relay domains. For any other domain, control passes to the second
52271 statement, which accepts the command only if it comes from one of the relay
52272 hosts. In practice, you will probably want to make your ACL more sophisticated
52273 than this, for example, by including sender and recipient verification. The
52274 default configuration includes a more comprehensive example, which is described
52275 in chapter <xref linkend="CHAPdefconfil"/>.
52278 <section id="SECTcheralcon">
52279 <title>Checking a relay configuration</title>
52281 <indexterm role="concept">
52282 <primary>relaying</primary>
52283 <secondary>checking control of</secondary>
52285 You can check the relay characteristics of your configuration in the same way
52286 that you can test any ACL behaviour for an incoming SMTP connection, by using
52287 the <option>-bh</option> option to run a fake SMTP session with which you interact.
52290 For specifically testing for unwanted relaying, the host
52291 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
52292 host from the host on which Exim is running, using the normal telnet port, you
52293 will see a normal telnet connection message and then quite a long delay. Be
52294 patient. The remote host is making an SMTP connection back to your host, and
52295 trying a number of common probes to test for open relay vulnerability. The
52296 results of the tests will eventually appear on your terminal.
52297 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
52302 <chapter id="CHAPexiscan">
52303 <title>Content scanning at ACL time</title>
52305 <indexterm role="concept" id="IIDcosca" class="startofrange">
52306 <primary>content scanning</primary>
52307 <secondary>at ACL time</secondary>
52309 The extension of Exim to include content scanning at ACL time, formerly known
52310 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
52311 was integrated into the main source for Exim release 4.50, and Tom continues to
52312 maintain it. Most of the wording of this chapter is taken from Tom’s
52316 It is also possible to scan the content of messages at other times. The
52317 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
52318 scanning after all the ACLs have run. A transport filter can be used to scan
52319 messages at delivery time (see the <option>transport_filter</option> option, described in
52320 chapter <xref linkend="CHAPtransportgeneric"/>).
52323 If you want to include the ACL-time content-scanning features when you compile
52324 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
52325 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
52330 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
52331 for all MIME parts for SMTP and non-SMTP messages, respectively.
52336 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
52337 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
52338 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
52343 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
52344 of messages, or parts of messages, for debugging purposes.
52349 Additional expansion variables that are set in the new ACL and by the new
52355 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
52360 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
52361 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
52362 condition is compiled, in addition to all the other content-scanning features.
52365 Content-scanning is continually evolving, and new features are still being
52366 added. While such features are still unstable and liable to incompatible
52367 changes, they are made available in Exim by setting options whose names begin
52368 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
52369 this manual. You can find out about them by reading the file called
52370 <filename>doc/experimental.txt</filename>.
52373 All the content-scanning facilities work on a MBOX copy of the message that is
52374 temporarily created in a file called:
52377 <<emphasis>spool_directory</emphasis>><literal>/scan/</literal><<emphasis>message_id</emphasis>>/<<emphasis>message_id</emphasis>><literal>.eml</literal>
52380 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
52381 expect an MBOX-like structure inside that file. The file is created when the
52382 first content scanning facility is called. Subsequent calls to content
52383 scanning conditions open the same file again. The directory is recursively
52384 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
52386 <literallayout class="monospaced">
52387 control = no_mbox_unspool
52390 has been encountered. When the MIME ACL decodes files, they are put into the
52391 same directory by default.
52393 <section id="SECTscanvirus">
52394 <title>Scanning for viruses</title>
52396 <indexterm role="concept">
52397 <primary>virus scanning</primary>
52399 <indexterm role="concept">
52400 <primary>content scanning</primary>
52401 <secondary>for viruses</secondary>
52403 <indexterm role="concept">
52404 <primary>content scanning</primary>
52405 <secondary>the <option>malware</option> condition</secondary>
52407 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
52408 It supports a <quote>generic</quote> interface to scanners called via the shell, and
52409 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
52410 in memory and thus are much faster.
52412 <para revisionflag="changed">
52413 <indexterm role="option">
52414 <primary><option>av_scanner</option></primary>
52416 You can set the <option>av_scanner</option> option in first part of the Exim configuration
52417 file to specify which scanner to use, together with any additional options that
52418 are needed. The basic syntax is as follows:
52420 <literallayout revisionflag="changed">
52421 <literal>av_scanner = <</literal><emphasis>scanner-type</emphasis><literal>>:<</literal><emphasis>option1</emphasis><literal>>:<</literal><emphasis>option2</emphasis><literal>>:[...]</literal>
52423 <para revisionflag="changed">
52424 If you do not set <option>av_scanner</option>, it defaults to
52426 <literallayout class="monospaced" revisionflag="changed">
52427 av_scanner = sophie:/var/run/sophie
52429 <para revisionflag="changed">
52430 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
52431 before use. The following scanner types are supported in this release:
52435 <term><option>aveserver</option></term>
52438 <indexterm role="concept">
52439 <primary>virus scanners</primary>
52440 <secondary>Kaspersky</secondary>
52442 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
52443 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
52444 which is the path to the daemon’s UNIX socket. The default is shown in this
52447 <literallayout class="monospaced">
52448 av_scanner = aveserver:/var/run/aveserver
52450 </listitem></varlistentry>
52451 <varlistentry revisionflag="changed">
52452 <term><option>clamd</option></term>
52454 <para revisionflag="changed">
52455 <indexterm role="concept">
52456 <primary>virus scanners</primary>
52457 <secondary>clamd</secondary>
52459 This daemon-type scanner is GPL and free. You can get it at
52460 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
52461 unpack MIME containers, so it used to be recommended to unpack MIME attachments
52462 in the MIME ACL. This no longer believed to be necessary. One option is
52463 required: either the path and name of a UNIX socket file, or a hostname or IP
52464 number, and a port, separated by space, as in the second of these examples:
52466 <literallayout class="monospaced" revisionflag="changed">
52467 av_scanner = clamd:/opt/clamd/socket
52468 av_scanner = clamd:192.0.2.3 1234
52469 av_scanner = clamd:192.0.2.3 1234:local
52471 <para revisionflag="changed">
52472 If the value of av_scanner points to a UNIX socket file or contains the local
52473 keyword, then the ClamAV interface will pass a filename containing the data
52474 to be scanned, which will should normally result in less I/O happening and be
52475 more efficient. Normally in the TCP case, the data is streamed to ClamAV as
52476 Exim does not assume that there is a common filesystem with the remote host.
52477 There is an option WITH_OLD_CLAMAV_STREAM in <filename>src/EDITME</filename> available, should
52478 you be running a version of ClamAV prior to 0.95.
52479 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
52480 contributing the code for this scanner.
52482 </listitem></varlistentry>
52484 <term><option>cmdline</option></term>
52487 <indexterm role="concept">
52488 <primary>virus scanners</primary>
52489 <secondary>command line interface</secondary>
52491 This is the keyword for the generic command line scanner interface. It can be
52492 used to attach virus scanners that are invoked from the shell. This scanner
52493 type takes 3 mandatory options:
52495 <orderedlist numeration="arabic">
52498 The full path and name of the scanner binary, with all command line options,
52499 and a placeholder (<literal>%s</literal>) for the directory to scan.
52504 A regular expression to match against the STDOUT and STDERR output of the
52505 virus scanner. If the expression matches, a virus was found. You must make
52506 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
52507 the <quote>trigger</quote> expression.
52512 Another regular expression, containing exactly one pair of parentheses, to
52513 match the name of the virus found in the scanners output. This is called the
52514 <quote>name</quote> expression.
52519 For example, Sophos Sweep reports a virus on a line like this:
52521 <literallayout class="monospaced">
52522 Virus 'W32/Magistr-B' found in file ./those.bat
52525 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
52526 name expression, we want to extract the W32/Magistr-B string, so we can match
52527 for the single quotes left and right of it. Altogether, this makes the
52528 configuration setting:
52530 <literallayout class="monospaced">
52531 av_scanner = cmdline:\
52532 /path/to/sweep -ss -all -rec -archive %s:\
52533 found in file:'(.+)'
52535 </listitem></varlistentry>
52537 <term><option>drweb</option></term>
52540 <indexterm role="concept">
52541 <primary>virus scanners</primary>
52542 <secondary>DrWeb</secondary>
52544 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
52545 argument, either a full path to a UNIX socket, or an IP address and port
52546 separated by white space, as in these examples:
52548 <literallayout class="monospaced">
52549 av_scanner = drweb:/var/run/drwebd.sock
52550 av_scanner = drweb:192.168.2.20 31337
52553 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
52554 is used. Thanks to Alex Miller for contributing the code for this scanner.
52556 </listitem></varlistentry>
52558 <term><option>fsecure</option></term>
52561 <indexterm role="concept">
52562 <primary>virus scanners</primary>
52563 <secondary>F-Secure</secondary>
52565 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
52566 argument which is the path to a UNIX socket. For example:
52568 <literallayout class="monospaced">
52569 av_scanner = fsecure:/path/to/.fsav
52572 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
52573 Thelmen for contributing the code for this scanner.
52575 </listitem></varlistentry>
52577 <term><option>kavdaemon</option></term>
52580 <indexterm role="concept">
52581 <primary>virus scanners</primary>
52582 <secondary>Kaspersky</secondary>
52584 This is the scanner daemon of Kaspersky Version 4. This version of the
52585 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
52586 scanner type takes one option, which is the path to the daemon’s UNIX socket.
52589 <literallayout class="monospaced">
52590 av_scanner = kavdaemon:/opt/AVP/AvpCtl
52593 The default path is <filename>/var/run/AvpCtl</filename>.
52595 </listitem></varlistentry>
52597 <term><option>mksd</option></term>
52600 <indexterm role="concept">
52601 <primary>virus scanners</primary>
52602 <secondary>mksd</secondary>
52604 This is a daemon type scanner that is aimed mainly at Polish users, though some
52605 parts of documentation are now available in English. You can get it at
52606 <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
52607 the maximum number of processes used simultaneously to scan the attachments,
52608 provided that the demime facility is employed and also provided that mksd has
52609 been run with at least the same number of child processes. For example:
52611 <literallayout class="monospaced">
52612 av_scanner = mksd:2
52615 You can safely omit this option (the default value is 1).
52617 </listitem></varlistentry>
52619 <term><option>sophie</option></term>
52622 <indexterm role="concept">
52623 <primary>virus scanners</primary>
52624 <secondary>Sophos and Sophie</secondary>
52626 Sophie is a daemon that uses Sophos’ <option>libsavi</option> library to scan for viruses.
52627 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
52628 for this scanner type is the path to the UNIX socket that Sophie uses for
52629 client communication. For example:
52631 <literallayout class="monospaced">
52632 av_scanner = sophie:/tmp/sophie
52635 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
52638 </listitem></varlistentry>
52641 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
52642 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
52646 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
52647 makes it possible to use different scanners. See further below for an example.
52648 The <option>malware</option> condition caches its results, so when you use it multiple times
52649 for the same message, the actual scanning process is only carried out once.
52650 However, using expandable items in <option>av_scanner</option> disables this caching, in
52651 which case each use of the <option>malware</option> condition causes a new scan of the
52655 The <option>malware</option> condition takes a right-hand argument that is expanded before
52656 use. It can then be one of
52661 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
52662 The condition succeeds if a virus was found, and fail otherwise. This is the
52668 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
52669 the condition fails immediately.
52674 A regular expression, in which case the message is scanned for viruses. The
52675 condition succeeds if a virus is found and its name matches the regular
52676 expression. This allows you to take special actions on certain types of virus.
52681 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
52682 even if there is a problem with the virus scanner. Otherwise, such a problem
52683 causes the ACL to defer.
52686 <indexterm role="variable">
52687 <primary><varname>$malware_name</varname></primary>
52689 When a virus is found, the condition sets up an expansion variable called
52690 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
52691 <option>message</option> modifier that specifies the error returned to the sender, and/or in
52695 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
52696 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
52697 <option>malware</option> condition.
52699 <para revisionflag="changed">
52700 Beware the interaction of Exim’s <option>message_size_limit</option> with any size limits
52701 imposed by your anti-virus scanner.
52704 Here is a very simple scanning example:
52706 <literallayout class="monospaced">
52707 deny message = This message contains malware ($malware_name)
52712 The next example accepts messages when there is a problem with the scanner:
52714 <literallayout class="monospaced">
52715 deny message = This message contains malware ($malware_name)
52717 malware = */defer_ok
52720 The next example shows how to use an ACL variable to scan with both sophie and
52721 aveserver. It assumes you have set:
52723 <literallayout class="monospaced">
52724 av_scanner = $acl_m0
52727 in the main Exim configuration.
52729 <literallayout class="monospaced">
52730 deny message = This message contains malware ($malware_name)
52731 set acl_m0 = sophie
52734 deny message = This message contains malware ($malware_name)
52735 set acl_m0 = aveserver
52739 <section id="SECTscanspamass">
52740 <title>Scanning with SpamAssassin</title>
52742 <indexterm role="concept">
52743 <primary>content scanning</primary>
52744 <secondary>for spam</secondary>
52746 <indexterm role="concept">
52747 <primary>spam scanning</primary>
52749 <indexterm role="concept">
52750 <primary>SpamAssassin</primary>
52752 The <option>spam</option> ACL condition calls SpamAssassin’s <option>spamd</option> daemon to get a spam
52753 score and a report for the message. You can get SpamAssassin at
52754 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
52755 installation, you can use CPAN by running:
52757 <literallayout class="monospaced">
52758 perl -MCPAN -e 'install Mail::SpamAssassin'
52761 SpamAssassin has its own set of configuration files. Please review its
52762 documentation to see how you can tweak it. The default installation should work
52766 <indexterm role="option">
52767 <primary><option>spamd_address</option></primary>
52769 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
52770 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
52771 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
52772 part of the Exim configuration as follows (example):
52774 <literallayout class="monospaced">
52775 spamd_address = 192.168.99.45 387
52778 You do not need to set this option if you use the default. As of version 2.60,
52779 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
52780 these, supply <option>spamd_address</option> with an absolute file name instead of a
52783 <literallayout class="monospaced">
52784 spamd_address = /var/run/spamd_socket
52787 You can have multiple <option>spamd</option> servers to improve scalability. These can
52788 reside on other hardware reachable over the network. To specify multiple
52789 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
52790 option, separated with colons:
52792 <literallayout class="monospaced">
52793 spamd_address = 192.168.2.10 783 : \
52794 192.168.2.11 783 : \
52798 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
52799 fashion. When a server fails to respond to the connection attempt, all other
52800 servers are tried until one succeeds. If no server responds, the <option>spam</option>
52804 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
52805 multiple <option>spamd</option> servers.
52808 The <option>spamd_address</option> variable is expanded before use if it starts with
52809 a dollar sign. In this case, the expansion may return a string that is
52810 used as the list so that multiple spamd servers can be the result of an
52814 <section id="SECID206">
52815 <title>Calling SpamAssassin from an Exim ACL</title>
52817 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
52819 <literallayout class="monospaced">
52820 deny message = This message was classified as SPAM
52824 The right-hand side of the <option>spam</option> condition specifies a name. This is
52825 relevant if you have set up multiple SpamAssassin profiles. If you do not want
52826 to scan using a specific profile, but rather use the SpamAssassin system-wide
52827 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
52828 However, you must put something on the right-hand side.
52831 The name allows you to use per-domain or per-user antispam profiles in
52832 principle, but this is not straightforward in practice, because a message may
52833 have multiple recipients, not necessarily all in the same domain. Because the
52834 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
52835 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
52839 The right-hand side of the <option>spam</option> condition is expanded before being used, so
52840 you can put lookups or conditions there. When the right-hand side evaluates to
52841 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
52844 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
52845 large ones may cause significant performance degradation. As most spam messages
52846 are quite small, it is recommended that you do not scan the big ones. For
52849 <literallayout class="monospaced">
52850 deny message = This message was classified as SPAM
52851 condition = ${if < {$message_size}{10K}}
52855 The <option>spam</option> condition returns true if the threshold specified in the user’s
52856 SpamAssassin profile has been matched or exceeded. If you want to use the
52857 <option>spam</option> condition for its side effects (see the variables below), you can make
52858 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
52860 <para revisionflag="changed">
52861 <indexterm role="concept">
52862 <primary>spam scanning</primary>
52863 <secondary>returned variables</secondary>
52865 When the <option>spam</option> condition is run, it sets up a number of expansion
52866 variables. These variables are saved with the received message, thus they are
52867 available for use at delivery time.
52871 <term><varname>$spam_score</varname></term>
52874 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
52875 for inclusion in log or reject messages.
52877 </listitem></varlistentry>
52878 <varlistentry revisionflag="changed">
52879 <term><varname>$spam_score_int</varname></term>
52881 <para revisionflag="changed">
52882 The spam score of the message, multiplied by ten, as an integer value. For
52883 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
52884 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
52885 The integer value is useful for numeric comparisons in conditions.
52887 </listitem></varlistentry>
52889 <term><varname>$spam_bar</varname></term>
52892 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
52893 integer part of the spam score value. A spam score of 4.4 would have a
52894 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
52895 headers, since MUAs can match on such strings.
52897 </listitem></varlistentry>
52899 <term><varname>$spam_report</varname></term>
52902 A multiline text table, containing the full SpamAssassin report for the
52903 message. Useful for inclusion in headers or reject messages.
52905 </listitem></varlistentry>
52908 The <option>spam</option> condition caches its results unless expansion in
52909 spamd_address was used. If you call it again with the same user name, it
52910 does not scan again, but rather returns the same values as before.
52913 The <option>spam</option> condition returns DEFER if there is any error while running
52914 the message through SpamAssassin or if the expansion of spamd_address
52915 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
52916 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
52917 spam condition, like this:
52919 <literallayout class="monospaced">
52920 deny message = This message was classified as SPAM
52921 spam = joe/defer_ok
52924 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
52927 Here is a longer, commented example of the use of the <option>spam</option>
52930 <literallayout class="monospaced">
52931 # put headers in all messages (no matter if spam or not)
52932 warn spam = nobody:true
52933 add_header = X-Spam-Score: $spam_score ($spam_bar)
52934 add_header = X-Spam-Report: $spam_report
52936 # add second subject line with *SPAM* marker when message
52937 # is over threshold
52939 add_header = Subject: *SPAM* $h_Subject:
52941 # reject spam at high scores (> 12)
52942 deny message = This message scored $spam_score spam points.
52944 condition = ${if >{$spam_score_int}{120}{1}{0}}
52947 <section id="SECTscanmimepart">
52948 <title>Scanning MIME parts</title>
52950 <indexterm role="concept">
52951 <primary>content scanning</primary>
52952 <secondary>MIME parts</secondary>
52954 <indexterm role="concept">
52955 <primary>MIME content scanning</primary>
52957 <indexterm role="option">
52958 <primary><option>acl_smtp_mime</option></primary>
52960 <indexterm role="option">
52961 <primary><option>acl_not_smtp_mime</option></primary>
52963 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
52964 each MIME part of an SMTP message, including multipart types, in the sequence
52965 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
52966 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
52967 options may both refer to the same ACL if you want the same processing in both
52971 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
52972 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
52973 the case of a non-SMTP message. However, a MIME ACL is called only if the
52974 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
52975 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
52976 result code is sent to the client. In the case of an SMTP message, the
52977 <option>acl_smtp_data</option> ACL is not called when this happens.
52980 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
52981 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
52982 condition to match against the raw MIME part. You can also use the
52983 <option>mime_regex</option> condition to match against the decoded MIME part (see section
52984 <xref linkend="SECTscanregex"/>).
52987 At the start of a MIME ACL, a number of variables are set from the header
52988 information for the relevant MIME part. These are described below. The contents
52989 of the MIME part are not by default decoded into a disk file except for MIME
52990 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
52991 part into a disk file, you can use the <option>decode</option> condition. The general
52995 <literal>decode = [/</literal><<emphasis>path</emphasis>><literal>/]</literal><<emphasis>filename</emphasis>>
52998 The right hand side is expanded before use. After expansion,
53001 <orderedlist numeration="arabic">
53004 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
53009 The string <quote>default</quote>. In that case, the file is put in the temporary
53010 <quote>default</quote> directory <<emphasis>spool_directory</emphasis>><filename>/scan/</filename><<emphasis>message_id</emphasis>><filename>/</filename> with
53011 a sequential file name consisting of the message id and a sequence number. The
53012 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
53017 A full path name starting with a slash. If the full name is an existing
53018 directory, it is used as a replacement for the default directory. The filename
53019 is then sequentially assigned. If the path does not exist, it is used as
53020 the full path and file name.
53025 If the string does not start with a slash, it is used as the
53026 filename, and the default path is then used.
53031 The <option>decode</option> condition normally succeeds. It is only false for syntax
53032 errors or unusual circumstances such as memory shortages. You can easily decode
53033 a file with its original, proposed filename using
53035 <literallayout class="monospaced">
53036 decode = $mime_filename
53039 However, you should keep in mind that <varname>$mime_filename</varname> might contain
53040 anything. If you place files outside of the default path, they are not
53041 automatically unlinked.
53044 For RFC822 attachments (these are messages attached to messages, with a
53045 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
53046 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
53047 variable is set (see below). Attached messages are always decoded to disk
53048 before being checked, and the files are unlinked once the check is done.
53051 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
53052 used to match regular expressions against raw and decoded MIME parts,
53053 respectively. They are described in section <xref linkend="SECTscanregex"/>.
53056 <indexterm role="concept">
53057 <primary>MIME content scanning</primary>
53058 <secondary>returned variables</secondary>
53060 The following list describes all expansion variables that are
53061 available in the MIME ACL:
53065 <term><varname>$mime_boundary</varname></term>
53068 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
53069 have a boundary string, which is stored in this variable. If the current part
53070 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
53071 contains the empty string.
53073 </listitem></varlistentry>
53075 <term><varname>$mime_charset</varname></term>
53078 This variable contains the character set identifier, if one was found in the
53079 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
53081 <literallayout class="monospaced">
53087 Please note that this value is not normalized, so you should do matches
53088 case-insensitively.
53090 </listitem></varlistentry>
53092 <term><varname>$mime_content_description</varname></term>
53095 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
53096 header. It can contain a human-readable description of the parts content. Some
53097 implementations repeat the filename for attachments here, but they are usually
53098 only used for display purposes.
53100 </listitem></varlistentry>
53102 <term><varname>$mime_content_disposition</varname></term>
53105 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
53106 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
53108 </listitem></varlistentry>
53110 <term><varname>$mime_content_id</varname></term>
53113 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
53114 This is a unique ID that can be used to reference a part from another part.
53116 </listitem></varlistentry>
53118 <term><varname>$mime_content_size</varname></term>
53121 This variable is set only after the <option>decode</option> modifier (see above) has been
53122 successfully run. It contains the size of the decoded part in kilobytes. The
53123 size is always rounded up to full kilobytes, so only a completely empty part
53124 has a <varname>$mime_content_size</varname> of zero.
53126 </listitem></varlistentry>
53128 <term><varname>$mime_content_transfer_encoding</varname></term>
53131 This variable contains the normalized content of the
53132 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
53133 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
53135 </listitem></varlistentry>
53137 <term><varname>$mime_content_type</varname></term>
53140 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
53141 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
53142 are some examples of popular MIME types, as they may appear in this variable:
53144 <literallayout class="monospaced">
53147 application/octet-stream
53152 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
53155 </listitem></varlistentry>
53157 <term><varname>$mime_decoded_filename</varname></term>
53160 This variable is set only after the <option>decode</option> modifier (see above) has been
53161 successfully run. It contains the full path and file name of the file
53162 containing the decoded data.
53164 </listitem></varlistentry>
53167 <indexterm role="concept">
53168 <primary>RFC 2047</primary>
53173 <term><varname>$mime_filename</varname></term>
53176 This is perhaps the most important of the MIME variables. It contains a
53177 proposed filename for an attachment, if one was found in either the
53178 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
53179 RFC2047 decoded, but no additional sanity checks are done. If no filename was
53180 found, this variable contains the empty string.
53182 </listitem></varlistentry>
53184 <term><varname>$mime_is_coverletter</varname></term>
53187 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
53188 attached data. It can be used to clamp down on flashy or unnecessarily encoded
53189 content in the cover letter, while not restricting attachments at all.
53192 The variable contains 1 (true) for a MIME part believed to be part of the
53193 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
53196 <orderedlist numeration="arabic">
53199 The outermost MIME part of a message is always a cover letter.
53204 If a multipart/alternative or multipart/related MIME part is a cover letter,
53205 so are all MIME subparts within that multipart.
53210 If any other multipart is a cover letter, the first subpart is a cover letter,
53211 and the rest are attachments.
53216 All parts contained within an attachment multipart are attachments.
53221 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
53222 alternative plain text), while allowing HTML files to be attached. HTML
53223 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
53225 <literallayout class="monospaced">
53226 deny message = HTML mail is not accepted here
53227 !condition = $mime_is_rfc822
53228 condition = $mime_is_coverletter
53229 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
53231 </listitem></varlistentry>
53233 <term><varname>$mime_is_multipart</varname></term>
53236 This variable has the value 1 (true) when the current part has the main type
53237 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
53238 Since multipart entities only serve as containers for other parts, you may not
53239 want to carry out specific actions on them.
53241 </listitem></varlistentry>
53243 <term><varname>$mime_is_rfc822</varname></term>
53246 This variable has the value 1 (true) if the current part is not a part of the
53247 checked message itself, but part of an attached message. Attached message
53248 decoding is fully recursive.
53250 </listitem></varlistentry>
53252 <term><varname>$mime_part_count</varname></term>
53255 This variable is a counter that is raised for each processed MIME part. It
53256 starts at zero for the very first part (which is usually a multipart). The
53257 counter is per-message, so it is reset when processing RFC822 attachments (see
53258 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
53259 complete, so you can use it in the DATA ACL to determine the number of MIME
53260 parts of a message. For non-MIME messages, this variable contains the value -1.
53262 </listitem></varlistentry>
53265 <section id="SECTscanregex">
53266 <title>Scanning with regular expressions</title>
53268 <indexterm role="concept">
53269 <primary>content scanning</primary>
53270 <secondary>with regular expressions</secondary>
53272 <indexterm role="concept">
53273 <primary>regular expressions</primary>
53274 <secondary>content scanning with</secondary>
53276 You can specify your own custom regular expression matches on the full body of
53277 the message, or on individual MIME parts.
53280 The <option>regex</option> condition takes one or more regular expressions as arguments and
53281 matches them against the full message (when called in the DATA ACL) or a raw
53282 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
53283 linewise, with a maximum line length of 32K characters. That means you cannot
53284 have multiline matches with the <option>regex</option> condition.
53287 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
53288 to 32K of decoded content (the whole content at once, not linewise). If the
53289 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
53290 is decoded automatically when <option>mime_regex</option> is executed (using default path
53291 and filename values). If the decoded data is larger than 32K, only the first
53292 32K characters are checked.
53295 The regular expressions are passed as a colon-separated list. To include a
53296 literal colon, you must double it. Since the whole right-hand side string is
53297 expanded before being used, you must also escape dollar signs and backslashes
53298 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
53299 Here is a simple example that contains two regular expressions:
53301 <literallayout class="monospaced">
53302 deny message = contains blacklisted regex ($regex_match_string)
53303 regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
53306 The conditions returns true if any one of the regular expressions matches. The
53307 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
53308 matching regular expression.
53311 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
53315 <section id="SECTdemimecond">
53316 <title>The demime condition</title>
53318 <indexterm role="concept">
53319 <primary>content scanning</primary>
53320 <secondary>MIME checking</secondary>
53322 <indexterm role="concept">
53323 <primary>MIME content scanning</primary>
53325 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
53326 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
53327 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
53328 ACL functionality, but provides no additional facilities. Please note that this
53329 condition is deprecated and kept only for backward compatibility. You must set
53330 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
53331 use the <option>demime</option> condition.
53334 The <option>demime</option> condition unpacks MIME containers in the message. It detects
53335 errors in MIME containers and can match file extensions found in the message
53336 against a list. Using this facility produces files containing the unpacked MIME
53337 parts of the message in the temporary scan directory. If you do antivirus
53338 scanning, it is recommended that you use the <option>demime</option> condition before the
53339 antivirus (<option>malware</option>) condition.
53342 On the right-hand side of the <option>demime</option> condition you can pass a
53343 colon-separated list of file extensions that it should match against. For
53346 <literallayout class="monospaced">
53347 deny message = Found blacklisted file attachment
53348 demime = vbs:com:bat:pif:prf:lnk
53351 If one of the file extensions is found, the condition is true, otherwise it is
53352 false. If there is a temporary error while demimeing (for example, <quote>disk
53353 full</quote>), the condition defers, and the message is temporarily rejected (unless
53354 the condition is on a <option>warn</option> verb).
53357 The right-hand side is expanded before being treated as a list, so you can have
53358 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
53359 zero (<quote>0</quote>), no demimeing is done and the condition is false.
53362 The <option>demime</option> condition set the following variables:
53366 <term><varname>$demime_errorlevel</varname></term>
53369 <indexterm role="variable">
53370 <primary><varname>$demime_errorlevel</varname></primary>
53372 When an error is detected in a MIME container, this variable contains the
53373 severity of the error, as an integer number. The higher the value, the more
53374 severe the error (the current maximum value is 3). If this variable is unset or
53375 zero, no error occurred.
53377 </listitem></varlistentry>
53379 <term><varname>$demime_reason</varname></term>
53382 <indexterm role="variable">
53383 <primary><varname>$demime_reason</varname></primary>
53385 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
53386 human-readable text string describing the MIME error that occurred.
53388 </listitem></varlistentry>
53392 <term><varname>$found_extension</varname></term>
53395 <indexterm role="variable">
53396 <primary><varname>$found_extension</varname></primary>
53398 When the <option>demime</option> condition is true, this variable contains the file
53399 extension it found.
53401 </listitem></varlistentry>
53404 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
53405 the <option>demime</option> condition, and are not changed on subsequent calls.
53408 If you do not want to check for file extensions, but rather use the <option>demime</option>
53409 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
53410 right-hand side value. Here is a more elaborate example of how to use this
53413 <literallayout class="monospaced">
53414 # Reject messages with serious MIME container errors
53415 deny message = Found MIME error ($demime_reason).
53417 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
53419 # Reject known virus spreading file extensions.
53420 # Accepting these is pretty much braindead.
53421 deny message = contains $found_extension file (blacklisted).
53422 demime = com:vbs:bat:pif:scr
53424 # Freeze .exe and .doc files. Postmaster can
53425 # examine them and eventually thaw them.
53426 deny log_message = Another $found_extension file.
53431 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
53436 <chapter id="CHAPlocalscan">
53437 <title>Adding a local scan function to Exim</title>
53438 <titleabbrev>Local scan function</titleabbrev>
53440 <indexterm role="concept" id="IIDlosca" class="startofrange">
53441 <primary><function>local_scan()</function> function</primary>
53442 <secondary>description of</secondary>
53444 <indexterm role="concept">
53445 <primary>customizing</primary>
53446 <secondary>input scan using C function</secondary>
53448 <indexterm role="concept">
53449 <primary>policy control</primary>
53450 <secondary>by local scan function</secondary>
53452 In these days of email worms, viruses, and ever-increasing spam, some sites
53453 want to apply a lot of checking to messages before accepting them.
53456 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
53457 passing messages to external virus and spam scanning software. You can also do
53458 a certain amount in Exim itself through string expansions and the <option>condition</option>
53459 condition in the ACL that runs after the SMTP DATA command or the ACL for
53460 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
53463 To allow for further customization to a site’s own requirements, there is the
53464 possibility of linking Exim with a private message scanning function, written
53465 in C. If you want to run code that is written in something other than C, you
53466 can of course use a little C stub to call it.
53469 The local scan function is run once for every incoming message, at the point
53470 when Exim is just about to accept the message.
53471 It can therefore be used to control non-SMTP messages from local processes as
53472 well as messages arriving via SMTP.
53475 Exim applies a timeout to calls of the local scan function, and there is an
53476 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
53477 Zero means <quote>no timeout</quote>.
53478 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
53479 before calling the local scan function, so that the most common types of crash
53480 are caught. If the timeout is exceeded or one of those signals is caught, the
53481 incoming message is rejected with a temporary error if it is an SMTP message.
53482 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
53483 code. The incident is logged on the main and reject logs.
53485 <section id="SECID207">
53486 <title>Building Exim to use a local scan function</title>
53488 <indexterm role="concept">
53489 <primary><function>local_scan()</function> function</primary>
53490 <secondary>building Exim to use</secondary>
53492 To make use of the local scan function feature, you must tell Exim where your
53493 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
53494 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
53495 directory, so you might set
53497 <literallayout class="monospaced">
53498 LOCAL_SCAN_SOURCE=Local/local_scan.c
53501 for example. The function must be called <function>local_scan()</function>. It is called by
53502 Exim after it has received a message, when the success return code is about to
53503 be sent. This is after all the ACLs have been run. The return code from your
53504 function controls whether the message is actually accepted or not. There is a
53505 commented template function (that just accepts the message) in the file
53506 _src/local_scan.c_.
53509 If you want to make use of Exim’s run time configuration file to set options
53510 for your <function>local_scan()</function> function, you must also set
53512 <literallayout class="monospaced">
53513 LOCAL_SCAN_HAS_OPTIONS=yes
53516 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
53519 <section id="SECTapiforloc">
53520 <title>API for local_scan()</title>
53522 <indexterm role="concept">
53523 <primary><function>local_scan()</function> function</primary>
53524 <secondary>API description</secondary>
53526 You must include this line near the start of your code:
53528 <literallayout class="monospaced">
53529 #include "local_scan.h"
53532 This header file defines a number of variables and other values, and the
53533 prototype for the function itself. Exim is coded to use unsigned char values
53534 almost exclusively, and one of the things this header defines is a shorthand
53535 for <literal>unsigned char</literal> called <literal>uschar</literal>.
53536 It also contains the following macro definitions, to simplify casting character
53537 strings and pointers to character strings:
53539 <literallayout class="monospaced">
53540 #define CS (char *)
53541 #define CCS (const char *)
53542 #define CSS (char **)
53543 #define US (unsigned char *)
53544 #define CUS (const unsigned char *)
53545 #define USS (unsigned char **)
53548 The function prototype for <function>local_scan()</function> is:
53550 <literallayout class="monospaced">
53551 extern int local_scan(int fd, uschar **return_text);
53554 The arguments are as follows:
53559 <option>fd</option> is a file descriptor for the file that contains the body of the message
53560 (the -D file). The file is open for reading and writing, but updating it is not
53561 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
53564 The descriptor is positioned at character 19 of the file, which is the first
53565 character of the body itself, because the first 19 characters are the message
53566 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
53567 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
53568 case this changes in some future version.
53573 <option>return_text</option> is an address which you can use to return a pointer to a text
53574 string at the end of the function. The value it points to on entry is NULL.
53579 The function must return an <option>int</option> value which is one of the following macros:
53583 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
53586 <indexterm role="variable">
53587 <primary><varname>$local_scan_data</varname></primary>
53589 The message is accepted. If you pass back a string of text, it is saved with
53590 the message, and made available in the variable <varname>$local_scan_data</varname>. No
53591 newlines are permitted (if there are any, they are turned into spaces) and the
53592 maximum length of text is 1000 characters.
53594 </listitem></varlistentry>
53596 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
53599 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53600 queued without immediate delivery, and is frozen.
53602 </listitem></varlistentry>
53604 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
53607 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
53608 queued without immediate delivery.
53610 </listitem></varlistentry>
53612 <term><literal>LOCAL_SCAN_REJECT</literal></term>
53615 The message is rejected; the returned text is used as an error message which is
53616 passed back to the sender and which is also logged. Newlines are permitted –
53617 they cause a multiline response for SMTP rejections, but are converted to
53618 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
53621 </listitem></varlistentry>
53623 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
53626 The message is temporarily rejected; the returned text is used as an error
53627 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
53628 problem</quote> is used.
53630 </listitem></varlistentry>
53632 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
53635 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
53636 message is not written to the reject log. It has the effect of unsetting the
53637 <option>rejected_header</option> log selector for just this rejection. If
53638 <option>rejected_header</option> is already unset (see the discussion of the
53639 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
53640 same as LOCAL_SCAN_REJECT.
53642 </listitem></varlistentry>
53644 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
53647 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
53648 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
53650 </listitem></varlistentry>
53653 If the message is not being received by interactive SMTP, rejections are
53654 reported by writing to <option>stderr</option> or by sending an email, as configured by the
53655 <option>-oe</option> command line options.
53658 <section id="SECTconoptloc">
53659 <title>Configuration options for local_scan()</title>
53661 <indexterm role="concept">
53662 <primary><function>local_scan()</function> function</primary>
53663 <secondary>configuration options</secondary>
53665 It is possible to have option settings in the main configuration file
53666 that set values in static variables in the <function>local_scan()</function> module. If you
53667 want to do this, you must have the line
53669 <literallayout class="monospaced">
53670 LOCAL_SCAN_HAS_OPTIONS=yes
53673 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
53674 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
53675 file, you must define static variables to hold the option values, and a table
53679 The table must be a vector called <option>local_scan_options</option>, of type
53680 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
53681 and a pointer to the variable that holds the value. The entries must appear in
53682 alphabetical order. Following <option>local_scan_options</option> you must also define a
53683 variable called <option>local_scan_options_count</option> that contains the number of
53684 entries in the table. Here is a short example, showing two kinds of option:
53686 <literallayout class="monospaced">
53687 static int my_integer_option = 42;
53688 static uschar *my_string_option = US"a default string";
53690 optionlist local_scan_options[] = {
53691 { "my_integer", opt_int, &my_integer_option },
53692 { "my_string", opt_stringptr, &my_string_option }
53695 int local_scan_options_count =
53696 sizeof(local_scan_options)/sizeof(optionlist);
53699 The values of the variables can now be changed from Exim’s runtime
53700 configuration file by including a local scan section as in this example:
53702 <literallayout class="monospaced">
53705 my_string = some string of text...
53708 The available types of option data are as follows:
53712 <term><emphasis role="bold">opt_bool</emphasis></term>
53715 This specifies a boolean (true/false) option. The address should point to a
53716 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
53717 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
53718 whether such a variable has been set at all, you can initialize it to
53719 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
53722 </listitem></varlistentry>
53724 <term><emphasis role="bold">opt_fixed</emphasis></term>
53727 This specifies a fixed point number, such as is used for load averages.
53728 The address should point to a variable of type <literal>int</literal>. The value is stored
53729 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
53731 </listitem></varlistentry>
53733 <term><emphasis role="bold">opt_int</emphasis></term>
53736 This specifies an integer; the address should point to a variable of type
53737 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
53740 </listitem></varlistentry>
53742 <term><emphasis role="bold">opt_mkint</emphasis></term>
53745 This is the same as <option>opt_int</option>, except that when such a value is output in a
53746 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
53747 printed with the suffix K or M.
53749 </listitem></varlistentry>
53751 <term><emphasis role="bold">opt_octint</emphasis></term>
53754 This also specifies an integer, but the value is always interpreted as an
53755 octal integer, whether or not it starts with the digit zero, and it is
53756 always output in octal.
53758 </listitem></varlistentry>
53760 <term><emphasis role="bold">opt_stringptr</emphasis></term>
53763 This specifies a string value; the address must be a pointer to a
53764 variable that points to a string (for example, of type <literal>uschar *</literal>).
53766 </listitem></varlistentry>
53768 <term><emphasis role="bold">opt_time</emphasis></term>
53771 This specifies a time interval value. The address must point to a variable of
53772 type <literal>int</literal>. The value that is placed there is a number of seconds.
53774 </listitem></varlistentry>
53777 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
53778 out the values of all the <function>local_scan()</function> options.
53781 <section id="SECID208">
53782 <title>Available Exim variables</title>
53784 <indexterm role="concept">
53785 <primary><function>local_scan()</function> function</primary>
53786 <secondary>available Exim variables</secondary>
53788 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
53789 are the only ones that are guaranteed to be maintained from release to release.
53790 Note, however, that you can obtain the value of any Exim expansion variable,
53791 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
53792 C variables are as follows:
53796 <term><emphasis role="bold">int body_linecount</emphasis></term>
53799 This variable contains the number of lines in the message’s body.
53801 </listitem></varlistentry>
53803 <term><emphasis role="bold">int body_zerocount</emphasis></term>
53806 This variable contains the number of binary zero bytes in the message’s body.
53808 </listitem></varlistentry>
53810 <term><emphasis role="bold">unsigned int debug_selector</emphasis></term>
53813 This variable is set to zero when no debugging is taking place. Otherwise, it
53814 is a bitmap of debugging selectors. Two bits are identified for use in
53815 <function>local_scan()</function>; they are defined as macros:
53820 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
53821 testing option that is not privileged – any caller may set it. All the
53822 other selector bits can be set only by admin users.
53827 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
53828 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
53834 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
53835 selected, you should use code like this:
53837 <literallayout class="monospaced">
53838 if ((debug_selector & D_local_scan) != 0)
53839 debug_printf("xxx", ...);
53841 </listitem></varlistentry>
53843 <term><emphasis role="bold">uschar *expand_string_message</emphasis></term>
53846 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
53847 variable <option>expand_string_message</option> contains the error message, zero-terminated.
53849 </listitem></varlistentry>
53851 <term><emphasis role="bold">header_line *header_list</emphasis></term>
53854 A pointer to a chain of header lines. The <option>header_line</option> structure is
53857 </listitem></varlistentry>
53859 <term><emphasis role="bold">header_line *header_last</emphasis></term>
53862 A pointer to the last of the header lines.
53864 </listitem></varlistentry>
53866 <term><emphasis role="bold">uschar *headers_charset</emphasis></term>
53869 The value of the <option>headers_charset</option> configuration option.
53871 </listitem></varlistentry>
53873 <term><emphasis role="bold">BOOL host_checking</emphasis></term>
53876 This variable is TRUE during a host checking session that is initiated by the
53877 <option>-bh</option> command line option.
53879 </listitem></varlistentry>
53881 <term><emphasis role="bold">uschar *interface_address</emphasis></term>
53884 The IP address of the interface that received the message, as a string. This
53885 is NULL for locally submitted messages.
53887 </listitem></varlistentry>
53889 <term><emphasis role="bold">int interface_port</emphasis></term>
53892 The port on which this message was received. When testing with the <option>-bh</option>
53893 command line option, the value of this variable is -1 unless a port has been
53894 specified via the <option>-oMi</option> option.
53896 </listitem></varlistentry>
53898 <term><emphasis role="bold">uschar *message_id</emphasis></term>
53901 This variable contains Exim’s message id for the incoming message (the value of
53902 <varname>$message_exim_id</varname>) as a zero-terminated string.
53904 </listitem></varlistentry>
53906 <term><emphasis role="bold">uschar *received_protocol</emphasis></term>
53909 The name of the protocol by which the message was received.
53911 </listitem></varlistentry>
53913 <term><emphasis role="bold">int recipients_count</emphasis></term>
53916 The number of accepted recipients.
53918 </listitem></varlistentry>
53920 <term><emphasis role="bold">recipient_item *recipients_list</emphasis></term>
53923 <indexterm role="concept">
53924 <primary>recipient</primary>
53925 <secondary>adding in local scan</secondary>
53927 <indexterm role="concept">
53928 <primary>recipient</primary>
53929 <secondary>removing in local scan</secondary>
53931 The list of accepted recipients, held in a vector of length
53932 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
53933 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
53934 below). You can delete recipients by removing them from the vector and
53935 adjusting the value in <option>recipients_count</option>. In particular, by setting
53936 <option>recipients_count</option> to zero you remove all recipients. If you then return the
53937 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
53938 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
53939 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
53941 </listitem></varlistentry>
53943 <term><emphasis role="bold">uschar *sender_address</emphasis></term>
53946 The envelope sender address. For bounce messages this is the empty string.
53948 </listitem></varlistentry>
53950 <term><emphasis role="bold">uschar *sender_host_address</emphasis></term>
53953 The IP address of the sending host, as a string. This is NULL for
53954 locally-submitted messages.
53956 </listitem></varlistentry>
53958 <term><emphasis role="bold">uschar *sender_host_authenticated</emphasis></term>
53961 The name of the authentication mechanism that was used, or NULL if the message
53962 was not received over an authenticated SMTP connection.
53964 </listitem></varlistentry>
53966 <term><emphasis role="bold">uschar *sender_host_name</emphasis></term>
53969 The name of the sending host, if known.
53971 </listitem></varlistentry>
53973 <term><emphasis role="bold">int sender_host_port</emphasis></term>
53976 The port on the sending host.
53978 </listitem></varlistentry>
53980 <term><emphasis role="bold">BOOL smtp_input</emphasis></term>
53983 This variable is TRUE for all SMTP input, including BSMTP.
53985 </listitem></varlistentry>
53987 <term><emphasis role="bold">BOOL smtp_batched_input</emphasis></term>
53990 This variable is TRUE for BSMTP input.
53992 </listitem></varlistentry>
53994 <term><emphasis role="bold">int store_pool</emphasis></term>
53997 The contents of this variable control which pool of memory is used for new
53998 requests. See section <xref linkend="SECTmemhanloc"/> for details.
54000 </listitem></varlistentry>
54003 <section id="SECID209">
54004 <title>Structure of header lines</title>
54006 The <option>header_line</option> structure contains the members listed below.
54007 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
54008 (see below). You can cause header lines to be ignored (deleted) by setting
54013 <term><emphasis role="bold">struct header_line *next</emphasis></term>
54016 A pointer to the next header line, or NULL for the last line.
54018 </listitem></varlistentry>
54020 <term><emphasis role="bold">int type</emphasis></term>
54023 A code identifying certain headers that Exim recognizes. The codes are printing
54024 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
54025 Notice in particular that any header line whose type is * is not transmitted
54026 with the message. This flagging is used for header lines that have been
54027 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
54028 lines.) Effectively, * means <quote>deleted</quote>.
54030 </listitem></varlistentry>
54032 <term><emphasis role="bold">int slen</emphasis></term>
54035 The number of characters in the header line, including the terminating and any
54038 </listitem></varlistentry>
54040 <term><emphasis role="bold">uschar *text</emphasis></term>
54043 A pointer to the text of the header. It always ends with a newline, followed by
54044 a zero byte. Internal newlines are preserved.
54046 </listitem></varlistentry>
54049 <section id="SECID210">
54050 <title>Structure of recipient items</title>
54052 The <option>recipient_item</option> structure contains these members:
54056 <term><emphasis role="bold">uschar *address</emphasis></term>
54059 This is a pointer to the recipient address as it was received.
54061 </listitem></varlistentry>
54063 <term><emphasis role="bold">int pno</emphasis></term>
54066 This is used in later Exim processing when top level addresses are created by
54067 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
54068 and must always contain -1 at this stage.
54070 </listitem></varlistentry>
54072 <term><emphasis role="bold">uschar *errors_to</emphasis></term>
54075 If this value is not NULL, bounce messages caused by failing to deliver to the
54076 recipient are sent to the address it contains. In other words, it overrides the
54077 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
54078 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
54079 an unqualified address, Exim qualifies it using the domain from
54080 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
54081 is NULL for all recipients.
54083 </listitem></varlistentry>
54086 <section id="SECID211">
54087 <title>Available Exim functions</title>
54089 <indexterm role="concept">
54090 <primary><function>local_scan()</function> function</primary>
54091 <secondary>available Exim functions</secondary>
54093 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
54094 These are the only ones that are guaranteed to be maintained from release to
54099 <term><emphasis role="bold">pid_t child_open(uschar **argv, uschar **envp, int newumask, int *infdptr, int *outfdptr, BOOL make_leader)</emphasis></term>
54102 This function creates a child process that runs the command specified by
54103 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
54104 be NULL if no environment variables are to be passed. A new umask is supplied
54105 for the process in <option>newumask</option>.
54108 Pipes to the standard input and output of the new process are set up
54109 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
54110 standard error is cloned to the standard output. If there are any file
54111 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
54112 argument is TRUE, the new process is made into a process group leader.
54115 The function returns the pid of the new process, or -1 if things go wrong.
54117 </listitem></varlistentry>
54119 <term><emphasis role="bold">int child_close(pid_t pid, int timeout)</emphasis></term>
54122 This function waits for a child process to terminate, or for a timeout (in
54123 seconds) to expire. A timeout value of zero means wait as long as it takes. The
54124 return value is as follows:
54132 The process terminated by a normal exit and the value is the process
54138 < 0 and > –256
54141 The process was terminated by a signal and the value is the negation of the
54150 The process timed out.
54158 The was some other error in wait(); <option>errno</option> is still set.
54162 </listitem></varlistentry>
54164 <term><emphasis role="bold">pid_t child_open_exim(int *fd)</emphasis></term>
54167 This function provide you with a means of submitting a new message to
54168 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
54169 want, but this packages it all up for you.) The function creates a pipe,
54170 forks a subprocess that is running
54172 <literallayout class="monospaced">
54173 exim -t -oem -oi -f <>
54176 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
54177 that is connected to the standard input. The yield of the function is the PID
54178 of the subprocess. You can then write a message to the file descriptor, with
54179 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
54182 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
54183 finish and to collect its ending status. A timeout value of zero is usually
54184 fine in this circumstance. Unless you have made a mistake with the recipient
54185 addresses, you should get a return code of zero.
54187 </listitem></varlistentry>
54189 <term><emphasis role="bold">pid_t child_open_exim2(int *fd, uschar *sender, uschar *sender_authentication)</emphasis></term>
54192 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
54196 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
54199 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
54201 </listitem></varlistentry>
54203 <term><emphasis role="bold">void debug_printf(char *, ...)</emphasis></term>
54206 This is Exim’s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
54207 output is written to the standard error stream. If no debugging is selected,
54208 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
54209 conditional on the <literal>local_scan</literal> debug selector by coding like this:
54211 <literallayout class="monospaced">
54212 if ((debug_selector & D_local_scan) != 0)
54213 debug_printf("xxx", ...);
54215 </listitem></varlistentry>
54217 <term><emphasis role="bold">uschar *expand_string(uschar *string)</emphasis></term>
54220 This is an interface to Exim’s string expansion code. The return value is the
54221 expanded string, or NULL if there was an expansion failure.
54222 The C variable <option>expand_string_message</option> contains an error message after an
54223 expansion failure. If expansion does not change the string, the return value is
54224 the pointer to the input string. Otherwise, the return value points to a new
54225 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
54226 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
54228 </listitem></varlistentry>
54230 <term><emphasis role="bold">void header_add(int type, char *format, ...)</emphasis></term>
54233 This function allows you to an add additional header line at the end of the
54234 existing ones. The first argument is the type, and should normally be a space
54235 character. The second argument is a format string and any number of
54236 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
54237 if you want, and you must ensure that the string ends with a newline.
54239 </listitem></varlistentry>
54241 <term><emphasis role="bold">void header_add_at_position(BOOL after, uschar *name, BOOL topnot, int type, char *format, ...)</emphasis></term>
54244 This function adds a new header line at a specified point in the header
54245 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
54248 If <option>name</option> is NULL, the new header is added at the end of the chain if
54249 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
54250 NULL, the header lines are searched for the first non-deleted header that
54251 matches the name. If one is found, the new header is added before it if
54252 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
54253 found header and any adjacent subsequent ones with the same name (even if
54254 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
54255 option controls where the header is added. If it is true, addition is at the
54256 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
54257 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
54259 <literallayout class="monospaced">
54260 header_add_at_position(TRUE, US"Received", TRUE,
54261 ' ', "X-xxx: ...");
54264 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
54265 there may not be if <option>received_header_text</option> expands to an empty string.
54267 </listitem></varlistentry>
54269 <term><emphasis role="bold">void header_remove(int occurrence, uschar *name)</emphasis></term>
54272 This function removes header lines. If <option>occurrence</option> is zero or negative, all
54273 occurrences of the header are removed. If occurrence is greater than zero, that
54274 particular instance of the header is removed. If no header(s) can be found that
54275 match the specification, the function does nothing.
54277 </listitem></varlistentry>
54279 <term><emphasis role="bold">BOOL header_testname(header_line *hdr, uschar *name, int length, BOOL notdel)</emphasis></term>
54282 This function tests whether the given header has the given name. It is not just
54283 a string comparison, because white space is permitted between the name and the
54284 colon. If the <option>notdel</option> argument is true, a false return is forced for all
54285 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
54287 <literallayout class="monospaced">
54288 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
54290 </listitem></varlistentry>
54292 <term><emphasis role="bold">uschar *lss_b64encode(uschar *cleartext, int length)</emphasis></term>
54295 <indexterm role="concept">
54296 <primary>base64 encoding</primary>
54297 <secondary>functions for <function>local_scan()</function> use</secondary>
54299 This function base64-encodes a string, which is passed by address and length.
54300 The text may contain bytes of any value, including zero. The result is passed
54301 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
54304 </listitem></varlistentry>
54306 <term><emphasis role="bold">int lss_b64decode(uschar *codetext, uschar **cleartext)</emphasis></term>
54309 This function decodes a base64-encoded string. Its arguments are a
54310 zero-terminated base64-encoded string and the address of a variable that is set
54311 to point to the result, which is in dynamic memory. The length of the decoded
54312 string is the yield of the function. If the input is invalid base64 data, the
54313 yield is -1. A zero byte is added to the end of the output string to make it
54314 easy to interpret as a C string (assuming it contains no zeros of its own). The
54315 added zero byte is not included in the returned count.
54317 </listitem></varlistentry>
54319 <term><emphasis role="bold">int lss_match_domain(uschar *domain, uschar *list)</emphasis></term>
54322 This function checks for a match in a domain list. Domains are always
54323 matched caselessly. The return value is one of the following:
54326 <literal>OK </literal> match succeeded
54327 <literal>FAIL </literal> match failed
54328 <literal>DEFER </literal> match deferred
54331 DEFER is usually caused by some kind of lookup defer, such as the
54332 inability to contact a database.
54334 </listitem></varlistentry>
54336 <term><emphasis role="bold">int lss_match_local_part(uschar *localpart, uschar *list, BOOL caseless)</emphasis></term>
54339 This function checks for a match in a local part list. The third argument
54340 controls case-sensitivity. The return values are as for
54341 <emphasis>lss_match_domain()</emphasis>.
54343 </listitem></varlistentry>
54345 <term><emphasis role="bold">int lss_match_address(uschar *address, uschar *list, BOOL caseless)</emphasis></term>
54348 This function checks for a match in an address list. The third argument
54349 controls the case-sensitivity of the local part match. The domain is always
54350 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
54352 </listitem></varlistentry>
54354 <term><emphasis role="bold">int lss_match_host(uschar *host_name, uschar *host_address, uschar *list)</emphasis></term>
54357 This function checks for a match in a host list. The most common usage is
54360 <literallayout class="monospaced">
54361 lss_match_host(sender_host_name, sender_host_address, ...)
54364 <indexterm role="variable">
54365 <primary><varname>$sender_host_address</varname></primary>
54367 An empty address field matches an empty item in the host list. If the host name
54368 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
54369 looked up if a host name is required to match an item in the list. The return
54370 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
54371 returns ERROR in the case when it had to look up a host name, but the lookup
54374 </listitem></varlistentry>
54376 <term><emphasis role="bold">void log_write(unsigned int selector, int which, char *format, ...)</emphasis></term>
54379 This function writes to Exim’s log files. The first argument should be zero (it
54380 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
54381 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
54382 them. It specifies to which log or logs the message is written. The remaining
54383 arguments are a format and relevant insertion arguments. The string should not
54384 contain any newlines, not even at the end.
54386 </listitem></varlistentry>
54388 <term><emphasis role="bold">void receive_add_recipient(uschar *address, int pno)</emphasis></term>
54391 This function adds an additional recipient to the message. The first argument
54392 is the recipient address. If it is unqualified (has no domain), it is qualified
54393 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
54396 This function does not allow you to specify a private <option>errors_to</option> address (as
54397 described with the structure of <option>recipient_item</option> above), because it pre-dates
54398 the addition of that field to the structure. However, it is easy to add such a
54399 value afterwards. For example:
54401 <literallayout class="monospaced">
54402 receive_add_recipient(US"monitor@mydom.example", -1);
54403 recipients_list[recipients_count-1].errors_to =
54404 US"postmaster@mydom.example";
54406 </listitem></varlistentry>
54408 <term><emphasis role="bold">BOOL receive_remove_recipient(uschar *recipient)</emphasis></term>
54411 This is a convenience function to remove a named recipient from the list of
54412 recipients. It returns true if a recipient was removed, and false if no
54413 matching recipient could be found. The argument must be a complete email
54416 </listitem></varlistentry>
54419 <indexterm role="concept">
54420 <primary>RFC 2047</primary>
54425 <term><emphasis role="bold">uschar rfc2047_decode(uschar *string, BOOL lencheck, uschar *target, int zeroval, int *lenptr, uschar **error)</emphasis></term>
54428 This function decodes strings that are encoded according to RFC 2047. Typically
54429 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
54430 from the Q or B encoding into a byte-string. Then, if provided with the name of
54431 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
54432 made to translate the result to the named character set. If this fails, the
54433 binary string is returned with an error message.
54436 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
54437 maximum MIME word length is enforced. The third argument is the target
54438 encoding, or NULL if no translation is wanted.
54441 <indexterm role="concept">
54442 <primary>binary zero</primary>
54443 <secondary>in RFC 2047 decoding</secondary>
54445 <indexterm role="concept">
54446 <primary>RFC 2047</primary>
54447 <secondary>binary zero in</secondary>
54449 If a binary zero is encountered in the decoded string, it is replaced by the
54450 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
54451 not be 0 because header lines are handled as zero-terminated strings.
54454 The function returns the result of processing the string, zero-terminated; if
54455 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
54456 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
54459 If an error is encountered, the function returns NULL and uses the <option>error</option>
54460 argument to return an error message. The variable pointed to by <option>error</option> is
54461 set to NULL if there is no error; it may be set non-NULL even when the function
54462 returns a non-NULL value if decoding was successful, but there was a problem
54465 </listitem></varlistentry>
54467 <term><emphasis role="bold">int smtp_fflush(void)</emphasis></term>
54470 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
54473 </listitem></varlistentry>
54475 <term><emphasis role="bold">void smtp_printf(char *, ...)</emphasis></term>
54478 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
54479 output stream. You should use this function only when there is an SMTP output
54480 stream, that is, when the incoming message is being received via interactive
54481 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
54482 is FALSE. If you want to test for an incoming message from another host (as
54483 opposed to a local process that used the <option>-bs</option> command line option), you can
54484 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
54488 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
54489 output function, so it can be used for all forms of SMTP connection.
54492 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
54493 must start with an appropriate response code: 550 if you are going to return
54494 LOCAL_SCAN_REJECT, 451 if you are going to return
54495 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
54496 initial lines of a multi-line response, the code must be followed by a hyphen
54497 to indicate that the line is not the final response line. You must also ensure
54498 that the lines you write terminate with CRLF. For example:
54500 <literallayout class="monospaced">
54501 smtp_printf("550-this is some extra info\r\n");
54502 return LOCAL_SCAN_REJECT;
54505 Note that you can also create multi-line responses by including newlines in
54506 the data returned via the <option>return_text</option> argument. The added value of using
54507 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
54508 multiple output lines.
54511 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
54512 does not automatically flush pending output, and therefore does not test
54513 the state of the stream. (In the main code of Exim, flushing and error
54514 detection is done when Exim is ready for the next SMTP input command.) If
54515 you want to flush the output and check for an error (for example, the
54516 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
54517 arguments. It flushes the output stream, and returns a non-zero value if there
54520 </listitem></varlistentry>
54522 <term><emphasis role="bold">void *store_get(int)</emphasis></term>
54525 This function accesses Exim’s internal store (memory) manager. It gets a new
54526 chunk of memory whose size is given by the argument. Exim bombs out if it ever
54527 runs out of memory. See the next section for a discussion of memory handling.
54529 </listitem></varlistentry>
54531 <term><emphasis role="bold">void *store_get_perm(int)</emphasis></term>
54534 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
54535 permanent pool. See the next section for a discussion of memory handling.
54537 </listitem></varlistentry>
54539 <term><emphasis role="bold">uschar *string_copy(uschar *string)</emphasis></term>
54544 </listitem></varlistentry>
54546 <term><emphasis role="bold">uschar *string_copyn(uschar *string, int length)</emphasis></term>
54551 </listitem></varlistentry>
54553 <term><emphasis role="bold">uschar *string_sprintf(char *format, ...)</emphasis></term>
54556 These three functions create strings using Exim’s dynamic memory facilities.
54557 The first makes a copy of an entire string. The second copies up to a maximum
54558 number of characters, indicated by the second argument. The third uses a format
54559 and insertion arguments to create a new string. In each case, the result is a
54560 pointer to a new string in the current memory pool. See the next section for
54563 </listitem></varlistentry>
54566 <section id="SECTmemhanloc">
54567 <title>More about Exim’s memory handling</title>
54569 <indexterm role="concept">
54570 <primary><function>local_scan()</function> function</primary>
54571 <secondary>memory handling</secondary>
54573 No function is provided for freeing memory, because that is never needed.
54574 The dynamic memory that Exim uses when receiving a message is automatically
54575 recycled if another message is received by the same process (this applies only
54576 to incoming SMTP connections – other input methods can supply only one
54577 message at a time). After receiving the last message, a reception process
54581 Because it is recycled, the normal dynamic memory cannot be used for holding
54582 data that must be preserved over a number of incoming messages on the same SMTP
54583 connection. However, Exim in fact uses two pools of dynamic memory; the second
54584 one is not recycled, and can be used for this purpose.
54587 If you want to allocate memory that remains available for subsequent messages
54588 in the same SMTP connection, you should set
54590 <literallayout class="monospaced">
54591 store_pool = POOL_PERM
54594 before calling the function that does the allocation. There is no need to
54595 restore the value if you do not need to; however, if you do want to revert to
54596 the normal pool, you can either restore the previous value of <option>store_pool</option> or
54597 set it explicitly to POOL_MAIN.
54600 The pool setting applies to all functions that get dynamic memory, including
54601 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
54602 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
54603 block of memory from the permanent pool while preserving the value of
54604 <option>store_pool</option>.
54605 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
54610 <chapter id="CHAPsystemfilter">
54611 <title>System-wide message filtering</title>
54613 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
54614 <primary>filter</primary>
54615 <secondary>system filter</secondary>
54617 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
54618 <primary>filtering all mail</primary>
54620 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
54621 <primary>system filter</primary>
54623 The previous chapters (on ACLs and the local scan function) describe checks
54624 that can be applied to messages before they are accepted by a host. There is
54625 also a mechanism for checking messages once they have been received, but before
54626 they are delivered. This is called the <emphasis>system filter</emphasis>.
54629 The system filter operates in a similar manner to users’ filter files, but it
54630 is run just once per message (however many recipients the message has).
54631 It should not normally be used as a substitute for routing, because <option>deliver</option>
54632 commands in a system router provide new envelope recipient addresses.
54633 The system filter must be an Exim filter. It cannot be a Sieve filter.
54636 The system filter is run at the start of a delivery attempt, before any routing
54637 is done. If a message fails to be completely delivered at the first attempt,
54638 the system filter is run again at the start of every retry.
54639 If you want your filter to do something only once per message, you can make use
54640 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
54641 prevent it happening on retries.
54644 <indexterm role="variable">
54645 <primary><varname>$domain</varname></primary>
54647 <indexterm role="variable">
54648 <primary><varname>$local_part</varname></primary>
54650 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
54651 specific to individual recipient addresses, such as <varname>$local_part</varname> and
54652 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
54653 you want to run a centrally-specified filter for each recipient address
54654 independently, you can do so by setting up a suitable <command>redirect</command> router, as
54655 described in section <xref linkend="SECTperaddfil"/> below.
54657 <section id="SECID212">
54658 <title>Specifying a system filter</title>
54660 <indexterm role="concept">
54661 <primary>uid (user id)</primary>
54662 <secondary>system filter</secondary>
54664 <indexterm role="concept">
54665 <primary>gid (group id)</primary>
54666 <secondary>system filter</secondary>
54668 The name of the file that contains the system filter must be specified by
54669 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
54670 other than root, you must also set <option>system_filter_user</option> and
54671 <option>system_filter_group</option> as appropriate. For example:
54673 <literallayout class="monospaced">
54674 system_filter = /etc/mail/exim.filter
54675 system_filter_user = exim
54678 If a system filter generates any deliveries directly to files or pipes (via the
54679 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
54680 specified by setting <option>system_filter_file_transport</option> and
54681 <option>system_filter_pipe_transport</option>, respectively. Similarly,
54682 <option>system_filter_reply_transport</option> must be set to handle any messages generated
54683 by the <option>reply</option> command.
54686 <section id="SECID213">
54687 <title>Testing a system filter</title>
54689 You can run simple tests of a system filter in the same way as for a user
54690 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
54691 are permitted only in system filters are recognized.
54694 If you want to test the combined effect of a system filter and a user filter,
54695 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
54698 <section id="SECID214">
54699 <title>Contents of a system filter</title>
54701 The language used to specify system filters is the same as for users’ filter
54702 files. It is described in the separate end-user document <emphasis>Exim’s interface to
54703 mail filtering</emphasis>. However, there are some additional features that are
54704 available only in system filters; these are described in subsequent sections.
54705 If they are encountered in a user’s filter file or when testing with <option>-bf</option>,
54709 <indexterm role="concept">
54710 <primary>frozen messages</primary>
54711 <secondary>manual thaw; testing in filter</secondary>
54713 There are two special conditions which, though available in users’ filter
54714 files, are designed for use in system filters. The condition <option>first_delivery</option>
54715 is true only for the first attempt at delivering a message, and
54716 <option>manually_thawed</option> is true only if the message has been frozen, and
54717 subsequently thawed by an admin user. An explicit forced delivery counts as a
54718 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
54721 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
54722 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
54723 succeed, it will not be tried again.
54724 If you want Exim to retry an unseen delivery until it succeeds, you should
54725 arrange to set it up every time the filter runs.
54728 When a system filter finishes running, the values of the variables <varname>$n0</varname> –
54729 <varname>$n9</varname> are copied into <varname>$sn0</varname> – <varname>$sn9</varname> and are thereby made available to
54730 users’ filter files. Thus a system filter can, for example, set up <quote>scores</quote>
54731 to which users’ filter files can refer.
54734 <section id="SECID215">
54735 <title>Additional variable for system filters</title>
54737 <indexterm role="variable">
54738 <primary><varname>$recipients</varname></primary>
54740 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
54741 of the message (separated by commas and white space), is available in system
54742 filters. It is not available in users’ filters for privacy reasons.
54745 <section id="SECID216">
54746 <title>Defer, freeze, and fail commands for system filters</title>
54748 <indexterm role="concept">
54749 <primary>freezing messages</primary>
54751 <indexterm role="concept">
54752 <primary>message</primary>
54753 <secondary>freezing</secondary>
54755 <indexterm role="concept">
54756 <primary>message</primary>
54757 <secondary>forced failure</secondary>
54759 <indexterm role="concept">
54760 <primary><option>fail</option></primary>
54761 <secondary>in system filter</secondary>
54763 <indexterm role="concept">
54764 <primary><option>freeze</option> in system filter</primary>
54766 <indexterm role="concept">
54767 <primary><option>defer</option> in system filter</primary>
54769 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
54770 always available in system filters, but are not normally enabled in users’
54771 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
54772 for the <command>redirect</command> router.) These commands can optionally be followed by the
54773 word <option>text</option> and a string containing an error message, for example:
54775 <literallayout class="monospaced">
54776 fail text "this message looks like spam to me"
54779 The keyword <option>text</option> is optional if the next character is a double quote.
54782 The <option>defer</option> command defers delivery of the original recipients of the
54783 message. The <option>fail</option> command causes all the original recipients to be failed,
54784 and a bounce message to be created. The <option>freeze</option> command suspends all
54785 delivery attempts for the original recipients. In all cases, any new deliveries
54786 that are specified by the filter are attempted as normal after the filter has
54790 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
54791 not manually frozen since. This means that automatic freezing by a system
54792 filter can be used as a way of checking out suspicious messages. If a message
54793 is found to be all right, manually unfreezing it allows it to be delivered.
54796 <indexterm role="concept">
54797 <primary>log</primary>
54798 <secondary><option>fail</option> command log line</secondary>
54800 <indexterm role="concept">
54801 <primary><option>fail</option></primary>
54802 <secondary>log line; reducing</secondary>
54804 The text given with a fail command is used as part of the bounce message as
54805 well as being written to the log. If the message is quite long, this can fill
54806 up a lot of log space when such failures are common. To reduce the size of the
54807 log message, Exim interprets the text in a special way if it starts with the
54808 two characters <literal><<</literal> and contains <literal>>></literal> later. The text between these two
54809 strings is written to the log, and the rest of the text is used in the bounce
54810 message. For example:
54812 <literallayout class="monospaced">
54813 fail "<<filter test 1>>Your message is rejected \
54814 because it contains attachments that we are \
54815 not prepared to receive."
54818 <indexterm role="concept">
54819 <primary>loop</primary>
54820 <secondary>caused by <option>fail</option></secondary>
54822 Take great care with the <option>fail</option> command when basing the decision to fail on
54823 the contents of the message, because the bounce message will of course include
54824 the contents of the original message and will therefore trigger the <option>fail</option>
54825 command again (causing a mail loop) unless steps are taken to prevent this.
54826 Testing the <option>error_message</option> condition is one way to prevent this. You could
54829 <literallayout class="monospaced">
54830 if $message_body contains "this is spam" and not error_message
54831 then fail text "spam is not wanted here" endif
54834 though of course that might let through unwanted bounce messages. The
54835 alternative is clever checking of the body and/or headers to detect bounces
54836 generated by the filter.
54839 The interpretation of a system filter file ceases after a
54840 <option>defer</option>,
54841 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
54842 set up earlier in the filter file are honoured, so you can use a sequence such
54845 <literallayout class="monospaced">
54850 to send a specified message when the system filter is freezing (or deferring or
54851 failing) a message. The normal deliveries for the message do not, of course,
54855 <section id="SECTaddremheasys">
54856 <title>Adding and removing headers in a system filter</title>
54858 <indexterm role="concept">
54859 <primary>header lines</primary>
54860 <secondary>adding; in system filter</secondary>
54862 <indexterm role="concept">
54863 <primary>header lines</primary>
54864 <secondary>removing; in system filter</secondary>
54866 <indexterm role="concept">
54867 <primary>filter</primary>
54868 <secondary>header lines; adding/removing</secondary>
54870 Two filter commands that are available only in system filters are:
54872 <literallayout class="monospaced">
54873 headers add <string>
54874 headers remove <string>
54877 The argument for the <option>headers add</option> is a string that is expanded and then
54878 added to the end of the message’s headers. It is the responsibility of the
54879 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
54880 space is ignored, and if the string is otherwise empty, or if the expansion is
54881 forced to fail, the command has no effect.
54884 You can use <quote>\n</quote> within the string, followed by white space, to specify
54885 continued header lines. More than one header may be added in one command by
54886 including <quote>\n</quote> within the string without any following white space. For
54889 <literallayout class="monospaced">
54890 headers add "X-header-1: ....\n \
54891 continuation of X-header-1 ...\n\
54895 Note that the header line continuation white space after the first newline must
54896 be placed before the backslash that continues the input string, because white
54897 space after input continuations is ignored.
54900 The argument for <option>headers remove</option> is a colon-separated list of header names.
54901 This command applies only to those headers that are stored with the message;
54902 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
54903 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
54904 header with the same name, they are all removed.
54907 The <option>headers</option> command in a system filter makes an immediate change to the set
54908 of header lines that was received with the message (with possible additions
54909 from ACL processing). Subsequent commands in the system filter operate on the
54910 modified set, which also forms the basis for subsequent message delivery.
54911 Unless further modified during routing or transporting, this set of headers is
54912 used for all recipients of the message.
54915 During routing and transporting, the variables that refer to the contents of
54916 header lines refer only to those lines that are in this set. Thus, header lines
54917 that are added by a system filter are visible to users’ filter files and to all
54918 routers and transports. This contrasts with the manipulation of header lines by
54919 routers and transports, which is not immediate, but which instead is saved up
54920 until the message is actually being written (see section
54921 <xref linkend="SECTheadersaddrem"/>).
54924 If the message is not delivered at the first attempt, header lines that were
54925 added by the system filter are stored with the message, and so are still
54926 present at the next delivery attempt. Header lines that were removed are still
54927 present, but marked <quote>deleted</quote> so that they are not transported with the
54928 message. For this reason, it is usual to make the <option>headers</option> command
54929 conditional on <option>first_delivery</option> so that the set of header lines is not
54930 modified more than once.
54933 Because header modification in a system filter acts immediately, you have to
54934 use an indirect approach if you want to modify the contents of a header line.
54937 <literallayout class="monospaced">
54938 headers add "Old-Subject: $h_subject:"
54939 headers remove "Subject"
54940 headers add "Subject: new subject (was: $h_old-subject:)"
54941 headers remove "Old-Subject"
54944 <section id="SECID217">
54945 <title>Setting an errors address in a system filter</title>
54947 <indexterm role="concept">
54948 <primary>envelope sender</primary>
54950 In a system filter, if a <option>deliver</option> command is followed by
54952 <literallayout class="monospaced">
54953 errors_to <some address>
54956 in order to change the envelope sender (and hence the error reporting) for that
54957 delivery, any address may be specified. (In a user filter, only the current
54958 user’s address can be set.) For example, if some mail is being monitored, you
54961 <literallayout class="monospaced">
54962 unseen deliver monitor@spying.example errors_to root@local.example
54965 to take a copy which would not be sent back to the normal error reporting
54966 address if its delivery failed.
54969 <section id="SECTperaddfil">
54970 <title>Per-address filtering</title>
54972 <indexterm role="variable">
54973 <primary><varname>$domain</varname></primary>
54975 <indexterm role="variable">
54976 <primary><varname>$local_part</varname></primary>
54978 In contrast to the system filter, which is run just once per message for each
54979 delivery attempt, it is also possible to set up a system-wide filtering
54980 operation that runs once for each recipient address. In this case, variables
54981 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
54982 filter file could be made dependent on them. This is an example of a router
54983 which implements such a filter:
54985 <literallayout class="monospaced">
54989 domains = +local_domains
54990 file = /central/filters/$local_part
54996 The filter is run in a separate process under its own uid. Therefore, either
54997 <option>check_local_user</option> must be set (as above), in which case the filter is run as
54998 the local user, or the <option>user</option> option must be used to specify which user to
54999 use. If both are set, <option>user</option> overrides.
55002 Care should be taken to ensure that none of the commands in the filter file
55003 specify a significant delivery if the message is to go on to be delivered to
55004 its intended recipient. The router will not then claim to have dealt with the
55005 address, so it will be passed on to subsequent routers to be delivered in the
55007 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
55008 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
55009 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
55014 <chapter id="CHAPmsgproc">
55015 <title>Message processing</title>
55017 <indexterm role="concept" id="IIDmesproc" class="startofrange">
55018 <primary>message</primary>
55019 <secondary>general processing</secondary>
55021 Exim performs various transformations on the sender and recipient addresses of
55022 all messages that it handles, and also on the messages’ header lines. Some of
55023 these are optional and configurable, while others always take place. All of
55024 this processing, except rewriting as a result of routing, and the addition or
55025 removal of header lines while delivering, happens when a message is received,
55026 before it is placed on Exim’s queue.
55029 Some of the automatic processing takes place by default only for
55030 <quote>locally-originated</quote> messages. This adjective is used to describe messages
55031 that are not received over TCP/IP, but instead are passed to an Exim process on
55032 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
55033 set up by the <option>-bs</option> command line option.
55036 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
55037 or ::1) are not considered to be locally-originated. Exim does not treat the
55038 loopback interface specially in any way.
55041 If you want the loopback interface to be treated specially, you must ensure
55042 that there are appropriate entries in your ACLs.
55044 <section id="SECTsubmodnon">
55045 <title>Submission mode for non-local messages</title>
55047 <indexterm role="concept">
55048 <primary>message</primary>
55049 <secondary>submission</secondary>
55051 <indexterm role="concept">
55052 <primary>submission mode</primary>
55054 Processing that happens automatically for locally-originated messages (unless
55055 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
55056 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
55057 state. Submission mode is set by the modifier
55059 <literallayout class="monospaced">
55060 control = submission
55063 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
55064 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
55065 a local submission, and is normally used when the source of the message is
55066 known to be an MUA running on a client host (as opposed to an MTA). For
55067 example, to set submission mode for messages originating on the IPv4 loopback
55068 interface, you could include the following in the MAIL ACL:
55070 <literallayout class="monospaced">
55071 warn hosts = 127.0.0.1
55072 control = submission
55075 <indexterm role="concept">
55076 <primary><option>sender_retain</option> submission option</primary>
55078 There are some options that can be used when setting submission mode. A slash
55079 is used to separate options. For example:
55081 <literallayout class="monospaced">
55082 control = submission/sender_retain
55085 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
55086 true and <option>local_from_check</option> false for the current incoming message. The first
55087 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
55088 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
55089 authenticated sender. With this setting, Exim still fixes up messages by adding
55090 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
55091 attempt to check sender authenticity in header lines.
55094 When <option>sender_retain</option> is not set, a submission mode setting may specify a
55095 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
55098 <literallayout class="monospaced">
55099 control = submission/domain=some.domain
55102 The domain may be empty. How this value is used is described in sections
55103 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
55104 that allows you to specify the user’s full name for inclusion in a created
55105 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
55107 <literallayout class="monospaced">
55108 accept authenticated = *
55109 control = submission/domain=wonderland.example/\
55110 name=${lookup {$authenticated_id} \
55111 lsearch {/etc/exim/namelist}}
55114 Because the name may contain any characters, including slashes, the <option>name</option>
55115 option must be given last. The remainder of the string is used as the name. For
55116 the example above, if <filename>/etc/exim/namelist</filename> contains:
55118 <literallayout class="monospaced">
55119 bigegg: Humpty Dumpty
55122 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
55125 <literallayout class="monospaced">
55126 Sender: Humpty Dumpty <bigegg@wonderland.example>
55129 <indexterm role="concept">
55130 <primary>return path</primary>
55131 <secondary>in submission mode</secondary>
55133 By default, submission mode forces the return path to the same address as is
55134 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
55135 specified, the return path is also left unchanged.
55138 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
55139 ACL. This means that any sender checks performed before the fix-ups use the
55140 untrusted sender address specified by the user, not the trusted sender address
55141 specified by submission mode. Although this might be slightly unexpected, it
55142 does mean that you can configure ACL checks to spot that a user is trying to
55143 spoof another’s address.
55146 <section id="SECTlineendings">
55147 <title>Line endings</title>
55149 <indexterm role="concept">
55150 <primary>line endings</primary>
55152 <indexterm role="concept">
55153 <primary>carriage return</primary>
55155 <indexterm role="concept">
55156 <primary>linefeed</primary>
55158 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
55159 linefeed) is the line ending for messages transmitted over the Internet using
55160 SMTP over TCP/IP. However, within individual operating systems, different
55161 conventions are used. For example, Unix-like systems use just LF, but others
55162 use CRLF or just CR.
55165 Exim was designed for Unix-like systems, and internally, it stores messages
55166 using the system’s convention of a single LF as a line terminator. When
55167 receiving a message, all line endings are translated to this standard format.
55168 Originally, it was thought that programs that passed messages directly to an
55169 MTA within an operating system would use that system’s convention. Experience
55170 has shown that this is not the case; for example, there are Unix applications
55171 that use CRLF in this circumstance. For this reason, and for compatibility with
55172 other MTAs, the way Exim handles line endings for all messages is now as
55178 LF not preceded by CR is treated as a line ending.
55183 CR is treated as a line ending; if it is immediately followed by LF, the LF
55189 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
55190 nor a local message in the state where a line containing only a dot is a
55196 If a bare CR is encountered within a header line, an extra space is added after
55197 the line terminator so as not to end the header line. The reasoning behind this
55198 is that bare CRs in header lines are most likely either to be mistakes, or
55199 people trying to play silly games.
55204 If the first header line received in a message ends with CRLF, a subsequent
55205 bare LF in a header line is treated in the same way as a bare CR in a header
55211 <section id="SECID218">
55212 <title>Unqualified addresses</title>
55214 <indexterm role="concept">
55215 <primary>unqualified addresses</primary>
55217 <indexterm role="concept">
55218 <primary>address</primary>
55219 <secondary>qualification</secondary>
55221 By default, Exim expects every envelope address it receives from an external
55222 host to be fully qualified. Unqualified addresses cause negative responses to
55223 SMTP commands. However, because SMTP is used as a means of transporting
55224 messages from MUAs running on personal workstations, there is sometimes a
55225 requirement to accept unqualified addresses from specific hosts or IP networks.
55228 Exim has two options that separately control which hosts may send unqualified
55229 sender or recipient addresses in SMTP commands, namely
55230 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
55231 cases, if an unqualified address is accepted, it is qualified by adding the
55232 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
55235 <indexterm role="option">
55236 <primary><option>qualify_domain</option></primary>
55238 <indexterm role="option">
55239 <primary><option>qualify_recipient</option></primary>
55241 Unqualified addresses in header lines are automatically qualified for messages
55242 that are locally originated, unless the <option>-bnq</option> option is given on the command
55243 line. For messages received over SMTP, unqualified addresses in header lines
55244 are qualified only if unqualified addresses are permitted in SMTP commands. In
55245 other words, such qualification is also controlled by
55246 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
55249 <section id="SECID219">
55250 <title>The UUCP From line</title>
55252 <indexterm role="concept">
55253 <primary><quote>From</quote> line</primary>
55255 <indexterm role="concept">
55256 <primary>UUCP</primary>
55257 <secondary><quote>From</quote> line</secondary>
55259 <indexterm role="concept">
55260 <primary>sender</primary>
55261 <secondary>address</secondary>
55263 <indexterm role="option">
55264 <primary><option>uucp_from_pattern</option></primary>
55266 <indexterm role="option">
55267 <primary><option>uucp_from_sender</option></primary>
55269 <indexterm role="concept">
55270 <primary>envelope sender</primary>
55272 <indexterm role="concept">
55273 <primary>Sendmail compatibility</primary>
55274 <secondary><quote>From</quote> line</secondary>
55276 Messages that have come from UUCP (and some other applications) often begin
55277 with a line containing the envelope sender and a timestamp, following the word
55278 <quote>From</quote>. Examples of two common formats are:
55280 <literallayout class="monospaced">
55281 From a.oakley@berlin.mus Fri Jan 5 12:35 GMT 1996
55282 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
55285 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
55286 Exim recognizes such lines at the start of messages that are submitted to it
55287 via the command line (that is, on the standard input). It does not recognize
55288 such lines in incoming SMTP messages, unless the sending host matches
55289 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
55290 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
55291 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
55292 default value matches the two common cases shown above and puts the address
55293 that follows <quote>From</quote> into <varname>$1</varname>.
55296 <indexterm role="concept">
55297 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55298 <secondary>in <quote>From </quote> line handling</secondary>
55300 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
55301 a trusted user, the message’s sender address is constructed by expanding the
55302 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
55303 then parsed as an RFC 2822 address. If there is no domain, the local part is
55304 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
55305 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
55308 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
55309 sender address is not changed. This is also the case for incoming SMTP messages
55310 that are permitted to contain <quote>From</quote> lines.
55313 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
55314 treated as a data line that starts the body of the message, as it is not valid
55315 as a header line. This also happens if a <quote>From</quote> line is present in an
55316 incoming SMTP message from a source that is not permitted to send them.
55319 <section id="SECID220">
55320 <title>Resent- header lines</title>
55322 <indexterm role="concept">
55323 <primary><option>Resent-</option> header lines</primary>
55325 RFC 2822 makes provision for sets of header lines starting with the string
55326 <literal>Resent-</literal> to be added to a message when it is resent by the original
55327 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
55328 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
55329 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
55333 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
55334 processing of replies or other such automatic actions on messages.</emphasis>
55338 This leaves things a bit vague as far as other processing actions such as
55339 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
55345 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
55346 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
55351 If there’s a rewriting rule for a particular header line, it is also applied to
55352 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
55353 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
55358 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
55364 For a locally-submitted message,
55365 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
55366 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
55367 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
55368 included in log lines in this case.
55373 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
55374 <option>Resent-</option> header lines are present.
55379 <section id="SECID221">
55380 <title>The Auto-Submitted: header line</title>
55382 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
55383 includes the header line:
55385 <literallayout class="monospaced">
55386 Auto-Submitted: auto-replied
55389 <section id="SECID222">
55390 <title>The Bcc: header line</title>
55392 <indexterm role="concept">
55393 <primary><emphasis>Bcc:</emphasis> header line</primary>
55395 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
55396 message’s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
55397 extracting its addresses). If <option>-t</option> is not present on the command line, any
55398 existing <emphasis>Bcc:</emphasis> is not removed.
55401 <section id="SECID223">
55402 <title>The Date: header line</title>
55404 <indexterm role="concept">
55405 <primary><emphasis>Date:</emphasis> header line</primary>
55407 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
55408 Exim adds one, using the current date and time, unless the
55409 <option>suppress_local_fixups</option> control has been specified.
55412 <section id="SECID224">
55413 <title>The Delivery-date: header line</title>
55415 <indexterm role="concept">
55416 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
55418 <indexterm role="option">
55419 <primary><option>delivery_date_remove</option></primary>
55421 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
55422 set. Exim can be configured to add them to the final delivery of messages. (See
55423 the generic <option>delivery_date_add</option> transport option.) They should not be present
55424 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
55425 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
55429 <section id="SECID225">
55430 <title>The Envelope-to: header line</title>
55432 <indexterm role="concept">
55433 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
55435 <indexterm role="option">
55436 <primary><option>envelope_to_remove</option></primary>
55438 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
55439 Exim can be configured to add them to the final delivery of messages. (See the
55440 generic <option>envelope_to_add</option> transport option.) They should not be present in
55441 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
55442 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
55446 <section id="SECTthefrohea">
55447 <title>The From: header line</title>
55449 <indexterm role="concept">
55450 <primary><emphasis>From:</emphasis> header line</primary>
55452 <indexterm role="concept">
55453 <primary>Sendmail compatibility</primary>
55454 <secondary><quote>From</quote> line</secondary>
55456 <indexterm role="concept">
55457 <primary>message</primary>
55458 <secondary>submission</secondary>
55460 <indexterm role="concept">
55461 <primary>submission mode</primary>
55463 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
55464 adds one if either of the following conditions is true:
55469 The envelope sender address is not empty (that is, this is not a bounce
55470 message). The added header line copies the envelope sender address.
55475 <indexterm role="variable">
55476 <primary><varname>$authenticated_id</varname></primary>
55478 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
55480 <orderedlist numeration="arabic">
55483 <indexterm role="variable">
55484 <primary><varname>$qualify_domain</varname></primary>
55486 If no domain is specified by the submission control, the local part is
55487 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55492 If a non-empty domain is specified by the submission control, the local
55493 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55498 If an empty domain is specified by the submission control,
55499 <varname>$authenticated_id</varname> is assumed to be the complete address.
55506 A non-empty envelope sender takes precedence.
55509 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
55510 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
55511 containing the sender’s address. The calling user’s login name and full name
55512 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
55513 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
55514 <option>unknown_login</option> configuration option). The address is qualified with
55515 <option>qualify_domain</option>.
55518 For compatibility with Sendmail, if an incoming, non-SMTP message has a
55519 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
55520 user, this is replaced by an address containing the user’s login name and full
55521 name as described in section <xref linkend="SECTconstr"/>.
55524 <section id="SECID226">
55525 <title>The Message-ID: header line</title>
55527 <indexterm role="concept">
55528 <primary><emphasis>Message-ID:</emphasis> header line</primary>
55530 <indexterm role="concept">
55531 <primary>message</primary>
55532 <secondary>submission</secondary>
55534 <indexterm role="option">
55535 <primary><option>message_id_header_text</option></primary>
55537 If a locally-generated or submission-mode incoming message does not contain a
55538 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
55539 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
55540 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
55541 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim’s internal
55542 message id, preceded by the letter E to ensure it starts with a letter, and
55543 followed by @ and the primary host name. Additional information can be included
55544 in this header line by setting the <option>message_id_header_text</option> and/or
55545 <option>message_id_header_domain</option> options.
55548 <section id="SECID227">
55549 <title>The Received: header line</title>
55551 <indexterm role="concept">
55552 <primary><emphasis>Received:</emphasis> header line</primary>
55554 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
55555 contents are defined by the <option>received_header_text</option> configuration option, and
55556 Exim automatically adds a semicolon and a timestamp to the configured string.
55559 The <emphasis>Received:</emphasis> header is generated as soon as the message’s header lines
55560 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
55561 line is the time that the message started to be received. This is the value
55562 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
55565 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
55566 changed to the time of acceptance, which is (apart from a small delay while the
55567 -H spool file is written) the earliest time at which delivery could start.
55570 <section id="SECID228">
55571 <title>The References: header line</title>
55573 <indexterm role="concept">
55574 <primary><emphasis>References:</emphasis> header line</primary>
55576 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
55577 header line. This is constructed according to the rules that are described in
55578 section 3.64 of RFC 2822 (which states that replies should contain such a
55579 header line), and section 3.14 of RFC 3834 (which states that automatic
55580 responses are not different in this respect). However, because some mail
55581 processing software does not cope well with very long header lines, no more
55582 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
55583 incoming message. If there are more than 12, the first one and then the final
55584 11 are copied, before adding the message ID of the incoming message.
55587 <section id="SECID229">
55588 <title>The Return-path: header line</title>
55590 <indexterm role="concept">
55591 <primary><emphasis>Return-path:</emphasis> header line</primary>
55593 <indexterm role="option">
55594 <primary><option>return_path_remove</option></primary>
55596 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
55597 it does the final delivery of messages. (See the generic <option>return_path_add</option>
55598 transport option.) Therefore, they should not be present in messages in
55599 transit. If the <option>return_path_remove</option> configuration option is set (the
55600 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
55603 <section id="SECTthesenhea">
55604 <title>The Sender: header line</title>
55606 <indexterm role="concept">
55607 <primary><emphasis>Sender:</emphasis> header line</primary>
55609 <indexterm role="concept">
55610 <primary>message</primary>
55611 <secondary>submission</secondary>
55613 For a locally-originated message from an untrusted user, Exim may remove an
55614 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
55615 these actions by setting the <option>local_sender_retain</option> option true, the
55616 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
55620 When a local message is received from an untrusted user and
55621 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
55622 control has not been set, a check is made to see if the address given in the
55623 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
55624 that is expected has the login name as the local part and the value of
55625 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
55626 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
55627 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
55628 line is added to the message.
55631 If you set <option>local_from_check</option> false, this checking does not occur. However,
55632 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
55633 <option>local_sender_retain</option> to be true. It is not possible to set both of these
55634 options true at the same time.
55637 <indexterm role="concept">
55638 <primary>submission mode</primary>
55640 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
55641 received over TCP/IP or for messages submitted by trusted users. However, when
55642 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
55643 not specified on the submission control, the following processing takes place:
55646 <indexterm role="variable">
55647 <primary><varname>$authenticated_id</varname></primary>
55649 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
55650 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
55651 created as follows:
55656 <indexterm role="variable">
55657 <primary><varname>$qualify_domain</varname></primary>
55659 If no domain is specified by the submission control, the local part is
55660 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
55665 If a non-empty domain is specified by the submission control, the local part
55666 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
55671 If an empty domain is specified by the submission control,
55672 <varname>$authenticated_id</varname> is assumed to be the complete address.
55677 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
55678 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
55679 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
55680 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
55683 <indexterm role="concept">
55684 <primary>return path</primary>
55685 <secondary>created from <emphasis>Sender:</emphasis></secondary>
55687 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
55688 the message (the envelope sender address) is changed to be the same address,
55689 except in the case of submission mode when <option>sender_retain</option> is specified.
55692 <section id="SECTheadersaddrem">
55693 <title>Adding and removing header lines in routers and transports</title>
55695 <indexterm role="concept">
55696 <primary>header lines</primary>
55697 <secondary>adding; in router or transport</secondary>
55699 <indexterm role="concept">
55700 <primary>header lines</primary>
55701 <secondary>removing; in router or transport</secondary>
55703 When a message is delivered, the addition and removal of header lines can be
55704 specified in a system filter, or on any of the routers and transports that
55705 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
55706 modifying headers in a system filter. Header lines can also be added in an ACL
55707 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
55710 In contrast to what happens in a system filter, header modifications that are
55711 specified on routers and transports apply only to the particular recipient
55712 addresses that are being processed by those routers and transports. These
55713 changes do not actually take place until a copy of the message is being
55714 transported. Therefore, they do not affect the basic set of header lines, and
55715 they do not affect the values of the variables that refer to header lines.
55718 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
55719 the transport cannot refer to the modified header lines, because such
55720 expansions all occur before the message is actually transported.
55723 For both routers and transports, the result of expanding a <option>headers_add</option>
55724 option must be in the form of one or more RFC 2822 header lines, separated by
55725 newlines (coded as <quote>\n</quote>). For example:
55727 <literallayout class="monospaced">
55728 headers_add = X-added-header: added by $primary_hostname\n\
55729 X-added-second: another added header line
55732 Exim does not check the syntax of these added header lines.
55735 The result of expanding <option>headers_remove</option> must consist of a colon-separated
55736 list of header names. This is confusing, because header names themselves are
55737 often terminated by colons. In this case, the colons are the list separators,
55738 not part of the names. For example:
55740 <literallayout class="monospaced">
55741 headers_remove = return-receipt-to:acknowledge-to
55744 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
55745 is expanded at routing time, and then associated with all addresses that are
55746 accepted by that router, and also with any new addresses that it generates. If
55747 an address passes through several routers as a result of aliasing or
55748 forwarding, the changes are cumulative.
55751 <indexterm role="option">
55752 <primary><option>unseen</option></primary>
55754 However, this does not apply to multiple routers that result from the use of
55755 the <option>unseen</option> option. Any header modifications that were specified by the
55756 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
55759 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
55760 settings cannot be delivered together in a batch, so a transport is always
55761 dealing with a set of addresses that have the same header-processing
55765 The transport starts by writing the original set of header lines that arrived
55766 with the message, possibly modified by the system filter. As it writes out
55767 these lines, it consults the list of header names that were attached to the
55768 recipient address(es) by <option>headers_remove</option> options in routers, and it also
55769 consults the transport’s own <option>headers_remove</option> option. Header lines whose
55770 names are on either of these lists are not written out. If there are multiple
55771 instances of any listed header, they are all skipped.
55774 After the remaining original header lines have been written, new header
55775 lines that were specified by routers’ <option>headers_add</option> options are written, in
55776 the order in which they were attached to the address. These are followed by any
55777 header lines specified by the transport’s <option>headers_add</option> option.
55780 This way of handling header line modifications in routers and transports has
55781 the following consequences:
55786 The original set of header lines, possibly modified by the system filter,
55787 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
55788 to it, at all times.
55793 Header lines that are added by a router’s
55794 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
55795 expansion syntax in subsequent routers or the transport.
55800 Conversely, header lines that are specified for removal by <option>headers_remove</option>
55801 in a router remain visible to subsequent routers and the transport.
55806 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
55807 a later router or by a transport.
55812 An added header can refer to the contents of an original header that is to be
55813 removed, even it has the same name as the added header. For example:
55815 <literallayout class="monospaced">
55816 headers_remove = subject
55817 headers_add = Subject: new subject (was: $h_subject:)
55822 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
55823 for a <command>redirect</command> router that has the <option>one_time</option> option set.
55826 <section id="SECTconstr">
55827 <title>Constructed addresses</title>
55829 <indexterm role="concept">
55830 <primary>address</primary>
55831 <secondary>constructed</secondary>
55833 <indexterm role="concept">
55834 <primary>constructed address</primary>
55836 When Exim constructs a sender address for a locally-generated message, it uses
55840 <<emphasis>user name</emphasis>> <<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>>
55845 <literallayout class="monospaced">
55846 Zaphod Beeblebrox <zaphod@end.univ.example>
55849 The user name is obtained from the <option>-F</option> command line option if set, or
55850 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
55851 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
55852 ampersand character, this is replaced by the login name with the first letter
55853 upper cased, as is conventional in a number of operating systems. See the
55854 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
55855 The <option>unknown_username</option> option can be used to specify user names in cases when
55856 there is no password file entry.
55859 <indexterm role="concept">
55860 <primary>RFC 2047</primary>
55862 In all cases, the user name is made to conform to RFC 2822 by quoting all or
55863 parts of it if necessary. In addition, if it contains any non-printing
55864 characters, it is encoded as described in RFC 2047, which defines a way of
55865 including non-ASCII characters in header lines. The value of the
55866 <option>headers_charset</option> option specifies the name of the encoding that is used (the
55867 characters are assumed to be in this encoding). The setting of
55868 <option>print_topbitchars</option> controls whether characters with the top bit set (that
55869 is, with codes greater than 127) count as printing characters or not.
55872 <section id="SECID230">
55873 <title>Case of local parts</title>
55875 <indexterm role="concept">
55876 <primary>case of local parts</primary>
55878 <indexterm role="concept">
55879 <primary>local part</primary>
55880 <secondary>case of</secondary>
55882 RFC 2822 states that the case of letters in the local parts of addresses cannot
55883 be assumed to be non-significant. Exim preserves the case of local parts of
55884 addresses, but by default it uses a lower-cased form when it is routing,
55885 because on most Unix systems, usernames are in lower case and case-insensitive
55886 routing is required. However, any particular router can be made to use the
55887 original case for local parts by setting the <option>caseful_local_part</option> generic
55891 <indexterm role="concept">
55892 <primary>mixed-case login names</primary>
55894 If you must have mixed-case user names on your system, the best way to proceed,
55895 assuming you want case-independent handling of incoming email, is to set up
55896 your first router to convert incoming local parts in your domains to the
55897 correct case by means of a file lookup. For example:
55899 <literallayout class="monospaced">
55902 domains = +local_domains
55903 data = ${lookup{$local_part}cdb\
55904 {/etc/usercased.cdb}{$value}fail}\
55908 For this router, the local part is forced to lower case by the default action
55909 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
55910 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
55911 on any subsequent routers which process your domains, they will operate on
55912 local parts with the correct case in a case-sensitive manner.
55915 <section id="SECID231">
55916 <title>Dots in local parts</title>
55918 <indexterm role="concept">
55919 <primary>dot</primary>
55920 <secondary>in local part</secondary>
55922 <indexterm role="concept">
55923 <primary>local part</primary>
55924 <secondary>dots in</secondary>
55926 RFC 2822 forbids empty components in local parts. That is, an unquoted local
55927 part may not begin or end with a dot, nor have two consecutive dots in the
55928 middle. However, it seems that many MTAs do not enforce this, so Exim permits
55929 empty components for compatibility.
55932 <section id="SECID232">
55933 <title>Rewriting addresses</title>
55935 <indexterm role="concept">
55936 <primary>rewriting</primary>
55937 <secondary>addresses</secondary>
55939 Rewriting of sender and recipient addresses, and addresses in headers, can
55940 happen automatically, or as the result of configuration options, as described
55941 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
55942 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
55945 Automatic rewriting includes qualification, as mentioned above. The other case
55946 in which it can happen is when an incomplete non-local domain is given. The
55947 routing process may cause this to be expanded into the full domain name. For
55948 example, a header such as
55950 <literallayout class="monospaced">
55954 might get rewritten as
55956 <literallayout class="monospaced">
55957 To: hare@teaparty.wonderland.fict.example
55960 Rewriting as a result of routing is the one kind of message processing that
55961 does not happen at input time, as it cannot be done until the address has
55965 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
55966 addresses have been routed, in case any of the headers get changed as a
55967 result of routing. However, doing this in practice would hold up many
55968 deliveries for unreasonable amounts of time, just because one address could not
55969 immediately be routed. Exim therefore does not delay other deliveries when
55970 routing of one or more addresses is deferred.
55971 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
55976 <chapter id="CHAPSMTP">
55977 <title>SMTP processing</title>
55979 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
55980 <primary>SMTP</primary>
55981 <secondary>processing details</secondary>
55983 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
55984 <primary>LMTP</primary>
55985 <secondary>processing details</secondary>
55987 Exim supports a number of different ways of using the SMTP protocol, and its
55988 LMTP variant, which is an interactive protocol for transferring messages into a
55989 closed mail store application. This chapter contains details of how SMTP is
55990 processed. For incoming mail, the following are available:
55995 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
56000 SMTP over the standard input and output (the <option>-bs</option> option);
56005 Batched SMTP on the standard input (the <option>-bS</option> option).
56010 For mail delivery, the following are available:
56015 SMTP over TCP/IP (the <command>smtp</command> transport);
56020 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
56021 <quote>lmtp</quote>);
56026 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
56032 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
56033 the <option>use_bsmtp</option> option set).
56038 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
56039 stored in or read from files (or pipes), in a format in which SMTP commands are
56040 used to contain the envelope information.
56042 <section id="SECToutSMTPTCP">
56043 <title>Outgoing SMTP and LMTP over TCP/IP</title>
56045 <indexterm role="concept">
56046 <primary>SMTP</primary>
56047 <secondary>outgoing over TCP/IP</secondary>
56049 <indexterm role="concept">
56050 <primary>outgoing SMTP over TCP/IP</primary>
56052 <indexterm role="concept">
56053 <primary>LMTP</primary>
56054 <secondary>over TCP/IP</secondary>
56056 <indexterm role="concept">
56057 <primary>outgoing LMTP over TCP/IP</primary>
56059 <indexterm role="concept">
56060 <primary>EHLO</primary>
56062 <indexterm role="concept">
56063 <primary>HELO</primary>
56065 <indexterm role="concept">
56066 <primary>SIZE option on MAIL command</primary>
56068 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
56069 The <option>protocol</option> option selects which protocol is to be used, but the actual
56070 processing is the same in both cases.
56073 If, in response to its EHLO command, Exim is told that the SIZE
56074 parameter is supported, it adds SIZE=<<emphasis>n</emphasis>> to each subsequent MAIL
56075 command. The value of <<emphasis>n</emphasis>> is the message size plus the value of the
56076 <option>size_addition</option> option (default 1024) to allow for additions to the message
56077 such as per-transport header lines, or changes made in a
56078 <indexterm role="concept">
56079 <primary>transport</primary>
56080 <secondary>filter</secondary>
56082 <indexterm role="concept">
56083 <primary>filter</primary>
56084 <secondary>transport filter</secondary>
56086 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
56090 If the remote server advertises support for PIPELINING, Exim uses the
56091 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
56092 required for the transaction.
56095 If the remote server advertises support for the STARTTLS command, and Exim
56096 was built to support TLS encryption, it tries to start a TLS session unless the
56097 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
56100 If the remote server advertises support for the AUTH command, Exim scans
56101 the authenticators configuration for any suitable client settings, as described
56102 in chapter <xref linkend="CHAPSMTPAUTH"/>.
56105 <indexterm role="concept">
56106 <primary>carriage return</primary>
56108 <indexterm role="concept">
56109 <primary>linefeed</primary>
56111 Responses from the remote host are supposed to be terminated by CR followed by
56112 LF. However, there are known to be hosts that do not send CR characters, so in
56113 order to be able to interwork with such hosts, Exim treats LF on its own as a
56117 If a message contains a number of different addresses, all those with the same
56118 characteristics (for example, the same envelope sender) that resolve to the
56119 same set of hosts, in the same order, are sent in a single SMTP transaction,
56120 even if they are for different domains, unless there are more than the setting
56121 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
56122 they are split into groups containing no more than <option>max_rcpt</option>s addresses
56123 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
56124 in parallel sessions. The order of hosts with identical MX values is not
56125 significant when checking whether addresses can be batched in this way.
56128 When the <command>smtp</command> transport suffers a temporary failure that is not
56129 message-related, Exim updates its transport-specific database, which contains
56130 records indexed by host name that remember which messages are waiting for each
56131 particular host. It also updates the retry database with new retry times.
56134 <indexterm role="concept">
56135 <primary>hints database</primary>
56136 <secondary>retry keys</secondary>
56138 Exim’s retry hints are based on host name plus IP address, so if one address of
56139 a multi-homed host is broken, it will soon be skipped most of the time.
56140 See the next section for more detail about error handling.
56143 <indexterm role="concept">
56144 <primary>SMTP</primary>
56145 <secondary>passed connection</secondary>
56147 <indexterm role="concept">
56148 <primary>SMTP</primary>
56149 <secondary>batching over TCP/IP</secondary>
56151 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
56152 looks in the hints database for the transport to see if there are any queued
56153 messages waiting for the host to which it is connected. If it finds one, it
56154 creates a new Exim process using the <option>-MC</option> option (which can only be used by
56155 a process running as root or the Exim user) and passes the TCP/IP socket to it
56156 so that it can deliver another message using the same socket. The new process
56157 does only those deliveries that are routed to the connected host, and may in
56158 turn pass the socket on to a third process, and so on.
56161 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
56162 limit the number of messages sent down a single TCP/IP connection.
56165 <indexterm role="concept">
56166 <primary>asterisk</primary>
56167 <secondary>after IP address</secondary>
56169 The second and subsequent messages delivered down an existing connection are
56170 identified in the main log by the addition of an asterisk after the closing
56171 square bracket of the IP address.
56174 <section id="SECToutSMTPerr">
56175 <title>Errors in outgoing SMTP</title>
56177 <indexterm role="concept">
56178 <primary>error</primary>
56179 <secondary>in outgoing SMTP</secondary>
56181 <indexterm role="concept">
56182 <primary>SMTP</primary>
56183 <secondary>errors in outgoing</secondary>
56185 <indexterm role="concept">
56186 <primary>host</primary>
56187 <secondary>error</secondary>
56189 Three different kinds of error are recognized for outgoing SMTP: host errors,
56190 message errors, and recipient errors.
56194 <term><emphasis role="bold">Host errors</emphasis></term>
56197 A host error is not associated with a particular message or with a
56198 particular recipient of a message. The host errors are:
56203 Connection refused or timed out,
56208 Any error response code on connection,
56213 Any error response code to EHLO or HELO,
56218 Loss of connection at any time, except after <quote>.</quote>,
56223 I/O errors at any time,
56228 Timeouts during the session, other than in response to MAIL, RCPT or
56229 the <quote>.</quote> at the end of the data.
56234 For a host error, a permanent error response on connection, or in response to
56235 EHLO, causes all addresses routed to the host to be failed. Any other host
56236 error causes all addresses to be deferred, and retry data to be created for the
56237 host. It is not tried again, for any message, until its retry time arrives. If
56238 the current set of addresses are not all delivered in this run (to some
56239 alternative host), the message is added to the list of those waiting for this
56240 host, so if it is still undelivered when a subsequent successful delivery is
56241 made to the host, it will be sent down the same SMTP connection.
56243 </listitem></varlistentry>
56245 <term><emphasis role="bold">Message errors</emphasis></term>
56248 <indexterm role="concept">
56249 <primary>message</primary>
56250 <secondary>error</secondary>
56252 A message error is associated with a particular message when sent to a
56253 particular host, but not with a particular recipient of the message. The
56254 message errors are:
56259 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
56265 Timeout after MAIL,
56270 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
56271 timeout after the DATA command itself is treated as a host error, as is loss of
56272 connection at any other time.
56277 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
56278 to be failed, and a delivery error report to be returned to the sender. A
56279 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
56280 addresses to be deferred. Retry data is not created for the host, but instead,
56281 a retry record for the combination of host plus message id is created. The
56282 message is not added to the list of those waiting for this host. This ensures
56283 that the failing message will not be sent to this host again until the retry
56284 time arrives. However, other messages that are routed to the host are not
56285 affected, so if it is some property of the message that is causing the error,
56286 it will not stop the delivery of other mail.
56289 If the remote host specified support for the SIZE parameter in its response
56290 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
56291 over-large message will cause a message error because the error arrives as a
56294 </listitem></varlistentry>
56296 <term><emphasis role="bold">Recipient errors</emphasis></term>
56299 <indexterm role="concept">
56300 <primary>recipient</primary>
56301 <secondary>error</secondary>
56303 A recipient error is associated with a particular recipient of a message. The
56304 recipient errors are:
56309 Any error response to RCPT,
56314 Timeout after RCPT.
56319 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
56320 recipient address to be failed, and a bounce message to be returned to the
56321 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
56322 address to be deferred, and routing retry data to be created for it. This is
56323 used to delay processing of the address in subsequent queue runs, until its
56324 routing retry time arrives. This applies to all messages, but because it
56325 operates only in queue runs, one attempt will be made to deliver a new message
56326 to the failing address before the delay starts to operate. This ensures that,
56327 if the failure is really related to the message rather than the recipient
56328 (<quote>message too big for this recipient</quote> is a possible example), other messages
56329 have a chance of getting delivered. If a delivery to the address does succeed,
56330 the retry information gets cleared, so all stuck messages get tried again, and
56331 the retry clock is reset.
56334 The message is not added to the list of those waiting for this host. Use of the
56335 host for other messages is unaffected, and except in the case of a timeout,
56336 other recipients are processed independently, and may be successfully delivered
56337 in the current SMTP session. After a timeout it is of course impossible to
56338 proceed with the session, so all addresses get deferred. However, those other
56339 than the one that failed do not suffer any subsequent retry delays. Therefore,
56340 if one recipient is causing trouble, the others have a chance of getting
56341 through when a subsequent delivery attempt occurs before the failing
56342 recipient’s retry time.
56344 </listitem></varlistentry>
56347 In all cases, if there are other hosts (or IP addresses) available for the
56348 current set of addresses (for example, from multiple MX records), they are
56349 tried in this run for any undelivered addresses, subject of course to their
56350 own retry data. In other words, recipient error retry data does not take effect
56351 until the next delivery attempt.
56354 Some hosts have been observed to give temporary error responses to every
56355 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
56356 would be nice if such circumstances could be recognized, and defer data for the
56357 host itself created, but this is not possible within the current Exim design.
56358 What actually happens is that retry data for every (host, message) combination
56362 The reason that timeouts after MAIL and RCPT are treated specially is that
56363 these can sometimes arise as a result of the remote host’s verification
56364 procedures. Exim makes this assumption, and treats them as if a temporary error
56365 response had been received. A timeout after <quote>.</quote> is treated specially because
56366 it is known that some broken implementations fail to recognize the end of the
56367 message if the last character of the last line is a binary zero. Thus, it is
56368 helpful to treat this case as a message error.
56371 Timeouts at other times are treated as host errors, assuming a problem with the
56372 host, or the connection to it. If a timeout after MAIL, RCPT,
56373 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
56374 the timeout is likely to occur at some other point in the dialogue, causing it
56375 then to be treated as a host error.
56378 There is experimental evidence that some MTAs drop the connection after the
56379 terminating <quote>.</quote> if they do not like the contents of the message for some
56380 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
56381 should be given. That is why Exim treats this case as a message rather than a
56382 host error, in order not to delay other messages to the same host.
56385 <section id="SECID233">
56386 <title>Incoming SMTP messages over TCP/IP</title>
56388 <indexterm role="concept">
56389 <primary>SMTP</primary>
56390 <secondary>incoming over TCP/IP</secondary>
56392 <indexterm role="concept">
56393 <primary>incoming SMTP over TCP/IP</primary>
56395 <indexterm role="concept">
56396 <primary>inetd</primary>
56398 <indexterm role="concept">
56399 <primary>daemon</primary>
56401 Incoming SMTP messages can be accepted in one of two ways: by running a
56402 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
56403 <filename>/etc/inetd.conf</filename> should be like this:
56405 <literallayout class="monospaced">
56406 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
56409 Exim distinguishes between this case and the case of a locally running user
56410 agent using the <option>-bs</option> option by checking whether or not the standard input is
56411 a socket. When it is, either the port must be privileged (less than 1024), or
56412 the caller must be root or the Exim user. If any other user passes a socket
56413 with an unprivileged port number, Exim prints a message on the standard error
56414 stream and exits with an error code.
56417 By default, Exim does not make a log entry when a remote host connects or
56418 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
56419 unexpected. It can be made to write such log entries by setting the
56420 <option>smtp_connection</option> log selector.
56423 <indexterm role="concept">
56424 <primary>carriage return</primary>
56426 <indexterm role="concept">
56427 <primary>linefeed</primary>
56429 Commands from the remote host are supposed to be terminated by CR followed by
56430 LF. However, there are known to be hosts that do not send CR characters. In
56431 order to be able to interwork with such hosts, Exim treats LF on its own as a
56433 Furthermore, because common code is used for receiving messages from all
56434 sources, a CR on its own is also interpreted as a line terminator. However, the
56435 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
56438 <indexterm role="concept">
56439 <primary>EHLO</primary>
56440 <secondary>invalid data</secondary>
56442 <indexterm role="concept">
56443 <primary>HELO</primary>
56444 <secondary>invalid data</secondary>
56446 One area that sometimes gives rise to problems concerns the EHLO or
56447 HELO commands. Some clients send syntactically invalid versions of these
56448 commands, which Exim rejects by default. (This is nothing to do with verifying
56449 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
56450 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
56451 match the broken hosts that send invalid commands.
56454 <indexterm role="concept">
56455 <primary>SIZE option on MAIL command</primary>
56457 <indexterm role="concept">
56458 <primary>MAIL</primary>
56459 <secondary>SIZE option</secondary>
56461 The amount of disk space available is checked whenever SIZE is received on
56462 a MAIL command, independently of whether <option>message_size_limit</option> or
56463 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
56464 false. A temporary error is given if there is not enough space. If
56465 <option>check_spool_space</option> is set, the check is for that amount of space plus the
56466 value given with SIZE, that is, it checks that the addition of the incoming
56467 message will not reduce the space below the threshold.
56470 When a message is successfully received, Exim includes the local message id in
56471 its response to the final <quote>.</quote> that terminates the data. If the remote host
56472 logs this text it can help with tracing what has happened to a message.
56475 The Exim daemon can limit the number of simultaneous incoming connections it is
56476 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
56477 number of simultaneous incoming connections from a single remote host (see the
56478 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
56479 rejected using the SMTP temporary error code 421.
56482 The Exim daemon does not rely on the SIGCHLD signal to detect when a
56483 subprocess has finished, as this can get lost at busy times. Instead, it looks
56484 for completed subprocesses every time it wakes up. Provided there are other
56485 things happening (new incoming calls, starts of queue runs), completed
56486 processes will be noticed and tidied away. On very quiet systems you may
56487 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
56488 it will be noticed when the daemon next wakes up.
56491 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
56492 and can also be set up to reject SMTP calls from non-reserved hosts at times of
56493 high system load – for details see the <option>smtp_accept_reserve</option>,
56494 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
56495 applies in both the daemon and <emphasis>inetd</emphasis> cases.
56498 Exim normally starts a delivery process for each message received, though this
56499 can be varied by means of the <option>-odq</option> command line option and the
56500 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
56501 number of simultaneously running delivery processes started in this way from
56502 SMTP input can be limited by the <option>smtp_accept_queue</option> and
56503 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
56504 subsequently received messages are just put on the input queue without starting
56505 a delivery process.
56508 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
56509 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
56510 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
56511 handled by an entirely independent Exim process. Control by load average is,
56512 however, available with <emphasis>inetd</emphasis>.
56515 Exim can be configured to verify addresses in incoming SMTP commands as they
56516 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
56517 to rewrite addresses at this time – before any syntax checking is done. See
56518 section <xref linkend="SECTrewriteS"/>.
56521 Exim can also be configured to limit the rate at which a client host submits
56522 MAIL and RCPT commands in a single SMTP session. See the
56523 <option>smtp_ratelimit_hosts</option> option.
56526 <section id="SECID234">
56527 <title>Unrecognized SMTP commands</title>
56529 <indexterm role="concept">
56530 <primary>SMTP</primary>
56531 <secondary>unrecognized commands</secondary>
56533 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
56534 commands during a single SMTP connection, it drops the connection after sending
56535 the error response to the last command. The default value for
56536 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
56537 abuse that subvert web servers into making connections to SMTP ports; in these
56538 circumstances, a number of non-SMTP lines are sent first.
56541 <section id="SECID235">
56542 <title>Syntax and protocol errors in SMTP commands</title>
56544 <indexterm role="concept">
56545 <primary>SMTP</primary>
56546 <secondary>syntax errors</secondary>
56548 <indexterm role="concept">
56549 <primary>SMTP</primary>
56550 <secondary>protocol errors</secondary>
56552 A syntax error is detected if an SMTP command is recognized, but there is
56553 something syntactically wrong with its data, for example, a malformed email
56554 address in a RCPT command. Protocol errors include invalid command
56555 sequencing such as RCPT before MAIL. If Exim receives more than
56556 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
56557 drops the connection after sending the error response to the last command. The
56558 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
56559 broken clients that loop sending bad commands (yes, it has been seen).
56562 <section id="SECID236">
56563 <title>Use of non-mail SMTP commands</title>
56565 <indexterm role="concept">
56566 <primary>SMTP</primary>
56567 <secondary>non-mail commands</secondary>
56569 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
56570 DATA. Exim counts such commands, and drops the connection if there are too
56571 many of them in a single SMTP session. This action catches some
56572 denial-of-service attempts and things like repeated failing AUTHs, or a mad
56573 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
56574 defines what <quote>too many</quote> means. Its default value is 10.
56577 When a new message is expected, one occurrence of RSET is not counted. This
56578 allows a client to send one RSET between messages (this is not necessary,
56579 but some clients do it). Exim also allows one uncounted occurrence of HELO
56580 or EHLO, and one occurrence of STARTTLS between messages. After
56581 starting up a TLS session, another EHLO is expected, and so it too is not
56585 The first occurrence of AUTH in a connection, or immediately following
56586 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
56587 RCPT, DATA, and QUIT are counted.
56590 You can control which hosts are subject to the limit set by
56591 <option>smtp_accept_max_nonmail</option> by setting
56592 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
56593 the limit apply to all hosts. This option means that you can exclude any
56594 specific badly-behaved hosts that you have to live with.
56597 <section id="SECID237">
56598 <title>The VRFY and EXPN commands</title>
56600 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
56601 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
56602 appropriate) in order to decide whether the command should be accepted or not.
56603 If no ACL is defined, the command is rejected.
56606 <indexterm role="concept">
56607 <primary>VRFY</primary>
56608 <secondary>processing</secondary>
56610 When VRFY is accepted, it runs exactly the same code as when Exim is
56611 called with the <option>-bv</option> option.
56614 <indexterm role="concept">
56615 <primary>EXPN</primary>
56616 <secondary>processing</secondary>
56618 When EXPN is accepted, a single-level expansion of the address is done.
56619 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
56620 than a verification (the <option>-bv</option> option). If an unqualified local part is given
56621 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
56622 of VRFY and EXPN commands are logged on the main and reject logs, and
56623 VRFY verification failures are logged on the main log for consistency with
56627 <section id="SECTETRN">
56628 <title>The ETRN command</title>
56630 <indexterm role="concept">
56631 <primary>ETRN</primary>
56632 <secondary>processing</secondary>
56634 RFC 1985 describes an SMTP command called ETRN that is designed to
56635 overcome the security problems of the TURN command (which has fallen into
56636 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
56637 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
56638 should be accepted or not. If no ACL is defined, the command is rejected.
56641 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
56642 delivery to certain hosts. As Exim does not organize its message queue by host,
56643 the only form of ETRN that is supported by default is the one where the
56644 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
56645 specific to the SMTP server. A valid ETRN command causes a run of Exim with
56646 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
56647 argument. For example,
56649 <literallayout class="monospaced">
56655 <literallayout class="monospaced">
56659 which causes a delivery attempt on all messages with undelivered addresses
56660 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
56661 default), Exim prevents the simultaneous execution of more than one queue run
56662 for the same argument string as a result of an ETRN command. This stops
56663 a misbehaving client from starting more than one queue runner at once.
56666 <indexterm role="concept">
56667 <primary>hints database</primary>
56668 <secondary>ETRN serialization</secondary>
56670 Exim implements the serialization by means of a hints database in which a
56671 record is written whenever a process is started by ETRN, and deleted when
56672 the process completes. However, Exim does not keep the SMTP session waiting for
56673 the ETRN process to complete. Once ETRN is accepted, the client is sent
56674 a <quote>success</quote> return code. Obviously there is scope for hints records to get
56675 left lying around if there is a system or program crash. To guard against this,
56676 Exim ignores any records that are more than six hours old.
56679 <indexterm role="option">
56680 <primary><option>smtp_etrn_command</option></primary>
56682 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
56683 used. This specifies a command that is run whenever ETRN is received,
56684 whatever the form of its argument. For
56687 <literallayout class="monospaced">
56688 smtp_etrn_command = /etc/etrn_command $domain \
56689 $sender_host_address
56692 <indexterm role="variable">
56693 <primary><varname>$domain</varname></primary>
56695 The string is split up into arguments which are independently expanded. The
56696 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
56697 and no syntax checking is done on the contents of this argument. Exim does not
56698 wait for the command to complete, so its status code is not checked. Exim runs
56699 under its own uid and gid when receiving incoming SMTP, so it is not possible
56700 for it to change them before running the command.
56703 <section id="SECID238">
56704 <title>Incoming local SMTP</title>
56706 <indexterm role="concept">
56707 <primary>SMTP</primary>
56708 <secondary>local incoming</secondary>
56710 Some user agents use SMTP to pass messages to their local MTA using the
56711 standard input and output, as opposed to passing the envelope on the command
56712 line and writing the message to the standard input. This is supported by the
56713 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
56714 messages over TCP/IP (including the use of ACLs), except that the envelope
56715 sender given in a MAIL command is ignored unless the caller is trusted. In
56716 an ACL you can detect this form of SMTP input by testing for an empty host
56717 identification. It is common to have this as the first line in the ACL that
56718 runs for RCPT commands:
56720 <literallayout class="monospaced">
56724 This accepts SMTP messages from local processes without doing any other tests.
56727 <section id="SECTbatchSMTP">
56728 <title>Outgoing batched SMTP</title>
56730 <indexterm role="concept">
56731 <primary>SMTP</primary>
56732 <secondary>batched outgoing</secondary>
56734 <indexterm role="concept">
56735 <primary>batched SMTP output</primary>
56737 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
56738 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
56739 be output in BSMTP format. No SMTP responses are possible for this form of
56740 delivery. All it is doing is using SMTP commands as a way of transmitting the
56741 envelope along with the message.
56744 The message is written to the file or pipe preceded by the SMTP commands
56745 MAIL and RCPT, and followed by a line containing a single dot. Lines in
56746 the message that start with a dot have an extra dot added. The SMTP command
56747 HELO is not normally used. If it is required, the <option>message_prefix</option> option
56748 can be used to specify it.
56751 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
56752 one recipient address at a time by default. However, you can arrange for them
56753 to handle several addresses at once by setting the <option>batch_max</option> option. When
56754 this is done for BSMTP, messages may contain multiple RCPT commands. See
56755 chapter <xref linkend="CHAPbatching"/> for more details.
56758 <indexterm role="variable">
56759 <primary><varname>$host</varname></primary>
56761 When one or more addresses are routed to a BSMTP transport by a router that
56762 sets up a host list, the name of the first host on the list is available to the
56763 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
56766 <literallayout class="monospaced">
56769 driver = manualroute
56770 transport = smtp_appendfile
56771 route_list = domain.example batch.host.example
56775 driver = appendfile
56776 directory = /var/bsmtp/$host
56782 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
56783 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
56784 message (unless there are more than 1000 recipients).
56787 <section id="SECTincomingbatchedSMTP">
56788 <title>Incoming batched SMTP</title>
56790 <indexterm role="concept">
56791 <primary>SMTP</primary>
56792 <secondary>batched incoming</secondary>
56794 <indexterm role="concept">
56795 <primary>batched SMTP input</primary>
56797 The <option>-bS</option> command line option causes Exim to accept one or more messages by
56798 reading SMTP on the standard input, but to generate no responses. If the caller
56799 is trusted, the senders in the MAIL commands are believed; otherwise the
56800 sender is always the caller of Exim. Unqualified senders and receivers are not
56801 rejected (there seems little point) but instead just get qualified. HELO
56802 and EHLO act as RSET; VRFY, EXPN, ETRN and HELP, act
56803 as NOOP; QUIT quits.
56805 <para revisionflag="changed">
56806 Minimal policy checking is done for BSMTP input. Only the non-SMTP
56807 ACL is run in the same way as for non-SMTP local input.
56810 If an error is detected while reading a message, including a missing <quote>.</quote> at
56811 the end, Exim gives up immediately. It writes details of the error to the
56812 standard output in a stylized way that the calling program should be able to
56813 make some use of automatically, for example:
56815 <literallayout class="monospaced">
56816 554 Unexpected end of file
56817 Transaction started in line 10
56818 Error detected in line 14
56821 It writes a more verbose version, for human consumption, to the standard error
56824 <literallayout class="monospaced">
56825 An error was detected while processing a file of BSMTP input.
56826 The error message was:
56828 501 '>' missing at end of address
56830 The SMTP transaction started in line 10.
56831 The error was detected in line 12.
56832 The SMTP command at fault was:
56834 rcpt to:<malformed@in.com.plete
56836 1 previous message was successfully processed.
56837 The rest of the batch was abandoned.
56840 The return code from Exim is zero only if there were no errors. It is 1 if some
56841 messages were accepted before an error was detected, and 2 if no messages were
56843 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
56844 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
56849 <chapter id="CHAPemsgcust">
56850 <title>Customizing bounce and warning messages</title>
56851 <titleabbrev>Customizing messages</titleabbrev>
56853 When a message fails to be delivered, or remains on the queue for more than a
56854 configured amount of time, Exim sends a message to the original sender, or
56855 to an alternative configured address. The text of these messages is built into
56856 the code of Exim, but it is possible to change it, either by adding a single
56857 string, or by replacing each of the paragraphs by text supplied in a file.
56860 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
56861 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
56862 option. Exim also adds the line
56864 <literallayout class="monospaced">
56865 Auto-Submitted: auto-generated
56868 to all warning and bounce messages,
56870 <section id="SECID239">
56871 <title>Customizing bounce messages</title>
56873 <indexterm role="concept">
56874 <primary>customizing</primary>
56875 <secondary>bounce message</secondary>
56877 <indexterm role="concept">
56878 <primary>bounce message</primary>
56879 <secondary>customizing</secondary>
56881 If <option>bounce_message_text</option> is set, its contents are included in the default
56882 message immediately after <quote>This message was created automatically by mail
56883 delivery software.</quote> The string is not expanded. It is not used if
56884 <option>bounce_message_file</option> is set.
56887 When <option>bounce_message_file</option> is set, it must point to a template file for
56888 constructing error messages. The file consists of a series of text items,
56889 separated by lines consisting of exactly four asterisks. If the file cannot be
56890 opened, default text is used and a message is written to the main and panic
56891 logs. If any text item in the file is empty, default text is used for that
56895 <indexterm role="variable">
56896 <primary><varname>$bounce_recipient</varname></primary>
56898 <indexterm role="variable">
56899 <primary><varname>$bounce_return_size_limit</varname></primary>
56901 Each item of text that is read from the file is expanded, and there are two
56902 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
56903 the recipient of an error message while it is being created, and
56904 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
56905 option, rounded to a whole number.
56908 The items must appear in the file in the following order:
56913 The first item is included in the headers, and should include at least a
56914 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
56919 The second item forms the start of the error message. After it, Exim lists the
56920 failing addresses with their error messages.
56925 The third item is used to introduce any text from pipe transports that is to be
56926 returned to the sender. It is omitted if there is no such text.
56931 The fourth item is used to introduce the copy of the message that is returned
56932 as part of the error report.
56937 The fifth item is added after the fourth one if the returned message is
56938 truncated because it is bigger than <option>return_size_limit</option>.
56943 The sixth item is added after the copy of the original message.
56948 The default state (<option>bounce_message_file</option> unset) is equivalent to the
56949 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
56950 other lines have been split in order to fit them on the page:
56952 <literallayout class="monospaced">
56953 Subject: Mail delivery failed
56954 ${if eq{$sender_address}{$bounce_recipient}
56955 {: returning message to sender}}
56957 This message was created automatically by mail delivery software.
56959 A message ${if eq{$sender_address}{$bounce_recipient}
56960 {that you sent }{sent by
56962 <$sender_address>
56964 }}could not be delivered to all of its recipients.
56965 This is a permanent error. The following address(es) failed:
56967 The following text was generated during the delivery attempt(s):
56969 ------ This is a copy of the message, including all the headers.
56972 ------ The body of the message is $message_size characters long;
56974 ------ $bounce_return_size_limit or so are included here.
56978 <section id="SECTcustwarn">
56979 <title>Customizing warning messages</title>
56981 <indexterm role="concept">
56982 <primary>customizing</primary>
56983 <secondary>warning message</secondary>
56985 <indexterm role="concept">
56986 <primary>warning of delay</primary>
56987 <secondary>customizing the message</secondary>
56989 The option <option>warn_message_file</option> can be pointed at a template file for use when
56990 warnings about message delays are created. In this case there are only three
56996 The first item is included in the headers, and should include at least a
56997 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
57002 The second item forms the start of the warning message. After it, Exim lists
57003 the delayed addresses.
57008 The third item then ends the message.
57013 The default state is equivalent to the following file, except that some lines
57014 have been split here, in order to fit them on the page:
57016 <literallayout class="monospaced">
57017 Subject: Warning: message $message_exim_id delayed
57018 $warn_message_delay
57020 This message was created automatically by mail delivery software.
57022 A message ${if eq{$sender_address}{$warn_message_recipients}
57023 {that you sent }{sent by
57025 <$sender_address>
57027 }}has not been delivered to all of its recipients after
57028 more than $warn_message_delay on the queue on $primary_hostname.
57030 The message identifier is: $message_exim_id
57031 The subject of the message is: $h_subject
57032 The date of the message is: $h_date
57034 The following address(es) have not yet been delivered:
57036 No action is required on your part. Delivery attempts will
57037 continue for some time, and this warning may be repeated at
57038 intervals if the message remains undelivered. Eventually the
57039 mail delivery software will give up, and when that happens,
57040 the message will be returned to you.
57043 <indexterm role="variable">
57044 <primary><varname>$warn_message_delay</varname></primary>
57046 <indexterm role="variable">
57047 <primary><varname>$warn_message_recipients</varname></primary>
57049 However, in the default state the subject and date lines are omitted if no
57050 appropriate headers exist. During the expansion of this file,
57051 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote><<emphasis>n</emphasis>>
57052 minutes</quote> or <quote><<emphasis>n</emphasis>> hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
57053 of recipients for the warning message. There may be more than one if there are
57054 multiple addresses with different <option>errors_to</option> settings on the routers that
57060 <chapter id="CHAPcomconreq">
57061 <title>Some common configuration settings</title>
57063 This chapter discusses some configuration settings that seem to be fairly
57064 common. More examples and discussion can be found in the Exim book.
57066 <section id="SECID240">
57067 <title>Sending mail to a smart host</title>
57069 <indexterm role="concept">
57070 <primary>smart host</primary>
57071 <secondary>example router</secondary>
57073 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
57074 should replace the default <command>dnslookup</command> router with a router which does the
57075 routing explicitly:
57077 <literallayout class="monospaced">
57078 send_to_smart_host:
57079 driver = manualroute
57080 route_list = !+local_domains smart.host.name
57081 transport = remote_smtp
57084 You can use the smart host’s IP address instead of the name if you wish.
57085 If you are using Exim only to submit messages to a smart host, and not for
57086 receiving incoming messages, you can arrange for it to do the submission
57087 synchronously by setting the <option>mua_wrapper</option> option (see chapter
57088 <xref linkend="CHAPnonqueueing"/>).
57091 <section id="SECTmailinglists">
57092 <title>Using Exim to handle mailing lists</title>
57094 <indexterm role="concept">
57095 <primary>mailing lists</primary>
57097 Exim can be used to run simple mailing lists, but for large and/or complicated
57098 requirements, the use of additional specialized mailing list software such as
57099 Majordomo or Mailman is recommended.
57102 The <command>redirect</command> router can be used to handle mailing lists where each list
57103 is maintained in a separate file, which can therefore be managed by an
57104 independent manager. The <option>domains</option> router option can be used to run these
57105 lists in a separate domain from normal mail. For example:
57107 <literallayout class="monospaced">
57110 domains = lists.example
57111 file = /usr/lists/$local_part
57114 errors_to = $local_part-request@lists.example
57118 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
57119 in that domain, it looks for a file that matches the local part. If there is no
57120 such file, the router declines, but because <option>no_more</option> is set, no subsequent
57121 routers are tried, and so the whole delivery fails.
57124 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
57125 expanded into a file name or a pipe delivery, which is usually inappropriate in
57129 <indexterm role="option">
57130 <primary><option>errors_to</option></primary>
57132 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
57133 taken from a mailing list are to be sent to the given address rather than the
57134 original sender of the message. However, before acting on this, Exim verifies
57135 the error address, and ignores it if verification fails.
57138 For example, using the configuration above, mail sent to
57139 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
57140 <filename>/usr/lists/dicts</filename>, with error reports directed to
57141 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
57142 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
57143 the address(es) of this particular list’s manager(s), but other approaches,
57144 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
57145 or <option>local_part_suffix</option> options) to handle addresses of the form
57146 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
57149 <section id="SECID241">
57150 <title>Syntax errors in mailing lists</title>
57152 <indexterm role="concept">
57153 <primary>mailing lists</primary>
57154 <secondary>syntax errors in</secondary>
57156 If an entry in redirection data contains a syntax error, Exim normally defers
57157 delivery of the original address. That means that a syntax error in a mailing
57158 list holds up all deliveries to the list. This may not be appropriate when a
57159 list is being maintained automatically from data supplied by users, and the
57160 addresses are not rigorously checked.
57163 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
57164 entries that fail to parse, noting the incident in the log. If in addition
57165 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
57166 whenever a broken address is skipped. It is usually appropriate to set
57167 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
57170 <section id="SECID242">
57171 <title>Re-expansion of mailing lists</title>
57173 <indexterm role="concept">
57174 <primary>mailing lists</primary>
57175 <secondary>re-expansion of</secondary>
57177 Exim remembers every individual address to which a message has been delivered,
57178 in order to avoid duplication, but it normally stores only the original
57179 recipient addresses with a message. If all the deliveries to a mailing list
57180 cannot be done at the first attempt, the mailing list is re-expanded when the
57181 delivery is next tried. This means that alterations to the list are taken into
57182 account at each delivery attempt, so addresses that have been added to
57183 the list since the message arrived will therefore receive a copy of the
57184 message, even though it pre-dates their subscription.
57187 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
57188 on the <command>redirect</command> router. If this is done, any addresses generated by the
57189 router that fail to deliver at the first attempt are added to the message as
57190 <quote>top level</quote> addresses, and the parent address that generated them is marked
57191 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
57192 subsequent delivery attempts. The disadvantage of this is that if any of the
57193 failing addresses are incorrect, correcting them in the file has no effect on
57194 pre-existing messages.
57197 The original top-level address is remembered with each of the generated
57198 addresses, and is output in any log messages. However, any intermediate parent
57199 addresses are not recorded. This makes a difference to the log only if the
57200 <option>all_parents</option> selector is set, but for mailing lists there is normally only
57201 one level of expansion anyway.
57204 <section id="SECID243">
57205 <title>Closed mailing lists</title>
57207 <indexterm role="concept">
57208 <primary>mailing lists</primary>
57209 <secondary>closed</secondary>
57211 The examples so far have assumed open mailing lists, to which anybody may
57212 send mail. It is also possible to set up closed lists, where mail is accepted
57213 from specified senders only. This is done by making use of the generic
57214 <option>senders</option> option to restrict the router that handles the list.
57217 The following example uses the same file as a list of recipients and as a list
57218 of permitted senders. It requires three routers:
57220 <literallayout class="monospaced">
57223 domains = lists.example
57224 local_part_suffix = -request
57225 file = /usr/lists/$local_part$local_part_suffix
57230 domains = lists.example
57231 senders = ${if exists {/usr/lists/$local_part}\
57232 {lsearch;/usr/lists/$local_part}{*}}
57233 file = /usr/lists/$local_part
57236 errors_to = $local_part-request@lists.example
57241 domains = lists.example
57243 data = :fail: $local_part@lists.example is a closed mailing list
57246 All three routers have the same <option>domains</option> setting, so for any other domains,
57247 they are all skipped. The first router runs only if the local part ends in
57248 <option>-request</option>. It handles messages to the list manager(s) by means of an open
57252 The second router runs only if the <option>senders</option> precondition is satisfied. It
57253 checks for the existence of a list that corresponds to the local part, and then
57254 checks that the sender is on the list by means of a linear search. It is
57255 necessary to check for the existence of the file before trying to search it,
57256 because otherwise Exim thinks there is a configuration error. If the file does
57257 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
57258 means that the router runs, but because there is no list, declines, and
57259 <option>no_more</option> ensures that no further routers are run. The address fails with an
57260 <quote>unrouteable address</quote> error.
57263 The third router runs only if the second router is skipped, which happens when
57264 a mailing list exists, but the sender is not on it. This router forcibly fails
57265 the address, giving a suitable error message.
57268 <section id="SECTverp">
57269 <title>Variable Envelope Return Paths (VERP)</title>
57271 <indexterm role="concept">
57272 <primary>VERP</primary>
57274 <indexterm role="concept">
57275 <primary>Variable Envelope Return Paths</primary>
57277 <indexterm role="concept">
57278 <primary>envelope sender</primary>
57280 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> –
57281 are a way of helping mailing list administrators discover which subscription
57282 address is the cause of a particular delivery failure. The idea is to encode
57283 the original recipient address in the outgoing envelope sender address, so that
57284 if the message is forwarded by another host and then subsequently bounces, the
57285 original recipient can be extracted from the recipient address of the bounce.
57288 <indexterm role="option">
57289 <primary><option>errors_to</option></primary>
57291 <indexterm role="option">
57292 <primary><option>return_path</option></primary>
57294 Envelope sender addresses can be modified by Exim using two different
57295 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
57296 list examples), or the <option>return_path</option> option on a transport. The second of
57297 these is effective only if the message is successfully delivered to another
57298 host; it is not used for errors detected on the local host (see the description
57299 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
57300 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
57302 <literallayout class="monospaced">
57307 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57308 {$1-request+$local_part=$domain@your.dom.example}fail}
57311 This has the effect of rewriting the return path (envelope sender) on outgoing
57312 SMTP messages, if the local part of the original return path ends in
57313 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
57314 local part and domain of the recipient into the return path. Suppose, for
57315 example, that a message whose return path has been set to
57316 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
57317 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
57320 <literallayout class="monospaced">
57321 somelist-request+subscriber=other.dom.example@your.dom.example
57324 <indexterm role="variable">
57325 <primary><varname>$local_part</varname></primary>
57327 For this to work, you must tell Exim to send multiple copies of messages that
57328 have more than one recipient, so that each copy has just one recipient. This is
57329 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
57330 might be sent to several different recipients in the same domain, in which case
57331 <varname>$local_part</varname> is not available in the transport, because it is not unique.
57334 Unless your host is doing nothing but mailing list deliveries, you should
57335 probably use a separate transport for the VERP deliveries, so as not to use
57336 extra resources in making one-per-recipient copies for other deliveries. This
57337 can easily be done by expanding the <option>transport</option> option in the router:
57339 <literallayout class="monospaced">
57342 domains = ! +local_domains
57344 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
57345 {verp_smtp}{remote_smtp}}
57349 If you want to change the return path using <option>errors_to</option> in a router instead
57350 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
57351 routers that handle mailing list addresses. This will ensure that all delivery
57352 errors, including those detected on the local host, are sent to the VERP
57356 On a host that does no local deliveries and has no manual routing, only the
57357 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
57358 SMTP deliveries. Every mailing list recipient has its own return path value,
57359 and so Exim must hand them to the transport one at a time. Here is an example
57360 of a <command>dnslookup</command> router that implements VERP:
57362 <literallayout class="monospaced">
57365 domains = ! +local_domains
57366 transport = remote_smtp
57368 ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
57369 {$1-request+$local_part=$domain@your.dom.example}fail}
57373 Before you start sending out messages with VERPed return paths, you must also
57374 configure Exim to accept the bounce messages that come back to those paths.
57375 Typically this is done by setting a <option>local_part_suffix</option> option for a
57376 router, and using this to route the messages to wherever you want to handle
57380 The overhead incurred in using VERP depends very much on the size of the
57381 message, the number of recipient addresses that resolve to the same remote
57382 host, and the speed of the connection over which the message is being sent. If
57383 a lot of addresses resolve to the same host and the connection is slow, sending
57384 a separate copy of the message for each address may take substantially longer
57385 than sending a single copy with many recipients (for which VERP cannot be
57389 <section id="SECTvirtualdomains">
57390 <title>Virtual domains</title>
57392 <indexterm role="concept">
57393 <primary>virtual domains</primary>
57395 <indexterm role="concept">
57396 <primary>domain</primary>
57397 <secondary>virtual</secondary>
57399 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
57405 A domain for which there are no real mailboxes; all valid local parts are
57406 aliases for other email addresses. Common examples are organizational
57407 top-level domains and <quote>vanity</quote> domains.
57412 One of a number of independent domains that are all handled by the same host,
57413 with mailboxes on that host, but where the mailbox owners do not necessarily
57414 have login accounts on that host.
57419 The first usage is probably more common, and does seem more <quote>virtual</quote> than
57420 the second. This kind of domain can be handled in Exim with a straightforward
57421 aliasing router. One approach is to create a separate alias file for each
57422 virtual domain. Exim can test for the existence of the alias file to determine
57423 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
57424 to a router of this form:
57426 <literallayout class="monospaced">
57429 domains = dsearch;/etc/mail/virtual
57430 data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
57434 The <option>domains</option> option specifies that the router is to be skipped, unless there
57435 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
57436 domain that is being processed. When the router runs, it looks up the local
57437 part in the file to find a new address (or list of addresses). The <option>no_more</option>
57438 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
57439 string), Exim gives up on the address without trying any subsequent routers.
57442 This one router can handle all the virtual domains because the alias file names
57443 follow a fixed pattern. Permissions can be arranged so that appropriate people
57444 can edit the different alias files. A successful aliasing operation results in
57445 a new envelope recipient address, which is then routed from scratch.
57448 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
57449 way. One approach is to create a file for each domain containing a list of
57450 valid local parts, and use it in a router like this:
57452 <literallayout class="monospaced">
57455 domains = dsearch;/etc/mail/domains
57456 local_parts = lsearch;/etc/mail/domains/$domain
57457 transport = my_mailboxes
57460 The address is accepted if there is a file for the domain, and the local part
57461 can be found in the file. The <option>domains</option> option is used to check for the
57462 file’s existence because <option>domains</option> is tested before the <option>local_parts</option>
57463 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
57464 because that option is tested after <option>local_parts</option>. The transport is as
57467 <literallayout class="monospaced">
57469 driver = appendfile
57470 file = /var/mail/$domain/$local_part
57474 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
57475 required, to specify which uid is to be used for writing to the mailboxes.
57478 The configuration shown here is just one example of how you might support this
57479 requirement. There are many other ways this kind of configuration can be set
57480 up, for example, by using a database instead of separate files to hold all the
57481 information about the domains.
57484 <section id="SECTmulbox">
57485 <title>Multiple user mailboxes</title>
57487 <indexterm role="concept">
57488 <primary>multiple mailboxes</primary>
57490 <indexterm role="concept">
57491 <primary>mailbox</primary>
57492 <secondary>multiple</secondary>
57494 <indexterm role="concept">
57495 <primary>local part</primary>
57496 <secondary>prefix</secondary>
57498 <indexterm role="concept">
57499 <primary>local part</primary>
57500 <secondary>suffix</secondary>
57502 Heavy email users often want to operate with multiple mailboxes, into which
57503 incoming mail is automatically sorted. A popular way of handling this is to
57504 allow users to use multiple sender addresses, so that replies can easily be
57505 identified. Users are permitted to add prefixes or suffixes to their local
57506 parts for this purpose. The wildcard facility of the generic router options
57507 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
57508 example, consider this router:
57510 <literallayout class="monospaced">
57514 file = $home/.forward
57515 local_part_suffix = -*
57516 local_part_suffix_optional
57520 <indexterm role="variable">
57521 <primary><varname>$local_part_suffix</varname></primary>
57523 It runs a user’s <filename>.forward</filename> file for all local parts of the form
57524 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
57525 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
57527 <literallayout class="monospaced">
57528 if $local_part_suffix contains -special then
57529 save /home/$local_part/Mail/special
57533 If the filter file does not exist, or does not deal with such addresses, they
57534 fall through to subsequent routers, and, assuming no subsequent use of the
57535 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
57536 control over which suffixes are valid.
57539 Alternatively, a suffix can be used to trigger the use of a different
57540 <filename>.forward</filename> file – which is the way a similar facility is implemented in
57543 <literallayout class="monospaced">
57547 file = $home/.forward$local_part_suffix
57548 local_part_suffix = -*
57549 local_part_suffix_optional
57553 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
57554 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
57555 does not exist, or does not deal with the address, it is passed on to
57556 subsequent routers, which could, if required, look for an unqualified
57557 <filename>.forward</filename> file to use as a default.
57560 <section id="SECID244">
57561 <title>Simplified vacation processing</title>
57563 <indexterm role="concept">
57564 <primary>vacation processing</primary>
57566 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
57567 a pipe command in a <filename>.forward</filename> file
57568 (see section <xref linkend="SECTspecitredli"/> for syntax details).
57569 This is prone to error by inexperienced users. There are two features of Exim
57570 that can be used to make this process simpler for users:
57575 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
57576 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
57577 alternatively can use Exim’s <command>autoreply</command> transport. The contents of a user’s
57578 <filename>.forward</filename> file are then much simpler. For example:
57580 <literallayout class="monospaced">
57581 spqr, vacation-spqr
57586 The <option>require_files</option> generic router option can be used to trigger a
57587 vacation delivery by checking for the existence of a certain file in the
57588 user’s home directory. The <option>unseen</option> generic option should also be used, to
57589 ensure that the original delivery also proceeds. In this case, all the user has
57590 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
57596 Another advantage of both these methods is that they both work even when the
57597 use of arbitrary pipes by users is locked out.
57600 <section id="SECID245">
57601 <title>Taking copies of mail</title>
57603 <indexterm role="concept">
57604 <primary>message</primary>
57605 <secondary>copying every</secondary>
57607 Some installations have policies that require archive copies of all messages to
57608 be made. A single copy of each message can easily be taken by an appropriate
57609 command in a system filter, which could, for example, use a different file for
57610 each day’s messages.
57613 There is also a shadow transport mechanism that can be used to take copies of
57614 messages that are successfully delivered by local transports, one copy per
57615 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
57616 notification of delivery by sites that insist on doing such things.
57619 <section id="SECID246">
57620 <title>Intermittently connected hosts</title>
57622 <indexterm role="concept">
57623 <primary>intermittently connected hosts</primary>
57625 It has become quite common (because it is cheaper) for hosts to connect to the
57626 Internet periodically rather than remain connected all the time. The normal
57627 arrangement is that mail for such hosts accumulates on a system that is
57628 permanently connected.
57631 Exim was designed for use on permanently connected hosts, and so it is not
57632 particularly well-suited to use in an intermittently connected environment.
57633 Nevertheless there are some features that can be used.
57636 <section id="SECID247">
57637 <title>Exim on the upstream server host</title>
57639 It is tempting to arrange for incoming mail for the intermittently connected
57640 host to remain on Exim’s queue until the client connects. However, this
57641 approach does not scale very well. Two different kinds of waiting message are
57642 being mixed up in the same queue – those that cannot be delivered because of
57643 some temporary problem, and those that are waiting for their destination host
57644 to connect. This makes it hard to manage the queue, as well as wasting
57645 resources, because each queue runner scans the entire queue.
57648 A better approach is to separate off those messages that are waiting for an
57649 intermittently connected host. This can be done by delivering these messages
57650 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
57651 format, from where they are transmitted by other software when their
57652 destination connects. This makes it easy to collect all the mail for one host
57653 in a single directory, and to apply local timeout rules on a per-message basis
57657 On a very small scale, leaving the mail on Exim’s queue can be made to work. If
57658 you are doing this, you should configure Exim with a long retry period for the
57659 intermittent host. For example:
57661 <literallayout class="monospaced">
57662 cheshire.wonderland.fict.example * F,5d,24h
57665 This stops a lot of failed delivery attempts from occurring, but Exim remembers
57666 which messages it has queued up for that host. Once the intermittent host comes
57667 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
57668 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
57669 causes all the queued up messages to be delivered, often down a single SMTP
57670 connection. While the host remains connected, any new messages get delivered
57674 If the connecting hosts do not have fixed IP addresses, that is, if a host is
57675 issued with a different IP address each time it connects, Exim’s retry
57676 mechanisms on the holding host get confused, because the IP address is normally
57677 used as part of the key string for holding retry information. This can be
57678 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
57679 Since this has disadvantages for permanently connected hosts, it is best to
57680 arrange a separate transport for the intermittently connected ones.
57683 <section id="SECID248">
57684 <title>Exim on the intermittently connected client host</title>
57686 The value of <option>smtp_accept_queue_per_connection</option> should probably be
57687 increased, or even set to zero (that is, disabled) on the intermittently
57688 connected host, so that all incoming messages down a single connection get
57689 delivered immediately.
57692 <indexterm role="concept">
57693 <primary>SMTP</primary>
57694 <secondary>passed connection</secondary>
57696 <indexterm role="concept">
57697 <primary>SMTP</primary>
57698 <secondary>multiple deliveries</secondary>
57700 <indexterm role="concept">
57701 <primary>multiple SMTP deliveries</primary>
57703 Mail waiting to be sent from an intermittently connected host will probably
57704 not have been routed, because without a connection DNS lookups are not
57705 possible. This means that if a normal queue run is done at connection time,
57706 each message is likely to be sent in a separate SMTP session. This can be
57707 avoided by starting the queue run with a command line option beginning with
57708 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
57709 first pass, routing is done but no deliveries take place. The second pass is a
57710 normal queue run; since all the messages have been previously routed, those
57711 destined for the same host are likely to get sent as multiple deliveries in a
57712 single SMTP connection.
57717 <chapter id="CHAPnonqueueing">
57718 <title>Using Exim as a non-queueing client</title>
57719 <titleabbrev>Exim as a non-queueing client</titleabbrev>
57721 <indexterm role="concept">
57722 <primary>client, non-queueing</primary>
57724 <indexterm role="concept">
57725 <primary>smart host</primary>
57726 <secondary>suppressing queueing</secondary>
57728 On a personal computer, it is a common requirement for all
57729 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
57730 configured to operate that way, for all the popular operating systems.
57731 However, there are some MUAs for Unix-like systems that cannot be so
57732 configured: they submit messages using the command line interface of
57733 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
57737 If the personal computer runs continuously, there is no problem, because it can
57738 run a conventional MTA that handles delivery to the smart host, and deal with
57739 any delays via its queueing mechanism. However, if the computer does not run
57740 continuously or runs different operating systems at different times, queueing
57741 email is not desirable.
57744 There is therefore a requirement for something that can provide the
57745 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
57746 any queueing or retrying facilities. Furthermore, the delivery to the smart
57747 host should be synchronous, so that if it fails, the sending MUA is immediately
57748 informed. In other words, we want something that extends an MUA that submits
57749 to a local MTA via the command line so that it behaves like one that submits
57750 to a remote smart host using TCP/SMTP.
57753 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
57754 that do this job. However, people have found them to be lacking in various
57755 ways. For instance, you might want to allow aliasing and forwarding to be done
57756 before sending a message to the smart host.
57759 Exim already had the necessary infrastructure for doing this job. Just a few
57760 tweaks were needed to make it behave as required, though it is somewhat of an
57761 overkill to use a fully-featured MTA for this purpose.
57764 <indexterm role="option">
57765 <primary><option>mua_wrapper</option></primary>
57767 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
57768 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
57769 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
57770 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
57771 compatible router and transport configuration. Typically there will be just one
57772 router and one transport, sending everything to a smart host.
57775 When run in MUA wrapping mode, the behaviour of Exim changes in the
57781 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
57782 In other words, the only way to submit messages is via the command line.
57787 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
57788 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
57789 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
57790 does not finish until the delivery attempt is complete. If the delivery is
57791 successful, a zero return code is given.
57796 Address redirection is permitted, but the final routing for all addresses must
57797 be to the same remote transport, and to the same list of hosts. Furthermore,
57798 the return address (envelope sender) must be the same for all recipients, as
57799 must any added or deleted header lines. In other words, it must be possible to
57800 deliver the message in a single SMTP transaction, however many recipients there
57806 If these conditions are not met, or if routing any address results in a
57807 failure or defer status, or if Exim is unable to deliver all the recipients
57808 successfully to one of the smart hosts, delivery of the entire message fails.
57813 Because no queueing is allowed, all failures are treated as permanent; there
57814 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
57815 smart host. Furthermore, because only a single yes/no response can be given to
57816 the caller, it is not possible to deliver to some recipients and not others. If
57817 there is an error (temporary or permanent) for any recipient, all are failed.
57822 If more than one smart host is listed, Exim will try another host after a
57823 connection failure or a timeout, in the normal way. However, if this kind of
57824 failure happens for all the hosts, the delivery fails.
57829 When delivery fails, an error message is written to the standard error stream
57830 (as well as to Exim’s log), and Exim exits to the caller with a return code
57831 value 1. The message is expunged from Exim’s spool files. No bounce messages
57832 are ever generated.
57837 No retry data is maintained, and any retry rules are ignored.
57842 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
57843 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
57844 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
57849 The overall effect is that Exim makes a single synchronous attempt to deliver
57850 the message, failing if there is any kind of problem. Because no local
57851 deliveries are done and no daemon can be run, Exim does not need root
57852 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
57853 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
57854 the advantages and disadvantages of running without root privilege.
57858 <chapter id="CHAPlog">
57859 <title>Log files</title>
57861 <indexterm role="concept" id="IIDloggen" class="startofrange">
57862 <primary>log</primary>
57863 <secondary>general description</secondary>
57865 <indexterm role="concept">
57866 <primary>log</primary>
57867 <secondary>types of</secondary>
57869 Exim writes three different logs, referred to as the main log, the reject log,
57875 <indexterm role="concept">
57876 <primary>main log</primary>
57878 The main log records the arrival of each message and each delivery in a single
57879 line in each case. The format is as compact as possible, in an attempt to keep
57880 down the size of log files. Two-character flag sequences make it easy to pick
57881 out these lines. A number of other events are recorded in the main log. Some of
57882 them are optional, in which case the <option>log_selector</option> option controls whether
57883 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
57884 analysis of main log files, is provided in the Exim distribution (see section
57885 <xref linkend="SECTmailstat"/>).
57890 <indexterm role="concept">
57891 <primary>reject log</primary>
57893 The reject log records information from messages that are rejected as a result
57894 of a configuration option (that is, for policy reasons).
57895 The first line of each rejection is a copy of the line that is also written to
57896 the main log. Then, if the message’s header has been read at the time the log
57897 is written, its contents are written to this log. Only the original header
57898 lines are available; header lines added by ACLs are not logged. You can use the
57899 reject log to check that your policy controls are working correctly; on a busy
57900 host this may be easier than scanning the main log for rejection messages. You
57901 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
57907 <indexterm role="concept">
57908 <primary>panic log</primary>
57910 <indexterm role="concept">
57911 <primary>system log</primary>
57913 When certain serious errors occur, Exim writes entries to its panic log. If the
57914 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
57915 are usually written to the main log as well, but can get lost amid the mass of
57916 other entries. The panic log should be empty under normal circumstances. It is
57917 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
57918 regularly, in order to become aware of any problems. When Exim cannot open its
57919 panic log, it tries as a last resort to write to the system log (syslog). This
57920 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
57921 message itself is written at priority LOG_CRIT.
57926 Every log line starts with a timestamp, in the format shown in the following
57927 example. Note that many of the examples shown in this chapter are line-wrapped.
57928 In the log file, this would be all on one line:
57930 <literallayout class="monospaced">
57931 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
57935 By default, the timestamps are in the local timezone. There are two
57936 ways of changing this:
57941 You can set the <option>timezone</option> option to a different time zone; in particular, if
57944 <literallayout class="monospaced">
57948 the timestamps will be in UTC (aka GMT).
57953 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
57956 <literallayout class="monospaced">
57957 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
57962 <indexterm role="concept">
57963 <primary>log</primary>
57964 <secondary>process ids in</secondary>
57966 <indexterm role="concept">
57967 <primary>pid (process id)</primary>
57968 <secondary>in log lines</secondary>
57970 Exim does not include its process id in log lines by default, but you can
57971 request that it does so by specifying the <literal>pid</literal> log selector (see section
57972 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
57973 brackets, immediately after the time and date.
57975 <section id="SECTwhelogwri">
57976 <title>Where the logs are written</title>
57978 <indexterm role="concept">
57979 <primary>log</primary>
57980 <secondary>destination</secondary>
57982 <indexterm role="concept">
57983 <primary>log</primary>
57984 <secondary>to file</secondary>
57986 <indexterm role="concept">
57987 <primary>log</primary>
57988 <secondary>to syslog</secondary>
57990 <indexterm role="concept">
57991 <primary>syslog</primary>
57993 The logs may be written to local files, or to syslog, or both. However, it
57994 should be noted that many syslog implementations use UDP as a transport, and
57995 are therefore unreliable in the sense that messages are not guaranteed to
57996 arrive at the loghost, nor is the ordering of messages necessarily maintained.
57997 It has also been reported that on large log files (tens of megabytes) you may
57998 need to tweak syslog to prevent it syncing the file with each write – on
57999 Linux this has been seen to make syslog take 90% plus of CPU time.
58002 The destination for Exim’s logs is configured by setting LOG_FILE_PATH in
58003 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
58004 configuration. This latter string is expanded, so it can contain, for example,
58005 references to the host name:
58007 <literallayout class="monospaced">
58008 log_file_path = /var/log/$primary_hostname/exim_%slog
58011 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
58012 rather than at run time, because then the setting is available right from the
58013 start of Exim’s execution. Otherwise, if there’s something it wants to log
58014 before it has read the configuration file (for example, an error in the
58015 configuration file) it will not use the path you want, and may not be able to
58019 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
58020 list, currently limited to at most two items. This is one option where the
58021 facility for changing a list separator may not be used. The list must always be
58022 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
58023 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
58024 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
58025 implying the use of a default path.
58028 When Exim encounters an empty item in the list, it searches the list defined by
58029 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
58030 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
58031 mean <quote>use the path specified at build time</quote>. It no such item exists, log
58032 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
58033 equivalent to the setting:
58035 <literallayout class="monospaced">
58036 log_file_path = $spool_directory/log/%slog
58039 If you do not specify anything at build time or run time, that is where the
58043 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
58044 use – see section <xref linkend="SECTdatlogfil"/> below.
58047 Here are some examples of possible settings:
58050 <literal>LOG_FILE_PATH=syslog </literal> syslog only
58051 <literal>LOG_FILE_PATH=:syslog </literal> syslog and default path
58052 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
58053 <literal>LOG_FILE_PATH=/usr/log/exim_%s </literal> specified path only
58056 If there are more than two paths in the list, the first is used and a panic
58060 <section id="SECID285">
58061 <title>Logging to local files that are periodically <quote>cycled</quote></title>
58063 <indexterm role="concept">
58064 <primary>log</primary>
58065 <secondary>cycling local files</secondary>
58067 <indexterm role="concept">
58068 <primary>cycling logs</primary>
58070 <indexterm role="concept">
58071 <primary><emphasis>exicyclog</emphasis></primary>
58073 <indexterm role="concept">
58074 <primary>log</primary>
58075 <secondary>local files; writing to</secondary>
58077 Some operating systems provide centralized and standardized methods for cycling
58078 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
58079 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
58080 main and reject logs each time it is called. The maximum number of old logs to
58081 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
58084 An Exim delivery process opens the main log when it first needs to write to it,
58085 and it keeps the file open in case subsequent entries are required – for
58086 example, if a number of different deliveries are being done for the same
58087 message. However, remote SMTP deliveries can take a long time, and this means
58088 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
58089 something similar is being used to rename log files on a regular basis. To
58090 ensure that a switch of log files is noticed as soon as possible, Exim calls
58091 <function>stat()</function> on the main log’s name before reusing an open file, and if the file
58092 does not exist, or its inode has changed, the old file is closed and Exim
58093 tries to open the main log from scratch. Thus, an old log file may remain open
58094 for quite some time, but no Exim processes should write to it once it has been
58098 <section id="SECTdatlogfil">
58099 <title>Datestamped log files</title>
58101 <indexterm role="concept">
58102 <primary>log</primary>
58103 <secondary>datestamped files</secondary>
58105 Instead of cycling the main and reject log files by renaming them
58106 periodically, some sites like to use files whose names contain a datestamp,
58107 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
58108 Exim has support for this way of working. It is enabled by setting the
58109 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
58110 datestamp is required. For example:
58112 <literallayout class="monospaced">
58113 log_file_path = /var/spool/exim/log/%slog-%D
58114 log_file_path = /var/log/exim-%s-%D.log
58115 log_file_path = /var/spool/exim/log/%D-%slog
58118 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
58119 examples of names generated by the above examples:
58121 <literallayout class="monospaced">
58122 /var/spool/exim/log/mainlog-20021225
58123 /var/log/exim-reject-20021225.log
58124 /var/spool/exim/log/20021225-mainlog
58127 When this form of log file is specified, Exim automatically switches to new
58128 files at midnight. It does not make any attempt to compress old logs; you
58129 will need to write your own script if you require this. You should not
58130 run <emphasis>exicyclog</emphasis> with this form of logging.
58133 The location of the panic log is also determined by <option>log_file_path</option>, but it
58134 is not datestamped, because rotation of the panic log does not make sense.
58135 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
58136 In addition, if it immediately follows a slash, a following non-alphanumeric
58137 character is removed; otherwise a preceding non-alphanumeric character is
58138 removed. Thus, the three examples above would give these panic log names:
58140 <literallayout class="monospaced">
58141 /var/spool/exim/log/paniclog
58142 /var/log/exim-panic.log
58143 /var/spool/exim/log/paniclog
58146 <section id="SECID249">
58147 <title>Logging to syslog</title>
58149 <indexterm role="concept">
58150 <primary>log</primary>
58151 <secondary>syslog; writing to</secondary>
58153 The use of syslog does not change what Exim logs or the format of its messages,
58154 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
58155 Exim’s log lines are omitted when these lines are sent to syslog. Apart from
58156 that, the same strings are written to syslog as to log files. The syslog
58157 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
58158 by default, but you can change these by setting the <option>syslog_facility</option> and
58159 <option>syslog_processname</option> options, respectively. If Exim was compiled with
58160 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
58161 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
58162 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
58163 the time and host name to each line.
58164 The three log streams are mapped onto syslog priorities as follows:
58169 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
58174 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
58179 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
58184 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
58185 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
58186 these are routed by syslog to the same place. You can suppress this duplication
58187 by setting <option>syslog_duplication</option> false.
58190 Exim’s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
58191 entries contain multiple lines when headers are included. To cope with both
58192 these cases, entries written to syslog are split into separate <function>syslog()</function>
58193 calls at each internal newline, and also after a maximum of
58194 870 data characters. (This allows for a total syslog line length of 1024, when
58195 additions such as timestamps are added.) If you are running a syslog
58196 replacement that can handle lines longer than the 1024 characters allowed by
58197 RFC 3164, you should set
58199 <literallayout class="monospaced">
58200 SYSLOG_LONG_LINES=yes
58203 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
58204 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
58207 To make it easy to re-assemble split lines later, each component of a split
58208 entry starts with a string of the form [<<emphasis>n</emphasis>>/<<emphasis>m</emphasis>>] or [<<emphasis>n</emphasis>>\<<emphasis>m</emphasis>>]
58209 where <<emphasis>n</emphasis>> is the component number and <<emphasis>m</emphasis>> is the total number of
58210 components in the entry. The / delimiter is used when the line was split
58211 because it was too long; if it was split because of an internal newline, the \
58212 delimiter is used. For example, supposing the length limit to be 50 instead of
58213 870, the following would be the result of a typical rejection message to
58214 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
58215 name, and pid as added by syslog:
58217 <literallayout class="monospaced">
58218 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
58219 [2/5] [127.0.0.1] (ph10): syntax error in 'From' header
58220 [3/5] when scanning for sender: missing or malformed lo
58221 [4/5] cal part in "<>" (envelope sender is <ph10@cam.exa
58225 The same error might cause the following lines to be written to <quote>rejectlog</quote>
58228 <literallayout class="monospaced">
58229 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
58230 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
58231 [3/18] er when scanning for sender: missing or malformed
58232 [4/18] local part in "<>" (envelope sender is <ph10@cam
58233 [5\18] .example>)
58234 [6\18] Recipients: ph10@some.domain.cam.example
58235 [7\18] P Received: from [127.0.0.1] (ident=ph10)
58236 [8\18] by xxxxx.cam.example with smtp (Exim 4.00)
58237 [9\18] id 16RdAL-0006pc-00
58238 [10/18] for ph10@cam.example; Mon, 16 Sep 2002 16:
58239 [11\18] 09:43 +0100
58240 [12\18] F From: <>
58241 [13\18] Subject: this is a test header
58242 [18\18] X-something: this is another header
58243 [15/18] I Message-Id: <E16RdAL-0006pc-00@xxxxx.cam.examp
58246 [18/18] Date: Mon, 16 Sep 2002 16:09:43 +0100
58249 Log lines that are neither too long nor contain newlines are written to syslog
58250 without modification.
58253 If only syslog is being used, the Exim monitor is unable to provide a log tail
58254 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
58255 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
58259 <section id="SECID250">
58260 <title>Log line flags</title>
58262 One line is written to the main log for each message received, and for each
58263 successful, unsuccessful, and delayed delivery. These lines can readily be
58264 picked out by the distinctive two-character flags that immediately follow the
58265 timestamp. The flags are:
58268 <literal><=</literal> message arrival
58269 <literal>=></literal> normal message delivery
58270 <literal>-></literal> additional address in same delivery
58271 <literal>*></literal> delivery suppressed by <option>-N</option>
58272 <literal>**</literal> delivery failed; address bounced
58273 <literal>==</literal> delivery deferred; temporary problem
58276 <section id="SECID251">
58277 <title>Logging message reception</title>
58279 <indexterm role="concept">
58280 <primary>log</primary>
58281 <secondary>reception line</secondary>
58283 The format of the single-line entry in the main log that is written for every
58284 message received is shown in the basic example below, which is split over
58285 several lines in order to fit it on the page:
58287 <literallayout class="monospaced">
58288 2002-10-31 08:57:53 16ZCW1-0005MB-00 <= kryten@dwarf.fict.example
58289 H=mailer.fict.example [192.168.123.123] U=exim
58290 P=smtp S=5678 id=<incoming message id>
58293 The address immediately following <quote><=</quote> is the envelope sender address. A
58294 bounce message is shown with the sender address <quote><></quote>, and if it is locally
58295 generated, this is followed by an item of the form
58297 <literallayout class="monospaced">
58298 R=<message id>
58301 which is a reference to the message that caused the bounce to be sent.
58304 <indexterm role="concept">
58305 <primary>HELO</primary>
58307 <indexterm role="concept">
58308 <primary>EHLO</primary>
58310 For messages from other hosts, the H and U fields identify the remote host and
58311 record the RFC 1413 identity of the user that sent the message, if one was
58312 received. The number given in square brackets is the IP address of the sending
58313 host. If there is a single, unparenthesized host name in the H field, as
58314 above, it has been verified to correspond to the IP address (see the
58315 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
58316 by the remote host in the SMTP HELO or EHLO command, and has not been
58317 verified. If verification yields a different name to that given for HELO or
58318 EHLO, the verified name appears first, followed by the HELO or EHLO
58319 name in parentheses.
58322 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
58323 without brackets, in the HELO or EHLO command, leading to entries in
58324 the log containing text like these examples:
58326 <literallayout class="monospaced">
58327 H=(10.21.32.43) [192.168.8.34]
58328 H=([10.21.32.43]) [192.168.8.34]
58331 This can be confusing. Only the final address in square brackets can be relied
58335 For locally generated messages (that is, messages not received over TCP/IP),
58336 the H field is omitted, and the U field contains the login name of the caller
58340 <indexterm role="concept">
58341 <primary>authentication</primary>
58342 <secondary>logging</secondary>
58344 <indexterm role="concept">
58345 <primary>AUTH</primary>
58346 <secondary>logging</secondary>
58348 For all messages, the P field specifies the protocol used to receive the
58349 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
58350 of incoming SMTP messages, the value indicates whether or not any SMTP
58351 extensions (ESMTP), encryption, or authentication were used. If the SMTP
58352 session was encrypted, there is an additional X field that records the cipher
58353 suite that was used.
58356 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
58357 hosts that have authenticated themselves using the SMTP AUTH command. The first
58358 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
58359 there is an additional item A= followed by the name of the authenticator that
58360 was used. If an authenticated identification was set up by the authenticator’s
58361 <option>server_set_id</option> option, this is logged too, separated by a colon from the
58362 authenticator name.
58365 <indexterm role="concept">
58366 <primary>size</primary>
58367 <secondary>of message</secondary>
58369 The id field records the existing message id, if present. The size of the
58370 received message is given by the S field. When the message is delivered,
58371 headers may be removed or added, so that the size of delivered copies of the
58372 message may not correspond with this value (and indeed may be different to each
58376 The <option>log_selector</option> option can be used to request the logging of additional
58377 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
58380 <section id="SECID252">
58381 <title>Logging deliveries</title>
58383 <indexterm role="concept">
58384 <primary>log</primary>
58385 <secondary>delivery line</secondary>
58387 The format of the single-line entry in the main log that is written for every
58388 delivery is shown in one of the examples below, for local and remote
58389 deliveries, respectively. Each example has been split into two lines in order
58390 to fit it on the page:
58392 <literallayout class="monospaced">
58393 2002-10-31 08:59:13 16ZCW1-0005MB-00 => marv
58394 <marv@hitch.fict.example> R=localuser T=local_delivery
58395 2002-10-31 09:00:10 16ZCW1-0005MB-00 =>
58396 monk@holistic.fict.example R=dnslookup T=remote_smtp
58397 H=holistic.fict.example [192.168.234.234]
58400 For ordinary local deliveries, the original address is given in angle brackets
58401 after the final delivery address, which might be a pipe or a file. If
58402 intermediate address(es) exist between the original and the final address, the
58403 last of these is given in parentheses after the final address. The R and T
58404 fields record the router and transport that were used to process the address.
58407 If a shadow transport was run after a successful local delivery, the log line
58408 for the successful delivery has an item added on the end, of the form
58411 <literal>ST=<</literal><emphasis>shadow transport name</emphasis><literal>></literal>
58414 If the shadow transport did not succeed, the error message is put in
58415 parentheses afterwards.
58418 <indexterm role="concept">
58419 <primary>asterisk</primary>
58420 <secondary>after IP address</secondary>
58422 When more than one address is included in a single delivery (for example, two
58423 SMTP RCPT commands in one transaction) the second and subsequent addresses are
58424 flagged with <literal>-></literal> instead of <literal>=></literal>. When two or more messages are delivered
58425 down a single SMTP connection, an asterisk follows the IP address in the log
58426 lines for the second and subsequent messages.
58429 The generation of a reply message by a filter file gets logged as a
58430 <quote>delivery</quote> to the addressee, preceded by <quote>></quote>.
58433 The <option>log_selector</option> option can be used to request the logging of additional
58434 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
58437 <section id="SECID253">
58438 <title>Discarded deliveries</title>
58440 <indexterm role="concept">
58441 <primary>discarded messages</primary>
58443 <indexterm role="concept">
58444 <primary>message</primary>
58445 <secondary>discarded</secondary>
58447 <indexterm role="concept">
58448 <primary>delivery</primary>
58449 <secondary>discarded; logging</secondary>
58451 When a message is discarded as a result of the command <quote>seen finish</quote> being
58452 obeyed in a filter file which generates no deliveries, a log entry of the form
58454 <literallayout class="monospaced">
58455 2002-12-10 00:50:49 16auJc-0001UB-00 => discarded
58456 <low.club@bridge.example> R=userforward
58459 is written, to record why no deliveries are logged. When a message is discarded
58460 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
58462 <literallayout class="monospaced">
58463 1999-03-02 09:44:33 10HmaX-0005vi-00 => :blackhole:
58464 <hole@nowhere.example> R=blackhole_router
58467 <section id="SECID254">
58468 <title>Deferred deliveries</title>
58470 When a delivery is deferred, a line of the following form is logged:
58472 <literallayout class="monospaced">
58473 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
58474 R=dnslookup T=smtp defer (146): Connection refused
58477 In the case of remote deliveries, the error is the one that was given for the
58478 last IP address that was tried. Details of individual SMTP failures are also
58479 written to the log, so the above line would be preceded by something like
58481 <literallayout class="monospaced">
58482 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
58483 mail1.endrest.example [192.168.239.239]: Connection refused
58486 When a deferred address is skipped because its retry time has not been reached,
58487 a message is written to the log, but this can be suppressed by setting an
58488 appropriate value in <option>log_selector</option>.
58491 <section id="SECID255">
58492 <title>Delivery failures</title>
58494 <indexterm role="concept">
58495 <primary>delivery</primary>
58496 <secondary>failure; logging</secondary>
58498 If a delivery fails because an address cannot be routed, a line of the
58499 following form is logged:
58501 <literallayout class="monospaced">
58502 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
58503 <jim@trek99.example>: unknown mail domain
58506 If a delivery fails at transport time, the router and transport are shown, and
58507 the response from the remote host is included, as in this example:
58509 <literallayout class="monospaced">
58510 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
58511 R=dnslookup T=remote_smtp: SMTP error from remote mailer
58512 after pipelined RCPT TO:<ace400@pb.example>: host
58513 pbmail3.py.example [192.168.63.111]: 553 5.3.0
58514 <ace400@pb.example>...Addressee unknown
58517 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
58518 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
58519 disabling PIPELINING. The log lines for all forms of delivery failure are
58520 flagged with <literal>**</literal>.
58523 <section id="SECID256">
58524 <title>Fake deliveries</title>
58526 <indexterm role="concept">
58527 <primary>delivery</primary>
58528 <secondary>fake; logging</secondary>
58530 If a delivery does not actually take place because the <option>-N</option> option has been
58531 used to suppress it, a normal delivery line is written to the log, except that
58532 <quote>=></quote> is replaced by <quote>*></quote>.
58535 <section id="SECID257">
58536 <title>Completion</title>
58540 <literallayout class="monospaced">
58541 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
58544 is written to the main log when a message is about to be removed from the spool
58545 at the end of its processing.
58548 <section id="SECID258">
58549 <title>Summary of Fields in Log Lines</title>
58551 <indexterm role="concept">
58552 <primary>log</primary>
58553 <secondary>summary of fields</secondary>
58555 A summary of the field identifiers that are used in log lines is shown in
58556 the following table:
58559 <literal>A </literal> authenticator name (and optional id)
58560 <literal>C </literal> SMTP confirmation on delivery
58561 <literal> </literal> command list for <quote>no mail in SMTP session</quote>
58562 <literal>CV </literal> certificate verification status
58563 <literal>D </literal> duration of <quote>no mail in SMTP session</quote>
58564 <literal>DN </literal> distinguished name from peer certificate
58565 <literal>DT </literal> on <literal>=></literal> lines: time taken for a delivery
58566 <literal>F </literal> sender address (on delivery lines)
58567 <literal>H </literal> host name and IP address
58568 <literal>I </literal> local interface used
58569 <literal>id </literal> message id for incoming message
58570 <literal>P </literal> on <literal><=</literal> lines: protocol used
58571 <literal> </literal> on <literal>=></literal> and <literal>**</literal> lines: return path
58572 <literal>QT </literal> on <literal>=></literal> lines: time spent on queue so far
58573 <literal> </literal> on <quote>Completed</quote> lines: time spent on queue
58574 <literal>R </literal> on <literal><=</literal> lines: reference for local bounce
58575 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: router name
58576 <literal>S </literal> size of message
58577 <literal>ST </literal> shadow transport name
58578 <literal>T </literal> on <literal><=</literal> lines: message subject (topic)
58579 <literal> </literal> on <literal>=></literal> <literal>**</literal> and <literal>==</literal> lines: transport name
58580 <literal>U </literal> local user or RFC 1413 identity
58581 <literal>X </literal> TLS cipher suite
58584 <section id="SECID259">
58585 <title>Other log entries</title>
58587 Various other types of log entry are written from time to time. Most should be
58588 self-explanatory. Among the more common are:
58593 <indexterm role="concept">
58594 <primary>retry</primary>
58595 <secondary>time not reached</secondary>
58597 <emphasis>retry time not reached</emphasis> An address previously suffered a temporary error
58598 during routing or local delivery, and the time to retry has not yet arrived.
58599 This message is not written to an individual message log file unless it happens
58600 during the first delivery attempt.
58605 <emphasis>retry time not reached for any host</emphasis> An address previously suffered
58606 temporary errors during remote delivery, and the retry time has not yet arrived
58607 for any of the hosts to which it is routed.
58612 <indexterm role="concept">
58613 <primary>spool directory</primary>
58614 <secondary>file locked</secondary>
58616 <emphasis>spool file locked</emphasis> An attempt to deliver a message cannot proceed because
58617 some other Exim process is already working on the message. This can be quite
58618 common if queue running processes are started at frequent intervals. The
58619 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
58625 <indexterm role="concept">
58626 <primary>error</primary>
58627 <secondary>ignored</secondary>
58629 <emphasis>error ignored</emphasis> There are several circumstances that give rise to this
58632 <orderedlist numeration="arabic">
58635 Exim failed to deliver a bounce message whose age was greater than
58636 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
58641 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
58642 failed. The delivery was discarded.
58647 A delivery set up by a router configured with
58649 <literallayout class="monospaced">
58650 errors_to = <>
58653 failed. The delivery was discarded.
58660 <section id="SECTlogselector">
58661 <title>Reducing or increasing what is logged</title>
58663 <indexterm role="concept">
58664 <primary>log</primary>
58665 <secondary>selectors</secondary>
58667 By setting the <option>log_selector</option> global option, you can disable some of Exim’s
58668 default logging, or you can request additional logging. The value of
58669 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
58672 <literallayout class="monospaced">
58673 log_selector = +arguments -retry_defer
58676 The list of optional log items is in the following table, with the default
58677 selection marked by asterisks:
58680 <literal>*acl_warn_skipped </literal> skipped <option>warn</option> statement in ACL
58681 <literal> address_rewrite </literal> address rewriting
58682 <literal> all_parents </literal> all parents in => lines
58683 <literal> arguments </literal> command line arguments
58684 <literal>*connection_reject </literal> connection rejections
58685 <literal>*delay_delivery </literal> immediate delivery delayed
58686 <literal> deliver_time </literal> time taken to perform delivery
58687 <literal> delivery_size </literal> add <literal>S=</literal><emphasis>nnn</emphasis> to => lines
58688 <literal>*dnslist_defer </literal> defers of DNS list (aka RBL) lookups
58689 <literal>*etrn </literal> ETRN commands
58690 <literal>*host_lookup_failed </literal> as it says
58691 <literal> ident_timeout </literal> timeout for ident connection
58692 <literal> incoming_interface </literal> incoming interface on <= lines
58693 <literal> incoming_port </literal> incoming port on <= lines
58694 <literal>*lost_incoming_connection </literal> as it says (includes timeouts)
58695 <literal> outgoing_port </literal> add remote port to => lines
58696 <literal>*queue_run </literal> start and end queue runs
58697 <literal> queue_time </literal> time on queue for one recipient
58698 <literal> queue_time_overall </literal> time on queue for whole message
58699 <literal> pid </literal> Exim process id
58700 <literal> received_recipients </literal> recipients on <= lines
58701 <literal> received_sender </literal> sender on <= lines
58702 <literal>*rejected_header </literal> header contents on reject log
58703 <literal>*retry_defer </literal> <quote>retry time not reached</quote>
58704 <literal> return_path_on_delivery </literal> put return path on => and ** lines
58705 <literal> sender_on_delivery </literal> add sender to => lines
58706 <literal>*sender_verify_fail </literal> sender verification failures
58707 <literal>*size_reject </literal> rejection because too big
58708 <literal>*skip_delivery </literal> delivery skipped in a queue run
58709 <literal> smtp_confirmation </literal> SMTP confirmation on => lines
58710 <literal> smtp_connection </literal> SMTP connections
58711 <literal> smtp_incomplete_transaction</literal> incomplete SMTP transactions
58712 <literal> smtp_no_mail </literal> session with no MAIL commands
58713 <literal> smtp_protocol_error </literal> SMTP protocol errors
58714 <literal> smtp_syntax_error </literal> SMTP syntax errors
58715 <literal> subject </literal> contents of <emphasis>Subject:</emphasis> on <= lines
58716 <literal> tls_certificate_verified </literal> certificate verification status
58717 <literal>*tls_cipher </literal> TLS cipher suite on <= and => lines
58718 <literal> tls_peerdn </literal> TLS peer DN on <= and => lines
58719 <literal> unknown_in_list </literal> DNS lookup failed in list match
58721 <literal> all </literal> all of the above
58724 More details on each of these items follows:
58729 <indexterm role="concept">
58730 <primary><option>warn</option> ACL verb</primary>
58731 <secondary>log when skipping</secondary>
58733 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
58734 its conditions cannot be evaluated, a log line to this effect is written if
58735 this log selector is set.
58740 <indexterm role="concept">
58741 <primary>log</primary>
58742 <secondary>rewriting</secondary>
58744 <indexterm role="concept">
58745 <primary>rewriting</primary>
58746 <secondary>logging</secondary>
58748 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
58749 rewrites, but not to rewrites in filters run as an unprivileged user (because
58750 such users cannot access the log).
58755 <indexterm role="concept">
58756 <primary>log</primary>
58757 <secondary>full parentage</secondary>
58759 <option>all_parents</option>: Normally only the original and final addresses are logged on
58760 delivery lines; with this selector, intermediate parents are given in
58761 parentheses between them.
58766 <indexterm role="concept">
58767 <primary>log</primary>
58768 <secondary>Exim arguments</secondary>
58770 <indexterm role="concept">
58771 <primary>Exim arguments, logging</primary>
58773 <option>arguments</option>: This causes Exim to write the arguments with which it was called
58774 to the main log, preceded by the current working directory. This is a debugging
58775 feature, added to make it easier to find out how certain MUAs call
58776 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
58777 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
58778 that are empty or that contain white space are quoted. Non-printing characters
58779 are shown as escape sequences. This facility cannot log unrecognized arguments,
58780 because the arguments are checked before the configuration file is read. The
58781 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
58782 between the caller and Exim.
58787 <indexterm role="concept">
58788 <primary>log</primary>
58789 <secondary>connection rejections</secondary>
58791 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
58792 connection is rejected, for whatever reason.
58797 <indexterm role="concept">
58798 <primary>log</primary>
58799 <secondary>delayed delivery</secondary>
58801 <indexterm role="concept">
58802 <primary>delayed delivery, logging</primary>
58804 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
58805 started for an incoming message because the load is too high or too many
58806 messages were received on one connection. Logging does not occur if no delivery
58807 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
58812 <indexterm role="concept">
58813 <primary>log</primary>
58814 <secondary>delivery duration</secondary>
58816 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
58817 perform the actual delivery is logged as DT=<<emphasis>time</emphasis>>, for example, <literal>DT=1s</literal>.
58822 <indexterm role="concept">
58823 <primary>log</primary>
58824 <secondary>message size on delivery</secondary>
58826 <indexterm role="concept">
58827 <primary>size</primary>
58828 <secondary>of message</secondary>
58830 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
58831 the <quote>=></quote> line, tagged with S=.
58836 <indexterm role="concept">
58837 <primary>log</primary>
58838 <secondary>dnslist defer</secondary>
58840 <indexterm role="concept">
58841 <primary>DNS list</primary>
58842 <secondary>logging defer</secondary>
58844 <indexterm role="concept">
58845 <primary>black list (DNS)</primary>
58847 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
58848 DNS black list suffers a temporary error.
58853 <indexterm role="concept">
58854 <primary>log</primary>
58855 <secondary>ETRN commands</secondary>
58857 <indexterm role="concept">
58858 <primary>ETRN</primary>
58859 <secondary>logging</secondary>
58861 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
58862 is run to determine whether or not it is actually accepted. An invalid ETRN
58863 command, or one received within a message transaction is not logged by this
58864 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
58869 <indexterm role="concept">
58870 <primary>log</primary>
58871 <secondary>host lookup failure</secondary>
58873 <option>host_lookup_failed</option>: When a lookup of a host’s IP addresses fails to find
58874 any addresses, or when a lookup of an IP address fails to find a host name, a
58875 log line is written. This logging does not apply to direct DNS lookups when
58876 routing email addresses, but it does apply to <quote>byname</quote> lookups.
58881 <indexterm role="concept">
58882 <primary>log</primary>
58883 <secondary>ident timeout</secondary>
58885 <indexterm role="concept">
58886 <primary>RFC 1413</primary>
58887 <secondary>logging timeout</secondary>
58889 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
58890 client’s ident port times out.
58895 <indexterm role="concept">
58896 <primary>log</primary>
58897 <secondary>incoming interface</secondary>
58899 <indexterm role="concept">
58900 <primary>interface</primary>
58901 <secondary>logging</secondary>
58903 <option>incoming_interface</option>: The interface on which a message was received is added
58904 to the <quote><=</quote> line as an IP address in square brackets, tagged by I= and
58905 followed by a colon and the port number. The local interface and port are also
58906 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
58912 <indexterm role="concept">
58913 <primary>log</primary>
58914 <secondary>incoming remote port</secondary>
58916 <indexterm role="concept">
58917 <primary>port</primary>
58918 <secondary>logging remote</secondary>
58920 <indexterm role="concept">
58921 <primary>TCP/IP</primary>
58922 <secondary>logging incoming remote port</secondary>
58924 <indexterm role="variable">
58925 <primary><varname>$sender_fullhost</varname></primary>
58927 <indexterm role="variable">
58928 <primary><varname>$sender_rcvhost</varname></primary>
58930 <option>incoming_port</option>: The remote port number from which a message was received is
58931 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
58932 in square brackets, and separated from it by a colon. This is implemented by
58933 changing the value that is put in the <varname>$sender_fullhost</varname> and
58934 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
58935 important with the widening use of NAT (see RFC 2505).
58940 <indexterm role="concept">
58941 <primary>log</primary>
58942 <secondary>dropped connection</secondary>
58944 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
58945 connection is unexpectedly dropped.
58950 <indexterm role="concept">
58951 <primary>log</primary>
58952 <secondary>outgoing remote port</secondary>
58954 <indexterm role="concept">
58955 <primary>port</primary>
58956 <secondary>logging outgoint remote</secondary>
58958 <indexterm role="concept">
58959 <primary>TCP/IP</primary>
58960 <secondary>logging ougtoing remote port</secondary>
58962 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
58963 containing => tags) following the IP address. This option is not included in
58964 the default setting, because for most ordinary configurations, the remote port
58965 number is always 25 (the SMTP port).
58970 <indexterm role="concept">
58971 <primary>log</primary>
58972 <secondary>process ids in</secondary>
58974 <indexterm role="concept">
58975 <primary>pid (process id)</primary>
58976 <secondary>in log lines</secondary>
58978 <option>pid</option>: The current process id is added to every log line, in square brackets,
58979 immediately after the time and date.
58984 <indexterm role="concept">
58985 <primary>log</primary>
58986 <secondary>queue run</secondary>
58988 <indexterm role="concept">
58989 <primary>queue runner</primary>
58990 <secondary>logging</secondary>
58992 <option>queue_run</option>: The start and end of every queue run are logged.
58997 <indexterm role="concept">
58998 <primary>log</primary>
58999 <secondary>queue time</secondary>
59001 <option>queue_time</option>: The amount of time the message has been in the queue on the
59002 local host is logged as QT=<<emphasis>time</emphasis>> on delivery (<literal>=></literal>) lines, for example,
59003 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
59004 includes reception time as well as the delivery time for the current address.
59005 This means that it may be longer than the difference between the arrival and
59006 delivery log line times, because the arrival log line is not written until the
59007 message has been successfully received.
59012 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
59013 the local host is logged as QT=<<emphasis>time</emphasis>> on <quote>Completed</quote> lines, for
59014 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
59015 message, so it includes reception time as well as the total delivery time.
59020 <indexterm role="concept">
59021 <primary>log</primary>
59022 <secondary>recipients</secondary>
59024 <option>received_recipients</option>: The recipients of a message are listed in the main log
59025 as soon as the message is received. The list appears at the end of the log line
59026 that is written when a message is received, preceded by the word <quote>for</quote>. The
59027 addresses are listed after they have been qualified, but before any rewriting
59029 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
59035 <indexterm role="concept">
59036 <primary>log</primary>
59037 <secondary>sender reception</secondary>
59039 <option>received_sender</option>: The unrewritten original sender of a message is added to
59040 the end of the log line that records the message’s arrival, after the word
59041 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
59046 <indexterm role="concept">
59047 <primary>log</primary>
59048 <secondary>header lines for rejection</secondary>
59050 <option>rejected_header</option>: If a message’s header has been received at the time a
59051 rejection is written to the reject log, the complete header is added to the
59052 log. Header logging can be turned off individually for messages that are
59053 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
59058 <indexterm role="concept">
59059 <primary>log</primary>
59060 <secondary>retry defer</secondary>
59062 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
59063 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
59064 message is always omitted from individual message logs after the first delivery
59070 <indexterm role="concept">
59071 <primary>log</primary>
59072 <secondary>return path</secondary>
59074 <option>return_path_on_delivery</option>: The return path that is being transmitted with
59075 the message is included in delivery and bounce lines, using the tag P=.
59076 This is omitted if no delivery actually happens, for example, if routing fails,
59077 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
59082 <indexterm role="concept">
59083 <primary>log</primary>
59084 <secondary>sender on delivery</secondary>
59086 <option>sender_on_delivery</option>: The message’s sender address is added to every delivery
59087 and bounce line, tagged by F= (for <quote>from</quote>).
59088 This is the original sender that was received with the message; it is not
59089 necessarily the same as the outgoing return path.
59094 <indexterm role="concept">
59095 <primary>log</primary>
59096 <secondary>sender verify failure</secondary>
59098 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
59099 gives details of a sender verification failure is not written. Log lines for
59100 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
59106 <indexterm role="concept">
59107 <primary>log</primary>
59108 <secondary>size rejection</secondary>
59110 <option>size_reject</option>: A log line is written whenever a message is rejected because
59116 <indexterm role="concept">
59117 <primary>log</primary>
59118 <secondary>frozen messages; skipped</secondary>
59120 <indexterm role="concept">
59121 <primary>frozen messages</primary>
59122 <secondary>logging skipping</secondary>
59124 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
59125 queue run because it is frozen or because another process is already delivering
59127 <indexterm role="concept">
59128 <primary><quote>spool file is locked</quote></primary>
59130 The message that is written is <quote>spool file is locked</quote>.
59135 <indexterm role="concept">
59136 <primary>log</primary>
59137 <secondary>smtp confirmation</secondary>
59139 <indexterm role="concept">
59140 <primary>SMTP</primary>
59141 <secondary>logging confirmation</secondary>
59143 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
59144 outgoing messages is added to delivery log lines in the form <literal>C=</literal><<emphasis>text</emphasis>>.
59145 A number of MTAs (including Exim) return an identifying string in this
59151 <indexterm role="concept">
59152 <primary>log</primary>
59153 <secondary>SMTP connections</secondary>
59155 <indexterm role="concept">
59156 <primary>SMTP</primary>
59157 <secondary>logging connections</secondary>
59159 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
59160 established or closed, unless the connection is from a host that matches
59161 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
59162 only when the closure is unexpected.) This applies to connections from local
59163 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
59164 dropped in the middle of a message, a log line is always written, whether or
59165 not this selector is set, but otherwise nothing is written at the start and end
59166 of connections unless this selector is enabled.
59169 For TCP/IP connections to an Exim daemon, the current number of connections is
59170 included in the log message for each new connection, but note that the count is
59171 reset if the daemon is restarted.
59172 Also, because connections are closed (and the closure is logged) in
59173 subprocesses, the count may not include connections that have been closed but
59174 whose termination the daemon has not yet noticed. Thus, while it is possible to
59175 match up the opening and closing of connections in the log, the value of the
59176 logged counts may not be entirely accurate.
59181 <indexterm role="concept">
59182 <primary>log</primary>
59183 <secondary>SMTP transaction; incomplete</secondary>
59185 <indexterm role="concept">
59186 <primary>SMTP</primary>
59187 <secondary>logging incomplete transactions</secondary>
59189 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
59190 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
59191 and the message sender plus any accepted recipients are included in the log
59192 line. This can provide evidence of dictionary attacks.
59197 <indexterm role="concept">
59198 <primary>log</primary>
59199 <secondary>non-MAIL SMTP sessions</secondary>
59201 <indexterm role="concept">
59202 <primary>MAIL</primary>
59203 <secondary>logging session without</secondary>
59205 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
59206 connection terminates without having issued a MAIL command. This includes both
59207 the case when the connection is dropped, and the case when QUIT is used. It
59208 does not include cases where the connection is rejected right at the start (by
59209 an ACL, or because there are too many connections, or whatever). These cases
59210 already have their own log lines.
59213 The log line that is written contains the identity of the client in the usual
59214 way, followed by D= and a time, which records the duration of the connection.
59215 If the connection was authenticated, this fact is logged exactly as it is for
59216 an incoming message, with an A= item. If the connection was encrypted, CV=,
59217 DN=, and X= items may appear as they do for an incoming message, controlled by
59218 the same logging options.
59221 Finally, if any SMTP commands were issued during the connection, a C= item
59222 is added to the line, listing the commands that were used. For example,
59224 <literallayout class="monospaced">
59228 shows that the client issued QUIT straight after EHLO. If there were fewer
59229 than 20 commands, they are all listed. If there were more than 20 commands,
59230 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
59231 setting of 10 for <option>smtp_accep_max_nonmail</option>, the connection will in any case
59232 have been aborted before 20 non-mail commands are processed.
59237 <indexterm role="concept">
59238 <primary>log</primary>
59239 <secondary>SMTP protocol error</secondary>
59241 <indexterm role="concept">
59242 <primary>SMTP</primary>
59243 <secondary>logging protocol error</secondary>
59245 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
59246 encountered. Exim does not have perfect detection of all protocol errors
59247 because of transmission delays and the use of pipelining. If PIPELINING has
59248 been advertised to a client, an Exim server assumes that the client will use
59249 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
59250 received after rejecting MAIL) as protocol errors.
59255 <indexterm role="concept">
59256 <primary>SMTP</primary>
59257 <secondary>logging syntax errors</secondary>
59259 <indexterm role="concept">
59260 <primary>SMTP</primary>
59261 <secondary>syntax errors; logging</secondary>
59263 <indexterm role="concept">
59264 <primary>SMTP</primary>
59265 <secondary>unknown command; logging</secondary>
59267 <indexterm role="concept">
59268 <primary>log</primary>
59269 <secondary>unknown SMTP command</secondary>
59271 <indexterm role="concept">
59272 <primary>log</primary>
59273 <secondary>SMTP syntax error</secondary>
59275 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
59276 encountered. An unrecognized command is treated as a syntax error. For an
59277 external connection, the host identity is given; for an internal connection
59278 using <option>-bs</option> the sender identification (normally the calling user) is given.
59283 <indexterm role="concept">
59284 <primary>log</primary>
59285 <secondary>subject</secondary>
59287 <indexterm role="concept">
59288 <primary>subject, logging</primary>
59290 <option>subject</option>: The subject of the message is added to the arrival log line,
59291 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
59292 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
59293 specifies whether characters with values greater than 127 should be logged
59294 unchanged, or whether they should be rendered as escape sequences.
59299 <indexterm role="concept">
59300 <primary>log</primary>
59301 <secondary>certificate verification</secondary>
59303 <option>tls_certificate_verified</option>: An extra item is added to <= and => log lines
59304 when TLS is in use. The item is <literal>CV=yes</literal> if the peer’s certificate was
59305 verified, and <literal>CV=no</literal> if not.
59310 <indexterm role="concept">
59311 <primary>log</primary>
59312 <secondary>TLS cipher</secondary>
59314 <indexterm role="concept">
59315 <primary>TLS</primary>
59316 <secondary>logging cipher</secondary>
59318 <option>tls_cipher</option>: When a message is sent or received over an encrypted
59319 connection, the cipher suite used is added to the log line, preceded by X=.
59324 <indexterm role="concept">
59325 <primary>log</primary>
59326 <secondary>TLS peer DN</secondary>
59328 <indexterm role="concept">
59329 <primary>TLS</primary>
59330 <secondary>logging peer DN</secondary>
59332 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
59333 connection, and a certificate is supplied by the remote host, the peer DN is
59334 added to the log line, preceded by DN=.
59339 <indexterm role="concept">
59340 <primary>log</primary>
59341 <secondary>DNS failure in list</secondary>
59343 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
59344 result of a list match is failure because a DNS lookup failed.
59349 <section id="SECID260">
59350 <title>Message log</title>
59352 <indexterm role="concept">
59353 <primary>message</primary>
59354 <secondary>log file for</secondary>
59356 <indexterm role="concept">
59357 <primary>log</primary>
59358 <secondary>message log; description of</secondary>
59360 <indexterm role="concept">
59361 <primary><filename>msglog</filename> directory</primary>
59363 <indexterm role="option">
59364 <primary><option>preserve_message_logs</option></primary>
59366 In addition to the general log files, Exim writes a log file for each message
59367 that it handles. The names of these per-message logs are the message ids, and
59368 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
59369 message log contains copies of the log lines that apply to the message. This
59370 makes it easier to inspect the status of an individual message without having
59371 to search the main log. A message log is deleted when processing of the message
59372 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
59373 only with great care because they can fill up your disk very quickly.
59376 On a heavily loaded system, it may be desirable to disable the use of
59377 per-message logs, in order to reduce disk I/O. This can be done by setting the
59378 <option>message_logs</option> option false.
59379 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
59384 <chapter id="CHAPutils">
59385 <title>Exim utilities</title>
59387 <indexterm role="concept" id="IIDutils" class="startofrange">
59388 <primary>utilities</primary>
59390 A number of utility scripts and programs are supplied with Exim and are
59391 described in this chapter. There is also the Exim Monitor, which is covered in
59392 the next chapter. The utilities described here are:
59394 <informaltable frame="none">
59395 <tgroup cols="3" colsep="0" rowsep="0">
59396 <colspec colwidth="7*" align="left"/>
59397 <colspec colwidth="15*" align="left"/>
59398 <colspec colwidth="40*" align="left"/>
59401 <entry> <xref linkend="SECTfinoutwha"/></entry>
59402 <entry><emphasis>exiwhat</emphasis></entry>
59403 <entry>list what Exim processes are doing</entry>
59406 <entry> <xref linkend="SECTgreptheque"/></entry>
59407 <entry><emphasis>exiqgrep</emphasis></entry>
59408 <entry>grep the queue</entry>
59411 <entry> <xref linkend="SECTsumtheque"/></entry>
59412 <entry><emphasis>exiqsumm</emphasis></entry>
59413 <entry>summarize the queue</entry>
59416 <entry> <xref linkend="SECTextspeinf"/></entry>
59417 <entry><emphasis>exigrep</emphasis></entry>
59418 <entry>search the main log</entry>
59421 <entry> <xref linkend="SECTexipick"/></entry>
59422 <entry><emphasis>exipick</emphasis></entry>
59423 <entry>select messages on various criteria</entry>
59426 <entry> <xref linkend="SECTcyclogfil"/></entry>
59427 <entry><emphasis>exicyclog</emphasis></entry>
59428 <entry>cycle (rotate) log files</entry>
59431 <entry> <xref linkend="SECTmailstat"/></entry>
59432 <entry><emphasis>eximstats</emphasis></entry>
59433 <entry>extract statistics from the log</entry>
59436 <entry> <xref linkend="SECTcheckaccess"/></entry>
59437 <entry><emphasis>exim_checkaccess</emphasis></entry>
59438 <entry>check address acceptance from given IP</entry>
59441 <entry> <xref linkend="SECTdbmbuild"/></entry>
59442 <entry><emphasis>exim_dbmbuild</emphasis></entry>
59443 <entry>build a DBM file</entry>
59446 <entry> <xref linkend="SECTfinindret"/></entry>
59447 <entry><emphasis>exinext</emphasis></entry>
59448 <entry>extract retry information</entry>
59451 <entry> <xref linkend="SECThindatmai"/></entry>
59452 <entry><emphasis>exim_dumpdb</emphasis></entry>
59453 <entry>dump a hints database</entry>
59456 <entry> <xref linkend="SECThindatmai"/></entry>
59457 <entry><emphasis>exim_tidydb</emphasis></entry>
59458 <entry>clean up a hints database</entry>
59461 <entry> <xref linkend="SECThindatmai"/></entry>
59462 <entry><emphasis>exim_fixdb</emphasis></entry>
59463 <entry>patch a hints database</entry>
59466 <entry> <xref linkend="SECTmailboxmaint"/></entry>
59467 <entry><emphasis>exim_lock</emphasis></entry>
59468 <entry>lock a mailbox file</entry>
59474 Another utility that might be of use to sites with many MTAs is Tom Kistner’s
59475 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
59476 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
59478 <section id="SECTfinoutwha">
59479 <title>Finding out what Exim processes are doing (exiwhat)</title>
59481 <indexterm role="concept">
59482 <primary><emphasis>exiwhat</emphasis></primary>
59484 <indexterm role="concept">
59485 <primary>process, querying</primary>
59487 <indexterm role="concept">
59488 <primary>SIGUSR1</primary>
59490 On operating systems that can restart a system call after receiving a signal
59491 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
59492 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
59493 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
59494 processes it can find, having first emptied the file. It then waits for one
59495 second to allow the Exim processes to react before displaying the results. In
59496 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
59497 send the signal to the Exim processes, so it is normally run as root.
59500 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
59501 use by system administrators. It is not sensible, for example, to set up a
59502 script that sends SIGUSR1 signals to Exim processes at short intervals.
59505 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
59506 varies in different operating systems. Not only are different options used,
59507 but the format of the output is different. For this reason, there are some
59508 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
59509 it doesn’t seem to be working for you, check the following compile-time
59513 <literal>EXIWHAT_PS_CMD </literal> the command for running <emphasis>ps</emphasis>
59514 <literal>EXIWHAT_PS_ARG </literal> the argument for <emphasis>ps</emphasis>
59515 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
59516 <literal>EXIWHAT_KILL_ARG </literal> the argument for the <emphasis>kill</emphasis> command
59519 An example of typical output from <emphasis>exiwhat</emphasis> is
59521 <literallayout class="monospaced">
59522 164 daemon: -q1h, listening on port 25
59523 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
59524 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
59525 [10.19.42.42] (editor@ref.example)
59526 10592 handling incoming call from [192.168.243.242]
59527 10628 accepting a local non-SMTP message
59530 The first number in the output line is the process number. The third line has
59531 been split here, in order to fit it on the page.
59534 <section id="SECTgreptheque">
59535 <title>Selective queue listing (exiqgrep)</title>
59537 <indexterm role="concept">
59538 <primary><emphasis>exiqgrep</emphasis></primary>
59540 <indexterm role="concept">
59541 <primary>queue</primary>
59542 <secondary>grepping</secondary>
59544 This utility is a Perl script contributed by Matt Hubbard. It runs
59546 <literallayout class="monospaced">
59550 to obtain a queue listing with undelivered recipients only, and then greps the
59551 output to select messages that match given criteria. The following selection
59552 options are available:
59556 <term><emphasis role="bold">-f</emphasis> <<emphasis>regex</emphasis>></term>
59559 Match the sender address. The field that is tested is enclosed in angle
59560 brackets, so you can test for bounce messages with
59562 <literallayout class="monospaced">
59563 exiqgrep -f '^<>$'
59565 </listitem></varlistentry>
59567 <term><emphasis role="bold">-r</emphasis> <<emphasis>regex</emphasis>></term>
59570 Match a recipient address. The field that is tested is not enclosed in angle
59573 </listitem></varlistentry>
59575 <term><emphasis role="bold">-s</emphasis> <<emphasis>regex</emphasis>></term>
59578 Match against the size field.
59580 </listitem></varlistentry>
59582 <term><emphasis role="bold">-y</emphasis> <<emphasis>seconds</emphasis>></term>
59585 Match messages that are younger than the given time.
59587 </listitem></varlistentry>
59589 <term><emphasis role="bold">-o</emphasis> <<emphasis>seconds</emphasis>></term>
59592 Match messages that are older than the given time.
59594 </listitem></varlistentry>
59596 <term><emphasis role="bold">-z</emphasis></term>
59599 Match only frozen messages.
59601 </listitem></varlistentry>
59603 <term><emphasis role="bold">-x</emphasis></term>
59606 Match only non-frozen messages.
59608 </listitem></varlistentry>
59611 The following options control the format of the output:
59615 <term><emphasis role="bold">-c</emphasis></term>
59618 Display only the count of matching messages.
59620 </listitem></varlistentry>
59622 <term><emphasis role="bold">-l</emphasis></term>
59625 Long format – display the full message information as output by Exim. This is
59628 </listitem></varlistentry>
59630 <term><emphasis role="bold">-i</emphasis></term>
59633 Display message ids only.
59635 </listitem></varlistentry>
59637 <term><emphasis role="bold">-b</emphasis></term>
59640 Brief format – one line per message.
59642 </listitem></varlistentry>
59644 <term><emphasis role="bold">-R</emphasis></term>
59647 Display messages in reverse order.
59649 </listitem></varlistentry>
59652 There is one more option, <option>-h</option>, which outputs a list of options.
59655 <section id="SECTsumtheque">
59656 <title>Summarizing the queue (exiqsumm)</title>
59658 <indexterm role="concept">
59659 <primary><emphasis>exiqsumm</emphasis></primary>
59661 <indexterm role="concept">
59662 <primary>queue</primary>
59663 <secondary>summary</secondary>
59665 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
59666 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
59667 running a command such as
59669 <literallayout class="monospaced">
59670 exim -bp | exiqsumm
59673 The output consists of one line for each domain that has messages waiting for
59674 it, as in the following example:
59676 <literallayout class="monospaced">
59677 3 2322 74m 66m msn.com.example
59680 Each line lists the number of pending deliveries for a domain, their total
59681 volume, and the length of time that the oldest and the newest messages have
59682 been waiting. Note that the number of pending deliveries is greater than the
59683 number of messages when messages have more than one recipient.
59686 A summary line is output at the end. By default the output is sorted on the
59687 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
59688 the output to be sorted by oldest message and by count of messages,
59689 respectively. There are also three options that split the messages for each
59690 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
59691 separates frozen messages, and <option>-s</option> separates messages according to their
59695 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
59696 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
59697 generated by aliasing or forwarding are included (unless the <option>one_time</option>
59698 option of the <command>redirect</command> router has been used to convert them into <quote>top
59699 level</quote> addresses).
59702 <section id="SECTextspeinf">
59703 <title>Extracting specific information from the log (exigrep)</title>
59705 <indexterm role="concept">
59706 <primary><emphasis>exigrep</emphasis></primary>
59708 <indexterm role="concept">
59709 <primary>log</primary>
59710 <secondary>extracts; grepping for</secondary>
59712 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
59713 files for entries that match a given pattern. When it finds a match, it
59714 extracts all the log entries for the relevant message, not just those that
59715 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
59716 given message, or all mail for a given user, or for a given host, for example.
59717 The input files can be in Exim log format or syslog format.
59718 If a matching log line is not associated with a specific message, it is
59719 included in <emphasis>exigrep</emphasis>’s output without any additional lines. The usage is:
59722 <literal>exigrep [-t<</literal><emphasis>n</emphasis><literal>>] [-I] [-l] [-v] <</literal><emphasis>pattern</emphasis><literal>> [<</literal><emphasis>log file</emphasis><literal>>] ...</literal>
59725 If no log file names are given on the command line, the standard input is read.
59728 The <option>-t</option> argument specifies a number of seconds. It adds an additional
59729 condition for message selection. Messages that are complete are shown only if
59730 they spent more than <<emphasis>n</emphasis>> seconds on the queue.
59733 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
59734 makes it case-sensitive. This may give a performance improvement when searching
59735 large log files. Without <option>-I</option>, the Perl pattern matches use Perl’s <literal>/i</literal>
59736 option; with <option>-I</option> they do not. In both cases it is possible to change the
59737 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
59740 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
59741 pattern as standing for themselves. Otherwise the pattern must be a Perl
59742 regular expression.
59745 The <option>-v</option> option inverts the matching condition. That is, a line is selected
59746 if it does <emphasis>not</emphasis> match the pattern.
59749 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
59750 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
59751 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
59754 <section id="SECTexipick">
59755 <title>Selecting messages by various criteria (exipick)</title>
59757 <indexterm role="concept">
59758 <primary><emphasis>exipick</emphasis></primary>
59760 John Jetmore’s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
59761 lists messages from the queue according to a variety of criteria. For details
59762 of <emphasis>exipick</emphasis>’s facilities, visit the web page at
59763 <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
59764 the <option>--help</option> option.
59767 <section id="SECTcyclogfil">
59768 <title>Cycling log files (exicyclog)</title>
59770 <indexterm role="concept">
59771 <primary>log</primary>
59772 <secondary>cycling local files</secondary>
59774 <indexterm role="concept">
59775 <primary>cycling logs</primary>
59777 <indexterm role="concept">
59778 <primary><emphasis>exicyclog</emphasis></primary>
59780 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
59781 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
59782 you are using log files with datestamps in their names (see section
59783 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
59784 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
59785 There are two command line options for <emphasis>exicyclog</emphasis>:
59790 <option>-k</option> <<emphasis>count</emphasis>> specifies the number of log files to keep, overriding the
59791 default that is set when Exim is built. The default default is 10.
59796 <option>-l</option> <<emphasis>path</emphasis>> specifies the log file path, in the same format as Exim’s
59797 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
59798 overriding the script’s default, which is to find the setting from Exim’s
59804 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
59805 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
59806 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
59807 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
59808 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
59809 logs are handled similarly.
59812 If the limit is greater than 99, the script uses 3-digit numbers such as
59813 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
59814 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
59815 any existing log files.
59818 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
59819 the end are deleted. All files with numbers greater than 01 are compressed,
59820 using a compression command which is configured by the COMPRESS_COMMAND
59821 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
59822 root <option>crontab</option> entry of the form
59824 <literallayout class="monospaced">
59825 1 0 * * * su exim -c /usr/exim/bin/exicyclog
59828 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
59829 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
59832 <section id="SECTmailstat">
59833 <title>Mail statistics (eximstats)</title>
59835 <indexterm role="concept">
59836 <primary>statistics</primary>
59838 <indexterm role="concept">
59839 <primary><emphasis>eximstats</emphasis></primary>
59841 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
59842 information from log files. The output is either plain text, or HTML.
59843 Exim log files are also supported by the <emphasis>Lire</emphasis> system produced by the
59844 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
59847 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
59848 latest version is the result of some extensive revision by Steve Campbell. A
59849 lot of information is given by default, but there are options for suppressing
59850 various parts of it. Following any options, the arguments to the script are a
59851 list of files, which should be main log files. For example:
59853 <literallayout class="monospaced">
59854 eximstats -nr /var/spool/exim/log/mainlog.01
59857 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
59858 messages received from or delivered to various hosts. The information is sorted
59859 both by message count and by volume, and the top fifty hosts in each category
59860 are listed on the standard output. Similar information, based on email
59861 addresses or domains instead of hosts can be requested by means of various
59862 options. For messages delivered and received locally, similar statistics are
59863 also produced per user.
59866 The output also includes total counts and statistics about delivery errors, and
59867 histograms showing the number of messages received and deliveries made in each
59868 hour of the day. A delivery with more than one address in its envelope (for
59869 example, an SMTP transaction with more than one RCPT command) is counted
59870 as a single delivery by <emphasis>eximstats</emphasis>.
59873 Though normally more deliveries than receipts are reported (as messages may
59874 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
59875 messages received than delivered, even though the queue is empty at the start
59876 and end of the period in question. If an incoming message contains no valid
59877 recipients, no deliveries are recorded for it. A bounce message is handled as
59878 an entirely separate message.
59881 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
59882 of messages received and deliveries made, and the number of hosts involved in
59883 each case. It also outputs the number of messages that were delayed (that is,
59884 not completely delivered at the first attempt), and the number that had at
59885 least one address that failed.
59888 The remainder of the output is in sections that can be independently disabled
59889 or modified by various options. It consists of a summary of deliveries by
59890 transport, histograms of messages received and delivered per time interval
59891 (default per hour), information about the time messages spent on the queue,
59892 a list of relayed messages, lists of the top fifty sending hosts, local
59893 senders, destination hosts, and destination local users by count and by volume,
59894 and a list of delivery errors that occurred.
59897 The relay information lists messages that were actually relayed, that is, they
59898 came from a remote host and were directly delivered to some other remote host,
59899 without being processed (for example, for aliasing or forwarding) locally.
59902 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
59903 outputs. These are documented in the Perl script itself, and can be extracted
59904 by running the command <command>perldoc</command> on the script. For example:
59906 <literallayout class="monospaced">
59907 perldoc /usr/exim/bin/eximstats
59910 <section id="SECTcheckaccess">
59911 <title>Checking access policy (exim_checkaccess)</title>
59913 <indexterm role="concept">
59914 <primary><emphasis>exim_checkaccess</emphasis></primary>
59916 <indexterm role="concept">
59917 <primary>policy control</primary>
59918 <secondary>checking access</secondary>
59920 <indexterm role="concept">
59921 <primary>checking access</primary>
59923 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
59924 debugging output, in order to check what Exim is doing when it is applying
59925 policy controls to incoming SMTP mail. However, not everybody is sufficiently
59926 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
59927 sometimes you just want to answer the question <quote>Does this address have
59928 access?</quote> without bothering with any further details.
59931 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
59932 two arguments, an IP address and an email address:
59934 <literallayout class="monospaced">
59935 exim_checkaccess 10.9.8.7 A.User@a.domain.example
59938 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
59939 given email address would be accepted in a RCPT command in a TCP/IP
59940 connection from the host with the given IP address. The output of the utility
59941 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
59943 <literallayout class="monospaced">
59945 550 Relay not permitted
59948 When running this test, the utility uses <literal><></literal> as the envelope sender address
59949 for the MAIL command, but you can change this by providing additional
59950 options. These are passed directly to the Exim command. For example, to specify
59951 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
59954 <literallayout class="monospaced">
59955 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
59956 -f himself@there.example
59959 Note that these additional Exim command line items must be given after the two
59960 mandatory arguments.
59963 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
59964 while running its checks. You can run checks that include callouts by using
59965 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
59968 <section id="SECTdbmbuild">
59969 <title>Making DBM files (exim_dbmbuild)</title>
59971 <indexterm role="concept">
59972 <primary>DBM</primary>
59973 <secondary>building dbm files</secondary>
59975 <indexterm role="concept">
59976 <primary>building DBM files</primary>
59978 <indexterm role="concept">
59979 <primary><emphasis>exim_dbmbuild</emphasis></primary>
59981 <indexterm role="concept">
59982 <primary>lower casing</primary>
59984 <indexterm role="concept">
59985 <primary>binary zero</primary>
59986 <secondary>in lookup key</secondary>
59988 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
59989 the format used by the <command>lsearch</command> lookup (see section
59990 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
59991 names as keys and the remainder of the information as data. The lower-casing
59992 can be prevented by calling the program with the <option>-nolc</option> option.
59995 A terminating zero is included as part of the key string. This is expected by
59996 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
59997 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
59998 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
60002 The program requires two arguments: the name of the input file (which can be a
60003 single hyphen to indicate the standard input), and the name of the output file.
60004 It creates the output under a temporary name, and then renames it if all went
60008 <indexterm role="concept">
60009 <primary>USE_DB</primary>
60011 If the native DB interface is in use (USE_DB is set in a compile-time
60012 configuration file – this is common in free versions of Unix) the two file
60013 names must be different, because in this mode the Berkeley DB functions create
60014 a single output file using exactly the name given. For example,
60016 <literallayout class="monospaced">
60017 exim_dbmbuild /etc/aliases /etc/aliases.db
60020 reads the system alias file and creates a DBM version of it in
60021 <filename>/etc/aliases.db</filename>.
60024 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
60025 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
60026 environment, the suffixes are added to the second argument of
60027 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
60028 when the Berkeley functions are used in compatibility mode (though this is not
60029 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
60032 If a duplicate key is encountered, the program outputs a warning, and when it
60033 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
60034 option is used. By default, only the first of a set of duplicates is used –
60035 this makes it compatible with <command>lsearch</command> lookups. There is an option
60036 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
60037 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
60038 <option>stderr</option>. For other errors, where it doesn’t actually make a new file, the
60042 <section id="SECTfinindret">
60043 <title>Finding individual retry times (exinext)</title>
60045 <indexterm role="concept">
60046 <primary>retry</primary>
60047 <secondary>times</secondary>
60049 <indexterm role="concept">
60050 <primary><emphasis>exinext</emphasis></primary>
60052 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
60053 fish specific information out of the retry database. Given a mail domain (or a
60054 complete address), it looks up the hosts for that domain, and outputs any retry
60055 information for the hosts or for the domain. At present, the retry information
60056 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
60057 output. For example:
60059 <literallayout class="monospaced">
60060 $ exinext piglet@milne.fict.example
60061 kanga.milne.example:192.168.8.1 error 146: Connection refused
60062 first failed: 21-Feb-1996 14:57:34
60063 last tried: 21-Feb-1996 14:57:34
60064 next try at: 21-Feb-1996 15:02:34
60065 roo.milne.example:192.168.8.3 error 146: Connection refused
60066 first failed: 20-Jan-1996 13:12:08
60067 last tried: 21-Feb-1996 11:42:03
60068 next try at: 21-Feb-1996 19:42:03
60069 past final cutoff time
60072 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
60073 will give any retry information for that local part in your default domain.
60074 A message id can be used to obtain retry information pertaining to a specific
60075 message. This exists only when an attempt to deliver a message to a remote host
60076 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
60077 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
60081 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
60082 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
60083 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
60084 configuration file, and the second sets macros for use within the configuration
60085 file. These features are mainly to help in testing, but might also be useful in
60086 environments where more than one configuration file is in use.
60089 <section id="SECThindatmai">
60090 <title>Hints database maintenance</title>
60092 <indexterm role="concept">
60093 <primary>hints database</primary>
60094 <secondary>maintenance</secondary>
60096 <indexterm role="concept">
60097 <primary>maintaining Exim’s hints database</primary>
60099 Three utility programs are provided for maintaining the DBM files that Exim
60100 uses to contain its delivery hint information. Each program requires two
60101 arguments. The first specifies the name of Exim’s spool directory, and the
60102 second is the name of the database it is to operate on. These are as follows:
60107 <emphasis>retry</emphasis>: the database of retry information
60112 <emphasis>wait-</emphasis><<emphasis>transport name</emphasis>>: databases of information about messages waiting
60118 <emphasis>callout</emphasis>: the callout cache
60123 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
60128 <emphasis>misc</emphasis>: other hints data
60133 The <emphasis>misc</emphasis> database is used for
60138 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
60143 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
60144 <command>smtp</command> transport)
60149 <section id="SECID261">
60150 <title>exim_dumpdb</title>
60152 <indexterm role="concept">
60153 <primary><emphasis>exim_dumpdb</emphasis></primary>
60155 The entire contents of a database are written to the standard output by the
60156 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
60157 spool and database names. For example, to dump the retry database:
60159 <literallayout class="monospaced">
60160 exim_dumpdb /var/spool/exim retry
60163 Two lines of output are produced for each entry:
60165 <literallayout class="monospaced">
60166 T:mail.ref.example:192.168.242.242 146 77 Connection refused
60167 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
60170 The first item on the first line is the key of the record. It starts with one
60171 of the letters R, or T, depending on whether it refers to a routing or
60172 transport retry. For a local delivery, the next part is the local address; for
60173 a remote delivery it is the name of the remote host, followed by its failing IP
60174 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
60175 transport). If the remote port is not the standard one (port 25), it is added
60176 to the IP address. Then there follows an error code, an additional error code,
60177 and a textual description of the error.
60180 The three times on the second line are the time of first failure, the time of
60181 the last delivery attempt, and the computed time for the next attempt. The line
60182 ends with an asterisk if the cutoff time for the last retry rule has been
60186 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
60187 consists of a host name followed by a list of ids for messages that are or were
60188 waiting to be delivered to that host. If there are a very large number for any
60189 one host, continuation records, with a sequence number added to the host name,
60190 may be seen. The data in these records is often out of date, because a message
60191 may be routed to several alternative hosts, and Exim makes no effort to keep
60195 <section id="SECID262">
60196 <title>exim_tidydb</title>
60198 <indexterm role="concept">
60199 <primary><emphasis>exim_tidydb</emphasis></primary>
60201 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
60202 database. If run with no options, it removes all records that are more than 30
60203 days old. The age is calculated from the date and time that the record was last
60204 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
60205 since the first delivery failure. Information about a host that has been down
60206 for more than 30 days will remain in the database, provided that the record is
60207 updated sufficiently often.
60210 The cutoff date can be altered by means of the <option>-t</option> option, which must be
60211 followed by a time. For example, to remove all records older than a week from
60212 the retry database:
60214 <literallayout class="monospaced">
60215 exim_tidydb -t 7d /var/spool/exim retry
60218 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
60219 message ids. In the former these appear as data in records keyed by host –
60220 they were messages that were waiting for that host – and in the latter they
60221 are the keys for retry information for messages that have suffered certain
60222 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
60223 message ids in database records are those of messages that are still on the
60224 queue. Message ids for messages that no longer exist are removed from
60225 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
60226 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
60227 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
60228 whenever it removes information from the database.
60231 Certain records are automatically removed by Exim when they are no longer
60232 needed, but others are not. For example, if all the MX hosts for a domain are
60233 down, a retry record is created for each one. If the primary MX host comes back
60234 first, its record is removed when Exim successfully delivers to it, but the
60235 records for the others remain because Exim has not tried to use those hosts.
60238 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
60239 hints databases. You should do this at a quiet time of day, because it requires
60240 a database to be locked (and therefore inaccessible to Exim) while it does its
60241 work. Removing records from a DBM file does not normally make the file smaller,
60242 but all the common DBM libraries are able to re-use the space that is released.
60243 After an initial phase of increasing in size, the databases normally reach a
60244 point at which they no longer get any bigger, as long as they are regularly
60248 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
60249 databases is likely to keep on increasing.
60252 <section id="SECID263">
60253 <title>exim_fixdb</title>
60255 <indexterm role="concept">
60256 <primary><emphasis>exim_fixdb</emphasis></primary>
60258 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
60259 Its main use is for testing Exim, but it might also be occasionally useful for
60260 getting round problems in a live system. It has no options, and its interface
60261 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
60262 key of a database record can then be entered, and the data for that record is
60266 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
60267 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
60268 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
60269 data for individual fields can be changed by typing the field number followed
60270 by new data, for example:
60272 <literallayout class="monospaced">
60276 resets the time of the next delivery attempt. Time values are given as a
60277 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
60278 used as optional separators.
60281 <section id="SECTmailboxmaint">
60282 <title>Mailbox maintenance (exim_lock)</title>
60284 <indexterm role="concept">
60285 <primary>mailbox</primary>
60286 <secondary>maintenance</secondary>
60288 <indexterm role="concept">
60289 <primary><emphasis>exim_lock</emphasis></primary>
60291 <indexterm role="concept">
60292 <primary>locking mailboxes</primary>
60294 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
60295 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
60296 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
60297 a user agent while investigating a problem. The utility requires the name of
60298 the file as its first argument. If the locking is successful, the second
60299 argument is run as a command (using C’s <function>system()</function> function); if there is no
60300 second argument, the value of the SHELL environment variable is used; if this
60301 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
60302 is unlocked and the utility ends. The following options are available:
60306 <term><option>-fcntl</option></term>
60309 Use <function>fcntl()</function> locking on the open mailbox.
60311 </listitem></varlistentry>
60313 <term><option>-flock</option></term>
60316 Use <function>flock()</function> locking on the open mailbox, provided the operating system
60319 </listitem></varlistentry>
60321 <term><option>-interval</option></term>
60324 This must be followed by a number, which is a number of seconds; it sets the
60325 interval to sleep between retries (default 3).
60327 </listitem></varlistentry>
60329 <term><option>-lockfile</option></term>
60332 Create a lock file before opening the mailbox.
60334 </listitem></varlistentry>
60336 <term><option>-mbx</option></term>
60339 Lock the mailbox using MBX rules.
60341 </listitem></varlistentry>
60343 <term><option>-q</option></term>
60346 Suppress verification output.
60348 </listitem></varlistentry>
60350 <term><option>-retries</option></term>
60353 This must be followed by a number; it sets the number of times to try to get
60354 the lock (default 10).
60356 </listitem></varlistentry>
60358 <term><option>-restore_time</option></term>
60361 This option causes <option>exim_lock</option> to restore the modified and read times to the
60362 locked file before exiting. This allows you to access a locked mailbox (for
60363 example, to take a backup copy) without disturbing the times that the user
60366 </listitem></varlistentry>
60368 <term><option>-timeout</option></term>
60371 This must be followed by a number, which is a number of seconds; it sets a
60372 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
60373 default), a non-blocking call is used.
60375 </listitem></varlistentry>
60377 <term><option>-v</option></term>
60380 Generate verbose output.
60382 </listitem></varlistentry>
60385 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
60386 default is to create a lock file and also to use <function>fcntl()</function> locking on the
60387 mailbox, which is the same as Exim’s default. The use of <option>-flock</option> or
60388 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
60389 requires that the directory containing the file be writeable. Locking by lock
60390 file does not last for ever; Exim assumes that a lock file is expired if it is
60391 more than 30 minutes old.
60394 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
60395 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
60396 to be taken out on the open mailbox, and an exclusive lock on the file
60397 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
60398 number of the mailbox file. When the locking is released, if an exclusive lock
60399 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
60402 The default output contains verification of the locking that takes place. The
60403 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
60404 suppresses all output except error messages.
60409 <literallayout class="monospaced">
60410 exim_lock /var/spool/mail/spqr
60413 runs an interactive shell while the file is locked, whereas
60416 <literal>exim_lock -q /var/spool/mail/spqr <<End</literal>
60417 <<emphasis>some commands</emphasis>>
60418 <literal>End</literal>
60421 runs a specific non-interactive sequence of commands while the file is locked,
60422 suppressing all verification output. A single command can be run by a command
60425 <literallayout class="monospaced">
60426 exim_lock -q /var/spool/mail/spqr \
60427 "cp /var/spool/mail/spqr /some/where"
60430 Note that if a command is supplied, it must be entirely contained within the
60431 second argument – hence the quotes.
60432 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
60437 <chapter id="CHAPeximon">
60438 <title>The Exim monitor</title>
60440 <indexterm role="concept" id="IIDeximon" class="startofrange">
60441 <primary>Exim monitor</primary>
60442 <secondary>description</secondary>
60444 <indexterm role="concept">
60445 <primary>X-windows</primary>
60447 <indexterm role="concept">
60448 <primary><emphasis>eximon</emphasis></primary>
60450 <indexterm role="concept">
60451 <primary>Local/eximon.conf</primary>
60453 <indexterm role="concept">
60454 <primary><filename>exim_monitor/EDITME</filename></primary>
60456 The Exim monitor is an application which displays in an X window information
60457 about the state of Exim’s queue and what Exim is doing. An admin user can
60458 perform certain operations on messages from this GUI interface; however all
60459 such facilities are also available from the command line, and indeed, the
60460 monitor itself makes use of the command line to perform any actions requested.
60462 <section id="SECID264">
60463 <title>Running the monitor</title>
60465 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
60466 script that sets up a number of environment variables, and then runs the
60467 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
60468 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
60469 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
60470 parameters are for.
60473 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
60474 a particular invocation by setting up environment variables of the same names,
60475 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
60477 <literallayout class="monospaced">
60478 EXIMON_LOG_DEPTH=400 eximon
60481 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
60482 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
60483 overrides the Exim log file configuration. This makes it possible to have
60484 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
60485 syslog messages are routed to a file on the local host.
60488 X resources can be used to change the appearance of the window in the normal
60489 way. For example, a resource setting of the form
60491 <literallayout class="monospaced">
60492 Eximon*background: gray94
60495 changes the colour of the background to light grey rather than white. The
60496 stripcharts are drawn with both the data lines and the reference lines in
60497 black. This means that the reference lines are not visible when on top of the
60498 data. However, their colour can be changed by setting a resource called
60499 <quote>highlight</quote> (an odd name, but that’s what the Athena stripchart widget uses).
60500 For example, if your X server is running Unix, you could set up lighter
60501 reference lines in the stripcharts by obeying
60503 <literallayout class="monospaced">
60504 xrdb -merge <<End
60505 Eximon*highlight: gray
60509 <indexterm role="concept">
60510 <primary>admin user</primary>
60512 In order to see the contents of messages on the queue, and to operate on them,
60513 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
60516 The monitor’s window is divided into three parts. The first contains one or
60517 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
60518 main log file, and the third is a display of the queue of messages awaiting
60519 delivery, with two more action buttons. The following sections describe these
60520 different parts of the display.
60523 <section id="SECID265">
60524 <title>The stripcharts</title>
60526 <indexterm role="concept">
60527 <primary>stripchart</primary>
60529 The first stripchart is always a count of messages on the queue. Its name can
60530 be configured by setting QUEUE_STRIPCHART_NAME in the
60531 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
60532 configuration script by regular expression matches on log file entries, making
60533 it possible to display, for example, counts of messages delivered to certain
60534 hosts or using certain transports. The supplied defaults display counts of
60535 received and delivered messages, and of local and SMTP deliveries. The default
60536 period between stripchart updates is one minute; this can be adjusted by a
60537 parameter in the <filename>Local/eximon.conf</filename> file.
60540 The stripchart displays rescale themselves automatically as the value they are
60541 displaying changes. There are always 10 horizontal lines in each chart; the
60542 title string indicates the value of each division when it is greater than one.
60543 For example, <quote>x2</quote> means that each division represents a value of 2.
60546 It is also possible to have a stripchart which shows the percentage fullness of
60547 a particular disk partition, which is useful when local deliveries are confined
60548 to a single partition.
60551 <indexterm role="concept">
60552 <primary><option>statvfs</option> function</primary>
60554 This relies on the availability of the <function>statvfs()</function> function or equivalent in
60555 the operating system. Most, but not all versions of Unix that support Exim have
60556 this. For this particular stripchart, the top of the chart always represents
60557 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
60558 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
60559 <filename>Local/eximon.conf</filename> file.
60562 <section id="SECID266">
60563 <title>Main action buttons</title>
60565 <indexterm role="concept">
60566 <primary>size</primary>
60567 <secondary>of monitor window</secondary>
60569 <indexterm role="concept">
60570 <primary>Exim monitor</primary>
60571 <secondary>window size</secondary>
60573 <indexterm role="concept">
60574 <primary>window size</primary>
60576 Below the stripcharts there is an action button for quitting the monitor. Next
60577 to this is another button marked <quote>Size</quote>. They are placed here so that
60578 shrinking the window to its default minimum size leaves just the queue count
60579 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
60580 the window to expand to its maximum size, unless it is already at the maximum,
60581 in which case it is reduced to its minimum.
60584 When expanding to the maximum, if the window cannot be fully seen where it
60585 currently is, it is moved back to where it was the last time it was at full
60586 size. When it is expanding from its minimum size, the old position is
60587 remembered, and next time it is reduced to the minimum it is moved back there.
60590 The idea is that you can keep a reduced window just showing one or two
60591 stripcharts at a convenient place on your screen, easily expand it to show
60592 the full window when required, and just as easily put it back to what it was.
60593 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
60594 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
60595 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
60598 Normally, the monitor starts up with the window at its full size, but it can be
60599 built so that it starts up with the window at its smallest size, by setting
60600 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
60603 <section id="SECID267">
60604 <title>The log display</title>
60606 <indexterm role="concept">
60607 <primary>log</primary>
60608 <secondary>tail of; in monitor</secondary>
60610 The second section of the window is an area in which a display of the tail of
60611 the main log is maintained.
60612 To save space on the screen, the timestamp on each log line is shortened by
60613 removing the date and, if <option>log_timezone</option> is set, the timezone.
60614 The log tail is not available when the only destination for logging data is
60615 syslog, unless the syslog lines are routed to a local file whose name is passed
60616 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
60619 The log sub-window has a scroll bar at its lefthand side which can be used to
60620 move back to look at earlier text, and the up and down arrow keys also have a
60621 scrolling effect. The amount of log that is kept depends on the setting of
60622 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
60623 to use. When this is full, the earlier 50% of data is discarded – this is
60624 much more efficient than throwing it away line by line. The sub-window also has
60625 a horizontal scroll bar for accessing the ends of long log lines. This is the
60626 only means of horizontal scrolling; the right and left arrow keys are not
60627 available. Text can be cut from this part of the window using the mouse in the
60628 normal way. The size of this subwindow is controlled by parameters in the
60629 configuration file <filename>Local/eximon.conf</filename>.
60632 Searches of the text in the log window can be carried out by means of the ^R
60633 and ^S keystrokes, which default to a reverse and a forward search,
60634 respectively. The search covers only the text that is displayed in the window.
60635 It cannot go further back up the log.
60638 The point from which the search starts is indicated by a caret marker. This is
60639 normally at the end of the text in the window, but can be positioned explicitly
60640 by pointing and clicking with the left mouse button, and is moved automatically
60641 by a successful search. If new text arrives in the window when it is scrolled
60642 back, the caret remains where it is, but if the window is not scrolled back,
60643 the caret is moved to the end of the new text.
60646 Pressing ^R or ^S pops up a window into which the search text can be typed.
60647 There are buttons for selecting forward or reverse searching, for carrying out
60648 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
60649 happens and the window remains so that further searches can be done. If the
60650 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
60651 ^C is typed the search is cancelled.
60654 The searching facility is implemented using the facilities of the Athena text
60655 widget. By default this pops up a window containing both <quote>search</quote> and
60656 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
60657 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
60658 However, the linkers in BSDI and HP-UX seem unable to handle an externally
60659 provided version of <option>TextPop</option> when the remaining parts of the text widget
60660 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
60661 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
60662 on these systems, at the expense of having unwanted items in the search popup
60666 <section id="SECID268">
60667 <title>The queue display</title>
60669 <indexterm role="concept">
60670 <primary>queue</primary>
60671 <secondary>display in monitor</secondary>
60673 The bottom section of the monitor window contains a list of all messages that
60674 are on the queue, which includes those currently being received or delivered,
60675 as well as those awaiting delivery. The size of this subwindow is controlled by
60676 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
60677 at which it is updated is controlled by another parameter in the same file –
60678 the default is 5 minutes, since queue scans can be quite expensive. However,
60679 there is an <quote>Update</quote> action button just above the display which can be used
60680 to force an update of the queue display at any time.
60683 When a host is down for some time, a lot of pending mail can build up for it,
60684 and this can make it hard to deal with other messages on the queue. To help
60685 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
60686 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
60687 type anything in here and press <quote>Return</quote>, the text is added to a chain of
60688 such texts, and if every undelivered address in a message matches at least one
60689 of the texts, the message is not displayed.
60692 If there is an address that does not match any of the texts, all the addresses
60693 are displayed as normal. The matching happens on the ends of addresses so, for
60694 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
60695 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
60696 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
60697 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
60698 a hide request is automatically cancelled after one hour.
60701 While the dialogue box is displayed, you can’t press any buttons or do anything
60702 else to the monitor window. For this reason, if you want to cut text from the
60703 queue display to use in the dialogue box, you have to do the cutting before
60704 pressing the <quote>Hide</quote> button.
60707 The queue display contains, for each unhidden queued message, the length of
60708 time it has been on the queue, the size of the message, the message id, the
60709 message sender, and the first undelivered recipient, all on one line. If it is
60710 a bounce message, the sender is shown as <quote><></quote>. If there is more than one
60711 recipient to which the message has not yet been delivered, subsequent ones are
60712 listed on additional lines, up to a maximum configured number, following which
60713 an ellipsis is displayed. Recipients that have already received the message are
60717 <indexterm role="concept">
60718 <primary>frozen messages</primary>
60719 <secondary>display</secondary>
60721 If a message is frozen, an asterisk is displayed at the left-hand side.
60724 The queue display has a vertical scroll bar, and can also be scrolled by means
60725 of the arrow keys. Text can be cut from it using the mouse in the normal way.
60726 The text searching facilities, as described above for the log window, are also
60727 available, but the caret is always moved to the end of the text when the queue
60728 display is updated.
60731 <section id="SECID269">
60732 <title>The queue menu</title>
60734 <indexterm role="concept">
60735 <primary>queue</primary>
60736 <secondary>menu in monitor</secondary>
60738 If the <option>shift</option> key is held down and the left button is clicked when the mouse
60739 pointer is over the text for any message, an action menu pops up, and the first
60740 line of the queue display for the message is highlighted. This does not affect
60744 If you want to use some other event for popping up the menu, you can set the
60745 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
60746 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
60747 value set in this parameter is a standard X event description. For example, to
60748 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
60750 <literallayout class="monospaced">
60751 EXIMON_MENU_EVENT='Ctrl<Btn1Down>' eximon
60754 The title of the menu is the message id, and it contains entries which act as
60760 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
60761 in a new text window.
60766 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
60767 information and headers is displayed in a new text window. See chapter
60768 <xref linkend="CHAPspool"/> for a description of the format of spool files.
60773 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
60774 displayed in a new text window. There is a default limit of 20,000 bytes to the
60775 amount of data displayed. This can be changed by setting the BODY_MAX
60776 option at compile time, or the EXIMON_BODY_MAX option at run time.
60781 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
60782 delivery of the message. This causes an automatic thaw if the message is
60783 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
60784 a new text window. The delivery is run in a separate process, to avoid holding
60785 up the monitor while the delivery proceeds.
60790 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
60791 that the message be frozen.
60796 <indexterm role="concept">
60797 <primary>thawing messages</primary>
60799 <indexterm role="concept">
60800 <primary>unfreezing messages</primary>
60802 <indexterm role="concept">
60803 <primary>frozen messages</primary>
60804 <secondary>thawing</secondary>
60806 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
60807 that the message be thawed.
60812 <indexterm role="concept">
60813 <primary>delivery</primary>
60814 <secondary>forcing failure</secondary>
60816 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
60817 that Exim gives up trying to deliver the message. A bounce message is generated
60818 for any remaining undelivered addresses.
60823 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
60824 that the message be deleted from the system without generating a bounce
60830 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
60831 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60832 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60833 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60834 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
60835 additional recipient be added to the message, unless the entry box is empty, in
60836 which case no action is taken.
60841 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
60842 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
60843 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
60844 Otherwise it must be entered as a fully qualified address. Pressing RETURN
60845 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
60846 recipient address as already delivered, unless the entry box is empty, in which
60847 case no action is taken.
60852 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
60853 mark all recipient addresses as already delivered.
60858 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
60859 sender’s address. Pressing RETURN causes a call to Exim to be made using the
60860 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
60861 in which case no action is taken. If you want to set an empty sender (as in
60862 bounce messages), you must specify it as <quote><></quote>. Otherwise, if the address is
60863 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
60864 the address is qualified with that domain.
60869 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
60870 other cases when a call to Exim is made, if there is any output from Exim (in
60871 particular, if the command fails) a window containing the command and the
60872 output is displayed. Otherwise, the results of the action are normally apparent
60873 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
60874 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
60875 if no output is generated.
60878 The queue display is automatically updated for actions such as freezing and
60879 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
60880 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
60881 force an update of the display after one of these actions.
60884 In any text window that is displayed as result of a menu action, the normal
60885 cut-and-paste facility is available, and searching can be carried out using ^R
60886 and ^S, as described above for the log tail window.
60887 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
60892 <chapter id="CHAPsecurity">
60893 <title>Security considerations</title>
60895 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
60896 <primary>security</primary>
60897 <secondary>discussion of</secondary>
60899 This chapter discusses a number of issues concerned with security, some of
60900 which are also covered in other parts of this manual.
60903 For reasons that this author does not understand, some people have promoted
60904 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
60905 existence of this chapter in the documentation. However, the intent of the
60906 chapter is simply to describe the way Exim works in relation to certain
60907 security concerns, not to make any specific claims about the effectiveness of
60908 its security as compared with other MTAs.
60911 What follows is a description of the way Exim is supposed to be. Best efforts
60912 have been made to try to ensure that the code agrees with the theory, but an
60913 absence of bugs can never be guaranteed. Any that are reported will get fixed
60914 as soon as possible.
60916 <section id="SECID286">
60917 <title>Building a more <quote>hardened</quote> Exim</title>
60919 <indexterm role="concept">
60920 <primary>security</primary>
60921 <secondary>build-time features</secondary>
60923 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
60924 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
60925 Exim administrator who does not have the root password, or by someone who has
60926 penetrated the Exim (but not the root) account. These options are as follows:
60931 ALT_CONFIG_PREFIX can be set to a string that is required to match the
60932 start of any file names used with the <option>-C</option> option. When it is set, these file
60933 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
60934 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
60935 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
60936 default setting for <option>ALT_CONFIG_PREFIX</option>.
60938 <para revisionflag="changed">
60939 If the permitted configuration files are confined to a directory to
60940 which only root has access, this guards against someone who has broken
60941 into the Exim account from running a privileged Exim with an arbitrary
60942 configuration file, and using it to break into other accounts.
60946 <para revisionflag="changed">
60947 If a non-trusted configuration file (i.e. not the default configuration file
60948 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
60949 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
60950 the next item), then root privilege is retained only if the caller of Exim is
60951 root. This locks out the possibility of testing a configuration using <option>-C</option>
60952 right through message reception and delivery, even if the caller is root. The
60953 reception works, but by that time, Exim is running as the Exim user, so when
60954 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
60955 privilege to be lost. However, root can test reception and delivery using two
60960 <para revisionflag="changed">
60961 The WHITELIST_D_MACROS build option declares some macros to be safe to override
60962 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
60963 CONFIGURE_OWNER, if defined. The potential impact of this option is limited by
60964 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
60965 the restrictive side. Requiring build-time selection of safe macros is onerous
60966 but this option is intended solely as a transition mechanism to permit
60967 previously-working configurations to continue to work after release 4.73.
60971 <para revisionflag="changed">
60972 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
60977 <para revisionflag="changed">
60978 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
60979 never to be used for any deliveries. This is like the <option>never_users</option> runtime
60980 option, but it cannot be overridden; the runtime option adds additional users
60981 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
60982 is permitted to modify the runtime file from using Exim as a way to get root.
60987 <section id="SECID270">
60988 <title>Root privilege</title>
60990 <indexterm role="concept">
60991 <primary>setuid</primary>
60993 <indexterm role="concept">
60994 <primary>root privilege</primary>
60996 The Exim binary is normally setuid to root, which means that it gains root
60997 privilege (runs as root) when it starts execution. In some special cases (for
60998 example, when the daemon is not in use and there are no local deliveries), it
60999 may be possible to run Exim setuid to some user other than root. This is
61000 discussed in the next section. However, in most installations, root privilege
61001 is required for two things:
61006 To set up a socket connected to the standard SMTP port (25) when initialising
61007 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
61013 To be able to change uid and gid in order to read users’ <filename>.forward</filename> files and
61014 perform local deliveries as the receiving user or as specified in the
61020 It is not necessary to be root to do any of the other things Exim does, such as
61021 receiving messages and delivering them externally over SMTP, and it is
61022 obviously more secure if Exim does not run as root except when necessary.
61023 For this reason, a user and group for Exim to use must be defined in
61024 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
61025 group</quote>. Their values can be changed by the run time configuration, though this
61026 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
61027 <emphasis>mail</emphasis> or another user name altogether.
61030 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
61031 abdication; the process cannot regain root afterwards. Prior to release 4.00,
61032 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
61035 After a new Exim process has interpreted its command line options, it changes
61036 uid and gid in the following cases:
61038 <itemizedlist revisionflag="changed">
61040 <para revisionflag="changed">
61041 <indexterm role="option">
61042 <primary><option>-C</option></primary>
61044 <indexterm role="option">
61045 <primary><option>-D</option></primary>
61047 If the <option>-C</option> option is used to specify an alternate configuration file, or if
61048 the <option>-D</option> option is used to define macro values for the configuration, and the
61049 calling process is not running as root, the uid and gid are changed to those of
61050 the calling process.
61051 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
61052 option may not be used at all.
61053 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
61054 can be supplied if the calling process is running as root, the Exim run-time
61055 user or CONFIGURE_OWNER, if defined.
61059 <para revisionflag="changed">
61060 <indexterm role="option">
61061 <primary><option>-be</option></primary>
61063 <indexterm role="option">
61064 <primary><option>-bf</option></primary>
61066 <indexterm role="option">
61067 <primary><option>-bF</option></primary>
61069 If the expansion test option (<option>-be</option>) or one of the filter testing options
61070 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
61075 <para revisionflag="changed">
61076 If the process is not a daemon process or a queue runner process or a delivery
61077 process or a process for testing address routing (started with <option>-bt</option>), the
61078 uid and gid are changed to the Exim user and group. This means that Exim always
61079 runs under its own uid and gid when receiving messages. This also applies when
61080 testing address verification
61081 <indexterm role="option">
61082 <primary><option>-bv</option></primary>
61084 <indexterm role="option">
61085 <primary><option>-bh</option></primary>
61087 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
61092 <para revisionflag="changed">
61093 For a daemon, queue runner, delivery, or address testing process, the uid
61094 remains as root at this stage, but the gid is changed to the Exim group.
61099 The processes that initially retain root privilege behave as follows:
61104 A daemon process changes the gid to the Exim group and the uid to the Exim
61105 user after setting up one or more listening sockets. The <function>initgroups()</function>
61106 function is called, so that if the Exim user is in any additional groups, they
61107 will be used during message reception.
61112 A queue runner process retains root privilege throughout its execution. Its
61113 job is to fork a controlled sequence of delivery processes.
61118 A delivery process retains root privilege throughout most of its execution,
61119 but any actual deliveries (that is, the transports themselves) are run in
61120 subprocesses which always change to a non-root uid and gid. For local
61121 deliveries this is typically the uid and gid of the owner of the mailbox; for
61122 remote deliveries, the Exim uid and gid are used. Once all the delivery
61123 subprocesses have been run, a delivery process changes to the Exim uid and gid
61124 while doing post-delivery tidying up such as updating the retry database and
61125 generating bounce and warning messages.
61128 While the recipient addresses in a message are being routed, the delivery
61129 process runs as root. However, if a user’s filter file has to be processed,
61130 this is done in a subprocess that runs under the individual user’s uid and
61131 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
61136 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
61137 the routing is done in the same environment as a message delivery.
61142 <section id="SECTrunexiwitpri">
61143 <title>Running Exim without privilege</title>
61145 <indexterm role="concept">
61146 <primary>privilege, running without</primary>
61148 <indexterm role="concept">
61149 <primary>unprivileged running</primary>
61151 <indexterm role="concept">
61152 <primary>root privilege</primary>
61153 <secondary>running without</secondary>
61155 Some installations like to run Exim in an unprivileged state for more of its
61156 operation, for added security. Support for this mode of operation is provided
61157 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
61158 gid are changed to the Exim user and group at the start of a delivery process
61159 (and also queue runner and address testing processes). This means that address
61160 routing is no longer run as root, and the deliveries themselves cannot change
61164 <indexterm role="concept">
61165 <primary>SIGHUP</primary>
61167 <indexterm role="concept">
61168 <primary>daemon</primary>
61169 <secondary>restarting</secondary>
61171 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
61172 that the daemon can still be started in the usual way, and it can respond
61173 correctly to SIGHUP because the re-invocation regains root privilege.
61176 An alternative approach is to make Exim setuid to the Exim user and also setgid
61177 to the Exim group. If you do this, the daemon must be started from a root
61178 process. (Calling Exim from a root process makes it behave in the way it does
61179 when it is setuid root.) However, the daemon cannot restart itself after a
61180 SIGHUP signal because it cannot regain privilege.
61183 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
61184 stops Exim from trying to re-invoke itself to do a delivery after a message has
61185 been received. Such a re-invocation is a waste of resources because it has no
61189 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
61190 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
61191 to the Exim user seems a clean approach, but there is one complication:
61194 In this style of operation, Exim is running with the real uid and gid set to
61195 those of the calling process, and the effective uid/gid set to Exim’s values.
61196 Ideally, any association with the calling process’ uid/gid should be dropped,
61197 that is, the real uid/gid should be reset to the effective values so as to
61198 discard any privileges that the caller may have. While some operating systems
61199 have a function that permits this action for a non-root effective uid, quite a
61200 number of them do not. Because of this lack of standardization, Exim does not
61201 address this problem at this time.
61204 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
61205 is to keep the Exim binary setuid to root, and to set
61206 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
61207 be used in the most straightforward way.
61210 If you configure Exim not to run delivery processes as root, there are a
61211 number of restrictions on what you can do:
61216 You can deliver only as the Exim user/group. You should explicitly use the
61217 <option>user</option> and <option>group</option> options to override routers or local transports that
61218 normally deliver as the recipient. This makes sure that configurations that
61219 work in this mode function the same way in normal mode. Any implicit or
61220 explicit specification of another user causes an error.
61225 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
61226 not worthwhile to include them in the configuration.
61231 Users who wish to use <filename>.forward</filename> would have to make their home directory and
61232 the file itself accessible to the Exim user. Pipe and append-to-file entries,
61233 and their equivalents in Exim filters, cannot be used. While they could be
61234 enabled in the Exim user’s name, that would be insecure and not very useful.
61239 Unless the local user mailboxes are all owned by the Exim user (possible in
61240 some POP3 or IMAP-only environments):
61242 <orderedlist numeration="arabic">
61245 They must be owned by the Exim group and be writeable by that group. This
61246 implies you must set <option>mode</option> in the appendfile configuration, as well as the
61247 mode of the mailbox files themselves.
61252 You must set <option>no_check_owner</option>, since most or all of the files will not be
61253 owned by the Exim user.
61258 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
61259 on a newly created mailbox when unprivileged. This also implies that new
61260 mailboxes need to be created manually.
61267 These restrictions severely restrict what can be done in local deliveries.
61268 However, there are no restrictions on remote deliveries. If you are running a
61269 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
61270 gives more security at essentially no cost.
61273 If you are using the <option>mua_wrapper</option> facility (see chapter
61274 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
61277 <section id="SECID271">
61278 <title>Delivering to local files</title>
61280 Full details of the checks applied by <command>appendfile</command> before it writes to a file
61281 are given in chapter <xref linkend="CHAPappendfile"/>.
61284 <section id="SECID272">
61285 <title>IPv4 source routing</title>
61287 <indexterm role="concept">
61288 <primary>source routing</primary>
61289 <secondary>in IP packets</secondary>
61291 <indexterm role="concept">
61292 <primary>IP source routing</primary>
61294 Many operating systems suppress IP source-routed packets in the kernel, but
61295 some cannot be made to do this, so Exim does its own check. It logs incoming
61296 IPv4 source-routed TCP calls, and then drops them. Things are all different in
61297 IPv6. No special checking is currently done.
61300 <section id="SECID273">
61301 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
61303 Support for these SMTP commands is disabled by default. If required, they can
61304 be enabled by defining suitable ACLs.
61307 <section id="SECID274">
61308 <title>Privileged users</title>
61310 <indexterm role="concept">
61311 <primary>trusted users</primary>
61313 <indexterm role="concept">
61314 <primary>admin user</primary>
61316 <indexterm role="concept">
61317 <primary>privileged user</primary>
61319 <indexterm role="concept">
61320 <primary>user</primary>
61321 <secondary>trusted</secondary>
61323 <indexterm role="concept">
61324 <primary>user</primary>
61325 <secondary>admin</secondary>
61327 Exim recognizes two sets of users with special privileges. Trusted users are
61328 able to submit new messages to Exim locally, but supply their own sender
61329 addresses and information about a sending host. For other users submitting
61330 local messages, Exim sets up the sender address from the uid, and doesn’t
61331 permit a remote host to be specified.
61334 <indexterm role="option">
61335 <primary><option>-f</option></primary>
61337 However, an untrusted user is permitted to use the <option>-f</option> command line option
61338 in the special form <option>-f <></option> to indicate that a delivery failure for the
61339 message should not cause an error report. This affects the message’s envelope,
61340 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
61341 permitted to use specific forms of address with the <option>-f</option> option by setting
61342 the <option>untrusted_set_sender</option> option.
61345 Trusted users are used to run processes that receive mail messages from some
61346 other mail domain and pass them on to Exim for delivery either locally, or over
61347 the Internet. Exim trusts a caller that is running as root, as the Exim user,
61348 as any user listed in the <option>trusted_users</option> configuration option, or under any
61349 group listed in the <option>trusted_groups</option> option.
61352 Admin users are permitted to do things to the messages on Exim’s queue. They
61353 can freeze or thaw messages, cause them to be returned to their senders, remove
61354 them entirely, or modify them in various ways. In addition, admin users can run
61355 the Exim monitor and see all the information it is capable of providing, which
61356 includes the contents of files on the spool.
61359 <indexterm role="option">
61360 <primary><option>-M</option></primary>
61362 <indexterm role="option">
61363 <primary><option>-q</option></primary>
61365 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
61366 delivery of messages on its queue is restricted to admin users. This
61367 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
61368 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
61369 queue is also restricted to admin users. This restriction can be relaxed by
61370 setting <option>no_queue_list_requires_admin</option>.
61373 Exim recognizes an admin user if the calling process is running as root or as
61374 the Exim user or if any of the groups associated with the calling process is
61375 the Exim group. It is not necessary actually to be running under the Exim
61376 group. However, if admin users who are not root or the Exim user are to access
61377 the contents of files on the spool via the Exim monitor (which runs
61378 unprivileged), Exim must be built to allow group read access to its spool
61382 <section id="SECID275">
61383 <title>Spool files</title>
61385 <indexterm role="concept">
61386 <primary>spool directory</primary>
61387 <secondary>files</secondary>
61389 Exim’s spool directory and everything it contains is owned by the Exim user and
61390 set to the Exim group. The mode for spool files is defined in the
61391 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
61392 any user who is a member of the Exim group can access these files.
61395 <section id="SECID276">
61396 <title>Use of argv[0]</title>
61398 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
61399 of specific strings, Exim assumes certain options. For example, calling Exim
61400 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
61401 to calling it with the option <option>-bS</option>. There are no security implications in
61405 <section id="SECID277">
61406 <title>Use of %f formatting</title>
61408 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
61409 are actually stored in integer variables as 1000 times the load average.
61410 Consequently, their range is limited and so therefore is the length of the
61414 <section id="SECID278">
61415 <title>Embedded Exim path</title>
61417 Exim uses its own path name, which is embedded in the code, only when it needs
61418 to re-exec in order to regain root privilege. Therefore, it is not root when it
61419 does so. If some bug allowed the path to get overwritten, it would lead to an
61420 arbitrary program’s being run as exim, not as root.
61423 <section id="SECTdynmoddir" revisionflag="changed">
61424 <title>Dynamic module directory</title>
61425 <para revisionflag="changed">
61426 Any dynamically loadable modules must be installed into the directory
61427 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
61431 <section id="SECID279">
61432 <title>Use of sprintf()</title>
61434 <indexterm role="concept">
61435 <primary><function>sprintf()</function></primary>
61437 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
61438 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc’d store.
61439 The intermediate formatting is done into a large fixed buffer by a function
61440 that runs through the format string itself, and checks the length of each
61441 conversion before performing it, thus preventing buffer overruns.
61444 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
61445 the output buffer is known to be sufficiently long to contain the converted
61449 <section id="SECID280">
61450 <title>Use of debug_printf() and log_write()</title>
61452 Arbitrary strings are passed to both these functions, but they do their
61453 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
61454 the format string itself, and checks the length of each conversion.
61457 <section id="SECID281">
61458 <title>Use of strcat() and strcpy()</title>
61460 These are used only in cases where the output buffer is known to be large
61461 enough to hold the result.
61462 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
61467 <chapter id="CHAPspool">
61468 <title>Format of spool files</title>
61470 <indexterm role="concept" id="IIDforspo1" class="startofrange">
61471 <primary>format</primary>
61472 <secondary>spool files</secondary>
61474 <indexterm role="concept" id="IIDforspo2" class="startofrange">
61475 <primary>spool directory</primary>
61476 <secondary>format of files</secondary>
61478 <indexterm role="concept" id="IIDforspo3" class="startofrange">
61479 <primary>spool files</primary>
61480 <secondary>format of</secondary>
61482 <indexterm role="concept">
61483 <primary>spool files</primary>
61484 <secondary>editing</secondary>
61486 A message on Exim’s queue consists of two files, whose names are the message id
61487 followed by -D and -H, respectively. The data portion of the message is kept in
61488 the -D file on its own. The message’s envelope, status, and headers are all
61489 kept in the -H file, whose format is described in this chapter. Each of these
61490 two files contains the final component of its own name as its first line. This
61491 is insurance against disk crashes where the directory is lost but the files
61492 themselves are recoverable.
61495 Some people are tempted into editing -D files in order to modify messages. You
61496 need to be extremely careful if you do this; it is not recommended and you are
61497 on your own if you do it. Here are some of the pitfalls:
61502 You must ensure that Exim does not try to deliver the message while you are
61503 fiddling with it. The safest way is to take out a write lock on the -D file,
61504 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
61505 place, the lock will be retained. If you write a new file and rename it, the
61506 lock will be lost at the instant of rename.
61511 <indexterm role="variable">
61512 <primary><varname>$body_linecount</varname></primary>
61514 If you change the number of lines in the file, the value of
61515 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
61516 present, this value is not used by Exim, but there is no guarantee that this
61517 will always be the case.
61522 If the message is in MIME format, you must take care not to break it.
61527 If the message is cryptographically signed, any change will invalidate the
61533 All in all, modifying -D files is fraught with danger.
61536 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
61537 its subdirectories when <option>split_spool_directory</option> is set). These are journal
61538 files, used to record addresses to which the message has been delivered during
61539 the course of a delivery attempt. If there are still undelivered recipients at
61540 the end, the -H file is updated, and the -J file is deleted. If, however, there
61541 is some kind of crash (for example, a power outage) before this happens, the -J
61542 file remains in existence. When Exim next processes the message, it notices the
61543 -J file and uses it to update the -H file before starting the next delivery
61546 <section id="SECID282">
61547 <title>Format of the -H file</title>
61549 <indexterm role="concept">
61550 <primary>uid (user id)</primary>
61551 <secondary>in spool file</secondary>
61553 <indexterm role="concept">
61554 <primary>gid (group id)</primary>
61555 <secondary>in spool file</secondary>
61557 The second line of the -H file contains the login name for the uid of the
61558 process that called Exim to read the message, followed by the numerical uid and
61559 gid. For a locally generated message, this is normally the user who sent the
61560 message. For a message received over TCP/IP via the daemon, it is
61561 normally the Exim user.
61564 The third line of the file contains the address of the message’s sender as
61565 transmitted in the envelope, contained in angle brackets. The sender address is
61566 empty for bounce messages. For incoming SMTP mail, the sender address is given
61567 in the MAIL command. For locally generated mail, the sender address is
61568 created by Exim from the login name of the current user and the configured
61569 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
61570 leading <quote>From </quote> line if the caller is trusted, or if the supplied address is
61571 <quote><></quote> or an address that matches <option>untrusted_set_senders</option>.
61574 The fourth line contains two numbers. The first is the time that the message
61575 was received, in the conventional Unix form – the number of seconds since the
61576 start of the epoch. The second number is a count of the number of messages
61577 warning of delayed delivery that have been sent to the sender.
61580 There follow a number of lines starting with a hyphen. These can appear in any
61581 order, and are omitted when not relevant:
61585 <term><option>-acl</option> <<emphasis>number</emphasis>> <<emphasis>length</emphasis>></term>
61588 This item is obsolete, and is not generated from Exim release 4.61 onwards;
61589 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
61590 recognized, to provide backward compatibility. In the old format, a line of
61591 this form is present for every ACL variable that is not empty. The number
61592 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0–9 and
61593 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10–19. The length is the length of
61594 the data string for the variable. The string itself starts at the beginning of
61595 the next line, and is followed by a newline character. It may contain internal
61598 </listitem></varlistentry>
61600 <term><option>-aclc</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61603 A line of this form is present for every ACL connection variable that is
61604 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
61605 The length is the length of the data string for the variable. The string itself
61606 starts at the beginning of the next line, and is followed by a newline
61607 character. It may contain internal newlines.
61609 </listitem></varlistentry>
61611 <term><option>-aclm</option> <<emphasis>rest-of-name</emphasis>> <<emphasis>length</emphasis>></term>
61614 A line of this form is present for every ACL message variable that is defined.
61615 Note that there is a space between <option>-aclm</option> and the rest of the name. The
61616 length is the length of the data string for the variable. The string itself
61617 starts at the beginning of the next line, and is followed by a newline
61618 character. It may contain internal newlines.
61620 </listitem></varlistentry>
61622 <term><option>-active_hostname</option> <<emphasis>hostname</emphasis>></term>
61625 This is present if, when the message was received over SMTP, the value of
61626 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
61628 </listitem></varlistentry>
61630 <term><option>-allow_unqualified_recipient</option></term>
61633 This is present if unqualified recipient addresses are permitted in header
61634 lines (to stop such addresses from being qualified if rewriting occurs at
61635 transport time). Local messages that were input using <option>-bnq</option> and remote
61636 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
61638 </listitem></varlistentry>
61640 <term><option>-allow_unqualified_sender</option></term>
61643 This is present if unqualified sender addresses are permitted in header lines
61644 (to stop such addresses from being qualified if rewriting occurs at transport
61645 time). Local messages that were input using <option>-bnq</option> and remote messages from
61646 hosts that match <option>sender_unqualified_hosts</option> set this flag.
61648 </listitem></varlistentry>
61650 <term><option>-auth_id</option> <<emphasis>text</emphasis>></term>
61653 The id information for a message received on an authenticated SMTP connection
61654 – the value of the <varname>$authenticated_id</varname> variable.
61656 </listitem></varlistentry>
61658 <term><option>-auth_sender</option> <<emphasis>address</emphasis>></term>
61661 The address of an authenticated sender – the value of the
61662 <varname>$authenticated_sender</varname> variable.
61664 </listitem></varlistentry>
61666 <term><option>-body_linecount</option> <<emphasis>number</emphasis>></term>
61669 This records the number of lines in the body of the message, and is always
61672 </listitem></varlistentry>
61674 <term><option>-body_zerocount</option> <<emphasis>number</emphasis>></term>
61677 This records the number of binary zero bytes in the body of the message, and is
61678 present if the number is greater than zero.
61680 </listitem></varlistentry>
61682 <term><option>-deliver_firsttime</option></term>
61685 This is written when a new message is first added to the spool. When the spool
61686 file is updated after a deferral, it is omitted.
61688 </listitem></varlistentry>
61690 <term><option>-frozen</option> <<emphasis>time</emphasis>></term>
61693 <indexterm role="concept">
61694 <primary>frozen messages</primary>
61695 <secondary>spool data</secondary>
61697 The message is frozen, and the freezing happened at <<emphasis>time</emphasis>>.
61699 </listitem></varlistentry>
61701 <term><option>-helo_name</option> <<emphasis>text</emphasis>></term>
61704 This records the host name as specified by a remote host in a HELO or EHLO
61707 </listitem></varlistentry>
61709 <term><option>-host_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61712 This records the IP address of the host from which the message was received and
61713 the remote port number that was used. It is omitted for locally generated
61716 </listitem></varlistentry>
61718 <term><option>-host_auth</option> <<emphasis>text</emphasis>></term>
61721 If the message was received on an authenticated SMTP connection, this records
61722 the name of the authenticator – the value of the
61723 <varname>$sender_host_authenticated</varname> variable.
61725 </listitem></varlistentry>
61727 <term><option>-host_lookup_failed</option></term>
61730 This is present if an attempt to look up the sending host’s name from its IP
61731 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
61733 </listitem></varlistentry>
61735 <term><option>-host_name</option> <<emphasis>text</emphasis>></term>
61738 <indexterm role="concept">
61739 <primary>reverse DNS lookup</primary>
61741 <indexterm role="concept">
61742 <primary>DNS</primary>
61743 <secondary>reverse lookup</secondary>
61745 This records the name of the remote host from which the message was received,
61746 if the host name was looked up from the IP address when the message was being
61747 received. It is not present if no reverse lookup was done.
61749 </listitem></varlistentry>
61751 <term><option>-ident</option> <<emphasis>text</emphasis>></term>
61754 For locally submitted messages, this records the login of the originating user,
61755 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
61756 ident value. For messages received over TCP/IP, this records the ident string
61757 supplied by the remote host, if any.
61759 </listitem></varlistentry>
61761 <term><option>-interface_address</option> <<emphasis>address</emphasis>>.<<emphasis>port</emphasis>></term>
61764 This records the IP address of the local interface and the port number through
61765 which a message was received from a remote host. It is omitted for locally
61766 generated messages.
61768 </listitem></varlistentry>
61770 <term><option>-local</option></term>
61773 The message is from a local sender.
61775 </listitem></varlistentry>
61777 <term><option>-localerror</option></term>
61780 The message is a locally-generated bounce message.
61782 </listitem></varlistentry>
61784 <term><option>-local_scan</option> <<emphasis>string</emphasis>></term>
61787 This records the data string that was returned by the <function>local_scan()</function> function
61788 when the message was received – the value of the <varname>$local_scan_data</varname>
61789 variable. It is omitted if no data was returned.
61791 </listitem></varlistentry>
61793 <term><option>-manual_thaw</option></term>
61796 The message was frozen but has been thawed manually, that is, by an explicit
61797 Exim command rather than via the auto-thaw process.
61799 </listitem></varlistentry>
61801 <term><option>-N</option></term>
61804 A testing delivery process was started using the <option>-N</option> option to suppress any
61805 actual deliveries, but delivery was deferred. At any further delivery attempts,
61806 <option>-N</option> is assumed.
61808 </listitem></varlistentry>
61810 <term><option>-received_protocol</option></term>
61813 This records the value of the <varname>$received_protocol</varname> variable, which contains
61814 the name of the protocol by which the message was received.
61816 </listitem></varlistentry>
61818 <term><option>-sender_set_untrusted</option></term>
61821 The envelope sender of this message was set by an untrusted local caller (used
61822 to ensure that the caller is displayed in queue listings).
61824 </listitem></varlistentry>
61826 <term><option>-spam_score_int</option> <<emphasis>number</emphasis>></term>
61829 If a message was scanned by SpamAssassin, this is present. It records the value
61830 of <varname>$spam_score_int</varname>.
61832 </listitem></varlistentry>
61834 <term><option>-tls_certificate_verified</option></term>
61837 A TLS certificate was received from the client that sent this message, and the
61838 certificate was verified by the server.
61840 </listitem></varlistentry>
61842 <term><option>-tls_cipher</option> <<emphasis>cipher name</emphasis>></term>
61845 When the message was received over an encrypted connection, this records the
61846 name of the cipher suite that was used.
61848 </listitem></varlistentry>
61850 <term><option>-tls_peerdn</option> <<emphasis>peer DN</emphasis>></term>
61853 When the message was received over an encrypted connection, and a certificate
61854 was received from the client, this records the Distinguished Name from that
61857 </listitem></varlistentry>
61860 Following the options there is a list of those addresses to which the message
61861 is not to be delivered. This set of addresses is initialized from the command
61862 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
61863 is set; otherwise it starts out empty. Whenever a successful delivery is made,
61864 the address is added to this set. The addresses are kept internally as a
61865 balanced binary tree, and it is a representation of that tree which is written
61866 to the spool file. If an address is expanded via an alias or forward file, the
61867 original address is added to the tree when deliveries to all its child
61868 addresses are complete.
61871 If the tree is empty, there is a single line in the spool file containing just
61872 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
61873 Y or N, followed by an address. The address is the value for the node of the
61874 tree, and the letters indicate whether the node has a left branch and/or a
61875 right branch attached to it, respectively. If branches exist, they immediately
61876 follow. Here is an example of a three-node tree:
61878 <literallayout class="monospaced">
61879 YY darcy@austen.fict.example
61880 NN alice@wonderland.fict.example
61881 NN editor@thesaurus.ref.example
61884 After the non-recipients tree, there is a list of the message’s recipients.
61885 This is a simple list, preceded by a count. It includes all the original
61886 recipients of the message, including those to whom the message has already been
61887 delivered. In the simplest case, the list contains one address per line. For
61890 <literallayout class="monospaced">
61892 editor@thesaurus.ref.example
61893 darcy@austen.fict.example
61895 alice@wonderland.fict.example
61898 However, when a child address has been added to the top-level addresses as a
61899 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
61900 line is of the following form:
61903 <<emphasis>top-level address</emphasis>> <<emphasis>errors_to address</emphasis>> <<emphasis>length</emphasis>>,<<emphasis>parent number</emphasis>>#<<emphasis>flag bits</emphasis>>
61906 The 01 flag bit indicates the presence of the three other fields that follow
61907 the top-level address. Other bits may be used in future to support additional
61908 fields. The <<emphasis>parent number</emphasis>> is the offset in the recipients list of the
61909 original parent of the <quote>one time</quote> address. The first two fields are the
61910 envelope sender that is associated with this address and its length. If the
61911 length is zero, there is no special envelope sender (there are then two space
61912 characters in the line). A non-empty field can arise from a <command>redirect</command> router
61913 that has an <option>errors_to</option> setting.
61916 A blank line separates the envelope and status information from the headers
61917 which follow. A header may occupy several lines of the file, and to save effort
61918 when reading it in, each header is preceded by a number and an identifying
61919 character. The number is the number of characters in the header, including any
61920 embedded newlines and the terminating newline. The character is one of the
61923 <informaltable frame="none">
61924 <tgroup cols="2" colsep="0" rowsep="0">
61925 <colspec colwidth="50pt" align="left"/>
61926 <colspec colwidth="254pt" align="left"/>
61929 <entry><<emphasis>blank</emphasis>></entry>
61930 <entry>header in which Exim has no special interest</entry>
61933 <entry><literal>B</literal></entry>
61934 <entry><emphasis>Bcc:</emphasis> header</entry>
61937 <entry><literal>C</literal></entry>
61938 <entry><emphasis>Cc:</emphasis> header</entry>
61941 <entry><literal>F</literal></entry>
61942 <entry><emphasis>From:</emphasis> header</entry>
61945 <entry><literal>I</literal></entry>
61946 <entry><emphasis>Message-id:</emphasis> header</entry>
61949 <entry><literal>P</literal></entry>
61950 <entry><emphasis>Received:</emphasis> header – P for <quote>postmark</quote></entry>
61953 <entry><literal>R</literal></entry>
61954 <entry><emphasis>Reply-To:</emphasis> header</entry>
61957 <entry><literal>S</literal></entry>
61958 <entry><emphasis>Sender:</emphasis> header</entry>
61961 <entry><literal>T</literal></entry>
61962 <entry><emphasis>To:</emphasis> header</entry>
61965 <entry><literal>*</literal></entry>
61966 <entry>replaced or deleted header</entry>
61972 Deleted or replaced (rewritten) headers remain in the spool file for debugging
61973 purposes. They are not transmitted when the message is delivered. Here is a
61974 typical set of headers:
61976 <literallayout class="monospaced">
61977 111P Received: by hobbit.fict.example with local (Exim 4.00)
61978 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
61979 049 Message-Id: <E14y9EI-00026G-00@hobbit.fict.example>
61980 038* X-rewrote-sender: bb@hobbit.fict.example
61981 042* From: Bilbo Baggins <bb@hobbit.fict.example>
61982 049F From: Bilbo Baggins <B.Baggins@hobbit.fict.example>
61983 099* To: alice@wonderland.fict.example, rdo@foundation,
61984 darcy@austen.fict.example, editor@thesaurus.ref.example
61985 104T To: alice@wonderland.fict.example, rdo@foundation.example,
61986 darcy@austen.fict.example, editor@thesaurus.ref.example
61987 038 Date: Fri, 11 May 2001 10:28:59 +0100
61990 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
61991 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
61992 unqualified domain <emphasis>foundation</emphasis>.
61993 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
61994 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
61995 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
62000 <chapter id="CHID12">
62001 <title>Support for DKIM (DomainKeys Identified Mail) - RFC4871</title>
62002 <titleabbrev>DKIM Support</titleabbrev>
62004 <indexterm role="concept">
62005 <primary>DKIM</primary>
62009 Since version 4.70, DKIM support is compiled into Exim by default. It can be
62010 disabled by setting DISABLE_DKIM=yes in Local/Makefile.
62012 <para revisionflag="changed">
62013 Exim’s DKIM implementation allows to
62015 <orderedlist numeration="arabic" revisionflag="changed">
62017 <para revisionflag="changed">
62018 Sign outgoing messages: This function is implemented in the SMTP transport.
62019 It can co-exist with all other Exim features, including transport filters.
62023 <para revisionflag="changed">
62024 Verify signatures in incoming messages: This is implemented by an additional
62025 ACL (acl_smtp_dkim), which can be called several times per message, with
62026 different signature contexts.
62031 In typical Exim style, the verification implementation does not include any
62032 default "policy". Instead it enables you to build your own policy using
62033 Exim’s standard controls.
62036 Please note that verification of DKIM signatures in incoming mail is turned
62037 on by default for logging purposes. For each signature in incoming email,
62038 exim will log a line displaying the most important signature details, and the
62039 signature status. Here is an example:
62041 <literallayout class="monospaced">
62042 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]
62045 You might want to turn off DKIM verification processing entirely for internal
62046 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
62047 control modifier. This should typically be done in the RCPT ACL, at points
62048 where you accept mail from relay sources (internal hosts or authenticated
62051 <section id="SECID513">
62052 <title>Signing outgoing messages</title>
62054 <indexterm role="concept">
62055 <primary>DKIM</primary>
62056 <secondary>signing</secondary>
62060 Signing is implemented by setting private options on the SMTP transport.
62061 These options take (expandable) strings as arguments.
62063 <para revisionflag="changed">
62064 <indexterm role="option">
62065 <primary><option>dkim_domain</option></primary>
62068 <informaltable frame="all" revisionflag="changed">
62069 <tgroup cols="4" colsep="0" rowsep="0">
62070 <colspec colwidth="8*" align="left"/>
62071 <colspec colwidth="6*" align="center"/>
62072 <colspec colwidth="6*" align="center"/>
62073 <colspec colwidth="6*" align="right"/>
62076 <entry><option>dkim_domain</option></entry>
62077 <entry>Use: <emphasis>smtp</emphasis></entry>
62078 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62079 <entry>Default: <emphasis>unset</emphasis></entry>
62084 <para revisionflag="changed">
62086 The domain you want to sign with. The result of this expanded
62087 option is put into the <option>$dkim_domain</option> expansion variable.
62089 <para revisionflag="changed">
62090 <indexterm role="option">
62091 <primary><option>dkim_selector</option></primary>
62094 <informaltable frame="all" revisionflag="changed">
62095 <tgroup cols="4" colsep="0" rowsep="0">
62096 <colspec colwidth="8*" align="left"/>
62097 <colspec colwidth="6*" align="center"/>
62098 <colspec colwidth="6*" align="center"/>
62099 <colspec colwidth="6*" align="right"/>
62102 <entry><option>dkim_selector</option></entry>
62103 <entry>Use: <emphasis>smtp</emphasis></entry>
62104 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62105 <entry>Default: <emphasis>unset</emphasis></entry>
62110 <para revisionflag="changed">
62112 This sets the key selector string. You can use the <option>$dkim_domain</option> expansion
62113 variable to look up a matching selector. The result is put in the expansion
62114 variable <option>$dkim_selector</option> which should be used in the <option>dkim_private_key</option>
62115 option along with <option>$dkim_domain</option>.
62117 <para revisionflag="changed">
62118 <indexterm role="option">
62119 <primary><option>dkim_private_key</option></primary>
62122 <informaltable frame="all" revisionflag="changed">
62123 <tgroup cols="4" colsep="0" rowsep="0">
62124 <colspec colwidth="8*" align="left"/>
62125 <colspec colwidth="6*" align="center"/>
62126 <colspec colwidth="6*" align="center"/>
62127 <colspec colwidth="6*" align="right"/>
62130 <entry><option>dkim_private_key</option></entry>
62131 <entry>Use: <emphasis>smtp</emphasis></entry>
62132 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62133 <entry>Default: <emphasis>unset</emphasis></entry>
62138 <para revisionflag="changed">
62140 This sets the private key to use. You can use the <option>$dkim_domain</option> and
62141 <option>$dkim_selector</option> expansion variables to determine the private key to use.
62142 The result can either
62144 <itemizedlist revisionflag="changed">
62146 <para revisionflag="changed">
62147 be a valid RSA private key in ASCII armor, including line breaks.
62151 <para revisionflag="changed">
62152 start with a slash, in which case it is treated as a file that contains
62157 <para revisionflag="changed">
62158 be "0", "false" or the empty string, in which case the message will not
62159 be signed. This case will not result in an error, even if <option>dkim_strict</option>
62164 <para revisionflag="changed">
62165 <indexterm role="option">
62166 <primary><option>dkim_canon</option></primary>
62169 <informaltable frame="all" revisionflag="changed">
62170 <tgroup cols="4" colsep="0" rowsep="0">
62171 <colspec colwidth="8*" align="left"/>
62172 <colspec colwidth="6*" align="center"/>
62173 <colspec colwidth="6*" align="center"/>
62174 <colspec colwidth="6*" align="right"/>
62177 <entry><option>dkim_canon</option></entry>
62178 <entry>Use: <emphasis>smtp</emphasis></entry>
62179 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62180 <entry>Default: <emphasis>unset</emphasis></entry>
62185 <para revisionflag="changed">
62187 This option sets the canonicalization method used when signing a message.
62188 The DKIM RFC currently supports two methods: "simple" and "relaxed".
62189 The option defaults to "relaxed" when unset. Note: the current implementation
62190 only supports using the same canonicalization method for both headers and body.
62192 <para revisionflag="changed">
62193 <indexterm role="option">
62194 <primary><option>dkim_strict</option></primary>
62197 <informaltable frame="all" revisionflag="changed">
62198 <tgroup cols="4" colsep="0" rowsep="0">
62199 <colspec colwidth="8*" align="left"/>
62200 <colspec colwidth="6*" align="center"/>
62201 <colspec colwidth="6*" align="center"/>
62202 <colspec colwidth="6*" align="right"/>
62205 <entry><option>dkim_strict</option></entry>
62206 <entry>Use: <emphasis>smtp</emphasis></entry>
62207 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62208 <entry>Default: <emphasis>unset</emphasis></entry>
62213 <para revisionflag="changed">
62215 This option defines how Exim behaves when signing a message that
62216 should be signed fails for some reason. When the expansion evaluates to
62217 either "1" or "true", Exim will defer. Otherwise Exim will send the message
62218 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
62221 <para revisionflag="changed">
62222 <indexterm role="option">
62223 <primary><option>dkim_sign_headers</option></primary>
62226 <informaltable frame="all" revisionflag="changed">
62227 <tgroup cols="4" colsep="0" rowsep="0">
62228 <colspec colwidth="8*" align="left"/>
62229 <colspec colwidth="6*" align="center"/>
62230 <colspec colwidth="6*" align="center"/>
62231 <colspec colwidth="6*" align="right"/>
62234 <entry><option>dkim_sign_headers</option></entry>
62235 <entry>Use: <emphasis>smtp</emphasis></entry>
62236 <entry>Type: <emphasis>string</emphasis>†<emphasis></emphasis></entry>
62237 <entry>Default: <emphasis>unset</emphasis></entry>
62242 <para revisionflag="changed">
62244 When set, this option must expand to (or be specified as) a colon-separated
62245 list of header names. Headers with these names will be included in the message
62246 signature. When unspecified, the header names recommended in RFC4871 will be
62250 <section id="SECID514">
62251 <title>Verifying DKIM signatures in incoming mail</title>
62253 <indexterm role="concept">
62254 <primary>DKIM</primary>
62255 <secondary>verification</secondary>
62259 Verification of DKIM signatures in incoming email is implemented via the
62260 <option>acl_smtp_dkim</option> ACL. By default, this ACL is called once for each
62261 syntactically(!) correct signature in the incoming message.
62264 To evaluate the signature in the ACL a large number of expansion variables
62265 containing the signature status and its details are set up during the
62266 runtime of the ACL.
62269 Calling the ACL only for existing signatures is not sufficient to build
62270 more advanced policies. For that reason, the global option
62271 <option>dkim_verify_signers</option>, and a global expansion variable
62272 <option>$dkim_signers</option> exist.
62274 <para revisionflag="changed">
62275 The global option <option>dkim_verify_signers</option> can be set to a colon-separated
62276 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
62277 called. It is expanded when the message has been received. At this point,
62278 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
62279 list of signer domains and identities for the message. When
62280 <option>dkim_verify_signers</option> is not specified in the main configuration,
62283 <literallayout class="monospaced" revisionflag="changed">
62284 dkim_verify_signers = $dkim_signers
62286 <para revisionflag="changed">
62287 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
62288 DKIM signature in the message. Current DKIM verifiers may want to explicitly
62289 call the ACL for known domains or identities. This would be achieved as follows:
62291 <literallayout class="monospaced" revisionflag="changed">
62292 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
62294 <para revisionflag="changed">
62295 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
62296 and "ebay.com", plus all domains and identities that have signatures in the message.
62297 You can also be more creative in constructing your policy. For example:
62299 <literallayout class="monospaced" revisionflag="changed">
62300 dkim_verify_signers = $sender_address_domain:$dkim_signers
62303 If a domain or identity is listed several times in the (expanded) value of
62304 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
62307 Inside the <option>acl_smtp_dkim</option>, the following expansion variables are
62308 available (from most to least important):
62310 <variablelist revisionflag="changed">
62311 <varlistentry revisionflag="changed">
62312 <term><option>$dkim_cur_signer</option></term>
62314 <para revisionflag="changed">
62315 The signer that is being evaluated in this ACL run. This can be a domain or
62316 an identity. This is one of the list items from the expanded main option
62317 <option>dkim_verify_signers</option> (see above).
62319 </listitem></varlistentry>
62320 <varlistentry revisionflag="changed">
62321 <term><option>$dkim_verify_status</option></term>
62323 <para revisionflag="changed">
62324 A string describing the general status of the signature. One of
62326 <itemizedlist revisionflag="changed">
62328 <para revisionflag="changed">
62329 <option>none</option>: There is no signature in the message for the current domain or
62330 identity (as reflected by <option>$dkim_cur_signer</option>).
62334 <para revisionflag="changed">
62335 <option>invalid</option>: The signature could not be verified due to a processing error.
62336 More detail is available in <option>$dkim_verify_reason</option>.
62340 <para revisionflag="changed">
62341 <option>fail</option>: Verification of the signature failed. More detail is
62342 available in <option>$dkim_verify_reason</option>.
62346 <para revisionflag="changed">
62347 <option>pass</option>: The signature passed verification. It is valid.
62351 </listitem></varlistentry>
62352 <varlistentry revisionflag="changed">
62353 <term><option>$dkim_verify_reason</option></term>
62355 <para revisionflag="changed">
62356 A string giving a litte bit more detail when <option>$dkim_verify_status</option> is either
62357 "fail" or "invalid". One of
62359 <itemizedlist revisionflag="changed">
62361 <para revisionflag="changed">
62362 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
62363 key for the domain could not be retrieved. This may be a temporary problem.
62367 <para revisionflag="changed">
62368 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
62369 record for the domain is syntactically invalid.
62373 <para revisionflag="changed">
62374 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
62375 body hash does not match the one specified in the signature header. This
62376 means that the message body was modified in transit.
62380 <para revisionflag="changed">
62381 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
62382 could not be verified. This may mean that headers were modified,
62383 re-written or otherwise changed in a way which is incompatible with
62384 DKIM verification. It may of course also mean that the signature is forged.
62388 </listitem></varlistentry>
62389 <varlistentry revisionflag="changed">
62390 <term><option>$dkim_domain</option></term>
62392 <para revisionflag="changed">
62393 The signing domain. IMPORTANT: This variable is only populated if there is
62394 an actual signature in the message for the current domain or identity (as
62395 reflected by <option>$dkim_cur_signer</option>).
62397 </listitem></varlistentry>
62398 <varlistentry revisionflag="changed">
62399 <term><option>$dkim_identity</option></term>
62401 <para revisionflag="changed">
62402 The signing identity, if present. IMPORTANT: This variable is only populated
62403 if there is an actual signature in the message for the current domain or
62404 identity (as reflected by <option>$dkim_cur_signer</option>).
62406 </listitem></varlistentry>
62407 <varlistentry revisionflag="changed">
62408 <term><option>$dkim_selector</option></term>
62410 <para revisionflag="changed">
62411 The key record selector string.
62413 </listitem></varlistentry>
62414 <varlistentry revisionflag="changed">
62415 <term><option>$dkim_algo</option></term>
62417 <para revisionflag="changed">
62418 The algorithm used. One of ’rsa-sha1’ or ’rsa-sha256’.
62420 </listitem></varlistentry>
62421 <varlistentry revisionflag="changed">
62422 <term><option>$dkim_canon_body</option></term>
62424 <para revisionflag="changed">
62425 The body canonicalization method. One of ’relaxed’ or ’simple’.
62427 </listitem></varlistentry>
62428 <varlistentry revisionflag="changed">
62429 <term><option>dkim_canon_headers</option></term>
62431 <para revisionflag="changed">
62432 The header canonicalization method. One of ’relaxed’ or ’simple’.
62434 </listitem></varlistentry>
62435 <varlistentry revisionflag="changed">
62436 <term><option>$dkim_copiedheaders</option></term>
62438 <para revisionflag="changed">
62439 A transcript of headers and their values which are included in the signature
62440 (copied from the ’z=’ tag of the signature).
62442 </listitem></varlistentry>
62443 <varlistentry revisionflag="changed">
62444 <term><option>$dkim_bodylength</option></term>
62446 <para revisionflag="changed">
62447 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
62448 limit was set by the signer, "9999999999999" is returned. This makes sure
62449 that this variable always expands to an integer value.
62451 </listitem></varlistentry>
62452 <varlistentry revisionflag="changed">
62453 <term><option>$dkim_created</option></term>
62455 <para revisionflag="changed">
62456 UNIX timestamp reflecting the date and time when the signature was created.
62457 When this was not specified by the signer, "0" is returned.
62459 </listitem></varlistentry>
62460 <varlistentry revisionflag="changed">
62461 <term><option>$dkim_expires</option></term>
62463 <para revisionflag="changed">
62464 UNIX timestamp reflecting the date and time when the signer wants the
62465 signature to be treated as "expired". When this was not specified by the
62466 signer, "9999999999999" is returned. This makes it possible to do useful
62467 integer size comparisons against this value.
62469 </listitem></varlistentry>
62470 <varlistentry revisionflag="changed">
62471 <term><option>$dkim_headernames</option></term>
62473 <para revisionflag="changed">
62474 A colon-separated list of names of headers included in the signature.
62476 </listitem></varlistentry>
62477 <varlistentry revisionflag="changed">
62478 <term><option>$dkim_key_testing</option></term>
62480 <para revisionflag="changed">
62481 "1" if the key record has the "testing" flag set, "0" if not.
62483 </listitem></varlistentry>
62484 <varlistentry revisionflag="changed">
62485 <term><option>$dkim_key_nosubdomaining</option></term>
62487 <para revisionflag="changed">
62488 "1" if the key record forbids subdomaining, "0" otherwise.
62490 </listitem></varlistentry>
62491 <varlistentry revisionflag="changed">
62492 <term><option>$dkim_key_srvtype</option></term>
62494 <para revisionflag="changed">
62495 Service type (tag s=) from the key record. Defaults to "*" if not specified
62498 </listitem></varlistentry>
62499 <varlistentry revisionflag="changed">
62500 <term><option>$dkim_key_granularity</option></term>
62502 <para revisionflag="changed">
62503 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
62506 </listitem></varlistentry>
62507 <varlistentry revisionflag="changed">
62508 <term><option>$dkim_key_notes</option></term>
62510 <para revisionflag="changed">
62511 Notes from the key record (tag n=).
62513 </listitem></varlistentry>
62516 In addition, two ACL conditions are provided:
62518 <variablelist revisionflag="changed">
62519 <varlistentry revisionflag="changed">
62520 <term><option>dkim_signers</option></term>
62522 <para revisionflag="changed">
62523 ACL condition that checks a colon-separated list of domains or identities
62524 for a match against the domain or identity that the ACL is currently verifying
62525 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
62526 verb to a group of domains or identities. For example:
62528 <literallayout class="monospaced">
62529 # Warn when message apparently from GMail has no signature at all
62530 warn log_message = GMail sender without DKIM signature
62531 sender_domains = gmail.com
62532 dkim_signers = gmail.com
62535 </listitem></varlistentry>
62537 <term><option>dkim_status</option></term>
62540 ACL condition that checks a colon-separated list of possible DKIM verification
62541 results agains the actual result of verification. This is typically used
62542 to restrict an ACL verb to a list of verification outcomes, like:
62544 <literallayout class="monospaced">
62545 deny message = Message from Paypal with invalid or missing signature
62546 sender_domains = paypal.com:paypal.de
62547 dkim_signers = paypal.com:paypal.de
62548 dkim_status = none:invalid:fail
62551 The possible status keywords are: ’none’,’invalid’,’fail’ and ’pass’. Please
62552 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
62553 for more information of what they mean.
62555 </listitem></varlistentry>
62560 <chapter id="CHID13">
62561 <title>Adding new drivers or lookup types</title>
62562 <titleabbrev>Adding drivers or lookups</titleabbrev>
62564 <indexterm role="concept">
62565 <primary>adding drivers</primary>
62567 <indexterm role="concept">
62568 <primary>new drivers, adding</primary>
62570 <indexterm role="concept">
62571 <primary>drivers</primary>
62572 <secondary>adding new</secondary>
62574 The following actions have to be taken in order to add a new router, transport,
62575 authenticator, or lookup type to Exim:
62577 <orderedlist numeration="arabic">
62580 Choose a name for the driver or lookup type that does not conflict with any
62581 existing name; I will use <quote>newdriver</quote> in what follows.
62586 Add to <filename>src/EDITME</filename> the line:
62589 <<emphasis>type</emphasis>><literal>_NEWDRIVER=yes</literal>
62592 where <<emphasis>type</emphasis>> is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
62593 code is not to be included in the binary by default, comment this line out. You
62594 should also add any relevant comments about the driver or lookup type.
62599 Add to <filename>src/config.h.defaults</filename> the line:
62601 <literallayout class="monospaced">
62602 #define <type>_NEWDRIVER
62607 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
62608 and create a table entry as is done for all the other drivers and lookup types.
62613 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
62614 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
62615 driver or lookup type and add it to the definition of OBJ.
62620 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
62621 <filename>src</filename>.
62626 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
62627 as for other drivers and lookups.
62632 Then all you need to do is write the code! A good way to start is to make a
62633 proforma by copying an existing module of the same type, globally changing all
62634 occurrences of the name, and cutting out most of the code. Note that any
62635 options you create must be listed in alphabetical order, because the tables are
62636 searched using a binary chop procedure.
62639 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
62640 the interface that is expected.
62644 foot_right_recto="&chaptertitle;"
62645 foot_right_verso="&chaptertitle;"
62649 <index role="option">
62650 <title>Options index</title>
62653 <index role="variable">
62654 <title>Variables index</title>
62657 <index role="concept">
62658 <title>Concept index</title>