chg: mention CVE for 3.97.1
[exim-website.git] / docbook / 4.64 / spec.xml
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">
3 <book>
4 <?sdop
5   toc_chapter_blanks="yes,yes"
6   table_warn_soft_overflow="no"
7 ?>
8 <bookinfo>
9 <title>Specification of the Exim Mail Transfer Agent</title>
10 <titleabbrev>The Exim MTA</titleabbrev>
11 <date>11 December 2006</date>
12 <author><firstname>Philip</firstname><surname>Hazel</surname></author>
13 <authorinitials>PH</authorinitials>
14 <affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
15 <address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
16 <revhistory><revision>
17   <revnumber>4.64</revnumber>
18   <date>11 December 2006</date>
19   <authorinitials>PH</authorinitials>
20 </revision></revhistory>
21 <copyright><year>2006</year><holder>University of Cambridge</holder></copyright>
22 </bookinfo>
23 <chapter>
24 <title>Introduction</title>
25
26 <indexterm role="concept">
27   <primary>$1, $2, etc.</primary>
28   <see><emphasis>numerical variables</emphasis></see>
29 </indexterm>
30 <indexterm role="concept">
31   <primary>address</primary>
32   <secondary>rewriting</secondary>
33   <see><emphasis>rewriting</emphasis></see>
34 </indexterm>
35 <indexterm role="concept">
36   <primary>Bounce Address Tag Validation</primary>
37   <see><emphasis>BATV</emphasis></see>
38 </indexterm>
39 <indexterm role="concept">
40   <primary>Client SMTP Authorization</primary>
41   <see><emphasis>CSA</emphasis></see>
42 </indexterm>
43 <indexterm role="concept">
44   <primary>CR character</primary>
45   <see><emphasis>carriage return</emphasis></see>
46 </indexterm>
47 <indexterm role="concept">
48   <primary>CRL</primary>
49   <see><emphasis>certificate revocation list</emphasis></see>
50 </indexterm>
51 <indexterm role="concept">
52   <primary>delivery</primary>
53   <secondary>failure report</secondary>
54   <see><emphasis>bounce message</emphasis></see>
55 </indexterm>
56 <indexterm role="concept">
57   <primary>dialup</primary>
58   <see><emphasis>intermittently connected hosts</emphasis></see>
59 </indexterm>
60 <indexterm role="concept">
61   <primary>exiscan</primary>
62   <see><emphasis>content scanning</emphasis></see>
63 </indexterm>
64 <indexterm role="concept">
65   <primary>failover</primary>
66   <see><emphasis>fallback</emphasis></see>
67 </indexterm>
68 <indexterm role="concept">
69   <primary>fallover</primary>
70   <see><emphasis>fallback</emphasis></see>
71 </indexterm>
72 <indexterm role="concept">
73   <primary>filter</primary>
74   <secondary>Sieve</secondary>
75   <see><emphasis>Sieve filter</emphasis></see>
76 </indexterm>
77 <indexterm role="concept">
78   <primary>ident</primary>
79   <see><emphasis>RFC 1413</emphasis></see>
80 </indexterm>
81 <indexterm role="concept">
82   <primary>LF character</primary>
83   <see><emphasis>linefeed</emphasis></see>
84 </indexterm>
85 <indexterm role="concept">
86   <primary>maximum</primary>
87   <see><emphasis>limit</emphasis></see>
88 </indexterm>
89 <indexterm role="concept">
90   <primary>monitor</primary>
91   <see><emphasis>Exim monitor</emphasis></see>
92 </indexterm>
93 <indexterm role="concept">
94   <primary>no_<emphasis>xxx</emphasis></primary>
95   <see>entry for xxx</see>
96 </indexterm>
97 <indexterm role="concept">
98   <primary>NUL</primary>
99   <see><emphasis>binary zero</emphasis></see>
100 </indexterm>
101 <indexterm role="concept">
102   <primary>passwd file</primary>
103   <see><emphasis>/etc/passwd</emphasis></see>
104 </indexterm>
105 <indexterm role="concept">
106   <primary>process id</primary>
107   <see><emphasis>pid</emphasis></see>
108 </indexterm>
109 <indexterm role="concept">
110   <primary>RBL</primary>
111   <see><emphasis>DNS list</emphasis></see>
112 </indexterm>
113 <indexterm role="concept">
114   <primary>redirection</primary>
115   <see><emphasis>address redirection</emphasis></see>
116 </indexterm>
117 <indexterm role="concept">
118   <primary>return path</primary>
119   <seealso><emphasis>envelope sender</emphasis></seealso>
120 </indexterm>
121 <indexterm role="concept">
122   <primary>scanning</primary>
123   <see><emphasis>content scanning</emphasis></see>
124 </indexterm>
125 <indexterm role="concept">
126   <primary>SSL</primary>
127   <see><emphasis>TLS</emphasis></see>
128 </indexterm>
129 <indexterm role="concept">
130   <primary>string</primary>
131   <secondary>expansion</secondary>
132   <see><emphasis>expansion</emphasis></see>
133 </indexterm>
134 <indexterm role="concept">
135   <primary>top bit</primary>
136   <see><emphasis>8-bit characters</emphasis></see>
137 </indexterm>
138 <indexterm role="concept">
139   <primary>variables</primary>
140   <see><emphasis>expansion, variables</emphasis></see>
141 </indexterm>
142 <indexterm role="concept">
143   <primary>zero, binary</primary>
144   <see><emphasis>binary zero</emphasis></see>
145 </indexterm>
146
147 <para>
148 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
149 Unix-like operating systems. It was designed on the assumption that it would be
150 run on hosts that are permanently connected to the Internet. However, it can be
151 used on intermittently connected hosts with suitable configuration adjustments.
152 </para>
153 <para>
154 Configuration files currently exist for the following operating systems: AIX,
155 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
156 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
157 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
158 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
159 Some of these operating systems are no longer current and cannot easily be
160 tested, so the configuration files may no longer work in practice.
161 </para>
162 <para>
163 There are also configuration files for compiling Exim in the Cygwin environment
164 that can be installed on systems running Windows. However, this document does
165 not contain any information about running Exim in the Cygwin environment.
166 </para>
167 <para>
168 The terms and conditions for the use and distribution of Exim are contained in
169 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
170 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
171 </para>
172 <para>
173 The use, supply or promotion of Exim for the purpose of sending bulk,
174 unsolicited electronic mail is incompatible with the basic aims of the program,
175 which revolve around the free provision of a service that enhances the quality
176 of personal communications. The author of Exim regards indiscriminate
177 mass-mailing as an antisocial, irresponsible abuse of the Internet.
178 </para>
179 <para>
180 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
181 experience of running and working on the Smail 3 code, I could never have
182 contemplated starting to write a new MTA. Many of the ideas and user interfaces
183 were originally taken from Smail 3, though the actual code of Exim is entirely
184 new, and has developed far beyond the initial concept.
185 </para>
186 <para>
187 Many people, both in Cambridge and around the world, have contributed to the
188 development and the testing of Exim, and to porting it to various operating
189 systems. I am grateful to them all. The distribution now contains a file called
190 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
191 contributors.
192 </para>
193 <section>
194 <title>Exim documentation</title>
195 <para revisionflag="changed">
196 <indexterm role="concept">
197 <primary>documentation</primary>
198 </indexterm>
199 This edition of the Exim specification applies to version 4.64 of Exim.
200 Substantive changes from the 4.63 edition are marked in some
201 renditions of the document; this paragraph is so marked if the rendition is
202 capable of showing a change indicator.
203 </para>
204 <para>
205 This document is very much a reference manual; it is not a tutorial. The reader
206 is expected to have some familiarity with the SMTP mail transfer protocol and
207 with general Unix system administration. Although there are some discussions
208 and examples in places, the information is mostly organized in a way that makes
209 it easy to look up, rather than in a natural order for sequential reading.
210 Furthermore, the manual aims to cover every aspect of Exim in detail, including
211 a number of rarely-used, special-purpose features that are unlikely to be of
212 very wide interest.
213 </para>
214 <para>
215 <indexterm role="concept">
216 <primary>books about Exim</primary>
217 </indexterm>
218 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
219 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
220 SMTP Mail Server</emphasis>, published by UIT Cambridge
221 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
222 </para>
223 <para>
224 This book also contains a chapter that gives a general introduction to SMTP and
225 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
226 with the latest release of Exim. (Note that the earlier book about Exim,
227 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
228 </para>
229 <para>
230 <indexterm role="concept">
231 <primary>Debian</primary>
232 <secondary>information sources</secondary>
233 </indexterm>
234 If you are using a Debian distribution of Exim, you will find information about
235 Debian-specific features in the file
236 </para>
237 <literallayout>
238 <filename>/usr/share/doc/exim4-base/README.Debian</filename>
239 </literallayout>
240 <para>
241 The command <command>man update-exim.conf</command> is another source of Debian-specific
242 information.
243 </para>
244 <para>
245 <indexterm role="concept">
246 <primary><filename>doc/NewStuff</filename></primary>
247 </indexterm>
248 <indexterm role="concept">
249 <primary><filename>doc/ChangeLog</filename></primary>
250 </indexterm>
251 <indexterm role="concept">
252 <primary>change log</primary>
253 </indexterm>
254 As the program develops, there may be features in newer versions that have not
255 yet made it into this document, which is updated only when the most significant
256 digit of the fractional part of the version number changes. Specifications of
257 new features that are not yet in this manual are placed in the file
258 <filename>doc/NewStuff</filename> in the Exim distribution.
259 </para>
260 <para>
261 Some features may be classified as <quote>experimental</quote>. These may change
262 incompatibly while they are developing, or even be withdrawn. For this reason,
263 they are not documented in this manual. Information about experimental features
264 can be found in the file <filename>doc/experimental.txt</filename>.
265 </para>
266 <para>
267 All changes to the program (whether new features, bug fixes, or other kinds of
268 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
269 </para>
270 <para>
271 <indexterm role="concept">
272 <primary><filename>doc/spec.txt</filename></primary>
273 </indexterm>
274 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
275 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
276 directory are:
277 </para>
278 <informaltable frame="none">
279 <tgroup cols="2" colsep="0" rowsep="0">
280 <colspec colwidth="100pt" align="left"/>
281 <colspec colwidth="254pt" align="left"/>
282 <tbody>
283 <row>
284 <entry><filename>OptionLists.txt</filename></entry>
285 <entry>list of all options in alphabetical order</entry>
286 </row>
287 <row>
288 <entry><filename>dbm.discuss.txt</filename></entry>
289 <entry>discussion about DBM libraries</entry>
290 </row>
291 <row>
292 <entry><filename>exim.8</filename></entry>
293 <entry>a man page of Exim&#x2019;s command line options</entry>
294 </row>
295 <row>
296 <entry><filename>experimental.txt</filename></entry>
297 <entry>documentation of experimental features</entry>
298 </row>
299 <row>
300 <entry><filename>filter.txt</filename></entry>
301 <entry>specification of the filter language</entry>
302 </row>
303 <row>
304 <entry><filename>pcrepattern.txt</filename></entry>
305 <entry>specification of PCRE regular expressions</entry>
306 </row>
307 <row>
308 <entry><filename>pcretest.txt</filename></entry>
309 <entry>specification of the PCRE testing program</entry>
310 </row>
311 <row>
312 <entry><filename>Exim3.upgrade</filename></entry>
313 <entry>upgrade notes from release 2 to release 3</entry>
314 </row>
315 <row>
316 <entry><filename>Exim4.upgrade</filename></entry>
317 <entry>upgrade notes from release 3 to release 4</entry>
318 </row>
319 </tbody>
320 </tgroup>
321 </informaltable>
322 <para>
323 The main specification and the specification of the filtering language are also
324 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
325 <xref linkend="SECTavail"/> below tells you how to get hold of these.
326 </para>
327 </section>
328 <section>
329 <title>FTP and web sites</title>
330 <para>
331 <indexterm role="concept">
332 <primary>web site</primary>
333 </indexterm>
334 <indexterm role="concept">
335 <primary>FTP site</primary>
336 </indexterm>
337 The primary site for Exim source distributions is currently the University of
338 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
339 distribution</emphasis> below. In addition, there is a web site and an FTP site at
340 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
341 <option>exim.org</option> site was previously hosted for a number of years by Energis
342 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
343 </para>
344 <para>
345 <indexterm role="concept">
346 <primary>wiki</primary>
347 </indexterm>
348 <indexterm role="concept">
349 <primary>FAQ</primary>
350 </indexterm>
351 As well as Exim distribution tar files, the Exim web site contains a number of
352 differently formatted versions of the documentation, including the FAQ in both
353 text and HTML formats. The HTML version comes with a keyword-in-context index.
354 A recent addition to the online information is the Exim wiki
355 (<emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/">http://www.exim.org/eximwiki/</ulink></emphasis>). We hope that this will make it easier
356 for Exim users to contribute examples, tips, and know-how for the benefit of
357 others.
358 </para>
359 </section>
360 <section>
361 <title>Mailing lists</title>
362 <para>
363 <indexterm role="concept">
364 <primary>mailing lists</primary>
365 <secondary>for Exim users</secondary>
366 </indexterm>
367 The following are the three main Exim mailing lists:
368 </para>
369 <informaltable frame="none">
370 <tgroup cols="2" colsep="0" rowsep="0">
371 <colspec colwidth="140pt" align="left"/>
372 <colspec colwidth="254pt" align="left"/>
373 <tbody>
374 <row>
375 <entry><emphasis>exim-users@exim.org</emphasis></entry>
376 <entry>general discussion list</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
380 <entry>discussion of bugs, enhancements, etc.</entry>
381 </row>
382 <row>
383 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
384 <entry>moderated, low volume announcements list</entry>
385 </row>
386 </tbody>
387 </tgroup>
388 </informaltable>
389 <para>
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>
395 </indexterm>
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>
398 via this web page:
399 </para>
400 <literallayout>
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>
402 </literallayout>
403 <para>
404 Please ask Debian-specific questions on this list and not on the general Exim
405 lists.
406 </para>
407 </section>
408 <section>
409 <title>Exim training</title>
410 <para>
411 <indexterm role="concept">
412 <primary>training courses</primary>
413 </indexterm>
414 From time to time (approximately annually at the time of writing), training
415 courses are run by the author of Exim in Cambridge, UK. Details of any
416 forthcoming courses can be found on the web site
417 <emphasis role="bold"><ulink url="http://www-tus.csx.cam.ac.uk/courses/exim/">http://www-tus.csx.cam.ac.uk/courses/exim/</ulink></emphasis>.
418 </para>
419 </section>
420 <section>
421 <title>Bug reports</title>
422 <para>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
425 </indexterm>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
428 </indexterm>
429 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
430 are unsure whether some behaviour is a bug or not, the best thing to do is to
431 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
432 </para>
433 </section>
434 <section id="SECTavail">
435 <title>Where to find the Exim distribution</title>
436 <para>
437 <indexterm role="concept">
438 <primary>FTP site</primary>
439 </indexterm>
440 <indexterm role="concept">
441 <primary>distribution</primary>
442 <secondary>ftp site</secondary>
443 </indexterm>
444 The master ftp site for the Exim distribution is
445 </para>
446 <literallayout>
447 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
448 </literallayout>
449 <para>
450 This is mirrored by
451 </para>
452 <literallayout>
453 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
454 </literallayout>
455 <para>
456 The file references that follow are relative to the <filename>exim</filename> directories at
457 these sites. There are now quite a number of independent mirror sites around
458 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
459 </para>
460 <para>
461 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
462 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
463 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
464 subdirectory, the current release can always be found in files called
465 </para>
466 <literallayout>
467 <filename>exim-n.nn.tar.gz</filename>
468 <filename>exim-n.nn.tar.bz2</filename>
469 </literallayout>
470 <para>
471 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
472 files contain identical data; the only difference is the type of compression.
473 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
474 </para>
475 <para>
476 <indexterm role="concept">
477 <primary>distribution</primary>
478 <secondary>signing details</secondary>
479 </indexterm>
480 <indexterm role="concept">
481 <primary>distribution</primary>
482 <secondary>public key</secondary>
483 </indexterm>
484 <indexterm role="concept">
485 <primary>public key for signed distribution</primary>
486 </indexterm>
487 The distributions are currently signed with Philip Hazel&#x2019;s GPG key. The
488 corresponding public key is available from a number of keyservers, and there is
489 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
490 in:
491 </para>
492 <literallayout>
493 <filename>exim-n.nn.tar.gz.sig</filename>
494 <filename>exim-n.nn.tar.bz2.sig</filename>
495 </literallayout>
496 <para>
497 For each released version, the log of changes is made separately available in a
498 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
499 find out what has changed without having to download the entire distribution.
500 </para>
501 <para>
502 <indexterm role="concept">
503 <primary>documentation</primary>
504 <secondary>available formats</secondary>
505 </indexterm>
506 The main distribution contains ASCII versions of this specification and other
507 documentation; other formats of the documents are available in separate files
508 inside the <filename>exim4</filename> directory of the FTP site:
509 </para>
510 <literallayout>
511 <filename>exim-html-n.nn.tar.gz</filename>
512 <filename>exim-pdf-n.nn.tar.gz</filename>
513 <filename>exim-postscript-n.nn.tar.gz</filename>
514 <filename>exim-texinfo-n.nn.tar.gz</filename>
515 </literallayout>
516 <para>
517 These tar files contain only the <filename>doc</filename> directory, not the complete
518 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
519 <indexterm role="concept">
520 <primary>FAQ</primary>
521 </indexterm>
522 The FAQ is available for downloading in two different formats in these files:
523 </para>
524 <literallayout>
525 <filename>exim4/FAQ.txt.gz</filename>
526 <filename>exim4/FAQ.html.tar.gz</filename>
527 </literallayout>
528 <para>
529 The first of these is a single ASCII file that can be searched with a text
530 editor. The second is a directory of HTML files, normally accessed by starting
531 at <filename>index.html</filename>. The HTML version of the FAQ (which is also included in the
532 HTML documentation tarbundle) includes a keyword-in-context index, which is
533 often the most convenient way of finding your way around.
534 </para>
535 </section>
536 <section>
537 <title>Wish list</title>
538 <para>
539 <indexterm role="concept">
540 <primary>wish list</primary>
541 </indexterm>
542 A wish list is maintained, containing ideas for new features that have been
543 submitted. This used to be a single file that from time to time was exported to
544 the ftp site into the file <filename>exim4/WishList</filename>. However, it has now been
545 imported into Exim&#x2019;s Bugzilla data.
546 </para>
547 </section>
548 <section>
549 <title>Contributed material</title>
550 <para>
551 <indexterm role="concept">
552 <primary>contributed material</primary>
553 </indexterm>
554 At the ftp site, there is a directory called <filename>Contrib</filename> that contains
555 miscellaneous files contributed to the Exim community by Exim users. There is
556 also a collection of contributed configuration examples in
557 <filename>exim4/config.samples.tar.gz</filename>. These samples are referenced from the FAQ.
558 </para>
559 </section>
560 <section>
561 <title>Limitations</title>
562 <itemizedlist>
563 <listitem>
564 <para>
565 <indexterm role="concept">
566 <primary>limitations of Exim</primary>
567 </indexterm>
568 <indexterm role="concept">
569 <primary>bang paths</primary>
570 <secondary>not handled by Exim</secondary>
571 </indexterm>
572 Exim is designed for use as an Internet MTA, and therefore handles addresses in
573 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
574 simple two-component bang paths can be converted by a straightforward rewriting
575 configuration. This restriction does not prevent Exim from being interfaced to
576 UUCP as a transport mechanism, provided that domain addresses are used.
577 </para>
578 </listitem>
579 <listitem>
580 <para>
581 <indexterm role="concept">
582 <primary>domainless addresses</primary>
583 </indexterm>
584 <indexterm role="concept">
585 <primary>address</primary>
586 <secondary>without domain</secondary>
587 </indexterm>
588 Exim insists that every address it handles has a domain attached. For incoming
589 local messages, domainless addresses are automatically qualified with a
590 configured domain value. Configuration options specify from which remote
591 systems unqualified addresses are acceptable. These are then qualified on
592 arrival.
593 </para>
594 </listitem>
595 <listitem>
596 <para>
597 <indexterm role="concept">
598 <primary>transport</primary>
599 <secondary>external</secondary>
600 </indexterm>
601 <indexterm role="concept">
602 <primary>external transports</primary>
603 </indexterm>
604 The only external transport mechanisms that are currently implemented are SMTP
605 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
606 transport is available, and there are facilities for writing messages to files
607 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
608 to send messages to other transport mechanisms such as UUCP, provided they can
609 handle domain-style addresses. Batched SMTP input is also catered for.
610 </para>
611 </listitem>
612 <listitem>
613 <para>
614 Exim is not designed for storing mail for dial-in hosts. When the volumes of
615 such mail are large, it is better to get the messages <quote>delivered</quote> into files
616 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
617 other means.
618 </para>
619 </listitem>
620 <listitem>
621 <para>
622 Although Exim does have basic facilities for scanning incoming messages, these
623 are not comprehensive enough to do full virus or spam scanning. Such operations
624 are best carried out using additional specialized software packages. If you
625 compile Exim with the content-scanning extension, straightforward interfaces to
626 a number of common scanners are provided.
627 </para>
628 </listitem>
629 </itemizedlist>
630 </section>
631 <section>
632 <title>Run time configuration</title>
633 <para>
634 Exim&#x2019;s run time configuration is held in a single text file that is divided
635 into a number of sections. The entries in this file consist of keywords and
636 values, in the style of Smail 3 configuration files. A default configuration
637 file which is suitable for simple online installations is provided in the
638 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
639 </para>
640 </section>
641 <section>
642 <title>Calling interface</title>
643 <para>
644 <indexterm role="concept">
645 <primary>Sendmail compatibility</primary>
646 <secondary>command line interface</secondary>
647 </indexterm>
648 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
649 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
650 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
651 about Sendmail in order to run Exim. For actions other than sending messages,
652 Sendmail-compatible options also exist, but those that produce output (for
653 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
654 format. There are also some additional options that are compatible with Smail
655 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
656 documents all Exim&#x2019;s command line options. This information is automatically
657 made into the man page that forms part of the Exim distribution.
658 </para>
659 <para>
660 Control of messages on the queue can be done via certain privileged command
661 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
662 which displays current information in an X window, and which contains a menu
663 interface to Exim&#x2019;s command line administration options.
664 </para>
665 </section>
666 <section>
667 <title>Terminology</title>
668 <para>
669 <indexterm role="concept">
670 <primary>terminology definitions</primary>
671 </indexterm>
672 <indexterm role="concept">
673 <primary>body of message</primary>
674 <secondary>definition of</secondary>
675 </indexterm>
676 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
677 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
678 below) by a blank line.
679 </para>
680 <para>
681 <indexterm role="concept">
682 <primary>bounce message</primary>
683 <secondary>definition of</secondary>
684 </indexterm>
685 When a message cannot be delivered, it is normally returned to the sender in a
686 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
687 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
688 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
689 failure error report</quote>. Such messages have an empty sender address in the
690 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
691 rise to further bounce messages.
692 </para>
693 <para>
694 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
695 value which is used in the absence of any setting in the configuration. It may
696 also qualify an action which is taken unless a configuration setting specifies
697 otherwise.
698 </para>
699 <para>
700 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
701 destination cannot immediately take place for some reason (a remote host may be
702 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
703 until a later time.
704 </para>
705 <para>
706 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
707 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
708 the part of an email address following the @ sign.
709 </para>
710 <para>
711 <indexterm role="concept">
712 <primary>envelope</primary>
713 <secondary>definition of</secondary>
714 </indexterm>
715 <indexterm role="concept">
716 <primary>sender</primary>
717 <secondary>definition of</secondary>
718 </indexterm>
719 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
720 body. The envelope contains a sender address (to which bounce messages should
721 be delivered), and any number of recipient addresses. References to the
722 sender or the recipients of a message usually mean the addresses in the
723 envelope. An MTA uses these addresses for delivery, and for returning bounce
724 messages, not the addresses that appear in the header lines.
725 </para>
726 <para>
727 <indexterm role="concept">
728 <primary>message header</primary>
729 <secondary>definition of</secondary>
730 </indexterm>
731 <indexterm role="concept">
732 <primary>header section</primary>
733 <secondary>definition of</secondary>
734 </indexterm>
735 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
736 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
737 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
738 indenting the continuations. The header is separated from the body by a blank
739 line.
740 </para>
741 <para>
742 <indexterm role="concept">
743 <primary>local part</primary>
744 <secondary>definition of</secondary>
745 </indexterm>
746 <indexterm role="concept">
747 <primary>domain</primary>
748 <secondary>definition of</secondary>
749 </indexterm>
750 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
751 part of an email address that precedes the @ sign. The part that follows the
752 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
753 </para>
754 <para>
755 <indexterm role="concept">
756 <primary>local delivery</primary>
757 <secondary>definition of</secondary>
758 </indexterm>
759 <indexterm role="concept">
760 <primary>remote delivery</primary>
761 <secondary>definition of</secondary>
762 </indexterm>
763 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
764 delivery to a file or a pipe on the local host from delivery by SMTP over
765 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
766 host it is running on are <emphasis>remote</emphasis>.
767 </para>
768 <para>
769 <indexterm role="concept">
770 <primary>return path</primary>
771 <secondary>definition of</secondary>
772 </indexterm>
773 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
774 message&#x2019;s envelope.
775 </para>
776 <para>
777 <indexterm role="concept">
778 <primary>queue</primary>
779 <secondary>definition of</secondary>
780 </indexterm>
781 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
782 because this term is in widespread use in the context of MTAs. However, in
783 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
784 normally no ordering of waiting messages.
785 </para>
786 <para>
787 <indexterm role="concept">
788 <primary>queue runner</primary>
789 <secondary>definition of</secondary>
790 </indexterm>
791 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
792 and attempts to deliver those messages whose retry times have come. This term
793 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
794 the waiting messages are normally processed in an unpredictable order.
795 </para>
796 <para>
797 <indexterm role="concept">
798 <primary>spool directory</primary>
799 <secondary>definition of</secondary>
800 </indexterm>
801 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
802 messages on its queue &ndash; that is, those that it is in the process of
803 delivering. This should not be confused with the directory in which local
804 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
805 the Exim documentation, <quote>spool</quote> is always used in the first sense.
806 </para>
807 </section>
808 </chapter>
809
810 <chapter>
811 <title>Incorporated code</title>
812 <para>
813 <indexterm role="concept">
814 <primary>incorporated code</primary>
815 </indexterm>
816 <indexterm role="concept">
817 <primary>regular expressions</primary>
818 <secondary>library</secondary>
819 </indexterm>
820 <indexterm role="concept">
821 <primary>PCRE</primary>
822 </indexterm>
823 A number of pieces of external code are included in the Exim distribution.
824 </para>
825 <itemizedlist>
826 <listitem>
827 <para>
828 Regular expressions are supported in the main Exim program and in the Exim
829 monitor using the freely-distributable PCRE library, copyright &copy;
830 University of Cambridge. The source is distributed in the directory
831 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
832 the PCRE library in other programs, you should obtain and install the full
833 version from <emphasis role="bold"><ulink url="ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre">ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre</ulink></emphasis>.
834 </para>
835 </listitem>
836 <listitem>
837 <para>
838 <indexterm role="concept">
839 <primary>cdb</primary>
840 <secondary>acknowledgement</secondary>
841 </indexterm>
842 Support for the cdb (Constant DataBase) lookup method is provided by code
843 contributed by Nigel Metheringham of (at the time he contributed it) Planet
844 Online Ltd. The implementation is completely contained within the code of Exim.
845 It does not link against an external cdb library. The code contains the
846 following statements:
847 </para>
848 <blockquote>
849 <para>
850 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
851 </para>
852 <para>
853 This program is free software; you can redistribute it and/or modify it under
854 the terms of the GNU General Public License as published by the Free Software
855 Foundation; either version 2 of the License, or (at your option) any later
856 version.
857 </para>
858 <para>
859 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
860 the spec and sample code for cdb can be obtained from
861 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>. This implementation borrows some
862 code from Dan Bernstein&#x2019;s implementation (which has no license restrictions
863 applied to it).
864 </para>
865 </blockquote>
866 </listitem>
867 <listitem>
868 <para>
869 <indexterm role="concept">
870 <primary>SPA authentication</primary>
871 </indexterm>
872 <indexterm role="concept">
873 <primary>Samba project</primary>
874 </indexterm>
875 <indexterm role="concept">
876 <primary>Microsoft Secure Password Authentication</primary>
877 </indexterm>
878 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
879 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
880 Tom Kistner. This includes code taken from the Samba project, which is released
881 under the Gnu GPL.
882 </para>
883 </listitem>
884 <listitem>
885 <para>
886 <indexterm role="concept">
887 <primary>Cyrus</primary>
888 </indexterm>
889 <indexterm role="concept">
890 <primary><emphasis>pwcheck</emphasis> daemon</primary>
891 </indexterm>
892 <indexterm role="concept">
893 <primary><emphasis>pwauthd</emphasis> daemon</primary>
894 </indexterm>
895 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
896 by code taken from the Cyrus-SASL library and adapted by Alexander S.
897 Sabourenkov. The permission notice appears below, in accordance with the
898 conditions expressed therein.
899 </para>
900 <blockquote>
901 <para>
902 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
903 </para>
904 <para>
905 Redistribution and use in source and binary forms, with or without
906 modification, are permitted provided that the following conditions
907 are met:
908 </para>
909 <orderedlist numeration="arabic">
910 <listitem>
911 <para>
912 Redistributions of source code must retain the above copyright
913 notice, this list of conditions and the following disclaimer.
914 </para>
915 </listitem>
916 <listitem>
917 <para>
918 Redistributions in binary form must reproduce the above copyright
919 notice, this list of conditions and the following disclaimer in
920 the documentation and/or other materials provided with the
921 distribution.
922 </para>
923 </listitem>
924 <listitem>
925 <para>
926 The name <quote>Carnegie Mellon University</quote> must not be used to
927 endorse or promote products derived from this software without
928 prior written permission. For permission or any other legal
929 details, please contact
930 </para>
931 <literallayout>
932               Office of Technology Transfer
933               Carnegie Mellon University
934               5000 Forbes Avenue
935               Pittsburgh, PA  15213-3890
936               (412) 268-4387, fax: (412) 268-7395
937               tech-transfer@andrew.cmu.edu
938 </literallayout>
939 </listitem>
940 <listitem>
941 <para>
942 Redistributions of any form whatsoever must retain the following
943 acknowledgment:
944 </para>
945 <para>
946 <quote>This product includes software developed by Computing Services
947 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
948 </para>
949 <para>
950 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
951 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
952 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
953 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
954 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
955 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
956 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
957 </para>
958 </listitem>
959 </orderedlist>
960 </blockquote>
961 </listitem>
962 <listitem>
963 <para>
964 <indexterm role="concept">
965 <primary>Exim monitor</primary>
966 <secondary>acknowledgement</secondary>
967 </indexterm>
968 <indexterm role="concept">
969 <primary>X-windows</primary>
970 </indexterm>
971 <indexterm role="concept">
972 <primary>Athena</primary>
973 </indexterm>
974 The Exim Monitor program, which is an X-Window application, includes
975 modified versions of the Athena StripChart and TextPop widgets.
976 This code is copyright by DEC and MIT, and their permission notice appears
977 below, in accordance with the conditions expressed therein.
978 </para>
979 <blockquote>
980 <para>
981 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
982 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
983 </para>
984 <para>
985 All Rights Reserved
986 </para>
987 <para>
988 Permission to use, copy, modify, and distribute this software and its
989 documentation for any purpose and without fee is hereby granted,
990 provided that the above copyright notice appear in all copies and that
991 both that copyright notice and this permission notice appear in
992 supporting documentation, and that the names of Digital or MIT not be
993 used in advertising or publicity pertaining to distribution of the
994 software without specific, written prior permission.
995 </para>
996 <para>
997 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
998 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
999 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
1000 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
1001 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1002 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1003 SOFTWARE.
1004 </para>
1005 </blockquote>
1006 </listitem>
1007 <listitem>
1008 <para>
1009 Many people have contributed code fragments, some large, some small, that were
1010 not covered by any specific licence requirements. It is assumed that the
1011 contributors are happy to see their code incoporated into Exim under the GPL.
1012 </para>
1013 </listitem>
1014 </itemizedlist>
1015 </chapter>
1016
1017 <chapter>
1018 <title>How Exim receives and delivers mail</title>
1019 <titleabbrev>Receiving and delivering mail</titleabbrev>
1020 <section>
1021 <title>Overall philosophy</title>
1022 <para>
1023 <indexterm role="concept">
1024 <primary>design philosophy</primary>
1025 </indexterm>
1026 Exim is designed to work efficiently on systems that are permanently connected
1027 to the Internet and are handling a general mix of mail. In such circumstances,
1028 most messages can be delivered immediately. Consequently, Exim does not
1029 maintain independent queues of messages for specific domains or hosts, though
1030 it does try to send several messages in a single SMTP connection after a host
1031 has been down, and it also maintains per-host retry information.
1032 </para>
1033 </section>
1034 <section>
1035 <title>Policy control</title>
1036 <para>
1037 <indexterm role="concept">
1038 <primary>policy control</primary>
1039 <secondary>overview</secondary>
1040 </indexterm>
1041 Policy controls are now an important feature of MTAs that are connected to the
1042 Internet. Perhaps their most important job is to stop MTAs being abused as
1043 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1044 unsolicited junk, and want to disguise its source. Exim provides flexible
1045 facilities for specifying policy controls on incoming mail:
1046 </para>
1047 <itemizedlist>
1048 <listitem>
1049 <para>
1050 <indexterm role="concept">
1051 <primary>access control lists (ACLs)</primary>
1052 <secondary>introduction</secondary>
1053 </indexterm>
1054 Exim 4 (unlike previous versions of Exim) implements policy controls on
1055 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1056 series of statements that may either grant or deny access. ACLs can be used at
1057 several places in the SMTP dialogue while receiving a message from a remote
1058 host. However, the most common places are after each RCPT command, and at the
1059 very end of the message. The sysadmin can specify conditions for accepting or
1060 rejecting individual recipients or the entire message, respectively, at these
1061 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1062 error code.
1063 </para>
1064 </listitem>
1065 <listitem>
1066 <para>
1067 An ACL is also available for locally generated, non-SMTP messages. In this
1068 case, the only available actions are to accept or deny the entire message.
1069 </para>
1070 </listitem>
1071 <listitem>
1072 <para>
1073 When Exim is compiled with the content-scanning extension, facilities are
1074 provided in the ACL mechanism for passing the message to external virus and/or
1075 spam scanning software. The result of such a scan is passed back to the ACL,
1076 which can then use it to decide what to do with the message.
1077 </para>
1078 </listitem>
1079 <listitem>
1080 <para>
1081 When a message has been received, either from a remote host or from the local
1082 host, but before the final acknowledgement has been sent, a locally supplied C
1083 function called <function>local_scan()</function> can be run to inspect the message and decide
1084 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1085 is accepted, the list of recipients can be modified by the function.
1086 </para>
1087 </listitem>
1088 <listitem>
1089 <para>
1090 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1091 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1092 Exim to be compiled with the content-scanning extension.
1093 </para>
1094 </listitem>
1095 <listitem>
1096 <para>
1097 After a message has been accepted, a further checking mechanism is available in
1098 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1099 runs at the start of every delivery process.
1100 </para>
1101 </listitem>
1102 </itemizedlist>
1103 </section>
1104 <section>
1105 <title>User filters</title>
1106 <para>
1107 <indexterm role="concept">
1108 <primary>filter</primary>
1109 <secondary>introduction</secondary>
1110 </indexterm>
1111 <indexterm role="concept">
1112 <primary>Sieve filter</primary>
1113 </indexterm>
1114 In a conventional Exim configuration, users are able to run private filters by
1115 setting up appropriate <filename>.forward</filename> files in their home directories. See
1116 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1117 configuration needed to support this, and the separate document entitled
1118 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1119 of filtering are available:
1120 </para>
1121 <itemizedlist>
1122 <listitem>
1123 <para>
1124 Sieve filters are written in the standard filtering language that is defined
1125 by RFC 3028.
1126 </para>
1127 </listitem>
1128 <listitem>
1129 <para>
1130 Exim filters are written in a syntax that is unique to Exim, but which is more
1131 powerful than Sieve, which it pre-dates.
1132 </para>
1133 </listitem>
1134 </itemizedlist>
1135 <para>
1136 User filters are run as part of the routing process, described below.
1137 </para>
1138 </section>
1139 <section id="SECTmessiden">
1140 <title>Message identification</title>
1141 <para>
1142 <indexterm role="concept">
1143 <primary>message ids</primary>
1144 <secondary>details of format</secondary>
1145 </indexterm>
1146 <indexterm role="concept">
1147 <primary>format</primary>
1148 <secondary>of message id</secondary>
1149 </indexterm>
1150 <indexterm role="concept">
1151 <primary>id of message</primary>
1152 </indexterm>
1153 <indexterm role="concept">
1154 <primary>base62</primary>
1155 </indexterm>
1156 <indexterm role="concept">
1157 <primary>base36</primary>
1158 </indexterm>
1159 <indexterm role="concept">
1160 <primary>Darwin</primary>
1161 </indexterm>
1162 <indexterm role="concept">
1163 <primary>Cygwin</primary>
1164 </indexterm>
1165 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1166 characters long. It is divided into three parts, separated by hyphens, for
1167 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1168 normally encoding numbers in base 62. However, in the Darwin operating
1169 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1170 (avoiding the use of lower case letters) is used instead, because the message
1171 id is used to construct file names, and the names of files in those systems are
1172 not always case-sensitive.
1173 </para>
1174 <para>
1175 <indexterm role="concept">
1176 <primary>pid (process id)</primary>
1177 <secondary>re-use of</secondary>
1178 </indexterm>
1179 The detail of the contents of the message id have changed as Exim has evolved.
1180 Earlier versions relied on the operating system not re-using a process id (pid)
1181 within one second. On modern operating systems, this assumption can no longer
1182 be made, so the algorithm had to be changed. To retain backward compatibility,
1183 the format of the message id was retained, which is why the following rules are
1184 somewhat eccentric:
1185 </para>
1186 <itemizedlist>
1187 <listitem>
1188 <para>
1189 The first six characters of the message id are the time at which the message
1190 started to be received, to a granularity of one second. That is, this field
1191 contains the number of seconds since the start of the epoch (the normal Unix
1192 way of representing the date and time of day).
1193 </para>
1194 </listitem>
1195 <listitem>
1196 <para>
1197 After the first hyphen, the next six characters are the id of the process that
1198 received the message.
1199 </para>
1200 </listitem>
1201 <listitem>
1202 <para>
1203 There are two different possibilities for the final two characters:
1204 </para>
1205 <orderedlist numeration="arabic">
1206 <listitem>
1207 <para>
1208 <indexterm role="concept">
1209 <primary><option>localhost_number</option></primary>
1210 </indexterm>
1211 If <option>localhost_number</option> is not set, this value is the fractional part of the
1212 time of reception, normally in units of 1/2000 of a second, but for systems
1213 that must use base 36 instead of base 62 (because of case-insensitive file
1214 systems), the units are 1/1000 of a second.
1215 </para>
1216 </listitem>
1217 <listitem>
1218 <para>
1219 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1220 the fractional part of the time, which in this case is in units of 1/200
1221 (1/100) of a second.
1222 </para>
1223 </listitem>
1224 </orderedlist>
1225 </listitem>
1226 </itemizedlist>
1227 <para>
1228 After a message has been received, Exim waits for the clock to tick at the
1229 appropriate resolution before proceeding, so that if another message is
1230 received by the same process, or by another process with the same (re-used)
1231 pid, it is guaranteed that the time will be different. In most cases, the clock
1232 will already have ticked while the message was being received.
1233 </para>
1234 </section>
1235 <section>
1236 <title>Receiving mail</title>
1237 <para>
1238 <indexterm role="concept">
1239 <primary>receiving mail</primary>
1240 </indexterm>
1241 <indexterm role="concept">
1242 <primary>message</primary>
1243 <secondary>reception</secondary>
1244 </indexterm>
1245 The only way Exim can receive mail from another host is using SMTP over
1246 TCP/IP, in which case the sender and recipient addresses are transferred using
1247 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1248 there are several possibilities:
1249 </para>
1250 <itemizedlist>
1251 <listitem>
1252 <para>
1253 If the process runs Exim with the <option>-bm</option> option, the message is read
1254 non-interactively (usually via a pipe), with the recipients taken from the
1255 command line, or from the body of the message if <option>-t</option> is also used.
1256 </para>
1257 </listitem>
1258 <listitem>
1259 <para>
1260 If the process runs Exim with the <option>-bS</option> option, the message is also read
1261 non-interactively, but in this case the recipients are listed at the start of
1262 the message in a series of SMTP RCPT commands, terminated by a DATA
1263 command. This is so-called <quote>batch SMTP</quote> format,
1264 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1265 envelope addresses in a non-interactive submission.
1266 </para>
1267 </listitem>
1268 <listitem>
1269 <para>
1270 If the process runs Exim with the <option>-bs</option> option, the message is read
1271 interactively, using the SMTP protocol. A two-way pipe is normally used for
1272 passing data between the local process and the Exim process.
1273 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1274 example, the ACLs for SMTP commands are used for this form of submission.
1275 </para>
1276 </listitem>
1277 <listitem>
1278 <para>
1279 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1280 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1281 does not treat the loopback address specially. It treats all such connections
1282 in the same way as connections from other hosts.
1283 </para>
1284 </listitem>
1285 </itemizedlist>
1286 <para>
1287 <indexterm role="concept">
1288 <primary>message sender</primary>
1289 <secondary>constructed by Exim</secondary>
1290 </indexterm>
1291 <indexterm role="concept">
1292 <primary>sender</primary>
1293 <secondary>constructed by Exim</secondary>
1294 </indexterm>
1295 In the three cases that do not involve TCP/IP, the sender address is
1296 constructed from the login name of the user that called Exim and a default
1297 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1298 option). For local or batch SMTP, a sender address that is passed using the
1299 SMTP MAIL command is ignored. However, the system administrator may allow
1300 certain users (<quote>trusted users</quote>) to specify a different sender address
1301 unconditionally, or all users to specify certain forms of different sender
1302 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1303 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1304 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1305 users to change sender addresses.
1306 </para>
1307 <para>
1308 Messages received by either of the non-interactive mechanisms are subject to
1309 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1310 (either over TCP/IP, or interacting with a local process) can be checked by a
1311 number of ACLs that operate at different times during the SMTP session. Either
1312 individual recipients, or the entire message, can be rejected if local policy
1313 requirements are not met. The <function>local_scan()</function> function (see chapter
1314 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1315 </para>
1316 <para>
1317 Exim can be configured not to start a delivery process when a message is
1318 received; this can be unconditional, or depend on the number of incoming SMTP
1319 connections or the system load. In these situations, new messages wait on the
1320 queue until a queue runner process picks them up. However, in standard
1321 configurations under normal conditions, delivery is started as soon as a
1322 message is received.
1323 </para>
1324 </section>
1325 <section>
1326 <title>Handling an incoming message</title>
1327 <para>
1328 <indexterm role="concept">
1329 <primary>spool directory</primary>
1330 <secondary>files that hold a message</secondary>
1331 </indexterm>
1332 <indexterm role="concept">
1333 <primary>file</primary>
1334 <secondary>how a message is held</secondary>
1335 </indexterm>
1336 When Exim accepts a message, it writes two files in its spool directory. The
1337 first contains the envelope information, the current status of the message, and
1338 the header lines, and the second contains the body of the message. The names of
1339 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1340 file containing the envelope and header, and <literal>-D</literal> for the data file.
1341 </para>
1342 <para>
1343 <indexterm role="concept">
1344 <primary>spool directory</primary>
1345 <secondary><filename>input</filename> sub-directory</secondary>
1346 </indexterm>
1347 By default all these message files are held in a single directory called
1348 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1349 not perform very well if the number of files in a directory gets large; to
1350 improve performance in such cases, the <option>split_spool_directory</option> option can be
1351 used. This causes Exim to split up the input files into 62 sub-directories
1352 whose names are single letters or digits. When this is done, the queue is
1353 processed one sub-directory at a time instead of all at once, which can improve
1354 overall performance even when there are not enough files in each directory to
1355 affect file system performance.
1356 </para>
1357 <para>
1358 The envelope information consists of the address of the message&#x2019;s sender and
1359 the addresses of the recipients. This information is entirely separate from
1360 any addresses contained in the header lines. The status of the message includes
1361 a list of recipients who have already received the message. The format of the
1362 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1363 </para>
1364 <para>
1365 <indexterm role="concept">
1366 <primary>rewriting</primary>
1367 <secondary>addresses</secondary>
1368 </indexterm>
1369 Address rewriting that is specified in the rewrite section of the configuration
1370 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1371 both in the header lines and the envelope, at the time the message is accepted.
1372 If during the course of delivery additional addresses are generated (for
1373 example, via aliasing), these new addresses are rewritten as soon as they are
1374 generated. At the time a message is actually delivered (transported) further
1375 rewriting can take place; because this is a transport option, it can be
1376 different for different forms of delivery. It is also possible to specify the
1377 addition or removal of certain header lines at the time the message is
1378 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1379 <xref linkend="CHAPtransportgeneric"/>).
1380 </para>
1381 </section>
1382 <section>
1383 <title>Life of a message</title>
1384 <para>
1385 <indexterm role="concept">
1386 <primary>message</primary>
1387 <secondary>life of</secondary>
1388 </indexterm>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>frozen</secondary>
1392 </indexterm>
1393 A message remains in the spool directory until it is completely delivered to
1394 its recipients or to an error address, or until it is deleted by an
1395 administrator or by the user who originally created it. In cases when delivery
1396 cannot proceed &ndash; for example, when a message can neither be delivered to its
1397 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1398 spool, and no more deliveries are attempted.
1399 </para>
1400 <para>
1401 <indexterm role="concept">
1402 <primary>frozen messages</primary>
1403 <secondary>thawing</secondary>
1404 </indexterm>
1405 <indexterm role="concept">
1406 <primary>message</primary>
1407 <secondary>thawing frozen</secondary>
1408 </indexterm>
1409 An administrator can <quote>thaw</quote> such messages when the problem has been
1410 corrected, and can also freeze individual messages by hand if necessary. In
1411 addition, an administrator can force a delivery error, causing a bounce message
1412 to be sent.
1413 </para>
1414 <para>
1415 <indexterm role="concept">
1416 <primary><option>timeout_frozen_after</option></primary>
1417 </indexterm>
1418 <indexterm role="concept">
1419 <primary><option>ignore_bounce_errors_after</option></primary>
1420 </indexterm>
1421 There are options called <option>ignore_bounce_errors_after</option> and
1422 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1423 The first applies only to frozen bounces, the second to any frozen messages.
1424 </para>
1425 <para>
1426 <indexterm role="concept">
1427 <primary>message</primary>
1428 <secondary>log file for</secondary>
1429 </indexterm>
1430 <indexterm role="concept">
1431 <primary>log</primary>
1432 <secondary>file for each message</secondary>
1433 </indexterm>
1434 While Exim is working on a message, it writes information about each delivery
1435 attempt to its main log file. This includes successful, unsuccessful, and
1436 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1437 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1438 These logs are solely for the benefit of the administrator, and are normally
1439 deleted along with the spool files when processing of a message is complete.
1440 The use of individual message logs can be disabled by setting
1441 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1442 systems.
1443 </para>
1444 <para>
1445 <indexterm role="concept">
1446 <primary>journal file</primary>
1447 </indexterm>
1448 <indexterm role="concept">
1449 <primary>file</primary>
1450 <secondary>journal</secondary>
1451 </indexterm>
1452 All the information Exim itself needs to set up a delivery is kept in the first
1453 spool file, along with the header lines. When a successful delivery occurs, the
1454 address is immediately written at the end of a journal file, whose name is the
1455 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1456 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1457 is updated to indicate which these are, and the journal file is then deleted.
1458 Updating the spool file is done by writing a new file and renaming it, to
1459 minimize the possibility of data loss.
1460 </para>
1461 <para>
1462 Should the system or the program crash after a successful delivery but before
1463 the spool file has been updated, the journal is left lying around. The next
1464 time Exim attempts to deliver the message, it reads the journal file and
1465 updates the spool file before proceeding. This minimizes the chances of double
1466 deliveries caused by crashes.
1467 </para>
1468 </section>
1469 <section id="SECTprocaddress">
1470 <title>Processing an address for delivery</title>
1471 <para>
1472 <indexterm role="concept">
1473 <primary>drivers</primary>
1474 <secondary>definition of</secondary>
1475 </indexterm>
1476 <indexterm role="concept">
1477 <primary>router</primary>
1478 <secondary>definition of</secondary>
1479 </indexterm>
1480 <indexterm role="concept">
1481 <primary>transport</primary>
1482 <secondary>definition of</secondary>
1483 </indexterm>
1484 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1485 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1486 number of them is provided in the source distribution, and compile-time options
1487 specify which ones are included in the binary. Run time options specify which
1488 ones are actually used for delivering messages.
1489 </para>
1490 <para>
1491 <indexterm role="concept">
1492 <primary>drivers</primary>
1493 <secondary>instance definition</secondary>
1494 </indexterm>
1495 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1496 of that particular driver type. Multiple instances are allowed; for example,
1497 you can set up several different <command>smtp</command> transports, each with different
1498 option values that might specify different ports or different timeouts. Each
1499 instance has its own identifying name. In what follows we will normally use the
1500 instance name when discussing one particular instance (that is, one specific
1501 configuration of the driver), and the generic driver name when discussing
1502 the driver&#x2019;s features in general.
1503 </para>
1504 <para>
1505 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1506 its delivery should happen, by assigning it to a specific transport, or
1507 converting the address into one or more new addresses (for example, via an
1508 alias file). A router may also explicitly choose to fail an address, causing it
1509 to be bounced.
1510 </para>
1511 <para>
1512 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1513 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1514 transport, the destination is a file or a pipe on the local host, whereas for a
1515 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1516 to a specific transport as a result of successful routing. If a message has
1517 several recipients, it may be passed to a number of different transports.
1518 </para>
1519 <para>
1520 <indexterm role="concept">
1521 <primary>preconditions</primary>
1522 <secondary>definition of</secondary>
1523 </indexterm>
1524 An address is processed by passing it to each configured router instance in
1525 turn, subject to certain preconditions, until a router accepts the address or
1526 specifies that it should be bounced. We will describe this process in more
1527 detail shortly. First, as a simple example, we consider how each recipient
1528 address in a message is processed in a small configuration of three routers.
1529 </para>
1530 <para>
1531 To make this a more concrete example, it is described in terms of some actual
1532 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1533 routers in many different ways, and there may be any number of routers in a
1534 configuration.
1535 </para>
1536 <para>
1537 The first router that is specified in a configuration is often one that handles
1538 addresses in domains that are not recognized specially by the local host. These
1539 are typically addresses for arbitrary domains on the Internet. A precondition
1540 is set up which looks for the special domains known to the host (for example,
1541 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1542 match. Typically, this is a router that looks up domains in the DNS in order to
1543 find the hosts to which this address routes. If it succeeds, the address is
1544 assigned to a suitable SMTP transport; if it does not succeed, the router is
1545 configured to fail the address.
1546 </para>
1547 <para>
1548 The second router is reached only when the domain is recognized as one that
1549 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1550 aliasing and forwarding. When it generates one or more new addresses from the
1551 original, each of them is routed independently from the start. Otherwise, the
1552 router may cause an address to fail, or it may simply decline to handle the
1553 address, in which case the address is passed to the next router.
1554 </para>
1555 <para>
1556 The final router in many configurations is one that checks to see if the
1557 address belongs to a local mailbox. The precondition may involve a check to
1558 see if the local part is the name of a login account, or it may look up the
1559 local part in a file or a database. If its preconditions are not met, or if
1560 the router declines, we have reached the end of the routers. When this happens,
1561 the address is bounced.
1562 </para>
1563 </section>
1564 <section>
1565 <title>Processing an address for verification</title>
1566 <para>
1567 <indexterm role="concept">
1568 <primary>router</primary>
1569 <secondary>for verification</secondary>
1570 </indexterm>
1571 <indexterm role="concept">
1572 <primary>verifying address</primary>
1573 <secondary>overview</secondary>
1574 </indexterm>
1575 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1576 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1577 one of the checks to be performed in an ACL for incoming messages, on both
1578 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1579 <option>-bvs</option> command line options.
1580 </para>
1581 <para>
1582 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1583 does not affect the way the routers work, but it is a state that can be
1584 detected. By this means, a router can be skipped or made to behave differently
1585 when verifying. A common example is a configuration in which the first router
1586 sends all messages to a message-scanning program, unless they have been
1587 previously scanned. Thus, the first router accepts all addresses without any
1588 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1589 would be set for such a router, causing it to be skipped in verify mode.
1590 </para>
1591 </section>
1592 <section id="SECTrunindrou">
1593 <title>Running an individual router</title>
1594 <para>
1595 <indexterm role="concept">
1596 <primary>router</primary>
1597 <secondary>running details</secondary>
1598 </indexterm>
1599 <indexterm role="concept">
1600 <primary>preconditions</primary>
1601 <secondary>checking</secondary>
1602 </indexterm>
1603 <indexterm role="concept">
1604 <primary>router</primary>
1605 <secondary>result of running</secondary>
1606 </indexterm>
1607 As explained in the example above, a number of preconditions are checked before
1608 running a router. If any are not met, the router is skipped, and the address is
1609 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1610 the router is run. What happens next depends on the outcome, which is one of
1611 the following:
1612 </para>
1613 <itemizedlist>
1614 <listitem>
1615 <para>
1616 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1617 transport, or generates one or more <quote>child</quote> addresses. Processing the
1618 original address ceases,
1619 <indexterm role="concept">
1620 <primary><option>unseen</option> option</primary>
1621 </indexterm>
1622 unless the <option>unseen</option> option is set on the router. This option
1623 can be used to set up multiple deliveries with different routing (for example,
1624 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1625 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1626 end of routing.
1627 </para>
1628 <para>
1629 Any child addresses generated by the router are processed independently,
1630 starting with the first router by default. It is possible to change this by
1631 setting the <option>redirect_router</option> option to specify which router to start at for
1632 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1633 <option>redirect_router</option> may be anywhere in the router configuration.
1634 </para>
1635 </listitem>
1636 <listitem>
1637 <para>
1638 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1639 requests that the address be passed to another router. By default the address
1640 is passed to the next router, but this can be changed by setting the
1641 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1642 must be below the current router (to avoid loops).
1643 </para>
1644 </listitem>
1645 <listitem>
1646 <para>
1647 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1648 recognize it at all. By default, the address is passed to the next router, but
1649 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1650 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1651 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1652 </para>
1653 </listitem>
1654 <listitem>
1655 <para>
1656 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1657 the generation of a bounce message. There is no further processing of the
1658 original address unless <option>unseen</option> is set on the router.
1659 </para>
1660 </listitem>
1661 <listitem>
1662 <para>
1663 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1664 database may be offline, or a DNS lookup may have timed out.) No further
1665 processing of the address happens in this delivery attempt. It is tried again
1666 next time the message is considered for delivery.
1667 </para>
1668 </listitem>
1669 <listitem>
1670 <para>
1671 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1672 its configuration). The action is as for defer.
1673 </para>
1674 </listitem>
1675 </itemizedlist>
1676 <para>
1677 If an address reaches the end of the routers without having been accepted by
1678 any of them, it is bounced as unrouteable. The default error message in this
1679 situation is <quote>unrouteable address</quote>, but you can set your own message by
1680 making use of the <option>cannot_route_message</option> option. This can be set for any
1681 router; the value from the last router that <quote>saw</quote> the address is used.
1682 </para>
1683 <para>
1684 Sometimes while routing you want to fail a delivery when some conditions are
1685 met but others are not, instead of passing the address on for further routing.
1686 You can do this by having a second router that explicitly fails the delivery
1687 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1688 facility for this purpose.
1689 </para>
1690 </section>
1691 <section>
1692 <title>Duplicate addresses</title>
1693 <para>
1694 <indexterm role="concept">
1695 <primary>case of local parts</primary>
1696 </indexterm>
1697 <indexterm role="concept">
1698 <primary>address duplicate</primary>
1699 <secondary>discarding</secondary>
1700 </indexterm>
1701 <indexterm role="concept">
1702 <primary>duplicate addresses</primary>
1703 </indexterm>
1704 Once routing is complete, Exim scans the addresses that are assigned to local
1705 and remote transports, and discards any duplicates that it finds. During this
1706 check, local parts are treated as case-sensitive. This happens only when
1707 actually delivering a message; when testing routers with <option>-bt</option>, all the
1708 routed addresses are shown.
1709 </para>
1710 </section>
1711 <section id="SECTrouprecon">
1712 <title>Router preconditions</title>
1713 <para>
1714 <indexterm role="concept">
1715 <primary>router preconditions</primary>
1716 <secondary>order of processing</secondary>
1717 </indexterm>
1718 <indexterm role="concept">
1719 <primary>preconditions</primary>
1720 <secondary>order of processing</secondary>
1721 </indexterm>
1722 The preconditions that are tested for each router are listed below, in the
1723 order in which they are tested. The individual configuration options are
1724 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1725 </para>
1726 <itemizedlist>
1727 <listitem>
1728 <para>
1729 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1730 the local parts handled by the router may or must have certain prefixes and/or
1731 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1732 skipped. These conditions are tested first. When an affix is present, it is
1733 removed from the local part before further processing, including the evaluation
1734 of any other conditions.
1735 </para>
1736 </listitem>
1737 <listitem>
1738 <para>
1739 Routers can be designated for use only when not verifying an address, that is,
1740 only when routing it for delivery (or testing its delivery routing). If the
1741 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1742 address.
1743 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1744 <option>verify_recipient</option>, which independently control the use of the router for
1745 sender and recipient verification. You can set these options directly if
1746 you want a router to be used for only one type of verification.
1747 </para>
1748 </listitem>
1749 <listitem>
1750 <para>
1751 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1752 run with the <option>-bt</option> option to test an address routing. This can be helpful
1753 when the first router sends all new messages to a scanner of some sort; it
1754 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1755 having to simulate the effect of the scanner.
1756 </para>
1757 </listitem>
1758 <listitem>
1759 <para>
1760 Routers can be designated for use only when verifying an address, as
1761 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1762 </para>
1763 </listitem>
1764 <listitem>
1765 <para>
1766 Individual routers can be explicitly skipped when running the routers to
1767 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1768 </para>
1769 </listitem>
1770 <listitem>
1771 <para>
1772 If the <option>domains</option> option is set, the domain of the address must be in the set
1773 of domains that it defines.
1774 </para>
1775 </listitem>
1776 <listitem>
1777 <para>
1778 <indexterm role="concept">
1779 <primary><varname>$local_part_prefix</varname></primary>
1780 </indexterm>
1781 <indexterm role="concept">
1782 <primary><varname>$local_part</varname></primary>
1783 </indexterm>
1784 <indexterm role="concept">
1785 <primary><varname>$local_part_suffix</varname></primary>
1786 </indexterm>
1787 If the <option>local_parts</option> option is set, the local part of the address must be in
1788 the set of local parts that it defines. If <option>local_part_prefix</option> or
1789 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1790 part before this check. If you want to do precondition tests on local parts
1791 that include affixes, you can do so by using a <option>condition</option> option (see below)
1792 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1793 <varname>$local_part_suffix</varname> as necessary.
1794 </para>
1795 </listitem>
1796 <listitem>
1797 <para>
1798 <indexterm role="concept">
1799 <primary><varname>$local_user_uid</varname></primary>
1800 </indexterm>
1801 <indexterm role="concept">
1802 <primary><varname>$local_user_gid</varname></primary>
1803 </indexterm>
1804 <indexterm role="concept">
1805 <primary><varname>$home</varname></primary>
1806 </indexterm>
1807 If the <option>check_local_user</option> option is set, the local part must be the name of
1808 an account on the local host. If this check succeeds, the uid and gid of the
1809 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1810 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1811 remaining preconditions.
1812 </para>
1813 </listitem>
1814 <listitem>
1815 <para>
1816 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1817 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1818 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1819 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1820 could lead to confusion.
1821 </para>
1822 </listitem>
1823 <listitem>
1824 <para>
1825 If the <option>senders</option> option is set, the envelope sender address must be in the
1826 set of addresses that it defines.
1827 </para>
1828 </listitem>
1829 <listitem>
1830 <para>
1831 If the <option>require_files</option> option is set, the existence or non-existence of
1832 specified files is tested.
1833 </para>
1834 </listitem>
1835 <listitem>
1836 <para>
1837 <indexterm role="concept">
1838 <primary>customizing</primary>
1839 <secondary>precondition</secondary>
1840 </indexterm>
1841 If the <option>condition</option> option is set, it is evaluated and tested. This option
1842 uses an expanded string to allow you to set up your own custom preconditions.
1843 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1844 </para>
1845 </listitem>
1846 </itemizedlist>
1847 <para>
1848 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1849 it to check for the existence of a file in which to lookup up a domain, local
1850 part, or sender. However, as these options are all expanded, you can use the
1851 <option>exists</option> expansion condition to make such tests within each condition. The
1852 <option>require_files</option> option is intended for checking files that the router may be
1853 going to use internally, or which are needed by a specific transport (for
1854 example, <filename>.procmailrc</filename>).
1855 </para>
1856 </section>
1857 <section>
1858 <title>Delivery in detail</title>
1859 <para>
1860 <indexterm role="concept">
1861 <primary>delivery</primary>
1862 <secondary>in detail</secondary>
1863 </indexterm>
1864 When a message is to be delivered, the sequence of events is as follows:
1865 </para>
1866 <itemizedlist>
1867 <listitem>
1868 <para>
1869 If a system-wide filter file is specified, the message is passed to it. The
1870 filter may add recipients to the message, replace the recipients, discard the
1871 message, cause a new message to be generated, or cause the message delivery to
1872 fail. The format of the system filter file is the same as for Exim user filter
1873 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1874 filtering</emphasis>.
1875 <indexterm role="concept">
1876 <primary>Sieve filter</primary>
1877 <secondary>not available for system filter</secondary>
1878 </indexterm>
1879 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1880 </para>
1881 <para>
1882 Some additional features are available in system filters &ndash; see chapter
1883 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1884 filter only once per delivery attempt, however many recipients it has. However,
1885 if there are several delivery attempts because one or more addresses could not
1886 be immediately delivered, the system filter is run each time. The filter
1887 condition <option>first_delivery</option> can be used to detect the first run of the system
1888 filter.
1889 </para>
1890 </listitem>
1891 <listitem>
1892 <para>
1893 Each recipient address is offered to each configured router in turn, subject to
1894 its preconditions, until one is able to handle it. If no router can handle the
1895 address, that is, if they all decline, the address is failed. Because routers
1896 can be targeted at particular domains, several locally handled domains can be
1897 processed entirely independently of each other.
1898 </para>
1899 </listitem>
1900 <listitem>
1901 <para>
1902 <indexterm role="concept">
1903 <primary>routing</primary>
1904 <secondary>loops in</secondary>
1905 </indexterm>
1906 <indexterm role="concept">
1907 <primary>loop</primary>
1908 <secondary>while routing</secondary>
1909 </indexterm>
1910 A router that accepts an address may assign it to a local or a remote
1911 transport. However, the transport is not run at this time. Instead, the address
1912 is placed on a list for the particular transport, which will be run later.
1913 Alternatively, the router may generate one or more new addresses (typically
1914 from alias, forward, or filter files). New addresses are fed back into this
1915 process from the top, but in order to avoid loops, a router ignores any address
1916 which has an identically-named ancestor that was processed by itself.
1917 </para>
1918 </listitem>
1919 <listitem>
1920 <para>
1921 When all the routing has been done, addresses that have been successfully
1922 handled are passed to their assigned transports. When local transports are
1923 doing real local deliveries, they handle only one address at a time, but if a
1924 local transport is being used as a pseudo-remote transport (for example, to
1925 collect batched SMTP messages for transmission by some other means) multiple
1926 addresses can be handled. Remote transports can always handle more than one
1927 address at a time, but can be configured not to do so, or to restrict multiple
1928 addresses to the same domain.
1929 </para>
1930 </listitem>
1931 <listitem>
1932 <para>
1933 Each local delivery to a file or a pipe runs in a separate process under a
1934 non-privileged uid, and these deliveries are run one at a time. Remote
1935 deliveries also run in separate processes, normally under a uid that is private
1936 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1937 run in parallel. The maximum number of simultaneous remote deliveries for any
1938 one message is set by the <option>remote_max_parallel</option> option.
1939 The order in which deliveries are done is not defined, except that all local
1940 deliveries happen before any remote deliveries.
1941 </para>
1942 </listitem>
1943 <listitem>
1944 <para>
1945 <indexterm role="concept">
1946 <primary>queue runner</primary>
1947 </indexterm>
1948 When it encounters a local delivery during a queue run, Exim checks its retry
1949 database to see if there has been a previous temporary delivery failure for the
1950 address before running the local transport. If there was a previous failure,
1951 Exim does not attempt a new delivery until the retry time for the address is
1952 reached. However, this happens only for delivery attempts that are part of a
1953 queue run. Local deliveries are always attempted when delivery immediately
1954 follows message reception, even if retry times are set for them. This makes for
1955 better behaviour if one particular message is causing problems (for example,
1956 causing quota overflow, or provoking an error in a filter file).
1957 </para>
1958 </listitem>
1959 <listitem>
1960 <para>
1961 <indexterm role="concept">
1962 <primary>delivery</primary>
1963 <secondary>retry in remote transports</secondary>
1964 </indexterm>
1965 Remote transports do their own retry handling, since an address may be
1966 deliverable to one of a number of hosts, each of which may have a different
1967 retry time. If there have been previous temporary failures and no host has
1968 reached its retry time, no delivery is attempted, whether in a queue run or
1969 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1970 </para>
1971 </listitem>
1972 <listitem>
1973 <para>
1974 If there were any permanent errors, a bounce message is returned to an
1975 appropriate address (the sender in the common case), with details of the error
1976 for each failing address. Exim can be configured to send copies of bounce
1977 messages to other addresses.
1978 </para>
1979 </listitem>
1980 <listitem>
1981 <para>
1982 <indexterm role="concept">
1983 <primary>delivery</primary>
1984 <secondary>deferral</secondary>
1985 </indexterm>
1986 If one or more addresses suffered a temporary failure, the message is left on
1987 the queue, to be tried again later. Delivery of these addresses is said to be
1988 <emphasis>deferred</emphasis>.
1989 </para>
1990 </listitem>
1991 <listitem>
1992 <para>
1993 When all the recipient addresses have either been delivered or bounced,
1994 handling of the message is complete. The spool files and message log are
1995 deleted, though the message log can optionally be preserved if required.
1996 </para>
1997 </listitem>
1998 </itemizedlist>
1999 </section>
2000 <section>
2001 <title>Retry mechanism</title>
2002 <para>
2003 <indexterm role="concept">
2004 <primary>delivery</primary>
2005 <secondary>retry mechanism</secondary>
2006 </indexterm>
2007 <indexterm role="concept">
2008 <primary>retry</primary>
2009 <secondary>description of mechanism</secondary>
2010 </indexterm>
2011 <indexterm role="concept">
2012 <primary>queue runner</primary>
2013 </indexterm>
2014 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2015 attempt is the queue runner process. You must either run an Exim daemon that
2016 uses the <option>-q</option> option with a time interval to start queue runners at regular
2017 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2018 not arrange for queue runners to be run, messages that fail temporarily at the
2019 first attempt will remain on your queue for ever. A queue runner process works
2020 its way through the queue, one message at a time, trying each delivery that has
2021 passed its retry time.
2022 You can run several queue runners at once.
2023 </para>
2024 <para>
2025 Exim uses a set of configured rules to determine when next to retry the failing
2026 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2027 should give up trying to deliver to the address, at which point it generates a
2028 bounce message. If no retry rules are set for a particular host, address, and
2029 error combination, no retries are attempted, and temporary errors are treated
2030 as permanent.
2031 </para>
2032 </section>
2033 <section>
2034 <title>Temporary delivery failure</title>
2035 <para>
2036 <indexterm role="concept">
2037 <primary>delivery</primary>
2038 <secondary>temporary failure</secondary>
2039 </indexterm>
2040 There are many reasons why a message may not be immediately deliverable to a
2041 particular address. Failure to connect to a remote machine (because it, or the
2042 connection to it, is down) is one of the most common. Temporary failures may be
2043 detected during routing as well as during the transport stage of delivery.
2044 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2045 is on a file system where the user is over quota. Exim can be configured to
2046 impose its own quotas on local mailboxes; where system quotas are set they will
2047 also apply.
2048 </para>
2049 <para>
2050 If a host is unreachable for a period of time, a number of messages may be
2051 waiting for it by the time it recovers, and sending them in a single SMTP
2052 connection is clearly beneficial. Whenever a delivery to a remote host is
2053 deferred,
2054 </para>
2055 <para>
2056 <indexterm role="concept">
2057 <primary>hints database</primary>
2058 </indexterm>
2059 Exim makes a note in its hints database, and whenever a successful
2060 SMTP delivery has happened, it looks to see if any other messages are waiting
2061 for the same host. If any are found, they are sent over the same SMTP
2062 connection, subject to a configuration limit as to the maximum number in any
2063 one connection.
2064 </para>
2065 </section>
2066 <section>
2067 <title>Permanent delivery failure</title>
2068 <para>
2069 <indexterm role="concept">
2070 <primary>delivery</primary>
2071 <secondary>permanent failure</secondary>
2072 </indexterm>
2073 <indexterm role="concept">
2074 <primary>bounce message</primary>
2075 <secondary>when generated</secondary>
2076 </indexterm>
2077 When a message cannot be delivered to some or all of its intended recipients, a
2078 bounce message is generated. Temporary delivery failures turn into permanent
2079 errors when their timeout expires. All the addresses that fail in a given
2080 delivery attempt are listed in a single message. If the original message has
2081 many recipients, it is possible for some addresses to fail in one delivery
2082 attempt and others to fail subsequently, giving rise to more than one bounce
2083 message. The wording of bounce messages can be customized by the administrator.
2084 See chapter <xref linkend="CHAPemsgcust"/> for details.
2085 </para>
2086 <para>
2087 <indexterm role="concept">
2088 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2089 </indexterm>
2090 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2091 failed addresses, for the benefit of programs that try to analyse such messages
2092 automatically.
2093 </para>
2094 <para>
2095 <indexterm role="concept">
2096 <primary>bounce message</primary>
2097 <secondary>recipient of</secondary>
2098 </indexterm>
2099 A bounce message is normally sent to the sender of the original message, as
2100 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2101 address given in the MAIL command. However, when an address is expanded via a
2102 forward or alias file, an alternative address can be specified for delivery
2103 failures of the generated addresses. For a mailing list expansion (see section
2104 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2105 of the list.
2106 </para>
2107 </section>
2108 <section>
2109 <title>Failures to deliver bounce messages</title>
2110 <para>
2111 <indexterm role="concept">
2112 <primary>bounce message</primary>
2113 <secondary>failure to deliver</secondary>
2114 </indexterm>
2115 If a bounce message (either locally generated or received from a remote host)
2116 itself suffers a permanent delivery failure, the message is left on the queue,
2117 but it is frozen, awaiting the attention of an administrator. There are options
2118 that can be used to make Exim discard such failed messages, or to keep them
2119 for only a short time (see <option>timeout_frozen_after</option> and
2120 <option>ignore_bounce_errors_after</option>).
2121 </para>
2122 </section>
2123 </chapter>
2124
2125 <chapter>
2126 <title>Building and installing Exim</title>
2127 <para>
2128 <indexterm role="concept" id="IIDbuex" class="startofrange">
2129 <primary>building Exim</primary>
2130 </indexterm>
2131 </para>
2132 <section>
2133 <title>Unpacking</title>
2134 <para>
2135 Exim is distributed as a gzipped or bzipped tar file which, when upacked,
2136 creates a directory with the name of the current release (for example,
2137 <filename>exim-4.64</filename>) into which the following files are placed:
2138 </para>
2139 <informaltable frame="none">
2140 <tgroup cols="2" colsep="0" rowsep="0">
2141 <colspec colwidth="140pt" align="left"/>
2142 <colspec colwidth="254pt" align="left"/>
2143 <tbody>
2144 <row>
2145 <entry><filename>ACKNOWLEDGMENTS</filename></entry>
2146 <entry>contains some acknowledgments</entry>
2147 </row>
2148 <row>
2149 <entry><filename>CHANGES</filename></entry>
2150 <entry>contains a reference to where changes are documented</entry>
2151 </row>
2152 <row>
2153 <entry><filename>LICENCE</filename></entry>
2154 <entry>the GNU General Public Licence</entry>
2155 </row>
2156 <row>
2157 <entry><filename>Makefile</filename></entry>
2158 <entry>top-level make file</entry>
2159 </row>
2160 <row>
2161 <entry><filename>NOTICE</filename></entry>
2162 <entry>conditions for the use of Exim</entry>
2163 </row>
2164 <row>
2165 <entry><filename>README</filename></entry>
2166 <entry>list of files, directories and simple build instructions</entry>
2167 </row>
2168 </tbody>
2169 </tgroup>
2170 </informaltable>
2171 <para>
2172 Other files whose names begin with <filename>README</filename> may also be present. The
2173 following subdirectories are created:
2174 </para>
2175 <informaltable frame="none">
2176 <tgroup cols="2" colsep="0" rowsep="0">
2177 <colspec colwidth="140pt" align="left"/>
2178 <colspec colwidth="254pt" align="left"/>
2179 <tbody>
2180 <row>
2181 <entry><filename>Local</filename></entry>
2182 <entry>an empty directory for local configuration files</entry>
2183 </row>
2184 <row>
2185 <entry><filename>OS</filename></entry>
2186 <entry>OS-specific files</entry>
2187 </row>
2188 <row>
2189 <entry><filename>doc</filename></entry>
2190 <entry>documentation files</entry>
2191 </row>
2192 <row>
2193 <entry><filename>exim_monitor</filename></entry>
2194 <entry>source files for the Exim monitor</entry>
2195 </row>
2196 <row>
2197 <entry><filename>scripts</filename></entry>
2198 <entry>scripts used in the build process</entry>
2199 </row>
2200 <row>
2201 <entry><filename>src</filename></entry>
2202 <entry>remaining source files</entry>
2203 </row>
2204 <row>
2205 <entry><filename>util</filename></entry>
2206 <entry>independent utilities</entry>
2207 </row>
2208 </tbody>
2209 </tgroup>
2210 </informaltable>
2211 <para>
2212 The main utility programs are contained in the <filename>src</filename> directory, and are built
2213 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2214 that may be useful to some sites.
2215 </para>
2216 </section>
2217 <section>
2218 <title>Multiple machine architectures and operating systems</title>
2219 <para>
2220 <indexterm role="concept">
2221 <primary>building Exim</primary>
2222 <secondary>multiple OS/architectures</secondary>
2223 </indexterm>
2224 The building process for Exim is arranged to make it easy to build binaries for
2225 a number of different architectures and operating systems from the same set of
2226 source files. Compilation does not take place in the <filename>src</filename> directory.
2227 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2228 system.
2229 <indexterm role="concept">
2230 <primary>symbolic link</primary>
2231 <secondary>to build directory</secondary>
2232 </indexterm>
2233 Symbolic links to the sources are installed in this directory, which is where
2234 the actual building takes place. In most cases, Exim can discover the machine
2235 architecture and operating system for itself, but the defaults can be
2236 overridden if necessary.
2237 </para>
2238 </section>
2239 <section id="SECTdb">
2240 <title>DBM libraries</title>
2241 <para>
2242 <indexterm role="concept">
2243 <primary>DBM libraries</primary>
2244 <secondary>discussion of</secondary>
2245 </indexterm>
2246 <indexterm role="concept">
2247 <primary>hints database</primary>
2248 <secondary>DBM files used for</secondary>
2249 </indexterm>
2250 Even if you do not use any DBM files in your configuration, Exim still needs a
2251 DBM library in order to operate, because it uses indexed files for its hints
2252 databases. Unfortunately, there are a number of DBM libraries in existence, and
2253 different operating systems often have different ones installed.
2254 </para>
2255 <para>
2256 <indexterm role="concept">
2257 <primary>Solaris</primary>
2258 <secondary>DBM library for</secondary>
2259 </indexterm>
2260 <indexterm role="concept">
2261 <primary>IRIX</primary>
2262 <secondary>DBM library for</secondary>
2263 </indexterm>
2264 <indexterm role="concept">
2265 <primary>BSD</primary>
2266 <secondary>DBM library for</secondary>
2267 </indexterm>
2268 <indexterm role="concept">
2269 <primary>Linux</primary>
2270 <secondary>DBM library for</secondary>
2271 </indexterm>
2272 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2273 Linux distribution, the DBM configuration should happen automatically, and you
2274 may be able to ignore this section. Otherwise, you may have to learn more than
2275 you would like about DBM libraries from what follows.
2276 </para>
2277 <para>
2278 <indexterm role="concept">
2279 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2280 </indexterm>
2281 Licensed versions of Unix normally contain a library of DBM functions operating
2282 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2283 versions of Unix seem to vary in what they contain as standard. In particular,
2284 some early versions of Linux have no default DBM library, and different
2285 distributors have chosen to bundle different libraries with their packaged
2286 versions. However, the more recent releases seem to have standardised on the
2287 Berkeley DB library.
2288 </para>
2289 <para>
2290 Different DBM libraries have different conventions for naming the files they
2291 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2292 possibilities:
2293 </para>
2294 <orderedlist numeration="arabic">
2295 <listitem>
2296 <para>
2297 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2298 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2299 </para>
2300 </listitem>
2301 <listitem>
2302 <para>
2303 <indexterm role="concept">
2304 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2305 </indexterm>
2306 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2307 compatibility interface it makes two different hard links to it with names
2308 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2309 file name is used unmodified.
2310 </para>
2311 </listitem>
2312 <listitem>
2313 <para>
2314 <indexterm role="concept">
2315 <primary>Berkeley DB library</primary>
2316 </indexterm>
2317 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2318 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2319 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2320 </para>
2321 </listitem>
2322 <listitem>
2323 <para>
2324 If the Berkeley package is used in its native mode, it operates on a single
2325 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2326 the traditional <emphasis>ndbm</emphasis> interface.
2327 </para>
2328 </listitem>
2329 <listitem>
2330 <para>
2331 To complicate things further, there are several very different versions of the
2332 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2333 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2334 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2335 versions of Berkeley DB can be obtained from
2336 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2337 </para>
2338 </listitem>
2339 <listitem>
2340 <para>
2341 <indexterm role="concept">
2342 <primary><emphasis>tdb</emphasis> DBM library</primary>
2343 </indexterm>
2344 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2345 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2346 operates on a single file.
2347 </para>
2348 </listitem>
2349 </orderedlist>
2350 <para>
2351 <indexterm role="concept">
2352 <primary>USE_DB</primary>
2353 </indexterm>
2354 <indexterm role="concept">
2355 <primary>DBM libraries</primary>
2356 <secondary>configuration for building</secondary>
2357 </indexterm>
2358 Exim and its utilities can be compiled to use any of these interfaces. In order
2359 to use any version of the Berkeley DB package in native mode, you must set
2360 USE_DB in an appropriate configuration file (typically
2361 <filename>Local/Makefile</filename>). For example:
2362 </para>
2363 <literallayout class="monospaced">
2364 USE_DB=yes
2365 </literallayout>
2366 <para>
2367 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2368 error is diagnosed if you set more than one of these.
2369 </para>
2370 <para>
2371 At the lowest level, the build-time configuration sets none of these options,
2372 thereby assuming an interface of type (1). However, some operating system
2373 configuration files (for example, those for the BSD operating systems and
2374 Linux) assume type (4) by setting USE_DB as their default, and the
2375 configuration files for Cygwin set USE_GDBM. Anything you set in
2376 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2377 </para>
2378 <para>
2379 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2380 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2381 in one of these lines:
2382 </para>
2383 <literallayout class="monospaced">
2384 DBMLIB = -ldb
2385 DBMLIB = -ltdb
2386 </literallayout>
2387 <para>
2388 Settings like that will work if the DBM library is installed in the standard
2389 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2390 the default path. You may need to set INCLUDE to specify where the header
2391 file is, and to specify the path to the library more fully in DBMLIB, as in
2392 this example:
2393 </para>
2394 <literallayout class="monospaced">
2395 INCLUDE=-I/usr/local/include/db-4.1
2396 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2397 </literallayout>
2398 <para>
2399 There is further detailed discussion about the various DBM libraries in the
2400 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2401 </para>
2402 </section>
2403 <section>
2404 <title>Pre-building configuration</title>
2405 <para>
2406 <indexterm role="concept">
2407 <primary>building Exim</primary>
2408 <secondary>pre-building configuration</secondary>
2409 </indexterm>
2410 <indexterm role="concept">
2411 <primary>configuration for building Exim</primary>
2412 </indexterm>
2413 <indexterm role="concept">
2414 <primary><filename>Local/Makefile</filename></primary>
2415 </indexterm>
2416 <indexterm role="concept">
2417 <primary><filename>src/EDITME</filename></primary>
2418 </indexterm>
2419 Before building Exim, a local configuration file that specifies options
2420 independent of any operating system has to be created with the name
2421 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2422 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2423 therein. These descriptions are therefore not repeated here. If you are
2424 building Exim for the first time, the simplest thing to do is to copy
2425 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2426 </para>
2427 <para>
2428 There are three settings that you must supply, because Exim will not build
2429 without them. They are the location of the run time configuration file
2430 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2431 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2432 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2433 a colon-separated list of file names; Exim uses the first of them that exists.
2434 </para>
2435 <para>
2436 There are a few other parameters that can be specified either at build time or
2437 at run time, to enable the same binary to be used on a number of different
2438 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2439 directory (if not within the spool directory) are fixed, it is recommended that
2440 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2441 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2442 be logged.
2443 </para>
2444 <para>
2445 <indexterm role="concept">
2446 <primary>content scanning</primary>
2447 <secondary>specifying at build time</secondary>
2448 </indexterm>
2449 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2450 access control lists are not compiled by default. If you want to include these
2451 facilities, you need to set
2452 </para>
2453 <literallayout class="monospaced">
2454 WITH_CONTENT_SCAN=yes
2455 </literallayout>
2456 <para>
2457 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2458 chapter <xref linkend="CHAPexiscan"/>.
2459 </para>
2460 <para>
2461 <indexterm role="concept">
2462 <primary><filename>Local/eximon.conf</filename></primary>
2463 </indexterm>
2464 <indexterm role="concept">
2465 <primary><filename>exim_monitor/EDITME</filename></primary>
2466 </indexterm>
2467 If you are going to build the Exim monitor, a similar configuration process is
2468 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2469 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2470 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2471 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2472 </para>
2473 <para>
2474 This is all the configuration that is needed in straightforward cases for known
2475 operating systems. However, the building process is set up so that it is easy
2476 to override options that are set by default or by operating-system-specific
2477 configuration files, for example to change the name of the C compiler, which
2478 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2479 do this.
2480 </para>
2481 </section>
2482 <section>
2483 <title>Support for iconv()</title>
2484 <para>
2485 <indexterm role="concept">
2486 <primary><function>iconv()</function> support</primary>
2487 </indexterm>
2488 <indexterm role="concept">
2489 <primary>RFC 2047</primary>
2490 </indexterm>
2491 The contents of header lines in messages may be encoded according to the rules
2492 described RFC 2047. This makes it possible to transmit characters that are not
2493 in the ASCII character set, and to label them as being in a particular
2494 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2495 mechanism, it decodes them, and translates them into a specified character set
2496 (default ISO-8859-1). The translation is possible only if the operating system
2497 supports the <function>iconv()</function> function.
2498 </para>
2499 <para>
2500 However, some of the operating systems that supply <function>iconv()</function> do not support
2501 very many conversions. The GNU <option>libiconv</option> library (available from
2502 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2503 systems to remedy this deficiency, as well as on systems that do not supply
2504 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2505 </para>
2506 <literallayout class="monospaced">
2507 HAVE_ICONV=yes
2508 </literallayout>
2509 <para>
2510 to your <filename>Local/Makefile</filename> and rebuild Exim.
2511 </para>
2512 </section>
2513 <section id="SECTinctlsssl">
2514 <title>Including TLS/SSL encryption support</title>
2515 <para>
2516 <indexterm role="concept">
2517 <primary>TLS</primary>
2518 <secondary>including support for TLS</secondary>
2519 </indexterm>
2520 <indexterm role="concept">
2521 <primary>encryption</primary>
2522 <secondary>including support for</secondary>
2523 </indexterm>
2524 <indexterm role="concept">
2525 <primary>SUPPORT_TLS</primary>
2526 </indexterm>
2527 <indexterm role="concept">
2528 <primary>OpenSSL</primary>
2529 <secondary>building Exim with</secondary>
2530 </indexterm>
2531 <indexterm role="concept">
2532 <primary>GnuTLS</primary>
2533 <secondary>building Exim with</secondary>
2534 </indexterm>
2535 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2536 command as per RFC 2487. It can also support legacy clients that expect to
2537 start a TLS session immediately on connection to a non-standard port (see the
2538 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2539 line option).
2540 </para>
2541 <para>
2542 If you want to build Exim with TLS support, you must first install either the
2543 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2544 implementing SSL.
2545 </para>
2546 <para>
2547 If OpenSSL is installed, you should set
2548 </para>
2549 <literallayout class="monospaced">
2550 SUPPORT_TLS=yes
2551 TLS_LIBS=-lssl -lcrypto
2552 </literallayout>
2553 <para>
2554 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2555 OpenSSL library and include files. For example:
2556 </para>
2557 <literallayout class="monospaced">
2558 SUPPORT_TLS=yes
2559 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2560 TLS_INCLUDE=-I/usr/local/openssl/include/
2561 </literallayout>
2562 <para>
2563 <indexterm role="concept">
2564 <primary>USE_GNUTLS</primary>
2565 </indexterm>
2566 If GnuTLS is installed, you should set
2567 </para>
2568 <literallayout class="monospaced">
2569 SUPPORT_TLS=yes
2570 USE_GNUTLS=yes
2571 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2572 </literallayout>
2573 <para>
2574 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2575 library and include files. For example:
2576 </para>
2577 <literallayout class="monospaced">
2578 SUPPORT_TLS=yes
2579 USE_GNUTLS=yes
2580 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2581 TLS_INCLUDE=-I/usr/gnu/include
2582 </literallayout>
2583 <para>
2584 You do not need to set TLS_INCLUDE if the relevant directory is already
2585 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2586 given in chapter <xref linkend="CHAPTLS"/>.
2587 </para>
2588 </section>
2589 <section>
2590 <title>Use of tcpwrappers</title>
2591 <para>
2592 <indexterm role="concept">
2593 <primary>tcpwrappers</primary>
2594 <secondary>building Exim to support</secondary>
2595 </indexterm>
2596 <indexterm role="concept">
2597 <primary>USE_TCP_WRAPPERS</primary>
2598 </indexterm>
2599 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2600 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2601 alternative to Exim&#x2019;s own checking facilities for installations that are
2602 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2603 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2604 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2605 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2606 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2607 you might have
2608 </para>
2609 <literallayout class="monospaced">
2610 USE_TCP_WRAPPERS=yes
2611 CFLAGS=-O -I/usr/local/include
2612 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2613 </literallayout>
2614 <para>
2615 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2616 <quote>exim</quote>. For example, the line
2617 </para>
2618 <literallayout class="monospaced">
2619 exim : LOCAL  192.168.1.  .friendly.domain.example
2620 </literallayout>
2621 <para>
2622 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2623 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2624 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2625 further details.
2626 </para>
2627 </section>
2628 <section>
2629 <title>Including support for IPv6</title>
2630 <para>
2631 <indexterm role="concept">
2632 <primary>IPv6</primary>
2633 <secondary>including support for</secondary>
2634 </indexterm>
2635 Exim contains code for use on systems that have IPv6 support. Setting
2636 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2637 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2638 where the IPv6 support is not fully integrated into the normal include and
2639 library files.
2640 </para>
2641 <para>
2642 Two different types of DNS record for handling IPv6 addresses have been
2643 defined. AAAA records (analagous to A records for IPv4) are in use, and are
2644 currently seen as the mainstream. Another record type called A6 was proposed
2645 as better than AAAA because it had more flexibility. However, it was felt to be
2646 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2647 if anyone is actually using A6 records. Exim has support for A6 records, but
2648 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2649 support has not been tested for some time.
2650 </para>
2651 </section>
2652 <section>
2653 <title>The building process</title>
2654 <para>
2655 <indexterm role="concept">
2656 <primary>build directory</primary>
2657 </indexterm>
2658 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2659 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2660 operating system types, and creates a build directory if one does not exist.
2661 For example, on a Sun system running Solaris 8, the directory
2662 <filename>build-SunOS5-5.8-sparc</filename> is created.
2663 <indexterm role="concept">
2664 <primary>symbolic link</primary>
2665 <secondary>to source files</secondary>
2666 </indexterm>
2667 Symbolic links to relevant source files are installed in the build directory.
2668 </para>
2669 <para>
2670 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2671 building process fails if it is set.
2672 </para>
2673 <para>
2674 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2675 a make file inside the build directory, using the configuration files from the
2676 <filename>Local</filename> directory. The new make file is then passed to another instance of
2677 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2678 then compiling and linking the binaries for the Exim monitor (if configured), a
2679 number of utility programs, and finally Exim itself. The command <literal>make
2680 makefile</literal> can be used to force a rebuild of the make file in the build
2681 directory, should this ever be necessary.
2682 </para>
2683 <para>
2684 If you have problems building Exim, check for any comments there may be in the
2685 <filename>README</filename> file concerning your operating system, and also take a look at the
2686 FAQ, where some common problems are covered.
2687 </para>
2688 </section>
2689 <section>
2690 <title>Output from <quote>make</quote></title>
2691 <para>
2692 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2693 unreadable, because these lines can be very long. For this reason, the normal
2694 output is suppressed by default, and instead output similar to that which
2695 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2696 each module that is being compiled or linked. However, it is still possible to
2697 get the full output, by calling <emphasis>make</emphasis> like this:
2698 </para>
2699 <literallayout class="monospaced">
2700 FULLECHO='' make -e
2701 </literallayout>
2702 <para>
2703 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2704 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2705 given in addition to the short output.
2706 </para>
2707 </section>
2708 <section id="SECToverride">
2709 <title>Overriding build-time options for Exim</title>
2710 <para>
2711 <indexterm role="concept">
2712 <primary>build-time options</primary>
2713 <secondary>overriding</secondary>
2714 </indexterm>
2715 The main make file that is created at the beginning of the building process
2716 consists of the concatenation of a number of files which set configuration
2717 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2718 more than once, the last setting overrides any previous ones. This provides a
2719 convenient way of overriding defaults. The files that are concatenated are, in
2720 order:
2721 </para>
2722 <literallayout>
2723 <filename>OS/Makefile-Default</filename>
2724 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2725 <filename>Local/Makefile</filename>
2726 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2727 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2728 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2729 <filename>OS/Makefile-Base</filename>
2730 </literallayout>
2731 <para>
2732 <indexterm role="concept">
2733 <primary><filename>Local/Makefile</filename></primary>
2734 </indexterm>
2735 <indexterm role="concept">
2736 <primary>building Exim</primary>
2737 <secondary>operating system type</secondary>
2738 </indexterm>
2739 <indexterm role="concept">
2740 <primary>building Exim</primary>
2741 <secondary>architecture type</secondary>
2742 </indexterm>
2743 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2744 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2745 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2746 and are often not needed.
2747 </para>
2748 <para>
2749 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2750 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2751 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2752 values are used, thereby providing a means of forcing particular settings.
2753 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2754 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2755 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2756 that Exim expects. You can run these scripts directly from the shell in order
2757 to find out what values are being used on your system.
2758 </para>
2759 <para>
2760 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2761 therein. Some (but not all) are mentioned below. If there is something that
2762 needs changing, review the contents of this file and the contents of the make
2763 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2764 default values are.
2765 </para>
2766 <para>
2767 <indexterm role="concept">
2768 <primary>building Exim</primary>
2769 <secondary>overriding default settings</secondary>
2770 </indexterm>
2771 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2772 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2773 need to change the original files. Instead, you should make the changes by
2774 putting the new values in an appropriate <filename>Local</filename> file. For example,
2775 <indexterm role="concept">
2776 <primary>Tru64-Unix build-time settings</primary>
2777 </indexterm>
2778 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2779 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2780 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2781 called with the option <option>-std1</option>, to make it recognize some of the features of
2782 Standard C that Exim uses. (Most other compilers recognize Standard C by
2783 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2784 containing the lines
2785 </para>
2786 <literallayout class="monospaced">
2787 CC=cc
2788 CFLAGS=-std1
2789 </literallayout>
2790 <para>
2791 If you are compiling for just one operating system, it may be easier to put
2792 these lines directly into <filename>Local/Makefile</filename>.
2793 </para>
2794 <para>
2795 Keeping all your local configuration settings separate from the distributed
2796 files makes it easy to transfer them to new versions of Exim simply by copying
2797 the contents of the <filename>Local</filename> directory.
2798 </para>
2799 <para>
2800 <indexterm role="concept">
2801 <primary>NIS lookup type</primary>
2802 <secondary>including support for</secondary>
2803 </indexterm>
2804 <indexterm role="concept">
2805 <primary>NIS+ lookup type</primary>
2806 <secondary>including support for</secondary>
2807 </indexterm>
2808 <indexterm role="concept">
2809 <primary>LDAP</primary>
2810 <secondary>including support for</secondary>
2811 </indexterm>
2812 <indexterm role="concept">
2813 <primary>lookup</primary>
2814 <secondary>inclusion in binary</secondary>
2815 </indexterm>
2816 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2817 lookup, but not all systems have these components installed, so the default is
2818 not to include the relevant code in the binary. All the different kinds of file
2819 and database lookup that Exim supports are implemented as separate code modules
2820 which are included only if the relevant compile-time options are set. In the
2821 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2822 </para>
2823 <literallayout class="monospaced">
2824 LOOKUP_LDAP=yes
2825 LOOKUP_NIS=yes
2826 LOOKUP_NISPLUS=yes
2827 </literallayout>
2828 <para>
2829 and similar settings apply to the other lookup types. They are all listed in
2830 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2831 libraries need to be installed before compiling Exim.
2832 <indexterm role="concept">
2833 <primary>cdb</primary>
2834 <secondary>including support for</secondary>
2835 </indexterm>
2836 However, there are some optional lookup types (such as cdb) for which
2837 the code is entirely contained within Exim, and no external include
2838 files or libraries are required. When a lookup type is not included in the
2839 binary, attempts to configure Exim to use it cause run time configuration
2840 errors.
2841 </para>
2842 <para>
2843 <indexterm role="concept">
2844 <primary>Perl</primary>
2845 <secondary>including support for</secondary>
2846 </indexterm>
2847 Exim can be linked with an embedded Perl interpreter, allowing Perl
2848 subroutines to be called during string expansion. To enable this facility,
2849 </para>
2850 <literallayout class="monospaced">
2851 EXIM_PERL=perl.o
2852 </literallayout>
2853 <para>
2854 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2855 chapter <xref linkend="CHAPperl"/>.
2856 </para>
2857 <para>
2858 <indexterm role="concept">
2859 <primary>X11 libraries</primary>
2860 <secondary>location of</secondary>
2861 </indexterm>
2862 The location of the X11 libraries is something that varies a lot between
2863 operating systems, and there may be different versions of X11 to cope
2864 with. Exim itself makes no use of X11, but if you are compiling the Exim
2865 monitor, the X11 libraries must be available.
2866 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2867 </para>
2868 <literallayout class="monospaced">
2869 X11=/usr/X11R6
2870 XINCLUDE=-I$(X11)/include
2871 XLFLAGS=-L$(X11)/lib
2872 </literallayout>
2873 <para>
2874 These are overridden in some of the operating-system configuration files. For
2875 example, in <filename>OS/Makefile-SunOS5</filename> there is
2876 </para>
2877 <literallayout class="monospaced">
2878 X11=/usr/openwin
2879 XINCLUDE=-I$(X11)/include
2880 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2881 </literallayout>
2882 <para>
2883 If you need to override the default setting for your operating system, place a
2884 definition of all three of these variables into your
2885 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2886 </para>
2887 <para>
2888 <indexterm role="concept">
2889 <primary>EXTRALIBS</primary>
2890 </indexterm>
2891 If you need to add any extra libraries to the link steps, these can be put in a
2892 variable called EXTRALIBS, which appears in all the link commands, but by
2893 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2894 command for linking the main Exim binary, and not for any associated utilities.
2895 </para>
2896 <para>
2897 <indexterm role="concept">
2898 <primary>DBM libraries</primary>
2899 <secondary>configuration for building</secondary>
2900 </indexterm>
2901 There is also DBMLIB, which appears in the link commands for binaries that
2902 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2903 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2904 binary, and which can be used, for example, to include additional X11
2905 libraries.
2906 </para>
2907 <para>
2908 <indexterm role="concept">
2909 <primary>configuration file</primary>
2910 <secondary>editing</secondary>
2911 </indexterm>
2912 The make file copes with rebuilding Exim correctly if any of the configuration
2913 files are edited. However, if an optional configuration file is deleted, it is
2914 necessary to touch the associated non-optional file (that is,
2915 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2916 </para>
2917 </section>
2918 <section>
2919 <title>OS-specific header files</title>
2920 <para>
2921 <indexterm role="concept">
2922 <primary><filename>os.h</filename></primary>
2923 </indexterm>
2924 <indexterm role="concept">
2925 <primary>building Exim</primary>
2926 <secondary>OS-specific C header files</secondary>
2927 </indexterm>
2928 The <filename>OS</filename> directory contains a number of files with names of the form
2929 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2930 normally need to be changed. There is a list of macro settings that are
2931 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2932 are porting Exim to a new operating system.
2933 </para>
2934 </section>
2935 <section>
2936 <title>Overriding build-time options for the monitor</title>
2937 <para>
2938 <indexterm role="concept">
2939 <primary>building Eximon</primary>
2940 <secondary>overriding default options</secondary>
2941 </indexterm>
2942 A similar process is used for overriding things when building the Exim monitor,
2943 where the files that are involved are
2944 </para>
2945 <literallayout>
2946 <filename>OS/eximon.conf-Default</filename>
2947 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2948 <filename>Local/eximon.conf</filename>
2949 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2950 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2951 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2952 </literallayout>
2953 <para>
2954 <indexterm role="concept">
2955 <primary><filename>Local/eximon.conf</filename></primary>
2956 </indexterm>
2957 As with Exim itself, the final three files need not exist, and in this case the
2958 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2959 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2960 variables of the same name, preceded by EXIMON_. For example, setting
2961 EXIMON_LOG_DEPTH in the environment overrides the value of
2962 LOG_DEPTH at run time.
2963 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2964 </para>
2965 </section>
2966 <section>
2967 <title>Installing Exim binaries and scripts</title>
2968 <para>
2969 <indexterm role="concept">
2970 <primary>installing Exim</primary>
2971 </indexterm>
2972 <indexterm role="concept">
2973 <primary>BIN_DIRECTORY</primary>
2974 </indexterm>
2975 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2976 arguments. The script copies binaries and utility scripts into the directory
2977 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2978 <indexterm role="concept">
2979 <primary>setuid</primary>
2980 <secondary>installing Exim with</secondary>
2981 </indexterm>
2982 The install script copies files only if they are newer than the files they are
2983 going to replace. The Exim binary is required to be owned by root and have the
2984 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2985 install</literal> as root so that it can set up the Exim binary in this way. However, in
2986 some special situations (for example, if a host is doing no local deliveries)
2987 it may be possible to run Exim without making the binary setuid root (see
2988 chapter <xref linkend="CHAPsecurity"/> for details).
2989 </para>
2990 <para>
2991 <indexterm role="concept">
2992 <primary>CONFIGURE_FILE</primary>
2993 </indexterm>
2994 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2995 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2996 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2997 by the installation script. If a run time configuration file already exists, it
2998 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2999 alternative files, no default is installed.
3000 </para>
3001 <para>
3002 <indexterm role="concept">
3003 <primary>system aliases file</primary>
3004 </indexterm>
3005 <indexterm role="concept">
3006 <primary><filename>/etc/aliases</filename></primary>
3007 </indexterm>
3008 One change is made to the default configuration file when it is installed: the
3009 default configuration contains a router that references a system aliases file.
3010 The path to this file is set to the value specified by
3011 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3012 If the system aliases file does not exist, the installation script creates it,
3013 and outputs a comment to the user.
3014 </para>
3015 <para>
3016 The created file contains no aliases, but it does contain comments about the
3017 aliases a site should normally have. Mail aliases have traditionally been
3018 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3019 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3020 Exim&#x2019;s configuration if necessary.
3021 </para>
3022 <para>
3023 The default configuration uses the local host&#x2019;s name as the only local domain,
3024 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3025 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3026 directories are supported, but no NIS or NIS+ support is configured. Domains
3027 other than the name of the local host are routed using the DNS, with delivery
3028 over SMTP.
3029 </para>
3030 <para>
3031 It is possible to install Exim for special purposes (such as building a binary
3032 distribution) in a private part of the file system. You can do this by a
3033 command such as
3034 </para>
3035 <literallayout class="monospaced">
3036 make DESTDIR=/some/directory/ install
3037 </literallayout>
3038 <para>
3039 This has the effect of pre-pending the specified directory to all the file
3040 paths, except the name of the system aliases file that appears in the default
3041 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3042 For backwards compatibility, ROOT is used if DESTDIR is not set,
3043 but this usage is deprecated.
3044 </para>
3045 <para>
3046 <indexterm role="concept">
3047 <primary>installing Exim</primary>
3048 <secondary>what is not installed</secondary>
3049 </indexterm>
3050 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3051 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3052 first of these only once (if you are upgrading from Exim 3), and the second
3053 isn&#x2019;t really part of Exim. None of the documentation files in the <filename>doc</filename>
3054 directory are copied, except for the info files when you have set
3055 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3056 </para>
3057 <para>
3058 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3059 to their names. The Exim binary itself, however, is handled differently. It is
3060 installed under a name that includes the version number and the compile number,
3061 for example <filename>exim-4.64-1</filename>. The script then arranges for a symbolic link
3062 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3063 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3064 from the directory (as seen by other processes).
3065 </para>
3066 <para>
3067 <indexterm role="concept">
3068 <primary>installing Exim</primary>
3069 <secondary>testing the script</secondary>
3070 </indexterm>
3071 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3072 real, you can pass the <option>-n</option> option to the installation script by this
3073 command:
3074 </para>
3075 <literallayout class="monospaced">
3076 make INSTALL_ARG=-n install
3077 </literallayout>
3078 <para>
3079 The contents of the variable INSTALL_ARG are passed to the installation
3080 script. You do not need to be root to run this test. Alternatively, you can run
3081 the installation script directly, but this must be from within the build
3082 directory. For example, from the top-level Exim directory you could use this
3083 command:
3084 </para>
3085 <literallayout class="monospaced">
3086 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3087 </literallayout>
3088 <para>
3089 <indexterm role="concept">
3090 <primary>installing Exim</primary>
3091 <secondary>install script options</secondary>
3092 </indexterm>
3093 There are two other options that can be supplied to the installation script.
3094 </para>
3095 <itemizedlist>
3096 <listitem>
3097 <para>
3098 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3099 to root, and the call to make it a setuid binary.
3100 </para>
3101 </listitem>
3102 <listitem>
3103 <para>
3104 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3105 installed binary.
3106 </para>
3107 </listitem>
3108 </itemizedlist>
3109 <para>
3110 INSTALL_ARG can be used to pass these options to the script. For example:
3111 </para>
3112 <literallayout class="monospaced">
3113 make INSTALL_ARG=-no_symlink install
3114 </literallayout>
3115 <para>
3116 The installation script can also be given arguments specifying which files are
3117 to be copied. For example, to install just the Exim binary, and nothing else,
3118 without creating the symbolic link, you could use:
3119 </para>
3120 <literallayout class="monospaced">
3121 make INSTALL_ARG='-no_symlink exim' install
3122 </literallayout>
3123 </section>
3124 <section id="SECTinsinfdoc">
3125 <title>Installing info documentation</title>
3126 <para>
3127 <indexterm role="concept">
3128 <primary>installing Exim</primary>
3129 <secondary><emphasis>info</emphasis> documentation</secondary>
3130 </indexterm>
3131 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3132 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3133 distribution. Instead it is available separately from the ftp site (see section
3134 <xref linkend="SECTavail"/>).
3135 </para>
3136 <para>
3137 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3138 source of the documentation is found in the source tree, running <literal>make
3139 install</literal> automatically builds the info files and installs them.
3140 </para>
3141 </section>
3142 <section>
3143 <title>Setting up the spool directory</title>
3144 <para>
3145 <indexterm role="concept">
3146 <primary>spool directory</primary>
3147 <secondary>creating</secondary>
3148 </indexterm>
3149 When it starts up, Exim tries to create its spool directory if it does not
3150 exist. The Exim uid and gid are used for the owner and group of the spool
3151 directory. Sub-directories are automatically created in the spool directory as
3152 necessary.
3153 </para>
3154 </section>
3155 <section>
3156 <title>Testing</title>
3157 <para>
3158 <indexterm role="concept">
3159 <primary>testing</primary>
3160 <secondary>installation</secondary>
3161 </indexterm>
3162 Having installed Exim, you can check that the run time configuration file is
3163 syntactically valid by running the following command, which assumes that the
3164 Exim binary directory is within your PATH environment variable:
3165 </para>
3166 <literallayout class="monospaced">
3167 exim -bV
3168 </literallayout>
3169 <para>
3170 If there are any errors in the configuration file, Exim outputs error messages.
3171 Otherwise it outputs the version number and build date,
3172 the DBM library that is being used, and information about which drivers and
3173 other optional code modules are included in the binary.
3174 Some simple routing tests can be done by using the address testing option. For
3175 example,
3176 </para>
3177 <literallayout>
3178 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3179 </literallayout>
3180 <para>
3181 should verify that it recognizes a local mailbox, and
3182 </para>
3183 <literallayout>
3184 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3185 </literallayout>
3186 <para>
3187 a remote one. Then try getting it to deliver mail, both locally and remotely.
3188 This can be done by passing messages directly to Exim, without going through a
3189 user agent. For example:
3190 </para>
3191 <literallayout class="monospaced">
3192 exim -v postmaster@your.domain.example
3193 From: user@your.domain.example
3194 To: postmaster@your.domain.example
3195 Subject: Testing Exim
3196
3197 This is a test message.
3198 ^D
3199 </literallayout>
3200 <para>
3201 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3202 In this case you should see copies of three log lines, one for the message&#x2019;s
3203 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3204 </para>
3205 <para>
3206 <indexterm role="concept">
3207 <primary>delivery</primary>
3208 <secondary>problems with</secondary>
3209 </indexterm>
3210 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3211 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3212 of information is running Exim with debugging turned on, by specifying the
3213 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3214 with debugging turned on by a command of the form
3215 </para>
3216 <literallayout>
3217 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3218 </literallayout>
3219 <para>
3220 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3221 produces rather a lot of output, but you can cut this down to specific areas.
3222 For example, if you use <option>-d-all+route</option> only the debugging information
3223 relevant to routing is included. (See the <option>-d</option> option in chapter
3224 <xref linkend="CHAPcommandline"/> for more details.)
3225 </para>
3226 <para>
3227 <indexterm role="concept">
3228 <primary><quote>sticky</quote> bit</primary>
3229 </indexterm>
3230 <indexterm role="concept">
3231 <primary>lock files</primary>
3232 </indexterm>
3233 One specific problem that has shown up on some sites is the inability to do
3234 local deliveries into a shared mailbox directory, because it does not have the
3235 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3236 writing to a mailbox file, and if it cannot create the lock file, the delivery
3237 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3238 directory, or by setting a specific group for local deliveries and allowing
3239 that group to create files in the directory (see the comments above the
3240 <command>local_delivery</command> transport in the default configuration file). Another
3241 approach is to configure Exim not to use lock files, but just to rely on
3242 <function>fcntl()</function> locking instead. However, you should do this only if all user
3243 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3244 see chapter <xref linkend="CHAPappendfile"/>.
3245 </para>
3246 <para>
3247 One thing that cannot be tested on a system that is already running an MTA is
3248 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3249 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3250 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3251 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3252 incoming SMTP mail.
3253 </para>
3254 <para>
3255 Testing a new version on a system that is already running Exim can most easily
3256 be done by building a binary with a different CONFIGURE_FILE setting. From
3257 within the run time configuration, all other file and directory names
3258 that Exim uses can be altered, in order to keep it entirely clear of the
3259 production version.
3260 </para>
3261 </section>
3262 <section>
3263 <title>Replacing another MTA with Exim</title>
3264 <para>
3265 <indexterm role="concept">
3266 <primary>replacing another MTA</primary>
3267 </indexterm>
3268 Building and installing Exim for the first time does not of itself put it in
3269 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3270 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3271 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3272 binary in order to get the user agents to pass messages to Exim. This is
3273 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3274 or <filename>/usr/lib/sendmail</filename>
3275 <indexterm role="concept">
3276 <primary>symbolic link</primary>
3277 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3278 </indexterm>
3279 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3280 privilege and executable status from the old MTA. It is then necessary to stop
3281 and restart the mailer daemon, if one is running.
3282 </para>
3283 <para>
3284 <indexterm role="concept">
3285 <primary>FreeBSD</primary>
3286 <secondary>MTA indirection</secondary>
3287 </indexterm>
3288 <indexterm role="concept">
3289 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3290 </indexterm>
3291 Some operating systems have introduced alternative ways of switching MTAs. For
3292 example, if you are running FreeBSD, you need to edit the file
3293 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3294 described. A typical example of the contents of this file for running Exim is
3295 as follows:
3296 </para>
3297 <literallayout class="monospaced">
3298 sendmail            /usr/exim/bin/exim
3299 send-mail           /usr/exim/bin/exim
3300 mailq               /usr/exim/bin/exim -bp
3301 newaliases          /usr/bin/true
3302 </literallayout>
3303 <para>
3304 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3305 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3306 favourite user agent.
3307 </para>
3308 <para>
3309 You should consider what to tell your users about the change of MTA. Exim may
3310 have different capabilities to what was previously running, and there are
3311 various operational differences such as the text of messages produced by
3312 command line options and in bounce messages. If you allow your users to make
3313 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3314 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3315 </para>
3316 </section>
3317 <section>
3318 <title>Upgrading Exim</title>
3319 <para>
3320 <indexterm role="concept">
3321 <primary>upgrading Exim</primary>
3322 </indexterm>
3323 If you are already running Exim on your host, building and installing a new
3324 version automatically makes it available to MUAs, or any other programs that
3325 call the MTA directly. However, if you are running an Exim daemon, you do need
3326 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3327 new binary. You do not need to stop processing mail in order to install a new
3328 version of Exim. The install script does not modify an existing runtime
3329 configuration file.
3330 </para>
3331 </section>
3332 <section>
3333 <title>Stopping the Exim daemon on Solaris</title>
3334 <para>
3335 <indexterm role="concept">
3336 <primary>Solaris</primary>
3337 <secondary>stopping Exim on</secondary>
3338 </indexterm>
3339 The standard command for stopping the mailer daemon on Solaris is
3340 </para>
3341 <literallayout class="monospaced">
3342 /etc/init.d/sendmail stop
3343 </literallayout>
3344 <para>
3345 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3346 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3347 for the text <quote>sendmail</quote>; this is not present because the actual program name
3348 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3349 solution is to replace the line that finds the process id with something like
3350 </para>
3351 <literallayout class="monospaced">
3352 pid=`cat /var/spool/exim/exim-daemon.pid`
3353 </literallayout>
3354 <para>
3355 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3356 </para>
3357 <para>
3358 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3359 still be received from local processes, and if automatic delivery is configured
3360 (the normal case), deliveries will still occur.
3361 </para>
3362 </section>
3363 </chapter>
3364
3365 <chapter id="CHAPcommandline">
3366 <title>The Exim command line</title>
3367 <para>
3368 <indexterm role="concept" id="IIDclo1" class="startofrange">
3369 <primary>command line</primary>
3370 <secondary>options</secondary>
3371 </indexterm>
3372 <indexterm role="concept" id="IIDclo2" class="startofrange">
3373 <primary>options</primary>
3374 <secondary>command line</secondary>
3375 </indexterm>
3376 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3377 each starting with a hyphen character, followed by a number of arguments. The
3378 options are compatible with the main options of Sendmail, and there are also
3379 some additional options, some of which are compatible with Smail 3. Certain
3380 combinations of options do not make sense, and provoke an error if used.
3381 The form of the arguments depends on which options are set.
3382 </para>
3383 <section>
3384 <title>Setting options by program name</title>
3385 <para>
3386 <indexterm role="concept">
3387 <primary><emphasis>mailq</emphasis></primary>
3388 </indexterm>
3389 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3390 were present before any other options.
3391 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3392 standard output.
3393 This feature is for compatibility with some systems that contain a command of
3394 that name in one of the standard libraries, symbolically linked to
3395 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3396 </para>
3397 <para>
3398 <indexterm role="concept">
3399 <primary><emphasis>rsmtp</emphasis></primary>
3400 </indexterm>
3401 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3402 were present before any other options, for compatibility with Smail. The
3403 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3404 format.
3405 </para>
3406 <para>
3407 <indexterm role="concept">
3408 <primary><emphasis>rmail</emphasis></primary>
3409 </indexterm>
3410 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3411 <option>-oee</option> options were present before any other options, for compatibility with
3412 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3413 </para>
3414 <para>
3415 <indexterm role="concept">
3416 <primary><emphasis>runq</emphasis></primary>
3417 </indexterm>
3418 <indexterm role="concept">
3419 <primary>queue runner</primary>
3420 </indexterm>
3421 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3422 were present before any other options, for compatibility with Smail. The <option>-q</option>
3423 option causes a single queue runner process to be started.
3424 </para>
3425 <para>
3426 <indexterm role="concept">
3427 <primary><emphasis>newaliases</emphasis></primary>
3428 </indexterm>
3429 <indexterm role="concept">
3430 <primary>alias file</primary>
3431 <secondary>building</secondary>
3432 </indexterm>
3433 <indexterm role="concept">
3434 <primary>Sendmail compatibility</primary>
3435 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3436 </indexterm>
3437 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3438 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3439 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3440 the concept of a single alias file, but can be configured to run a given
3441 command if called with the <option>-bi</option> option.
3442 </para>
3443 </section>
3444 <section id="SECTtrustedadmin">
3445 <title>Trusted and admin users</title>
3446 <para>
3447 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3448 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3449 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3450 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3451 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3452 </para>
3453 <itemizedlist>
3454 <listitem>
3455 <para>
3456 <indexterm role="concept">
3457 <primary>trusted user</primary>
3458 <secondary>definition of</secondary>
3459 </indexterm>
3460 <indexterm role="concept">
3461 <primary>user</primary>
3462 <secondary>trusted definition of</secondary>
3463 </indexterm>
3464 The trusted users are root, the Exim user, any user listed in the
3465 <option>trusted_users</option> configuration option, and any user whose current group or any
3466 supplementary group is one of those listed in the <option>trusted_groups</option>
3467 configuration option. Note that the Exim group is not automatically trusted.
3468 </para>
3469 <para>
3470 <indexterm role="concept">
3471 <primary><quote>From</quote> line</primary>
3472 </indexterm>
3473 <indexterm role="concept">
3474 <primary>envelope sender</primary>
3475 </indexterm>
3476 Trusted users are always permitted to use the <option>-f</option> option or a leading
3477 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3478 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3479 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3480 users to set envelope senders.
3481 </para>
3482 <para>
3483 <indexterm role="concept">
3484 <primary><emphasis>From:</emphasis> header line</primary>
3485 </indexterm>
3486 <indexterm role="concept">
3487 <primary><emphasis>Sender:</emphasis> header line</primary>
3488 </indexterm>
3489 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3490 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3491 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3492 </para>
3493 <para>
3494 Trusted users may also specify a host name, host address, interface address,
3495 protocol name, ident value, and authentication data when submitting a message
3496 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3497 have the characteristics of messages received from a remote host. Untrusted
3498 users may in some circumstances use <option>-f</option>, but can never set the other values
3499 that are available to trusted users.
3500 </para>
3501 </listitem>
3502 <listitem>
3503 <para>
3504 <indexterm role="concept">
3505 <primary>user</primary>
3506 <secondary>admin definition of</secondary>
3507 </indexterm>
3508 <indexterm role="concept">
3509 <primary>admin user</primary>
3510 <secondary>definition of</secondary>
3511 </indexterm>
3512 The admin users are root, the Exim user, and any user that is a member of the
3513 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3514 The current group does not have to be one of these groups.
3515 </para>
3516 <para>
3517 Admin users are permitted to list the queue, and to carry out certain
3518 operations on messages, for example, to force delivery failures. It is also
3519 necessary to be an admin user in order to see the full information provided by
3520 the Exim monitor, and full debugging output.
3521 </para>
3522 <para>
3523 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3524 Exim to attempt delivery of messages on its queue is restricted to admin users.
3525 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3526 option false (that is, specifying <option>no_prod_requires_admin</option>).
3527 </para>
3528 <para>
3529 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3530 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3531 false.
3532 </para>
3533 </listitem>
3534 </itemizedlist>
3535 <para>
3536 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3537 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3538 getting root. There is further discussion of this issue at the start of chapter
3539 <xref linkend="CHAPconf"/>.
3540 </para>
3541 </section>
3542 <section>
3543 <title>Command line options</title>
3544 <para>
3545 Exim&#x2019;s command line options are described in alphabetical order below. If none
3546 of the options that specifies a specific action (such as starting the daemon or
3547 a queue runner, or testing an address, or receiving a message in a specific
3548 format, or listing the queue) are present, and there is at least one argument
3549 on the command line, <option>-bm</option> (accept a local message on the standard input,
3550 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3551 outputs a brief message about itself and exits.
3552 </para>
3553 <!-- === Start of command line options === -->
3554 <variablelist>
3555 <varlistentry>
3556 <term><option>--</option></term>
3557 <listitem>
3558 <para>
3559 <indexterm role="option">
3560 <primary>--</primary>
3561 </indexterm>
3562 <indexterm role="concept">
3563 <primary>options</primary>
3564 <secondary>command line; terminating</secondary>
3565 </indexterm>
3566 This is a pseudo-option whose only purpose is to terminate the options and
3567 therefore to cause subsequent command line items to be treated as arguments
3568 rather than options, even if they begin with hyphens.
3569 </para>
3570 </listitem></varlistentry>
3571 <varlistentry>
3572 <term><option>--help</option></term>
3573 <listitem>
3574 <para>
3575 <indexterm role="option">
3576 <primary><option>--help</option></primary>
3577 </indexterm>
3578 This option causes Exim to output a few sentences stating what it is.
3579 The same output is generated if the Exim binary is called with no options and
3580 no arguments.
3581 </para>
3582 </listitem></varlistentry>
3583 <varlistentry>
3584 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3585 <listitem>
3586 <para>
3587 <indexterm role="option">
3588 <primary><option>-B</option></primary>
3589 </indexterm>
3590 <indexterm role="concept">
3591 <primary>8-bit characters</primary>
3592 </indexterm>
3593 <indexterm role="concept">
3594 <primary>Sendmail compatibility</primary>
3595 <secondary>8-bit characters</secondary>
3596 </indexterm>
3597 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3598 clean; it ignores this option.
3599 </para>
3600 </listitem></varlistentry>
3601 <varlistentry>
3602 <term><option>-bd</option></term>
3603 <listitem>
3604 <para>
3605 <indexterm role="option">
3606 <primary><option>-bd</option></primary>
3607 </indexterm>
3608 <indexterm role="concept">
3609 <primary>daemon</primary>
3610 </indexterm>
3611 <indexterm role="concept">
3612 <primary>SMTP listener</primary>
3613 </indexterm>
3614 <indexterm role="concept">
3615 <primary>queue runner</primary>
3616 </indexterm>
3617 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3618 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3619 that the daemon should also initiate periodic queue runs.
3620 </para>
3621 <para>
3622 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3623 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3624 disconnect from the controlling terminal. When running this way, it can be
3625 stopped by pressing ctrl-C.
3626 </para>
3627 <para>
3628 By default, Exim listens for incoming connections to the standard SMTP port on
3629 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3630 ports, on multiple ports, and only on specific interfaces. Chapter
3631 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3632 </para>
3633 <para>
3634 When a listening daemon
3635 <indexterm role="concept">
3636 <primary>daemon</primary>
3637 <secondary>process id (pid)</secondary>
3638 </indexterm>
3639 <indexterm role="concept">
3640 <primary>pid (process id)</primary>
3641 <secondary>of daemon</secondary>
3642 </indexterm>
3643 is started without the use of <option>-oX</option> (that is, without overriding the normal
3644 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3645 in Exim&#x2019;s spool directory. This location can be overridden by setting
3646 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3647 running as root.
3648 </para>
3649 <para>
3650 When <option>-oX</option> is used on the command line to start a listening daemon, the
3651 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3652 used to specify a path on the command line if a pid file is required.
3653 </para>
3654 <para>
3655 The SIGHUP signal
3656 <indexterm role="concept">
3657 <primary>SIGHUP</primary>
3658 </indexterm>
3659 <indexterm role="concept">
3660 <primary>daemon</primary>
3661 <secondary>restarting</secondary>
3662 </indexterm>
3663 can be used to cause the daemon to re-execute itself. This should be done
3664 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3665 means of the <option>.include</option> facility, is changed, and also whenever a new version
3666 of Exim is installed. It is not necessary to do this when other files that are
3667 referenced from the configuration (for example, alias files) are changed,
3668 because these are reread each time they are used.
3669 </para>
3670 </listitem></varlistentry>
3671 <varlistentry>
3672 <term><option>-bdf</option></term>
3673 <listitem>
3674 <para>
3675 <indexterm role="option">
3676 <primary><option>-bdf</option></primary>
3677 </indexterm>
3678 This option has the same effect as <option>-bd</option> except that it never disconnects
3679 from the controlling terminal, even when no debugging is specified.
3680 </para>
3681 </listitem></varlistentry>
3682 <varlistentry>
3683 <term><option>-be</option></term>
3684 <listitem>
3685 <para>
3686 <indexterm role="option">
3687 <primary><option>-be</option></primary>
3688 </indexterm>
3689 <indexterm role="concept">
3690 <primary>testing</primary>
3691 <secondary>string expansion</secondary>
3692 </indexterm>
3693 <indexterm role="concept">
3694 <primary>expansion</primary>
3695 <secondary>testing</secondary>
3696 </indexterm>
3697 Run Exim in expansion testing mode. Exim discards its root privilege, to
3698 prevent ordinary users from using this mode to read otherwise inaccessible
3699 files. If no arguments are given, Exim runs interactively, prompting for lines
3700 of data. Otherwise, it processes each argument in turn.
3701 </para>
3702 <para>
3703 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3704 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3705 used without command line arguments. If successful, it uses the <function>readline()</function>
3706 function, which provides extensive line-editing facilities, for reading the
3707 test data. A line history is supported.
3708 </para>
3709 <para>
3710 Long expansion expressions can be split over several lines by using backslash
3711 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3712 continuation lines is ignored. Each argument or data line is passed through the
3713 string expansion mechanism, and the result is output. Variable values from the
3714 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3715 message-specific values (such as <varname>$sender_domain</varname>) are set, because no message
3716 is being processed <phrase revisionflag="changed">(but see <option>-bem</option> and <option>-Mset</option>)</phrase>.
3717 </para>
3718 <para>
3719 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3720 files or databases you are using, you must exit and restart Exim before trying
3721 the same lookup again. Otherwise, because each Exim process caches the results
3722 of lookups, you will just get the same result as before.
3723 </para>
3724 </listitem></varlistentry>
3725 <varlistentry revisionflag="changed">
3726 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3727 <listitem>
3728 <para revisionflag="changed">
3729 <indexterm role="option">
3730 <primary><option>-bem</option></primary>
3731 </indexterm>
3732 <indexterm role="concept">
3733 <primary>testing</primary>
3734 <secondary>string expansion</secondary>
3735 </indexterm>
3736 <indexterm role="concept">
3737 <primary>expansion</primary>
3738 <secondary>testing</secondary>
3739 </indexterm>
3740 This option operates like <option>-be</option> except that it must be followed by the name
3741 of a file. For example:
3742 </para>
3743 <literallayout class="monospaced" revisionflag="changed">
3744 exim -bem /tmp/testmessage
3745 </literallayout>
3746 <para revisionflag="changed">
3747 The file is read as a message (as if receiving a locally-submitted non-SMTP
3748 message) before any of the test expansions are done. Thus, message-specific
3749 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
3750 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
3751 recipients are read from the headers in the normal way, and are shown in the
3752 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
3753 line, because further arguments are taken as strings to expand (just like
3754 <option>-be</option>).
3755 </para>
3756 </listitem></varlistentry>
3757 <varlistentry>
3758 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3759 <listitem>
3760 <para>
3761 <indexterm role="option">
3762 <primary><option>-bF</option></primary>
3763 </indexterm>
3764 <indexterm role="concept">
3765 <primary>system filter</primary>
3766 <secondary>testing</secondary>
3767 </indexterm>
3768 <indexterm role="concept">
3769 <primary>testing</primary>
3770 <secondary>system filter</secondary>
3771 </indexterm>
3772 This option is the same as <option>-bf</option> except that it assumes that the filter being
3773 tested is a system filter. The additional commands that are available only in
3774 system filters are recognized.
3775 </para>
3776 </listitem></varlistentry>
3777 <varlistentry>
3778 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3779 <listitem>
3780 <para>
3781 <indexterm role="option">
3782 <primary><option>-bf</option></primary>
3783 </indexterm>
3784 <indexterm role="concept">
3785 <primary>filter</primary>
3786 <secondary>testing</secondary>
3787 </indexterm>
3788 <indexterm role="concept">
3789 <primary>testing</primary>
3790 <secondary>filter file</secondary>
3791 </indexterm>
3792 <indexterm role="concept">
3793 <primary>forward file</primary>
3794 <secondary>testing</secondary>
3795 </indexterm>
3796 <indexterm role="concept">
3797 <primary>testing</primary>
3798 <secondary>forward file</secondary>
3799 </indexterm>
3800 <indexterm role="concept">
3801 <primary>Sieve filter</primary>
3802 <secondary>testing</secondary>
3803 </indexterm>
3804 This option runs Exim in user filter testing mode; the file is the filter file
3805 to be tested, and a test message must be supplied on the standard input. If
3806 there are no message-dependent tests in the filter, an empty file can be
3807 supplied.
3808 </para>
3809 <para>
3810 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3811 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3812 filter and a user filter in the same run. For example:
3813 </para>
3814 <literallayout class="monospaced">
3815 exim -bF /system/filter -bf /user/filter &lt;/test/message
3816 </literallayout>
3817 <para>
3818 This is helpful when the system filter adds header lines or sets filter
3819 variables that are used by the user filter.
3820 </para>
3821 <para>
3822 If the test filter file does not begin with one of the special lines
3823 </para>
3824 <literallayout class="monospaced">
3825 # Exim filter
3826 # Sieve filter
3827 </literallayout>
3828 <para>
3829 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3830 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3831 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3832 redirection lists.
3833 </para>
3834 <para>
3835 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3836 detected, is a list of the actions that Exim would try to take if presented
3837 with the message for real. More details of filter testing are given in the
3838 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3839 </para>
3840 <para>
3841 When testing a filter file,
3842 <indexterm role="concept">
3843 <primary><quote>From</quote> line</primary>
3844 </indexterm>
3845 <indexterm role="concept">
3846 <primary>envelope sender</primary>
3847 </indexterm>
3848 <indexterm role="concept">
3849 <primary><option>-f</option> option</primary>
3850 <secondary>for filter testing</secondary>
3851 </indexterm>
3852 the envelope sender can be set by the <option>-f</option> option,
3853 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3854 that would normally be taken from the envelope recipient address of the message
3855 can be set by means of additional command line options (see the next four
3856 options).
3857 </para>
3858 </listitem></varlistentry>
3859 <varlistentry>
3860 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3861 <listitem>
3862 <para>
3863 <indexterm role="option">
3864 <primary><option>-bfd</option></primary>
3865 </indexterm>
3866 <indexterm role="concept">
3867 <primary><varname>$qualify_domain</varname></primary>
3868 </indexterm>
3869 This sets the domain of the recipient address when a filter file is being
3870 tested by means of the <option>-bf</option> option. The default is the value of
3871 <varname>$qualify_domain</varname>.
3872 </para>
3873 </listitem></varlistentry>
3874 <varlistentry>
3875 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3876 <listitem>
3877 <para>
3878 <indexterm role="option">
3879 <primary><option>-bfl</option></primary>
3880 </indexterm>
3881 This sets the local part of the recipient address when a filter file is being
3882 tested by means of the <option>-bf</option> option. The default is the username of the
3883 process that calls Exim. A local part should be specified with any prefix or
3884 suffix stripped, because that is how it appears to the filter when a message is
3885 actually being delivered.
3886 </para>
3887 </listitem></varlistentry>
3888 <varlistentry>
3889 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3890 <listitem>
3891 <para>
3892 <indexterm role="option">
3893 <primary><option>-bfp</option></primary>
3894 </indexterm>
3895 This sets the prefix of the local part of the recipient address when a filter
3896 file is being tested by means of the <option>-bf</option> option. The default is an empty
3897 prefix.
3898 </para>
3899 </listitem></varlistentry>
3900 <varlistentry>
3901 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3902 <listitem>
3903 <para>
3904 <indexterm role="option">
3905 <primary><option>-bfs</option></primary>
3906 </indexterm>
3907 This sets the suffix of the local part of the recipient address when a filter
3908 file is being tested by means of the <option>-bf</option> option. The default is an empty
3909 suffix.
3910 </para>
3911 </listitem></varlistentry>
3912 <varlistentry>
3913 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3914 <listitem>
3915 <para>
3916 <indexterm role="option">
3917 <primary><option>-bh</option></primary>
3918 </indexterm>
3919 <indexterm role="concept">
3920 <primary>testing</primary>
3921 <secondary>incoming SMTP</secondary>
3922 </indexterm>
3923 <indexterm role="concept">
3924 <primary>SMTP</primary>
3925 <secondary>testing incoming</secondary>
3926 </indexterm>
3927 <indexterm role="concept">
3928 <primary>testing</primary>
3929 <secondary>relay control</secondary>
3930 </indexterm>
3931 <indexterm role="concept">
3932 <primary>relaying</primary>
3933 <secondary>testing configuration</secondary>
3934 </indexterm>
3935 <indexterm role="concept">
3936 <primary>policy control</primary>
3937 <secondary>testing</secondary>
3938 </indexterm>
3939 <indexterm role="concept">
3940 <primary>debugging</primary>
3941 <secondary><option>-bh</option> option</secondary>
3942 </indexterm>
3943 This option runs a fake SMTP session as if from the given IP address, using the
3944 standard input and output. The IP address may include a port number at the end,
3945 after a full stop. For example:
3946 </para>
3947 <literallayout class="monospaced">
3948 exim -bh 10.9.8.7.1234
3949 exim -bh fe80::a00:20ff:fe86:a061.5678
3950 </literallayout>
3951 <para>
3952 When an IPv6 address is given, it is converted into canonical form. In the case
3953 of the second example above, the value of <varname>$sender_host_address</varname> after
3954 conversion to the canonical form is
3955 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3956 </para>
3957 <para>
3958 Comments as to what is going on are written to the standard error file. These
3959 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3960 This facility is provided for testing configuration options for incoming
3961 messages, to make sure they implement the required policy. For example, you can
3962 test your relay controls using <option>-bh</option>.
3963 </para>
3964 <para>
3965 <emphasis role="bold">Warning 1</emphasis>:
3966 <indexterm role="concept">
3967 <primary>RFC 1413</primary>
3968 </indexterm>
3969 You can test features of the configuration that rely on ident (RFC 1413)
3970 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3971 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3972 connection.
3973 </para>
3974 <para>
3975 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3976 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3977 occur, use <option>-bhc</option> instead.
3978 </para>
3979 <para>
3980 Messages supplied during the testing session are discarded, and nothing is
3981 written to any of the real log files. There may be pauses when DNS (and other)
3982 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3983 can be used to specify a specific IP interface and port if this is important,
3984 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3985 session were authenticated.
3986 </para>
3987 <para>
3988 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3989 output just states whether a given recipient address from a given host is
3990 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3991 </para>
3992 <para revisionflag="changed">
3993 Features such as authentication and encryption, where the client input is not
3994 plain text, are most easily tested using specialized SMTP test programs such as
3995 <emphasis role="bold"><ulink url="http://jetmore.org/john/code/#swaks">swaks</ulink></emphasis>.
3996 </para>
3997 </listitem></varlistentry>
3998 <varlistentry>
3999 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4000 <listitem>
4001 <para>
4002 <indexterm role="option">
4003 <primary><option>-bhc</option></primary>
4004 </indexterm>
4005 This option operates in the same way as <option>-bh</option>, except that address
4006 verification callouts are performed if required. This includes consulting and
4007 updating the callout cache database.
4008 </para>
4009 </listitem></varlistentry>
4010 <varlistentry>
4011 <term><option>-bi</option></term>
4012 <listitem>
4013 <para>
4014 <indexterm role="option">
4015 <primary><option>-bi</option></primary>
4016 </indexterm>
4017 <indexterm role="concept">
4018 <primary>alias file</primary>
4019 <secondary>building</secondary>
4020 </indexterm>
4021 <indexterm role="concept">
4022 <primary>building alias file</primary>
4023 </indexterm>
4024 <indexterm role="concept">
4025 <primary>Sendmail compatibility</primary>
4026 <secondary><option>-bi</option> option</secondary>
4027 </indexterm>
4028 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4029 Exim does not have the concept of a single alias file, and so it cannot mimic
4030 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4031 tend to appear in various scripts such as NIS make files, so the option must be
4032 recognized.
4033 </para>
4034 <para>
4035 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4036 configuration option is run, under the uid and gid of the caller of Exim. If
4037 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4038 The command set by <option>bi_command</option> may not contain arguments. The command can
4039 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4040 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4041 <option>-bi</option> is a no-op.
4042 </para>
4043 </listitem></varlistentry>
4044 <varlistentry>
4045 <term><option>-bm</option></term>
4046 <listitem>
4047 <para>
4048 <indexterm role="option">
4049 <primary><option>-bm</option></primary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>local message reception</primary>
4053 </indexterm>
4054 This option runs an Exim receiving process that accepts an incoming,
4055 locally-generated message on the current input. The recipients are given as the
4056 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4057 argument can be a comma-separated list of RFC 2822 addresses. This is the
4058 default option for selecting the overall action of an Exim call; it is assumed
4059 if no other conflicting option is present.
4060 </para>
4061 <para>
4062 If any addresses in the message are unqualified (have no domain), they are
4063 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4064 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4065 suppressing this for special cases.
4066 </para>
4067 <para>
4068 Policy checks on the contents of local messages can be enforced by means of
4069 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4070 </para>
4071 <para>
4072 <indexterm role="concept">
4073 <primary>return code</primary>
4074 <secondary>for <option>-bm</option></secondary>
4075 </indexterm>
4076 The return code is zero if the message is successfully accepted. Otherwise, the
4077 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4078 </para>
4079 <para>
4080 The format
4081 <indexterm role="concept">
4082 <primary>message</primary>
4083 <secondary>format</secondary>
4084 </indexterm>
4085 <indexterm role="concept">
4086 <primary>format</primary>
4087 <secondary>message</secondary>
4088 </indexterm>
4089 <indexterm role="concept">
4090 <primary><quote>From</quote> line</primary>
4091 </indexterm>
4092 <indexterm role="concept">
4093 <primary>UUCP</primary>
4094 <secondary><quote>From</quote> line</secondary>
4095 </indexterm>
4096 <indexterm role="concept">
4097 <primary>Sendmail compatibility</primary>
4098 <secondary><quote>From</quote> line</secondary>
4099 </indexterm>
4100 of the message must be as defined in RFC 2822, except that, for
4101 compatibility with Sendmail and Smail, a line in one of the forms
4102 </para>
4103 <literallayout class="monospaced">
4104 From sender Fri Jan  5 12:55 GMT 1997
4105 From sender Fri, 5 Jan 97 12:55:01
4106 </literallayout>
4107 <para>
4108 (with the weekday optional, and possibly with additional text after the date)
4109 is permitted to appear at the start of the message. There appears to be no
4110 authoritative specification of the format of this line. Exim recognizes it by
4111 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4112 option, which can be changed if necessary.
4113 </para>
4114 <para>
4115 The
4116 <indexterm role="concept">
4117 <primary><option>-f</option> option</primary>
4118 <secondary>overriding <quote>From</quote> line</secondary>
4119 </indexterm>
4120 specified sender is treated as if it were given as the argument to the
4121 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4122 preference to the address taken from the message. The caller of Exim must be a
4123 trusted user for the sender of a message to be set in this way.
4124 </para>
4125 </listitem></varlistentry>
4126 <varlistentry>
4127 <term><option>-bnq</option></term>
4128 <listitem>
4129 <para>
4130 <indexterm role="option">
4131 <primary><option>-bnq</option></primary>
4132 </indexterm>
4133 <indexterm role="concept">
4134 <primary>address qualification</primary>
4135 <secondary>suppressing</secondary>
4136 </indexterm>
4137 By default, Exim automatically qualifies unqualified addresses (those
4138 without domains) that appear in messages that are submitted locally (that
4139 is, not over TCP/IP). This qualification applies both to addresses in
4140 envelopes, and addresses in header lines. Sender addresses are qualified using
4141 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4142 defaults to the value of <option>qualify_domain</option>).
4143 </para>
4144 <para>
4145 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4146 being used to re-submit messages that originally came from remote hosts after
4147 content scanning, you probably do not want to qualify unqualified addresses in
4148 header lines. (Such lines will be present only if you have not enabled a header
4149 syntax check in the appropriate ACL.)
4150 </para>
4151 <para>
4152 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4153 messages that originate on the local host. When this is used, unqualified
4154 addresses in the envelope provoke errors (causing message rejection) and
4155 unqualified addresses in header lines are left alone.
4156 </para>
4157 </listitem></varlistentry>
4158 <varlistentry>
4159 <term><option>-bP</option></term>
4160 <listitem>
4161 <para>
4162 <indexterm role="option">
4163 <primary><option>-bP</option></primary>
4164 </indexterm>
4165 <indexterm role="concept">
4166 <primary>configuration options</primary>
4167 <secondary>extracting</secondary>
4168 </indexterm>
4169 <indexterm role="concept">
4170 <primary>options</primary>
4171 <secondary>configuration &ndash; extracting</secondary>
4172 </indexterm>
4173 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4174 main configuration options to be written to the standard output. The values
4175 of one or more specific options can be requested by giving their names as
4176 arguments, for example:
4177 </para>
4178 <literallayout class="monospaced">
4179 exim -bP qualify_domain hold_domains
4180 </literallayout>
4181 <para>
4182 However, any option setting that is preceded by the word <quote>hide</quote> in the
4183 configuration file is not shown in full, except to an admin user. For other
4184 users, the output is as in this example:
4185 </para>
4186 <literallayout class="monospaced">
4187 mysql_servers = &lt;value not displayable&gt;
4188 </literallayout>
4189 <para>
4190 If <option>configure_file</option> is given as an argument, the name of the run time
4191 configuration file is output.
4192 If a list of configuration files was supplied, the value that is output here
4193 is the name of the file that was actually used.
4194 </para>
4195 <para>
4196 <indexterm role="concept">
4197 <primary>daemon</primary>
4198 <secondary>process id (pid)</secondary>
4199 </indexterm>
4200 <indexterm role="concept">
4201 <primary>pid (process id)</primary>
4202 <secondary>of daemon</secondary>
4203 </indexterm>
4204 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4205 directories where log files and daemon pid files are written are output,
4206 respectively. If these values are unset, log files are written in a
4207 sub-directory of the spool directory called <option>log</option>, and the pid file is
4208 written directly into the spool directory.
4209 </para>
4210 <para>
4211 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4212 </para>
4213 <literallayout class="monospaced">
4214 exim -bP +local_domains
4215 </literallayout>
4216 <para>
4217 it searches for a matching named list of any type (domain, host, address, or
4218 local part) and outputs what it finds.
4219 </para>
4220 <para>
4221 <indexterm role="concept">
4222 <primary>options</primary>
4223 <secondary>router &ndash; extracting</secondary>
4224 </indexterm>
4225 <indexterm role="concept">
4226 <primary>options</primary>
4227 <secondary>transport &ndash; extracting</secondary>
4228 </indexterm>
4229 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4230 followed by the name of an appropriate driver instance, the option settings for
4231 that driver are output. For example:
4232 </para>
4233 <literallayout class="monospaced">
4234 exim -bP transport local_delivery
4235 </literallayout>
4236 <para>
4237 The generic driver options are output first, followed by the driver&#x2019;s private
4238 options. A list of the names of drivers of a particular type can be obtained by
4239 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4240 <option>authenticator_list</option>, and a complete list of all drivers with their option
4241 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4242 <option>authenticators</option>.
4243 </para>
4244 </listitem></varlistentry>
4245 <varlistentry>
4246 <term><option>-bp</option></term>
4247 <listitem>
4248 <para>
4249 <indexterm role="option">
4250 <primary><option>-bp</option></primary>
4251 </indexterm>
4252 <indexterm role="concept">
4253 <primary>queue</primary>
4254 <secondary>listing messages on</secondary>
4255 </indexterm>
4256 <indexterm role="concept">
4257 <primary>listing</primary>
4258 <secondary>messages on the queue</secondary>
4259 </indexterm>
4260 This option requests a listing of the contents of the mail queue on the
4261 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4262 just those messages are listed. By default, this option can be used only by an
4263 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4264 to allow any user to see the queue.
4265 </para>
4266 <para>
4267 Each message on the queue is displayed as in the following example:
4268 </para>
4269 <literallayout class="monospaced">
4270 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4271           red.king@looking-glass.fict.example
4272           &lt;other addresses&gt;
4273 </literallayout>
4274 <para>
4275 <indexterm role="concept">
4276 <primary>message</primary>
4277 <secondary>size in queue listing</secondary>
4278 </indexterm>
4279 <indexterm role="concept">
4280 <primary>size</primary>
4281 <secondary>of message</secondary>
4282 </indexterm>
4283 The first line contains the length of time the message has been on the queue
4284 (in this case 25 minutes), the size of the message (2.9K), the unique local
4285 identifier for the message, and the message sender, as contained in the
4286 envelope. For bounce messages, the sender address is empty, and appears as
4287 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4288 the default sender address, the user&#x2019;s login name is shown in parentheses
4289 before the sender address.
4290 </para>
4291 <para>
4292 <indexterm role="concept">
4293 <primary>frozen messages</primary>
4294 <secondary>in queue listing</secondary>
4295 </indexterm>
4296 If the message is frozen (attempts to deliver it are suspended) then the text
4297 <quote>*** frozen ***</quote> is displayed at the end of this line.
4298 </para>
4299 <para>
4300 The recipients of the message (taken from the envelope, not the headers) are
4301 displayed on subsequent lines. Those addresses to which the message has already
4302 been delivered are marked with the letter D. If an original address gets
4303 expanded into several addresses via an alias or forward file, the original is
4304 displayed with a D only when deliveries for all of its child addresses are
4305 complete.
4306 </para>
4307 </listitem></varlistentry>
4308 <varlistentry>
4309 <term><option>-bpa</option></term>
4310 <listitem>
4311 <para>
4312 <indexterm role="option">
4313 <primary><option>-bpa</option></primary>
4314 </indexterm>
4315 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4316 that were generated from the original top level address(es) in each message by
4317 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4318 of just <quote>D</quote>.
4319 </para>
4320 </listitem></varlistentry>
4321 <varlistentry>
4322 <term><option>-bpc</option></term>
4323 <listitem>
4324 <para>
4325 <indexterm role="option">
4326 <primary><option>-bpc</option></primary>
4327 </indexterm>
4328 <indexterm role="concept">
4329 <primary>queue</primary>
4330 <secondary>count of messages on</secondary>
4331 </indexterm>
4332 This option counts the number of messages on the queue, and writes the total
4333 to the standard output. It is restricted to admin users, unless
4334 <option>queue_list_requires_admin</option> is set false.
4335 </para>
4336 </listitem></varlistentry>
4337 <varlistentry>
4338 <term><option>-bpr</option></term>
4339 <listitem>
4340 <para>
4341 <indexterm role="option">
4342 <primary><option>-bpr</option></primary>
4343 </indexterm>
4344 This option operates like <option>-bp</option>, but the output is not sorted into
4345 chronological order of message arrival. This can speed it up when there are
4346 lots of messages on the queue, and is particularly useful if the output is
4347 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4348 </para>
4349 </listitem></varlistentry>
4350 <varlistentry>
4351 <term><option>-bpra</option></term>
4352 <listitem>
4353 <para>
4354 <indexterm role="option">
4355 <primary><option>-bpra</option></primary>
4356 </indexterm>
4357 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4358 </para>
4359 </listitem></varlistentry>
4360 <varlistentry>
4361 <term><option>-bpru</option></term>
4362 <listitem>
4363 <para>
4364 <indexterm role="option">
4365 <primary><option>-bpru</option></primary>
4366 </indexterm>
4367 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4368 </para>
4369 </listitem></varlistentry>
4370 <varlistentry>
4371 <term><option>-bpu</option></term>
4372 <listitem>
4373 <para>
4374 <indexterm role="option">
4375 <primary><option>-bpu</option></primary>
4376 </indexterm>
4377 This option operates like <option>-bp</option> but shows only undelivered top-level
4378 addresses for each message displayed. Addresses generated by aliasing or
4379 forwarding are not shown, unless the message was deferred after processing by a
4380 router with the <option>one_time</option> option set.
4381 </para>
4382 </listitem></varlistentry>
4383 <varlistentry>
4384 <term><option>-brt</option></term>
4385 <listitem>
4386 <para>
4387 <indexterm role="option">
4388 <primary><option>-brt</option></primary>
4389 </indexterm>
4390 <indexterm role="concept">
4391 <primary>testing</primary>
4392 <secondary>retry configuration</secondary>
4393 </indexterm>
4394 <indexterm role="concept">
4395 <primary>retry</primary>
4396 <secondary>configuration testing</secondary>
4397 </indexterm>
4398 This option is for testing retry rules, and it must be followed by up to three
4399 arguments. It causes Exim to look for a retry rule that matches the values
4400 and to write it to the standard output. For example:
4401 </para>
4402 <literallayout class="monospaced">
4403 exim -brt bach.comp.mus.example
4404 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4405 </literallayout>
4406 <para>
4407 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4408 argument, which is required, can be a complete address in the form
4409 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4410 contains a dot, it is interpreted as an optional second domain name; if no
4411 retry rule is found for the first argument, the second is tried. This ties in
4412 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4413 rule is found that matches the host, one that matches the mail domain is
4414 sought. Finally, an argument that is the name of a specific delivery error, as
4415 used in setting up retry rules, can be given. For example:
4416 </para>
4417 <literallayout class="monospaced">
4418 exim -brt haydn.comp.mus.example quota_3d
4419 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4420 </literallayout>
4421 </listitem></varlistentry>
4422 <varlistentry>
4423 <term><option>-brw</option></term>
4424 <listitem>
4425 <para>
4426 <indexterm role="option">
4427 <primary><option>-brw</option></primary>
4428 </indexterm>
4429 <indexterm role="concept">
4430 <primary>testing</primary>
4431 <secondary>rewriting</secondary>
4432 </indexterm>
4433 <indexterm role="concept">
4434 <primary>rewriting</primary>
4435 <secondary>testing</secondary>
4436 </indexterm>
4437 This option is for testing address rewriting rules, and it must be followed by
4438 a single argument, consisting of either a local part without a domain, or a
4439 complete address with a fully qualified domain. Exim outputs how this address
4440 would be rewritten for each possible place it might appear. See chapter
4441 <xref linkend="CHAPrewrite"/> for further details.
4442 </para>
4443 </listitem></varlistentry>
4444 <varlistentry>
4445 <term><option>-bS</option></term>
4446 <listitem>
4447 <para>
4448 <indexterm role="option">
4449 <primary><option>-bS</option></primary>
4450 </indexterm>
4451 <indexterm role="concept">
4452 <primary>SMTP</primary>
4453 <secondary>batched incoming</secondary>
4454 </indexterm>
4455 <indexterm role="concept">
4456 <primary>batched SMTP input</primary>
4457 </indexterm>
4458 This option is used for batched SMTP input, which is an alternative interface
4459 for non-interactive local message submission. A number of messages can be
4460 submitted in a single run. However, despite its name, this is not really SMTP
4461 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4462 input, but generates no responses. If the caller is trusted, or
4463 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4464 believed; otherwise the sender is always the caller of Exim.
4465 </para>
4466 <para>
4467 The message itself is read from the standard input, in SMTP format (leading
4468 dots doubled), terminated by a line containing just a single dot. An error is
4469 provoked if the terminating dot is missing. A further message may then follow.
4470 </para>
4471 <para>
4472 As for other local message submissions, the contents of incoming batch SMTP
4473 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4474 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4475 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4476 </para>
4477 <para>
4478 Some other SMTP commands are recognized in the input. HELO and EHLO act
4479 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4480 QUIT quits, ignoring the rest of the standard input.
4481 </para>
4482 <para>
4483 <indexterm role="concept">
4484 <primary>return code</primary>
4485 <secondary>for <option>-bS</option></secondary>
4486 </indexterm>
4487 If any error is encountered, reports are written to the standard output and
4488 error streams, and Exim gives up immediately. The return code is 0 if no error
4489 was detected; it is 1 if one or more messages were accepted before the error
4490 was detected; otherwise it is 2.
4491 </para>
4492 <para>
4493 More details of input using batched SMTP are given in section
4494 <xref linkend="SECTincomingbatchedSMTP"/>.
4495 </para>
4496 </listitem></varlistentry>
4497 <varlistentry>
4498 <term><option>-bs</option></term>
4499 <listitem>
4500 <para>
4501 <indexterm role="option">
4502 <primary><option>-bs</option></primary>
4503 </indexterm>
4504 <indexterm role="concept">
4505 <primary>SMTP</primary>
4506 <secondary>local input</secondary>
4507 </indexterm>
4508 <indexterm role="concept">
4509 <primary>local SMTP input</primary>
4510 </indexterm>
4511 This option causes Exim to accept one or more messages by reading SMTP commands
4512 on the standard input, and producing SMTP replies on the standard output. SMTP
4513 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4514 Some user agents use this interface as a way of passing locally-generated
4515 messages to the MTA.
4516 </para>
4517 <para>
4518 In
4519 <indexterm role="concept">
4520 <primary>sender</primary>
4521 <secondary>source of</secondary>
4522 </indexterm>
4523 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4524 set, the senders of messages are taken from the SMTP MAIL commands.
4525 Otherwise the content of these commands is ignored and the sender is set up as
4526 the calling user. Unqualified addresses are automatically qualified using
4527 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4528 <option>-bnq</option> option is used.
4529 </para>
4530 <para>
4531 <indexterm role="concept">
4532 <primary>inetd</primary>
4533 </indexterm>
4534 The
4535 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4536 using a listening daemon. Exim can distinguish the two cases by checking
4537 whether the standard input is a TCP/IP socket. When Exim is called from
4538 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4539 above concerning senders and qualification do not apply. In this situation,
4540 Exim behaves in exactly the same way as it does when receiving a message via
4541 the listening daemon.
4542 </para>
4543 </listitem></varlistentry>
4544 <varlistentry>
4545 <term><option>-bt</option></term>
4546 <listitem>
4547 <para>
4548 <indexterm role="option">
4549 <primary><option>-bt</option></primary>
4550 </indexterm>
4551 <indexterm role="concept">
4552 <primary>testing</primary>
4553 <secondary>addresses</secondary>
4554 </indexterm>
4555 <indexterm role="concept">
4556 <primary>address</primary>
4557 <secondary>testing</secondary>
4558 </indexterm>
4559 This option runs Exim in address testing mode, in which each argument is taken
4560 as an address to be tested for deliverability. The results are written to the
4561 standard output. If a test fails, and the caller is not an admin user, no
4562 details of the failure are output, because these might contain sensitive
4563 information such as usernames and passwords for database lookups.
4564 </para>
4565 <para>
4566 If no arguments are given, Exim runs in an interactive manner, prompting with a
4567 right angle bracket for addresses to be tested.
4568 </para>
4569 <para>
4570 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4571 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4572 security issues.
4573 </para>
4574 <para>
4575 Each address is handled as if it were the recipient address of a message
4576 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4577 written to the standard output. However, any router that has
4578 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4579 genuine routing tests if your first router passes everything to a scanner
4580 program.
4581 </para>
4582 <para>
4583 The
4584 <indexterm role="concept">
4585 <primary>return code</primary>
4586 <secondary>for <option>-bt</option></secondary>
4587 </indexterm>
4588 return code is 2 if any address failed outright; it is 1 if no address
4589 failed outright but at least one could not be resolved for some reason. Return
4590 code 0 is given only when all addresses succeed.
4591 </para>
4592 <para>
4593 <indexterm role="concept">
4594 <primary>duplicate addresses</primary>
4595 </indexterm>
4596 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4597 addresses after routing is complete, so that only one delivery takes place.
4598 This does not happen when testing with <option>-bt</option>; the full results of routing are
4599 always shown.
4600 </para>
4601 <para>
4602 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4603 routers in the configuration makes any tests on the sender address of a
4604 message,
4605 <indexterm role="concept">
4606 <primary><option>-f</option> option</primary>
4607 <secondary>for address testing</secondary>
4608 </indexterm>
4609 you can use the <option>-f</option> option to set an appropriate sender when running
4610 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4611 default qualifying domain. However, if you have set up (for example) routers
4612 whose behaviour depends on the contents of an incoming message, you cannot test
4613 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4614 doing such tests.
4615 </para>
4616 </listitem></varlistentry>
4617 <varlistentry>
4618 <term><option>-bV</option></term>
4619 <listitem>
4620 <para>
4621 <indexterm role="option">
4622 <primary><option>-bV</option></primary>
4623 </indexterm>
4624 <indexterm role="concept">
4625 <primary>version number of Exim</primary>
4626 <secondary>verifying</secondary>
4627 </indexterm>
4628 This option causes Exim to write the current version number, compilation
4629 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4630 It also lists the DBM library this is being used, the optional modules (such as
4631 specific lookup types), the drivers that are included in the binary, and the
4632 name of the run time configuration file that is in use.
4633 </para>
4634 <para>
4635 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4636 configuration file. However, this is a static check only. It cannot check
4637 values that are to be expanded. For example, although a misspelt ACL verb is
4638 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4639 alone to discover (for example) all the typos in the configuration; some
4640 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4641 dynamic testing facilities.
4642 </para>
4643 </listitem></varlistentry>
4644 <varlistentry>
4645 <term><option>-bv</option></term>
4646 <listitem>
4647 <para>
4648 <indexterm role="option">
4649 <primary><option>-bv</option></primary>
4650 </indexterm>
4651 <indexterm role="concept">
4652 <primary>verifying address</primary>
4653 <secondary>using <option>-bv</option></secondary>
4654 </indexterm>
4655 <indexterm role="concept">
4656 <primary>address</primary>
4657 <secondary>verification</secondary>
4658 </indexterm>
4659 This option runs Exim in address verification mode, in which each argument is
4660 taken as an address to be verified by the routers. (This does not involve any
4661 verification callouts). During normal operation, verification happens mostly as
4662 a consequence processing a <option>verify</option> condition in an ACL (see chapter
4663 <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly including callouts,
4664 see the <option>-bh</option> and <option>-bhc</option> options.
4665 </para>
4666 <para>
4667 If verification fails, and the caller is not an admin user, no details of the
4668 failure are output, because these might contain sensitive information such as
4669 usernames and passwords for database lookups.
4670 </para>
4671 <para>
4672 If no arguments are given, Exim runs in an interactive manner, prompting with a
4673 right angle bracket for addresses to be verified.
4674 </para>
4675 <para>
4676 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4677 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4678 security issues.
4679 </para>
4680 <para>
4681 Verification differs from address testing (the <option>-bt</option> option) in that routers
4682 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4683 router that has <option>fail_verify</option> set, verification fails. The address is
4684 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4685 address, <option>-bvs</option> should be used.
4686 </para>
4687 <para revisionflag="changed">
4688 If the <option>-v</option> option is not set, the output consists of a single line for each
4689 address, stating whether it was verified or not, and giving a reason in the
4690 latter case. Without <option>-v</option>, generating more than one address by redirection
4691 causes verification to end successfully, without considering the generated
4692 addresses. However, if just one address is generated, processing continues,
4693 and the generated address must verify successfully for the overall verification
4694 to succeed.
4695 </para>
4696 <para revisionflag="changed">
4697 When <option>-v</option> is set, more details are given of how the address has been handled,
4698 and in the case of address redirection, all the generated addresses are also
4699 considered. Verification may succeed for some and fail for others.
4700 </para>
4701 <para>
4702 The
4703 <indexterm role="concept">
4704 <primary>return code</primary>
4705 <secondary>for <option>-bv</option></secondary>
4706 </indexterm>
4707 return code is 2 if any address failed outright; it is 1 if no address
4708 failed outright but at least one could not be resolved for some reason. Return
4709 code 0 is given only when all addresses succeed.
4710 </para>
4711 <para>
4712 If any of the routers in the configuration makes any tests on the sender
4713 address of a message, you should use the <option>-f</option> option to set an appropriate
4714 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4715 calling user at the default qualifying domain.
4716 </para>
4717 </listitem></varlistentry>
4718 <varlistentry>
4719 <term><option>-bvs</option></term>
4720 <listitem>
4721 <para>
4722 <indexterm role="option">
4723 <primary><option>-bvs</option></primary>
4724 </indexterm>
4725 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4726 than a recipient address. This affects any rewriting and qualification that
4727 might happen.
4728 </para>
4729 </listitem></varlistentry>
4730 <varlistentry>
4731 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4732 <listitem>
4733 <para>
4734 <indexterm role="option">
4735 <primary><option>-C</option></primary>
4736 </indexterm>
4737 <indexterm role="concept">
4738 <primary>configuration file</primary>
4739 <secondary>alternate</secondary>
4740 </indexterm>
4741 <indexterm role="concept">
4742 <primary>CONFIGURE_FILE</primary>
4743 </indexterm>
4744 <indexterm role="concept">
4745 <primary>alternate configuration file</primary>
4746 </indexterm>
4747 This option causes Exim to find the run time configuration file from the given
4748 list instead of from the list specified by the CONFIGURE_FILE
4749 compile-time setting. Usually, the list will consist of just a single file
4750 name, but it can be a colon-separated list of names. In this case, the first
4751 file that exists is used. Failure to open an existing file stops Exim from
4752 proceeding any further along the list, and an error is generated.
4753 </para>
4754 <para>
4755 When this option is used by a caller other than root or the Exim user, and the
4756 list is different from the compiled-in list, Exim gives up its root privilege
4757 immediately, and runs with the real and effective uid and gid set to those of
4758 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4759 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4760 Exim is root.
4761 </para>
4762 <para>
4763 That is, the Exim user is no longer privileged in this regard. This build-time
4764 option is not set by default in the Exim source distribution tarbundle.
4765 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4766 the packagers might have enabled it.
4767 </para>
4768 <para>
4769 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4770 configuration using <option>-C</option> right through message reception and delivery, even
4771 if the caller is root. The reception works, but by that time, Exim is running
4772 as the Exim user, so when it re-executes to regain privilege for the delivery,
4773 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4774 and delivery using two separate commands (one to put a message on the queue,
4775 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4776 </para>
4777 <para>
4778 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4779 prefix string with which any file named in a <option>-C</option> command line option
4780 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4781 However, if the value of the <option>-C</option> option is identical to the value of
4782 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4783 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4784 unset, any file name can be used with <option>-C</option>.
4785 </para>
4786 <para>
4787 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4788 to a directory to which only root has access. This prevents someone who has
4789 broken into the Exim account from running a privileged Exim with an arbitrary
4790 configuration file.
4791 </para>
4792 <para>
4793 The <option>-C</option> facility is useful for ensuring that configuration files are
4794 syntactically correct, but cannot be used for test deliveries, unless the
4795 caller is privileged, or unless it is an exotic configuration that does not
4796 require privilege. No check is made on the owner or group of the files
4797 specified by this option.
4798 </para>
4799 </listitem></varlistentry>
4800 <varlistentry>
4801 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4802 <listitem>
4803 <para>
4804 <indexterm role="option">
4805 <primary><option>-D</option></primary>
4806 </indexterm>
4807 <indexterm role="concept">
4808 <primary>macro</primary>
4809 <secondary>setting on command line</secondary>
4810 </indexterm>
4811 This option can be used to override macro definitions in the configuration file
4812 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4813 unprivileged caller, it causes Exim to give up its root privilege.
4814 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4815 completely disabled, and its use causes an immediate error exit.
4816 </para>
4817 <para>
4818 The entire option (including equals sign if present) must all be within one
4819 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4820 string, in which case the equals sign is optional. These two commands are
4821 synonymous:
4822 </para>
4823 <literallayout class="monospaced">
4824 exim -DABC  ...
4825 exim -DABC= ...
4826 </literallayout>
4827 <para>
4828 To include spaces in a macro definition item, quotes must be used. If you use
4829 quotes, spaces are permitted around the macro name and the equals sign. For
4830 example:
4831 </para>
4832 <literallayout class="monospaced">
4833 exim '-D ABC = something' ...
4834 </literallayout>
4835 <para>
4836 <option>-D</option> may be repeated up to 10 times on a command line.
4837 </para>
4838 </listitem></varlistentry>
4839 <varlistentry>
4840 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4841 <listitem>
4842 <para>
4843 <indexterm role="option">
4844 <primary><option>-d</option></primary>
4845 </indexterm>
4846 <indexterm role="concept">
4847 <primary>debugging</primary>
4848 <secondary>list of selectors</secondary>
4849 </indexterm>
4850 <indexterm role="concept">
4851 <primary>debugging</primary>
4852 <secondary><option>-d</option> option</secondary>
4853 </indexterm>
4854 This option causes debugging information to be written to the standard
4855 error stream. It is restricted to admin users because debugging output may show
4856 database queries that contain password information. Also, the details of users&#x2019;
4857 filter files should be protected. <phrase revisionflag="changed">If a non-admin user uses <option>-d</option>, Exim
4858 writes an error message to the standard error stream and exits with a non-zero
4859 return code.</phrase>
4860 </para>
4861 <para>
4862 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
4863 standard debugging data is output. This can be reduced, or increased to include
4864 some more rarely needed information, by directly following <option>-d</option> with a string
4865 made up of names preceded by plus or minus characters. These add or remove sets
4866 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
4867 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
4868 no spaces are allowed in the debug setting. The available debugging categories
4869 are:
4870 </para>
4871 <literallayout>
4872 <literal>acl            </literal> ACL interpretation
4873 <literal>auth           </literal> authenticators
4874 <literal>deliver        </literal> general delivery logic
4875 <literal>dns            </literal> DNS lookups (see also resolver)
4876 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4877 <literal>exec           </literal> arguments for <function>execv()</function> calls
4878 <literal>expand         </literal> detailed debugging for string expansions
4879 <literal>filter         </literal> filter handling
4880 <literal>hints_lookup   </literal> hints data lookups
4881 <literal>host_lookup    </literal> all types of name-to-IP address handling
4882 <literal>ident          </literal> ident lookup
4883 <literal>interface      </literal> lists of local interfaces
4884 <literal>lists          </literal> matching things in lists
4885 <literal>load           </literal> system load checks
4886 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4887 <literal>lookup         </literal> general lookup code and all lookups
4888 <literal>memory         </literal> memory handling
4889 <literal>pid            </literal> add pid to debug output lines
4890 <literal>process_info   </literal> setting info for the process log
4891 <literal>queue_run      </literal> queue runs
4892 <literal>receive        </literal> general message reception logic
4893 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4894 <literal>retry          </literal> retry handling
4895 <literal>rewrite        </literal> address rewriting
4896 <literal>route          </literal> address routing
4897 <literal>timestamp      </literal> add timestamp to debug output lines
4898 <literal>tls            </literal> TLS logic
4899 <literal>transport      </literal> transports
4900 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4901 <literal>verify         </literal> address verification logic
4902 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4903 </literallayout>
4904 <para>
4905 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4906 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4907 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4908 is included, an awful lot of output that is very rarely of interest is
4909 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4910 turn everything off.
4911 </para>
4912 <para>
4913 <indexterm role="concept">
4914 <primary>resolver</primary>
4915 <secondary>debugging output</secondary>
4916 </indexterm>
4917 <indexterm role="concept">
4918 <primary>DNS resolver</primary>
4919 <secondary>debugging output</secondary>
4920 </indexterm>
4921 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4922 with DEBUG enabled. This is not the case in some operating systems. Also,
4923 unfortunately, debugging output from the DNS resolver is written to stdout
4924 rather than stderr.
4925 </para>
4926 <para>
4927 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4928 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4929 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4930 daemon, which then passes it on to any re-executed Exims. Exim also
4931 automatically adds the pid to debug lines when several remote deliveries are
4932 run in parallel.
4933 </para>
4934 <para>
4935 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4936 of all debug output lines. This can be useful when trying to track down delays
4937 in processing.
4938 </para>
4939 <para>
4940 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4941 any debugging is selected, or if <option>-v</option> is used.
4942 </para>
4943 </listitem></varlistentry>
4944 <varlistentry>
4945 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4946 <listitem>
4947 <para>
4948 <indexterm role="option">
4949 <primary><option>-dd</option></primary>
4950 </indexterm>
4951 This option behaves exactly like <option>-d</option> except when used on a command that
4952 starts a daemon process. In that case, debugging is turned off for the
4953 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4954 behaviour of the daemon without creating as much output as full debugging does.
4955 </para>
4956 </listitem></varlistentry>
4957 <varlistentry>
4958 <term><option>-dropcr</option></term>
4959 <listitem>
4960 <para>
4961 <indexterm role="option">
4962 <primary><option>-dropcr</option></primary>
4963 </indexterm>
4964 This is an obsolete option that is now a no-op. It used to affect the way Exim
4965 handled CR and LF characters in incoming messages. What happens now is
4966 described in section <xref linkend="SECTlineendings"/>.
4967 </para>
4968 </listitem></varlistentry>
4969 <varlistentry>
4970 <term><option>-E</option></term>
4971 <listitem>
4972 <para>
4973 <indexterm role="option">
4974 <primary><option>-E</option></primary>
4975 </indexterm>
4976 <indexterm role="concept">
4977 <primary>bounce message</primary>
4978 <secondary>generating</secondary>
4979 </indexterm>
4980 This option specifies that an incoming message is a locally-generated delivery
4981 failure report. It is used internally by Exim when handling delivery failures
4982 and is not intended for external use. Its only effect is to stop Exim
4983 generating certain messages to the postmaster, as otherwise message cascades
4984 could occur in some situations. As part of the same option, a message id may
4985 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4986 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4987 </para>
4988 </listitem></varlistentry>
4989 <varlistentry>
4990 <term><option>-e</option><emphasis>x</emphasis></term>
4991 <listitem>
4992 <para>
4993 <indexterm role="option">
4994 <primary><option>-e</option><emphasis>x</emphasis></primary>
4995 </indexterm>
4996 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4997 called by various programs without the leading <option>o</option> in the option. For
4998 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4999 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5000 </para>
5001 </listitem></varlistentry>
5002 <varlistentry>
5003 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5004 <listitem>
5005 <para>
5006 <indexterm role="option">
5007 <primary><option>-F</option></primary>
5008 </indexterm>
5009 <indexterm role="concept">
5010 <primary>sender</primary>
5011 <secondary>name</secondary>
5012 </indexterm>
5013 <indexterm role="concept">
5014 <primary>name</primary>
5015 <secondary>of sender</secondary>
5016 </indexterm>
5017 This option sets the sender&#x2019;s full name for use when a locally-generated
5018 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5019 entry from the password data is used. As users are generally permitted to alter
5020 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5021 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5022 </para>
5023 </listitem></varlistentry>
5024 <varlistentry>
5025 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5026 <listitem>
5027 <para>
5028 <indexterm role="option">
5029 <primary><option>-f</option></primary>
5030 </indexterm>
5031 <indexterm role="concept">
5032 <primary>sender</primary>
5033 <secondary>address</secondary>
5034 </indexterm>
5035 <indexterm role="concept">
5036 <primary>address</primary>
5037 <secondary>sender</secondary>
5038 </indexterm>
5039 <indexterm role="concept">
5040 <primary>trusted user</primary>
5041 </indexterm>
5042 <indexterm role="concept">
5043 <primary>envelope sender</primary>
5044 </indexterm>
5045 <indexterm role="concept">
5046 <primary>user</primary>
5047 <secondary>trusted</secondary>
5048 </indexterm>
5049 This option sets the address of the envelope sender of a locally-generated
5050 message (also known as the return path). The option can normally be used only
5051 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5052 users to use it.
5053 </para>
5054 <para>
5055 Processes running as root or the Exim user are always trusted. Other
5056 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5057 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5058 of a local message is set to the caller&#x2019;s login name at the default qualify
5059 domain.
5060 </para>
5061 <para>
5062 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5063 can be specified by any user, trusted or not, to create a message that can
5064 never provoke a bounce. An empty sender can be specified either as an empty
5065 string, or as a pair of angle brackets with nothing between them, as in these
5066 examples of shell commands:
5067 </para>
5068 <literallayout class="monospaced">
5069 exim -f '&lt;&gt;' user@domain
5070 exim -f "" user@domain
5071 </literallayout>
5072 <para>
5073 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5074 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5075 <option>-bv</option> options.
5076 </para>
5077 <para>
5078 Allowing untrusted users to change the sender address does not of itself make
5079 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5080 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5081 though this can be overridden by setting <option>no_local_from_check</option>.
5082 </para>
5083 <para>
5084 White
5085 <indexterm role="concept">
5086 <primary><quote>From</quote> line</primary>
5087 </indexterm>
5088 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5089 given as two arguments or one combined argument). The sender of a
5090 locally-generated message can also be set (when permitted) by an initial
5091 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5092 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5093 </para>
5094 </listitem></varlistentry>
5095 <varlistentry>
5096 <term><option>-G</option></term>
5097 <listitem>
5098 <para>
5099 <indexterm role="option">
5100 <primary><option>-G</option></primary>
5101 </indexterm>
5102 <indexterm role="concept">
5103 <primary>Sendmail compatibility</primary>
5104 <secondary><option>-G</option> option ignored</secondary>
5105 </indexterm>
5106 This is a Sendmail option which is ignored by Exim.
5107 </para>
5108 </listitem></varlistentry>
5109 <varlistentry>
5110 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5111 <listitem>
5112 <para>
5113 <indexterm role="option">
5114 <primary><option>-h</option></primary>
5115 </indexterm>
5116 <indexterm role="concept">
5117 <primary>Sendmail compatibility</primary>
5118 <secondary><option>-h</option> option ignored</secondary>
5119 </indexterm>
5120 This option is accepted for compatibility with Sendmail, but has no effect. (In
5121 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5122 headers.)
5123 </para>
5124 </listitem></varlistentry>
5125 <varlistentry>
5126 <term><option>-i</option></term>
5127 <listitem>
5128 <para>
5129 <indexterm role="option">
5130 <primary><option>-i</option></primary>
5131 </indexterm>
5132 <indexterm role="concept">
5133 <primary>Solaris</primary>
5134 <secondary><emphasis>mail</emphasis> command</secondary>
5135 </indexterm>
5136 <indexterm role="concept">
5137 <primary>dot in incoming</primary>
5138 <secondary>non-SMTP message</secondary>
5139 </indexterm>
5140 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5141 line by itself should not terminate an incoming, non-SMTP message. I can find
5142 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5143 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5144 </para>
5145 </listitem></varlistentry>
5146 <varlistentry>
5147 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5148 <listitem>
5149 <para>
5150 <indexterm role="option">
5151 <primary><option>-M</option></primary>
5152 </indexterm>
5153 <indexterm role="concept">
5154 <primary>forcing delivery</primary>
5155 </indexterm>
5156 <indexterm role="concept">
5157 <primary>delivery</primary>
5158 <secondary>forcing attempt</secondary>
5159 </indexterm>
5160 <indexterm role="concept">
5161 <primary>frozen messages</primary>
5162 <secondary>forcing delivery</secondary>
5163 </indexterm>
5164 This option requests Exim to run a delivery attempt on each message in turn. If
5165 any of the messages are frozen, they are automatically thawed before the
5166 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5167 and <option>hold_domains</option> are ignored.
5168 </para>
5169 <para>
5170 Retry
5171 <indexterm role="concept">
5172 <primary>hints database</primary>
5173 <secondary>overriding retry hints</secondary>
5174 </indexterm>
5175 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5176 the normal retry time has not yet been reached. This option requires the caller
5177 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5178 which can be set false to relax this restriction (and also the same requirement
5179 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5180 </para>
5181 <para>
5182 The deliveries happen synchronously, that is, the original Exim process does
5183 not terminate until all the delivery attempts have finished. No output is
5184 produced unless there is a serious error. If you want to see what is happening,
5185 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5186 </para>
5187 </listitem></varlistentry>
5188 <varlistentry>
5189 <term><option>-Mar</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5190 <listitem>
5191 <para>
5192 <indexterm role="option">
5193 <primary><option>-Mar</option></primary>
5194 </indexterm>
5195 <indexterm role="concept">
5196 <primary>message</primary>
5197 <secondary>adding recipients</secondary>
5198 </indexterm>
5199 <indexterm role="concept">
5200 <primary>recipient</primary>
5201 <secondary>adding</secondary>
5202 </indexterm>
5203 This option requests Exim to add the addresses to the list of recipients of the
5204 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5205 id, and the remaining ones must be email addresses. However, if the message is
5206 active (in the middle of a delivery attempt), it is not altered. This option
5207 can be used only by an admin user.
5208 </para>
5209 </listitem></varlistentry>
5210 <varlistentry>
5211 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5212 <listitem>
5213 <para>
5214 <indexterm role="option">
5215 <primary><option>-MC</option></primary>
5216 </indexterm>
5217 <indexterm role="concept">
5218 <primary>SMTP</primary>
5219 <secondary>passed connection</secondary>
5220 </indexterm>
5221 <indexterm role="concept">
5222 <primary>SMTP</primary>
5223 <secondary>multiple deliveries</secondary>
5224 </indexterm>
5225 <indexterm role="concept">
5226 <primary>multiple SMTP deliveries</primary>
5227 </indexterm>
5228 This option is not intended for use by external callers. It is used internally
5229 by Exim to invoke another instance of itself to deliver a waiting message using
5230 an existing SMTP connection, which is passed as the standard input. Details are
5231 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5232 must be root or the Exim user in order to use it.
5233 </para>
5234 </listitem></varlistentry>
5235 <varlistentry>
5236 <term><option>-MCA</option></term>
5237 <listitem>
5238 <para>
5239 <indexterm role="option">
5240 <primary><option>-MCA</option></primary>
5241 </indexterm>
5242 This option is not intended for use by external callers. It is used internally
5243 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5244 connection to the remote host has been authenticated.
5245 </para>
5246 </listitem></varlistentry>
5247 <varlistentry>
5248 <term><option>-MCP</option></term>
5249 <listitem>
5250 <para>
5251 <indexterm role="option">
5252 <primary><option>-MCP</option></primary>
5253 </indexterm>
5254 This option is not intended for use by external callers. It is used internally
5255 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5256 which Exim is connected supports pipelining.
5257 </para>
5258 </listitem></varlistentry>
5259 <varlistentry>
5260 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5261 <listitem>
5262 <para>
5263 <indexterm role="option">
5264 <primary><option>-MCQ</option></primary>
5265 </indexterm>
5266 This option is not intended for use by external callers. It is used internally
5267 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5268 started by a queue runner. It passes on the process id of the queue runner,
5269 together with the file descriptor number of an open pipe. Closure of the pipe
5270 signals the final completion of the sequence of processes that are passing
5271 messages through the same SMTP connection.
5272 </para>
5273 </listitem></varlistentry>
5274 <varlistentry>
5275 <term><option>-MCS</option></term>
5276 <listitem>
5277 <para>
5278 <indexterm role="option">
5279 <primary><option>-MCS</option></primary>
5280 </indexterm>
5281 This option is not intended for use by external callers. It is used internally
5282 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5283 SMTP SIZE option should be used on messages delivered down the existing
5284 connection.
5285 </para>
5286 </listitem></varlistentry>
5287 <varlistentry>
5288 <term><option>-MCT</option></term>
5289 <listitem>
5290 <para>
5291 <indexterm role="option">
5292 <primary><option>-MCT</option></primary>
5293 </indexterm>
5294 This option is not intended for use by external callers. It is used internally
5295 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5296 host to which Exim is connected supports TLS encryption.
5297 </para>
5298 </listitem></varlistentry>
5299 <varlistentry>
5300 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5301 <listitem>
5302 <para>
5303 <indexterm role="option">
5304 <primary><option>-Mc</option></primary>
5305 </indexterm>
5306 <indexterm role="concept">
5307 <primary>hints database</primary>
5308 <secondary>not overridden by <option>-Mc</option></secondary>
5309 </indexterm>
5310 <indexterm role="concept">
5311 <primary>delivery</primary>
5312 <secondary>manually started &ndash; not forced</secondary>
5313 </indexterm>
5314 This option requests Exim to run a delivery attempt on each message in turn,
5315 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5316 that are found. This option is not very useful to external callers. It is
5317 provided mainly for internal use by Exim when it needs to re-invoke itself in
5318 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5319 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5320 respects retry times and other options such as <option>hold_domains</option> that are
5321 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5322 If you want to run a specific delivery as if in a queue run, you should use
5323 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5324 and other deliveries is made in one or two places.
5325 </para>
5326 </listitem></varlistentry>
5327 <varlistentry>
5328 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5329 <listitem>
5330 <para>
5331 <indexterm role="option">
5332 <primary><option>-Mes</option></primary>
5333 </indexterm>
5334 <indexterm role="concept">
5335 <primary>message</primary>
5336 <secondary>changing sender</secondary>
5337 </indexterm>
5338 <indexterm role="concept">
5339 <primary>sender</primary>
5340 <secondary>changing</secondary>
5341 </indexterm>
5342 This option requests Exim to change the sender address in the message to the
5343 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5344 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5345 be a message id, and the second one an email address. However, if the message
5346 is active (in the middle of a delivery attempt), its status is not altered.
5347 This option can be used only by an admin user.
5348 </para>
5349 </listitem></varlistentry>
5350 <varlistentry>
5351 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5352 <listitem>
5353 <para>
5354 <indexterm role="option">
5355 <primary><option>-Mf</option></primary>
5356 </indexterm>
5357 <indexterm role="concept">
5358 <primary>freezing messages</primary>
5359 </indexterm>
5360 <indexterm role="concept">
5361 <primary>message</primary>
5362 <secondary>manually freezing</secondary>
5363 </indexterm>
5364 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5365 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5366 either manually or as a result of the <option>auto_thaw</option> configuration option.
5367 However, if any of the messages are active (in the middle of a delivery
5368 attempt), their status is not altered. This option can be used only by an admin
5369 user.
5370 </para>
5371 </listitem></varlistentry>
5372 <varlistentry>
5373 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5374 <listitem>
5375 <para>
5376 <indexterm role="option">
5377 <primary><option>-Mg</option></primary>
5378 </indexterm>
5379 <indexterm role="concept">
5380 <primary>giving up on messages</primary>
5381 </indexterm>
5382 <indexterm role="concept">
5383 <primary>message</primary>
5384 <secondary>abandoning delivery attempts</secondary>
5385 </indexterm>
5386 <indexterm role="concept">
5387 <primary>delivery</primary>
5388 <secondary>abandoning further attempts</secondary>
5389 </indexterm>
5390 This option requests Exim to give up trying to deliver the listed messages,
5391 including any that are frozen. However, if any of the messages are active,
5392 their status is not altered. For non-bounce messages, a delivery error message
5393 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5394 Bounce messages are just discarded. This option can be used only by an admin
5395 user.
5396 </para>
5397 </listitem></varlistentry>
5398 <varlistentry>
5399 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5400 <listitem>
5401 <para>
5402 <indexterm role="option">
5403 <primary><option>-Mmad</option></primary>
5404 </indexterm>
5405 <indexterm role="concept">
5406 <primary>delivery</primary>
5407 <secondary>cancelling all</secondary>
5408 </indexterm>
5409 This option requests Exim to mark all the recipient addresses in the messages
5410 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5411 message is active (in the middle of a delivery attempt), its status is not
5412 altered. This option can be used only by an admin user.
5413 </para>
5414 </listitem></varlistentry>
5415 <varlistentry>
5416 <term><option>-Mmd</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;&nbsp;...</term>
5417 <listitem>
5418 <para>
5419 <indexterm role="option">
5420 <primary><option>-Mmd</option></primary>
5421 </indexterm>
5422 <indexterm role="concept">
5423 <primary>delivery</primary>
5424 <secondary>cancelling by address</secondary>
5425 </indexterm>
5426 <indexterm role="concept">
5427 <primary>recipient</primary>
5428 <secondary>removing</secondary>
5429 </indexterm>
5430 <indexterm role="concept">
5431 <primary>removing recipients</primary>
5432 </indexterm>
5433 This option requests Exim to mark the given addresses as already delivered
5434 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5435 the remaining ones must be email addresses. These are matched to recipient
5436 addresses in the message in a case-sensitive manner. If the message is active
5437 (in the middle of a delivery attempt), its status is not altered. This option
5438 can be used only by an admin user.
5439 </para>
5440 </listitem></varlistentry>
5441 <varlistentry>
5442 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5443 <listitem>
5444 <para>
5445 <indexterm role="option">
5446 <primary><option>-Mrm</option></primary>
5447 </indexterm>
5448 <indexterm role="concept">
5449 <primary>removing messages</primary>
5450 </indexterm>
5451 <indexterm role="concept">
5452 <primary>abandoning mail</primary>
5453 </indexterm>
5454 <indexterm role="concept">
5455 <primary>message</primary>
5456 <secondary>manually discarding</secondary>
5457 </indexterm>
5458 This option requests Exim to remove the given messages from the queue. No
5459 bounce messages are sent; each message is simply forgotten. However, if any of
5460 the messages are active, their status is not altered. This option can be used
5461 only by an admin user or by the user who originally caused the message to be
5462 placed on the queue.
5463 </para>
5464 </listitem></varlistentry>
5465 <varlistentry revisionflag="changed">
5466 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5467 <listitem>
5468 <para revisionflag="changed">
5469 <indexterm role="option">
5470 <primary><option>-Mset</option></primary>
5471 </indexterm>
5472 <indexterm role="concept">
5473 <primary>testing</primary>
5474 <secondary>string expansion</secondary>
5475 </indexterm>
5476 <indexterm role="concept">
5477 <primary>expansion</primary>
5478 <secondary>testing</secondary>
5479 </indexterm>
5480 This option is useful only in conjunction with <option>-be</option> (that is, when testing
5481 string expansions). Exim loads the given message from its spool before doing
5482 the test expansions, thus setting message-specific variables such as
5483 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
5484 available. This feature is provided to make it easier to test expansions that
5485 make use of these variables. However, this option can be used only by an admin
5486 user. See also <option>-bem</option>.
5487 </para>
5488 </listitem></varlistentry>
5489 <varlistentry>
5490 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5491 <listitem>
5492 <para>
5493 <indexterm role="option">
5494 <primary><option>-Mt</option></primary>
5495 </indexterm>
5496 <indexterm role="concept">
5497 <primary>thawing messages</primary>
5498 </indexterm>
5499 <indexterm role="concept">
5500 <primary>unfreezing messages</primary>
5501 </indexterm>
5502 <indexterm role="concept">
5503 <primary>frozen messages</primary>
5504 <secondary>thawing</secondary>
5505 </indexterm>
5506 <indexterm role="concept">
5507 <primary>message</primary>
5508 <secondary>thawing frozen</secondary>
5509 </indexterm>
5510 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5511 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5512 messages are active, their status is not altered. This option can be used only
5513 by an admin user.
5514 </para>
5515 </listitem></varlistentry>
5516 <varlistentry>
5517 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5518 <listitem>
5519 <para>
5520 <indexterm role="option">
5521 <primary><option>-Mvb</option></primary>
5522 </indexterm>
5523 <indexterm role="concept">
5524 <primary>listing</primary>
5525 <secondary>message body</secondary>
5526 </indexterm>
5527 <indexterm role="concept">
5528 <primary>message</primary>
5529 <secondary>listing body of</secondary>
5530 </indexterm>
5531 This option causes the contents of the message body (-D) spool file to be
5532 written to the standard output. This option can be used only by an admin user.
5533 </para>
5534 </listitem></varlistentry>
5535 <varlistentry>
5536 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5537 <listitem>
5538 <para>
5539 <indexterm role="option">
5540 <primary><option>-Mvh</option></primary>
5541 </indexterm>
5542 <indexterm role="concept">
5543 <primary>listing</primary>
5544 <secondary>message headers</secondary>
5545 </indexterm>
5546 <indexterm role="concept">
5547 <primary>header lines</primary>
5548 <secondary>listing</secondary>
5549 </indexterm>
5550 <indexterm role="concept">
5551 <primary>message</primary>
5552 <secondary>listing header lines</secondary>
5553 </indexterm>
5554 This option causes the contents of the message headers (-H) spool file to be
5555 written to the standard output. This option can be used only by an admin user.
5556 </para>
5557 </listitem></varlistentry>
5558 <varlistentry>
5559 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5560 <listitem>
5561 <para>
5562 <indexterm role="option">
5563 <primary><option>-Mvl</option></primary>
5564 </indexterm>
5565 <indexterm role="concept">
5566 <primary>listing</primary>
5567 <secondary>message log</secondary>
5568 </indexterm>
5569 <indexterm role="concept">
5570 <primary>message</primary>
5571 <secondary>listing message log</secondary>
5572 </indexterm>
5573 This option causes the contents of the message log spool file to be written to
5574 the standard output. This option can be used only by an admin user.
5575 </para>
5576 </listitem></varlistentry>
5577 <varlistentry>
5578 <term><option>-m</option></term>
5579 <listitem>
5580 <para>
5581 <indexterm role="option">
5582 <primary><option>-m</option></primary>
5583 </indexterm>
5584 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5585 treats it that way too.
5586 </para>
5587 </listitem></varlistentry>
5588 <varlistentry>
5589 <term><option>-N</option></term>
5590 <listitem>
5591 <para>
5592 <indexterm role="option">
5593 <primary><option>-N</option></primary>
5594 </indexterm>
5595 <indexterm role="concept">
5596 <primary>debugging</primary>
5597 <secondary><option>-N</option> option</secondary>
5598 </indexterm>
5599 <indexterm role="concept">
5600 <primary>debugging</primary>
5601 <secondary>suppressing delivery</secondary>
5602 </indexterm>
5603 This is a debugging option that inhibits delivery of a message at the transport
5604 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5605 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5606 had successfully done so. However, it does not make any updates to the retry
5607 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5608 than <quote>=&gt;</quote>.
5609 </para>
5610 <para>
5611 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5612 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5613 words, an ordinary user can use it only when supplying an incoming message to
5614 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5615 address may be deferred because of a configuration problem on a transport, or a
5616 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5617 the message, and applies to any subsequent delivery attempts that may happen
5618 for that message.
5619 </para>
5620 </listitem></varlistentry>
5621 <varlistentry>
5622 <term><option>-n</option></term>
5623 <listitem>
5624 <para>
5625 <indexterm role="option">
5626 <primary><option>-n</option></primary>
5627 </indexterm>
5628 <indexterm role="concept">
5629 <primary>Sendmail compatibility</primary>
5630 <secondary><option>-n</option> option ignored</secondary>
5631 </indexterm>
5632 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5633 by Exim.
5634 </para>
5635 </listitem></varlistentry>
5636 <varlistentry>
5637 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5638 <listitem>
5639 <para>
5640 <indexterm role="option">
5641 <primary><option>-O</option></primary>
5642 </indexterm>
5643 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5644 Exim.
5645 </para>
5646 </listitem></varlistentry>
5647 <varlistentry>
5648 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5649 <listitem>
5650 <para>
5651 <indexterm role="option">
5652 <primary><option>-oA</option></primary>
5653 </indexterm>
5654 <indexterm role="concept">
5655 <primary>Sendmail compatibility</primary>
5656 <secondary><option>-oA</option> option</secondary>
5657 </indexterm>
5658 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5659 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5660 description above.
5661 </para>
5662 </listitem></varlistentry>
5663 <varlistentry>
5664 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5665 <listitem>
5666 <para>
5667 <indexterm role="option">
5668 <primary><option>-oB</option></primary>
5669 </indexterm>
5670 <indexterm role="concept">
5671 <primary>SMTP</primary>
5672 <secondary>passed connection</secondary>
5673 </indexterm>
5674 <indexterm role="concept">
5675 <primary>SMTP</primary>
5676 <secondary>multiple deliveries</secondary>
5677 </indexterm>
5678 <indexterm role="concept">
5679 <primary>multiple SMTP deliveries</primary>
5680 </indexterm>
5681 This is a debugging option which limits the maximum number of messages that can
5682 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5683 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5684 </para>
5685 </listitem></varlistentry>
5686 <varlistentry>
5687 <term><option>-odb</option></term>
5688 <listitem>
5689 <para>
5690 <indexterm role="option">
5691 <primary><option>-odb</option></primary>
5692 </indexterm>
5693 <indexterm role="concept">
5694 <primary>background delivery</primary>
5695 </indexterm>
5696 <indexterm role="concept">
5697 <primary>delivery</primary>
5698 <secondary>in the background</secondary>
5699 </indexterm>
5700 This option applies to all modes in which Exim accepts incoming messages,
5701 including the listening daemon. It requests <quote>background</quote> delivery of such
5702 messages, which means that the accepting process automatically starts a
5703 delivery process for each message received, but does not wait for the delivery
5704 processes to finish.
5705 </para>
5706 <para>
5707 When all the messages have been received, the reception process exits,
5708 leaving the delivery processes to finish in their own time. The standard output
5709 and error streams are closed at the start of each delivery process.
5710 This is the default action if none of the <option>-od</option> options are present.
5711 </para>
5712 <para>
5713 If one of the queueing options in the configuration file
5714 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5715 overrides it if <option>queue_only_override</option> is set true, which is the default
5716 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5717 </para>
5718 </listitem></varlistentry>
5719 <varlistentry>
5720 <term><option>-odf</option></term>
5721 <listitem>
5722 <para>
5723 <indexterm role="option">
5724 <primary><option>-odf</option></primary>
5725 </indexterm>
5726 <indexterm role="concept">
5727 <primary>foreground delivery</primary>
5728 </indexterm>
5729 <indexterm role="concept">
5730 <primary>delivery</primary>
5731 <secondary>in the foreground</secondary>
5732 </indexterm>
5733 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5734 accepted a locally-generated message. (For the daemon it is exactly the same as
5735 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5736 and Exim waits for it to complete before proceeding.
5737 </para>
5738 <para>
5739 The original Exim reception process does not finish until the delivery
5740 process for the final message has ended. The standard error stream is left open
5741 during deliveries.
5742 </para>
5743 <para>
5744 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5745 false and one of the queueing options in the configuration file is in effect.
5746 </para>
5747 <para>
5748 If there is a temporary delivery error during foreground delivery, the
5749 message is left on the queue for later delivery, and the original reception
5750 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5751 restricted configuration that never queues messages.
5752 </para>
5753 </listitem></varlistentry>
5754 <varlistentry>
5755 <term><option>-odi</option></term>
5756 <listitem>
5757 <para>
5758 <indexterm role="option">
5759 <primary><option>-odi</option></primary>
5760 </indexterm>
5761 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5762 Sendmail.
5763 </para>
5764 </listitem></varlistentry>
5765 <varlistentry>
5766 <term><option>-odq</option></term>
5767 <listitem>
5768 <para>
5769 <indexterm role="option">
5770 <primary><option>-odq</option></primary>
5771 </indexterm>
5772 <indexterm role="concept">
5773 <primary>non-immediate delivery</primary>
5774 </indexterm>
5775 <indexterm role="concept">
5776 <primary>delivery</primary>
5777 <secondary>suppressing immediate</secondary>
5778 </indexterm>
5779 <indexterm role="concept">
5780 <primary>queueing incoming messages</primary>
5781 </indexterm>
5782 This option applies to all modes in which Exim accepts incoming messages,
5783 including the listening daemon. It specifies that the accepting process should
5784 not automatically start a delivery process for each message received. Messages
5785 are placed on the queue, and remain there until a subsequent queue runner
5786 process encounters them. There are several configuration options (such as
5787 <option>queue_only</option>) that can be used to queue incoming messages under certain
5788 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5789 forces queueing.
5790 </para>
5791 </listitem></varlistentry>
5792 <varlistentry>
5793 <term><option>-odqs</option></term>
5794 <listitem>
5795 <para>
5796 <indexterm role="option">
5797 <primary><option>-odqs</option></primary>
5798 </indexterm>
5799 <indexterm role="concept">
5800 <primary>SMTP</primary>
5801 <secondary>delaying delivery</secondary>
5802 </indexterm>
5803 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5804 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5805 <option>queue_only_override</option> is false and one of the queueing options in the
5806 configuration file is in effect.
5807 </para>
5808 <para>
5809 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5810 message, in the background by default, but in the foreground if <option>-odi</option> is
5811 also present. The recipient addresses are routed, and local deliveries are done
5812 in the normal way. However, if any SMTP deliveries are required, they are not
5813 done at this time, so the message remains on the queue until a subsequent queue
5814 runner process encounters it. Because routing was done, Exim knows which
5815 messages are waiting for which hosts, and so a number of messages for the same
5816 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5817 configuration option has the same effect for specific domains. See also the
5818 <option>-qq</option> option.
5819 </para>
5820 </listitem></varlistentry>
5821 <varlistentry>
5822 <term><option>-oee</option></term>
5823 <listitem>
5824 <para>
5825 <indexterm role="option">
5826 <primary><option>-oee</option></primary>
5827 </indexterm>
5828 <indexterm role="concept">
5829 <primary>error</primary>
5830 <secondary>reporting</secondary>
5831 </indexterm>
5832 If an error is detected while a non-SMTP message is being received (for
5833 example, a malformed address), the error is reported to the sender in a mail
5834 message.
5835 </para>
5836 <para>
5837 <indexterm role="concept">
5838 <primary>return code</primary>
5839 <secondary>for <option>-oee</option></secondary>
5840 </indexterm>
5841 Provided
5842 this error message is successfully sent, the Exim receiving process
5843 exits with a return code of zero. If not, the return code is 2 if the problem
5844 is that the original message has no recipients, or 1 any other error. This is
5845 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5846 </para>
5847 </listitem></varlistentry>
5848 <varlistentry>
5849 <term><option>-oem</option></term>
5850 <listitem>
5851 <para>
5852 <indexterm role="option">
5853 <primary><option>-oem</option></primary>
5854 </indexterm>
5855 <indexterm role="concept">
5856 <primary>error</primary>
5857 <secondary>reporting</secondary>
5858 </indexterm>
5859 <indexterm role="concept">
5860 <primary>return code</primary>
5861 <secondary>for <option>-oem</option></secondary>
5862 </indexterm>
5863 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5864 return code, whether or not the error message was successfully sent.
5865 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5866 </para>
5867 </listitem></varlistentry>
5868 <varlistentry>
5869 <term><option>-oep</option></term>
5870 <listitem>
5871 <para>
5872 <indexterm role="option">
5873 <primary><option>-oep</option></primary>
5874 </indexterm>
5875 <indexterm role="concept">
5876 <primary>error</primary>
5877 <secondary>reporting</secondary>
5878 </indexterm>
5879 If an error is detected while a non-SMTP message is being received, the
5880 error is reported by writing a message to the standard error file (stderr).
5881 <indexterm role="concept">
5882 <primary>return code</primary>
5883 <secondary>for <option>-oep</option></secondary>
5884 </indexterm>
5885 The return code is 1 for all errors.
5886 </para>
5887 </listitem></varlistentry>
5888 <varlistentry>
5889 <term><option>-oeq</option></term>
5890 <listitem>
5891 <para>
5892 <indexterm role="option">
5893 <primary><option>-oeq</option></primary>
5894 </indexterm>
5895 <indexterm role="concept">
5896 <primary>error</primary>
5897 <secondary>reporting</secondary>
5898 </indexterm>
5899 This option is supported for compatibility with Sendmail, but has the same
5900 effect as <option>-oep</option>.
5901 </para>
5902 </listitem></varlistentry>
5903 <varlistentry>
5904 <term><option>-oew</option></term>
5905 <listitem>
5906 <para>
5907 <indexterm role="option">
5908 <primary><option>-oew</option></primary>
5909 </indexterm>
5910 <indexterm role="concept">
5911 <primary>error</primary>
5912 <secondary>reporting</secondary>
5913 </indexterm>
5914 This option is supported for compatibility with Sendmail, but has the same
5915 effect as <option>-oem</option>.
5916 </para>
5917 </listitem></varlistentry>
5918 <varlistentry>
5919 <term><option>-oi</option></term>
5920 <listitem>
5921 <para>
5922 <indexterm role="option">
5923 <primary><option>-oi</option></primary>
5924 </indexterm>
5925 <indexterm role="concept">
5926 <primary>dot in incoming</primary>
5927 <secondary>non-SMTP message</secondary>
5928 </indexterm>
5929 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5930 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5931 single dot does terminate, though Exim does no special processing for other
5932 lines that start with a dot. This option is set by default if Exim is called as
5933 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5934 </para>
5935 </listitem></varlistentry>
5936 <varlistentry>
5937 <term><option>-oitrue</option></term>
5938 <listitem>
5939 <para>
5940 <indexterm role="option">
5941 <primary><option>-oitrue</option></primary>
5942 </indexterm>
5943 This option is treated as synonymous with <option>-oi</option>.
5944 </para>
5945 </listitem></varlistentry>
5946 <varlistentry>
5947 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5948 <listitem>
5949 <para>
5950 <indexterm role="option">
5951 <primary><option>-oMa</option></primary>
5952 </indexterm>
5953 <indexterm role="concept">
5954 <primary>sender host address</primary>
5955 <secondary>specifying for local message</secondary>
5956 </indexterm>
5957 A number of options starting with <option>-oM</option> can be used to set values associated
5958 with remote hosts on locally-submitted messages (that is, messages not received
5959 over TCP/IP). These options can be used by any caller in conjunction with the
5960 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5961 other circumstances, they are ignored unless the caller is trusted.
5962 </para>
5963 <para>
5964 The <option>-oMa</option> option sets the sender host address. This may include a port
5965 number at the end, after a full stop (period). For example:
5966 </para>
5967 <literallayout class="monospaced">
5968 exim -bs -oMa 10.9.8.7.1234
5969 </literallayout>
5970 <para>
5971 An alternative syntax is to enclose the IP address in square brackets,
5972 followed by a colon and the port number:
5973 </para>
5974 <literallayout class="monospaced">
5975 exim -bs -oMa [10.9.8.7]:1234
5976 </literallayout>
5977 <para>
5978 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5979 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
5980 are present on the command line, the sender host IP address is taken from
5981 whichever one is last.
5982 </para>
5983 </listitem></varlistentry>
5984 <varlistentry>
5985 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5986 <listitem>
5987 <para>
5988 <indexterm role="option">
5989 <primary><option>-oMaa</option></primary>
5990 </indexterm>
5991 <indexterm role="concept">
5992 <primary>authentication name</primary>
5993 <secondary>specifying for local message</secondary>
5994 </indexterm>
5995 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5996 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5997 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5998 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5999 authenticated SMTP session without actually using the SMTP AUTH command.
6000 </para>
6001 </listitem></varlistentry>
6002 <varlistentry>
6003 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6004 <listitem>
6005 <para>
6006 <indexterm role="option">
6007 <primary><option>-oMai</option></primary>
6008 </indexterm>
6009 <indexterm role="concept">
6010 <primary>authentication id</primary>
6011 <secondary>specifying for local message</secondary>
6012 </indexterm>
6013 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6014 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6015 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6016 where there is no default) for messages from local sources. See chapter
6017 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6018 </para>
6019 </listitem></varlistentry>
6020 <varlistentry>
6021 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6022 <listitem>
6023 <para>
6024 <indexterm role="option">
6025 <primary><option>-oMas</option></primary>
6026 </indexterm>
6027 <indexterm role="concept">
6028 <primary>authentication sender</primary>
6029 <secondary>specifying for local message</secondary>
6030 </indexterm>
6031 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6032 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6033 overrides the sender address that is created from the caller&#x2019;s login id for
6034 messages from local sources, except when <option>-bh</option> is used, when there is no
6035 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6036 specified on a MAIL command overrides this value. See chapter
6037 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6038 </para>
6039 </listitem></varlistentry>
6040 <varlistentry>
6041 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6042 <listitem>
6043 <para>
6044 <indexterm role="option">
6045 <primary><option>-oMi</option></primary>
6046 </indexterm>
6047 <indexterm role="concept">
6048 <primary>interface address</primary>
6049 <secondary>specifying for local message</secondary>
6050 </indexterm>
6051 </para>
6052 <para revisionflag="changed">
6053 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6054 option sets the IP interface address value. A port number may be included,
6055 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6056 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6057 </para>
6058 </listitem></varlistentry>
6059 <varlistentry>
6060 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6061 <listitem>
6062 <para>
6063 <indexterm role="option">
6064 <primary><option>-oMr</option></primary>
6065 </indexterm>
6066 <indexterm role="concept">
6067 <primary>protocol</primary>
6068 <secondary>incoming &ndash; specifying for local message</secondary>
6069 </indexterm>
6070 <indexterm role="concept">
6071 <primary><varname>$received_protocol</varname></primary>
6072 </indexterm>
6073 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6074 option sets the received protocol value that is stored in
6075 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6076 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6077 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6078 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6079 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6080 be set by <option>-oMr</option>.
6081 </para>
6082 </listitem></varlistentry>
6083 <varlistentry>
6084 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6085 <listitem>
6086 <para>
6087 <indexterm role="option">
6088 <primary><option>-oMs</option></primary>
6089 </indexterm>
6090 <indexterm role="concept">
6091 <primary>sender host name</primary>
6092 <secondary>specifying for local message</secondary>
6093 </indexterm>
6094 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6095 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6096 present, Exim does not attempt to look up a host name from an IP address; it
6097 uses the name it is given.
6098 </para>
6099 </listitem></varlistentry>
6100 <varlistentry>
6101 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6102 <listitem>
6103 <para>
6104 <indexterm role="option">
6105 <primary><option>-oMt</option></primary>
6106 </indexterm>
6107 <indexterm role="concept">
6108 <primary>sender ident string</primary>
6109 <secondary>specifying for local message</secondary>
6110 </indexterm>
6111 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6112 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6113 local callers is the login id of the calling process, except when <option>-bh</option> is
6114 used, when there is no default.
6115 </para>
6116 </listitem></varlistentry>
6117 <varlistentry>
6118 <term><option>-om</option></term>
6119 <listitem>
6120 <para>
6121 <indexterm role="option">
6122 <primary><option>-om</option></primary>
6123 </indexterm>
6124 <indexterm role="concept">
6125 <primary>Sendmail compatibility</primary>
6126 <secondary><option>-om</option> option ignored</secondary>
6127 </indexterm>
6128 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6129 message should receive a copy of the message if the sender appears in an alias
6130 expansion. Exim always does this, so the option does nothing.
6131 </para>
6132 </listitem></varlistentry>
6133 <varlistentry>
6134 <term><option>-oo</option></term>
6135 <listitem>
6136 <para>
6137 <indexterm role="option">
6138 <primary><option>-oo</option></primary>
6139 </indexterm>
6140 <indexterm role="concept">
6141 <primary>Sendmail compatibility</primary>
6142 <secondary><option>-oo</option> option ignored</secondary>
6143 </indexterm>
6144 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6145 whatever that means.
6146 </para>
6147 </listitem></varlistentry>
6148 <varlistentry>
6149 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6150 <listitem>
6151 <para>
6152 <indexterm role="option">
6153 <primary><option>-oP</option></primary>
6154 </indexterm>
6155 <indexterm role="concept">
6156 <primary>pid (process id)</primary>
6157 <secondary>of daemon</secondary>
6158 </indexterm>
6159 <indexterm role="concept">
6160 <primary>daemon</primary>
6161 <secondary>process id (pid)</secondary>
6162 </indexterm>
6163 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6164 value. The option specifies the file to which the process id of the daemon is
6165 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6166 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6167 because in those cases, the normal pid file is not used.
6168 </para>
6169 </listitem></varlistentry>
6170 <varlistentry>
6171 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6172 <listitem>
6173 <para>
6174 <indexterm role="option">
6175 <primary><option>-or</option></primary>
6176 </indexterm>
6177 <indexterm role="concept">
6178 <primary>timeout</primary>
6179 <secondary>for non-SMTP input</secondary>
6180 </indexterm>
6181 This option sets a timeout value for incoming non-SMTP messages. If it is not
6182 set, Exim will wait forever for the standard input. The value can also be set
6183 by the <option>receive_timeout</option> option. The format used for specifying times is
6184 described in section <xref linkend="SECTtimeformat"/>.
6185 </para>
6186 </listitem></varlistentry>
6187 <varlistentry>
6188 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6189 <listitem>
6190 <para>
6191 <indexterm role="option">
6192 <primary><option>-os</option></primary>
6193 </indexterm>
6194 <indexterm role="concept">
6195 <primary>timeout</primary>
6196 <secondary>for SMTP input</secondary>
6197 </indexterm>
6198 <indexterm role="concept">
6199 <primary>SMTP timeout</primary>
6200 <secondary>input</secondary>
6201 </indexterm>
6202 This option sets a timeout value for incoming SMTP messages. The timeout
6203 applies to each SMTP command and block of data. The value can also be set by
6204 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6205 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6206 </para>
6207 </listitem></varlistentry>
6208 <varlistentry>
6209 <term><option>-ov</option></term>
6210 <listitem>
6211 <para>
6212 <indexterm role="option">
6213 <primary><option>-ov</option></primary>
6214 </indexterm>
6215 This option has exactly the same effect as <option>-v</option>.
6216 </para>
6217 </listitem></varlistentry>
6218 <varlistentry>
6219 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6220 <listitem>
6221 <para>
6222 <indexterm role="option">
6223 <primary><option>-oX</option></primary>
6224 </indexterm>
6225 <indexterm role="concept">
6226 <primary>TCP/IP</primary>
6227 <secondary>setting listening ports</secondary>
6228 </indexterm>
6229 <indexterm role="concept">
6230 <primary>TCP/IP</primary>
6231 <secondary>setting listening interfaces</secondary>
6232 </indexterm>
6233 <indexterm role="concept">
6234 <primary>port</primary>
6235 <secondary>receiving TCP/IP</secondary>
6236 </indexterm>
6237 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6238 is also given. It controls which ports and interfaces the daemon uses. Details
6239 of the syntax, and how it interacts with configuration file options, are given
6240 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6241 file is written unless <option>-oP</option> is also present to specify a pid file name.
6242 </para>
6243 </listitem></varlistentry>
6244 <varlistentry>
6245 <term><option>-pd</option></term>
6246 <listitem>
6247 <para>
6248 <indexterm role="option">
6249 <primary><option>-pd</option></primary>
6250 </indexterm>
6251 <indexterm role="concept">
6252 <primary>Perl</primary>
6253 <secondary>starting the interpreter</secondary>
6254 </indexterm>
6255 This option applies when an embedded Perl interpreter is linked with Exim (see
6256 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6257 option, forcing the starting of the interpreter to be delayed until it is
6258 needed.
6259 </para>
6260 </listitem></varlistentry>
6261 <varlistentry>
6262 <term><option>-ps</option></term>
6263 <listitem>
6264 <para>
6265 <indexterm role="option">
6266 <primary><option>-ps</option></primary>
6267 </indexterm>
6268 <indexterm role="concept">
6269 <primary>Perl</primary>
6270 <secondary>starting the interpreter</secondary>
6271 </indexterm>
6272 This option applies when an embedded Perl interpreter is linked with Exim (see
6273 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6274 option, forcing the starting of the interpreter to occur as soon as Exim is
6275 started.
6276 </para>
6277 </listitem></varlistentry>
6278 <varlistentry>
6279 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6280 <listitem>
6281 <para>
6282 <indexterm role="option">
6283 <primary><option>-p</option></primary>
6284 </indexterm>
6285 For compatibility with Sendmail, this option is equivalent to
6286 </para>
6287 <literallayout>
6288 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6289 </literallayout>
6290 <para>
6291 It sets the incoming protocol and host name (for trusted callers). The
6292 host name and its colon can be omitted when only the protocol is to be set.
6293 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6294 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6295 or <literal>s</literal> using this option (but that does not seem a real limitation).
6296 </para>
6297 </listitem></varlistentry>
6298 <varlistentry>
6299 <term><option>-q</option></term>
6300 <listitem>
6301 <para>
6302 <indexterm role="option">
6303 <primary><option>-q</option></primary>
6304 </indexterm>
6305 <indexterm role="concept">
6306 <primary>queue runner</primary>
6307 <secondary>starting manually</secondary>
6308 </indexterm>
6309 This option is normally restricted to admin users. However, there is a
6310 configuration option called <option>prod_requires_admin</option> which can be set false to
6311 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6312 and <option>-S</option> options).
6313 </para>
6314 <para>
6315 <indexterm role="concept">
6316 <primary>queue runner</primary>
6317 <secondary>description of operation</secondary>
6318 </indexterm>
6319 The <option>-q</option> option starts one queue runner process. This scans the queue of
6320 waiting messages, and runs a delivery process for each one in turn. It waits
6321 for each delivery process to finish before starting the next one. A delivery
6322 process may not actually do any deliveries if the retry times for the addresses
6323 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6324 </para>
6325 <para>
6326 If
6327 <indexterm role="concept">
6328 <primary>SMTP</primary>
6329 <secondary>passed connection</secondary>
6330 </indexterm>
6331 <indexterm role="concept">
6332 <primary>SMTP</primary>
6333 <secondary>multiple deliveries</secondary>
6334 </indexterm>
6335 <indexterm role="concept">
6336 <primary>multiple SMTP deliveries</primary>
6337 </indexterm>
6338 the delivery process spawns other processes to deliver other messages down
6339 passed SMTP connections, the queue runner waits for these to finish before
6340 proceeding.
6341 </para>
6342 <para>
6343 When all the queued messages have been considered, the original queue runner
6344 process terminates. In other words, a single pass is made over the waiting
6345 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6346 this to be repeated periodically.
6347 </para>
6348 <para>
6349 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6350 random, but it is likely to be different each time, which is all that matters.
6351 If one particular message screws up a remote MTA, other messages to the same
6352 MTA have a chance of getting through if they get tried first.
6353 </para>
6354 <para>
6355 It is possible to cause the messages to be processed in lexical message id
6356 order, which is essentially the order in which they arrived, by setting the
6357 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6358 </para>
6359 </listitem></varlistentry>
6360 <varlistentry>
6361 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6362 <listitem>
6363 <para>
6364 The <option>-q</option> option may be followed by one or more flag letters that change its
6365 behaviour. They are all optional, but if more than one is present, they must
6366 appear in the correct order. Each flag is described in a separate item below.
6367 </para>
6368 </listitem></varlistentry>
6369 <varlistentry>
6370 <term><option>-qq...</option></term>
6371 <listitem>
6372 <para>
6373 <indexterm role="option">
6374 <primary><option>-qq</option></primary>
6375 </indexterm>
6376 <indexterm role="concept">
6377 <primary>queue</primary>
6378 <secondary>double scanning</secondary>
6379 </indexterm>
6380 <indexterm role="concept">
6381 <primary>queue</primary>
6382 <secondary>routing</secondary>
6383 </indexterm>
6384 <indexterm role="concept">
6385 <primary>routing</primary>
6386 <secondary>whole queue before delivery</secondary>
6387 </indexterm>
6388 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6389 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6390 every domain. Addresses are routed, local deliveries happen, but no remote
6391 transports are run.
6392 </para>
6393 <para>
6394 <indexterm role="concept">
6395 <primary>hints database</primary>
6396 <secondary>remembering routing</secondary>
6397 </indexterm>
6398 The hints database that remembers which messages are waiting for specific hosts
6399 is updated, as if delivery to those hosts had been deferred. After this is
6400 complete, a second, normal queue scan happens, with routing and delivery taking
6401 place as normal. Messages that are routed to the same host should mostly be
6402 delivered down a single SMTP
6403 <indexterm role="concept">
6404 <primary>SMTP</primary>
6405 <secondary>passed connection</secondary>
6406 </indexterm>
6407 <indexterm role="concept">
6408 <primary>SMTP</primary>
6409 <secondary>multiple deliveries</secondary>
6410 </indexterm>
6411 <indexterm role="concept">
6412 <primary>multiple SMTP deliveries</primary>
6413 </indexterm>
6414 connection because of the hints that were set up during the first queue scan.
6415 This option may be useful for hosts that are connected to the Internet
6416 intermittently.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <term><option>-q[q]i...</option></term>
6421 <listitem>
6422 <para>
6423 <indexterm role="option">
6424 <primary><option>-qi</option></primary>
6425 </indexterm>
6426 <indexterm role="concept">
6427 <primary>queue</primary>
6428 <secondary>initial delivery</secondary>
6429 </indexterm>
6430 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6431 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6432 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6433 <option>-odq</option> and want a queue runner just to process the new messages.
6434 </para>
6435 </listitem></varlistentry>
6436 <varlistentry>
6437 <term><option>-q[q][i]f...</option></term>
6438 <listitem>
6439 <para>
6440 <indexterm role="option">
6441 <primary><option>-qf</option></primary>
6442 </indexterm>
6443 <indexterm role="concept">
6444 <primary>queue</primary>
6445 <secondary>forcing delivery</secondary>
6446 </indexterm>
6447 <indexterm role="concept">
6448 <primary>delivery</primary>
6449 <secondary>forcing in queue run</secondary>
6450 </indexterm>
6451 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6452 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6453 their retry times are tried.
6454 </para>
6455 </listitem></varlistentry>
6456 <varlistentry>
6457 <term><option>-q[q][i]ff...</option></term>
6458 <listitem>
6459 <para>
6460 <indexterm role="option">
6461 <primary><option>-qff</option></primary>
6462 </indexterm>
6463 <indexterm role="concept">
6464 <primary>frozen messages</primary>
6465 <secondary>forcing delivery</secondary>
6466 </indexterm>
6467 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6468 frozen or not.
6469 </para>
6470 </listitem></varlistentry>
6471 <varlistentry>
6472 <term><option>-q[q][i][f[f]]l</option></term>
6473 <listitem>
6474 <para>
6475 <indexterm role="option">
6476 <primary><option>-ql</option></primary>
6477 </indexterm>
6478 <indexterm role="concept">
6479 <primary>queue</primary>
6480 <secondary>local deliveries only</secondary>
6481 </indexterm>
6482 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6483 be done. If a message requires any remote deliveries, it remains on the queue
6484 for later delivery.
6485 </para>
6486 </listitem></varlistentry>
6487 <varlistentry>
6488 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&nbsp;&lt;<emphasis>start&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>end&nbsp;id</emphasis>&gt;</term>
6489 <listitem>
6490 <para>
6491 <indexterm role="concept">
6492 <primary>queue</primary>
6493 <secondary>delivering specific messages</secondary>
6494 </indexterm>
6495 When scanning the queue, Exim can be made to skip over messages whose ids are
6496 lexically less than a given value by following the <option>-q</option> option with a
6497 starting message id. For example:
6498 </para>
6499 <literallayout class="monospaced">
6500 exim -q 0t5C6f-0000c8-00
6501 </literallayout>
6502 <para>
6503 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6504 second message id is given, messages whose ids are lexically greater than it
6505 are also skipped. If the same id is given twice, for example,
6506 </para>
6507 <literallayout class="monospaced">
6508 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6509 </literallayout>
6510 <para>
6511 just one delivery process is started, for that message. This differs from
6512 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6513 that it counts as a delivery from a queue run. Note that the selection
6514 mechanism does not affect the order in which the messages are scanned. There
6515 are also other ways of selecting specific sets of messages for delivery in a
6516 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6517 </para>
6518 </listitem></varlistentry>
6519 <varlistentry>
6520 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6521 <listitem>
6522 <para>
6523 <indexterm role="concept">
6524 <primary>queue runner</primary>
6525 <secondary>starting periodically</secondary>
6526 </indexterm>
6527 <indexterm role="concept">
6528 <primary>periodic queue running</primary>
6529 </indexterm>
6530 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6531 starting a queue runner process at intervals specified by the given time value
6532 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6533 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6534 single daemon process handles both functions. A common way of starting up a
6535 combined daemon at system boot time is to use a command such as
6536 </para>
6537 <literallayout class="monospaced">
6538 /usr/exim/bin/exim -bd -q30m
6539 </literallayout>
6540 <para>
6541 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6542 process every 30 minutes.
6543 </para>
6544 <para>
6545 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6546 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6547 </para>
6548 </listitem></varlistentry>
6549 <varlistentry>
6550 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6551 <listitem>
6552 <para>
6553 <indexterm role="option">
6554 <primary><option>-qR</option></primary>
6555 </indexterm>
6556 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6557 compatibility.
6558 </para>
6559 </listitem></varlistentry>
6560 <varlistentry>
6561 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6562 <listitem>
6563 <para>
6564 <indexterm role="option">
6565 <primary><option>-qS</option></primary>
6566 </indexterm>
6567 This option is synonymous with <option>-S</option>.
6568 </para>
6569 </listitem></varlistentry>
6570 <varlistentry>
6571 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6572 <listitem>
6573 <para>
6574 <indexterm role="option">
6575 <primary><option>-R</option></primary>
6576 </indexterm>
6577 <indexterm role="concept">
6578 <primary>queue runner</primary>
6579 <secondary>for specific recipients</secondary>
6580 </indexterm>
6581 <indexterm role="concept">
6582 <primary>delivery</primary>
6583 <secondary>to given domain</secondary>
6584 </indexterm>
6585 <indexterm role="concept">
6586 <primary>domain</primary>
6587 <secondary>delivery to</secondary>
6588 </indexterm>
6589 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6590 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6591 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6592 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6593 </para>
6594 <para>
6595 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6596 perform a single queue run, except that, when scanning the messages on the
6597 queue, Exim processes only those that have at least one undelivered recipient
6598 address containing the given string, which is checked in a case-independent
6599 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6600 regular expression; otherwise it is a literal string.
6601 </para>
6602 <para revisionflag="changed">
6603 If you want to do periodic queue runs for messages with specific recipients,
6604 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
6605 </para>
6606 <literallayout class="monospaced" revisionflag="changed">
6607 exim -q25m -R @special.domain.example
6608 </literallayout>
6609 <para revisionflag="changed">
6610 This example does a queue run for messages with recipients in the given domain
6611 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
6612 applied to each queue run.
6613 </para>
6614 <para>
6615 Once a message is selected for delivery by this mechanism, all its addresses
6616 are processed. For the first selected message, Exim overrides any retry
6617 information and forces a delivery attempt for each undelivered address. This
6618 means that if delivery of any address in the first message is successful, any
6619 existing retry information is deleted, and so delivery attempts for that
6620 address in subsequently selected messages (which are processed without forcing)
6621 will run. However, if delivery of any address does not succeed, the retry
6622 information is updated, and in subsequently selected messages, the failing
6623 address will be skipped.
6624 </para>
6625 <para>
6626 <indexterm role="concept">
6627 <primary>frozen messages</primary>
6628 <secondary>forcing delivery</secondary>
6629 </indexterm>
6630 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6631 all selected messages, not just the first; frozen messages are included when
6632 <emphasis>ff</emphasis> is present.
6633 </para>
6634 <para>
6635 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6636 to a given domain after a host has been down for some time. When the SMTP
6637 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6638 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6639 an arbitrary command instead.
6640 </para>
6641 </listitem></varlistentry>
6642 <varlistentry>
6643 <term><option>-r</option></term>
6644 <listitem>
6645 <para>
6646 <indexterm role="option">
6647 <primary><option>-r</option></primary>
6648 </indexterm>
6649 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6650 </para>
6651 </listitem></varlistentry>
6652 <varlistentry>
6653 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6654 <listitem>
6655 <para>
6656 <indexterm role="option">
6657 <primary><option>-S</option></primary>
6658 </indexterm>
6659 <indexterm role="concept">
6660 <primary>delivery</primary>
6661 <secondary>from given sender</secondary>
6662 </indexterm>
6663 <indexterm role="concept">
6664 <primary>queue runner</primary>
6665 <secondary>for specific senders</secondary>
6666 </indexterm>
6667 This option acts like <option>-R</option> except that it checks the string against each
6668 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6669 conditions must be met for a message to be selected. If either of the options
6670 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6671 </para>
6672 </listitem></varlistentry>
6673 <varlistentry>
6674 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6675 <listitem>
6676 <para>
6677 <indexterm role="option">
6678 <primary><option>-Tqt</option></primary>
6679 </indexterm>
6680 This an option that is exclusively for use by the Exim testing suite. It is not
6681 recognized when Exim is run normally. It allows for the setting up of explicit
6682 <quote>queue times</quote> so that various warning/retry features can be tested.
6683 </para>
6684 </listitem></varlistentry>
6685 <varlistentry>
6686 <term><option>-t</option></term>
6687 <listitem>
6688 <para>
6689 <indexterm role="option">
6690 <primary><option>-t</option></primary>
6691 </indexterm>
6692 <indexterm role="concept">
6693 <primary>recipient</primary>
6694 <secondary>extracting from header lines</secondary>
6695 </indexterm>
6696 <indexterm role="concept">
6697 <primary><emphasis>Bcc:</emphasis> header line</primary>
6698 </indexterm>
6699 <indexterm role="concept">
6700 <primary><emphasis>Cc:</emphasis> header line</primary>
6701 </indexterm>
6702 <indexterm role="concept">
6703 <primary><emphasis>To:</emphasis> header line</primary>
6704 </indexterm>
6705 When Exim is receiving a locally-generated, non-SMTP message on its standard
6706 input, the <option>-t</option> option causes the recipients of the message to be obtained
6707 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6708 from the command arguments. The addresses are extracted before any rewriting
6709 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6710 </para>
6711 <para>
6712 <indexterm role="concept">
6713 <primary>Sendmail compatibility</primary>
6714 <secondary><option>-t</option> option</secondary>
6715 </indexterm>
6716 If the command has any arguments, they specify addresses to which the message
6717 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6718 the recipients list obtained from the headers. This is compatible with Smail 3
6719 and in accordance with the documented behaviour of several versions of
6720 Sendmail, as described in man pages on a number of operating systems (e.g.
6721 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6722 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6723 Sendmail book documents it that way. Exim can be made to add argument addresses
6724 instead of subtracting them by setting the option
6725 <option>extract_addresses_remove_arguments</option> false.
6726 </para>
6727 <para>
6728 <indexterm role="concept">
6729 <primary><option>Resent-</option> header lines</primary>
6730 <secondary>with <option>-t</option></secondary>
6731 </indexterm>
6732 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6733 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6734 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6735 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6736 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6737 </para>
6738 <para>
6739 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6740 message is resent several times). The RFC also specifies that they should be
6741 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6742 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6743 nor indeed exactly what constitutes a <quote>set</quote>.
6744 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6745 are often added at the end of the header, and if a message is resent more than
6746 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6747 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6748 </para>
6749 </listitem></varlistentry>
6750 <varlistentry>
6751 <term><option>-ti</option></term>
6752 <listitem>
6753 <para>
6754 <indexterm role="option">
6755 <primary><option>-ti</option></primary>
6756 </indexterm>
6757 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6758 compatibility with Sendmail.
6759 </para>
6760 </listitem></varlistentry>
6761 <varlistentry>
6762 <term><option>-tls-on-connect</option></term>
6763 <listitem>
6764 <para>
6765 <indexterm role="option">
6766 <primary><option>-tls-on-connect</option></primary>
6767 </indexterm>
6768 <indexterm role="concept">
6769 <primary>TLS</primary>
6770 <secondary>use without STARTTLS</secondary>
6771 </indexterm>
6772 <indexterm role="concept">
6773 <primary>TLS</primary>
6774 <secondary>automatic start</secondary>
6775 </indexterm>
6776 This option is available when Exim is compiled with TLS support. It forces all
6777 incoming SMTP connections to behave as if the incoming port is listed in the
6778 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6779 <xref linkend="CHAPTLS"/> for further details.
6780 </para>
6781 </listitem></varlistentry>
6782 <varlistentry>
6783 <term><option>-U</option></term>
6784 <listitem>
6785 <para>
6786 <indexterm role="option">
6787 <primary><option>-U</option></primary>
6788 </indexterm>
6789 <indexterm role="concept">
6790 <primary>Sendmail compatibility</primary>
6791 <secondary><option>-U</option> option ignored</secondary>
6792 </indexterm>
6793 Sendmail uses this option for <quote>initial message submission</quote>, and its
6794 documentation states that in future releases, it may complain about
6795 syntactically invalid messages rather than fixing them when this flag is not
6796 set. Exim ignores this option.
6797 </para>
6798 </listitem></varlistentry>
6799 <varlistentry>
6800 <term><option>-v</option></term>
6801 <listitem>
6802 <para>
6803 <indexterm role="option">
6804 <primary><option>-v</option></primary>
6805 </indexterm>
6806 This option causes Exim to write information to the standard error stream,
6807 describing what it is doing. In particular, it shows the log lines for
6808 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6809 dialogue is shown. Some of the log lines shown may not actually be written to
6810 the log if the setting of <option>log_selector</option> discards them. Any relevant
6811 selectors are shown with each log line. If none are shown, the logging is
6812 unconditional.
6813 </para>
6814 </listitem></varlistentry>
6815 <varlistentry>
6816 <term><option>-x</option></term>
6817 <listitem>
6818 <para>
6819 <indexterm role="option">
6820 <primary><option>-x</option></primary>
6821 </indexterm>
6822 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6823 National Language Support extended characters in the body of the mail item</quote>).
6824 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6825 this option.
6826 </para>
6827 </listitem></varlistentry>
6828 </variablelist>
6829 <para>
6830 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6831 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6832 </para>
6833 <!-- === End of command line options === -->
6834 </section>
6835 </chapter>
6836
6837 <chapter id="CHAPconf">
6838 <title>The Exim run time configuration file</title>
6839 <titleabbrev>The runtime configuration file</titleabbrev>
6840 <para>
6841 <indexterm role="concept">
6842 <primary>run time configuration</primary>
6843 </indexterm>
6844 <indexterm role="concept">
6845 <primary>configuration file</primary>
6846 <secondary>general description</secondary>
6847 </indexterm>
6848 <indexterm role="concept">
6849 <primary>CONFIGURE_FILE</primary>
6850 </indexterm>
6851 <indexterm role="concept">
6852 <primary>configuration file</primary>
6853 <secondary>errors in</secondary>
6854 </indexterm>
6855 <indexterm role="concept">
6856 <primary>error</primary>
6857 <secondary>in configuration file</secondary>
6858 </indexterm>
6859 <indexterm role="concept">
6860 <primary>return code</primary>
6861 <secondary>for bad configuration</secondary>
6862 </indexterm>
6863 Exim uses a single run time configuration file that is read whenever an Exim
6864 binary is executed. Note that in normal operation, this happens frequently,
6865 because Exim is designed to operate in a distributed manner, without central
6866 control.
6867 </para>
6868 <para>
6869 If a syntax error is detected while reading the configuration file, Exim
6870 writes a message on the standard error, and exits with a non-zero return code.
6871 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6872 errors can be detected at this time. The values of any expanded options are
6873 not checked until the expansion happens, even when the expansion does not
6874 actually alter the string.
6875 </para>
6876 <para>
6877 The name of the configuration file is compiled into the binary for security
6878 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6879 most configurations, this specifies a single file. However, it is permitted to
6880 give a colon-separated list of file names, in which case Exim uses the first
6881 existing file in the list.
6882 </para>
6883 <para>
6884 <indexterm role="concept">
6885 <primary>EXIM_USER</primary>
6886 </indexterm>
6887 <indexterm role="concept">
6888 <primary>EXIM_GROUP</primary>
6889 </indexterm>
6890 <indexterm role="concept">
6891 <primary>CONFIGURE_OWNER</primary>
6892 </indexterm>
6893 <indexterm role="concept">
6894 <primary>CONFIGURE_GROUP</primary>
6895 </indexterm>
6896 <indexterm role="concept">
6897 <primary>configuration file</primary>
6898 <secondary>ownership</secondary>
6899 </indexterm>
6900 <indexterm role="concept">
6901 <primary>ownership</primary>
6902 <secondary>configuration file</secondary>
6903 </indexterm>
6904 The run time configuration file must be owned by root or by the user that is
6905 specified at compile time by the EXIM_USER option, or by the user that is
6906 specified at compile time by the CONFIGURE_OWNER option (if set). The
6907 configuration file must not be world-writeable or group-writeable, unless its
6908 group is the one specified at compile time by the EXIM_GROUP option or by the
6909 CONFIGURE_GROUP option.
6910 </para>
6911 <para>
6912 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6913 to root, anybody who is able to edit the run time configuration file has an
6914 easy way to run commands as root. If you make your mail administrators members
6915 of the Exim group, but do not trust them with root, make sure that the run time
6916 configuration is not group writeable.
6917 </para>
6918 <para>
6919 A default configuration file, which will work correctly in simple situations,
6920 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6921 defines just one file name, the installation process copies the default
6922 configuration to a new file of that name if it did not previously exist. If
6923 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6924 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6925 configuration.
6926 </para>
6927 <section>
6928 <title>Using a different configuration file</title>
6929 <para>
6930 <indexterm role="concept">
6931 <primary>configuration file</primary>
6932 <secondary>alternate</secondary>
6933 </indexterm>
6934 A one-off alternate configuration can be specified by the <option>-C</option> command line
6935 option, which may specify a single file or a list of files. However, when
6936 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6937 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6938 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6939 configuration files before installing them. No owner or group checks are done
6940 on a configuration file specified by <option>-C</option>.
6941 </para>
6942 <para>
6943 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6944 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6945 if you do this, you also lock out the possibility of testing a
6946 configuration using <option>-C</option> right through message reception and delivery, even
6947 if the caller is root. The reception works, but by that time, Exim is running
6948 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6949 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6950 delivery using two separate commands (one to put a message on the queue, using
6951 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6952 </para>
6953 <para>
6954 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6955 prefix string with which any file named in a <option>-C</option> command line option must
6956 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6957 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6958 name can be used with <option>-C</option>.
6959 </para>
6960 <para>
6961 One-off changes to a configuration can be specified by the <option>-D</option> command line
6962 option, which defines and overrides values for macros used inside the
6963 configuration file. However, like <option>-C</option>, the use of this option by a
6964 non-privileged user causes Exim to discard its root privilege.
6965 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6966 completely disabled, and its use causes an immediate error exit.
6967 </para>
6968 <para>
6969 Some sites may wish to use the same Exim binary on different machines that
6970 share a file system, but to use different configuration files on each machine.
6971 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6972 looks for a file whose name is the configuration file name followed by a dot
6973 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6974 file does not exist, the standard name is tried. This processing occurs for
6975 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6976 </para>
6977 <para>
6978 In some esoteric situations different versions of Exim may be run under
6979 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6980 help with this. See the comments in <filename>src/EDITME</filename> for details.
6981 </para>
6982 </section>
6983 <section id="SECTconffilfor">
6984 <title>Configuration file format</title>
6985 <para>
6986 <indexterm role="concept">
6987 <primary>configuration file</primary>
6988 <secondary>format of</secondary>
6989 </indexterm>
6990 <indexterm role="concept">
6991 <primary>format</primary>
6992 <secondary>configuration file</secondary>
6993 </indexterm>
6994 Exim&#x2019;s configuration file is divided into a number of different parts. General
6995 option settings must always appear at the start of the file. The other parts
6996 are all optional, and may appear in any order. Each part other than the first
6997 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6998 optional parts are:
6999 </para>
7000 <itemizedlist>
7001 <listitem>
7002 <para>
7003 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
7004 </para>
7005 </listitem>
7006 <listitem>
7007 <para>
7008 <indexterm role="concept">
7009 <primary>AUTH</primary>
7010 <secondary>configuration</secondary>
7011 </indexterm>
7012 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7013 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7014 </para>
7015 </listitem>
7016 <listitem>
7017 <para>
7018 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7019 addresses and determine how the message is to be delivered.
7020 </para>
7021 </listitem>
7022 <listitem>
7023 <para>
7024 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
7025 define mechanisms for copying messages to destinations.
7026 </para>
7027 </listitem>
7028 <listitem>
7029 <para>
7030 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
7031 </para>
7032 </listitem>
7033 <listitem>
7034 <para>
7035 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
7036 when new addresses are generated during delivery.
7037 </para>
7038 </listitem>
7039 <listitem>
7040 <para>
7041 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
7042 want to use this feature, you must set
7043 </para>
7044 <literallayout class="monospaced">
7045 LOCAL_SCAN_HAS_OPTIONS=yes
7046 </literallayout>
7047 <para>
7048 in <filename>Local/Makefile</filename> before building Exim. Full details of the
7049 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
7050 </para>
7051 </listitem>
7052 </itemizedlist>
7053 <para>
7054 <indexterm role="concept">
7055 <primary>configuration file</primary>
7056 <secondary>leading white space in</secondary>
7057 </indexterm>
7058 <indexterm role="concept">
7059 <primary>configuration file</primary>
7060 <secondary>trailing white space in</secondary>
7061 </indexterm>
7062 <indexterm role="concept">
7063 <primary>white space</primary>
7064 <secondary>in configuration file</secondary>
7065 </indexterm>
7066 Leading and trailing white space in configuration lines is always ignored.
7067 </para>
7068 <para>
7069 Blank lines in the file, and lines starting with a # character (ignoring
7070 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
7071 # character other than at the beginning of a line is not treated specially,
7072 and does not introduce a comment.
7073 </para>
7074 <para>
7075 Any non-comment line can be continued by ending it with a backslash. Note that
7076 the general rule for white space means that trailing white space after the
7077 backslash and leading white space at the start of continuation
7078 lines is ignored. Comment lines beginning with # (but not empty lines) may
7079 appear in the middle of a sequence of continuation lines.
7080 </para>
7081 <para>
7082 A convenient way to create a configuration file is to start from the
7083 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7084 change settings as required.
7085 </para>
7086 <para>
7087 The ACLs, retry rules, and rewriting rules have their own syntax which is
7088 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7089 respectively. The other parts of the configuration file have some syntactic
7090 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7091 onwards. Before that, the inclusion, macro, and conditional facilities are
7092 described.
7093 </para>
7094 </section>
7095 <section>
7096 <title>File inclusions in the configuration file</title>
7097 <para>
7098 <indexterm role="concept">
7099 <primary>inclusions in configuration file</primary>
7100 </indexterm>
7101 <indexterm role="concept">
7102 <primary>configuration file</primary>
7103 <secondary>including other files</secondary>
7104 </indexterm>
7105 <indexterm role="concept">
7106 <primary>.include in configuration file</primary>
7107 </indexterm>
7108 <indexterm role="concept">
7109 <primary>.include_if_exists in configuration file</primary>
7110 </indexterm>
7111 You can include other files inside Exim&#x2019;s run time configuration file by
7112 using this syntax:
7113 </para>
7114 <literallayout>
7115 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7116 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7117 </literallayout>
7118 <para>
7119 on a line by itself. Double quotes round the file name are optional. If you use
7120 the first form, a configuration error occurs if the file does not exist; the
7121 second form does nothing for non-existent files. In all cases, an absolute file
7122 name is required.
7123 </para>
7124 <para>
7125 Includes may be nested to any depth, but remember that Exim reads its
7126 configuration file often, so it is a good idea to keep them to a minimum.
7127 If you change the contents of an included file, you must HUP the daemon,
7128 because an included file is read only when the configuration itself is read.
7129 </para>
7130 <para>
7131 The processing of inclusions happens early, at a physical line level, so, like
7132 comment lines, an inclusion can be used in the middle of an option setting,
7133 for example:
7134 </para>
7135 <literallayout class="monospaced">
7136 hosts_lookup = a.b.c \
7137                .include /some/file
7138 </literallayout>
7139 <para>
7140 Include processing happens after macro processing (see below). Its effect is to
7141 process the lines of the included file as if they occurred inline where the
7142 inclusion appears.
7143 </para>
7144 </section>
7145 <section id="SECTmacrodefs">
7146 <title>Macros in the configuration file</title>
7147 <para>
7148 <indexterm role="concept">
7149 <primary>macro</primary>
7150 <secondary>description of</secondary>
7151 </indexterm>
7152 <indexterm role="concept">
7153 <primary>configuration file</primary>
7154 <secondary>macros</secondary>
7155 </indexterm>
7156 If a line in the main part of the configuration (that is, before the first
7157 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7158 definition, and must be of the form
7159 </para>
7160 <literallayout>
7161 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7162 </literallayout>
7163 <para>
7164 The name must consist of letters, digits, and underscores, and need not all be
7165 in upper case, though that is recommended. The rest of the line, including any
7166 continuations, is the replacement text, and has leading and trailing white
7167 space removed. Quotes are not removed. The replacement text can never end with
7168 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7169 </para>
7170 <para>
7171 Macros may also be defined between router, transport, authenticator, or ACL
7172 definitions. They may not, however, be defined within an individual driver or
7173 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7174 </para>
7175 </section>
7176 <section>
7177 <title>Macro substitution</title>
7178 <para>
7179 Once a macro is defined, all subsequent lines in the file (and any included
7180 files) are scanned for the macro name; if there are several macros, the line is
7181 scanned for each in turn, in the order in which the macros are defined. The
7182 replacement text is not re-scanned for the current macro, though it is scanned
7183 for subsequently defined macros. For this reason, a macro name may not contain
7184 the name of a previously defined macro as a substring. You could, for example,
7185 define
7186 </para>
7187 <literallayout>
7188 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7189 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7190 </literallayout>
7191 <para>
7192 but putting the definitions in the opposite order would provoke a configuration
7193 error. Macro expansion is applied to individual physical lines from the file,
7194 before checking for line continuation or file inclusion (see above). If a line
7195 consists solely of a macro name, and the expansion of the macro is empty, the
7196 line is ignored. A macro at the start of a line may turn the line into a
7197 comment line or a <literal>.include</literal> line.
7198 </para>
7199 </section>
7200 <section>
7201 <title>Redefining macros</title>
7202 <para>
7203 Once defined, the value of a macro can be redefined later in the configuration
7204 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7205 <emphasis>=</emphasis>. For example:
7206 </para>
7207 <literallayout class="monospaced">
7208 MAC =  initial value
7209 ...
7210 MAC == updated value
7211 </literallayout>
7212 <para>
7213 Redefinition does not alter the order in which the macros are applied to the
7214 subsequent lines of the configuration file. It is still the same order in which
7215 the macros were originally defined. All that changes is the macro&#x2019;s value.
7216 Redefinition makes it possible to accumulate values. For example:
7217 </para>
7218 <literallayout class="monospaced">
7219 MAC =  initial value
7220 ...
7221 MAC == MAC and something added
7222 </literallayout>
7223 <para>
7224 This can be helpful in situations where the configuration file is built
7225 from a number of other files.
7226 </para>
7227 </section>
7228 <section>
7229 <title>Overriding macro values</title>
7230 <para>
7231 The values set for macros in the configuration file can be overridden by the
7232 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7233 used, unless called by root or the Exim user. A definition on the command line
7234 using the <option>-D</option> option causes all definitions and redefinitions within the
7235 file to be ignored.
7236 </para>
7237 </section>
7238 <section>
7239 <title>Example of macro usage</title>
7240 <para>
7241 As an example of macro usage, consider a configuration where aliases are looked
7242 up in a MySQL database. It helps to keep the file less cluttered if long
7243 strings such as SQL statements are defined separately as macros, for example:
7244 </para>
7245 <literallayout class="monospaced">
7246 ALIAS_QUERY = select mailbox from user where \
7247               login=${quote_mysql:$local_part};
7248 </literallayout>
7249 <para>
7250 This can then be used in a <command>redirect</command> router setting like this:
7251 </para>
7252 <literallayout class="monospaced">
7253 data = ${lookup mysql{ALIAS_QUERY}}
7254 </literallayout>
7255 <para>
7256 In earlier versions of Exim macros were sometimes used for domain, host, or
7257 address lists. In Exim 4 these are handled better by named lists &ndash; see
7258 section <xref linkend="SECTnamedlists"/>.
7259 </para>
7260 </section>
7261 <section>
7262 <title>Conditional skips in the configuration file</title>
7263 <para>
7264 <indexterm role="concept">
7265 <primary>configuration file</primary>
7266 <secondary>conditional skips</secondary>
7267 </indexterm>
7268 <indexterm role="concept">
7269 <primary>.ifdef</primary>
7270 </indexterm>
7271 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7272 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7273 portions of the configuration file. The processing happens whenever the file is
7274 read (that is, when an Exim binary starts to run).
7275 </para>
7276 <para>
7277 The implementation is very simple. Instances of the first four directives must
7278 be followed by text that includes the names of one or macros. The condition
7279 that is tested is whether or not any macro substitution has taken place in the
7280 line. Thus:
7281 </para>
7282 <literallayout class="monospaced">
7283 .ifdef AAA
7284 message_size_limit = 50M
7285 .else
7286 message_size_limit = 100M
7287 .endif
7288 </literallayout>
7289 <para>
7290 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7291 otherwise. If there is more than one macro named on the line, the condition
7292 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7293 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7294 </para>
7295 <para>
7296 Although you can use a macro expansion to generate one of these directives,
7297 it is not very useful, because the condition <quote>there was a macro substitution
7298 in this line</quote> will always be true.
7299 </para>
7300 <para>
7301 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7302 to clarify complicated nestings.
7303 </para>
7304 </section>
7305 <section id="SECTcos">
7306 <title>Common option syntax</title>
7307 <para>
7308 <indexterm role="concept">
7309 <primary>common option syntax</primary>
7310 </indexterm>
7311 <indexterm role="concept">
7312 <primary>syntax of common options</primary>
7313 </indexterm>
7314 <indexterm role="concept">
7315 <primary>configuration file</primary>
7316 <secondary>common option syntax</secondary>
7317 </indexterm>
7318 For the main set of options, driver options, and <function>local_scan()</function> options,
7319 each setting is on a line by itself, and starts with a name consisting of
7320 lower-case letters and underscores. Many options require a data value, and in
7321 these cases the name must be followed by an equals sign (with optional white
7322 space) and then the value. For example:
7323 </para>
7324 <literallayout class="monospaced">
7325 qualify_domain = mydomain.example.com
7326 </literallayout>
7327 <para>
7328 Some option settings may contain sensitive data, for example, passwords for
7329 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7330 line option to read these values, you can precede the option settings with the
7331 word <quote>hide</quote>. For example:
7332 </para>
7333 <literallayout class="monospaced">
7334 hide mysql_servers = localhost/users/admin/secret-password
7335 </literallayout>
7336 <para>
7337 For non-admin users, such options are displayed like this:
7338 </para>
7339 <literallayout class="monospaced">
7340 mysql_servers = &lt;value not displayable&gt;
7341 </literallayout>
7342 <para>
7343 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7344 all instances of the same driver.
7345 </para>
7346 <para>
7347 The following sections describe the syntax used for the different data types
7348 that are found in option settings.
7349 </para>
7350 </section>
7351 <section>
7352 <title>Boolean options</title>
7353 <para>
7354 <indexterm role="concept">
7355 <primary>format</primary>
7356 <secondary>boolean</secondary>
7357 </indexterm>
7358 <indexterm role="concept">
7359 <primary>boolean configuration values</primary>
7360 </indexterm>
7361 <indexterm role="option">
7362 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7363 </indexterm>
7364 <indexterm role="option">
7365 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7366 </indexterm>
7367 Options whose type is given as boolean are on/off switches. There are two
7368 different ways of specifying such options: with and without a data value. If
7369 the option name is specified on its own without data, the switch is turned on;
7370 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7371 boolean options may be followed by an equals sign and one of the words
7372 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7373 the following two settings have exactly the same effect:
7374 </para>
7375 <literallayout class="monospaced">
7376 queue_only
7377 queue_only = true
7378 </literallayout>
7379 <para>
7380 The following two lines also have the same (opposite) effect:
7381 </para>
7382 <literallayout class="monospaced">
7383 no_queue_only
7384 queue_only = false
7385 </literallayout>
7386 <para>
7387 You can use whichever syntax you prefer.
7388 </para>
7389 </section>
7390 <section>
7391 <title>Integer values</title>
7392 <para>
7393 <indexterm role="concept">
7394 <primary>integer configuration values</primary>
7395 </indexterm>
7396 <indexterm role="concept">
7397 <primary>format</primary>
7398 <secondary>integer</secondary>
7399 </indexterm>
7400 If an integer data item starts with the characters <quote>0x</quote>, the remainder of it
7401 is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it
7402 starts with the digit 0, and decimal if not. If an integer value is followed by
7403 the letter K, it is multiplied by 1024; if it is followed by the letter M, it
7404 is multiplied by 1024x1024.
7405 </para>
7406 <para>
7407 When the values of integer option settings are output, values which are an
7408 exact multiple of 1024 or 1024x1024 are
7409 sometimes, but not always,
7410 printed using the letters K and M. The printing style is independent of the
7411 actual input format that was used.
7412 </para>
7413 </section>
7414 <section>
7415 <title>Octal integer values</title>
7416 <para>
7417 <indexterm role="concept">
7418 <primary>integer format</primary>
7419 </indexterm>
7420 <indexterm role="concept">
7421 <primary>format</primary>
7422 <secondary>octal integer</secondary>
7423 </indexterm>
7424 The value of an option specified as an octal integer is always interpreted in
7425 octal, whether or not it starts with the digit zero. Such options are always
7426 output in octal.
7427 </para>
7428 </section>
7429 <section>
7430 <title>Fixed point number values</title>
7431 <para>
7432 <indexterm role="concept">
7433 <primary>fixed point configuration values</primary>
7434 </indexterm>
7435 <indexterm role="concept">
7436 <primary>format</primary>
7437 <secondary>fixed point</secondary>
7438 </indexterm>
7439 A fixed point number consists of a decimal integer, optionally followed by a
7440 decimal point and up to three further digits.
7441 </para>
7442 </section>
7443 <section id="SECTtimeformat">
7444 <title>Time interval values</title>
7445 <para>
7446 <indexterm role="concept">
7447 <primary>time interval</primary>
7448 <secondary>specifying in configuration</secondary>
7449 </indexterm>
7450 <indexterm role="concept">
7451 <primary>format</primary>
7452 <secondary>time interval</secondary>
7453 </indexterm>
7454 A time interval is specified as a sequence of numbers, each followed by one of
7455 the following letters, with no intervening white space:
7456 </para>
7457 <informaltable frame="none">
7458 <tgroup cols="2" colsep="0" rowsep="0">
7459 <colspec colwidth="50pt" align="left"/>
7460 <colspec colwidth="254pt" align="left"/>
7461 <tbody>
7462 <row>
7463 <entry>&nbsp;<option>s</option></entry>
7464 <entry>seconds</entry>
7465 </row>
7466 <row>
7467 <entry>&nbsp;<option>m</option></entry>
7468 <entry>minutes</entry>
7469 </row>
7470 <row>
7471 <entry>&nbsp;<option>h</option></entry>
7472 <entry>hours</entry>
7473 </row>
7474 <row>
7475 <entry>&nbsp;<option>d</option></entry>
7476 <entry>days</entry>
7477 </row>
7478 <row>
7479 <entry>&nbsp;<option>w</option></entry>
7480 <entry>weeks</entry>
7481 </row>
7482 </tbody>
7483 </tgroup>
7484 </informaltable>
7485 <para>
7486 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7487 intervals are output in the same format. Exim does not restrict the values; it
7488 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7489 </para>
7490 </section>
7491 <section id="SECTstrings">
7492 <title>String values</title>
7493 <para>
7494 <indexterm role="concept">
7495 <primary>string</primary>
7496 <secondary>format of configuration values</secondary>
7497 </indexterm>
7498 <indexterm role="concept">
7499 <primary>format</primary>
7500 <secondary>string</secondary>
7501 </indexterm>
7502 If a string data item does not start with a double-quote character, it is taken
7503 as consisting of the remainder of the line plus any continuation lines,
7504 starting at the first character after any leading white space, with trailing
7505 white space removed, and with no interpretation of the characters in the
7506 string. Because Exim removes comment lines (those beginning with #) at an early
7507 stage, they can appear in the middle of a multi-line string. The following
7508 settings are therefore equivalent:
7509 </para>
7510 <literallayout class="monospaced">
7511 trusted_users = uucp:mail
7512
7513 trusted_users = uucp:\
7514                 # This comment line is ignored
7515                 mail
7516 </literallayout>
7517 <para>
7518 <indexterm role="concept">
7519 <primary>string</primary>
7520 <secondary>quoted</secondary>
7521 </indexterm>
7522 <indexterm role="concept">
7523 <primary>escape characters in quoted strings</primary>
7524 </indexterm>
7525 If a string does start with a double-quote, it must end with a closing
7526 double-quote, and any backslash characters other than those used for line
7527 continuation are interpreted as escape characters, as follows:
7528 </para>
7529 <informaltable frame="none">
7530 <tgroup cols="2" colsep="0" rowsep="0">
7531 <colspec colwidth="100pt" align="left"/>
7532 <colspec colwidth="254pt" align="left"/>
7533 <tbody>
7534 <row>
7535 <entry>&nbsp;<literal>\\</literal></entry>
7536 <entry>single backslash</entry>
7537 </row>
7538 <row>
7539 <entry>&nbsp;<literal>\n</literal></entry>
7540 <entry>newline</entry>
7541 </row>
7542 <row>
7543 <entry>&nbsp;<literal>\r</literal></entry>
7544 <entry>carriage return</entry>
7545 </row>
7546 <row>
7547 <entry>&nbsp;<literal>\t</literal></entry>
7548 <entry>tab</entry>
7549 </row>
7550 <row>
7551 <entry>&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7552 <entry>up to 3 octal digits specify one character</entry>
7553 </row>
7554 <row>
7555 <entry>&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7556 <entry>up to 2 hexadecimal digits specify one character</entry>
7557 </row>
7558 </tbody>
7559 </tgroup>
7560 </informaltable>
7561 <para>
7562 If a backslash is followed by some other character, including a double-quote
7563 character, that character replaces the pair.
7564 </para>
7565 <para>
7566 Quoting is necessary only if you want to make use of the backslash escapes to
7567 insert special characters, or if you need to specify a value with leading or
7568 trailing spaces. These cases are rare, so quoting is almost never needed in
7569 current versions of Exim. In versions of Exim before 3.14, quoting was required
7570 in order to continue lines, so you may come across older configuration files
7571 and examples that apparently quote unnecessarily.
7572 </para>
7573 </section>
7574 <section>
7575 <title>Expanded strings</title>
7576 <para>
7577 <indexterm role="concept">
7578 <primary>string expansion</primary>
7579 <secondary>definition of</secondary>
7580 </indexterm>
7581 <indexterm role="concept">
7582 <primary>expansion</primary>
7583 <secondary>definition of</secondary>
7584 </indexterm>
7585 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7586 by which means various parts of the string may be changed according to the
7587 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7588 is as just described; in particular, the handling of backslashes in quoted
7589 strings is done as part of the input process, before expansion takes place.
7590 However, backslash is also an escape character for the expander, so any
7591 backslashes that are required for that reason must be doubled if they are
7592 within a quoted configuration string.
7593 </para>
7594 </section>
7595 <section>
7596 <title>User and group names</title>
7597 <para>
7598 <indexterm role="concept">
7599 <primary>user name</primary>
7600 <secondary>format of</secondary>
7601 </indexterm>
7602 <indexterm role="concept">
7603 <primary>format</primary>
7604 <secondary>user name</secondary>
7605 </indexterm>
7606 <indexterm role="concept">
7607 <primary>group</primary>
7608 <secondary>name format</secondary>
7609 </indexterm>
7610 <indexterm role="concept">
7611 <primary>format</primary>
7612 <secondary>group name</secondary>
7613 </indexterm>
7614 User and group names are specified as strings, using the syntax described
7615 above, but the strings are interpreted specially. A user or group name must
7616 either consist entirely of digits, or be a name that can be looked up using the
7617 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7618 </para>
7619 </section>
7620 <section id="SECTlistconstruct">
7621 <title>List construction</title>
7622 <para>
7623 <indexterm role="concept">
7624 <primary>list</primary>
7625 <secondary>syntax of in configuration</secondary>
7626 </indexterm>
7627 <indexterm role="concept">
7628 <primary>format</primary>
7629 <secondary>list item in configuration</secondary>
7630 </indexterm>
7631 <indexterm role="concept">
7632 <primary>string list</primary>
7633 <secondary>definition</secondary>
7634 </indexterm>
7635 The data for some configuration options is a list of items, with colon as the
7636 default separator. Many of these options are shown with type <quote>string list</quote> in
7637 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7638 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7639 are all the same; however, those other than <quote>string list</quote> are subject to
7640 particular kinds of interpretation, as described in chapter
7641 <xref linkend="CHAPdomhosaddlists"/>.
7642 </para>
7643 <para>
7644 In all these cases, the entire list is treated as a single string as far as the
7645 input syntax is concerned. The <option>trusted_users</option> setting in section
7646 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7647 in a list, it must be entered as two colons. Leading and trailing white space
7648 on each item in a list is ignored. This makes it possible to include items that
7649 start with a colon, and in particular, certain forms of IPv6 address. For
7650 example, the list
7651 </para>
7652 <literallayout class="monospaced">
7653 local_interfaces = 127.0.0.1 : ::::1
7654 </literallayout>
7655 <para>
7656 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7657 </para>
7658 <para>
7659 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7660 list items, it is not ignored when parsing the list. The space after the first
7661 colon in the example above is necessary. If it were not there, the list would
7662 be interpreted as the two items 127.0.0.1:: and 1.
7663 </para>
7664 <para>
7665 <indexterm role="concept">
7666 <primary>list separator</primary>
7667 <secondary>changing</secondary>
7668 </indexterm>
7669 <indexterm role="concept">
7670 <primary>IPv6</primary>
7671 <secondary>addresses in lists</secondary>
7672 </indexterm>
7673 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7674 introduced to allow the separator character to be changed. If a list begins
7675 with a left angle bracket, followed by any punctuation character, that
7676 character is used instead of colon as the list separator. For example, the list
7677 above can be rewritten to use a semicolon separator like this:
7678 </para>
7679 <literallayout class="monospaced">
7680 local_interfaces = &lt;; 127.0.0.1 ; ::1
7681 </literallayout>
7682 <para>
7683 This facility applies to all lists, with the exception of the list in
7684 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7685 confined to circumstances where they really are needed.
7686 </para>
7687 </section>
7688 <section id="SECTempitelis">
7689 <title>Empty items in lists</title>
7690 <para>
7691 <indexterm role="concept">
7692 <primary>list</primary>
7693 <secondary>empty item in</secondary>
7694 </indexterm>
7695 An empty item at the end of a list is always ignored. In other words, trailing
7696 separator characters are ignored. Thus, the list in
7697 </para>
7698 <literallayout class="monospaced">
7699 senders = user@domain :
7700 </literallayout>
7701 <para>
7702 contains only a single item. If you want to include an empty string as one item
7703 in a list, it must not be the last item. For example, this list contains three
7704 items, the second of which is empty:
7705 </para>
7706 <literallayout class="monospaced">
7707 senders = user1@domain : : user2@domain
7708 </literallayout>
7709 <para>
7710 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7711 are interpreted as representing a single colon data character (and the list
7712 would then contain just one item). If you want to specify a list that contains
7713 just one, empty item, you can do it as in this example:
7714 </para>
7715 <literallayout class="monospaced">
7716 senders = :
7717 </literallayout>
7718 <para>
7719 In this case, the first item is empty, and the second is discarded because it
7720 is at the end of the list.
7721 </para>
7722 </section>
7723 <section id="SECTfordricon">
7724 <title>Format of driver configurations</title>
7725 <para>
7726 <indexterm role="concept">
7727 <primary>drivers</primary>
7728 <secondary>configuration format</secondary>
7729 </indexterm>
7730 There are separate parts in the configuration for defining routers, transports,
7731 and authenticators. In each part, you are defining a number of driver
7732 instances, each with its own set of options. Each driver instance is defined by
7733 a sequence of lines like this:
7734 </para>
7735 <literallayout>
7736 &lt;<emphasis>instance name</emphasis>&gt;:
7737   &lt;<emphasis>option</emphasis>&gt;
7738   ...
7739   &lt;<emphasis>option</emphasis>&gt;
7740 </literallayout>
7741 <para>
7742 In the following example, the instance name is <command>localuser</command>, and it is
7743 followed by three options settings:
7744 </para>
7745 <literallayout class="monospaced">
7746 localuser:
7747   driver = accept
7748   check_local_user
7749   transport = local_delivery
7750 </literallayout>
7751 <para>
7752 For each driver instance, you specify which Exim code module it uses &ndash; by the
7753 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7754 settings. For example, in the case of transports, if you want a transport to
7755 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7756 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7757 described in detail in its own separate chapter later in this manual.
7758 </para>
7759 <para>
7760 You can have several routers, transports, or authenticators that are based on
7761 the same underlying driver (each must have a different instance name).
7762 </para>
7763 <para>
7764 The order in which routers are defined is important, because addresses are
7765 passed to individual routers one by one, in order. The order in which
7766 transports are defined does not matter at all. The order in which
7767 authenticators are defined is used only when Exim, as a client, is searching
7768 them to find one that matches an authentication mechanism offered by the
7769 server.
7770 </para>
7771 <para>
7772 <indexterm role="concept">
7773 <primary>generic options</primary>
7774 </indexterm>
7775 <indexterm role="concept">
7776 <primary>options</primary>
7777 <secondary>generic &ndash; definition of</secondary>
7778 </indexterm>
7779 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7780 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7781 same type (that is, all routers, all transports or all authenticators). The
7782 <option>driver</option> option is a generic option that must appear in every definition.
7783 <indexterm role="concept">
7784 <primary>private options</primary>
7785 </indexterm>
7786 The private options are special for each driver, and none need appear, because
7787 they all have default values.
7788 </para>
7789 <para>
7790 The options may appear in any order, except that the <option>driver</option> option must
7791 precede any private options, since these depend on the particular driver. For
7792 this reason, it is recommended that <option>driver</option> always be the first option.
7793 </para>
7794 <para>
7795 Driver instance names, which are used for reference in log entries and
7796 elsewhere, can be any sequence of letters, digits, and underscores (starting
7797 with a letter) and must be unique among drivers of the same type. A router and
7798 a transport (for example) can each have the same name, but no two router
7799 instances can have the same name. The name of a driver instance should not be
7800 confused with the name of the underlying driver module. For example, the
7801 configuration lines:
7802 </para>
7803 <literallayout class="monospaced">
7804 remote_smtp:
7805   driver = smtp
7806 </literallayout>
7807 <para>
7808 create an instance of the <command>smtp</command> transport driver whose name is
7809 <command>remote_smtp</command>. The same driver code can be used more than once, with
7810 different instance names and different option settings each time. A second
7811 instance of the <command>smtp</command> transport, with different options, might be defined
7812 thus:
7813 </para>
7814 <literallayout class="monospaced">
7815 special_smtp:
7816   driver = smtp
7817   port = 1234
7818   command_timeout = 10s
7819 </literallayout>
7820 <para>
7821 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7822 these transport instances from routers, and these names would appear in log
7823 lines.
7824 </para>
7825 <para>
7826 Comment lines may be present in the middle of driver specifications. The full
7827 list of option settings for any particular driver instance, including all the
7828 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7829 option.
7830 </para>
7831 </section>
7832 </chapter>
7833
7834 <chapter id="CHAPdefconfil">
7835 <title>The default configuration file</title>
7836 <para>
7837 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7838 <primary>configuration file</primary>
7839 <secondary>default <quote>walk through</quote></secondary>
7840 </indexterm>
7841 <indexterm role="concept">
7842 <primary>default</primary>
7843 <secondary>configuration file <quote>walk through</quote></secondary>
7844 </indexterm>
7845 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7846 is sufficient for a host with simple mail requirements. As an introduction to
7847 the way Exim is configured, this chapter <quote>walks through</quote> the default
7848 configuration, giving brief explanations of the settings. Detailed descriptions
7849 of the options are given in subsequent chapters. The default configuration file
7850 itself contains extensive comments about ways you might want to modify the
7851 initial settings. However, note that there are many options that are not
7852 mentioned at all in the default configuration.
7853 </para>
7854 <section id="SECTdefconfmain">
7855 <title>Main configuration settings</title>
7856 <para>
7857 The main (global) configuration option settings must always come first in the
7858 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7859 the line
7860 </para>
7861 <literallayout class="monospaced">
7862 # primary_hostname =
7863 </literallayout>
7864 <para>
7865 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7866 to know the official, fully qualified name of your host, and this is where you
7867 can specify it. However, in most cases you do not need to set this option. When
7868 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7869 </para>
7870 <para>
7871 The first three non-comment configuration lines are as follows:
7872 </para>
7873 <literallayout class="monospaced">
7874 domainlist local_domains = @
7875 domainlist relay_to_domains =
7876 hostlist   relay_from_hosts = 127.0.0.1
7877 </literallayout>
7878 <para>
7879 These are not, in fact, option settings. They are definitions of two named
7880 domain lists and one named host list. Exim allows you to give names to lists of
7881 domains, hosts, and email addresses, in order to make it easier to manage the
7882 configuration file (see section <xref linkend="SECTnamedlists"/>).
7883 </para>
7884 <para>
7885 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7886 later in the configuration to identify domains that are to be delivered
7887 on the local host.
7888 </para>
7889 <para>
7890 <indexterm role="concept">
7891 <primary>@ in a domain list</primary>
7892 </indexterm>
7893 There is just one item in this list, the string <quote>@</quote>. This is a special form
7894 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7895 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7896 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7897 the same configuration file can be used on different hosts.
7898 </para>
7899 <para>
7900 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7901 list itself is empty. Later in the configuration we will come to the part that
7902 controls mail relaying through the local host; it allows relaying to any
7903 domains in this list. By default, therefore, no relaying on the basis of a mail
7904 domain is permitted.
7905 </para>
7906 <para>
7907 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7908 used later in the configuration to permit relaying from any host or IP address
7909 that matches the list. The default contains just the IP address of the IPv4
7910 loopback interface, which means that processes on the local host are able to
7911 submit mail for relaying by sending it over TCP/IP to that interface. No other
7912 hosts are permitted to submit messages for relaying.
7913 </para>
7914 <para>
7915 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7916 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7917 and hosts that will be used in the controls that are specified later.
7918 </para>
7919 <para>
7920 The next two configuration lines are genuine option settings:
7921 </para>
7922 <literallayout class="monospaced">
7923 acl_smtp_rcpt = acl_check_rcpt
7924 acl_smtp_data = acl_check_data
7925 </literallayout>
7926 <para>
7927 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7928 during an incoming SMTP session for every recipient of a message (every RCPT
7929 command), and after the contents of the message have been received,
7930 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7931 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7932 section of the configuration. The RCPT ACL controls which recipients are
7933 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7934 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7935 contents of a message to be checked.
7936 </para>
7937 <para>
7938 Two commented-out option settings are next:
7939 </para>
7940 <literallayout class="monospaced">
7941 # av_scanner = clamd:/tmp/clamd
7942 # spamd_address = 127.0.0.1 783
7943 </literallayout>
7944 <para>
7945 These are example settings that can be used when Exim is compiled with the
7946 content-scanning extension. The first specifies the interface to the virus
7947 scanner, and the second specifies the interface to SpamAssassin. Further
7948 details are given in chapter <xref linkend="CHAPexiscan"/>.
7949 </para>
7950 <para>
7951 Three more commented-out option settings follow:
7952 </para>
7953 <literallayout class="monospaced">
7954 # tls_advertise_hosts = *
7955 # tls_certificate = /etc/ssl/exim.crt
7956 # tls_privatekey = /etc/ssl/exim.pem
7957 </literallayout>
7958 <para>
7959 These are example settings that can be used when Exim is compiled with
7960 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7961 first one specifies the list of clients that are allowed to use TLS when
7962 connecting to this server; in this case the wildcard means all clients. The
7963 other options specify where Exim should find its TLS certificate and private
7964 key, which together prove the server&#x2019;s identity to any clients that connect.
7965 More details are given in chapter <xref linkend="CHAPTLS"/>.
7966 </para>
7967 <para>
7968 Another two commented-out option settings follow:
7969 </para>
7970 <literallayout class="monospaced">
7971 # daemon_smtp_ports = 25 : 465 : 587
7972 # tls_on_connect_ports = 465
7973 </literallayout>
7974 <para>
7975 <indexterm role="concept">
7976 <primary>port</primary>
7977 <secondary>465 and 587</secondary>
7978 </indexterm>
7979 <indexterm role="concept">
7980 <primary>port</primary>
7981 <secondary>for message submission</secondary>
7982 </indexterm>
7983 <indexterm role="concept">
7984 <primary>message</primary>
7985 <secondary>submission, ports for</secondary>
7986 </indexterm>
7987 <indexterm role="concept">
7988 <primary>ssmtp protocol</primary>
7989 </indexterm>
7990 <indexterm role="concept">
7991 <primary>smtps protocol</primary>
7992 </indexterm>
7993 <indexterm role="concept">
7994 <primary>SMTP</primary>
7995 <secondary>ssmtp protocol</secondary>
7996 </indexterm>
7997 <indexterm role="concept">
7998 <primary>SMTP</primary>
7999 <secondary>smtps protocol</secondary>
8000 </indexterm>
8001 These options provide better support for roaming users who wish to use this
8002 server for message submission. They are not much use unless you have turned on
8003 TLS (as described in the previous paragraph) and authentication (about which
8004 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
8005 on end-user networks, so RFC 4409 specifies that message submission should use
8006 port 587 instead. However some software (notably Microsoft Outlook) cannot be
8007 configured to use port 587 correctly, so these settings also enable the
8008 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
8009 <xref linkend="SECTsupobssmt"/>).
8010 </para>
8011 <para>
8012 Two more commented-out options settings follow:
8013 </para>
8014 <literallayout class="monospaced">
8015 # qualify_domain =
8016 # qualify_recipient =
8017 </literallayout>
8018 <para>
8019 The first of these specifies a domain that Exim uses when it constructs a
8020 complete email address from a local login name. This is often needed when Exim
8021 receives a message from a local process. If you do not set <option>qualify_domain</option>,
8022 the value of <option>primary_hostname</option> is used. If you set both of these options,
8023 you can have different qualification domains for sender and recipient
8024 addresses. If you set only the first one, its value is used in both cases.
8025 </para>
8026 <para>
8027 <indexterm role="concept">
8028 <primary>domain literal</primary>
8029 <secondary>recognizing format</secondary>
8030 </indexterm>
8031 The following line must be uncommented if you want Exim to recognize
8032 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
8033 (an IP address within square brackets) instead of a named domain.
8034 </para>
8035 <literallayout class="monospaced">
8036 # allow_domain_literals
8037 </literallayout>
8038 <para>
8039 The RFCs still require this form, but many people think that in the modern
8040 Internet it makes little sense to permit mail to be sent to specific hosts by
8041 quoting their IP addresses. This ancient format has been used by people who
8042 try to abuse hosts by using them for unwanted relaying. However, some
8043 people believe there are circumstances (for example, messages addressed to
8044 <emphasis>postmaster</emphasis>) where domain literals are still useful.
8045 </para>
8046 <para>
8047 The next configuration line is a kind of trigger guard:
8048 </para>
8049 <literallayout class="monospaced">
8050 never_users = root
8051 </literallayout>
8052 <para>
8053 It specifies that no delivery must ever be run as the root user. The normal
8054 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
8055 setting is a guard against slips in the configuration.
8056 The list of users specified by <option>never_users</option> is not, however, the complete
8057 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
8058 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
8059 contents of <option>never_users</option> are added to this list. By default
8060 FIXED_NEVER_USERS also specifies root.
8061 </para>
8062 <para>
8063 When a remote host connects to Exim in order to send mail, the only information
8064 Exim has about the host&#x2019;s identity is its IP address. The next configuration
8065 line,
8066 </para>
8067 <literallayout class="monospaced">
8068 host_lookup = *
8069 </literallayout>
8070 <para>
8071 specifies that Exim should do a reverse DNS lookup on all incoming connections,
8072 in order to get a host name. This improves the quality of the logging
8073 information, but if you feel it is too expensive, you can remove it entirely,
8074 or restrict the lookup to hosts on <quote>nearby</quote> networks.
8075 Note that it is not always possible to find a host name from an IP address,
8076 because not all DNS reverse zones are maintained, and sometimes DNS servers are
8077 unreachable.
8078 </para>
8079 <para>
8080 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8081 1413 (hence their names):
8082 </para>
8083 <literallayout class="monospaced">
8084 rfc1413_hosts = *
8085 rfc1413_query_timeout = 5s
8086 </literallayout>
8087 <para>
8088 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8089 You can limit the hosts to which these calls are made, or change the timeout
8090 that is used. If you set the timeout to zero, all ident calls are disabled.
8091 Although they are cheap and can provide useful information for tracing problem
8092 messages, some hosts and firewalls have problems with ident calls. This can
8093 result in a timeout instead of an immediate refused connection, leading to
8094 delays on starting up an incoming SMTP session.
8095 </para>
8096 <para>
8097 When Exim receives messages over SMTP connections, it expects all addresses to
8098 be fully qualified with a domain, as required by the SMTP definition. However,
8099 if you are running a server to which simple clients submit messages, you may
8100 find that they send unqualified addresses. The two commented-out options:
8101 </para>
8102 <literallayout class="monospaced">
8103 # sender_unqualified_hosts =
8104 # recipient_unqualified_hosts =
8105 </literallayout>
8106 <para>
8107 show how you can specify hosts that are permitted to send unqualified sender
8108 and recipient addresses, respectively.
8109 </para>
8110 <para>
8111 The <option>percent_hack_domains</option> option is also commented out:
8112 </para>
8113 <literallayout class="monospaced">
8114 # percent_hack_domains =
8115 </literallayout>
8116 <para>
8117 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8118 This is an almost obsolete form of explicit email routing. If you do not know
8119 anything about it, you can safely ignore this topic.
8120 </para>
8121 <para>
8122 The last two settings in the main part of the default configuration are
8123 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8124 message is frozen, Exim no longer continues to try to deliver it. Freezing
8125 occurs when a bounce message encounters a permanent failure because the sender
8126 address of the original message that caused the bounce is invalid, so the
8127 bounce cannot be delivered. This is probably the most common case, but there
8128 are also other conditions that cause freezing, and frozen messages are not
8129 always bounce messages.
8130 </para>
8131 <literallayout class="monospaced">
8132 ignore_bounce_errors_after = 2d
8133 timeout_frozen_after = 7d
8134 </literallayout>
8135 <para>
8136 The first of these options specifies that failing bounce messages are to be
8137 discarded after 2 days on the queue. The second specifies that any frozen
8138 message (whether a bounce message or not) is to be timed out (and discarded)
8139 after a week. In this configuration, the first setting ensures that no failing
8140 bounce message ever lasts a week.
8141 </para>
8142 </section>
8143 <section>
8144 <title>ACL configuration</title>
8145 <para>
8146 <indexterm role="concept">
8147 <primary>default</primary>
8148 <secondary>ACLs</secondary>
8149 </indexterm>
8150 <indexterm role="concept">
8151 <primary>access control lists (ACLs)</primary>
8152 <secondary>default configuration</secondary>
8153 </indexterm>
8154 In the default configuration, the ACL section follows the main configuration.
8155 It starts with the line
8156 </para>
8157 <literallayout class="monospaced">
8158 begin acl
8159 </literallayout>
8160 <para>
8161 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8162 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8163 and <option>acl_smtp_data</option> above.
8164 </para>
8165 <para>
8166 <indexterm role="concept">
8167 <primary>RCPT</primary>
8168 <secondary>ACL for</secondary>
8169 </indexterm>
8170 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8171 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8172 are considered in order, until the recipient address is either accepted or
8173 rejected. The RCPT command is then accepted or rejected, according to the
8174 result of the ACL processing.
8175 </para>
8176 <literallayout class="monospaced">
8177 acl_check_rcpt:
8178 </literallayout>
8179 <para>
8180 This line, consisting of a name terminated by a colon, marks the start of the
8181 ACL, and names it.
8182 </para>
8183 <literallayout class="monospaced">
8184 accept  hosts = :
8185 </literallayout>
8186 <para>
8187 This ACL statement accepts the recipient if the sending host matches the list.
8188 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8189 names or IP addresses. The presence of the colon puts an empty item in the
8190 list; Exim matches this only if the incoming message did not come from a remote
8191 host, because in that case, the remote hostname is empty. The colon is
8192 important. Without it, the list itself is empty, and can never match anything.
8193 </para>
8194 <para>
8195 What this statement is doing is to accept unconditionally all recipients in
8196 messages that are submitted by SMTP from local processes using the standard
8197 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8198 manner.
8199 </para>
8200 <literallayout class="monospaced">
8201 deny    message       = Restricted characters in address
8202         domains       = +local_domains
8203         local_parts   = ^[.] : ^.*[@%!/|]
8204
8205 deny    message       = Restricted characters in address
8206         domains       = !+local_domains
8207         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8208 </literallayout>
8209 <para>
8210 These statements are concerned with local parts that contain any of the
8211 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8212 Although these characters are entirely legal in local parts (in the case of
8213 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8214 in Internet mail addresses.
8215 </para>
8216 <para>
8217 The first three have in the past been associated with explicitly routed
8218 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8219 option). Addresses containing these characters are regularly tried by spammers
8220 in an attempt to bypass relaying restrictions, and also by open relay testing
8221 programs. Unless you really need them it is safest to reject these characters
8222 at this early stage. This configuration is heavy-handed in rejecting these
8223 characters for all messages it accepts from remote hosts. This is a deliberate
8224 policy of being as safe as possible.
8225 </para>
8226 <para>
8227 The first rule above is stricter, and is applied to messages that are addressed
8228 to one of the local domains handled by this host. This is implemented by the
8229 first condition, which restricts it to domains that are listed in the
8230 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8231 reference to a named list. In this configuration, there is just one domain in
8232 <emphasis>local_domains</emphasis>, but in general there may be many.
8233 </para>
8234 <para>
8235 The second condition on the first statement uses two regular expressions to
8236 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8237 or <quote>|</quote>. If you have local accounts that include these characters, you will
8238 have to modify this rule.
8239 </para>
8240 <para>
8241 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8242 allows them because they have been encountered in practice. (Consider the
8243 common convention of local parts constructed as
8244 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8245 the author of Exim, who has no second initial.) However, a local part starting
8246 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8247 file name (for example, for a mailing list). This is also true for local parts
8248 that contain slashes. A pipe symbol can also be troublesome if the local part
8249 is incorporated unthinkingly into a shell command line.
8250 </para>
8251 <para>
8252 The second rule above applies to all other domains, and is less strict. This
8253 allows your own users to send outgoing messages to sites that use slashes
8254 and vertical bars in their local parts. It blocks local parts that begin
8255 with a dot, slash, or vertical bar, but allows these characters within the
8256 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8257 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8258 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8259 </para>
8260 <literallayout class="monospaced">
8261 accept  local_parts   = postmaster
8262         domains       = +local_domains
8263 </literallayout>
8264 <para>
8265 This statement, which has two conditions, accepts an incoming address if the
8266 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8267 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8268 reference to a named list. In this configuration, there is just one domain in
8269 <emphasis>local_domains</emphasis>, but in general there may be many.
8270 </para>
8271 <para>
8272 The presence of this statement means that mail to postmaster is never blocked
8273 by any of the subsequent tests. This can be helpful while sorting out problems
8274 in cases where the subsequent tests are incorrectly denying access.
8275 </para>
8276 <literallayout class="monospaced">
8277 require verify        = sender
8278 </literallayout>
8279 <para>
8280 This statement requires the sender address to be verified before any subsequent
8281 ACL statement can be used. If verification fails, the incoming recipient
8282 address is refused. Verification consists of trying to route the address, to
8283 see if a bounce message could be delivered to it. In the case of remote
8284 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8285 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8286 discusses the details of address verification.
8287 </para>
8288 <literallayout class="monospaced">
8289 accept  hosts         = +relay_from_hosts
8290         control       = submission
8291 </literallayout>
8292 <para>
8293 This statement accepts the address if the message is coming from one of the
8294 hosts that are defined as being allowed to relay through this host. Recipient
8295 verification is omitted here, because in many cases the clients are dumb MUAs
8296 that do not cope well with SMTP error responses. For the same reason, the
8297 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8298 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8299 messages that are deficient in some way, for example, because they lack a
8300 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8301 probably add recipient verification here, and disable submission mode.
8302 </para>
8303 <literallayout class="monospaced">
8304 accept  authenticated = *
8305         control       = submission
8306 </literallayout>
8307 <para>
8308 This statement accepts the address if the client host has authenticated itself.
8309 Submission mode is again specified, on the grounds that such messages are most
8310 likely to come from MUAs. The default configuration does not define any
8311 authenticators, though it does include some nearly complete commented-out
8312 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8313 fact authenticate until you complete the authenticator definitions.
8314 </para>
8315 <literallayout class="monospaced">
8316 require message = relay not permitted
8317         domains = +local_domains : +relay_domains
8318 </literallayout>
8319 <para>
8320 This statement rejects the address if its domain is neither a local domain nor
8321 one of the domains for which this host is a relay.
8322 </para>
8323 <literallayout class="monospaced">
8324 require verify = recipient
8325 </literallayout>
8326 <para>
8327 This statement requires the recipient address to be verified; if verification
8328 fails, the address is rejected.
8329 </para>
8330 <literallayout class="monospaced">
8331 # deny    message     = rejected because $sender_host_address \
8332 #                       is in a black list at $dnslist_domain\n\
8333 #                       $dnslist_text
8334 #         dnslists    = black.list.example
8335 #
8336 # warn    dnslists    = black.list.example
8337 #         add_header  = X-Warning: $sender_host_address is in \
8338 #                       a black list at $dnslist_domain
8339 #         log_message = found in $dnslist_domain
8340 </literallayout>
8341 <para>
8342 These commented-out lines are examples of how you could configure Exim to check
8343 sending hosts against a DNS black list. The first statement rejects messages
8344 from blacklisted hosts, whereas the second just inserts a warning header
8345 line.
8346 </para>
8347 <literallayout class="monospaced">
8348 # require verify = csa
8349 </literallayout>
8350 <para>
8351 This commented-out line is an example of how you could turn on client SMTP
8352 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8353 records.
8354 </para>
8355 <literallayout class="monospaced">
8356 accept
8357 </literallayout>
8358 <para>
8359 The final statement in the first ACL unconditionally accepts any recipient
8360 address that has successfully passed all the previous tests.
8361 </para>
8362 <literallayout class="monospaced">
8363 acl_check_data:
8364 </literallayout>
8365 <para>
8366 This line marks the start of the second ACL, and names it. Most of the contents
8367 of this ACL are commented out:
8368 </para>
8369 <literallayout class="monospaced">
8370 # deny    malware   = *
8371 #         message   = This message contains a virus \
8372 #                     ($malware_name).
8373 </literallayout>
8374 <para>
8375 These lines are examples of how to arrange for messages to be scanned for
8376 viruses when Exim has been compiled with the content-scanning extension, and a
8377 suitable virus scanner is installed. If the message is found to contain a
8378 virus, it is rejected with the given custom error message.
8379 </para>
8380 <literallayout class="monospaced">
8381 # warn    spam      = nobody
8382 #         message   = X-Spam_score: $spam_score\n\
8383 #                     X-Spam_score_int: $spam_score_int\n\
8384 #                     X-Spam_bar: $spam_bar\n\
8385 #                     X-Spam_report: $spam_report
8386 </literallayout>
8387 <para>
8388 These lines are an example of how to arrange for messages to be scanned by
8389 SpamAssassin when Exim has been compiled with the content-scanning extension,
8390 and SpamAssassin has been installed. The SpamAssassin check is run with
8391 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8392 series of extra header line. In this case, the message is not rejected,
8393 whatever the spam score.
8394 </para>
8395 <literallayout class="monospaced">
8396 accept
8397 </literallayout>
8398 <para>
8399 This final line in the DATA ACL accepts the message unconditionally.
8400 </para>
8401 </section>
8402 <section>
8403 <title>Router configuration</title>
8404 <para>
8405 <indexterm role="concept">
8406 <primary>default</primary>
8407 <secondary>routers</secondary>
8408 </indexterm>
8409 <indexterm role="concept">
8410 <primary>routers</primary>
8411 <secondary>default</secondary>
8412 </indexterm>
8413 The router configuration comes next in the default configuration, introduced
8414 by the line
8415 </para>
8416 <literallayout class="monospaced">
8417 begin routers
8418 </literallayout>
8419 <para>
8420 Routers are the modules in Exim that make decisions about where to send
8421 messages. An address is passed to each router in turn, until it is either
8422 accepted, or failed. This means that the order in which you define the routers
8423 matters. Each router is fully described in its own chapter later in this
8424 manual. Here we give only brief overviews.
8425 </para>
8426 <literallayout class="monospaced">
8427 # domain_literal:
8428 #   driver = ipliteral
8429 #   domains = !+local_domains
8430 #   transport = remote_smtp
8431 </literallayout>
8432 <para>
8433 <indexterm role="concept">
8434 <primary>domain literal</primary>
8435 <secondary>default router</secondary>
8436 </indexterm>
8437 This router is commented out because the majority of sites do not want to
8438 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8439 you uncomment this router, you also need to uncomment the setting of
8440 <option>allow_domain_literals</option> in the main part of the configuration.
8441 </para>
8442 <literallayout class="monospaced">
8443 dnslookup:
8444   driver = dnslookup
8445   domains = ! +local_domains
8446   transport = remote_smtp
8447   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8448   no_more
8449 </literallayout>
8450 <para>
8451 The first uncommented router handles addresses that do not involve any local
8452 domains. This is specified by the line
8453 </para>
8454 <literallayout class="monospaced">
8455 domains = ! +local_domains
8456 </literallayout>
8457 <para>
8458 The <option>domains</option> option lists the domains to which this router applies, but the
8459 exclamation mark is a negation sign, so the router is used only for domains
8460 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8461 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8462 indicates that it is referring to a named list. Addresses in other domains are
8463 passed on to the following routers.
8464 </para>
8465 <para>
8466 The name of the router driver is <command>dnslookup</command>,
8467 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8468 the name of this router instance is the same as the name of the driver. The
8469 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8470 one of the driver modules that is in the Exim binary.
8471 </para>
8472 <para>
8473 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8474 DNS in order to obtain a list of hosts to which the address is routed. If the
8475 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8476 specified by the <option>transport</option> option. If the router does not find the domain
8477 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8478 the address fails and is bounced.
8479 </para>
8480 <para>
8481 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8482 be entirely ignored. This option is present because a number of cases have been
8483 encountered where MX records in the DNS point to host names
8484 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8485 Completely ignoring these IP addresses causes Exim to fail to route the
8486 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8487 continue to try to deliver the message periodically until the address timed
8488 out.
8489 </para>
8490 <literallayout class="monospaced">
8491 system_aliases:
8492   driver = redirect
8493   allow_fail
8494   allow_defer
8495   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8496 # user = exim
8497   file_transport = address_file
8498   pipe_transport = address_pipe
8499 </literallayout>
8500 <para>
8501 Control reaches this and subsequent routers only for addresses in the local
8502 domains. This router checks to see whether the local part is defined as an
8503 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8504 data that it looks up from that file. If no data is found for the local part,
8505 the value of the <option>data</option> option is empty, causing the address to be passed to
8506 the next router.
8507 </para>
8508 <para>
8509 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8510 often used. That is why it is referenced by from the default configuration
8511 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8512 <filename>Local/Makefile</filename> before building Exim.
8513 </para>
8514 <literallayout class="monospaced">
8515 userforward:
8516   driver = redirect
8517   check_local_user
8518 # local_part_suffix = +* : -*
8519 # local_part_suffix_optional
8520   file = $home/.forward
8521 # allow_filter
8522   no_verify
8523   no_expn
8524   check_ancestor
8525   file_transport = address_file
8526   pipe_transport = address_pipe
8527   reply_transport = address_reply
8528 </literallayout>
8529 <para>
8530 This is the most complicated router in the default configuration. It is another
8531 redirection router, but this time it is looking for forwarding data set up by
8532 individual users. The <option>check_local_user</option> setting specifies a check that the
8533 local part of the address is the login name of a local user. If it is not, the
8534 router is skipped. The two commented options that follow <option>check_local_user</option>,
8535 namely:
8536 </para>
8537 <literallayout class="monospaced">
8538 # local_part_suffix = +* : -*
8539 # local_part_suffix_optional
8540 </literallayout>
8541 <para>
8542 <indexterm role="concept">
8543 <primary><varname>$local_part_suffix</varname></primary>
8544 </indexterm>
8545 show how you can specify the recognition of local part suffixes. If the first
8546 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8547 by any sequence of characters, is removed from the local part and placed in the
8548 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8549 presence of a suffix in the local part is optional. When a suffix is present,
8550 the check for a local login uses the local part with the suffix removed.
8551 </para>
8552 <para>
8553 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8554 home directory is consulted. If it does not exist, or is empty, the router
8555 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8556 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8557 </para>
8558 <para>
8559 <indexterm role="concept">
8560 <primary>Sieve filter</primary>
8561 <secondary>enabling in default router</secondary>
8562 </indexterm>
8563 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8564 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8565 is commented out by default), the contents of the file are interpreted as a set
8566 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8567 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8568 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8569 </para>
8570 <para>
8571 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8572 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8573 There are two reasons for doing this:
8574 </para>
8575 <orderedlist numeration="arabic">
8576 <listitem>
8577 <para>
8578 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8579 checking an address for validity; it makes sense not to waste resources doing
8580 unnecessary work.
8581 </para>
8582 </listitem>
8583 <listitem>
8584 <para>
8585 More importantly, when Exim is verifying addresses or handling an EXPN
8586 command during an SMTP session, it is running as the Exim user, not as root.
8587 The group is the Exim group, and no additional groups are set up.
8588 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8589 this time.
8590 </para>
8591 </listitem>
8592 </orderedlist>
8593 <para>
8594 The setting of <option>check_ancestor</option> prevents the router from generating a new
8595 address that is the same as any previous address that was redirected. (This
8596 works round a problem concerning a bad interaction between aliasing and
8597 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8598 </para>
8599 <para>
8600 The final three option settings specify the transports that are to be used when
8601 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8602 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8603 </para>
8604 <literallayout class="monospaced">
8605 a.nother@elsewhere.example, /home/spqr/archive
8606 </literallayout>
8607 <para>
8608 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8609 transport.
8610 </para>
8611 <literallayout class="monospaced">
8612 localuser:
8613   driver = accept
8614   check_local_user
8615 # local_part_suffix = +* : -*
8616 # local_part_suffix_optional
8617   transport = local_delivery
8618 </literallayout>
8619 <para>
8620 The final router sets up delivery into local mailboxes, provided that the local
8621 part is the name of a local login, by accepting the address and assigning it to
8622 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8623 routers, so the address is bounced. The commented suffix settings fulfil the
8624 same purpose as they do for the <command>userforward</command> router.
8625 </para>
8626 </section>
8627 <section>
8628 <title>Transport configuration</title>
8629 <para>
8630 <indexterm role="concept">
8631 <primary>default</primary>
8632 <secondary>transports</secondary>
8633 </indexterm>
8634 <indexterm role="concept">
8635 <primary>transports</primary>
8636 <secondary>default</secondary>
8637 </indexterm>
8638 Transports define mechanisms for actually delivering messages. They operate
8639 only when referenced from routers, so the order in which they are defined does
8640 not matter. The transports section of the configuration starts with
8641 </para>
8642 <literallayout class="monospaced">
8643 begin transports
8644 </literallayout>
8645 <para>
8646 One remote transport and four local transports are defined.
8647 </para>
8648 <literallayout class="monospaced">
8649 remote_smtp:
8650   driver = smtp
8651 </literallayout>
8652 <para>
8653 This transport is used for delivering messages over SMTP connections. All its
8654 options are defaulted. The list of remote hosts comes from the router.
8655 </para>
8656 <literallayout class="monospaced">
8657 local_delivery:
8658   driver = appendfile
8659   file = /var/mail/$local_part
8660   delivery_date_add
8661   envelope_to_add
8662   return_path_add
8663 # group = mail
8664 # mode = 0660
8665 </literallayout>
8666 <para>
8667 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8668 traditional BSD mailbox format. By default it runs under the uid and gid of the
8669 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8670 directory. Some systems use the alternative approach of running mail deliveries
8671 under a particular group instead of using the sticky bit. The commented options
8672 show how this can be done.
8673 </para>
8674 <para>
8675 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8676 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8677 similarly-named options above.
8678 </para>
8679 <literallayout class="monospaced">
8680 address_pipe:
8681   driver = pipe
8682   return_output
8683 </literallayout>
8684 <para>
8685 This transport is used for handling deliveries to pipes that are generated by
8686 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8687 option specifies that any output generated by the pipe is to be returned to the
8688 sender.
8689 </para>
8690 <literallayout class="monospaced">
8691 address_file:
8692   driver = appendfile
8693   delivery_date_add
8694   envelope_to_add
8695   return_path_add
8696 </literallayout>
8697 <para>
8698 This transport is used for handling deliveries to files that are generated by
8699 redirection. The name of the file is not specified in this instance of
8700 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8701 </para>
8702 <literallayout class="monospaced">
8703 address_reply:
8704   driver = autoreply
8705 </literallayout>
8706 <para>
8707 This transport is used for handling automatic replies generated by users&#x2019;
8708 filter files.
8709 </para>
8710 </section>
8711 <section>
8712 <title>Default retry rule</title>
8713 <para>
8714 <indexterm role="concept">
8715 <primary>retry</primary>
8716 <secondary>default rule</secondary>
8717 </indexterm>
8718 <indexterm role="concept">
8719 <primary>default</primary>
8720 <secondary>retry rule</secondary>
8721 </indexterm>
8722 The retry section of the configuration file contains rules which affect the way
8723 Exim retries deliveries that cannot be completed at the first attempt. It is
8724 introduced by the line
8725 </para>
8726 <literallayout class="monospaced">
8727 begin retry
8728 </literallayout>
8729 <para>
8730 In the default configuration, there is just one rule, which applies to all
8731 errors:
8732 </para>
8733 <literallayout class="monospaced">
8734 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8735 </literallayout>
8736 <para>
8737 This causes any temporarily failing address to be retried every 15 minutes for
8738 2 hours, then at intervals starting at one hour and increasing by a factor of
8739 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8740 is not delivered after 4 days of temporary failure, it is bounced.
8741 </para>
8742 </section>
8743 <section>
8744 <title>Rewriting configuration</title>
8745 <para>
8746 The rewriting section of the configuration, introduced by
8747 </para>
8748 <literallayout class="monospaced">
8749 begin rewrite
8750 </literallayout>
8751 <para>
8752 contains rules for rewriting addresses in messages as they arrive. There are no
8753 rewriting rules in the default configuration file.
8754 </para>
8755 </section>
8756 <section id="SECTdefconfauth">
8757 <title>Authenticators configuration</title>
8758 <para>
8759 <indexterm role="concept">
8760 <primary>AUTH</primary>
8761 <secondary>configuration</secondary>
8762 </indexterm>
8763 The authenticators section of the configuration, introduced by
8764 </para>
8765 <literallayout class="monospaced">
8766 begin authenticators
8767 </literallayout>
8768 <para>
8769 defines mechanisms for the use of the SMTP AUTH command. The default
8770 configuration file contains two commented-out example authenticators
8771 which support plaintext username/password authentication using the
8772 standard PLAIN mechanism and the traditional but non-standard LOGIN
8773 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8774 to support most MUA software.
8775 </para>
8776 <para>
8777 The example PLAIN authenticator looks like this:
8778 </para>
8779 <literallayout class="monospaced">
8780 #PLAIN:
8781 #  driver                     = plaintext
8782 #  server_set_id              = $auth2
8783 #  server_prompts             = :
8784 #  server_condition           = Authentication is not yet configured
8785 #  server_advertise_condition = ${if def:tls_cipher }
8786 </literallayout>
8787 <para>
8788 And the example LOGIN authenticator looks like this:
8789 </para>
8790 <literallayout class="monospaced">
8791 #LOGIN:
8792 #  driver                     = plaintext
8793 #  server_set_id              = $auth1
8794 #  server_prompts             = &lt;| Username: | Password:
8795 #  server_condition           = Authentication is not yet configured
8796 #  server_advertise_condition = ${if def:tls_cipher }
8797 </literallayout>
8798 <para>
8799 The <option>server_set_id</option> option makes Exim remember the authenticated username
8800 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8801 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8802 that it implements the details of the specific authentication mechanism,
8803 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8804 when Exim offers authentication to clients; in the examples, this is only
8805 when TLS or SSL has been started, so to enable the authenticators you also
8806 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8807 </para>
8808 <para>
8809 The <option>server_condition</option> setting defines how to verify that the username and
8810 password are correct. In the examples it just produces an error message.
8811 To make the authenticators work, you can use a string expansion
8812 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8813 </para>
8814 <para>
8815 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8816 </para>
8817 </section>
8818 </chapter>
8819
8820 <chapter id="CHAPregexp">
8821 <title>Regular expressions</title>
8822 <para>
8823 <indexterm role="concept">
8824 <primary>regular expressions</primary>
8825 <secondary>library</secondary>
8826 </indexterm>
8827 <indexterm role="concept">
8828 <primary>PCRE</primary>
8829 </indexterm>
8830 Exim supports the use of regular expressions in many of its options. It
8831 uses the PCRE regular expression library; this provides regular expression
8832 matching that is compatible with Perl 5. The syntax and semantics of
8833 regular expressions is discussed in many Perl reference books, and also in
8834 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8835 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8836 </para>
8837 <para>
8838 The documentation for the syntax and semantics of the regular expressions that
8839 are supported by PCRE is included in plain text in the file
8840 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8841 tarbundle of Exim documentation. It describes in detail the features of the
8842 regular expressions that PCRE supports, so no further description is included
8843 here. The PCRE functions are called from Exim using the default option settings
8844 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8845 set when the matching is required to be case-insensitive.
8846 </para>
8847 <para>
8848 In most cases, when a regular expression is required in an Exim configuration,
8849 it has to start with a circumflex, in order to distinguish it from plain text
8850 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8851 second item in the colon-separated list is a regular expression.
8852 </para>
8853 <literallayout class="monospaced">
8854 domains = a.b.c : ^\\d{3} : *.y.z : ...
8855 </literallayout>
8856 <para>
8857 The doubling of the backslash is required because of string expansion that
8858 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8859 of this issue, and a way of avoiding the need for doubling backslashes. The
8860 regular expression that is eventually used in this example contains just one
8861 backslash. The circumflex is included in the regular expression, and has the
8862 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8863 matched.
8864 </para>
8865 <para>
8866 There are, however, two cases where a circumflex is not required for the
8867 recognition of a regular expression: these are the <option>match</option> condition in a
8868 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8869 these cases, the relevant string is always treated as a regular expression; if
8870 it does not start with a circumflex, the expression is not anchored, and can
8871 match anywhere in the subject string.
8872 </para>
8873 <para>
8874 In all cases, if you want a regular expression to match at the end of a string,
8875 you must code the $ metacharacter to indicate this. For example:
8876 </para>
8877 <literallayout class="monospaced">
8878 domains = ^\\d{3}\\.example
8879 </literallayout>
8880 <para>
8881 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8882 You need to use:
8883 </para>
8884 <literallayout class="monospaced">
8885 domains = ^\\d{3}\\.example\$
8886 </literallayout>
8887 <para>
8888 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8889 $ is needed because string expansion also interprets dollar characters.
8890 </para>
8891 <section>
8892 <title>Testing regular expressions</title>
8893 <para>
8894 <indexterm role="concept">
8895 <primary>testing</primary>
8896 <secondary>regular expressions</secondary>
8897 </indexterm>
8898 <indexterm role="concept">
8899 <primary>regular expressions</primary>
8900 <secondary>testing</secondary>
8901 </indexterm>
8902 <indexterm role="concept">
8903 <primary><emphasis>pcretest</emphasis></primary>
8904 </indexterm>
8905 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8906 with PCRE during the process of building Exim. It is primarily intended for
8907 testing PCRE itself, but it can also be used for experimenting with regular
8908 expressions. After building Exim, the binary can be found in the build
8909 directory (it is not installed anywhere automatically). There is documentation
8910 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8911 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8912 </para>
8913 <literallayout>
8914 <literal>  re&gt; </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8915 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8916 <literal> 0: x@y.ac.uk</literal>
8917 <literal> 1: x</literal>
8918 <literal> 2: ac</literal>
8919 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8920 <literal>No match</literal>
8921 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8922 <literal>No match</literal>
8923 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8924 <literal> 0: x@y.edu.co</literal>
8925 <literal> 1: x</literal>
8926 <literal> 2: edu</literal>
8927 </literallayout>
8928 <para>
8929 Input typed by the user is shown in bold face. After the <quote>re&gt;</quote> prompt, a
8930 regular expression enclosed in delimiters is expected. If this compiles without
8931 error, <quote>data&gt;</quote> prompts are given for strings against which the expression is
8932 matched. An empty data line causes a new regular expression to be read. If the
8933 match is successful, the captured substring values (that is, what would be in
8934 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8935 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8936 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8937 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8938 </para>
8939 </section>
8940 </chapter>
8941
8942 <chapter id="CHAPfdlookup">
8943 <title>File and database lookups</title>
8944 <para>
8945 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8946 <primary>file</primary>
8947 <secondary>lookups</secondary>
8948 </indexterm>
8949 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8950 <primary>database lookups</primary>
8951 </indexterm>
8952 <indexterm role="concept">
8953 <primary>lookup</primary>
8954 <secondary>description of</secondary>
8955 </indexterm>
8956 Exim can be configured to look up data in files or databases as it processes
8957 messages. Two different kinds of syntax are used:
8958 </para>
8959 <orderedlist numeration="arabic">
8960 <listitem>
8961 <para>
8962 A string that is to be expanded may contain explicit lookup requests. These
8963 cause parts of the string to be replaced by data that is obtained from the
8964 lookup. Lookups of this type are conditional expansion items. Different results
8965 can be defined for the cases of lookup success and failure. See chapter
8966 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8967 </para>
8968 </listitem>
8969 <listitem>
8970 <para>
8971 Lists of domains, hosts, and email addresses can contain lookup requests as a
8972 way of avoiding excessively long linear lists. In this case, the data that is
8973 returned by the lookup is often (but not always) discarded; whether the lookup
8974 succeeds or fails is what really counts. These kinds of list are described in
8975 chapter <xref linkend="CHAPdomhosaddlists"/>.
8976 </para>
8977 </listitem>
8978 </orderedlist>
8979 <para>
8980 String expansions, lists, and lookups interact with each other in such a way
8981 that there is no order in which to describe any one of them that does not
8982 involve references to the others. Each of these three chapters makes more sense
8983 if you have read the other two first. If you are reading this for the first
8984 time, be aware that some of it will make a lot more sense after you have read
8985 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8986 </para>
8987 <section>
8988 <title>Examples of different lookup syntax</title>
8989 <para>
8990 It is easy to confuse the two different kinds of lookup, especially as the
8991 lists that may contain the second kind are always expanded before being
8992 processed as lists. Therefore, they may also contain lookups of the first kind.
8993 Be careful to distinguish between the following two examples:
8994 </para>
8995 <literallayout class="monospaced">
8996 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8997 domains = lsearch;/some/file
8998 </literallayout>
8999 <para>
9000 The first uses a string expansion, the result of which must be a domain list.
9001 No strings have been specified for a successful or a failing lookup; the
9002 defaults in this case are the looked-up data and an empty string, respectively.
9003 The expansion takes place before the string is processed as a list, and the
9004 file that is searched could contain lines like this:
9005 </para>
9006 <literallayout class="monospaced">
9007 192.168.3.4: domain1:domain2:...
9008 192.168.1.9: domain3:domain4:...
9009 </literallayout>
9010 <para>
9011 When the lookup succeeds, the result of the expansion is a list of domains (and
9012 possibly other types of item that are allowed in domain lists).
9013 </para>
9014 <para>
9015 In the second example, the lookup is a single item in a domain list. It causes
9016 Exim to use a lookup to see if the domain that is being processed can be found
9017 in the file. The file could contains lines like this:
9018 </para>
9019 <literallayout class="monospaced">
9020 domain1:
9021 domain2:
9022 </literallayout>
9023 <para>
9024 Any data that follows the keys is not relevant when checking that the domain
9025 matches the list item.
9026 </para>
9027 <para>
9028 It is possible, though no doubt confusing, to use both kinds of lookup at once.
9029 Consider a file containing lines like this:
9030 </para>
9031 <literallayout class="monospaced">
9032 192.168.5.6: lsearch;/another/file
9033 </literallayout>
9034 <para>
9035 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
9036 first <option>domains</option> setting above generates the second setting, which therefore
9037 causes a second lookup to occur.
9038 </para>
9039 <para>
9040 The rest of this chapter describes the different lookup types that are
9041 available. Any of them can be used in any part of the configuration where a
9042 lookup is permitted.
9043 </para>
9044 </section>
9045 <section>
9046 <title>Lookup types</title>
9047 <para>
9048 <indexterm role="concept">
9049 <primary>lookup</primary>
9050 <secondary>types of</secondary>
9051 </indexterm>
9052 <indexterm role="concept">
9053 <primary>single-key lookup</primary>
9054 <secondary>definition of</secondary>
9055 </indexterm>
9056 Two different types of data lookup are implemented:
9057 </para>
9058 <itemizedlist>
9059 <listitem>
9060 <para>
9061 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
9062 and a single key to search for. The key must be a non-empty string for the
9063 lookup to succeed. The lookup type determines how the file is searched.
9064 </para>
9065 </listitem>
9066 <listitem>
9067 <para>
9068 <indexterm role="concept">
9069 <primary>query-style lookup</primary>
9070 <secondary>definition of</secondary>
9071 </indexterm>
9072 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
9073 key value is assumed by Exim for query-style lookups. You can use whichever
9074 Exim variables you need to construct the database query.
9075 </para>
9076 </listitem>
9077 </itemizedlist>
9078 <para>
9079 The code for each lookup type is in a separate source file that is included in
9080 the binary of Exim only if the corresponding compile-time option is set. The
9081 default settings in <filename>src/EDITME</filename> are:
9082 </para>
9083 <literallayout class="monospaced">
9084 LOOKUP_DBM=yes
9085 LOOKUP_LSEARCH=yes
9086 </literallayout>
9087 <para>
9088 which means that only linear searching and DBM lookups are included by default.
9089 For some types of lookup (e.g. SQL databases), you need to install appropriate
9090 libraries and header files before building Exim.
9091 </para>
9092 </section>
9093 <section id="SECTsinglekeylookups">
9094 <title>Single-key lookup types</title>
9095 <para>
9096 <indexterm role="concept">
9097 <primary>lookup</primary>
9098 <secondary>single-key types</secondary>
9099 </indexterm>
9100 <indexterm role="concept">
9101 <primary>single-key lookup</primary>
9102 <secondary>list of types</secondary>
9103 </indexterm>
9104 The following single-key lookup types are implemented:
9105 </para>
9106 <itemizedlist>
9107 <listitem>
9108 <para>
9109 <indexterm role="concept">
9110 <primary>cdb</primary>
9111 <secondary>description of</secondary>
9112 </indexterm>
9113 <indexterm role="concept">
9114 <primary>lookup</primary>
9115 <secondary>cdb</secondary>
9116 </indexterm>
9117 <indexterm role="concept">
9118 <primary>binary zero</primary>
9119 <secondary>in lookup key</secondary>
9120 </indexterm>
9121 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9122 string without a terminating binary zero. The cdb format is designed for
9123 indexed files that are read frequently and never updated, except by total
9124 re-creation. As such, it is particulary suitable for large files containing
9125 aliases or other indexed data referenced by an MTA. Information about cdb can
9126 be found in several places:
9127 </para>
9128 <literallayout>
9129 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9130 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9131 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9132 </literallayout>
9133 <para>
9134 A cdb distribution is not needed in order to build Exim with cdb support,
9135 because the code for reading cdb files is included directly in Exim itself.
9136 However, no means of building or testing cdb files is provided with Exim, so
9137 you need to obtain a cdb distribution in order to do this.
9138 </para>
9139 </listitem>
9140 <listitem>
9141 <para>
9142 <indexterm role="concept">
9143 <primary>DBM</primary>
9144 <secondary>lookup type</secondary>
9145 </indexterm>
9146 <indexterm role="concept">
9147 <primary>lookup</primary>
9148 <secondary>dbm</secondary>
9149 </indexterm>
9150 <indexterm role="concept">
9151 <primary>binary zero</primary>
9152 <secondary>in lookup key</secondary>
9153 </indexterm>
9154 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9155 DBM file by looking up the record with the given key. A terminating binary
9156 zero is included in the key that is passed to the DBM library. See section
9157 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9158 </para>
9159 <para>
9160 <indexterm role="concept">
9161 <primary>Berkeley DB library</primary>
9162 <secondary>file format</secondary>
9163 </indexterm>
9164 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9165 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9166 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9167 the DB_UNKNOWN option. This enables it to handle any of the types of database
9168 that the library supports, and can be useful for accessing DBM files created by
9169 other applications. (For earlier DB versions, DB_HASH is always used.)
9170 </para>
9171 </listitem>
9172 <listitem>
9173 <para>
9174 <indexterm role="concept">
9175 <primary>lookup</primary>
9176 <secondary>dbmnz</secondary>
9177 </indexterm>
9178 <indexterm role="concept">
9179 <primary>lookup</primary>
9180 <secondary>dbm &ndash; terminating zero</secondary>
9181 </indexterm>
9182 <indexterm role="concept">
9183 <primary>binary zero</primary>
9184 <secondary>in lookup key</secondary>
9185 </indexterm>
9186 <indexterm role="concept">
9187 <primary>Courier</primary>
9188 </indexterm>
9189 <indexterm role="concept">
9190 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9191 </indexterm>
9192 <indexterm role="concept">
9193 <primary>dmbnz lookup type</primary>
9194 </indexterm>
9195 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9196 is not included in the key that is passed to the DBM library. You may need this
9197 if you want to look up data in files that are created by or shared with some
9198 other application that does not use terminating zeros. For example, you need to
9199 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9200 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9201 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9202 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9203 </para>
9204 </listitem>
9205 <listitem>
9206 <para>
9207 <indexterm role="concept">
9208 <primary>lookup</primary>
9209 <secondary>dsearch</secondary>
9210 </indexterm>
9211 <indexterm role="concept">
9212 <primary>dsearch lookup type</primary>
9213 </indexterm>
9214 <command>dsearch</command>: The given file must be a directory; this is searched for a file
9215 whose name is the key. The key may not contain any forward slash characters.
9216 The result of a successful lookup is the name of the file. An example of how
9217 this lookup can be used to support virtual domains is given in section
9218 <xref linkend="SECTvirtualdomains"/>.
9219 </para>
9220 </listitem>
9221 <listitem>
9222 <para>
9223 <indexterm role="concept">
9224 <primary>lookup</primary>
9225 <secondary>iplsearch</secondary>
9226 </indexterm>
9227 <indexterm role="concept">
9228 <primary>iplsearch lookup type</primary>
9229 </indexterm>
9230 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9231 terminated by a colon or white space or the end of the line. The keys in the
9232 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9233 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9234 being interpreted as a key terminator. For example:
9235 </para>
9236 <literallayout class="monospaced">
9237 1.2.3.4:           data for 1.2.3.4
9238 192.168.0.0/16     data for 192.168.0.0/16
9239 "abcd::cdab":      data for abcd::cdab
9240 "abcd:abcd::/32"   data for abcd:abcd::/32
9241 </literallayout>
9242 <para>
9243 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9244 file is searched linearly, using the CIDR masks where present, until a matching
9245 key is found. The first key that matches is used; there is no attempt to find a
9246 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9247 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9248 </para>
9249 <para>
9250 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9251 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9252 lookup types support only literal keys.
9253 </para>
9254 <para>
9255 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9256 the implicit key is the host&#x2019;s IP address rather than its name (see section
9257 <xref linkend="SECThoslispatsikey"/>).
9258 </para>
9259 </listitem>
9260 <listitem>
9261 <para>
9262 <indexterm role="concept">
9263 <primary>linear search</primary>
9264 </indexterm>
9265 <indexterm role="concept">
9266 <primary>lookup</primary>
9267 <secondary>lsearch</secondary>
9268 </indexterm>
9269 <indexterm role="concept">
9270 <primary>lsearch lookup type</primary>
9271 </indexterm>
9272 <indexterm role="concept">
9273 <primary>case sensitivity</primary>
9274 <secondary>in lsearch lookup</secondary>
9275 </indexterm>
9276 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9277 line beginning with the search key, terminated by a colon or white space or the
9278 end of the line. The search is case-insensitive; that is, upper and lower case
9279 letters are treated as the same. The first occurrence of the key that is found
9280 in the file is used.
9281 </para>
9282 <para>
9283 White space between the key and the colon is permitted. The remainder of the
9284 line, with leading and trailing white space removed, is the data. This can be
9285 continued onto subsequent lines by starting them with any amount of white
9286 space, but only a single space character is included in the data at such a
9287 junction. If the data begins with a colon, the key must be terminated by a
9288 colon, for example:
9289 </para>
9290 <literallayout class="monospaced">
9291 baduser:  :fail:
9292 </literallayout>
9293 <para>
9294 Empty lines and lines beginning with # are ignored, even if they occur in the
9295 middle of an item. This is the traditional textual format of alias files. Note
9296 that the keys in an <command>lsearch</command> file are literal strings. There is no
9297 wildcarding of any kind.
9298 </para>
9299 <para>
9300 <indexterm role="concept">
9301 <primary>lookup</primary>
9302 <secondary>lsearch &ndash; colons in keys</secondary>
9303 </indexterm>
9304 <indexterm role="concept">
9305 <primary>white space</primary>
9306 <secondary>in lsearch key</secondary>
9307 </indexterm>
9308 In most <command>lsearch</command> files, keys are not required to contain colons or #
9309 characters, or white space. However, if you need this feature, it is available.
9310 If a key begins with a doublequote character, it is terminated only by a
9311 matching quote (or end of line), and the normal escaping rules apply to its
9312 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9313 quoted keys (exactly as for unquoted keys). There is no special handling of
9314 quotes for the data part of an <command>lsearch</command> line.
9315 </para>
9316 </listitem>
9317 <listitem>
9318 <para>
9319 <indexterm role="concept">
9320 <primary>NIS lookup type</primary>
9321 </indexterm>
9322 <indexterm role="concept">
9323 <primary>lookup</primary>
9324 <secondary>NIS</secondary>
9325 </indexterm>
9326 <indexterm role="concept">
9327 <primary>binary zero</primary>
9328 <secondary>in lookup key</secondary>
9329 </indexterm>
9330 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9331 the given key, without a terminating binary zero. There is a variant called
9332 <command>nis0</command> which does include the terminating binary zero in the key. This is
9333 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9334 aliases; the full map names must be used.
9335 </para>
9336 </listitem>
9337 <listitem>
9338 <para>
9339 <indexterm role="concept">
9340 <primary>wildlsearch lookup type</primary>
9341 </indexterm>
9342 <indexterm role="concept">
9343 <primary>lookup</primary>
9344 <secondary>wildlsearch</secondary>
9345 </indexterm>
9346 <indexterm role="concept">
9347 <primary>nwildlsearch lookup type</primary>
9348 </indexterm>
9349 <indexterm role="concept">
9350 <primary>lookup</primary>
9351 <secondary>nwildlsearch</secondary>
9352 </indexterm>
9353 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9354 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9355 the file may be wildcarded. The difference between these two lookup types is
9356 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9357 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9358 </para>
9359 <para>
9360 <indexterm role="concept">
9361 <primary>case sensitivity</primary>
9362 <secondary>in (n)wildlsearch lookup</secondary>
9363 </indexterm>
9364 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9365 file that are regular expressions can be made case-sensitive by the use of
9366 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9367 </para>
9368 <orderedlist numeration="arabic">
9369 <listitem>
9370 <para>
9371 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9372 </para>
9373 <literallayout class="monospaced">
9374     *.a.b.c       data for anything.a.b.c
9375     *fish         data for anythingfish
9376 </literallayout>
9377 </listitem>
9378 <listitem>
9379 <para>
9380 The string may begin with a circumflex to indicate a regular expression. For
9381 example, for <command>wildlsearch</command>:
9382 </para>
9383 <literallayout class="monospaced">
9384     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9385 </literallayout>
9386 <para>
9387 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9388 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9389 string-expanded, the equivalent entry is:
9390 </para>
9391 <literallayout class="monospaced">
9392     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9393 </literallayout>
9394 <para>
9395 The case-insensitive flag is set at the start of compiling the regular
9396 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9397 For example, to make the entire pattern case-sensitive:
9398 </para>
9399 <literallayout class="monospaced">
9400     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9401 </literallayout>
9402 <para>
9403 If the regular expression contains white space or colon characters, you must
9404 either quote it (see <command>lsearch</command> above), or represent these characters in other
9405 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9406 colon. This may be easier than quoting, because if you quote, you have to
9407 escape all the backslashes inside the quotes.
9408 </para>
9409 <para>
9410 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9411 match for later use, because the results of all lookups are cached. If a lookup
9412 is repeated, the result is taken from the cache, and no actual pattern matching
9413 takes place. The values of all the numeric variables are unset after a
9414 <command>(n)wildlsearch</command> match.
9415 </para>
9416 </listitem>
9417 <listitem>
9418 <para>
9419 Although I cannot see it being of much use, the general matching function that
9420 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9421 lookup name terminated by a semicolon, and followed by lookup data. For
9422 example:
9423 </para>
9424 <literallayout class="monospaced">
9425     cdb;/some/file  data for keys that match the file
9426 </literallayout>
9427 <para>
9428 The data that is obtained from the nested lookup is discarded.
9429 </para>
9430 </listitem>
9431 </orderedlist>
9432 <para>
9433 Keys that do not match any of these patterns are interpreted literally. The
9434 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9435 be followed by optional colons.
9436 </para>
9437 <para>
9438 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9439 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9440 lookup types support only literal keys.
9441 </para>
9442 </listitem>
9443 </itemizedlist>
9444 </section>
9445 <section>
9446 <title>Query-style lookup types</title>
9447 <para>
9448 <indexterm role="concept">
9449 <primary>lookup</primary>
9450 <secondary>query-style types</secondary>
9451 </indexterm>
9452 <indexterm role="concept">
9453 <primary>query-style lookup</primary>
9454 <secondary>list of types</secondary>
9455 </indexterm>
9456 The supported query-style lookup types are listed below. Further details about
9457 many of them are given in later sections.
9458 </para>
9459 <itemizedlist>
9460 <listitem>
9461 <para>
9462 <indexterm role="concept">
9463 <primary>DNS</primary>
9464 <secondary>as a lookup type</secondary>
9465 </indexterm>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>DNS</secondary>
9469 </indexterm>
9470 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9471 are given in the supplied query. The resulting data is the contents of the
9472 records. See section <xref linkend="SECTdnsdb"/>.
9473 </para>
9474 </listitem>
9475 <listitem>
9476 <para>
9477 <indexterm role="concept">
9478 <primary>InterBase lookup type</primary>
9479 </indexterm>
9480 <indexterm role="concept">
9481 <primary>lookup</primary>
9482 <secondary>InterBase</secondary>
9483 </indexterm>
9484 <command>ibase</command>: This does a lookup in an InterBase database.
9485 </para>
9486 </listitem>
9487 <listitem>
9488 <para>
9489 <indexterm role="concept">
9490 <primary>LDAP</primary>
9491 <secondary>lookup type</secondary>
9492 </indexterm>
9493 <indexterm role="concept">
9494 <primary>lookup</primary>
9495 <secondary>LDAP</secondary>
9496 </indexterm>
9497 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9498 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9499 that permits values from multiple entries to be returned. A third variant
9500 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9501 any attribute values. See section <xref linkend="SECTldap"/>.
9502 </para>
9503 </listitem>
9504 <listitem>
9505 <para>
9506 <indexterm role="concept">
9507 <primary>MySQL</primary>
9508 <secondary>lookup type</secondary>
9509 </indexterm>
9510 <indexterm role="concept">
9511 <primary>lookup</primary>
9512 <secondary>MySQL</secondary>
9513 </indexterm>
9514 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9515 MySQL database. See section <xref linkend="SECTsql"/>.
9516 </para>
9517 </listitem>
9518 <listitem>
9519 <para>
9520 <indexterm role="concept">
9521 <primary>NIS+ lookup type</primary>
9522 </indexterm>
9523 <indexterm role="concept">
9524 <primary>lookup</primary>
9525 <secondary>NIS+</secondary>
9526 </indexterm>
9527 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9528 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9529 </para>
9530 </listitem>
9531 <listitem>
9532 <para>
9533 <indexterm role="concept">
9534 <primary>Oracle</primary>
9535 <secondary>lookup type</secondary>
9536 </indexterm>
9537 <indexterm role="concept">
9538 <primary>lookup</primary>
9539 <secondary>Oracle</secondary>
9540 </indexterm>
9541 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9542 Oracle database. See section <xref linkend="SECTsql"/>.
9543 </para>
9544 </listitem>
9545 <listitem>
9546 <para>
9547 <indexterm role="concept">
9548 <primary>lookup</primary>
9549 <secondary>passwd</secondary>
9550 </indexterm>
9551 <indexterm role="concept">
9552 <primary>passwd lookup type</primary>
9553 </indexterm>
9554 <indexterm role="concept">
9555 <primary><filename>/etc/passwd</filename></primary>
9556 </indexterm>
9557 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9558 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9559 success, the result string is the same as you would get from an <command>lsearch</command>
9560 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9561 password value. For example:
9562 </para>
9563 <literallayout class="monospaced">
9564 *:42:42:King Rat:/home/kr:/bin/bash
9565 </literallayout>
9566 </listitem>
9567 <listitem>
9568 <para>
9569 <indexterm role="concept">
9570 <primary>PostgreSQL lookup type</primary>
9571 </indexterm>
9572 <indexterm role="concept">
9573 <primary>lookup</primary>
9574 <secondary>PostgreSQL</secondary>
9575 </indexterm>
9576 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9577 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9578 </para>
9579 </listitem>
9580 <listitem>
9581 <para>
9582 <indexterm role="concept">
9583 <primary>sqlite lookup type</primary>
9584 </indexterm>
9585 <indexterm role="concept">
9586 <primary>lookup</primary>
9587 <secondary>sqlite</secondary>
9588 </indexterm>
9589 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9590 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9591 </para>
9592 </listitem>
9593 <listitem>
9594 <para>
9595 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9596 not likely to be useful in normal operation.
9597 </para>
9598 </listitem>
9599 <listitem>
9600 <para>
9601 <indexterm role="concept">
9602 <primary>whoson lookup type</primary>
9603 </indexterm>
9604 <indexterm role="concept">
9605 <primary>lookup</primary>
9606 <secondary>whoson</secondary>
9607 </indexterm>
9608 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a proposed
9609 Internet protocol that allows Internet server programs to check whether a
9610 particular (dynamically allocated) IP address is currently allocated to a known
9611 (trusted) user and, optionally, to obtain the identity of the said user. In
9612 Exim, this can be used to implement <quote>POP before SMTP</quote> checking using ACL
9613 statements such as
9614 </para>
9615 <literallayout class="monospaced">
9616 require condition = \
9617   ${lookup whoson {$sender_host_address}{yes}{no}}
9618 </literallayout>
9619 <para>
9620 The query consists of a single IP address. The value returned is the name of
9621 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9622 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9623 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9624 </para>
9625 </listitem>
9626 </itemizedlist>
9627 </section>
9628 <section>
9629 <title>Temporary errors in lookups</title>
9630 <para>
9631 <indexterm role="concept">
9632 <primary>lookup</primary>
9633 <secondary>temporary error in</secondary>
9634 </indexterm>
9635 Lookup functions can return temporary error codes if the lookup cannot be
9636 completed. For example, an SQL or LDAP database might be unavailable. For this
9637 reason, it is not advisable to use a lookup that might do this for critical
9638 options such as a list of local domains.
9639 </para>
9640 <para>
9641 When a lookup cannot be completed in a router or transport, delivery
9642 of the message (to the relevant address) is deferred, as for any other
9643 temporary error. In other circumstances Exim may assume the lookup has failed,
9644 or may give up altogether.
9645 </para>
9646 </section>
9647 <section id="SECTdefaultvaluelookups">
9648 <title>Default values in single-key lookups</title>
9649 <para>
9650 <indexterm role="concept">
9651 <primary>wildcard lookups</primary>
9652 </indexterm>
9653 <indexterm role="concept">
9654 <primary>lookup</primary>
9655 <secondary>default values</secondary>
9656 </indexterm>
9657 <indexterm role="concept">
9658 <primary>lookup</primary>
9659 <secondary>wildcard</secondary>
9660 </indexterm>
9661 <indexterm role="concept">
9662 <primary>lookup</primary>
9663 <secondary>* added to type</secondary>
9664 </indexterm>
9665 <indexterm role="concept">
9666 <primary>default</primary>
9667 <secondary>in single-key lookups</secondary>
9668 </indexterm>
9669 In this context, a <quote>default value</quote> is a value specified by the administrator
9670 that is to be used if a lookup fails.
9671 </para>
9672 <para revisionflag="changed">
9673 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
9674 lookups, the facilities of the query language must be used. An attempt to
9675 specify a default for a query-style lookup provokes an error.
9676 </para>
9677 <para>
9678 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9679 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9680 provide a default value. See also the section on partial matching below.
9681 </para>
9682 <para>
9683 <indexterm role="concept">
9684 <primary>*@ with single-key lookup</primary>
9685 </indexterm>
9686 <indexterm role="concept">
9687 <primary>lookup</primary>
9688 <secondary>*@ added to type</secondary>
9689 </indexterm>
9690 <indexterm role="concept">
9691 <primary>alias file</primary>
9692 <secondary>per-domain default</secondary>
9693 </indexterm>
9694 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9695 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9696 character, a second lookup is done with everything before the last @ replaced
9697 by *. This makes it possible to provide per-domain defaults in alias files
9698 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9699 take place because there is no @ in the key), <quote>*</quote> is looked up.
9700 For example, a <command>redirect</command> router might contain:
9701 </para>
9702 <literallayout class="monospaced">
9703 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9704 </literallayout>
9705 <para>
9706 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9707 looks up these keys, in this order:
9708 </para>
9709 <literallayout class="monospaced">
9710 jane@eyre.example
9711 *@eyre.example
9712 *
9713 </literallayout>
9714 <para>
9715 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9716 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9717 complete scan is done for each key, and only if it is not found at all does
9718 Exim move on to try the next key.
9719 </para>
9720 </section>
9721 <section id="SECTpartiallookup">
9722 <title>Partial matching in single-key lookups</title>
9723 <para>
9724 <indexterm role="concept">
9725 <primary>partial matching</primary>
9726 </indexterm>
9727 <indexterm role="concept">
9728 <primary>wildcard lookups</primary>
9729 </indexterm>
9730 <indexterm role="concept">
9731 <primary>lookup</primary>
9732 <secondary>partial matching</secondary>
9733 </indexterm>
9734 <indexterm role="concept">
9735 <primary>lookup</primary>
9736 <secondary>wildcard</secondary>
9737 </indexterm>
9738 <indexterm role="concept">
9739 <primary>asterisk</primary>
9740 <secondary>in search type</secondary>
9741 </indexterm>
9742 The normal operation of a single-key lookup is to search the file for an exact
9743 match with the given key. However, in a number of situations where domains are
9744 being looked up, it is useful to be able to do partial matching. In this case,
9745 information in the file that has a key starting with <quote>*.</quote> is matched by any
9746 domain that ends with the components that follow the full stop. For example, if
9747 a key in a DBM file is
9748 </para>
9749 <literallayout class="monospaced">
9750 *.dates.fict.example
9751 </literallayout>
9752 <para>
9753 then when partial matching is enabled this is matched by (amongst others)
9754 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9755 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9756 file.
9757 </para>
9758 <para>
9759 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9760 also not available for any lookup items in address lists (see section
9761 <xref linkend="SECTaddresslist"/>).
9762 </para>
9763 <para>
9764 Partial matching is implemented by doing a series of separate lookups using
9765 keys constructed by modifying the original subject key. This means that it can
9766 be used with any of the single-key lookup types, provided that
9767 partial matching keys
9768 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9769 Keys in the file that do not begin with the prefix are matched only by
9770 unmodified subject keys when partial matching is in use.
9771 </para>
9772 <para>
9773 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9774 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9775 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9776 is added at the start of the subject key, and it is looked up again. If that
9777 fails, further lookups are tried with dot-separated components removed from the
9778 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9779 remains.
9780 </para>
9781 <para>
9782 A minimum number of two non-* components are required. This can be adjusted
9783 by including a number before the hyphen in the search type. For example,
9784 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9785 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9786 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9787 up when the minimum number of non-* components is two:
9788 </para>
9789 <literallayout class="monospaced">
9790 2250.dates.fict.example
9791 *.2250.dates.fict.example
9792 *.dates.fict.example
9793 *.fict.example
9794 </literallayout>
9795 <para>
9796 As soon as one key in the sequence is successfully looked up, the lookup
9797 finishes.
9798 </para>
9799 <para>
9800 <indexterm role="concept">
9801 <primary>lookup</primary>
9802 <secondary>partial matching &ndash; changing prefix</secondary>
9803 </indexterm>
9804 <indexterm role="concept">
9805 <primary>prefix</primary>
9806 <secondary>for partial matching</secondary>
9807 </indexterm>
9808 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9809 changed. The motivation for this feature is to allow Exim to operate with file
9810 formats that are used by other MTAs. A different prefix can be supplied in
9811 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9812 </para>
9813 <literallayout class="monospaced">
9814 domains = partial(.)lsearch;/some/file
9815 </literallayout>
9816 <para>
9817 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9818 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9819 components is unchanged). The prefix may consist of any punctuation characters
9820 other than a closing parenthesis. It may be empty, for example:
9821 </para>
9822 <literallayout class="monospaced">
9823 domains = partial1()cdb;/some/file
9824 </literallayout>
9825 <para>
9826 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9827 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9828 </para>
9829 <para>
9830 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9831 just one non-wild component has failed, and the original key is shortened right
9832 down to the null string) depends on the prefix:
9833 </para>
9834 <itemizedlist>
9835 <listitem>
9836 <para>
9837 If the prefix has zero length, the whole lookup fails.
9838 </para>
9839 </listitem>
9840 <listitem>
9841 <para>
9842 If the prefix has length 1, a lookup for just the prefix is done. For
9843 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9844 </para>
9845 </listitem>
9846 <listitem>
9847 <para>
9848 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9849 remainder is looked up. With the default prefix, therefore, the final lookup is
9850 for <quote>*</quote> on its own.
9851 </para>
9852 </listitem>
9853 <listitem>
9854 <para>
9855 Otherwise, the whole prefix is looked up.
9856 </para>
9857 </listitem>
9858 </itemizedlist>
9859 <para>
9860 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9861 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9862 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9863 specified, adding <quote>*</quote> to the search type has no effect with the default
9864 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9865 lookups. However, there might be a use for lookup types such as
9866 <quote>partial0(.)lsearch*</quote>.
9867 </para>
9868 <para>
9869 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9870 in domain lists and the like. Partial matching works only in terms of
9871 dot-separated components; a key such as <literal>*fict.example</literal>
9872 in a database file is useless, because the asterisk in a partial matching
9873 subject key is always followed by a dot.
9874 </para>
9875 </section>
9876 <section>
9877 <title>Lookup caching</title>
9878 <para>
9879 <indexterm role="concept">
9880 <primary>lookup</primary>
9881 <secondary>caching</secondary>
9882 </indexterm>
9883 <indexterm role="concept">
9884 <primary>caching</primary>
9885 <secondary>lookup data</secondary>
9886 </indexterm>
9887 Exim caches all lookup results in order to avoid needless repetition of
9888 lookups. However, because (apart from the daemon) Exim operates as a collection
9889 of independent, short-lived processes, this caching applies only within a
9890 single Exim process. There is no inter-process lookup caching facility.
9891 </para>
9892 <para>
9893 For single-key lookups, Exim keeps the relevant files open in case there is
9894 another lookup that needs them. In some types of configuration this can lead to
9895 many files being kept open for messages with many recipients. To avoid hitting
9896 the operating system limit on the number of simultaneously open files, Exim
9897 closes the least recently used file when it needs to open more files than its
9898 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9899 </para>
9900 <para>
9901 The single-key lookup files are closed and the lookup caches are flushed at
9902 strategic points during delivery &ndash; for example, after all routing is
9903 complete.
9904 </para>
9905 </section>
9906 <section>
9907 <title>Quoting lookup data</title>
9908 <para>
9909 <indexterm role="concept">
9910 <primary>lookup</primary>
9911 <secondary>quoting</secondary>
9912 </indexterm>
9913 <indexterm role="concept">
9914 <primary>quoting</primary>
9915 <secondary>in lookups</secondary>
9916 </indexterm>
9917 When data from an incoming message is included in a query-style lookup, there
9918 is the possibility of special characters in the data messing up the syntax of
9919 the query. For example, a NIS+ query that contains
9920 </para>
9921 <literallayout class="monospaced">
9922 [name=$local_part]
9923 </literallayout>
9924 <para>
9925 will be broken if the local part happens to contain a closing square bracket.
9926 For NIS+, data can be enclosed in double quotes like this:
9927 </para>
9928 <literallayout class="monospaced">
9929 [name="$local_part"]
9930 </literallayout>
9931 <para>
9932 but this still leaves the problem of a double quote in the data. The rule for
9933 NIS+ is that double quotes must be doubled. Other lookup types have different
9934 rules, and to cope with the differing requirements, an expansion operator
9935 of the following form is provided:
9936 </para>
9937 <literallayout class="monospaced">
9938 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9939 </literallayout>
9940 <para>
9941 For example, the safest way to write the NIS+ query is
9942 </para>
9943 <literallayout class="monospaced">
9944 [name="${quote_nisplus:$local_part}"]
9945 </literallayout>
9946 <para>
9947 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9948 operator can be used for all lookup types, but has no effect for single-key
9949 lookups, since no quoting is ever needed in their key strings.
9950 </para>
9951 </section>
9952 <section id="SECTdnsdb">
9953 <title>More about dnsdb</title>
9954 <para>
9955 <indexterm role="concept">
9956 <primary>dnsdb lookup</primary>
9957 </indexterm>
9958 <indexterm role="concept">
9959 <primary>lookup</primary>
9960 <secondary>dnsdb</secondary>
9961 </indexterm>
9962 <indexterm role="concept">
9963 <primary>DNS</primary>
9964 <secondary>as a lookup type</secondary>
9965 </indexterm>
9966 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9967 of a record type and a domain name, separated by an equals sign. For example,
9968 an expansion string could contain:
9969 </para>
9970 <literallayout class="monospaced">
9971 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9972 </literallayout>
9973 <para>
9974 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9975 is used on its own as the result. If the lookup does not succeed, the
9976 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
9977 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9978 </para>
9979 <para>
9980 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9981 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9982 configured). If no type is given, TXT is assumed. When the type is PTR,
9983 the data can be an IP address, written as normal; inversion and the addition of
9984 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9985 </para>
9986 <literallayout class="monospaced">
9987 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9988 </literallayout>
9989 <para>
9990 If the data for a PTR record is not a syntactically valid IP address, it is not
9991 altered and nothing is added.
9992 </para>
9993 <para>
9994 <indexterm role="concept">
9995 <primary>MX record</primary>
9996 <secondary>in <command>dnsdb</command> lookup</secondary>
9997 </indexterm>
9998 <indexterm role="concept">
9999 <primary>SRV record</primary>
10000 <secondary>in <command>dnsdb</command> lookup</secondary>
10001 </indexterm>
10002 For an MX lookup, both the preference value and the host name are returned for
10003 each record, separated by a space. For an SRV lookup, the priority, weight,
10004 port, and host name are returned for each record, separated by spaces.
10005 </para>
10006 <para>
10007 For any record type, if multiple records are found (or, for A6 lookups, if a
10008 single record leads to multiple addresses), the data is returned as a
10009 concatenation, with newline as the default separator. The order, of course,
10010 depends on the DNS resolver. You can specify a different separator character
10011 between multiple records by putting a right angle-bracket followed immediately
10012 by the new separator at the start of the query. For example:
10013 </para>
10014 <literallayout class="monospaced">
10015 ${lookup dnsdb{&gt;: a=host1.example}}
10016 </literallayout>
10017 <para>
10018 It is permitted to specify a space as the separator character. Further
10019 white space is ignored.
10020 </para>
10021 </section>
10022 <section>
10023 <title>Pseudo dnsdb record types</title>
10024 <para>
10025 <indexterm role="concept">
10026 <primary>MX record</primary>
10027 <secondary>in <command>dnsdb</command> lookup</secondary>
10028 </indexterm>
10029 By default, both the preference value and the host name are returned for
10030 each MX record, separated by a space. If you want only host names, you can use
10031 the pseudo-type MXH:
10032 </para>
10033 <literallayout class="monospaced">
10034 ${lookup dnsdb{mxh=a.b.example}}
10035 </literallayout>
10036 <para>
10037 In this case, the preference values are omitted, and just the host names are
10038 returned.
10039 </para>
10040 <para>
10041 <indexterm role="concept">
10042 <primary>name server</primary>
10043 <secondary>for enclosing domain</secondary>
10044 </indexterm>
10045 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
10046 records on the given domain, but if none are found, it removes the first
10047 component of the domain name, and tries again. This process continues until NS
10048 records are found or there are no more components left (or there is a DNS
10049 error). In other words, it may return the name servers for a top-level domain,
10050 but it never returns the root name servers. If there are no NS records for the
10051 top-level domain, the lookup fails. Consider these examples:
10052 </para>
10053 <literallayout class="monospaced">
10054 ${lookup dnsdb{zns=xxx.quercite.com}}
10055 ${lookup dnsdb{zns=xxx.edu}}
10056 </literallayout>
10057 <para>
10058 Assuming that in each case there are no NS records for the full domain name,
10059 the first returns the name servers for <option>quercite.com</option>, and the second returns
10060 the name servers for <option>edu</option>.
10061 </para>
10062 <para>
10063 You should be careful about how you use this lookup because, unless the
10064 top-level domain does not exist, the lookup always returns some host names. The
10065 sort of use to which this might be put is for seeing if the name servers for a
10066 given domain are on a blacklist. You can probably assume that the name servers
10067 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
10068 such a list.
10069 </para>
10070 <para>
10071 <indexterm role="concept">
10072 <primary>CSA</primary>
10073 <secondary>in <command>dnsdb</command> lookup</secondary>
10074 </indexterm>
10075 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
10076 records according to the CSA rules, which are described in section
10077 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
10078 not sufficient because of the extra parent domain search behaviour of CSA. The
10079 result of a successful lookup such as:
10080 </para>
10081 <literallayout class="monospaced">
10082 ${lookup dnsdb {csa=$sender_helo_name}}
10083 </literallayout>
10084 <para>
10085 has two space-separated fields: an authorization code and a target host name.
10086 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10087 authorization required but absent, or <quote>?</quote> for unknown.
10088 </para>
10089 </section>
10090 <section>
10091 <title>Multiple dnsdb lookups</title>
10092 <para>
10093 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10094 However, you can specify a list of domains or IP addresses in a single
10095 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10096 the default separator, but with the ability to change this. For example:
10097 </para>
10098 <literallayout class="monospaced">
10099 ${lookup dnsdb{one.domain.com:two.domain.com}}
10100 ${lookup dnsdb{a=one.host.com:two.host.com}}
10101 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10102 </literallayout>
10103 <para>
10104 In order to retain backwards compatibility, there is one special case: if
10105 the lookup type is PTR and no change of separator is specified, Exim looks
10106 to see if the rest of the string is precisely one IPv6 address. In this
10107 case, it does not treat it as a list.
10108 </para>
10109 <para>
10110 The data from each lookup is concatenated, with newline separators by default,
10111 in the same way that multiple DNS records for a single item are handled. A
10112 different separator can be specified, as described above.
10113 </para>
10114 <para>
10115 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10116 temporary DNS error for any of them, the behaviour is controlled by
10117 an optional keyword followed by a comma that may appear before the record
10118 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10119 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10120 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10121 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10122 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10123 error causes the whole lookup to defer only if none of the other lookups
10124 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10125 </para>
10126 <literallayout class="monospaced">
10127 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10128 ${lookup dnsdb{a=one.host.com:two.host.com}}
10129 </literallayout>
10130 <para>
10131 Thus, in the default case, as long as at least one of the DNS lookups
10132 yields some data, the lookup succeeds.
10133 </para>
10134 </section>
10135 <section id="SECTldap">
10136 <title>More about LDAP</title>
10137 <para>
10138 <indexterm role="concept">
10139 <primary>LDAP lookup</primary>
10140 </indexterm>
10141 <indexterm role="concept">
10142 <primary>lookup</primary>
10143 <secondary>LDAP</secondary>
10144 </indexterm>
10145 <indexterm role="concept">
10146 <primary>Solaris</primary>
10147 <secondary>LDAP</secondary>
10148 </indexterm>
10149 The original LDAP implementation came from the University of Michigan; this has
10150 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10151 implementation comes from Netscape, and Solaris 7 and subsequent releases
10152 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10153 the lookup function level, their error handling is different. For this reason
10154 it is necessary to set a compile-time variable when building Exim with LDAP, to
10155 indicate which LDAP library is in use. One of the following should appear in
10156 your <filename>Local/Makefile</filename>:
10157 </para>
10158 <literallayout class="monospaced">
10159 LDAP_LIB_TYPE=UMICHIGAN
10160 LDAP_LIB_TYPE=OPENLDAP1
10161 LDAP_LIB_TYPE=OPENLDAP2
10162 LDAP_LIB_TYPE=NETSCAPE
10163 LDAP_LIB_TYPE=SOLARIS
10164 </literallayout>
10165 <para>
10166 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10167 same interface as the University of Michigan version.
10168 </para>
10169 <para>
10170 There are three LDAP lookup types in Exim. These behave slightly differently in
10171 the way they handle the results of a query:
10172 </para>
10173 <itemizedlist>
10174 <listitem>
10175 <para>
10176 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10177 gives an error.
10178 </para>
10179 </listitem>
10180 <listitem>
10181 <para>
10182 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10183 Distinguished Name that is returned rather than any attribute values.
10184 </para>
10185 </listitem>
10186 <listitem>
10187 <para>
10188 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10189 from all of them are returned.
10190 </para>
10191 </listitem>
10192 </itemizedlist>
10193 <para>
10194 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10195 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10196 the data returned by a successful lookup is described in the next section.
10197 First we explain how LDAP queries are coded.
10198 </para>
10199 </section>
10200 <section id="SECTforldaque">
10201 <title>Format of LDAP queries</title>
10202 <para>
10203 <indexterm role="concept">
10204 <primary>LDAP</primary>
10205 <secondary>query format</secondary>
10206 </indexterm>
10207 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10208 the configuration of a <command>redirect</command> router one might have this setting:
10209 </para>
10210 <literallayout class="monospaced">
10211 data = ${lookup ldap \
10212   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10213   c=UK?mailbox?base?}}
10214 </literallayout>
10215 <para>
10216 <indexterm role="concept">
10217 <primary>LDAP</primary>
10218 <secondary>with TLS</secondary>
10219 </indexterm>
10220 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10221 secure (encrypted) LDAP connections. The second of these ensures that an
10222 encrypted TLS connection is used.
10223 </para>
10224 </section>
10225 <section>
10226 <title>LDAP quoting</title>
10227 <para>
10228 <indexterm role="concept">
10229 <primary>LDAP</primary>
10230 <secondary>quoting</secondary>
10231 </indexterm>
10232 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10233 and the second because the LDAP query is represented as a URL. Furthermore,
10234 within an LDAP query, two different kinds of quoting are required. For this
10235 reason, there are two different LDAP-specific quoting operators.
10236 </para>
10237 <para>
10238 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10239 filter specifications. Conceptually, it first does the following conversions on
10240 the string:
10241 </para>
10242 <literallayout class="monospaced">
10243 *   =&gt;   \2A
10244 (   =&gt;   \28
10245 )   =&gt;   \29
10246 \   =&gt;   \5C
10247 </literallayout>
10248 <para>
10249 in accordance with RFC 2254. The resulting string is then quoted according
10250 to the rules for URLs, that is, all non-alphanumeric characters except
10251 </para>
10252 <literallayout class="monospaced">
10253 ! $ ' - . _ ( ) * +
10254 </literallayout>
10255 <para>
10256 are converted to their hex values, preceded by a percent sign. For example:
10257 </para>
10258 <literallayout class="monospaced">
10259 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10260 </literallayout>
10261 <para>
10262 yields
10263 </para>
10264 <literallayout class="monospaced">
10265 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10266 </literallayout>
10267 <para>
10268 Removing the URL quoting, this is (with a leading and a trailing space):
10269 </para>
10270 <literallayout class="monospaced">
10271 a\28bc\29\2A, a&lt;yz&gt;;
10272 </literallayout>
10273 <para>
10274 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10275 base DN specifications in queries. Conceptually, it first converts the string
10276 by inserting a backslash in front of any of the following characters:
10277 </para>
10278 <literallayout class="monospaced">
10279 , + " \ &lt; &gt; ;
10280 </literallayout>
10281 <para>
10282 It also inserts a backslash before any leading spaces or # characters, and
10283 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10284 is then quoted according to the rules for URLs. For example:
10285 </para>
10286 <literallayout class="monospaced">
10287 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10288 </literallayout>
10289 <para>
10290 yields
10291 </para>
10292 <literallayout class="monospaced">
10293 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10294 </literallayout>
10295 <para>
10296 Removing the URL quoting, this is (with a trailing space):
10297 </para>
10298 <literallayout class="monospaced">
10299 \ a(bc)*\, a\&lt;yz\&gt;\;\
10300 </literallayout>
10301 <para>
10302 There are some further comments about quoting in the section on LDAP
10303 authentication below.
10304 </para>
10305 </section>
10306 <section>
10307 <title>LDAP connections</title>
10308 <para>
10309 <indexterm role="concept">
10310 <primary>LDAP</primary>
10311 <secondary>connections</secondary>
10312 </indexterm>
10313 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10314 is in use, via a Unix domain socket. The example given above does not specify
10315 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10316 by starting it with
10317 </para>
10318 <literallayout class="monospaced">
10319 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10320 </literallayout>
10321 <para>
10322 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10323 used. When no server is specified in a query, a list of default servers is
10324 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10325 colon-separated list of servers which are tried in turn until one successfully
10326 handles a query, or there is a serious error. Successful handling either
10327 returns the requested data, or indicates that it does not exist. Serious errors
10328 are syntactical, or multiple values when only a single value is expected.
10329 Errors which cause the next server to be tried are connection failures, bind
10330 failures, and timeouts.
10331 </para>
10332 <para>
10333 For each server name in the list, a port number can be given. The standard way
10334 of specifing a host and port is to use a colon separator (RFC 1738). Because
10335 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10336 doubled. For example
10337 </para>
10338 <literallayout class="monospaced">
10339 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10340 </literallayout>
10341 <para>
10342 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10343 to the LDAP library with no server name, and the library&#x2019;s default (normally
10344 the local host) is used.
10345 </para>
10346 <para>
10347 If you are using the OpenLDAP library, you can connect to an LDAP server using
10348 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10349 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10350 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10351 not available.
10352 </para>
10353 <para>
10354 For this type of connection, instead of a host name for the server, a pathname
10355 for the socket is required, and the port number is not relevant. The pathname
10356 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10357 the query. In the former case, you can have settings such as
10358 </para>
10359 <literallayout class="monospaced">
10360 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10361 </literallayout>
10362 <para>
10363 When the pathname is given in the query, you have to escape the slashes as
10364 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10365 </para>
10366 <literallayout class="monospaced">
10367 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10368 </literallayout>
10369 <para>
10370 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10371 a pathname, it uses the Unix domain socket code, even if the query actually
10372 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10373 socket connection. This behaviour means that you can use a setting of
10374 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10375 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10376 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10377 backup host.
10378 </para>
10379 <para>
10380 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10381 specified, an error is diagnosed. However, if there are more items in
10382 <option>ldap_default_servers</option>, they are tried. In other words:
10383 </para>
10384 <itemizedlist>
10385 <listitem>
10386 <para>
10387 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10388 interface.
10389 </para>
10390 </listitem>
10391 <listitem>
10392 <para>
10393 Using <literal>ldapi</literal> with a host name causes an error.
10394 </para>
10395 </listitem>
10396 </itemizedlist>
10397 <para>
10398 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10399 <option>ldap_default_servers</option>, does whatever the library does by default.
10400 </para>
10401 </section>
10402 <section>
10403 <title>LDAP authentication and control information</title>
10404 <para>
10405 <indexterm role="concept">
10406 <primary>LDAP</primary>
10407 <secondary>authentication</secondary>
10408 </indexterm>
10409 The LDAP URL syntax provides no way of passing authentication and other control
10410 information to the server. To make this possible, the URL in an LDAP query may
10411 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10412 spaces. If a value contains spaces it must be enclosed in double quotes, and
10413 when double quotes are used, backslash is interpreted in the usual way inside
10414 them. The following names are recognized:
10415 </para>
10416 <literallayout>
10417 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10418 <literal>NETTIME    </literal>  set a timeout for a network operation
10419 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10420 <literal>PASS       </literal>  set the password, likewise
10421 <literal>REFERRALS  </literal>  set the referrals parameter
10422 <literal>SIZE       </literal>  set the limit for the number of entries returned
10423 <literal>TIME       </literal>  set the maximum waiting time for a query
10424 </literallayout>
10425 <para>
10426 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10427 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10428 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10429 library from trying to follow referrals issued by the LDAP server.
10430 </para>
10431 <para>
10432 The name CONNECT is an obsolete name for NETTIME, retained for
10433 backwards compatibility. This timeout (specified as a number of seconds) is
10434 enforced from the client end for operations that can be carried out over a
10435 network. Specifically, it applies to network connections and calls to the
10436 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10437 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10438 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10439 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10440 Netscape SDK; for OpenLDAP no action is taken.
10441 </para>
10442 <para>
10443 The TIME parameter (also a number of seconds) is passed to the server to
10444 set a server-side limit on the time taken to complete a search.
10445 </para>
10446 <para>
10447 Here is an example of an LDAP query in an Exim lookup that uses some of these
10448 values. This is a single line, folded to fit on the page:
10449 </para>
10450 <literallayout class="monospaced">
10451 ${lookup ldap
10452   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10453   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10454   {$value}fail}
10455 </literallayout>
10456 <para>
10457 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10458 any of the auxiliary data. Exim configuration settings that include lookups
10459 which contain password information should be preceded by <quote>hide</quote> to prevent
10460 non-admin users from using the <option>-bP</option> option to see their values.
10461 </para>
10462 <para>
10463 The auxiliary data items may be given in any order. The default is no
10464 connection timeout (the system timeout is used), no user or password, no limit
10465 on the number of entries returned, and no time limit on queries.
10466 </para>
10467 <para>
10468 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10469 removes any URL quoting that it may contain before passing it LDAP. Apparently
10470 some libraries do this for themselves, but some do not. Removing the URL
10471 quoting has two advantages:
10472 </para>
10473 <itemizedlist>
10474 <listitem>
10475 <para>
10476 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10477 DNs as with DNs inside actual queries.
10478 </para>
10479 </listitem>
10480 <listitem>
10481 <para>
10482 It permits spaces inside USER= DNs.
10483 </para>
10484 </listitem>
10485 </itemizedlist>
10486 <para>
10487 For example, a setting such as
10488 </para>
10489 <literallayout class="monospaced">
10490 USER=cn=${quote_ldap_dn:$1}
10491 </literallayout>
10492 <para>
10493 should work even if <varname>$1</varname> contains spaces.
10494 </para>
10495 <para>
10496 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10497 expansion operator, rather than the LDAP quote operators. The only reason this
10498 field needs quoting is to ensure that it conforms to the Exim syntax, which
10499 does not allow unquoted spaces. For example:
10500 </para>
10501 <literallayout class="monospaced">
10502 PASS=${quote:$3}
10503 </literallayout>
10504 <para>
10505 The LDAP authentication mechanism can be used to check passwords as part of
10506 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10507 <xref linkend="CHAPexpand"/>.
10508 </para>
10509 </section>
10510 <section>
10511 <title>Format of data returned by LDAP</title>
10512 <para>
10513 <indexterm role="concept">
10514 <primary>LDAP</primary>
10515 <secondary>returned data formats</secondary>
10516 </indexterm>
10517 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10518 as a sequence of values, for example
10519 </para>
10520 <literallayout class="monospaced">
10521 cn=manager, o=University of Cambridge, c=UK
10522 </literallayout>
10523 <para>
10524 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10525 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10526 the result between the data from different entries. It is possible for multiple
10527 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10528 you know that whatever values are returned all came from a single entry in the
10529 directory.
10530 </para>
10531 <para>
10532 In the common case where you specify a single attribute in your LDAP query, the
10533 result is not quoted, and does not contain the attribute name. If the attribute
10534 has multiple values, they are separated by commas.
10535 </para>
10536 <para>
10537 If you specify multiple attributes, the result contains space-separated, quoted
10538 strings, each preceded by the attribute name and an equals sign. Within the
10539 quotes, the quote character, backslash, and newline are escaped with
10540 backslashes, and commas are used to separate multiple values for the attribute.
10541 Apart from the escaping, the string within quotes takes the same form as the
10542 output when a single attribute is requested. Specifying no attributes is the
10543 same as specifying all of an entry&#x2019;s attributes.
10544 </para>
10545 <para>
10546 Here are some examples of the output format. The first line of each pair is an
10547 LDAP query, and the second is the data that is returned. The attribute called
10548 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10549 </para>
10550 <literallayout class="monospaced">
10551 ldap:///o=base?attr1?sub?(uid=fred)
10552 value1.1, value1.2
10553
10554 ldap:///o=base?attr2?sub?(uid=fred)
10555 value two
10556
10557 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10558 attr1="value1.1, value1.2" attr2="value two"
10559
10560 ldap:///o=base??sub?(uid=fred)
10561 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10562 </literallayout>
10563 <para>
10564 The <option>extract</option> operator in string expansions can be used to pick out
10565 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10566 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10567 results of LDAP lookups.
10568 </para>
10569 </section>
10570 <section id="SECTnisplus">
10571 <title>More about NIS+</title>
10572 <para>
10573 <indexterm role="concept">
10574 <primary>NIS+ lookup type</primary>
10575 </indexterm>
10576 <indexterm role="concept">
10577 <primary>lookup</primary>
10578 <secondary>NIS+</secondary>
10579 </indexterm>
10580 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10581 and field name. If this is given, the result of a successful query is the
10582 contents of the named field; otherwise the result consists of a concatenation
10583 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10584 values containing spaces are quoted. For example, the query
10585 </para>
10586 <literallayout class="monospaced">
10587 [name=mg1456],passwd.org_dir
10588 </literallayout>
10589 <para>
10590 might return the string
10591 </para>
10592 <literallayout class="monospaced">
10593 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10594 home=/home/mg1456 shell=/bin/bash shadow=""
10595 </literallayout>
10596 <para>
10597 (split over two lines here to fit on the page), whereas
10598 </para>
10599 <literallayout class="monospaced">
10600 [name=mg1456],passwd.org_dir:gcos
10601 </literallayout>
10602 <para>
10603 would just return
10604 </para>
10605 <literallayout class="monospaced">
10606 Martin Guerre
10607 </literallayout>
10608 <para>
10609 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10610 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10611 operator is to double any quote characters within the text.
10612 </para>
10613 </section>
10614 <section id="SECTsql">
10615 <title>SQL lookups</title>
10616 <para>
10617 <indexterm role="concept">
10618 <primary>SQL lookup types</primary>
10619 </indexterm>
10620 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10621 databases. Queries for these databases contain SQL statements, so an example
10622 might be
10623 </para>
10624 <literallayout class="monospaced">
10625 ${lookup mysql{select mailbox from users where id='userx'}\
10626   {$value}fail}
10627 </literallayout>
10628 <para>
10629 If the result of the query contains more than one field, the data for each
10630 field in the row is returned, preceded by its name, so the result of
10631 </para>
10632 <literallayout class="monospaced">
10633 ${lookup pgsql{select home,name from users where id='userx'}\
10634   {$value}}
10635 </literallayout>
10636 <para>
10637 might be
10638 </para>
10639 <literallayout class="monospaced">
10640 home=/home/userx name="Mister X"
10641 </literallayout>
10642 <para>
10643 Empty values and values containing spaces are double quoted, with embedded
10644 quotes escaped by a backslash. If the result of the query contains just one
10645 field, the value is passed back verbatim, without a field name, for example:
10646 </para>
10647 <literallayout class="monospaced">
10648 Mister X
10649 </literallayout>
10650 <para>
10651 If the result of the query yields more than one row, it is all concatenated,
10652 with a newline between the data for each row.
10653 </para>
10654 </section>
10655 <section>
10656 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10657 <para>
10658 <indexterm role="concept">
10659 <primary>MySQL</primary>
10660 <secondary>lookup type</secondary>
10661 </indexterm>
10662 <indexterm role="concept">
10663 <primary>PostgreSQL lookup type</primary>
10664 </indexterm>
10665 <indexterm role="concept">
10666 <primary>lookup</primary>
10667 <secondary>MySQL</secondary>
10668 </indexterm>
10669 <indexterm role="concept">
10670 <primary>lookup</primary>
10671 <secondary>PostgreSQL</secondary>
10672 </indexterm>
10673 <indexterm role="concept">
10674 <primary>Oracle</primary>
10675 <secondary>lookup type</secondary>
10676 </indexterm>
10677 <indexterm role="concept">
10678 <primary>lookup</primary>
10679 <secondary>Oracle</secondary>
10680 </indexterm>
10681 <indexterm role="concept">
10682 <primary>InterBase lookup type</primary>
10683 </indexterm>
10684 <indexterm role="concept">
10685 <primary>lookup</primary>
10686 <secondary>InterBase</secondary>
10687 </indexterm>
10688 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10689 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10690 option (as appropriate) must be set to a colon-separated list of server
10691 information. Each item in the list is a slash-separated list of four items:
10692 host name, database name, user name, and password. In the case of Oracle, the
10693 host name field is used for the <quote>service name</quote>, and the database name field
10694 is not used and should be empty. For example:
10695 </para>
10696 <literallayout class="monospaced">
10697 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10698 </literallayout>
10699 <para>
10700 Because password data is sensitive, you should always precede the setting with
10701 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10702 option. Here is an example where two MySQL servers are listed:
10703 </para>
10704 <literallayout class="monospaced">
10705 hide mysql_servers = localhost/users/root/secret:\
10706                      otherhost/users/root/othersecret
10707 </literallayout>
10708 <para>
10709 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10710 because this is a colon-separated list, the colon has to be doubled. For each
10711 query, these parameter groups are tried in order until a connection and a query
10712 succeeds.
10713 </para>
10714 <para>
10715 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10716 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10717 respectively, and the characters single-quote, double-quote, and backslash
10718 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10719 addition, escapes the percent and underscore characters. This cannot be done
10720 for MySQL because these escapes are not recognized in contexts where these
10721 characters are not special.
10722 </para>
10723 </section>
10724 <section>
10725 <title>Special MySQL features</title>
10726 <para>
10727 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10728 causes a connection to the server on the local host by means of a Unix domain
10729 socket. An alternate socket can be specified in parentheses. The full syntax of
10730 each item in <option>mysql_servers</option> is:
10731 </para>
10732 <literallayout>
10733 &lt;<emphasis>hostname</emphasis>&gt;::&lt;<emphasis>port</emphasis>&gt;(&lt;<emphasis>socket name</emphasis>&gt;)/&lt;<emphasis>database</emphasis>&gt;/&lt;<emphasis>user</emphasis>&gt;/&lt;<emphasis>password</emphasis>&gt;
10734 </literallayout>
10735 <para>
10736 Any of the three sub-parts of the first field can be omitted. For normal use on
10737 the local host it can be left blank or set to just <quote>localhost</quote>.
10738 </para>
10739 <para>
10740 No database need be supplied &ndash; but if it is absent here, it must be given in
10741 the queries.
10742 </para>
10743 <para>
10744 If a MySQL query is issued that does not request any data (an insert, update,
10745 or delete command), the result of the lookup is the number of rows affected.
10746 </para>
10747 <para>
10748 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10749 anything (for example, setting a field to the value it already has), the result
10750 is zero because no rows are affected.
10751 </para>
10752 </section>
10753 <section>
10754 <title>Special PostgreSQL features</title>
10755 <para>
10756 PostgreSQL lookups can also use Unix domain socket connections to the database.
10757 This is usually faster and costs less CPU time than a TCP/IP connection.
10758 However it can be used only if the mail server runs on the same machine as the
10759 database server. A configuration line for PostgreSQL via Unix domain sockets
10760 looks like this:
10761 </para>
10762 <literallayout class="monospaced">
10763 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10764 </literallayout>
10765 <para>
10766 In other words, instead of supplying a host name, a path to the socket is
10767 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10768 visually confused with the delimiters for the other server parameters.
10769 </para>
10770 <para>
10771 If a PostgreSQL query is issued that does not request any data (an insert,
10772 update, or delete command), the result of the lookup is the number of rows
10773 affected.
10774 </para>
10775 </section>
10776 <section id="SECTsqlite">
10777 <title>More about SQLite</title>
10778 <para>
10779 <indexterm role="concept">
10780 <primary>lookup</primary>
10781 <secondary>SQLite</secondary>
10782 </indexterm>
10783 <indexterm role="concept">
10784 <primary>SQLite lookup type</primary>
10785 </indexterm>
10786 SQLite is different to the other SQL lookups because a file name is required in
10787 addition to the SQL query. An SQLite database is a single file, and there is no
10788 daemon as in the other SQL databases. The interface to Exim requires the name
10789 of the file, as an absolute path, to be given at the start of the query. It is
10790 separated from the query by white space. This means that the path name cannot
10791 contain white space. Here is a lookup expansion example:
10792 </para>
10793 <literallayout class="monospaced">
10794 ${lookup sqlite {/some/thing/sqlitedb \
10795   select name from aliases where id='userx';}}
10796 </literallayout>
10797 <para>
10798 In a list, the syntax is similar. For example:
10799 </para>
10800 <literallayout class="monospaced">
10801 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10802    select * from relays where ip='$sender_host_address';
10803 </literallayout>
10804 <para>
10805 The only character affected by the <option>quote_sqlite</option> operator is a single
10806 quote, which it doubles.
10807 </para>
10808 <para>
10809 The SQLite library handles multiple simultaneous accesses to the database
10810 internally. Multiple readers are permitted, but only one process can
10811 update at once. Attempts to access the database while it is being updated
10812 are rejected after a timeout period, during which the SQLite library
10813 waits for the lock to be released. In Exim, the default timeout is set
10814 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10815 option.
10816 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10817 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10818 </para>
10819 </section>
10820 </chapter>
10821
10822 <chapter id="CHAPdomhosaddlists">
10823 <title>Domain, host, address, and local part lists</title>
10824 <titleabbrev>Domain, host, and address lists</titleabbrev>
10825 <para>
10826 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10827 <primary>lists of domains; hosts; etc.</primary>
10828 </indexterm>
10829 A number of Exim configuration options contain lists of domains, hosts,
10830 email addresses, or local parts. For example, the <option>hold_domains</option> option
10831 contains a list of domains whose delivery is currently suspended. These lists
10832 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10833 arguments to expansion conditions such as <option>match_domain</option>.
10834 </para>
10835 <para>
10836 Each item in one of these lists is a pattern to be matched against a domain,
10837 host, email address, or local part, respectively. In the sections below, the
10838 different types of pattern for each case are described, but first we cover some
10839 general facilities that apply to all four kinds of list.
10840 </para>
10841 <section>
10842 <title>Expansion of lists</title>
10843 <para>
10844 <indexterm role="concept">
10845 <primary>expansion</primary>
10846 <secondary>of lists</secondary>
10847 </indexterm>
10848 Each list is expanded as a single string before it is used. The result of
10849 expansion must be a list, possibly containing empty items, which is split up
10850 into separate items for matching. By default, colon is the separator character,
10851 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10852 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10853 discusses the way to specify empty list items.
10854 </para>
10855 <para>
10856 If the string expansion is forced to fail, Exim behaves as if the item it is
10857 testing (domain, host, address, or local part) is not in the list. Other
10858 expansion failures cause temporary errors.
10859 </para>
10860 <para>
10861 If an item in a list is a regular expression, backslashes, dollars and possibly
10862 other special characters in the expression must be protected against
10863 misinterpretation by the string expander. The easiest way to do this is to use
10864 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10865 expression should not be expanded. For example, in an ACL you might have:
10866 </para>
10867 <literallayout class="monospaced">
10868 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10869                ${lookup{$domain}lsearch{/badsenders/bydomain}}
10870 </literallayout>
10871 <para>
10872 The first item is a regular expression that is protected from expansion by
10873 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10874 senders based on the receiving domain.
10875 </para>
10876 </section>
10877 <section>
10878 <title>Negated items in lists</title>
10879 <para>
10880 <indexterm role="concept">
10881 <primary>list</primary>
10882 <secondary>negation</secondary>
10883 </indexterm>
10884 <indexterm role="concept">
10885 <primary>negation</primary>
10886 <secondary>in lists</secondary>
10887 </indexterm>
10888 Items in a list may be positive or negative. Negative items are indicated by a
10889 leading exclamation mark, which may be followed by optional white space. A list
10890 defines a set of items (domains, etc). When Exim processes one of these lists,
10891 it is trying to find out whether a domain, host, address, or local part
10892 (respectively) is in the set that is defined by the list. It works like this:
10893 </para>
10894 <para>
10895 The list is scanned from left to right. If a positive item is matched, the
10896 subject that is being checked is in the set; if a negative item is matched, the
10897 subject is not in the set. If the end of the list is reached without the
10898 subject having matched any of the patterns, it is in the set if the last item
10899 was a negative one, but not if it was a positive one. For example, the list in
10900 </para>
10901 <literallayout class="monospaced">
10902 domainlist relay_domains = !a.b.c : *.b.c
10903 </literallayout>
10904 <para>
10905 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10906 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10907 list is positive. However, if the setting were
10908 </para>
10909 <literallayout class="monospaced">
10910 domainlist relay_domains = !a.b.c
10911 </literallayout>
10912 <para>
10913 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10914 list is negative. In other words, a list that ends with a negative item behaves
10915 as if it had an extra item <literal>:*</literal> on the end.
10916 </para>
10917 <para>
10918 Another way of thinking about positive and negative items in lists is to read
10919 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10920 item.
10921 </para>
10922 </section>
10923 <section id="SECTfilnamlis">
10924 <title>File names in lists</title>
10925 <para>
10926 <indexterm role="concept">
10927 <primary>list</primary>
10928 <secondary>file name in</secondary>
10929 </indexterm>
10930 If an item in a domain, host, address, or local part list is an absolute file
10931 name (beginning with a slash character), each line of the file is read and
10932 processed as if it were an independent item in the list, except that further
10933 file names are not allowed,
10934 and no expansion of the data from the file takes place.
10935 Empty lines in the file are ignored, and the file may also contain comment
10936 lines:
10937 </para>
10938 <itemizedlist>
10939 <listitem>
10940 <para>
10941 For domain and host lists, if a # character appears anywhere in a line of the
10942 file, it and all following characters are ignored.
10943 </para>
10944 </listitem>
10945 <listitem>
10946 <para>
10947 Because local parts may legitimately contain # characters, a comment in an
10948 address list or local part list file is recognized only if # is preceded by
10949 white space or the start of the line. For example:
10950 </para>
10951 <literallayout class="monospaced">
10952 not#comment@x.y.z   # but this is a comment
10953 </literallayout>
10954 </listitem>
10955 </itemizedlist>
10956 <para>
10957 Putting a file name in a list has the same effect as inserting each line of the
10958 file as an item in the list (blank lines and comments excepted). However, there
10959 is one important difference: the file is read each time the list is processed,
10960 so if its contents vary over time, Exim&#x2019;s behaviour changes.
10961 </para>
10962 <para>
10963 If a file name is preceded by an exclamation mark, the sense of any match
10964 within the file is inverted. For example, if
10965 </para>
10966 <literallayout class="monospaced">
10967 hold_domains = !/etc/nohold-domains
10968 </literallayout>
10969 <para>
10970 and the file contains the lines
10971 </para>
10972 <literallayout class="monospaced">
10973 !a.b.c
10974 *.b.c
10975 </literallayout>
10976 <para>
10977 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10978 any domain matching <literal>*.b.c</literal> is not.
10979 </para>
10980 </section>
10981 <section>
10982 <title>An lsearch file is not an out-of-line list</title>
10983 <para>
10984 As will be described in the sections that follow, lookups can be used in lists
10985 to provide indexed methods of checking list membership. There has been some
10986 confusion about the way <command>lsearch</command> lookups work in lists. Because
10987 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10988 sometimes thought that it is allowed to contain wild cards and other kinds of
10989 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10990 always fixed strings, just as for any other single-key lookup type.
10991 </para>
10992 <para>
10993 If you want to use a file to contain wild-card patterns that form part of a
10994 list, just give the file name on its own, without a search type, as described
10995 in the previous section. You could also use the <command>wildlsearch</command> or
10996 <command>nwildlsearch</command>, but there is no advantage in doing this.
10997 </para>
10998 </section>
10999 <section id="SECTnamedlists">
11000 <title>Named lists</title>
11001 <para>
11002 <indexterm role="concept">
11003 <primary>named lists</primary>
11004 </indexterm>
11005 <indexterm role="concept">
11006 <primary>list</primary>
11007 <secondary>named</secondary>
11008 </indexterm>
11009 A list of domains, hosts, email addresses, or local parts can be given a name
11010 which is then used to refer to the list elsewhere in the configuration. This is
11011 particularly convenient if the same list is required in several different
11012 places. It also allows lists to be given meaningful names, which can improve
11013 the readability of the configuration. For example, it is conventional to define
11014 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
11015 locally on a host, using a configuration line such as
11016 </para>
11017 <literallayout class="monospaced">
11018 domainlist local_domains = localhost:my.dom.example
11019 </literallayout>
11020 <para>
11021 Named lists are referenced by giving their name preceded by a plus sign, so,
11022 for example, a router that is intended to handle local domains would be
11023 configured with the line
11024 </para>
11025 <literallayout class="monospaced">
11026 domains = +local_domains
11027 </literallayout>
11028 <para>
11029 The first router in a configuration is often one that handles all domains
11030 except the local ones, using a configuration with a negated item like this:
11031 </para>
11032 <literallayout class="monospaced">
11033 dnslookup:
11034   driver = dnslookup
11035   domains = ! +local_domains
11036   transport = remote_smtp
11037   no_more
11038 </literallayout>
11039 <para>
11040 The four kinds of named list are created by configuration lines starting with
11041 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
11042 respectively. Then there follows the name that you are defining, followed by an
11043 equals sign and the list itself. For example:
11044 </para>
11045 <literallayout class="monospaced">
11046 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
11047 addresslist bad_senders = cdb;/etc/badsenders
11048 </literallayout>
11049 <para>
11050 A named list may refer to other named lists:
11051 </para>
11052 <literallayout class="monospaced">
11053 domainlist  dom1 = first.example : second.example
11054 domainlist  dom2 = +dom1 : third.example
11055 domainlist  dom3 = fourth.example : +dom2 : fifth.example
11056 </literallayout>
11057 <para>
11058 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
11059 effect may not be what you intended, because the negation does not propagate
11060 out to the higher level. For example, consider:
11061 </para>
11062 <literallayout class="monospaced">
11063 domainlist  dom1 = !a.b
11064 domainlist  dom2 = +dom1 : *.b
11065 </literallayout>
11066 <para>
11067 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
11068 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
11069 means it matches the second list as well. The effect is not the same as
11070 </para>
11071 <literallayout class="monospaced">
11072 domainlist  dom2 = !a.b : *.b
11073 </literallayout>
11074 <para>
11075 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
11076 referenced lists if you can.
11077 </para>
11078 <para>
11079 Named lists may have a performance advantage. When Exim is routing an
11080 address or checking an incoming message, it caches the result of tests on named
11081 lists. So, if you have a setting such as
11082 </para>
11083 <literallayout class="monospaced">
11084 domains = +local_domains
11085 </literallayout>
11086 <para>
11087 on several of your routers
11088 or in several ACL statements,
11089 the actual test is done only for the first one. However, the caching works only
11090 if there are no expansions within the list itself or any sublists that it
11091 references. In other words, caching happens only for lists that are known to be
11092 the same each time they are referenced.
11093 </para>
11094 <para>
11095 By default, there may be up to 16 named lists of each type. This limit can be
11096 extended by changing a compile-time variable. The use of domain and host lists
11097 is recommended for concepts such as local domains, relay domains, and relay
11098 hosts. The default configuration is set up like this.
11099 </para>
11100 </section>
11101 <section>
11102 <title>Named lists compared with macros</title>
11103 <para>
11104 <indexterm role="concept">
11105 <primary>list</primary>
11106 <secondary>named compared with macro</secondary>
11107 </indexterm>
11108 <indexterm role="concept">
11109 <primary>macro</primary>
11110 <secondary>compared with named list</secondary>
11111 </indexterm>
11112 At first sight, named lists might seem to be no different from macros in the
11113 configuration file. However, macros are just textual substitutions. If you
11114 write
11115 </para>
11116 <literallayout class="monospaced">
11117 ALIST = host1 : host2
11118 auth_advertise_hosts = !ALIST
11119 </literallayout>
11120 <para>
11121 it probably won&#x2019;t do what you want, because that is exactly the same as
11122 </para>
11123 <literallayout class="monospaced">
11124 auth_advertise_hosts = !host1 : host2
11125 </literallayout>
11126 <para>
11127 Notice that the second host name is not negated. However, if you use a host
11128 list, and write
11129 </para>
11130 <literallayout class="monospaced">
11131 hostlist alist = host1 : host2
11132 auth_advertise_hosts = ! +alist
11133 </literallayout>
11134 <para>
11135 the negation applies to the whole list, and so that is equivalent to
11136 </para>
11137 <literallayout class="monospaced">
11138 auth_advertise_hosts = !host1 : !host2
11139 </literallayout>
11140 </section>
11141 <section>
11142 <title>Named list caching</title>
11143 <para>
11144 <indexterm role="concept">
11145 <primary>list</primary>
11146 <secondary>caching of named</secondary>
11147 </indexterm>
11148 <indexterm role="concept">
11149 <primary>caching</primary>
11150 <secondary>named lists</secondary>
11151 </indexterm>
11152 While processing a message, Exim caches the result of checking a named list if
11153 it is sure that the list is the same each time. In practice, this means that
11154 the cache operates only if the list contains no $ characters, which guarantees
11155 that it will not change when it is expanded. Sometimes, however, you may have
11156 an expanded list that you know will be the same each time within a given
11157 message. For example:
11158 </para>
11159 <literallayout class="monospaced">
11160 domainlist special_domains = \
11161            ${lookup{$sender_host_address}cdb{/some/file}}
11162 </literallayout>
11163 <para>
11164 This provides a list of domains that depends only on the sending host&#x2019;s IP
11165 address. If this domain list is referenced a number of times (for example,
11166 in several ACL lines, or in several routers) the result of the check is not
11167 cached by default, because Exim does not know that it is going to be the
11168 same list each time.
11169 </para>
11170 <para>
11171 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11172 cache the result anyway. For example:
11173 </para>
11174 <literallayout class="monospaced">
11175 domainlist_cache special_domains = ${lookup{...
11176 </literallayout>
11177 <para>
11178 If you do this, you should be absolutely sure that caching is going to do
11179 the right thing in all cases. When in doubt, leave it out.
11180 </para>
11181 </section>
11182 <section id="SECTdomainlist">
11183 <title>Domain lists</title>
11184 <para>
11185 <indexterm role="concept">
11186 <primary>domain list</primary>
11187 <secondary>patterns for</secondary>
11188 </indexterm>
11189 <indexterm role="concept">
11190 <primary>list</primary>
11191 <secondary>domain list</secondary>
11192 </indexterm>
11193 Domain lists contain patterns that are to be matched against a mail domain.
11194 The following types of item may appear in domain lists:
11195 </para>
11196 <itemizedlist>
11197 <listitem>
11198 <para>
11199 <indexterm role="concept">
11200 <primary>primary host name</primary>
11201 </indexterm>
11202 <indexterm role="concept">
11203 <primary>host name</primary>
11204 <secondary>matched in domain list</secondary>
11205 </indexterm>
11206 <indexterm role="concept">
11207 <primary><option>primary_hostname</option></primary>
11208 </indexterm>
11209 <indexterm role="concept">
11210 <primary>domain list</primary>
11211 <secondary>matching primary host name</secondary>
11212 </indexterm>
11213 <indexterm role="concept">
11214 <primary>@ in a domain list</primary>
11215 </indexterm>
11216 If a pattern consists of a single @ character, it matches the local host name,
11217 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11218 possible to use the same configuration file on several different hosts that
11219 differ only in their names.
11220 </para>
11221 </listitem>
11222 <listitem>
11223 <para>
11224 <indexterm role="concept">
11225 <primary>@[] in a domain list</primary>
11226 </indexterm>
11227 <indexterm role="concept">
11228 <primary>domain list</primary>
11229 <secondary>matching local IP interfaces</secondary>
11230 </indexterm>
11231 <indexterm role="concept">
11232 <primary>domain literal</primary>
11233 </indexterm>
11234 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
11235 address, enclosed in square brackets, as in an email address that contains a
11236 domain literal.
11237 In today&#x2019;s Internet, the use of domain literals is controversial.
11238 </para>
11239 </listitem>
11240 <listitem>
11241 <para>
11242 <indexterm role="concept">
11243 <primary>@mx_any</primary>
11244 </indexterm>
11245 <indexterm role="concept">
11246 <primary>@mx_primary</primary>
11247 </indexterm>
11248 <indexterm role="concept">
11249 <primary>@mx_secondary</primary>
11250 </indexterm>
11251 <indexterm role="concept">
11252 <primary>domain list</primary>
11253 <secondary>matching MX pointers to local host</secondary>
11254 </indexterm>
11255 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11256 has an MX record pointing to the local host or to any host that is listed in
11257 <indexterm role="concept">
11258 <primary><option>hosts_treat_as_local</option></primary>
11259 </indexterm>
11260 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11261 are similar, except that the first matches only when a primary MX target is the
11262 local host, and the second only when no primary MX target is the local host,
11263 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11264 preference value &ndash; there may of course be more than one of them.
11265 </para>
11266 <para>
11267 The MX lookup that takes place when matching a pattern of this type is
11268 performed with the resolver options for widening names turned off. Thus, for
11269 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11270 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11271 options of the <command>dnslookup</command> router for a discussion of domain widening.
11272 </para>
11273 <para>
11274 Sometimes you may want to ignore certain IP addresses when using one of these
11275 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11276 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11277 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11278 on a router). For example:
11279 </para>
11280 <literallayout class="monospaced">
11281 domains = @mx_any/ignore=127.0.0.1
11282 </literallayout>
11283 <para>
11284 This example matches any domain that has an MX record pointing to one of
11285 the local host&#x2019;s IP addresses other than 127.0.0.1.
11286 </para>
11287 <para>
11288 The list of IP addresses is in fact processed by the same code that processes
11289 host lists, so it may contain CIDR-coded network specifications and it may also
11290 contain negative items.
11291 </para>
11292 <para>
11293 Because the list of IP addresses is a sublist within a domain list, you have to
11294 be careful about delimiters if there is more than one address. Like any other
11295 list, the default delimiter can be changed. Thus, you might have:
11296 </para>
11297 <literallayout class="monospaced">
11298 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11299           an.other.domain : ...
11300 </literallayout>
11301 <para>
11302 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11303 involved, it is easiest to change the delimiter for the main list as well:
11304 </para>
11305 <literallayout class="monospaced">
11306 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11307           an.other.domain ? ...
11308 </literallayout>
11309 </listitem>
11310 <listitem>
11311 <para>
11312 <indexterm role="concept">
11313 <primary>asterisk</primary>
11314 <secondary>in domain list</secondary>
11315 </indexterm>
11316 <indexterm role="concept">
11317 <primary>domain list</primary>
11318 <secondary>asterisk in</secondary>
11319 </indexterm>
11320 <indexterm role="concept">
11321 <primary>domain list</primary>
11322 <secondary>matching <quote>ends with</quote></secondary>
11323 </indexterm>
11324 If a pattern starts with an asterisk, the remaining characters of the pattern
11325 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11326 domain lists differs from its use in partial matching lookups. In a domain
11327 list, the character following the asterisk need not be a dot, whereas partial
11328 matching works only in terms of dot-separated components. For example, a domain
11329 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11330 <emphasis>cipher.key.ex</emphasis>.
11331 </para>
11332 </listitem>
11333 <listitem>
11334 <para>
11335 <indexterm role="concept">
11336 <primary>regular expressions</primary>
11337 <secondary>in domain list</secondary>
11338 </indexterm>
11339 <indexterm role="concept">
11340 <primary>domain list</primary>
11341 <secondary>matching regular expression</secondary>
11342 </indexterm>
11343 If a pattern starts with a circumflex character, it is treated as a regular
11344 expression, and matched against the domain using a regular expression matching
11345 function. The circumflex is treated as part of the regular expression.
11346 References to descriptions of the syntax of regular expressions are given in
11347 chapter <xref linkend="CHAPregexp"/>.
11348 </para>
11349 <para>
11350 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11351 must escape any backslash and dollar characters in the regular expression, or
11352 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11353 it is not to be expanded (unless you really do want to build a regular
11354 expression by expansion, of course).
11355 </para>
11356 </listitem>
11357 <listitem>
11358 <para>
11359 <indexterm role="concept">
11360 <primary>lookup</primary>
11361 <secondary>in domain list</secondary>
11362 </indexterm>
11363 <indexterm role="concept">
11364 <primary>domain list</primary>
11365 <secondary>matching by lookup</secondary>
11366 </indexterm>
11367 If a pattern starts with the name of a single-key lookup type followed by a
11368 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11369 must be a file name in a suitable format for the lookup type. For example, for
11370 <quote>cdb;</quote> it must be an absolute path:
11371 </para>
11372 <literallayout class="monospaced">
11373 domains = cdb;/etc/mail/local_domains.cdb
11374 </literallayout>
11375 <para>
11376 The appropriate type of lookup is done on the file using the domain name as the
11377 key. In most cases, the data that is looked up is not used; Exim is interested
11378 only in whether or not the key is present in the file. However, when a lookup
11379 is used for the <option>domains</option> option on a router
11380 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11381 <varname>$domain_data</varname> variable and can be referred to in other router options or
11382 other statements in the same ACL.
11383 </para>
11384 </listitem>
11385 <listitem>
11386 <para>
11387 Any of the single-key lookup type names may be preceded by
11388 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11389 </para>
11390 <literallayout class="monospaced">
11391 domains = partial-dbm;/partial/domains
11392 </literallayout>
11393 <para>
11394 This causes partial matching logic to be invoked; a description of how this
11395 works is given in section <xref linkend="SECTpartiallookup"/>.
11396 </para>
11397 </listitem>
11398 <listitem>
11399 <para>
11400 <indexterm role="concept">
11401 <primary>asterisk</primary>
11402 <secondary>in lookup type</secondary>
11403 </indexterm>
11404 Any of the single-key lookup types may be followed by an asterisk. This causes
11405 a default lookup for a key consisting of a single asterisk to be done if the
11406 original lookup fails. This is not a useful feature when using a domain list to
11407 select particular domains (because any domain would match), but it might have
11408 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11409 expansion variable.
11410 </para>
11411 </listitem>
11412 <listitem>
11413 <para>
11414 If the pattern starts with the name of a query-style lookup type followed by a
11415 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11416 pattern must be an appropriate query for the lookup type, as described in
11417 chapter <xref linkend="CHAPfdlookup"/>. For example:
11418 </para>
11419 <literallayout class="monospaced">
11420 hold_domains = mysql;select domain from holdlist \
11421   where domain = '$domain';
11422 </literallayout>
11423 <para>
11424 In most cases, the data that is looked up is not used (so for an SQL query, for
11425 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11426 whether or not the query succeeds. However, when a lookup is used for the
11427 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11428 variable and can be referred to in other options.
11429 </para>
11430 </listitem>
11431 <listitem>
11432 <para>
11433 <indexterm role="concept">
11434 <primary>domain list</primary>
11435 <secondary>matching literal domain name</secondary>
11436 </indexterm>
11437 If none of the above cases apply, a caseless textual comparison is made
11438 between the pattern and the domain.
11439 </para>
11440 </listitem>
11441 </itemizedlist>
11442 <para>
11443 Here is an example that uses several different kinds of pattern:
11444 </para>
11445 <literallayout class="monospaced">
11446 domainlist funny_domains = \
11447   @ : \
11448   lib.unseen.edu : \
11449   *.foundation.fict.example : \
11450   \N^[1-2]\d{3}\.fict\.example$\N : \
11451   partial-dbm;/opt/data/penguin/book : \
11452   nis;domains.byname : \
11453   nisplus;[name=$domain,status=local],domains.org_dir
11454 </literallayout>
11455 <para>
11456 There are obvious processing trade-offs among the various matching modes. Using
11457 an asterisk is faster than a regular expression, and listing a few names
11458 explicitly probably is too. The use of a file or database lookup is expensive,
11459 but may be the only option if hundreds of names are required. Because the
11460 patterns are tested in order, it makes sense to put the most commonly matched
11461 patterns earlier.
11462 </para>
11463 </section>
11464 <section id="SECThostlist">
11465 <title>Host lists</title>
11466 <para>
11467 <indexterm role="concept">
11468 <primary>host list</primary>
11469 <secondary>patterns in</secondary>
11470 </indexterm>
11471 <indexterm role="concept">
11472 <primary>list</primary>
11473 <secondary>host list</secondary>
11474 </indexterm>
11475 Host lists are used to control what remote hosts are allowed to do. For
11476 example, some hosts may be allowed to use the local host as a relay, and some
11477 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11478 two different ways, by name or by IP address. In a host list, some types of
11479 pattern are matched to a host name, and some are matched to an IP address.
11480 You need to be particularly careful with this when single-key lookups are
11481 involved, to ensure that the right value is being used as the key.
11482 </para>
11483 </section>
11484 <section>
11485 <title>Special host list patterns</title>
11486 <para>
11487 <indexterm role="concept">
11488 <primary>empty item in hosts list</primary>
11489 </indexterm>
11490 <indexterm role="concept">
11491 <primary>host list</primary>
11492 <secondary>empty string in</secondary>
11493 </indexterm>
11494 If a host list item is the empty string, it matches only when no remote host is
11495 involved. This is the case when a message is being received from a local
11496 process using SMTP on the standard input, that is, when a TCP/IP connection is
11497 not used.
11498 </para>
11499 <para>
11500 <indexterm role="concept">
11501 <primary>asterisk</primary>
11502 <secondary>in host list</secondary>
11503 </indexterm>
11504 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11505 the IP address nor the name is actually inspected.
11506 </para>
11507 </section>
11508 <section id="SECThoslispatip">
11509 <title>Host list patterns that match by IP address</title>
11510 <para>
11511 <indexterm role="concept">
11512 <primary>host list</primary>
11513 <secondary>matching IP addresses</secondary>
11514 </indexterm>
11515 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11516 the incoming address actually appears in the IPv6 host as
11517 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11518 list, it is converted into a traditional IPv4 address first. (Not all operating
11519 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11520 concerns.)
11521 </para>
11522 <para>
11523 The following types of pattern in a host list check the remote host by
11524 inspecting its IP address:
11525 </para>
11526 <itemizedlist>
11527 <listitem>
11528 <para>
11529 If the pattern is a plain domain name (not a regular expression, not starting
11530 with *, not a lookup of any kind), Exim calls the operating system function
11531 to find the associated IP address(es). Exim uses the newer
11532 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11533 This typically causes a forward DNS lookup of the name. The result is compared
11534 with the IP address of the subject host.
11535 </para>
11536 <para>
11537 If there is a temporary problem (such as a DNS timeout) with the host name
11538 lookup, a temporary error occurs. For example, if the list is being used in an
11539 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11540 temporary SMTP error code. If no IP address can be found for the host name,
11541 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11542 </para>
11543 </listitem>
11544 <listitem>
11545 <para>
11546 <indexterm role="concept">
11547 <primary>@ in a host list</primary>
11548 </indexterm>
11549 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11550 domain name, as just described.
11551 </para>
11552 </listitem>
11553 <listitem>
11554 <para>
11555 If the pattern is an IP address, it is matched against the IP address of the
11556 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11557 IPv6 addresses can be given in colon-separated format, but the colons have to
11558 be doubled so as not to be taken as item separators when the default list
11559 separator is used. IPv6 addresses are recognized even when Exim is compiled
11560 without IPv6 support. This means that if they appear in a host list on an
11561 IPv4-only host, Exim will not treat them as host names. They are just addresses
11562 that can never match a client host.
11563 </para>
11564 </listitem>
11565 <listitem>
11566 <para>
11567 <indexterm role="concept">
11568 <primary>@[] in a host list</primary>
11569 </indexterm>
11570 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11571 the local host. For example, if the local host is an IPv4 host with one
11572 interface address 10.45.23.56, these two ACL statements have the same effect:
11573 </para>
11574 <literallayout class="monospaced">
11575 accept hosts = 127.0.0.1 : 10.45.23.56
11576 accept hosts = @[]
11577 </literallayout>
11578 </listitem>
11579 <listitem>
11580 <para>
11581 <indexterm role="concept">
11582 <primary>CIDR notation</primary>
11583 </indexterm>
11584 If the pattern is an IP address followed by a slash and a mask length (for
11585 example 10.11.42.0/24), it is matched against the IP address of the subject
11586 host under the given mask. This allows, an entire network of hosts to be
11587 included (or excluded) by a single item. The mask uses CIDR notation; it
11588 specifies the number of address bits that must match, starting from the most
11589 significant end of the address.
11590 </para>
11591 <para>
11592 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11593 of a range of addresses. It is the number of bits in the network portion of the
11594 address. The above example specifies a 24-bit netmask, so it matches all 256
11595 addresses in the 10.11.42.0 network. An item such as
11596 </para>
11597 <literallayout class="monospaced">
11598 192.168.23.236/31
11599 </literallayout>
11600 <para>
11601 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11602 32 for an IPv4 address is the same as no mask at all; just a single address
11603 matches.
11604 </para>
11605 <para>
11606 Here is another example which shows an IPv4 and an IPv6 network:
11607 </para>
11608 <literallayout class="monospaced">
11609 recipient_unqualified_hosts = 192.168.0.0/16: \
11610                               3ffe::ffff::836f::::/48
11611 </literallayout>
11612 <para>
11613 The doubling of list separator characters applies only when these items
11614 appear inline in a host list. It is not required when indirecting via a file.
11615 For example:
11616 </para>
11617 <literallayout class="monospaced">
11618 recipient_unqualified_hosts = /opt/exim/unqualnets
11619 </literallayout>
11620 <para>
11621 could make use of a file containing
11622 </para>
11623 <literallayout class="monospaced">
11624 172.16.0.0/12
11625 3ffe:ffff:836f::/48
11626 </literallayout>
11627 <para>
11628 to have exactly the same effect as the previous example. When listing IPv6
11629 addresses inline, it is usually more convenient to use the facility for
11630 changing separator characters. This list contains the same two networks:
11631 </para>
11632 <literallayout class="monospaced">
11633 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11634                                  3ffe:ffff:836f::/48
11635 </literallayout>
11636 <para>
11637 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11638 list.
11639 </para>
11640 </listitem>
11641 </itemizedlist>
11642 </section>
11643 <section id="SECThoslispatsikey">
11644 <title>Host list patterns for single-key lookups by host address</title>
11645 <para>
11646 <indexterm role="concept">
11647 <primary>host list</primary>
11648 <secondary>lookup of IP address</secondary>
11649 </indexterm>
11650 When a host is to be identified by a single-key lookup of its complete IP
11651 address, the pattern takes this form:
11652 </para>
11653 <literallayout>
11654 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11655 </literallayout>
11656 <para>
11657 For example:
11658 </para>
11659 <literallayout class="monospaced">
11660 hosts_lookup = net-cdb;/hosts-by-ip.db
11661 </literallayout>
11662 <para>
11663 The text form of the IP address of the subject host is used as the lookup key.
11664 IPv6 addresses are converted to an unabbreviated form, using lower case
11665 letters, with dots as separators because colon is the key terminator in
11666 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11667 quoting the keys, but this is a facility that was added later.] The data
11668 returned by the lookup is not used.
11669 </para>
11670 <para>
11671 <indexterm role="concept">
11672 <primary>IP address</primary>
11673 <secondary>masking</secondary>
11674 </indexterm>
11675 <indexterm role="concept">
11676 <primary>host list</primary>
11677 <secondary>masked IP address</secondary>
11678 </indexterm>
11679 Single-key lookups can also be performed using masked IP addresses, using
11680 patterns of this form:
11681 </para>
11682 <literallayout>
11683 <literal>net&lt;</literal><emphasis>number</emphasis><literal>&gt;-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11684 </literallayout>
11685 <para>
11686 For example:
11687 </para>
11688 <literallayout class="monospaced">
11689 net24-dbm;/networks.db
11690 </literallayout>
11691 <para>
11692 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11693 length. A textual string is constructed from the masked value, followed by the
11694 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11695 is 192.168.34.6, the key that is looked up for the above example is
11696 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11697 case letters and dots as separators instead of the more usual colon, because
11698 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11699 addresses are always used.
11700 </para>
11701 <para>
11702 <emphasis role="bold">Warning</emphasis>: Specifing <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11703 IPv6 address) is not the same as specifing just <option>net-</option> without a number. In
11704 the former case the key strings include the mask value, whereas in the latter
11705 case the IP address is used on its own.
11706 </para>
11707 </section>
11708 <section id="SECThoslispatnam">
11709 <title>Host list patterns that match by host name</title>
11710 <para>
11711 <indexterm role="concept">
11712 <primary>host</primary>
11713 <secondary>lookup failures</secondary>
11714 </indexterm>
11715 <indexterm role="concept">
11716 <primary>unknown host name</primary>
11717 </indexterm>
11718 <indexterm role="concept">
11719 <primary>host list</primary>
11720 <secondary>matching host name</secondary>
11721 </indexterm>
11722 There are several types of pattern that require Exim to know the name of the
11723 remote host. These are either wildcard patterns or lookups by name. (If a
11724 complete hostname is given without any wildcarding, it is used to find an IP
11725 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11726 above.)
11727 </para>
11728 <para>
11729 If the remote host name is not already known when Exim encounters one of these
11730 patterns, it has to be found from the IP address.
11731 Although many sites on the Internet are conscientious about maintaining reverse
11732 DNS data for their hosts, there are also many that do not do this.
11733 Consequently, a name cannot always be found, and this may lead to unwanted
11734 effects. Take care when configuring host lists with wildcarded name patterns.
11735 Consider what will happen if a name cannot be found.
11736 </para>
11737 <para>
11738 Because of the problems of determining host names from IP addresses, matching
11739 against host names is not as common as matching against IP addresses.
11740 </para>
11741 <para>
11742 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11743 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11744 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11745 are done can be changed by setting the <option>host_lookup_order</option> option.
11746 </para>
11747 <para>
11748 There are some options that control what happens if a host name cannot be
11749 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11750 </para>
11751 <para>
11752 <indexterm role="concept">
11753 <primary>host</primary>
11754 <secondary>alias for</secondary>
11755 </indexterm>
11756 <indexterm role="concept">
11757 <primary>alias for host</primary>
11758 </indexterm>
11759 As a result of aliasing, hosts may have more than one name. When processing any
11760 of the following types of pattern, all the host&#x2019;s names are checked:
11761 </para>
11762 <itemizedlist>
11763 <listitem>
11764 <para>
11765 <indexterm role="concept">
11766 <primary>asterisk</primary>
11767 <secondary>in host list</secondary>
11768 </indexterm>
11769 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11770 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11771 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11772 requirement. Other kinds of wildcarding require the use of a regular
11773 expression.
11774 </para>
11775 </listitem>
11776 <listitem>
11777 <para>
11778 <indexterm role="concept">
11779 <primary>regular expressions</primary>
11780 <secondary>in host list</secondary>
11781 </indexterm>
11782 <indexterm role="concept">
11783 <primary>host list</primary>
11784 <secondary>regular expression in</secondary>
11785 </indexterm>
11786 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11787 matched against the host name. For example,
11788 </para>
11789 <literallayout class="monospaced">
11790 ^(a|b)\.c\.d$
11791 </literallayout>
11792 <para>
11793 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11794 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11795 that backslash and dollar characters are not misinterpreted as part of the
11796 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11797 part of the string as non-expandable. For example:
11798 </para>
11799 <literallayout class="monospaced">
11800 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11801 </literallayout>
11802 <para>
11803 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11804 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11805 example. Without it, a match at the start of the host name is all that is
11806 required.
11807 </para>
11808 </listitem>
11809 </itemizedlist>
11810 </section>
11811 <section id="SECTbehipnot">
11812 <title>Behaviour when an IP address or name cannot be found</title>
11813 <para>
11814 <indexterm role="concept">
11815 <primary>host</primary>
11816 <secondary>lookup failures</secondary>
11817 </indexterm>
11818 While processing a host list, Exim may need to look up an IP address from a
11819 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11820 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11821 behaviour when it fails to find the information it is seeking is the same.
11822 </para>
11823 <para>
11824 <indexterm role="concept">
11825 <primary><literal>+include_unknown</literal></primary>
11826 </indexterm>
11827 <indexterm role="concept">
11828 <primary><literal>+ignore_unknown</literal></primary>
11829 </indexterm>
11830 By default, Exim behaves as if the host does not match the list. This may not
11831 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
11832 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11833 top level &ndash; they are not recognized in an indirected file).
11834 </para>
11835 <itemizedlist>
11836 <listitem>
11837 <para>
11838 If any item that follows <literal>+include_unknown</literal> requires information that
11839 cannot found, Exim behaves as if the host does match the list. For example,
11840 </para>
11841 <literallayout class="monospaced">
11842 host_reject_connection = +include_unknown:*.enemy.ex
11843 </literallayout>
11844 <para>
11845 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11846 any hosts whose name it cannot find.
11847 </para>
11848 </listitem>
11849 <listitem>
11850 <para>
11851 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11852 be found, Exim ignores that item and proceeds to the rest of the list. For
11853 example:
11854 </para>
11855 <literallayout class="monospaced">
11856 accept hosts = +ignore_unknown : friend.example : \
11857                192.168.4.5
11858 </literallayout>
11859 <para>
11860 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11861 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11862 name can be found for 192.168.4.5, it is rejected.
11863 </para>
11864 </listitem>
11865 </itemizedlist>
11866 <para>
11867 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11868 list. The effect of each one lasts until the next, or until the end of the
11869 list.
11870 </para>
11871 <para>
11872 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11873 apply to temporary DNS errors. They always cause a defer action (except when
11874 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11875 </para>
11876 </section>
11877 <section id="SECThoslispatnamsk">
11878 <title>Host list patterns for single-key lookups by host name</title>
11879 <para>
11880 <indexterm role="concept">
11881 <primary>host</primary>
11882 <secondary>lookup failures</secondary>
11883 </indexterm>
11884 <indexterm role="concept">
11885 <primary>unknown host name</primary>
11886 </indexterm>
11887 <indexterm role="concept">
11888 <primary>host list</primary>
11889 <secondary>matching host name</secondary>
11890 </indexterm>
11891 If a pattern is of the form
11892 </para>
11893 <literallayout>
11894 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
11895 </literallayout>
11896 <para>
11897 for example
11898 </para>
11899 <literallayout class="monospaced">
11900 dbm;/host/accept/list
11901 </literallayout>
11902 <para>
11903 a single-key lookup is performend, using the host name as its key. If the
11904 lookup succeeds, the host matches the item. The actual data that is looked up
11905 is not used.
11906 </para>
11907 <para>
11908 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11909 keys in the file, not IP addresses. If you want to do lookups based on IP
11910 addresses, you must precede the search type with <quote>net-</quote> (see section
11911 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11912 two items in the same list, one doing an address lookup and one doing a name
11913 lookup, both using the same file.
11914 </para>
11915 </section>
11916 <section>
11917 <title>Host list patterns for query-style lookups</title>
11918 <para>
11919 If a pattern is of the form
11920 </para>
11921 <literallayout>
11922 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
11923 </literallayout>
11924 <para>
11925 the query is obeyed, and if it succeeds, the host matches the item. The actual
11926 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11927 <varname>$sender_host_name</varname> can be used in the query. For example:
11928 </para>
11929 <literallayout class="monospaced">
11930 hosts_lookup = pgsql;\
11931   select ip from hostlist where ip='$sender_host_address'
11932 </literallayout>
11933 <para>
11934 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11935 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11936 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11937 operator.
11938 </para>
11939 <para>
11940 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11941 looks up the host name if has not already done so. (See section
11942 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11943 </para>
11944 <para>
11945 Historical note: prior to release 4.30, Exim would always attempt to find a
11946 host name before running the query, unless the search type was preceded by
11947 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11948 still recognized for query-style lookups, but its presence or absence has no
11949 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11950 See section <xref linkend="SECThoslispatsikey"/>.)
11951 </para>
11952 </section>
11953 <section id="SECTmixwilhos">
11954 <title>Mixing wildcarded host names and addresses in host lists</title>
11955 <para>
11956 <indexterm role="concept">
11957 <primary>host list</primary>
11958 <secondary>mixing names and addresses in</secondary>
11959 </indexterm>
11960 If you have name lookups or wildcarded host names and IP addresses in the same
11961 host list, you should normally put the IP addresses first. For example, in an
11962 ACL you could have:
11963 </para>
11964 <literallayout class="monospaced">
11965 accept hosts = 10.9.8.7 : *.friend.example
11966 </literallayout>
11967 <para>
11968 The reason for this lies in the left-to-right way that Exim processes lists.
11969 It can test IP addresses without doing any DNS lookups, but when it reaches an
11970 item that requires a host name, it fails if it cannot find a host name to
11971 compare with the pattern. If the above list is given in the opposite order, the
11972 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11973 IP address is 10.9.8.7.
11974 </para>
11975 <para>
11976 If you really do want to do the name check first, and still recognize the IP
11977 address, you can rewrite the ACL like this:
11978 </para>
11979 <literallayout class="monospaced">
11980 accept hosts = *.friend.example
11981 accept hosts = 10.9.8.7
11982 </literallayout>
11983 <para>
11984 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11985 <xref linkend="CHAPACL"/> for details of ACLs.
11986 </para>
11987 </section>
11988 <section id="SECTaddresslist">
11989 <title>Address lists</title>
11990 <para>
11991 <indexterm role="concept">
11992 <primary>list</primary>
11993 <secondary>address list</secondary>
11994 </indexterm>
11995 <indexterm role="concept">
11996 <primary>address list</primary>
11997 <secondary>empty item</secondary>
11998 </indexterm>
11999 <indexterm role="concept">
12000 <primary>address list</primary>
12001 <secondary>patterns</secondary>
12002 </indexterm>
12003 Address lists contain patterns that are matched against mail addresses. There
12004 is one special case to be considered: the sender address of a bounce message is
12005 always empty. You can test for this by providing an empty item in an address
12006 list. For example, you can set up a router to process bounce messages by
12007 using this option setting:
12008 </para>
12009 <literallayout class="monospaced">
12010 senders = :
12011 </literallayout>
12012 <para>
12013 The presence of the colon creates an empty item. If you do not provide any
12014 data, the list is empty and matches nothing. The empty sender can also be
12015 detected by a regular expression that matches an empty string,
12016 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
12017 </para>
12018 <para>
12019 Non-empty items in an address list can be straightforward email addresses. For
12020 example:
12021 </para>
12022 <literallayout class="monospaced">
12023 senders = jbc@askone.example : hs@anacreon.example
12024 </literallayout>
12025 <para>
12026 A certain amount of wildcarding is permitted. If a pattern contains an @
12027 character, but is not a regular expression and does not begin with a
12028 semicolon-terminated lookup type (described below), the local part of the
12029 subject address is compared with the local part of the pattern, which may start
12030 with an asterisk. If the local parts match, the domain is checked in exactly
12031 the same way as for a pattern in a domain list. For example, the domain can be
12032 wildcarded, refer to a named list, or be a lookup:
12033 </para>
12034 <literallayout class="monospaced">
12035 deny senders = *@*.spamming.site:\
12036                *@+hostile_domains:\
12037                bozo@partial-lsearch;/list/of/dodgy/sites:\
12038                *@dbm;/bad/domains.db
12039 </literallayout>
12040 <para>
12041 <indexterm role="concept">
12042 <primary>local part</primary>
12043 <secondary>starting with !</secondary>
12044 </indexterm>
12045 <indexterm role="concept">
12046 <primary>address list</primary>
12047 <secondary>local part starting with !</secondary>
12048 </indexterm>
12049 If a local part that begins with an exclamation mark is required, it has to be
12050 specified using a regular expression, because otherwise the exclamation mark is
12051 treated as a sign of negation, as is standard in lists.
12052 </para>
12053 <para>
12054 If a non-empty pattern that is not a regular expression or a lookup does not
12055 contain an @ character, it is matched against the domain part of the subject
12056 address. The only two formats that are recognized this way are a literal
12057 domain, or a domain pattern that starts with *. In both these cases, the effect
12058 is the same as if <literal>*@</literal> preceded the pattern. For example:
12059 </para>
12060 <literallayout class="monospaced">
12061 deny senders = enemy.domain : *.enemy.domain
12062 </literallayout>
12063 <para>
12064 The following kinds of more complicated address list pattern can match any
12065 address, including the empty address that is characteristic of bounce message
12066 senders:
12067 </para>
12068 <itemizedlist>
12069 <listitem>
12070 <para>
12071 <indexterm role="concept">
12072 <primary>regular expressions</primary>
12073 <secondary>in address list</secondary>
12074 </indexterm>
12075 <indexterm role="concept">
12076 <primary>address list</primary>
12077 <secondary>regular expression in</secondary>
12078 </indexterm>
12079 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
12080 done against the complete address, with the pattern as the regular expression.
12081 You must take care that backslash and dollar characters are not misinterpreted
12082 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
12083 to mark that part of the string as non-expandable. For example:
12084 </para>
12085 <literallayout class="monospaced">
12086 deny senders = \N^.*this.*@example\.com$\N : \
12087                \N^\d{8}.+@spamhaus.example$\N : ...
12088 </literallayout>
12089 <para>
12090 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12091 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12092 </para>
12093 </listitem>
12094 <listitem>
12095 <para>
12096 <indexterm role="concept">
12097 <primary>address list</primary>
12098 <secondary>lookup for complete address</secondary>
12099 </indexterm>
12100 Complete addresses can be looked up by using a pattern that starts with a
12101 lookup type terminated by a semicolon, followed by the data for the lookup. For
12102 example:
12103 </para>
12104 <literallayout class="monospaced">
12105 deny senders = cdb;/etc/blocked.senders : \
12106   mysql;select address from blocked where \
12107   address='${quote_mysql:$sender_address}'
12108 </literallayout>
12109 <para>
12110 Both query-style and single-key lookup types can be used. For a single-key
12111 lookup type, Exim uses the complete address as the key. However, empty keys are
12112 not supported for single-key lookups, so a match against the empty address
12113 always fails. This restriction does not apply to query-style lookups.
12114 </para>
12115 <para>
12116 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12117 cannot be used, and is ignored if specified, with an entry being written to the
12118 panic log.
12119 <indexterm role="concept">
12120 <primary>*@ with single-key lookup</primary>
12121 </indexterm>
12122 However, you can configure lookup defaults, as described in section
12123 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12124 default. For example, with this lookup:
12125 </para>
12126 <literallayout class="monospaced">
12127 accept senders = lsearch*@;/some/file
12128 </literallayout>
12129 <para>
12130 the file could contains lines like this:
12131 </para>
12132 <literallayout class="monospaced">
12133 user1@domain1.example
12134 *@domain2.example
12135 </literallayout>
12136 <para>
12137 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12138 that are tried is:
12139 </para>
12140 <literallayout class="monospaced">
12141 nimrod@jaeger.example
12142 *@jaeger.example
12143 *
12144 </literallayout>
12145 <para>
12146 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12147 would mean that every address matches, thus rendering the test useless.
12148 </para>
12149 <para>
12150 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12151 </para>
12152 <literallayout class="monospaced">
12153 deny recipients = dbm*@;/some/file
12154 deny recipients = *@dbm;/some/file
12155 </literallayout>
12156 <para>
12157 The first does a whole address lookup, with defaulting, as just described,
12158 because it starts with a lookup type. The second matches the local part and
12159 domain independently, as described in a bullet point below.
12160 </para>
12161 </listitem>
12162 </itemizedlist>
12163 <para>
12164 The following kinds of address list pattern can match only non-empty addresses.
12165 If the subject address is empty, a match against any of these pattern types
12166 always fails.
12167 </para>
12168 <itemizedlist>
12169 <listitem>
12170 <para>
12171 <indexterm role="concept">
12172 <primary>@@ with single-key lookup</primary>
12173 </indexterm>
12174 <indexterm role="concept">
12175 <primary>address list</primary>
12176 <secondary>@@ lookup type</secondary>
12177 </indexterm>
12178 <indexterm role="concept">
12179 <primary>address list</primary>
12180 <secondary>split local part and domain</secondary>
12181 </indexterm>
12182 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12183 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12184 split into a local part and a domain. The domain is looked up in the file. If
12185 it is not found, there is no match. If it is found, the data that is looked up
12186 from the file is treated as a colon-separated list of local part patterns, each
12187 of which is matched against the subject local part in turn.
12188 </para>
12189 <para>
12190 <indexterm role="concept">
12191 <primary>asterisk</primary>
12192 <secondary>in address list</secondary>
12193 </indexterm>
12194 The lookup may be a partial one, and/or one involving a search for a default
12195 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12196 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12197 even be further lookups. They may also be independently negated. For example,
12198 with
12199 </para>
12200 <literallayout class="monospaced">
12201 deny senders = @@dbm;/etc/reject-by-domain
12202 </literallayout>
12203 <para>
12204 the data from which the DBM file is built could contain lines like
12205 </para>
12206 <literallayout class="monospaced">
12207 baddomain.com:  !postmaster : *
12208 </literallayout>
12209 <para>
12210 to reject all senders except <option>postmaster</option> from that domain.
12211 </para>
12212 <para>
12213 <indexterm role="concept">
12214 <primary>local part</primary>
12215 <secondary>starting with !</secondary>
12216 </indexterm>
12217 If a local part that actually begins with an exclamation mark is required, it
12218 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12219 may be split over several lines by indenting the second and subsequent lines,
12220 but the separating colon must still be included at line breaks. White space
12221 surrounding the colons is ignored. For example:
12222 </para>
12223 <literallayout class="monospaced">
12224 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12225 spammer3 : spammer4
12226 </literallayout>
12227 <para>
12228 As in all colon-separated lists in Exim, a colon can be included in an item by
12229 doubling.
12230 </para>
12231 <para>
12232 If the last item in the list starts with a right angle-bracket, the remainder
12233 of the item is taken as a new key to look up in order to obtain a continuation
12234 list of local parts. The new key can be any sequence of characters. Thus one
12235 might have entries like
12236 </para>
12237 <literallayout class="monospaced">
12238 aol.com: spammer1 : spammer 2 : &gt;*
12239 xyz.com: spammer3 : &gt;*
12240 *:       ^\d{8}$
12241 </literallayout>
12242 <para>
12243 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12244 local parts for all domains, in addition to the specific local parts listed for
12245 each domain. Of course, using this feature costs another lookup each time a
12246 chain is followed, but the effort needed to maintain the data is reduced.
12247 </para>
12248 <para>
12249 <indexterm role="concept">
12250 <primary>loop</primary>
12251 <secondary>in lookups</secondary>
12252 </indexterm>
12253 It is possible to construct loops using this facility, and in order to catch
12254 them, the chains may be no more than fifty items long.
12255 </para>
12256 </listitem>
12257 <listitem>
12258 <para>
12259 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12260 lookup, but in this case, the chaining facility is not available. The lookup
12261 can only return a single list of local parts.
12262 </para>
12263 </listitem>
12264 </itemizedlist>
12265 <para>
12266 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12267 in these two examples:
12268 </para>
12269 <literallayout class="monospaced">
12270 senders = +my_list
12271 senders = *@+my_list
12272 </literallayout>
12273 <para>
12274 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12275 example it is a named domain list.
12276 </para>
12277 </section>
12278 <section id="SECTcasletadd">
12279 <title>Case of letters in address lists</title>
12280 <para>
12281 <indexterm role="concept">
12282 <primary>case of local parts</primary>
12283 </indexterm>
12284 <indexterm role="concept">
12285 <primary>address list</primary>
12286 <secondary>case forcing</secondary>
12287 </indexterm>
12288 <indexterm role="concept">
12289 <primary>case forcing in address lists</primary>
12290 </indexterm>
12291 Domains in email addresses are always handled caselessly, but for local parts
12292 case may be significant on some systems (see <option>caseful_local_part</option> for how
12293 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12294 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12295 blocking lists should be done in a case-independent manner. Since most address
12296 lists in Exim are used for this kind of control, Exim attempts to do this by
12297 default.
12298 </para>
12299 <para>
12300 The domain portion of an address is always lowercased before matching it to an
12301 address list. The local part is lowercased by default, and any string
12302 comparisons that take place are done caselessly. This means that the data in
12303 the address list itself, in files included as plain file names, and in any file
12304 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12305 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12306 works caselessly) must be in lower case, because these lookups are not
12307 case-independent.
12308 </para>
12309 <para>
12310 <indexterm role="concept">
12311 <primary><literal>+caseful</literal></primary>
12312 </indexterm>
12313 To allow for the possibility of caseful address list matching, if an item in
12314 an address list is the string <quote>+caseful</quote>, the original case of the local
12315 part is restored for any comparisons that follow, and string comparisons are no
12316 longer case-independent. This does not affect the domain, which remains in
12317 lower case. However, although independent matches on the domain alone are still
12318 performed caselessly, regular expressions that match against an entire address
12319 become case-sensitive after <quote>+caseful</quote> has been seen.
12320 </para>
12321 </section>
12322 <section id="SECTlocparlis">
12323 <title>Local part lists</title>
12324 <para>
12325 <indexterm role="concept">
12326 <primary>list</primary>
12327 <secondary>local part list</secondary>
12328 </indexterm>
12329 <indexterm role="concept">
12330 <primary>local part</primary>
12331 <secondary>list</secondary>
12332 </indexterm>
12333 Case-sensitivity in local part lists is handled in the same way as for address
12334 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12335 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12336 set false, the subject is lowercased and the matching is initially
12337 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12338 matching in the local part list, but not elsewhere in the router. If
12339 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12340 option is case-sensitive from the start.
12341 </para>
12342 <para>
12343 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12344 comments are handled in the same way as address lists &ndash; they are recognized
12345 only if the # is preceded by white space or the start of the line.
12346 Otherwise, local part lists are matched in the same way as domain lists, except
12347 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12348 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12349 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12350 types.
12351 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12352 </para>
12353 </section>
12354 </chapter>
12355
12356 <chapter id="CHAPexpand">
12357 <title>String expansions</title>
12358 <para>
12359 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12360 <primary>expansion</primary>
12361 <secondary>of strings</secondary>
12362 </indexterm>
12363 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12364 them are expanded every time they are used; others are expanded only once.
12365 </para>
12366 <para>
12367 When a string is being expanded it is copied verbatim from left to right except
12368 when a dollar or backslash character is encountered. A dollar specifies the
12369 start of a portion of the string that is interpreted and replaced as described
12370 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12371 escape character, as described in the following section.
12372 </para>
12373 <section id="SECTlittext">
12374 <title>Literal text in expanded strings</title>
12375 <para>
12376 <indexterm role="concept">
12377 <primary>expansion</primary>
12378 <secondary>including literal text</secondary>
12379 </indexterm>
12380 An uninterpreted dollar can be included in an expanded string by putting a
12381 backslash in front of it. A backslash can be used to prevent any special
12382 character being treated specially in an expansion, including backslash itself.
12383 If the string appears in quotes in the configuration file, two backslashes are
12384 required because the quotes themselves cause interpretation of backslashes when
12385 the string is read in (see section <xref linkend="SECTstrings"/>).
12386 </para>
12387 <para>
12388 <indexterm role="concept">
12389 <primary>expansion</primary>
12390 <secondary>non-expandable substrings</secondary>
12391 </indexterm>
12392 A portion of the string can specified as non-expandable by placing it between
12393 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12394 expressions, which often contain backslashes and dollar signs. For example:
12395 </para>
12396 <literallayout class="monospaced">
12397 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12398 </literallayout>
12399 <para>
12400 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12401 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12402 string.
12403 </para>
12404 </section>
12405 <section>
12406 <title>Character escape sequences in expanded strings</title>
12407 <para>
12408 <indexterm role="concept">
12409 <primary>expansion</primary>
12410 <secondary>escape sequences</secondary>
12411 </indexterm>
12412 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12413 expanded string is recognized as an escape sequence for the character newline,
12414 carriage return, or tab, respectively. A backslash followed by up to three
12415 octal digits is recognized as an octal encoding for a single character, and a
12416 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12417 encoding.
12418 </para>
12419 <para>
12420 These escape sequences are also recognized in quoted strings when they are read
12421 in. Their interpretation in expansions as well is useful for unquoted strings,
12422 and for other cases such as looked-up strings that are then expanded.
12423 </para>
12424 </section>
12425 <section>
12426 <title>Testing string expansions</title>
12427 <para>
12428 <indexterm role="concept">
12429 <primary>expansion</primary>
12430 <secondary>testing</secondary>
12431 </indexterm>
12432 <indexterm role="concept">
12433 <primary>testing</primary>
12434 <secondary>string expansion</secondary>
12435 </indexterm>
12436 <indexterm role="concept">
12437 <primary><option>-be</option> option</primary>
12438 </indexterm>
12439 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12440 takes the command arguments, or lines from the standard input if there are no
12441 arguments, runs them through the string expansion code, and writes the results
12442 to the standard output. Variables based on configuration values are set up, but
12443 since no message is being processed, variables such as <varname>$local_part</varname> have no
12444 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12445 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12446 and <option>nhash</option>.
12447 </para>
12448 <para>
12449 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12450 instead runs under the uid and gid it was called with, to prevent users from
12451 using <option>-be</option> for reading files to which they do not have access.
12452 </para>
12453 <para revisionflag="changed">
12454 <indexterm role="concept">
12455 <primary><option>-bem</option> option</primary>
12456 </indexterm>
12457 If you want to test expansions that include variables whose values are taken
12458 from a message, there are two other options that can be used. The <option>-bem</option>
12459 option is like <option>-be</option> except that it is followed by a file name. The file is
12460 read as a message before doing the test expansions. For example:
12461 </para>
12462 <literallayout class="monospaced" revisionflag="changed">
12463 exim -bem /tmp/test.message '$h_subject:'
12464 </literallayout>
12465 <para revisionflag="changed">
12466 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
12467 Exim message identifier. For example:
12468 </para>
12469 <literallayout class="monospaced" revisionflag="changed">
12470 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
12471 </literallayout>
12472 <para revisionflag="changed">
12473 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
12474 is therefore restricted to admin users.
12475 </para>
12476 </section>
12477 <section id="SECTforexpfai">
12478 <title>Forced expansion failure</title>
12479 <para>
12480 <indexterm role="concept">
12481 <primary>expansion</primary>
12482 <secondary>forced failure</secondary>
12483 </indexterm>
12484 A number of expansions that are described in the following section have
12485 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12486 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12487 used depends on some condition that is evaluated as part of the expansion. If,
12488 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12489 the entire string expansion fails in a way that can be detected by the code
12490 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12491 its consequences depend on the circumstances. In some cases it is no different
12492 from any other expansion failure, but in others a different action may be
12493 taken. Such variations are mentioned in the documentation of the option that is
12494 being expanded.
12495 </para>
12496 </section>
12497 <section id="SECTexpansionitems">
12498 <title>Expansion items</title>
12499 <para>
12500 The following items are recognized in expanded strings. White space may be used
12501 between sub-items that are keywords or substrings enclosed in braces inside an
12502 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12503 white space is significant.
12504 </para>
12505 <variablelist>
12506 <varlistentry>
12507 <term><emphasis role="bold">$</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;&nbsp;or&nbsp;<emphasis role="bold">${</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12508 <listitem>
12509 <para>
12510 <indexterm role="concept">
12511 <primary>expansion</primary>
12512 <secondary>variables</secondary>
12513 </indexterm>
12514 Substitute the contents of the named variable, for example:
12515 </para>
12516 <literallayout class="monospaced">
12517 $local_part
12518 ${domain}
12519 </literallayout>
12520 <para>
12521 The second form can be used to separate the name from subsequent alphanumeric
12522 characters. This form (using braces) is available only for variables; it does
12523 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12524 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12525 given, the expansion fails.
12526 </para>
12527 </listitem></varlistentry>
12528 <varlistentry>
12529 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12530 <listitem>
12531 <para>
12532 <indexterm role="concept">
12533 <primary>expansion</primary>
12534 <secondary>operators</secondary>
12535 </indexterm>
12536 The string is first itself expanded, and then the operation specified by
12537 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12538 </para>
12539 <literallayout class="monospaced">
12540 ${lc:$local_part}
12541 </literallayout>
12542 <para>
12543 The string starts with the first character after the colon, which may be
12544 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12545 below. The operator notation is used for simple expansion items that have just
12546 one argument, because it reduces the number of braces and therefore makes the
12547 string easier to understand.
12548 </para>
12549 </listitem></varlistentry>
12550 <varlistentry>
12551 <term><emphasis role="bold">${dlfunc{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>function</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
12552 <listitem>
12553 <para>
12554 <indexterm role="concept">
12555 <primary><option>dlfunc</option></primary>
12556 </indexterm>
12557 This expansion dynamically loads and then calls a locally-written C function.
12558 This functionality is available only if Exim is compiled with
12559 </para>
12560 <literallayout class="monospaced">
12561 EXPAND_DLFUNC=yes
12562 </literallayout>
12563 <para>
12564 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12565 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12566 (but of course Exim does start new processes frequently).
12567 </para>
12568 <para>
12569 There may be from zero to eight arguments to the function. When compiling
12570 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12571 included. The Exim variables and functions that are defined by that API
12572 are also available for dynamically loaded functions. The function itself
12573 must have the following type:
12574 </para>
12575 <literallayout class="monospaced">
12576 int dlfunction(uschar **yield, int argc, uschar *argv[])
12577 </literallayout>
12578 <para>
12579 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12580 function should return one of the following values:
12581 </para>
12582 <para>
12583 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12584 into the expanded string that is being built.
12585 </para>
12586 <para>
12587 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12588 from <emphasis>yield</emphasis>, if it is set.
12589 </para>
12590 <para>
12591 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12592 taken from <emphasis>yield</emphasis> if it is set.
12593 </para>
12594 <para>
12595 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12596 </para>
12597 <para>
12598 When compiling a function that is to be used in this way with gcc,
12599 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12600 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12601 </para>
12602 </listitem></varlistentry>
12603 <varlistentry>
12604 <term><emphasis role="bold">${extract{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12605 <listitem>
12606 <para>
12607 <indexterm role="concept">
12608 <primary>expansion</primary>
12609 <secondary>extracting substrings by key</secondary>
12610 </indexterm>
12611 <indexterm role="concept">
12612 <primary><option>extract</option></primary>
12613 <secondary>substrings by key</secondary>
12614 </indexterm>
12615 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12616 white space is removed from the key (but not from any of the strings). The key
12617 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12618 form:
12619 </para>
12620 <literallayout>
12621 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12622 </literallayout>
12623 <para>
12624 <indexterm role="concept">
12625 <primary><varname>$value</varname></primary>
12626 </indexterm>
12627 where the equals signs and spaces (but not both) are optional. If any of the
12628 values contain white space, they must be enclosed in double quotes, and any
12629 values that are enclosed in double quotes are subject to escape processing as
12630 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12631 for the value that corresponds to the key. The search is case-insensitive. If
12632 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12633 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12634 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12635 is restored to any previous value it might have had.
12636 </para>
12637 <para>
12638 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12639 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12640 extracted is used. Thus, for example, these two expansions are identical, and
12641 yield <quote>2001</quote>:
12642 </para>
12643 <literallayout class="monospaced">
12644 ${extract{gid}{uid=1984 gid=2001}}
12645 ${extract{gid}{uid=1984 gid=2001}{$value}}
12646 </literallayout>
12647 <para>
12648 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12649 appear, for example:
12650 </para>
12651 <literallayout class="monospaced">
12652 ${extract{Z}{A=... B=...}{$value} fail }
12653 </literallayout>
12654 <para>
12655 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12656 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12657 </para>
12658 </listitem></varlistentry>
12659 <varlistentry>
12660 <term><emphasis role="bold">${extract{</emphasis>&lt;<emphasis>number</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>separators</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12661 <listitem>
12662 <para>
12663 <indexterm role="concept">
12664 <primary>expansion</primary>
12665 <secondary>extracting substrings by number</secondary>
12666 </indexterm>
12667 <indexterm role="concept">
12668 <primary><option>extract</option></primary>
12669 <secondary>substrings by number</secondary>
12670 </indexterm>
12671 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12672 apart from leading and trailing white space, which is ignored.
12673 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12674 behaves in the same way, except that, instead of extracting a named field, it
12675 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12676 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12677 &lt;<emphasis>string3</emphasis>&gt; as before.
12678 </para>
12679 <para>
12680 The fields in the string are separated by any one of the characters in the
12681 separator string. These may include space or tab characters.
12682 The first field is numbered one. If the number is negative, the fields are
12683 counted from the end of the string, with the rightmost one numbered -1. If the
12684 number given is zero, the entire string is returned. If the modulus of the
12685 number is greater than the number of fields in the string, the result is the
12686 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12687 provided. For example:
12688 </para>
12689 <literallayout class="monospaced">
12690 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12691 </literallayout>
12692 <para>
12693 yields <quote>42</quote>, and
12694 </para>
12695 <literallayout class="monospaced">
12696 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12697 </literallayout>
12698 <para>
12699 yields <quote>99</quote>. Two successive separators mean that the field between them is
12700 empty (for example, the fifth field above).
12701 </para>
12702 </listitem></varlistentry>
12703 <varlistentry>
12704 <term><emphasis role="bold">${hash{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12705 <listitem>
12706 <para>
12707 <indexterm role="concept">
12708 <primary>hash function</primary>
12709 <secondary>textual</secondary>
12710 </indexterm>
12711 <indexterm role="concept">
12712 <primary>expansion</primary>
12713 <secondary>textual hash</secondary>
12714 </indexterm>
12715 This is a textual hashing function, and was the first to be implemented in
12716 early versions of Exim. In current releases, there are other hashing functions
12717 (numeric, MD5, and SHA-1), which are described below.
12718 </para>
12719 <para>
12720 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12721 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12722 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12723 use the simpler operator notation that avoids some of the braces:
12724 </para>
12725 <literallayout class="monospaced">
12726 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12727 </literallayout>
12728 <para>
12729 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12730 or equal to the length of the string, the expansion item returns the string.
12731 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12732 function to the string. The new string consists of characters taken from the
12733 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12734 </para>
12735 <literallayout class="monospaced">
12736 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12737 </literallayout>
12738 <para>
12739 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12740 letters appear. For example:
12741 </para>
12742 <literallayout>
12743 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12744 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12745 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12746 </literallayout>
12747 </listitem></varlistentry>
12748 <varlistentry>
12749 <term><emphasis role="bold">$header_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$h_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
12750 <listitem>
12751 <para>
12752 See <emphasis role="bold">$rheader</emphasis> below.
12753 </para>
12754 </listitem></varlistentry>
12755 <varlistentry>
12756 <term><emphasis role="bold">$bheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$bh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
12757 <listitem>
12758 <para>
12759 See <emphasis role="bold">$rheader</emphasis> below.
12760 </para>
12761 </listitem></varlistentry>
12762 <varlistentry>
12763 <term><emphasis role="bold">$rheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;or&nbsp;<emphasis role="bold">$rh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
12764 <listitem>
12765 <para>
12766 <indexterm role="concept">
12767 <primary>expansion</primary>
12768 <secondary>header insertion</secondary>
12769 </indexterm>
12770 <indexterm role="concept">
12771 <primary><varname>$header_</varname></primary>
12772 </indexterm>
12773 <indexterm role="concept">
12774 <primary><varname>$bheader_</varname></primary>
12775 </indexterm>
12776 <indexterm role="concept">
12777 <primary><varname>$rheader_</varname></primary>
12778 </indexterm>
12779 <indexterm role="concept">
12780 <primary>header lines</primary>
12781 <secondary>in expansion strings</secondary>
12782 </indexterm>
12783 <indexterm role="concept">
12784 <primary>header lines</primary>
12785 <secondary>character sets</secondary>
12786 </indexterm>
12787 <indexterm role="concept">
12788 <primary>header lines</primary>
12789 <secondary>decoding</secondary>
12790 </indexterm>
12791 Substitute the contents of the named message header line, for example
12792 </para>
12793 <literallayout class="monospaced">
12794 $header_reply-to:
12795 </literallayout>
12796 <para>
12797 The newline that terminates a header line is not included in the expansion, but
12798 internal newlines (caused by splitting the header line over several physical
12799 lines) may be present.
12800 </para>
12801 <para>
12802 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12803 the data in the header line is interpreted.
12804 </para>
12805 <itemizedlist>
12806 <listitem>
12807 <para>
12808 <indexterm role="concept">
12809 <primary>white space</primary>
12810 <secondary>in header lines</secondary>
12811 </indexterm>
12812 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12813 processing at all, and without the removal of leading and trailing white space.
12814 </para>
12815 </listitem>
12816 <listitem>
12817 <para>
12818 <indexterm role="concept">
12819 <primary>base64 encoding</primary>
12820 <secondary>in header lines</secondary>
12821 </indexterm>
12822 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12823 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12824 character set translation. If decoding of what looks superficially like a MIME
12825 <quote>word</quote> fails, the raw string is returned. If decoding
12826 <indexterm role="concept">
12827 <primary>binary zero</primary>
12828 <secondary>in header line</secondary>
12829 </indexterm>
12830 produces a binary zero character, it is replaced by a question mark &ndash; this is
12831 what Exim does for binary zeros that are actually received in header lines.
12832 </para>
12833 </listitem>
12834 <listitem>
12835 <para>
12836 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12837 standard character set. This is an attempt to produce the same string as would
12838 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
12839 returned. Translation is attempted only on operating systems that support the
12840 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12841 a system Makefile or in <filename>Local/Makefile</filename>.
12842 </para>
12843 </listitem>
12844 </itemizedlist>
12845 <para>
12846 In a filter file, the target character set for <option>header</option> can be specified by a
12847 command of the following form:
12848 </para>
12849 <literallayout class="monospaced">
12850 headers charset "UTF-8"
12851 </literallayout>
12852 <para>
12853 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12854 subsequently obeyed filter commands. In the absence of this command, the target
12855 character set in a filter is taken from the setting of the <option>headers_charset</option>
12856 option in the runtime configuration. The value of this option defaults to the
12857 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12858 ISO-8859-1.
12859 </para>
12860 <para>
12861 Header names follow the syntax of RFC 2822, which states that they may contain
12862 any printing characters except space and colon. Consequently, curly brackets
12863 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12864 if they were variables. Attempting to do so causes a syntax error.
12865 </para>
12866 <para revisionflag="changed">
12867 Only header lines that are common to all copies of a message are visible to
12868 this mechanism. These are the original header lines that are received with the
12869 message, and any that are added by an ACL statement or by a system
12870 filter. Header lines that are added to a particular copy of a message by a
12871 router or transport are not accessible.
12872 </para>
12873 <para revisionflag="changed">
12874 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12875 before the DATA ACL, because the header structure is not set up until the
12876 message is received. Header lines that are added in a RCPT ACL (for example)
12877 are saved until the message&#x2019;s incoming header lines are available, at which
12878 point they are added. When a DATA ACL is running, however, header lines added
12879 by earlier ACLs are visible.
12880 </para>
12881 <para>
12882 Upper case and lower case letters are synonymous in header names. If the
12883 following character is white space, the terminating colon may be omitted, but
12884 this is not recommended, because you may then forget it when it is needed. When
12885 white space terminates the header name, it is included in the expanded string.
12886 If the message does not contain the given header, the expansion item is
12887 replaced by an empty string. (See the <option>def</option> condition in section
12888 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12889 </para>
12890 <para revisionflag="changed">
12891 If there is more than one header with the same name, they are all concatenated
12892 to form the substitution string, up to a maximum length of 64K. Unless
12893 <option>rheader</option> is being used, leading and trailing white space is removed from
12894 each header before concatenation, and a completely empty header is ignored. A
12895 newline character is then inserted between non-empty headers, but there is no
12896 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
12897 those headers that contain lists of addresses, a comma is also inserted at the
12898 junctions between headers. This does not happen for the <option>rheader</option> expansion.
12899 </para>
12900 </listitem></varlistentry>
12901 <varlistentry>
12902 <term><emphasis role="bold">${hmac{</emphasis>&lt;<emphasis>hashname</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12903 <listitem>
12904 <para>
12905 <indexterm role="concept">
12906 <primary>expansion</primary>
12907 <secondary>hmac hashing</secondary>
12908 </indexterm>
12909 <indexterm role="concept">
12910 <primary><option>hmac</option></primary>
12911 </indexterm>
12912 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12913 shared secret and some text into a message authentication code, as specified in
12914 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12915 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12916 cryptographic hash, allowing for authentication that is not possible with MD5
12917 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12918 present. For example:
12919 </para>
12920 <literallayout class="monospaced">
12921 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12922 </literallayout>
12923 <para>
12924 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12925 produces:
12926 </para>
12927 <literallayout class="monospaced">
12928 dd97e3ba5d1a61b5006108f8c8252953
12929 </literallayout>
12930 <para>
12931 As an example of how this might be used, you might put in the main part of
12932 an Exim configuration:
12933 </para>
12934 <literallayout class="monospaced">
12935 SPAMSCAN_SECRET=cohgheeLei2thahw
12936 </literallayout>
12937 <para>
12938 In a router or a transport you could then have:
12939 </para>
12940 <literallayout class="monospaced">
12941 headers_add = \
12942   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12943   ${hmac{md5}{SPAMSCAN_SECRET}\
12944   {${primary_hostname},${message_exim_id},$h_message-id:}}
12945 </literallayout>
12946 <para>
12947 Then given a message, you can check where it was scanned by looking at the
12948 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12949 this header line is authentic by recomputing the authentication code from the
12950 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12951 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
12952 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12953 </para>
12954 </listitem></varlistentry>
12955 <varlistentry>
12956 <term><emphasis role="bold">${if&nbsp;</emphasis>&lt;<emphasis>condition</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12957 <listitem>
12958 <para>
12959 <indexterm role="concept">
12960 <primary>expansion</primary>
12961 <secondary>conditional</secondary>
12962 </indexterm>
12963 <indexterm role="concept">
12964 <primary><option>if</option>, expansion item</primary>
12965 </indexterm>
12966 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
12967 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
12968 in section <xref linkend="SECTexpcond"/> below. For example:
12969 </para>
12970 <literallayout class="monospaced">
12971 ${if eq {$local_part}{postmaster} {yes}{no} }
12972 </literallayout>
12973 <para>
12974 The second string need not be present; if it is not and the condition is not
12975 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
12976 be present instead of the second string (without any curly brackets). In this
12977 case, the expansion is forced to fail if the condition is not true (see section
12978 <xref linkend="SECTforexpfai"/>).
12979 </para>
12980 <para>
12981 If both strings are omitted, the result is the string <literal>true</literal> if the condition
12982 is true, and the empty string if the condition is false. This makes it less
12983 cumbersome to write custom ACL and router conditions. For example, instead of
12984 </para>
12985 <literallayout class="monospaced">
12986 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
12987 </literallayout>
12988 <para>
12989 you can use
12990 </para>
12991 <literallayout class="monospaced">
12992 condition = ${if &gt;{$acl_m4}{3}}
12993 </literallayout>
12994 </listitem></varlistentry>
12995 <varlistentry>
12996 <term><emphasis role="bold">${length{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
12997 <listitem>
12998 <para>
12999 <indexterm role="concept">
13000 <primary>expansion</primary>
13001 <secondary>string truncation</secondary>
13002 </indexterm>
13003 <indexterm role="concept">
13004 <primary><option>length</option></primary>
13005 <secondary>expansion item</secondary>
13006 </indexterm>
13007 The <option>length</option> item is used to extract the initial portion of a string. Both
13008 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
13009 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
13010 change when expanded, you can use the simpler operator notation that avoids
13011 some of the braces:
13012 </para>
13013 <literallayout class="monospaced">
13014 ${length_&lt;n&gt;:&lt;string&gt;}
13015 </literallayout>
13016 <para>
13017 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
13018 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
13019 <option>strlen</option>, which gives the length of a string.
13020 </para>
13021 </listitem></varlistentry>
13022 <varlistentry>
13023 <term><emphasis role="bold">${lookup{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13024 <listitem>
13025 <para>
13026 This is the first of one of two different types of lookup item, which are both
13027 described in the next item.
13028 </para>
13029 </listitem></varlistentry>
13030 <varlistentry>
13031 <term><emphasis role="bold">${lookup&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>query</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13032 <listitem>
13033 <para>
13034 <indexterm role="concept">
13035 <primary>expansion</primary>
13036 <secondary>lookup in</secondary>
13037 </indexterm>
13038 <indexterm role="concept">
13039 <primary>file</primary>
13040 <secondary>lookups</secondary>
13041 </indexterm>
13042 <indexterm role="concept">
13043 <primary>lookup</primary>
13044 <secondary>in expanded string</secondary>
13045 </indexterm>
13046 The two forms of lookup item specify data lookups in files and databases, as
13047 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
13048 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
13049 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
13050 </para>
13051 <para>
13052 If there is any white space in a lookup item which is part of a filter command,
13053 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
13054 other place where white space is significant, the lookup item must be enclosed
13055 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
13056 out by the system administrator.
13057 </para>
13058 <para>
13059 <indexterm role="concept">
13060 <primary><varname>$value</varname></primary>
13061 </indexterm>
13062 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
13063 During its expansion, the variable <varname>$value</varname> contains the data returned by the
13064 lookup. Afterwards it reverts to the value it had previously (at the outer
13065 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
13066 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
13067 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
13068 lookup, thus providing a mechanism for looking up a default value when the
13069 original lookup fails.
13070 </para>
13071 <para>
13072 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
13073 data for the outer lookup while the parameters of the second lookup are
13074 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
13075 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
13076 appear, and in this case, if the lookup fails, the entire expansion is forced
13077 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
13078 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
13079 successful lookup, and nothing in the case of failure.
13080 </para>
13081 <para>
13082 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
13083 search type in order to do partial matching, and * or *@ may follow a search
13084 type to request default lookups if the key does not match (see sections
13085 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
13086 </para>
13087 <para>
13088 <indexterm role="concept">
13089 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
13090 <secondary>in lookup expansion</secondary>
13091 </indexterm>
13092 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
13093 and non-wild parts of the key during the expansion of the replacement text.
13094 They return to their previous values at the end of the lookup item.
13095 </para>
13096 <para>
13097 This example looks up the postmaster alias in the conventional alias file:
13098 </para>
13099 <literallayout class="monospaced">
13100 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
13101 </literallayout>
13102 <para>
13103 This example uses NIS+ to look up the full name of the user corresponding to
13104 the local part of an address, forcing the expansion to fail if it is not found:
13105 </para>
13106 <literallayout class="monospaced">
13107 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
13108   {$value}fail}
13109 </literallayout>
13110 </listitem></varlistentry>
13111 <varlistentry>
13112 <term><emphasis role="bold">${nhash{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13113 <listitem>
13114 <para>
13115 <indexterm role="concept">
13116 <primary>expansion</primary>
13117 <secondary>numeric hash</secondary>
13118 </indexterm>
13119 <indexterm role="concept">
13120 <primary>hash function</primary>
13121 <secondary>numeric</secondary>
13122 </indexterm>
13123 The three strings are expanded; the first two must yield numbers. Call them
13124 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13125 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13126 can use the simpler operator notation that avoids some of the braces:
13127 </para>
13128 <literallayout class="monospaced">
13129 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13130 </literallayout>
13131 <para>
13132 The second number is optional (in both notations). If there is only one number,
13133 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13134 processed by a div/mod hash function that returns two numbers, separated by a
13135 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13136 example,
13137 </para>
13138 <literallayout class="monospaced">
13139 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13140 </literallayout>
13141 <para>
13142 returns the string <quote>6/33</quote>.
13143 </para>
13144 </listitem></varlistentry>
13145 <varlistentry>
13146 <term><emphasis role="bold">${perl{</emphasis>&lt;<emphasis>subroutine</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>arg</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
13147 <listitem>
13148 <para>
13149 <indexterm role="concept">
13150 <primary>Perl</primary>
13151 <secondary>use in expanded string</secondary>
13152 </indexterm>
13153 <indexterm role="concept">
13154 <primary>expansion</primary>
13155 <secondary>calling Perl from</secondary>
13156 </indexterm>
13157 This item is available only if Exim has been built to include an embedded Perl
13158 interpreter. The subroutine name and the arguments are first separately
13159 expanded, and then the Perl subroutine is called with those arguments. No
13160 additional arguments need be given; the maximum number permitted, including the
13161 name of the subroutine, is nine.
13162 </para>
13163 <para>
13164 The return value of the subroutine is inserted into the expanded string, unless
13165 the return value is <option>undef</option>. In that case, the expansion fails in the same
13166 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13167 Whatever you return is evaluated in a scalar context. For example, if you
13168 return the name of a Perl vector, the return value is the size of the vector,
13169 not its contents.
13170 </para>
13171 <para>
13172 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13173 with the error message that was passed to <option>die</option>. More details of the embedded
13174 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13175 </para>
13176 <para>
13177 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13178 out the use of this expansion item in filter files.
13179 </para>
13180 </listitem></varlistentry>
13181 <varlistentry>
13182 <term><emphasis role="bold">${prvs{</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>keynumber</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13183 <listitem>
13184 <para>
13185 <indexterm role="concept">
13186 <primary>prvs</primary>
13187 <secondary>expansion item</secondary>
13188 </indexterm>
13189 The first argument is a complete email address and the second is secret
13190 keystring. The third argument, specifying a key number, is optional. If absent,
13191 it defaults to 0. The result of the expansion is a prvs-signed email address,
13192 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13193 as part of a bounce address tag validation (BATV) scheme. For more discussion
13194 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13195 </para>
13196 </listitem></varlistentry>
13197 <varlistentry>
13198 <term><emphasis role="bold">${prvscheck{</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13199 <listitem>
13200 <para>
13201 <indexterm role="concept">
13202 <primary>prvscheck</primary>
13203 <secondary>expansion item</secondary>
13204 </indexterm>
13205 This expansion item is the complement of the <option>prvs</option> item. It is used for
13206 checking prvs-signed addresses. If the expansion of the first argument does not
13207 yield a syntactically valid prvs-signed address, the whole item expands to the
13208 empty string. When the first argument does expand to a syntactically valid
13209 prvs-signed address, the second argument is expanded, with the prvs-decoded
13210 version of the address and the key number extracted from the address in the
13211 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13212 </para>
13213 <para>
13214 These two variables can be used in the expansion of the second argument to
13215 retrieve the secret. The validity of the prvs-signed address is then checked
13216 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13217 which is empty for failure or <quote>1</quote> for success.
13218 </para>
13219 <para>
13220 The third argument is optional; if it is missing, it defaults to an empty
13221 string. This argument is now expanded. If the result is an empty string, the
13222 result of the expansion is the decoded version of the address. This is the case
13223 whether or not the signature was valid. Otherwise, the result of the expansion
13224 is the expansion of the third argument.
13225 </para>
13226 <para>
13227 All three variables can be used in the expansion of the third argument.
13228 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13229 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13230 </para>
13231 </listitem></varlistentry>
13232 <varlistentry>
13233 <term><emphasis role="bold">${readfile{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>eol&nbsp;string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13234 <listitem>
13235 <para>
13236 <indexterm role="concept">
13237 <primary>expansion</primary>
13238 <secondary>inserting an entire file</secondary>
13239 </indexterm>
13240 <indexterm role="concept">
13241 <primary>file</primary>
13242 <secondary>inserting into expansion</secondary>
13243 </indexterm>
13244 <indexterm role="concept">
13245 <primary><option>readfile</option> expansion item</primary>
13246 </indexterm>
13247 The file name and end-of-line string are first expanded separately. The file is
13248 then read, and its contents replace the entire item. All newline characters in
13249 the file are replaced by the end-of-line string if it is present. Otherwise,
13250 newlines are left in the string.
13251 String expansion is not applied to the contents of the file. If you want this,
13252 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13253 the string expansion fails.
13254 </para>
13255 <para>
13256 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13257 locks out the use of this expansion item in filter files.
13258 </para>
13259 </listitem></varlistentry>
13260 <varlistentry>
13261 <term><emphasis role="bold">${readsocket{</emphasis>&lt;<emphasis>name</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>request</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>timeout</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>eol&nbsp;string</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>fail&nbsp;string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13262 <listitem>
13263 <para>
13264 <indexterm role="concept">
13265 <primary>expansion</primary>
13266 <secondary>inserting from a socket</secondary>
13267 </indexterm>
13268 <indexterm role="concept">
13269 <primary>socket</primary>
13270 <secondary>use of in expansion</secondary>
13271 </indexterm>
13272 <indexterm role="concept">
13273 <primary><option>readsocket</option> expansion item</primary>
13274 </indexterm>
13275 This item inserts data from a Unix domain or Internet socket into the expanded
13276 string. The minimal way of using it uses just two arguments, as in these
13277 examples:
13278 </para>
13279 <literallayout class="monospaced">
13280 ${readsocket{/socket/name}{request string}}
13281 ${readsocket{inet:some.host:1234}{request string}}
13282 </literallayout>
13283 <para>
13284 For a Unix domain socket, the first substring must be the path to the socket.
13285 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13286 a host name or IP address, followed by a colon and a port, which can be a
13287 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13288 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13289 example:
13290 </para>
13291 <literallayout class="monospaced">
13292 ${readsocket{inet:[::1]:1234}{request string}}
13293 </literallayout>
13294 <para>
13295 Only a single host name may be given, but if looking it up yields more than
13296 one IP address, they are each tried in turn until a connection is made. For
13297 both kinds of socket, Exim makes a connection, writes the request string
13298 (unless it is an empty string) and reads from the socket until an end-of-file
13299 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13300 extend what can be done. Firstly, you can vary the timeout. For example:
13301 </para>
13302 <literallayout class="monospaced">
13303 ${readsocket{/socket/name}{request string}{3s}}
13304 </literallayout>
13305 <para>
13306 A fourth argument allows you to change any newlines that are in the data
13307 that is read, in the same way as for <option>readfile</option> (see above). This example
13308 turns them into spaces:
13309 </para>
13310 <literallayout class="monospaced">
13311 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13312 </literallayout>
13313 <para>
13314 As with all expansions, the substrings are expanded before the processing
13315 happens. Errors in these sub-expansions cause the expansion to fail. In
13316 addition, the following errors can occur:
13317 </para>
13318 <itemizedlist>
13319 <listitem>
13320 <para>
13321 Failure to create a socket file descriptor;
13322 </para>
13323 </listitem>
13324 <listitem>
13325 <para>
13326 Failure to connect the socket;
13327 </para>
13328 </listitem>
13329 <listitem>
13330 <para>
13331 Failure to write the request string;
13332 </para>
13333 </listitem>
13334 <listitem>
13335 <para>
13336 Timeout on reading from the socket.
13337 </para>
13338 </listitem>
13339 </itemizedlist>
13340 <para>
13341 By default, any of these errors causes the expansion to fail. However, if
13342 you supply a fifth substring, it is expanded and used when any of the above
13343 errors occurs. For example:
13344 </para>
13345 <literallayout class="monospaced">
13346 ${readsocket{/socket/name}{request string}{3s}{\n}\
13347   {socket failure}}
13348 </literallayout>
13349 <para>
13350 You can test for the existence of a Unix domain socket by wrapping this
13351 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13352 and the actual opening of the socket, so it is safer to use the fifth argument
13353 if you want to be absolutely sure of avoiding an expansion error for a
13354 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13355 </para>
13356 <para>
13357 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13358 locks out the use of this expansion item in filter files.
13359 </para>
13360 </listitem></varlistentry>
13361 <varlistentry>
13362 <term><emphasis role="bold">$rheader_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:&nbsp;or&nbsp;$rh_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
13363 <listitem>
13364 <para>
13365 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13366 expansion item above.
13367 </para>
13368 </listitem></varlistentry>
13369 <varlistentry>
13370 <term><emphasis role="bold">${run{</emphasis>&lt;<emphasis>command</emphasis>&gt;<emphasis role="bold">&nbsp;</emphasis>&lt;<emphasis>args</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13371 <listitem>
13372 <para>
13373 <indexterm role="concept">
13374 <primary>expansion</primary>
13375 <secondary>running a command</secondary>
13376 </indexterm>
13377 <indexterm role="concept">
13378 <primary><option>run</option> expansion item</primary>
13379 </indexterm>
13380 The command and its arguments are first expanded separately, and then the
13381 command is run in a separate process, but under the same uid and gid. As in
13382 other command executions from Exim, a shell is not used by default. If you want
13383 a shell, you must explicitly code it.
13384 </para>
13385 <para revisionflag="changed">
13386 The standard input for the command exists, but is empty. The standard output
13387 and standard error are set to the same file descriptor.
13388 <indexterm role="concept">
13389 <primary>return code</primary>
13390 <secondary>from <option>run</option> expansion</secondary>
13391 </indexterm>
13392 <indexterm role="concept">
13393 <primary><varname>$value</varname></primary>
13394 </indexterm>
13395 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13396 and replaces the entire item; during this expansion, the standard output/error
13397 from the command is in the variable <varname>$value</varname>. If the command fails,
13398 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
13399 expansion, the standard output/error from the command is in the variable
13400 <varname>$value</varname>.
13401 </para>
13402 <para revisionflag="changed">
13403 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
13404 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
13405 command does not succeed. If both strings are omitted, the result is contents
13406 of the standard output/error on success, and nothing on failure.
13407 </para>
13408 <para>
13409 <indexterm role="concept">
13410 <primary><varname>$runrc</varname></primary>
13411 </indexterm>
13412 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13413 remains set afterwards, so in a filter file you can do things like this:
13414 </para>
13415 <literallayout class="monospaced">
13416 if "${run{x y z}{}}$runrc" is 1 then ...
13417   elif $runrc is 2 then ...
13418   ...
13419 endif
13420 </literallayout>
13421 <para>
13422 If execution of the command fails (for example, the command does not exist),
13423 the return code is 127 &ndash; the same code that shells use for non-existent
13424 commands.
13425 </para>
13426 <para>
13427 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13428 option values are expanded, except for those preconditions whose order of
13429 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13430 by the expansion of one option, and use it in another.
13431 </para>
13432 <para>
13433 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13434 out the use of this expansion item in filter files.
13435 </para>
13436 </listitem></varlistentry>
13437 <varlistentry>
13438 <term><emphasis role="bold">${sg{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>regex</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>replacement</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13439 <listitem>
13440 <para>
13441 <indexterm role="concept">
13442 <primary>expansion</primary>
13443 <secondary>string substitution</secondary>
13444 </indexterm>
13445 <indexterm role="concept">
13446 <primary><option>sg</option> expansion item</primary>
13447 </indexterm>
13448 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13449 option; hence its name. However, unlike the Perl equivalent, Exim does not
13450 modify the subject string; instead it returns the modified string for insertion
13451 into the overall expansion. The item takes three arguments: the subject string,
13452 a regular expression, and a substitution string. For example:
13453 </para>
13454 <literallayout class="monospaced">
13455 ${sg{abcdefabcdef}{abc}{xyz}}
13456 </literallayout>
13457 <para>
13458 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13459 if any $ or \ characters are required in the regular expression or in the
13460 substitution string, they have to be escaped. For example:
13461 </para>
13462 <literallayout class="monospaced">
13463 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13464 </literallayout>
13465 <para>
13466 yields <quote>defabc</quote>, and
13467 </para>
13468 <literallayout class="monospaced">
13469 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13470 </literallayout>
13471 <para>
13472 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13473 the regular expression from string expansion.
13474 </para>
13475 </listitem></varlistentry>
13476 <varlistentry>
13477 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string3</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13478 <listitem>
13479 <para>
13480 <indexterm role="concept">
13481 <primary><option>substr</option></primary>
13482 </indexterm>
13483 <indexterm role="concept">
13484 <primary>substring extraction</primary>
13485 </indexterm>
13486 <indexterm role="concept">
13487 <primary>expansion</primary>
13488 <secondary>substring extraction</secondary>
13489 </indexterm>
13490 The three strings are expanded; the first two must yield numbers. Call them
13491 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13492 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13493 can use the simpler operator notation that avoids some of the braces:
13494 </para>
13495 <literallayout class="monospaced">
13496 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13497 </literallayout>
13498 <para>
13499 The second number is optional (in both notations).
13500 If it is absent in the simpler format, the preceding underscore must also be
13501 omitted.
13502 </para>
13503 <para>
13504 The <option>substr</option> item can be used to extract more general substrings than
13505 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13506 length required. For example
13507 </para>
13508 <literallayout class="monospaced">
13509 ${substr{3}{2}{$local_part}}
13510 </literallayout>
13511 <para>
13512 If the starting offset is greater than the string length the result is the
13513 null string; if the length plus starting offset is greater than the string
13514 length, the result is the right-hand part of the string, starting from the
13515 given offset. The first character in the string has offset zero.
13516 </para>
13517 <para>
13518 The <option>substr</option> expansion item can take negative offset values to count
13519 from the right-hand end of its operand. The last character is offset -1, the
13520 second-last is offset -2, and so on. Thus, for example,
13521 </para>
13522 <literallayout class="monospaced">
13523 ${substr{-5}{2}{1234567}}
13524 </literallayout>
13525 <para>
13526 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13527 length of the string, the substring starts at the beginning of the string, and
13528 the length is reduced by the amount of overshoot. Thus, for example,
13529 </para>
13530 <literallayout class="monospaced">
13531 ${substr{-5}{2}{12}}
13532 </literallayout>
13533 <para>
13534 yields an empty string, but
13535 </para>
13536 <literallayout class="monospaced">
13537 ${substr{-3}{2}{12}}
13538 </literallayout>
13539 <para>
13540 yields <quote>1</quote>.
13541 </para>
13542 <para>
13543 When the second number is omitted from <option>substr</option>, the remainder of the string
13544 is taken if the offset is positive. If it is negative, all characters in the
13545 string preceding the offset point are taken. For example, an offset of -1 and
13546 no length, as in these semantically identical examples:
13547 </para>
13548 <literallayout class="monospaced">
13549 ${substr_-1:abcde}
13550 ${substr{-1}{abcde}}
13551 </literallayout>
13552 <para>
13553 yields all but the last character of the string, that is, <quote>abcd</quote>.
13554 </para>
13555 </listitem></varlistentry>
13556 <varlistentry>
13557 <term><emphasis role="bold">${tr{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>characters</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>replacements</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
13558 <listitem>
13559 <para>
13560 <indexterm role="concept">
13561 <primary>expansion</primary>
13562 <secondary>character translation</secondary>
13563 </indexterm>
13564 <indexterm role="concept">
13565 <primary><option>tr</option> expansion item</primary>
13566 </indexterm>
13567 This item does single-character translation on its subject string. The second
13568 argument is a list of characters to be translated in the subject string. Each
13569 matching character is replaced by the corresponding character from the
13570 replacement list. For example
13571 </para>
13572 <literallayout class="monospaced">
13573 ${tr{abcdea}{ac}{13}}
13574 </literallayout>
13575 <para>
13576 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13577 last occurrence is used. If the third string is shorter than the second, its
13578 last character is replicated. However, if it is empty, no translation takes
13579 place.
13580 </para>
13581 </listitem></varlistentry>
13582 </variablelist>
13583 </section>
13584 <section id="SECTexpop">
13585 <title>Expansion operators</title>
13586 <para>
13587 <indexterm role="concept">
13588 <primary>expansion</primary>
13589 <secondary>operators</secondary>
13590 </indexterm>
13591 For expansion items that perform transformations on a single argument string,
13592 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13593 The substring is first expanded before the operation is applied to it. The
13594 following operations can be performed:
13595 </para>
13596 <variablelist>
13597 <varlistentry>
13598 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13599 <listitem>
13600 <para>
13601 <indexterm role="concept">
13602 <primary>expansion</primary>
13603 <secondary>RFC 2822 address handling</secondary>
13604 </indexterm>
13605 <indexterm role="concept">
13606 <primary><option>address</option></primary>
13607 <secondary>expansion item</secondary>
13608 </indexterm>
13609 The string is interpreted as an RFC 2822 address, as it might appear in a
13610 header line, and the effective address is extracted from it. If the string does
13611 not parse successfully, the result is empty.
13612 </para>
13613 </listitem></varlistentry>
13614 <varlistentry>
13615 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13616 <listitem>
13617 <para>
13618 <indexterm role="concept">
13619 <primary><option>base62</option></primary>
13620 </indexterm>
13621 <indexterm role="concept">
13622 <primary>expansion</primary>
13623 <secondary>conversion to base 62</secondary>
13624 </indexterm>
13625 The string must consist entirely of decimal digits. The number is converted to
13626 base 62 and output as a string of six characters, including leading zeros. In
13627 the few operating environments where Exim uses base 36 instead of base 62 for
13628 its message identifiers (because those systems do not have case-sensitive file
13629 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13630 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13631 </para>
13632 </listitem></varlistentry>
13633 <varlistentry>
13634 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13635 <listitem>
13636 <para>
13637 <indexterm role="concept">
13638 <primary><option>base62d</option></primary>
13639 </indexterm>
13640 <indexterm role="concept">
13641 <primary>expansion</primary>
13642 <secondary>conversion to base 62</secondary>
13643 </indexterm>
13644 The string must consist entirely of base-62 digits, or, in operating
13645 environments where Exim uses base 36 instead of base 62 for its message
13646 identifiers, base-36 digits. The number is converted to decimal and output as a
13647 string.
13648 </para>
13649 </listitem></varlistentry>
13650 <varlistentry>
13651 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13652 <listitem>
13653 <para>
13654 <indexterm role="concept">
13655 <primary>domain</primary>
13656 <secondary>extraction</secondary>
13657 </indexterm>
13658 <indexterm role="concept">
13659 <primary>expansion</primary>
13660 <secondary>domain extraction</secondary>
13661 </indexterm>
13662 The string is interpreted as an RFC 2822 address and the domain is extracted
13663 from it. If the string does not parse successfully, the result is empty.
13664 </para>
13665 </listitem></varlistentry>
13666 <varlistentry>
13667 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13668 <listitem>
13669 <para>
13670 <indexterm role="concept">
13671 <primary>expansion</primary>
13672 <secondary>escaping non-printing characters</secondary>
13673 </indexterm>
13674 <indexterm role="concept">
13675 <primary><option>escape</option>, expansion item</primary>
13676 </indexterm>
13677 If the string contains any non-printing characters, they are converted to
13678 escape sequences starting with a backslash. Whether characters with the most
13679 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13680 is controlled by the <option>print_topbitchars</option> option.
13681 </para>
13682 </listitem></varlistentry>
13683 <varlistentry>
13684 <term><emphasis role="bold">${eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis>&nbsp;and&nbsp;<emphasis role="bold">${eval10:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13685 <listitem>
13686 <para>
13687 <indexterm role="concept">
13688 <primary>expansion</primary>
13689 <secondary>expression evaluation</secondary>
13690 </indexterm>
13691 <indexterm role="concept">
13692 <primary>expansion</primary>
13693 <secondary>arithmetic expression</secondary>
13694 </indexterm>
13695 <indexterm role="concept">
13696 <primary><option>eval</option> expansion item</primary>
13697 </indexterm>
13698 </para>
13699 <para revisionflag="changed">
13700 These items supports simple arithmetic and bitwise logical operations in
13701 expansion strings. The string (after expansion) must be a conventional
13702 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
13703 logical operators, and parentheses. All operations are carried out using
13704 integer arithmetic. The operator priorities are as follows (the same as in the
13705 C programming language):
13706 </para>
13707 <informaltable frame="none" revisionflag="changed">
13708 <tgroup cols="2" colsep="0" rowsep="0">
13709 <colspec colwidth="90pt" align="left"/>
13710 <colspec colwidth="300pt" align="left"/>
13711 <tbody>
13712 <row>
13713 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
13714 <entry>not (~), negate (-)</entry>
13715 </row>
13716 <row>
13717 <entry></entry>
13718 <entry>multiply (*), divide (/), remainder (%)</entry>
13719 </row>
13720 <row>
13721 <entry></entry>
13722 <entry>plus (+), minus (-)</entry>
13723 </row>
13724 <row>
13725 <entry></entry>
13726 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
13727 </row>
13728 <row>
13729 <entry></entry>
13730 <entry>and (&amp;)</entry>
13731 </row>
13732 <row>
13733 <entry></entry>
13734 <entry>xor (^)</entry>
13735 </row>
13736 <row>
13737 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
13738 <entry>or (|)</entry>
13739 </row>
13740 </tbody>
13741 </tgroup>
13742 </informaltable>
13743 <para revisionflag="changed">
13744 Binary operators with the same priority are evaluated from left to right. White
13745 space is permitted before or after operators.
13746 </para>
13747 <para revisionflag="changed">
13748 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13749 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13750 decimal, even if they start with a leading zero; hexadecimal numbers are not
13751 permitted. This can be useful when processing numbers extracted from dates or
13752 times, which often do have leading zeros.
13753 </para>
13754 <para revisionflag="changed">
13755 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13756 respectively. Negative numbers are supported. The result of the computation is
13757 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13758 </para>
13759 <literallayout revisionflag="changed">
13760 <literal>${eval:1+1}            </literal>  yields 2
13761 <literal>${eval:1+2*3}          </literal>  yields 7
13762 <literal>${eval:(1+2)*3}        </literal>  yields 9
13763 <literal>${eval:2+42%5}         </literal>  yields 4
13764 <literal>${eval:0xc&amp;5}          </literal>  yields 4
13765 <literal>${eval:0xc|5}          </literal>  yields 13
13766 <literal>${eval:0xc^5}          </literal>  yields 9
13767 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
13768 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
13769 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
13770 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
13771 </literallayout>
13772 <para>
13773 As a more realistic example, in an ACL you might have
13774 </para>
13775 <literallayout class="monospaced">
13776 deny   message = Too many bad recipients
13777        condition =                    \
13778          ${if and {                   \
13779            {&gt;{$rcpt_count}{10}}       \
13780            {                          \
13781            &lt;                          \
13782              {$recipients_count}      \
13783              {${eval:$rcpt_count/2}}  \
13784            }                          \
13785          }{yes}{no}}
13786 </literallayout>
13787 <para>
13788 The condition is true if there have been more than 10 RCPT commands and
13789 fewer than half of them have resulted in a valid recipient.
13790 </para>
13791 </listitem></varlistentry>
13792 <varlistentry>
13793 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13794 <listitem>
13795 <para>
13796 <indexterm role="concept">
13797 <primary>expansion</primary>
13798 <secondary>re-expansion of substring</secondary>
13799 </indexterm>
13800 The <option>expand</option> operator causes a string to be expanded for a second time. For
13801 example,
13802 </para>
13803 <literallayout class="monospaced">
13804 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13805 </literallayout>
13806 <para>
13807 first looks up a string in a file while expanding the operand for <option>expand</option>,
13808 and then re-expands what it has found.
13809 </para>
13810 </listitem></varlistentry>
13811 <varlistentry>
13812 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13813 <listitem>
13814 <para>
13815 <indexterm role="concept">
13816 <primary>Unicode</primary>
13817 </indexterm>
13818 <indexterm role="concept">
13819 <primary>UTF-8</primary>
13820 <secondary>conversion from</secondary>
13821 </indexterm>
13822 <indexterm role="concept">
13823 <primary>expansion</primary>
13824 <secondary>UTF-8 conversion</secondary>
13825 </indexterm>
13826 <indexterm role="concept">
13827 <primary><option>from_utf8</option></primary>
13828 </indexterm>
13829 The world is slowly moving towards Unicode, although there are no standards for
13830 email yet. However, other applications (including some databases) are starting
13831 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13832 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13833 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13834 the result is an undefined sequence of bytes.
13835 </para>
13836 <para>
13837 Unicode code points with values less than 256 are compatible with ASCII and
13838 ISO-8859-1 (also known as Latin-1).
13839 For example, character 169 is the copyright symbol in both cases, though the
13840 way it is encoded is different. In UTF-8, more than one byte is needed for
13841 characters with code values greater than 127, whereas ISO-8859-1 is a
13842 single-byte encoding (but thereby limited to 256 characters). This makes
13843 translation from UTF-8 to ISO-8859-1 straightforward.
13844 </para>
13845 </listitem></varlistentry>
13846 <varlistentry>
13847 <term><emphasis role="bold">${hash_</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>m</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13848 <listitem>
13849 <para>
13850 <indexterm role="concept">
13851 <primary>hash function</primary>
13852 <secondary>textual</secondary>
13853 </indexterm>
13854 <indexterm role="concept">
13855 <primary>expansion</primary>
13856 <secondary>textual hash</secondary>
13857 </indexterm>
13858 The <option>hash</option> operator is a simpler interface to the hashing function that can
13859 be used when the two parameters are fixed numbers (as opposed to strings that
13860 change when expanded). The effect is the same as
13861 </para>
13862 <literallayout class="monospaced">
13863 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
13864 </literallayout>
13865 <para>
13866 See the description of the general <option>hash</option> item above for details. The
13867 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
13868 </para>
13869 </listitem></varlistentry>
13870 <varlistentry>
13871 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13872 <listitem>
13873 <para>
13874 <indexterm role="concept">
13875 <primary>base64 encoding</primary>
13876 <secondary>conversion from hex</secondary>
13877 </indexterm>
13878 <indexterm role="concept">
13879 <primary>expansion</primary>
13880 <secondary>hex to base64</secondary>
13881 </indexterm>
13882 <indexterm role="concept">
13883 <primary><option>hex2b64</option></primary>
13884 </indexterm>
13885 This operator converts a hex string into one that is base64 encoded. This can
13886 be useful for processing the output of the MD5 and SHA-1 hashing functions.
13887 </para>
13888 </listitem></varlistentry>
13889 <varlistentry>
13890 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13891 <listitem>
13892 <para>
13893 <indexterm role="concept">
13894 <primary>case forcing in strings</primary>
13895 </indexterm>
13896 <indexterm role="concept">
13897 <primary>string</primary>
13898 <secondary>case forcing</secondary>
13899 </indexterm>
13900 <indexterm role="concept">
13901 <primary>lower casing</primary>
13902 </indexterm>
13903 <indexterm role="concept">
13904 <primary>expansion</primary>
13905 <secondary>case forcing</secondary>
13906 </indexterm>
13907 <indexterm role="concept">
13908 <primary><option>lc</option> expansion item</primary>
13909 </indexterm>
13910 This forces the letters in the string into lower-case, for example:
13911 </para>
13912 <literallayout class="monospaced">
13913 ${lc:$local_part}
13914 </literallayout>
13915 </listitem></varlistentry>
13916 <varlistentry>
13917 <term><emphasis role="bold">${length_</emphasis>&lt;<emphasis>number</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13918 <listitem>
13919 <para>
13920 <indexterm role="concept">
13921 <primary>expansion</primary>
13922 <secondary>string truncation</secondary>
13923 </indexterm>
13924 <indexterm role="concept">
13925 <primary><option>length</option></primary>
13926 <secondary>expansion item</secondary>
13927 </indexterm>
13928 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
13929 can be used when the parameter is a fixed number (as opposed to a string that
13930 changes when expanded). The effect is the same as
13931 </para>
13932 <literallayout class="monospaced">
13933 ${length{&lt;number&gt;}{&lt;string&gt;}}
13934 </literallayout>
13935 <para>
13936 See the description of the general <option>length</option> item above for details. Note that
13937 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
13938 when <option>length</option> is used as an operator.
13939 </para>
13940 </listitem></varlistentry>
13941 <varlistentry>
13942 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13943 <listitem>
13944 <para>
13945 <indexterm role="concept">
13946 <primary>expansion</primary>
13947 <secondary>local part extraction</secondary>
13948 </indexterm>
13949 <indexterm role="concept">
13950 <primary><option>local_part</option> expansion item</primary>
13951 </indexterm>
13952 The string is interpreted as an RFC 2822 address and the local part is
13953 extracted from it. If the string does not parse successfully, the result is
13954 empty.
13955 </para>
13956 </listitem></varlistentry>
13957 <varlistentry>
13958 <term><emphasis role="bold">${mask:</emphasis>&lt;<emphasis>IP&nbsp;address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>bit&nbsp;count</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13959 <listitem>
13960 <para>
13961 <indexterm role="concept">
13962 <primary>masked IP address</primary>
13963 </indexterm>
13964 <indexterm role="concept">
13965 <primary>IP address</primary>
13966 <secondary>masking</secondary>
13967 </indexterm>
13968 <indexterm role="concept">
13969 <primary>CIDR notation</primary>
13970 </indexterm>
13971 <indexterm role="concept">
13972 <primary>expansion</primary>
13973 <secondary>IP address masking</secondary>
13974 </indexterm>
13975 <indexterm role="concept">
13976 <primary><option>mask</option>, expansion item</primary>
13977 </indexterm>
13978 If the form of the string to be operated on is not an IP address followed by a
13979 slash and an integer (that is, a network address in CIDR notation), the
13980 expansion fails. Otherwise, this operator converts the IP address to binary,
13981 masks off the least significant bits according to the bit count, and converts
13982 the result back to text, with mask appended. For example,
13983 </para>
13984 <literallayout class="monospaced">
13985 ${mask:10.111.131.206/28}
13986 </literallayout>
13987 <para>
13988 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
13989 be mostly used for looking up masked addresses in files, the result for an IPv6
13990 address uses dots to separate components instead of colons, because colon
13991 terminates a key string in lsearch files. So, for example,
13992 </para>
13993 <literallayout class="monospaced">
13994 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
13995 </literallayout>
13996 <para>
13997 returns the string
13998 </para>
13999 <literallayout class="monospaced">
14000 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
14001 </literallayout>
14002 <para>
14003 Letters in IPv6 addresses are always output in lower case.
14004 </para>
14005 </listitem></varlistentry>
14006 <varlistentry>
14007 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14008 <listitem>
14009 <para>
14010 <indexterm role="concept">
14011 <primary>MD5 hash</primary>
14012 </indexterm>
14013 <indexterm role="concept">
14014 <primary>expansion</primary>
14015 <secondary>MD5 hash</secondary>
14016 </indexterm>
14017 <indexterm role="concept">
14018 <primary><option>md5</option> expansion item</primary>
14019 </indexterm>
14020 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
14021 as a 32-digit hexadecimal number, in which any letters are in lower case.
14022 </para>
14023 </listitem></varlistentry>
14024 <varlistentry>
14025 <term><emphasis role="bold">${nhash_</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>m</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14026 <listitem>
14027 <para>
14028 <indexterm role="concept">
14029 <primary>expansion</primary>
14030 <secondary>numeric hash</secondary>
14031 </indexterm>
14032 <indexterm role="concept">
14033 <primary>hash function</primary>
14034 <secondary>numeric</secondary>
14035 </indexterm>
14036 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
14037 that can be used when the two parameters are fixed numbers (as opposed to
14038 strings that change when expanded). The effect is the same as
14039 </para>
14040 <literallayout class="monospaced">
14041 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
14042 </literallayout>
14043 <para>
14044 See the description of the general <option>nhash</option> item above for details.
14045 </para>
14046 </listitem></varlistentry>
14047 <varlistentry>
14048 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14049 <listitem>
14050 <para>
14051 <indexterm role="concept">
14052 <primary>quoting</primary>
14053 <secondary>in string expansions</secondary>
14054 </indexterm>
14055 <indexterm role="concept">
14056 <primary>expansion</primary>
14057 <secondary>quoting</secondary>
14058 </indexterm>
14059 <indexterm role="concept">
14060 <primary><option>quote</option>, expansion item</primary>
14061 </indexterm>
14062 The <option>quote</option> operator puts its argument into double quotes if it
14063 is an empty string or
14064 contains anything other than letters, digits, underscores, dots, and hyphens.
14065 Any occurrences of double quotes and backslashes are escaped with a backslash.
14066 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
14067 respectively For example,
14068 </para>
14069 <literallayout class="monospaced">
14070 ${quote:ab"*"cd}
14071 </literallayout>
14072 <para>
14073 becomes
14074 </para>
14075 <literallayout class="monospaced">
14076 "ab\"*\"cd"
14077 </literallayout>
14078 <para>
14079 The place where this is useful is when the argument is a substitution from a
14080 variable or a message header.
14081 </para>
14082 </listitem></varlistentry>
14083 <varlistentry>
14084 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14085 <listitem>
14086 <para>
14087 <indexterm role="concept">
14088 <primary><option>quote_local_part</option> expansion item</primary>
14089 </indexterm>
14090 This operator is like <option>quote</option>, except that it quotes the string only if
14091 required to do so by the rules of RFC 2822 for quoting local parts. For
14092 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
14093 If you are creating a new email address from the contents of <varname>$local_part</varname>
14094 (or any other unknown data), you should always use this operator.
14095 </para>
14096 </listitem></varlistentry>
14097 <varlistentry>
14098 <term><emphasis role="bold">${quote_</emphasis>&lt;<emphasis>lookup-type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14099 <listitem>
14100 <para>
14101 <indexterm role="concept">
14102 <primary>quoting</primary>
14103 <secondary>lookup-specific</secondary>
14104 </indexterm>
14105 This operator applies lookup-specific quoting rules to the string. Each
14106 query-style lookup type has its own quoting rules which are described with
14107 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
14108 </para>
14109 <literallayout class="monospaced">
14110 ${quote_ldap:two * two}
14111 </literallayout>
14112 <para>
14113 returns
14114 </para>
14115 <literallayout class="monospaced">
14116 two%20%5C2A%20two
14117 </literallayout>
14118 <para>
14119 For single-key lookup types, no quoting is ever necessary and this operator
14120 yields an unchanged string.
14121 </para>
14122 </listitem></varlistentry>
14123 <varlistentry>
14124 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14125 <listitem>
14126 <para>
14127 <indexterm role="concept">
14128 <primary>expansion</primary>
14129 <secondary>RFC 2047</secondary>
14130 </indexterm>
14131 <indexterm role="concept">
14132 <primary>RFC 2047</primary>
14133 <secondary>expansion operator</secondary>
14134 </indexterm>
14135 <indexterm role="concept">
14136 <primary><option>rfc2047</option> expansion item</primary>
14137 </indexterm>
14138 This operator encodes text according to the rules of RFC 2047. This is an
14139 encoding that is used in header lines to encode non-ASCII characters. It is
14140 assumed that the input string is in the encoding specified by the
14141 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
14142 contains only characters in the range 33&ndash;126, and no instances of the
14143 characters
14144 </para>
14145 <literallayout class="monospaced">
14146 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
14147 </literallayout>
14148 <para>
14149 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
14150 string, using as many <quote>encoded words</quote> as necessary to encode all the
14151 characters.
14152 </para>
14153 </listitem></varlistentry>
14154 <varlistentry>
14155 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14156 <listitem>
14157 <para>
14158 <indexterm role="concept">
14159 <primary>quoting</primary>
14160 <secondary>in regular expressions</secondary>
14161 </indexterm>
14162 <indexterm role="concept">
14163 <primary>regular expressions</primary>
14164 <secondary>quoting</secondary>
14165 </indexterm>
14166 <indexterm role="concept">
14167 <primary><option>rxquote</option> expansion item</primary>
14168 </indexterm>
14169 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14170 characters in its argument. This is useful when substituting the values of
14171 variables or headers inside regular expressions.
14172 </para>
14173 </listitem></varlistentry>
14174 <varlistentry>
14175 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14176 <listitem>
14177 <para>
14178 <indexterm role="concept">
14179 <primary>SHA-1 hash</primary>
14180 </indexterm>
14181 <indexterm role="concept">
14182 <primary>expansion</primary>
14183 <secondary>SHA-1 hashing</secondary>
14184 </indexterm>
14185 <indexterm role="concept">
14186 <primary><option>sha2</option> expansion item</primary>
14187 </indexterm>
14188 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14189 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14190 </para>
14191 </listitem></varlistentry>
14192 <varlistentry>
14193 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14194 <listitem>
14195 <para>
14196 <indexterm role="concept">
14197 <primary>expansion</primary>
14198 <secondary>statting a file</secondary>
14199 </indexterm>
14200 <indexterm role="concept">
14201 <primary>file</primary>
14202 <secondary>extracting characteristics</secondary>
14203 </indexterm>
14204 <indexterm role="concept">
14205 <primary><option>stat</option> expansion item</primary>
14206 </indexterm>
14207 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14208 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14209 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14210 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14211 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14212 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14213 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14214 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14215 can extract individual fields using the <option>extract</option> expansion item.
14216 </para>
14217 <para>
14218 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14219 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14220 systems for files larger than 2GB.
14221 </para>
14222 </listitem></varlistentry>
14223 <varlistentry>
14224 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14225 <listitem>
14226 <para>
14227 <indexterm role="concept">
14228 <primary>expansion</primary>
14229 <secondary>base64 encoding</secondary>
14230 </indexterm>
14231 <indexterm role="concept">
14232 <primary>base64 encoding</primary>
14233 <secondary>in string expansion</secondary>
14234 </indexterm>
14235 <indexterm role="concept">
14236 <primary><option>str2b64</option> expansion item</primary>
14237 </indexterm>
14238 This operator converts a string into one that is base64 encoded.
14239 </para>
14240 </listitem></varlistentry>
14241 <varlistentry>
14242 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14243 <listitem>
14244 <para>
14245 <indexterm role="concept">
14246 <primary>expansion</primary>
14247 <secondary>string length</secondary>
14248 </indexterm>
14249 <indexterm role="concept">
14250 <primary>string</primary>
14251 <secondary>length in expansion</secondary>
14252 </indexterm>
14253 <indexterm role="concept">
14254 <primary><option>strlen</option> expansion item</primary>
14255 </indexterm>
14256 The item is replace by the length of the expanded string, expressed as a
14257 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14258 </para>
14259 </listitem></varlistentry>
14260 <varlistentry>
14261 <term><emphasis role="bold">${substr_</emphasis>&lt;<emphasis>start</emphasis>&gt;<emphasis role="bold">_</emphasis>&lt;<emphasis>length</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14262 <listitem>
14263 <para>
14264 <indexterm role="concept">
14265 <primary><option>substr</option> expansion item</primary>
14266 </indexterm>
14267 <indexterm role="concept">
14268 <primary>substring extraction</primary>
14269 </indexterm>
14270 <indexterm role="concept">
14271 <primary>expansion</primary>
14272 <secondary>substring expansion</secondary>
14273 </indexterm>
14274 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14275 can be used when the two parameters are fixed numbers (as opposed to strings
14276 that change when expanded). The effect is the same as
14277 </para>
14278 <literallayout class="monospaced">
14279 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14280 </literallayout>
14281 <para>
14282 See the description of the general <option>substr</option> item above for details. The
14283 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14284 </para>
14285 </listitem></varlistentry>
14286 <varlistentry>
14287 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14288 <listitem>
14289 <para>
14290 <indexterm role="concept">
14291 <primary><option>time_eval</option> expansion item</primary>
14292 </indexterm>
14293 <indexterm role="concept">
14294 <primary>time interval</primary>
14295 <secondary>decoding</secondary>
14296 </indexterm>
14297 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14298 seconds.
14299 </para>
14300 </listitem></varlistentry>
14301 <varlistentry>
14302 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14303 <listitem>
14304 <para>
14305 <indexterm role="concept">
14306 <primary><option>time_interval</option> expansion item</primary>
14307 </indexterm>
14308 <indexterm role="concept">
14309 <primary>time interval</primary>
14310 <secondary>formatting</secondary>
14311 </indexterm>
14312 The argument (after sub-expansion) must be a sequence of decimal digits that
14313 represents an interval of time as a number of seconds. It is converted into a
14314 number of larger units and output in Exim&#x2019;s normal time format, for example,
14315 <literal>1w3d4h2m6s</literal>.
14316 </para>
14317 </listitem></varlistentry>
14318 <varlistentry>
14319 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14320 <listitem>
14321 <para>
14322 <indexterm role="concept">
14323 <primary>case forcing in strings</primary>
14324 </indexterm>
14325 <indexterm role="concept">
14326 <primary>string</primary>
14327 <secondary>case forcing</secondary>
14328 </indexterm>
14329 <indexterm role="concept">
14330 <primary>upper casing</primary>
14331 </indexterm>
14332 <indexterm role="concept">
14333 <primary>expansion</primary>
14334 <secondary>case forcing</secondary>
14335 </indexterm>
14336 <indexterm role="concept">
14337 <primary><option>uc</option> expansion item</primary>
14338 </indexterm>
14339 This forces the letters in the string into upper-case.
14340 </para>
14341 </listitem></varlistentry>
14342 </variablelist>
14343 </section>
14344 <section id="SECTexpcond">
14345 <title>Expansion conditions</title>
14346 <para>
14347 <indexterm role="concept" id="IIDexpcond" class="startofrange">
14348 <primary>expansion</primary>
14349 <secondary>conditions</secondary>
14350 </indexterm>
14351 The following conditions are available for testing by the <option>${if</option> construct
14352 while expanding strings:
14353 </para>
14354 <variablelist>
14355 <varlistentry>
14356 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14357 <listitem>
14358 <para>
14359 <indexterm role="concept">
14360 <primary>expansion</primary>
14361 <secondary>negating a condition</secondary>
14362 </indexterm>
14363 <indexterm role="concept">
14364 <primary>negation</primary>
14365 <secondary>in expansion condition</secondary>
14366 </indexterm>
14367 Preceding any condition with an exclamation mark negates the result of the
14368 condition.
14369 </para>
14370 </listitem></varlistentry>
14371 <varlistentry>
14372 <term>&lt;<emphasis>symbolic&nbsp;operator</emphasis>&gt;&nbsp;<emphasis role="bold">{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14373 <listitem>
14374 <para>
14375 <indexterm role="concept">
14376 <primary>numeric comparison</primary>
14377 </indexterm>
14378 <indexterm role="concept">
14379 <primary>expansion</primary>
14380 <secondary>numeric comparison</secondary>
14381 </indexterm>
14382 There are a number of symbolic operators for doing numeric comparisons. They
14383 are:
14384 </para>
14385 <literallayout>
14386 <literal>=   </literal>   equal
14387 <literal>==  </literal>   equal
14388 <literal>&gt;   </literal>   greater
14389 <literal>&gt;=  </literal>   greater or equal
14390 <literal>&lt;   </literal>   less
14391 <literal>&lt;=  </literal>   less or equal
14392 </literallayout>
14393 <para>
14394 For example:
14395 </para>
14396 <literallayout class="monospaced">
14397 ${if &gt;{$message_size}{10M} ...
14398 </literallayout>
14399 <para>
14400 Note that the general negation operator provides for inequality testing. The
14401 two strings must take the form of optionally signed decimal integers,
14402 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14403 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14404 </para>
14405 </listitem></varlistentry>
14406 <varlistentry>
14407 <term><emphasis role="bold">crypteq&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14408 <listitem>
14409 <para>
14410 <indexterm role="concept">
14411 <primary>expansion</primary>
14412 <secondary>encrypted comparison</secondary>
14413 </indexterm>
14414 <indexterm role="concept">
14415 <primary>encrypted strings</primary>
14416 <secondary>comparing</secondary>
14417 </indexterm>
14418 <indexterm role="concept">
14419 <primary><option>crypteq</option> expansion condition</primary>
14420 </indexterm>
14421 This condition is included in the Exim binary if it is built to support any
14422 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14423 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14424 included in the binary.
14425 </para>
14426 <para>
14427 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14428 compared against the second, which is already encrypted. The second string may
14429 be in the LDAP form for storing encrypted strings, which starts with the
14430 encryption type in curly brackets, followed by the data. If the second string
14431 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14432 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14433 Typically this will be a field from a password file. An example of an encrypted
14434 string in LDAP form is:
14435 </para>
14436 <literallayout class="monospaced">
14437 {md5}CY9rzUYh03PK3k6DJie09g==
14438 </literallayout>
14439 <para>
14440 If such a string appears directly in an expansion, the curly brackets have to
14441 be quoted, because they are part of the expansion syntax. For example:
14442 </para>
14443 <literallayout class="monospaced">
14444 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14445 </literallayout>
14446 <para>
14447 The following encryption types (whose names are matched case-independently) are
14448 supported:
14449 </para>
14450 <itemizedlist>
14451 <listitem>
14452 <para>
14453 <indexterm role="concept">
14454 <primary>MD5 hash</primary>
14455 </indexterm>
14456 <indexterm role="concept">
14457 <primary>base64 encoding</primary>
14458 <secondary>in encrypted password</secondary>
14459 </indexterm>
14460 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14461 printable characters to compare with the remainder of the second string. If the
14462 length of the comparison string is 24, Exim assumes that it is base64 encoded
14463 (as in the above example). If the length is 32, Exim assumes that it is a
14464 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14465 comparison fails.
14466 </para>
14467 </listitem>
14468 <listitem>
14469 <para>
14470 <indexterm role="concept">
14471 <primary>SHA-1 hash</primary>
14472 </indexterm>
14473 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14474 printable characters to compare with the remainder of the second string. If the
14475 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14476 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14477 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14478 </para>
14479 </listitem>
14480 <listitem>
14481 <para>
14482 <indexterm role="concept">
14483 <primary><function>crypt()</function></primary>
14484 </indexterm>
14485 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14486 only the first eight characters of the password. However, in modern operating
14487 systems this is no longer true, and in many cases the entire password is used,
14488 whatever its length.
14489 </para>
14490 </listitem>
14491 <listitem>
14492 <para revisionflag="changed">
14493 <indexterm role="concept">
14494 <primary><function>crypt16()</function></primary>
14495 </indexterm>
14496 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was orginally created to
14497 use up to 16 characters of the password in some operating systems. Again, in
14498 modern operating systems, more characters may be used.
14499 </para>
14500 </listitem>
14501 </itemizedlist>
14502 <para revisionflag="changed">
14503 Exim has its own version of <function>crypt16()</function>, which is just a double call to
14504 <function>crypt()</function>. For operating systems that have their own version, setting
14505 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14506 operating system version instead of its own. This option is set by default in
14507 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14508 support <function>crypt16()</function>.
14509 </para>
14510 <para revisionflag="changed">
14511 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
14512 it was not using the same algorithm as some operating systems&#x2019; versions. It
14513 turns out that as well as <function>crypt16()</function> there is a function called
14514 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
14515 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
14516 </para>
14517 <para revisionflag="changed">
14518 However, since there is now a move away from the traditional <function>crypt()</function>
14519 functions towards using SHA1 and other algorithms, tidying up this area of
14520 Exim is seen as very low priority.
14521 </para>
14522 <para revisionflag="changed">
14523 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
14524 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
14525 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
14526 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
14527 function by specifying it explicitly in curly brackets.
14528 </para>
14529 </listitem></varlistentry>
14530 <varlistentry>
14531 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14532 <listitem>
14533 <para>
14534 <indexterm role="concept">
14535 <primary>expansion</primary>
14536 <secondary>checking for empty variable</secondary>
14537 </indexterm>
14538 <indexterm role="concept">
14539 <primary><option>def</option> expansion condition</primary>
14540 </indexterm>
14541 The <option>def</option> condition must be followed by the name of one of the expansion
14542 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14543 variable does not contain the empty string. For example:
14544 </para>
14545 <literallayout class="monospaced">
14546 ${if def:sender_ident {from $sender_ident}}
14547 </literallayout>
14548 <para>
14549 Note that the variable name is given without a leading <option>$</option> character. If the
14550 variable does not exist, the expansion fails.
14551 </para>
14552 </listitem></varlistentry>
14553 <varlistentry>
14554 <term><emphasis role="bold">def:header_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis>&nbsp;&nbsp;or&nbsp;&nbsp;<emphasis role="bold">def:h_</emphasis>&lt;<emphasis>header&nbsp;name</emphasis>&gt;<emphasis role="bold">:</emphasis></term>
14555 <listitem>
14556 <para>
14557 <indexterm role="concept">
14558 <primary>expansion</primary>
14559 <secondary>checking header line existence</secondary>
14560 </indexterm>
14561 This condition is true if a message is being processed and the named header
14562 exists in the message. For example,
14563 </para>
14564 <literallayout class="monospaced">
14565 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14566 </literallayout>
14567 <para>
14568 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14569 the header name must be terminated by a colon if white space does not follow.
14570 </para>
14571 </listitem></varlistentry>
14572 <varlistentry>
14573 <term><emphasis role="bold">eq&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14574 <listitem>
14575 <para>
14576 <indexterm role="concept">
14577 <primary>string</primary>
14578 <secondary>comparison</secondary>
14579 </indexterm>
14580 <indexterm role="concept">
14581 <primary>expansion</primary>
14582 <secondary>string comparison</secondary>
14583 </indexterm>
14584 <indexterm role="concept">
14585 <primary><option>eq</option> expansion condition</primary>
14586 </indexterm>
14587 The two substrings are first expanded. The condition is true if the two
14588 resulting strings are identical, including the case of letters.
14589 </para>
14590 </listitem></varlistentry>
14591 <varlistentry>
14592 <term><emphasis role="bold">eqi&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14593 <listitem>
14594 <para>
14595 <indexterm role="concept">
14596 <primary>string</primary>
14597 <secondary>comparison</secondary>
14598 </indexterm>
14599 <indexterm role="concept">
14600 <primary>expansion</primary>
14601 <secondary>string comparison</secondary>
14602 </indexterm>
14603 <indexterm role="concept">
14604 <primary><option>eqi</option> expansion condition</primary>
14605 </indexterm>
14606 The two substrings are first expanded. The condition is true if the two
14607 resulting strings are identical when compared in a case-independent way.
14608 </para>
14609 </listitem></varlistentry>
14610 <varlistentry>
14611 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14612 <listitem>
14613 <para>
14614 <indexterm role="concept">
14615 <primary>expansion</primary>
14616 <secondary>file existence test</secondary>
14617 </indexterm>
14618 <indexterm role="concept">
14619 <primary>file</primary>
14620 <secondary>existence test</secondary>
14621 </indexterm>
14622 <indexterm role="concept">
14623 <primary><option>exists</option>, expansion condition</primary>
14624 </indexterm>
14625 The substring is first expanded and then interpreted as an absolute path. The
14626 condition is true if the named file (or directory) exists. The existence test
14627 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14628 users&#x2019; filter files may be locked out by the system administrator.
14629 </para>
14630 </listitem></varlistentry>
14631 <varlistentry>
14632 <term><emphasis role="bold">first_delivery</emphasis></term>
14633 <listitem>
14634 <para>
14635 <indexterm role="concept">
14636 <primary>delivery</primary>
14637 <secondary>first</secondary>
14638 </indexterm>
14639 <indexterm role="concept">
14640 <primary>first delivery</primary>
14641 </indexterm>
14642 <indexterm role="concept">
14643 <primary>expansion</primary>
14644 <secondary>first delivery test</secondary>
14645 </indexterm>
14646 <indexterm role="concept">
14647 <primary><option>first_delivery</option> expansion condition</primary>
14648 </indexterm>
14649 This condition, which has no data, is true during a message&#x2019;s first delivery
14650 attempt. It is false during any subsequent delivery attempts.
14651 </para>
14652 </listitem></varlistentry>
14653 <varlistentry>
14654 <term><emphasis role="bold">ge&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14655 <listitem>
14656 <para>
14657 <indexterm role="concept">
14658 <primary><option>ge</option> expansion condition</primary>
14659 </indexterm>
14660 See <emphasis role="bold">gei</emphasis>.
14661 </para>
14662 </listitem></varlistentry>
14663 <varlistentry>
14664 <term><emphasis role="bold">gei&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14665 <listitem>
14666 <para>
14667 <indexterm role="concept">
14668 <primary>string</primary>
14669 <secondary>comparison</secondary>
14670 </indexterm>
14671 <indexterm role="concept">
14672 <primary>expansion</primary>
14673 <secondary>string comparison</secondary>
14674 </indexterm>
14675 <indexterm role="concept">
14676 <primary><option>gei</option> expansion condition</primary>
14677 </indexterm>
14678 The two substrings are first expanded. The condition is true if the first
14679 string is lexically greater than or equal to the second string: for <option>ge</option> the
14680 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14681 case-independent.
14682 </para>
14683 </listitem></varlistentry>
14684 <varlistentry>
14685 <term><emphasis role="bold">gt&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14686 <listitem>
14687 <para>
14688 <indexterm role="concept">
14689 <primary><option>gt</option> expansion condition</primary>
14690 </indexterm>
14691 See <emphasis role="bold">gti</emphasis>.
14692 </para>
14693 </listitem></varlistentry>
14694 <varlistentry>
14695 <term><emphasis role="bold">gti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14696 <listitem>
14697 <para>
14698 <indexterm role="concept">
14699 <primary>string</primary>
14700 <secondary>comparison</secondary>
14701 </indexterm>
14702 <indexterm role="concept">
14703 <primary>expansion</primary>
14704 <secondary>string comparison</secondary>
14705 </indexterm>
14706 <indexterm role="concept">
14707 <primary><option>gti</option> expansion condition</primary>
14708 </indexterm>
14709 The two substrings are first expanded. The condition is true if the first
14710 string is lexically greater than the second string: for <option>gt</option> the comparison
14711 includes the case of letters, whereas for <option>gti</option> the comparison is
14712 case-independent.
14713 </para>
14714 </listitem></varlistentry>
14715 <varlistentry>
14716 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14717 <listitem>
14718 <para>
14719 <indexterm role="concept">
14720 <primary><option>isip</option> expansion condition</primary>
14721 </indexterm>
14722 See <emphasis role="bold">isip6</emphasis>.
14723 </para>
14724 </listitem></varlistentry>
14725 <varlistentry>
14726 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14727 <listitem>
14728 <para>
14729 <indexterm role="concept">
14730 <primary><option>isip4</option> expansion condition</primary>
14731 </indexterm>
14732 See <emphasis role="bold">isip6</emphasis>.
14733 </para>
14734 </listitem></varlistentry>
14735 <varlistentry>
14736 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14737 <listitem>
14738 <para>
14739 <indexterm role="concept">
14740 <primary>IP address</primary>
14741 <secondary>testing string format</secondary>
14742 </indexterm>
14743 <indexterm role="concept">
14744 <primary>string</primary>
14745 <secondary>testing for IP address</secondary>
14746 </indexterm>
14747 <indexterm role="concept">
14748 <primary><option>isip6</option> expansion condition</primary>
14749 </indexterm>
14750 The substring is first expanded, and then tested to see if it has the form of
14751 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14752 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14753 example, you could use
14754 </para>
14755 <literallayout class="monospaced">
14756 ${if isip4{$sender_host_address}...
14757 </literallayout>
14758 <para>
14759 to test which version of IP an incoming SMTP connection is using.
14760 </para>
14761 </listitem></varlistentry>
14762 <varlistentry>
14763 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14764 <listitem>
14765 <para>
14766 <indexterm role="concept">
14767 <primary>LDAP</primary>
14768 <secondary>use for authentication</secondary>
14769 </indexterm>
14770 <indexterm role="concept">
14771 <primary>expansion</primary>
14772 <secondary>LDAP authentication test</secondary>
14773 </indexterm>
14774 <indexterm role="concept">
14775 <primary><option>ldapauth</option> expansion condition</primary>
14776 </indexterm>
14777 This condition supports user authentication using LDAP. See section
14778 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14779 queries. For this use, the query must contain a user name and password. The
14780 query itself is not used, and can be empty. The condition is true if the
14781 password is not empty, and the user name and password are accepted by the LDAP
14782 server. An empty password is rejected without calling LDAP because LDAP binds
14783 with an empty password are considered anonymous regardless of the username, and
14784 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14785 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14786 this can be used.
14787 </para>
14788 </listitem></varlistentry>
14789 <varlistentry>
14790 <term><emphasis role="bold">le&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14791 <listitem>
14792 <para>
14793 <indexterm role="concept">
14794 <primary><option>le</option> expansion condition</primary>
14795 </indexterm>
14796 See <emphasis role="bold">lei</emphasis>.
14797 </para>
14798 </listitem></varlistentry>
14799 <varlistentry>
14800 <term><emphasis role="bold">lei&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14801 <listitem>
14802 <para>
14803 <indexterm role="concept">
14804 <primary>string</primary>
14805 <secondary>comparison</secondary>
14806 </indexterm>
14807 <indexterm role="concept">
14808 <primary>expansion</primary>
14809 <secondary>string comparison</secondary>
14810 </indexterm>
14811 <indexterm role="concept">
14812 <primary><option>lei</option> expansion condition</primary>
14813 </indexterm>
14814 The two substrings are first expanded. The condition is true if the first
14815 string is lexically less than or equal to the second string: for <option>le</option> the
14816 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14817 case-independent.
14818 </para>
14819 </listitem></varlistentry>
14820 <varlistentry>
14821 <term><emphasis role="bold">lt&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14822 <listitem>
14823 <para>
14824 <indexterm role="concept">
14825 <primary><option>lt</option> expansion condition</primary>
14826 </indexterm>
14827 See <emphasis role="bold">lti</emphasis>.
14828 </para>
14829 </listitem></varlistentry>
14830 <varlistentry>
14831 <term><emphasis role="bold">lti&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14832 <listitem>
14833 <para>
14834 <indexterm role="concept">
14835 <primary>string</primary>
14836 <secondary>comparison</secondary>
14837 </indexterm>
14838 <indexterm role="concept">
14839 <primary>expansion</primary>
14840 <secondary>string comparison</secondary>
14841 </indexterm>
14842 <indexterm role="concept">
14843 <primary><option>lti</option> expansion condition</primary>
14844 </indexterm>
14845 The two substrings are first expanded. The condition is true if the first
14846 string is lexically less than the second string: for <option>lt</option> the comparison
14847 includes the case of letters, whereas for <option>lti</option> the comparison is
14848 case-independent.
14849 </para>
14850 </listitem></varlistentry>
14851 <varlistentry>
14852 <term><emphasis role="bold">match&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14853 <listitem>
14854 <para>
14855 <indexterm role="concept">
14856 <primary>expansion</primary>
14857 <secondary>regular expression comparison</secondary>
14858 </indexterm>
14859 <indexterm role="concept">
14860 <primary>regular expressions</primary>
14861 <secondary>match in expanded string</secondary>
14862 </indexterm>
14863 <indexterm role="concept">
14864 <primary><option>match</option>, expansion condition</primary>
14865 </indexterm>
14866 The two substrings are first expanded. The second is then treated as a regular
14867 expression and applied to the first. Because of the pre-expansion, if the
14868 regular expression contains dollar, or backslash characters, they must be
14869 escaped. Care must also be taken if the regular expression contains braces
14870 (curly brackets). A closing brace must be escaped so that it is not taken as a
14871 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
14872 <literal>\N</literal> feature to disable expansion of the regular expression.
14873 For example,
14874 </para>
14875 <literallayout class="monospaced">
14876 ${if match {$local_part}{\N^\d{3}\N} ...
14877 </literallayout>
14878 <para>
14879 If the whole expansion string is in double quotes, further escaping of
14880 backslashes is also required.
14881 </para>
14882 <para>
14883 The condition is true if the regular expression match succeeds.
14884 The regular expression is not required to begin with a circumflex
14885 metacharacter, but if there is no circumflex, the expression is not anchored,
14886 and it may match anywhere in the subject, not just at the start. If you want
14887 the pattern to match at the end of the subject, you must include the <literal>$</literal>
14888 metacharacter at an appropriate point.
14889 </para>
14890 <para>
14891 <indexterm role="concept">
14892 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14893 <secondary>in <option>if</option> expansion</secondary>
14894 </indexterm>
14895 At the start of an <option>if</option> expansion the values of the numeric variable
14896 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
14897 succeeds causes them to be reset to the substrings of that condition and they
14898 will have these values during the expansion of the success string. At the end
14899 of the <option>if</option> expansion, the previous values are restored. After testing a
14900 combination of conditions using <option>or</option>, the subsequent values of the numeric
14901 variables are those of the condition that succeeded.
14902 </para>
14903 </listitem></varlistentry>
14904 <varlistentry>
14905 <term><emphasis role="bold">match_address&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14906 <listitem>
14907 <para>
14908 <indexterm role="concept">
14909 <primary><option>match_address</option> expansion condition</primary>
14910 </indexterm>
14911 See <emphasis role="bold">match_local_part</emphasis>.
14912 </para>
14913 </listitem></varlistentry>
14914 <varlistentry>
14915 <term><emphasis role="bold">match_domain&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14916 <listitem>
14917 <para>
14918 <indexterm role="concept">
14919 <primary><option>match_domain</option> expansion condition</primary>
14920 </indexterm>
14921 See <emphasis role="bold">match_local_part</emphasis>.
14922 </para>
14923 </listitem></varlistentry>
14924 <varlistentry>
14925 <term><emphasis role="bold">match_ip&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14926 <listitem>
14927 <para>
14928 <indexterm role="concept">
14929 <primary><option>match_ip</option> expansion condition</primary>
14930 </indexterm>
14931 This condition matches an IP address to a list of IP address patterns. It must
14932 be followed by two argument strings. The first (after expansion) must be an IP
14933 address or an empty string. The second (after expansion) is a restricted host
14934 list that can match only an IP address, not a host name. For example:
14935 </para>
14936 <literallayout class="monospaced">
14937 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
14938 </literallayout>
14939 <para>
14940 The specific types of host list item that are permitted in the list are:
14941 </para>
14942 <itemizedlist>
14943 <listitem>
14944 <para>
14945 An IP address, optionally with a CIDR mask.
14946 </para>
14947 </listitem>
14948 <listitem>
14949 <para>
14950 A single asterisk, which matches any IP address.
14951 </para>
14952 </listitem>
14953 <listitem>
14954 <para>
14955 An empty item, which matches only if the IP address is empty. This could be
14956 useful for testing for a locally submitted message or one from specific hosts
14957 in a single test such as
14958 </para>
14959 <literallayout class="monospaced">
14960   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
14961 </literallayout>
14962 <para>
14963 where the first item in the list is the empty string.
14964 </para>
14965 </listitem>
14966 <listitem>
14967 <para>
14968 The item @[] matches any of the local host&#x2019;s interface addresses.
14969 </para>
14970 </listitem>
14971 <listitem>
14972 <para>
14973 Lookups are assumed to be <quote>net-</quote> style lookups, even if <literal>net-</literal> is not
14974 specified. Thus, the following are equivalent:
14975 </para>
14976 <literallayout class="monospaced">
14977   ${if match_ip{$sender_host_address}{lsearch;/some/file}...
14978   ${if match_ip{$sender_host_address}{net-lsearch;/some/file}...
14979 </literallayout>
14980 <para>
14981 You do need to specify the <literal>net-</literal> prefix if you want to specify a
14982 specific address mask, for example, by using <literal>net24-</literal>. However, unless you
14983 are combining a <option>match_ip</option> condition with others, it is usually neater to use
14984 an expansion lookup such as:
14985 </para>
14986 <literallayout class="monospaced">
14987   ${lookup{${mask:$sender_host_address/24}}lsearch{/some/file}...
14988 </literallayout>
14989 </listitem>
14990 </itemizedlist>
14991 <para>
14992 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
14993 </para>
14994 </listitem></varlistentry>
14995 <varlistentry>
14996 <term><emphasis role="bold">match_local_part&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14997 <listitem>
14998 <para>
14999 <indexterm role="concept">
15000 <primary>domain list</primary>
15001 <secondary>in expansion condition</secondary>
15002 </indexterm>
15003 <indexterm role="concept">
15004 <primary>address list</primary>
15005 <secondary>in expansion condition</secondary>
15006 </indexterm>
15007 <indexterm role="concept">
15008 <primary>local part list</primary>
15009 <secondary>in expansion condition</secondary>
15010 </indexterm>
15011 <indexterm role="concept">
15012 <primary><option>match_local_part</option> expansion condition</primary>
15013 </indexterm>
15014 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
15015 possible to test domain, address, and local part lists within expansions. Each
15016 condition requires two arguments: an item and a list to match. A trivial
15017 example is:
15018 </para>
15019 <literallayout class="monospaced">
15020 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
15021 </literallayout>
15022 <para>
15023 In each case, the second argument may contain any of the allowable items for a
15024 list of the appropriate type. Also, because the second argument (after
15025 expansion) is a standard form of list, it is possible to refer to a named list.
15026 Thus, you can use conditions like this:
15027 </para>
15028 <literallayout class="monospaced">
15029 ${if match_domain{$domain}{+local_domains}{...
15030 </literallayout>
15031 <para>
15032 <indexterm role="concept">
15033 <primary><literal>+caseful</literal></primary>
15034 </indexterm>
15035 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
15036 item can be used, as in all address lists, to cause subsequent items to
15037 have their local parts matched casefully. Domains are always matched
15038 caselessly.
15039 </para>
15040 <para>
15041 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
15042 hosts have two identities: a name and an IP address, and it is not clear
15043 how to specify cleanly how such a test would work. However, IP addresses can be
15044 matched using <option>match_ip</option>.
15045 </para>
15046 </listitem></varlistentry>
15047 <varlistentry>
15048 <term><emphasis role="bold">pam&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">:...}</emphasis></term>
15049 <listitem>
15050 <para>
15051 <indexterm role="concept">
15052 <primary>PAM authentication</primary>
15053 </indexterm>
15054 <indexterm role="concept">
15055 <primary>AUTH</primary>
15056 <secondary>with PAM</secondary>
15057 </indexterm>
15058 <indexterm role="concept">
15059 <primary>Solaris</primary>
15060 <secondary>PAM support</secondary>
15061 </indexterm>
15062 <indexterm role="concept">
15063 <primary>expansion</primary>
15064 <secondary>PAM authentication test</secondary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary><option>pam</option> expansion condition</primary>
15068 </indexterm>
15069 <emphasis>Pluggable Authentication Modules</emphasis>
15070 (<emphasis role="bold"><ulink url="http://www.kernel.org/pub/linux/libs/pam/">http://www.kernel.org/pub/linux/libs/pam/</ulink></emphasis>) are a facility that is
15071 available in the latest releases of Solaris and in some GNU/Linux
15072 distributions. The Exim support, which is intended for use in conjunction with
15073 the SMTP AUTH command, is available only if Exim is compiled with
15074 </para>
15075 <literallayout class="monospaced">
15076 SUPPORT_PAM=yes
15077 </literallayout>
15078 <para>
15079 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
15080 in some releases of GNU/Linux <option>-ldl</option> is also needed.
15081 </para>
15082 <para>
15083 The argument string is first expanded, and the result must be a
15084 colon-separated list of strings. Leading and trailing white space is ignored.
15085 The PAM module is initialized with the service name <quote>exim</quote> and the user name
15086 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
15087 The remaining items in the data string are passed over in response to requests
15088 from the authentication function. In the simple case there will only be one
15089 request, for a password, so the data consists of just two strings.
15090 </para>
15091 <para>
15092 There can be problems if any of the strings are permitted to contain colon
15093 characters. In the usual way, these have to be doubled to avoid being taken as
15094 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
15095 item can be used to double any existing colons. For example, the configuration
15096 of a LOGIN authenticator might contain this setting:
15097 </para>
15098 <literallayout class="monospaced">
15099 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
15100 </literallayout>
15101 <para>
15102 For a PLAIN authenticator you could use:
15103 </para>
15104 <literallayout class="monospaced">
15105 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
15106 </literallayout>
15107 <para>
15108 In some operating systems, PAM authentication can be done only from a process
15109 running as root. Since Exim is running as the Exim user when receiving
15110 messages, this means that PAM cannot be used directly in those systems.
15111 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
15112 Linux PAM package is available from <emphasis role="bold"><ulink url="http://www.e-admin.de/pam_exim/">http://www.e-admin.de/pam_exim/</ulink></emphasis>.
15113 The patched module allows one special uid/gid combination, in addition to root,
15114 to authenticate. If you build the patched module to allow the Exim user and
15115 group, PAM can then be used from an Exim authenticator.
15116 </para>
15117 </listitem></varlistentry>
15118 <varlistentry>
15119 <term><emphasis role="bold">pwcheck&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15120 <listitem>
15121 <para>
15122 <indexterm role="concept">
15123 <primary><emphasis>pwcheck</emphasis> daemon</primary>
15124 </indexterm>
15125 <indexterm role="concept">
15126 <primary>Cyrus</primary>
15127 </indexterm>
15128 <indexterm role="concept">
15129 <primary>expansion</primary>
15130 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
15131 </indexterm>
15132 <indexterm role="concept">
15133 <primary><option>pwcheck</option> expansion condition</primary>
15134 </indexterm>
15135 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
15136 This is one way of making it possible for passwords to be checked by a process
15137 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
15138 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
15139 </para>
15140 <para>
15141 The pwcheck support is not included in Exim by default. You need to specify
15142 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15143 building Exim. For example:
15144 </para>
15145 <literallayout class="monospaced">
15146 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
15147 </literallayout>
15148 <para>
15149 You do not need to install the full Cyrus software suite in order to use
15150 the pwcheck daemon. You can compile and install just the daemon alone
15151 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
15152 access to the <filename>/var/pwcheck</filename> directory.
15153 </para>
15154 <para>
15155 The <option>pwcheck</option> condition takes one argument, which must be the user name and
15156 password, separated by a colon. For example, in a LOGIN authenticator
15157 configuration, you might have this:
15158 </para>
15159 <literallayout class="monospaced">
15160 server_condition = ${if pwcheck{$auth1:$auth2}}
15161 </literallayout>
15162 </listitem></varlistentry>
15163 <varlistentry>
15164 <term><emphasis role="bold">queue_running</emphasis></term>
15165 <listitem>
15166 <para>
15167 <indexterm role="concept">
15168 <primary>queue runner</primary>
15169 <secondary>detecting when delivering from</secondary>
15170 </indexterm>
15171 <indexterm role="concept">
15172 <primary>expansion</primary>
15173 <secondary>queue runner test</secondary>
15174 </indexterm>
15175 <indexterm role="concept">
15176 <primary><option>queue_runnint</option> expansion condition</primary>
15177 </indexterm>
15178 This condition, which has no data, is true during delivery attempts that are
15179 initiated by queue runner processes, and false otherwise.
15180 </para>
15181 </listitem></varlistentry>
15182 <varlistentry>
15183 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15184 <listitem>
15185 <para>
15186 <indexterm role="concept">
15187 <primary>Radius</primary>
15188 </indexterm>
15189 <indexterm role="concept">
15190 <primary>expansion</primary>
15191 <secondary>Radius authentication</secondary>
15192 </indexterm>
15193 <indexterm role="concept">
15194 <primary><option>radius</option> expansion condition</primary>
15195 </indexterm>
15196 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15197 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15198 the Radius client configuration file in order to build Exim with Radius
15199 support.
15200 </para>
15201 <para>
15202 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15203 library, using the original API. If you are using release 0.4.0 or later of
15204 this library, you need to set
15205 </para>
15206 <literallayout class="monospaced">
15207 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15208 </literallayout>
15209 <para>
15210 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15211 <option>libradius</option> library that comes with FreeBSD. To do this, set
15212 </para>
15213 <literallayout class="monospaced">
15214 RADIUS_LIB_TYPE=RADLIB
15215 </literallayout>
15216 <para>
15217 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15218 You may also have to supply a suitable setting in EXTRALIBS so that the
15219 Radius library can be found when Exim is linked.
15220 </para>
15221 <para>
15222 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15223 Radius client library, which calls the Radius server. The condition is true if
15224 the authentication is successful. For example:
15225 </para>
15226 <literallayout class="monospaced">
15227 server_condition = ${if radius{&lt;arguments&gt;}}
15228 </literallayout>
15229 </listitem></varlistentry>
15230 <varlistentry>
15231 <term><emphasis role="bold">saslauthd&nbsp;{{</emphasis>&lt;<emphasis>user</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>password</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>service</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>realm</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15232 <listitem>
15233 <para>
15234 <indexterm role="concept">
15235 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15236 </indexterm>
15237 <indexterm role="concept">
15238 <primary>Cyrus</primary>
15239 </indexterm>
15240 <indexterm role="concept">
15241 <primary>expansion</primary>
15242 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15243 </indexterm>
15244 <indexterm role="concept">
15245 <primary><option>saslauthd</option> expansion condition</primary>
15246 </indexterm>
15247 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15248 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15249 Using this daemon is one way of making it possible for passwords to be checked
15250 by a process that is not running as root.
15251 </para>
15252 <para>
15253 The saslauthd support is not included in Exim by default. You need to specify
15254 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15255 building Exim. For example:
15256 </para>
15257 <literallayout class="monospaced">
15258 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15259 </literallayout>
15260 <para>
15261 You do not need to install the full Cyrus software suite in order to use
15262 the saslauthd daemon. You can compile and install just the daemon alone
15263 from the Cyrus SASL library.
15264 </para>
15265 <para>
15266 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15267 two are mandatory. For example:
15268 </para>
15269 <literallayout class="monospaced">
15270 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15271 </literallayout>
15272 <para>
15273 The service and the realm are optional (which is why the arguments are enclosed
15274 in their own set of braces). For details of the meaning of the service and
15275 realm, and how to run the daemon, consult the Cyrus documentation.
15276 </para>
15277 </listitem></varlistentry>
15278 </variablelist>
15279 </section>
15280 <section>
15281 <title>Combining expansion conditions</title>
15282 <para>
15283 <indexterm role="concept">
15284 <primary>expansion</primary>
15285 <secondary>combining conditions</secondary>
15286 </indexterm>
15287 Several conditions can be tested at once by combining them using the <option>and</option>
15288 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15289 conditions on their own, and precede their lists of sub-conditions. Each
15290 sub-condition must be enclosed in braces within the overall braces that contain
15291 the list. No repetition of <option>if</option> is used.
15292 </para>
15293 <variablelist>
15294 <varlistentry>
15295 <term><emphasis role="bold">or&nbsp;{{</emphasis>&lt;<emphasis>cond1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>cond2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
15296 <listitem>
15297 <para>
15298 <indexterm role="concept">
15299 <primary><quote>or</quote> expansion condition</primary>
15300 </indexterm>
15301 <indexterm role="concept">
15302 <primary>expansion</primary>
15303 <secondary><quote>or</quote> of conditions</secondary>
15304 </indexterm>
15305 The sub-conditions are evaluated from left to right. The condition is true if
15306 any one of the sub-conditions is true.
15307 For example,
15308 </para>
15309 <literallayout class="monospaced">
15310 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15311 </literallayout>
15312 <para>
15313 When a true sub-condition is found, the following ones are parsed but not
15314 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15315 numeric variables afterwards are taken from the first one that succeeds.
15316 </para>
15317 </listitem></varlistentry>
15318 <varlistentry>
15319 <term><emphasis role="bold">and&nbsp;{{</emphasis>&lt;<emphasis>cond1</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>cond2</emphasis>&gt;<emphasis role="bold">}...}</emphasis></term>
15320 <listitem>
15321 <para>
15322 <indexterm role="concept">
15323 <primary><quote>and</quote> expansion condition</primary>
15324 </indexterm>
15325 <indexterm role="concept">
15326 <primary>expansion</primary>
15327 <secondary><quote>and</quote> of conditions</secondary>
15328 </indexterm>
15329 The sub-conditions are evaluated from left to right. The condition is true if
15330 all of the sub-conditions are true. If there are several <quote>match</quote>
15331 sub-conditions, the values of the numeric variables afterwards are taken from
15332 the last one. When a false sub-condition is found, the following ones are
15333 parsed but not evaluated.
15334 </para>
15335 </listitem></varlistentry>
15336 </variablelist>
15337 <para>
15338 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
15339 </para>
15340 </section>
15341 <section id="SECTexpvar">
15342 <title>Expansion variables</title>
15343 <para>
15344 <indexterm role="concept">
15345 <primary>expansion variables</primary>
15346 <secondary>list of</secondary>
15347 </indexterm>
15348 This section contains an alphabetical list of all the expansion variables. Some
15349 of them are available only when Exim is compiled with specific options such as
15350 support for TLS or the content scanning extension.
15351 </para>
15352 <variablelist>
15353 <varlistentry>
15354 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15355 <listitem>
15356 <para>
15357 <indexterm role="concept">
15358 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15359 </indexterm>
15360 When a <option>match</option> expansion condition succeeds, these variables contain the
15361 captured substrings identified by the regular expression during subsequent
15362 processing of the success string of the containing <option>if</option> expansion item. They
15363 may also be set externally by some other matching process which precedes the
15364 expansion of the string. For example, the commands available in Exim filter
15365 files include an <option>if</option> command with its own regular expression matching
15366 condition.
15367 </para>
15368 </listitem></varlistentry>
15369 <varlistentry>
15370 <term><varname>$acl_c0</varname> &ndash; <varname>$acl_c19</varname></term>
15371 <listitem>
15372 <para>
15373 Values can be placed in these variables by the <option>set</option> modifier in an ACL. The
15374 values persist throughout the lifetime of an SMTP connection. They can be used
15375 to pass information between ACLs and between different invocations of the same
15376 ACL. When a message is received, the values of these variables are saved with
15377 the message, and can be accessed by filters, routers, and transports during
15378 subsequent delivery.
15379 </para>
15380 </listitem></varlistentry>
15381 <varlistentry>
15382 <term><varname>$acl_m0</varname> &ndash; <varname>$acl_m19</varname></term>
15383 <listitem>
15384 <para>
15385 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15386 retain their values while a message is being received, but are reset
15387 afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a
15388 TLS session. When a message is received, the values of these variables are
15389 saved with the message, and can be accessed by filters, routers, and transports
15390 during subsequent delivery.
15391 </para>
15392 </listitem></varlistentry>
15393 <varlistentry>
15394 <term><varname>$acl_verify_message</varname></term>
15395 <listitem>
15396 <para>
15397 <indexterm role="concept">
15398 <primary><varname>$acl_verify_message</varname></primary>
15399 </indexterm>
15400 After an address verification has failed, this variable contains the failure
15401 message. It retains its value for use in subsequent modifiers. The message can
15402 be preserved by coding like this:
15403 </para>
15404 <literallayout class="monospaced">
15405 warn !verify = sender
15406      set acl_m0 = $acl_verify_message
15407 </literallayout>
15408 <para>
15409 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15410 <option>log_message</option> modifiers, to include information about the verification
15411 failure.
15412 </para>
15413 </listitem></varlistentry>
15414 <varlistentry>
15415 <term><varname>$address_data</varname></term>
15416 <listitem>
15417 <para>
15418 <indexterm role="concept">
15419 <primary><varname>$address_data</varname></primary>
15420 </indexterm>
15421 This variable is set by means of the <option>address_data</option> option in routers. The
15422 value then remains with the address while it is processed by subsequent routers
15423 and eventually a transport. If the transport is handling multiple addresses,
15424 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15425 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15426 user filter files.
15427 </para>
15428 <para>
15429 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15430 a recipient address, the final value is still in the variable for subsequent
15431 conditions and modifiers of the ACL statement. If routing the address caused it
15432 to be redirected to just one address, the child address is also routed as part
15433 of the verification, and in this case the final value of <varname>$address_data</varname> is
15434 from the child&#x2019;s routing.
15435 </para>
15436 <para>
15437 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15438 sender address, the final value is also preserved, but this time in
15439 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15440 address.
15441 </para>
15442 <para>
15443 In both cases (recipient and sender verification), the value does not persist
15444 after the end of the current ACL statement. If you want to preserve
15445 these values for longer, you can save them in ACL variables.
15446 </para>
15447 </listitem></varlistentry>
15448 <varlistentry>
15449 <term><varname>$address_file</varname></term>
15450 <listitem>
15451 <para>
15452 <indexterm role="concept">
15453 <primary><varname>$address_file</varname></primary>
15454 </indexterm>
15455 When, as a result of aliasing, forwarding, or filtering, a message is directed
15456 to a specific file, this variable holds the name of the file when the transport
15457 is running. At other times, the variable is empty. For example, using the
15458 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15459 </para>
15460 <literallayout class="monospaced">
15461 /home/r2d2/savemail
15462 </literallayout>
15463 <para>
15464 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15465 contains <quote>/home/r2d2/savemail</quote>.
15466 </para>
15467 <para>
15468 <indexterm role="concept">
15469 <primary>Sieve filter</primary>
15470 <secondary>value of <varname>$address_file</varname></secondary>
15471 </indexterm>
15472 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15473 then up to the transport configuration to generate an appropriate absolute path
15474 to the relevant file.
15475 </para>
15476 </listitem></varlistentry>
15477 <varlistentry>
15478 <term><varname>$address_pipe</varname></term>
15479 <listitem>
15480 <para>
15481 <indexterm role="concept">
15482 <primary><varname>$address_pipe</varname></primary>
15483 </indexterm>
15484 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15485 this variable holds the pipe command when the transport is running.
15486 </para>
15487 </listitem></varlistentry>
15488 <varlistentry>
15489 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15490 <listitem>
15491 <para>
15492 <indexterm role="concept">
15493 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15494 </indexterm>
15495 These variables are used in SMTP authenticators (see chapters
15496 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15497 </para>
15498 </listitem></varlistentry>
15499 <varlistentry>
15500 <term><varname>$authenticated_id</varname></term>
15501 <listitem>
15502 <para>
15503 <indexterm role="concept">
15504 <primary>authentication</primary>
15505 <secondary>id</secondary>
15506 </indexterm>
15507 <indexterm role="concept">
15508 <primary><varname>$authenticated_id</varname></primary>
15509 </indexterm>
15510 When a server successfully authenticates a client it may be configured to
15511 preserve some of the authentication information in the variable
15512 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15513 user/password authenticator configuration might preserve the user name for use
15514 in the routers. Note that this is not the same information that is saved in
15515 <varname>$sender_host_authenticated</varname>.
15516 When a message is submitted locally (that is, not over a TCP connection)
15517 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15518 process. However, a trusted user can override this by means of the <option>-oMai</option>
15519 command line option.
15520 </para>
15521 </listitem></varlistentry>
15522 <varlistentry>
15523 <term><varname>$authenticated_sender</varname></term>
15524 <listitem>
15525 <para>
15526 <indexterm role="concept">
15527 <primary>sender</primary>
15528 <secondary>authenticated</secondary>
15529 </indexterm>
15530 <indexterm role="concept">
15531 <primary>authentication</primary>
15532 <secondary>sender</secondary>
15533 </indexterm>
15534 <indexterm role="concept">
15535 <primary>AUTH</primary>
15536 <secondary>on MAIL command</secondary>
15537 </indexterm>
15538 <indexterm role="concept">
15539 <primary><varname>$authenticated_sender</varname></primary>
15540 </indexterm>
15541 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15542 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15543 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15544 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15545 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15546 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15547 </para>
15548 <para>
15549 <indexterm role="concept">
15550 <primary><varname>$qualify_domain</varname></primary>
15551 </indexterm>
15552 When a message is submitted locally (that is, not over a TCP connection), the
15553 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15554 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15555 can override this by means of the <option>-oMas</option> command line option.
15556 </para>
15557 </listitem></varlistentry>
15558 <varlistentry>
15559 <term><varname>$authentication_failed</varname></term>
15560 <listitem>
15561 <para>
15562 <indexterm role="concept">
15563 <primary>authentication</primary>
15564 <secondary>failure</secondary>
15565 </indexterm>
15566 <indexterm role="concept">
15567 <primary><varname>$authentication_failed</varname></primary>
15568 </indexterm>
15569 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15570 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15571 possible to distinguish between <quote>did not try to authenticate</quote>
15572 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15573 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15574 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15575 negative response to an AUTH command, including (for example) an attempt to use
15576 an undefined mechanism.
15577 </para>
15578 </listitem></varlistentry>
15579 <varlistentry>
15580 <term><varname>$body_linecount</varname></term>
15581 <listitem>
15582 <para>
15583 <indexterm role="concept">
15584 <primary>message body</primary>
15585 <secondary>line count</secondary>
15586 </indexterm>
15587 <indexterm role="concept">
15588 <primary>body of message</primary>
15589 <secondary>line count</secondary>
15590 </indexterm>
15591 <indexterm role="concept">
15592 <primary><varname>$body_linecount</varname></primary>
15593 </indexterm>
15594 When a message is being received or delivered, this variable contains the
15595 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15596 </para>
15597 </listitem></varlistentry>
15598 <varlistentry>
15599 <term><varname>$body_zerocount</varname></term>
15600 <listitem>
15601 <para>
15602 <indexterm role="concept">
15603 <primary>message body</primary>
15604 <secondary>binary zero count</secondary>
15605 </indexterm>
15606 <indexterm role="concept">
15607 <primary>body of message</primary>
15608 <secondary>binary zero count</secondary>
15609 </indexterm>
15610 <indexterm role="concept">
15611 <primary>binary zero</primary>
15612 <secondary>in message body</secondary>
15613 </indexterm>
15614 <indexterm role="concept">
15615 <primary><varname>$body_zerocount</varname></primary>
15616 </indexterm>
15617 When a message is being received or delivered, this variable contains the
15618 number of binary zero bytes in the message&#x2019;s body.
15619 </para>
15620 </listitem></varlistentry>
15621 <varlistentry>
15622 <term><varname>$bounce_recipient</varname></term>
15623 <listitem>
15624 <para>
15625 <indexterm role="concept">
15626 <primary><varname>$bounce_recipient</varname></primary>
15627 </indexterm>
15628 This is set to the recipient address of a bounce message while Exim is creating
15629 it. It is useful if a customized bounce message text file is in use (see
15630 chapter <xref linkend="CHAPemsgcust"/>).
15631 </para>
15632 </listitem></varlistentry>
15633 <varlistentry>
15634 <term><varname>$bounce_return_size_limit</varname></term>
15635 <listitem>
15636 <para>
15637 <indexterm role="concept">
15638 <primary><varname>$bounce_return_size_limit</varname></primary>
15639 </indexterm>
15640 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15641 up to a multiple of 1000. It is useful when a customized error message text
15642 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15643 </para>
15644 </listitem></varlistentry>
15645 <varlistentry>
15646 <term><varname>$caller_gid</varname></term>
15647 <listitem>
15648 <para>
15649 <indexterm role="concept">
15650 <primary>gid (group id)</primary>
15651 <secondary>caller</secondary>
15652 </indexterm>
15653 <indexterm role="concept">
15654 <primary><varname>$caller_gid</varname></primary>
15655 </indexterm>
15656 The real group id under which the process that called Exim was running. This is
15657 not the same as the group id of the originator of a message (see
15658 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15659 incarnation normally contains the Exim gid.
15660 </para>
15661 </listitem></varlistentry>
15662 <varlistentry>
15663 <term><varname>$caller_uid</varname></term>
15664 <listitem>
15665 <para>
15666 <indexterm role="concept">
15667 <primary>uid (user id)</primary>
15668 <secondary>caller</secondary>
15669 </indexterm>
15670 <indexterm role="concept">
15671 <primary><varname>$caller_uid</varname></primary>
15672 </indexterm>
15673 The real user id under which the process that called Exim was running. This is
15674 not the same as the user id of the originator of a message (see
15675 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15676 incarnation normally contains the Exim uid.
15677 </para>
15678 </listitem></varlistentry>
15679 <varlistentry>
15680 <term><varname>$compile_date</varname></term>
15681 <listitem>
15682 <para>
15683 <indexterm role="concept">
15684 <primary><varname>$compile_date</varname></primary>
15685 </indexterm>
15686 The date on which the Exim binary was compiled.
15687 </para>
15688 </listitem></varlistentry>
15689 <varlistentry>
15690 <term><varname>$compile_number</varname></term>
15691 <listitem>
15692 <para>
15693 <indexterm role="concept">
15694 <primary><varname>$compile_number</varname></primary>
15695 </indexterm>
15696 The building process for Exim keeps a count of the number
15697 of times it has been compiled. This serves to distinguish different
15698 compilations of the same version of the program.
15699 </para>
15700 </listitem></varlistentry>
15701 <varlistentry>
15702 <term><varname>$demime_errorlevel</varname></term>
15703 <listitem>
15704 <para>
15705 <indexterm role="concept">
15706 <primary><varname>$demime_errorlevel</varname></primary>
15707 </indexterm>
15708 This variable is available when Exim is compiled with
15709 the content-scanning extension and the obsolete <option>demime</option> condition. For
15710 details, see section <xref linkend="SECTdemimecond"/>.
15711 </para>
15712 </listitem></varlistentry>
15713 <varlistentry>
15714 <term><varname>$demime_reason</varname></term>
15715 <listitem>
15716 <para>
15717 <indexterm role="concept">
15718 <primary><varname>$demime_reason</varname></primary>
15719 </indexterm>
15720 This variable is available when Exim is compiled with the
15721 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15722 see section <xref linkend="SECTdemimecond"/>.
15723 </para>
15724 </listitem></varlistentry>
15725 <varlistentry>
15726 <term><varname>$dnslist_domain</varname></term>
15727 <listitem>
15728 <para>
15729 <indexterm role="concept">
15730 <primary>black list (DNS)</primary>
15731 </indexterm>
15732 <indexterm role="concept">
15733 <primary><varname>$dnslist_domain</varname></primary>
15734 </indexterm>
15735 When a client host is found to be on a DNS (black) list,
15736 the list&#x2019;s domain name is put into this variable so that it can be included in
15737 the rejection message.
15738 </para>
15739 </listitem></varlistentry>
15740 <varlistentry>
15741 <term><varname>$dnslist_text</varname></term>
15742 <listitem>
15743 <para>
15744 <indexterm role="concept">
15745 <primary><varname>$dnslist_text</varname></primary>
15746 </indexterm>
15747 When a client host is found to be on a DNS (black) list, the
15748 contents of any associated TXT record are placed in this variable.
15749 </para>
15750 </listitem></varlistentry>
15751 <varlistentry>
15752 <term><varname>$dnslist_value</varname></term>
15753 <listitem>
15754 <para>
15755 <indexterm role="concept">
15756 <primary><varname>$dnslist_value</varname></primary>
15757 </indexterm>
15758 When a client host is found to be on a DNS (black) list,
15759 the IP address from the resource record is placed in this variable.
15760 If there are multiple records, all the addresses are included, comma-space
15761 separated.
15762 </para>
15763 </listitem></varlistentry>
15764 <varlistentry>
15765 <term><varname>$domain</varname></term>
15766 <listitem>
15767 <para revisionflag="changed">
15768 <indexterm role="concept">
15769 <primary><varname>$domain</varname></primary>
15770 </indexterm>
15771 When an address is being routed, or delivered on its own, this variable
15772 contains the domain. Uppercase letters in the domain are converted into lower
15773 case for <varname>$domain</varname>.
15774 </para>
15775 <para>
15776 Global address rewriting happens when a message is received, so the value of
15777 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
15778 is set during user filtering, but not during system filtering, because a
15779 message may have many recipients and the system filter is called just once.
15780 </para>
15781 <para>
15782 When more than one address is being delivered at once (for example, several
15783 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15784 have the same domain. Transports can be restricted to handling only one domain
15785 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
15786 the default for local transports. For further details of the environment in
15787 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15788 </para>
15789 <para>
15790 <indexterm role="concept">
15791 <primary><option>delay_warning_condition</option></primary>
15792 </indexterm>
15793 At the end of a delivery, if all deferred addresses have the same domain, it is
15794 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15795 </para>
15796 <para>
15797 The <varname>$domain</varname> variable is also used in some other circumstances:
15798 </para>
15799 <itemizedlist>
15800 <listitem>
15801 <para>
15802 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15803 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15804 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15805 normally set during the running of the MAIL ACL. However, if the sender address
15806 is verified with a callout during the MAIL ACL, the sender domain is placed in
15807 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15808 the <command>smtp</command> transport.
15809 </para>
15810 </listitem>
15811 <listitem>
15812 <para>
15813 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15814 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15815 it can be used in the expansion of the replacement address, for example, to
15816 rewrite domains by file lookup.
15817 </para>
15818 </listitem>
15819 <listitem>
15820 <para>
15821 With one important exception, whenever a domain list is being scanned,
15822 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
15823 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
15824 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
15825 that, in a RCPT ACL, the sender domain list can be dependent on the
15826 recipient domain (which is what is in <varname>$domain</varname> at this time).
15827 </para>
15828 </listitem>
15829 <listitem>
15830 <para>
15831 <indexterm role="concept">
15832 <primary>ETRN</primary>
15833 <secondary>value of <varname>$domain</varname></secondary>
15834 </indexterm>
15835 <indexterm role="concept">
15836 <primary><option>smtp_etrn_command</option></primary>
15837 </indexterm>
15838 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
15839 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
15840 </para>
15841 </listitem>
15842 </itemizedlist>
15843 </listitem></varlistentry>
15844 <varlistentry>
15845 <term><varname>$domain_data</varname></term>
15846 <listitem>
15847 <para>
15848 <indexterm role="concept">
15849 <primary><varname>$domain_data</varname></primary>
15850 </indexterm>
15851 When the <option>domains</option> option on a router matches a domain by
15852 means of a lookup, the data read by the lookup is available during the running
15853 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
15854 address to a transport, the value is available in that transport. If the
15855 transport is handling multiple addresses, the value from the first address is
15856 used.
15857 </para>
15858 <para>
15859 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
15860 domain by means of a lookup. The data read by the lookup is available during
15861 the rest of the ACL statement. In all other situations, this variable expands
15862 to nothing.
15863 </para>
15864 </listitem></varlistentry>
15865 <varlistentry>
15866 <term><varname>$exim_gid</varname></term>
15867 <listitem>
15868 <para>
15869 <indexterm role="concept">
15870 <primary><varname>$exim_gid</varname></primary>
15871 </indexterm>
15872 This variable contains the numerical value of the Exim group id.
15873 </para>
15874 </listitem></varlistentry>
15875 <varlistentry>
15876 <term><varname>$exim_path</varname></term>
15877 <listitem>
15878 <para>
15879 <indexterm role="concept">
15880 <primary><varname>$exim_path</varname></primary>
15881 </indexterm>
15882 This variable contains the path to the Exim binary.
15883 </para>
15884 </listitem></varlistentry>
15885 <varlistentry>
15886 <term><varname>$exim_uid</varname></term>
15887 <listitem>
15888 <para>
15889 <indexterm role="concept">
15890 <primary><varname>$exim_uid</varname></primary>
15891 </indexterm>
15892 This variable contains the numerical value of the Exim user id.
15893 </para>
15894 </listitem></varlistentry>
15895 <varlistentry>
15896 <term><varname>$found_extension</varname></term>
15897 <listitem>
15898 <para>
15899 <indexterm role="concept">
15900 <primary><varname>$found_extension</varname></primary>
15901 </indexterm>
15902 This variable is available when Exim is compiled with the
15903 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15904 see section <xref linkend="SECTdemimecond"/>.
15905 </para>
15906 </listitem></varlistentry>
15907 <varlistentry>
15908 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
15909 <listitem>
15910 <para>
15911 This is not strictly an expansion variable. It is expansion syntax for
15912 inserting the message header line with the given name. Note that the name must
15913 be terminated by colon or white space, because it may contain a wide variety of
15914 characters. Note also that braces must <emphasis>not</emphasis> be used.
15915 </para>
15916 </listitem></varlistentry>
15917 <varlistentry>
15918 <term><varname>$home</varname></term>
15919 <listitem>
15920 <para>
15921 <indexterm role="concept">
15922 <primary><varname>$home</varname></primary>
15923 </indexterm>
15924 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
15925 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
15926 means it is set during the running of users&#x2019; filter files. A router may also
15927 explicitly set a home directory for use by a transport; this can be overridden
15928 by a setting on the transport itself.
15929 </para>
15930 <para>
15931 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
15932 of the environment variable HOME.
15933 </para>
15934 </listitem></varlistentry>
15935 <varlistentry>
15936 <term><varname>$host</varname></term>
15937 <listitem>
15938 <para>
15939 <indexterm role="concept">
15940 <primary><varname>$host</varname></primary>
15941 </indexterm>
15942 If a router assigns an address to a transport (any transport), and passes a
15943 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
15944 to run is the name of the first host on the list. Note that this applies both
15945 to local and remote transports.
15946 </para>
15947 <para>
15948 <indexterm role="concept">
15949 <primary>transport</primary>
15950 <secondary>filter</secondary>
15951 </indexterm>
15952 <indexterm role="concept">
15953 <primary>filter</primary>
15954 <secondary>transport filter</secondary>
15955 </indexterm>
15956 For the <command>smtp</command> transport, if there is more than one host, the value of
15957 <varname>$host</varname> changes as the transport works its way through the list. In
15958 particular, when the <command>smtp</command> transport is expanding its options for encryption
15959 using TLS, or for specifying a transport filter (see chapter
15960 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
15961 is connected.
15962 </para>
15963 <para>
15964 When used in the client part of an authenticator configuration (see chapter
15965 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
15966 client is connected.
15967 </para>
15968 </listitem></varlistentry>
15969 <varlistentry>
15970 <term><varname>$host_address</varname></term>
15971 <listitem>
15972 <para>
15973 <indexterm role="concept">
15974 <primary><varname>$host_address</varname></primary>
15975 </indexterm>
15976 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
15977 for a remote connection. It is also set to the IP address that is being checked
15978 when the <option>ignore_target_hosts</option> option is being processed.
15979 </para>
15980 </listitem></varlistentry>
15981 <varlistentry>
15982 <term><varname>$host_data</varname></term>
15983 <listitem>
15984 <para>
15985 <indexterm role="concept">
15986 <primary><varname>$host_data</varname></primary>
15987 </indexterm>
15988 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
15989 result of the lookup is made available in the <varname>$host_data</varname> variable. This
15990 allows you, for example, to do things like this:
15991 </para>
15992 <literallayout class="monospaced">
15993 deny  hosts = net-lsearch;/some/file
15994 message = $host_data
15995 </literallayout>
15996 </listitem></varlistentry>
15997 <varlistentry>
15998 <term><varname>$host_lookup_deferred</varname></term>
15999 <listitem>
16000 <para>
16001 <indexterm role="concept">
16002 <primary>host name lookup</primary>
16003 <secondary>failure of</secondary>
16004 </indexterm>
16005 <indexterm role="concept">
16006 <primary><varname>$host_lookup_deferred</varname></primary>
16007 </indexterm>
16008 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
16009 message comes from a remote host and there is an attempt to look up the host&#x2019;s
16010 name from its IP address, and the attempt is not successful, one of these
16011 variables is set to <quote>1</quote>.
16012 </para>
16013 <itemizedlist>
16014 <listitem>
16015 <para>
16016 If the lookup receives a definite negative response (for example, a DNS lookup
16017 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
16018 </para>
16019 </listitem>
16020 <listitem>
16021 <para>
16022 If there is any kind of problem during the lookup, such that Exim cannot
16023 tell whether or not the host name is defined (for example, a timeout for a DNS
16024 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
16025 </para>
16026 </listitem>
16027 </itemizedlist>
16028 <para>
16029 Looking up a host&#x2019;s name from its IP address consists of more than just a
16030 single reverse lookup. Exim checks that a forward lookup of at least one of the
16031 names it receives from a reverse lookup yields the original IP address. If this
16032 is not the case, Exim does not accept the looked up name(s), and
16033 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
16034 IP address (for example, the existence of a PTR record in the DNS) is not
16035 sufficient on its own for the success of a host name lookup. If the reverse
16036 lookup succeeds, but there is a lookup problem such as a timeout when checking
16037 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
16038 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
16039 </para>
16040 </listitem></varlistentry>
16041 <varlistentry>
16042 <term><varname>$host_lookup_failed</varname></term>
16043 <listitem>
16044 <para>
16045 <indexterm role="concept">
16046 <primary><varname>$host_lookup_failed</varname></primary>
16047 </indexterm>
16048 See <varname>$host_lookup_deferred</varname>.
16049 </para>
16050 </listitem></varlistentry>
16051 <varlistentry>
16052 <term><varname>$inode</varname></term>
16053 <listitem>
16054 <para>
16055 <indexterm role="concept">
16056 <primary><varname>$inode</varname></primary>
16057 </indexterm>
16058 The only time this variable is set is while expanding the <option>directory_file</option>
16059 option in the <command>appendfile</command> transport. The variable contains the inode number
16060 of the temporary file which is about to be renamed. It can be used to construct
16061 a unique name for the file.
16062 </para>
16063 </listitem></varlistentry>
16064 <varlistentry revisionflag="changed">
16065 <term><varname>$interface_address</varname></term>
16066 <listitem>
16067 <para revisionflag="changed">
16068 <indexterm role="concept">
16069 <primary><varname>$interface_address</varname></primary>
16070 </indexterm>
16071 This is an obsolete name for <varname>$received_ip_address</varname>.
16072 </para>
16073 </listitem></varlistentry>
16074 <varlistentry revisionflag="changed">
16075 <term><varname>$interface_port</varname></term>
16076 <listitem>
16077 <para revisionflag="changed">
16078 <indexterm role="concept">
16079 <primary><varname>$interface_port</varname></primary>
16080 </indexterm>
16081 This is an obsolete name for <varname>$received_port</varname>.
16082 </para>
16083 </listitem></varlistentry>
16084 <varlistentry>
16085 <term><varname>$ldap_dn</varname></term>
16086 <listitem>
16087 <para>
16088 <indexterm role="concept">
16089 <primary><varname>$ldap_dn</varname></primary>
16090 </indexterm>
16091 This variable, which is available only when Exim is compiled with LDAP support,
16092 contains the DN from the last entry in the most recently successful LDAP
16093 lookup.
16094 </para>
16095 </listitem></varlistentry>
16096 <varlistentry>
16097 <term><varname>$load_average</varname></term>
16098 <listitem>
16099 <para>
16100 <indexterm role="concept">
16101 <primary><varname>$load_average</varname></primary>
16102 </indexterm>
16103 This variable contains the system load average, multiplied by 1000 to that it
16104 is an integer. For example, if the load average is 0.21, the value of the
16105 variable is 210. The value is recomputed every time the variable is referenced.
16106 </para>
16107 </listitem></varlistentry>
16108 <varlistentry>
16109 <term><varname>$local_part</varname></term>
16110 <listitem>
16111 <para>
16112 <indexterm role="concept">
16113 <primary><varname>$local_part</varname></primary>
16114 </indexterm>
16115 When an address is being routed, or delivered on its own, this
16116 variable contains the local part. When a number of addresses are being
16117 delivered together (for example, multiple RCPT commands in an SMTP
16118 session), <varname>$local_part</varname> is not set.
16119 </para>
16120 <para>
16121 Global address rewriting happens when a message is received, so the value of
16122 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
16123 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
16124 because a message may have many recipients and the system filter is called just
16125 once.
16126 </para>
16127 <para>
16128 <indexterm role="concept">
16129 <primary><varname>$local_part_prefix</varname></primary>
16130 </indexterm>
16131 <indexterm role="concept">
16132 <primary><varname>$local_part_suffix</varname></primary>
16133 </indexterm>
16134 If a local part prefix or suffix has been recognized, it is not included in the
16135 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
16136 any prefix or suffix are in <varname>$local_part_prefix</varname> and
16137 <varname>$local_part_suffix</varname>, respectively.
16138 </para>
16139 <para>
16140 When a message is being delivered to a file, pipe, or autoreply transport as a
16141 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
16142 the parent address, not to the file name or command (see <varname>$address_file</varname> and
16143 <varname>$address_pipe</varname>).
16144 </para>
16145 <para>
16146 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
16147 local part of the recipient address.
16148 </para>
16149 <para>
16150 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
16151 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
16152 it can be used in the expansion of the replacement address, for example.
16153 </para>
16154 <para>
16155 In all cases, all quoting is removed from the local part. For example, for both
16156 the addresses
16157 </para>
16158 <literallayout class="monospaced">
16159 "abc:xyz"@test.example
16160 abc\:xyz@test.example
16161 </literallayout>
16162 <para>
16163 the value of <varname>$local_part</varname> is
16164 </para>
16165 <literallayout class="monospaced">
16166 abc:xyz
16167 </literallayout>
16168 <para>
16169 If you use <varname>$local_part</varname> to create another address, you should always wrap it
16170 inside a quoting operator. For example, in a <command>redirect</command> router you could
16171 have:
16172 </para>
16173 <literallayout class="monospaced">
16174 data = ${quote_local_part:$local_part}@new.domain.example
16175 </literallayout>
16176 <para>
16177 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16178 to process local parts in a case-dependent manner in a router, you can set the
16179 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16180 </para>
16181 </listitem></varlistentry>
16182 <varlistentry>
16183 <term><varname>$local_part_data</varname></term>
16184 <listitem>
16185 <para>
16186 <indexterm role="concept">
16187 <primary><varname>$local_part_data</varname></primary>
16188 </indexterm>
16189 When the <option>local_parts</option> option on a router matches a local part by means of a
16190 lookup, the data read by the lookup is available during the running of the
16191 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16192 to a transport, the value is available in that transport. If the transport is
16193 handling multiple addresses, the value from the first address is used.
16194 </para>
16195 <para>
16196 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16197 matches a local part by means of a lookup. The data read by the lookup is
16198 available during the rest of the ACL statement. In all other situations, this
16199 variable expands to nothing.
16200 </para>
16201 </listitem></varlistentry>
16202 <varlistentry>
16203 <term><varname>$local_part_prefix</varname></term>
16204 <listitem>
16205 <para>
16206 <indexterm role="concept">
16207 <primary><varname>$local_part_prefix</varname></primary>
16208 </indexterm>
16209 When an address is being routed or delivered, and a
16210 specific prefix for the local part was recognized, it is available in this
16211 variable, having been removed from <varname>$local_part</varname>.
16212 </para>
16213 </listitem></varlistentry>
16214 <varlistentry>
16215 <term><varname>$local_part_suffix</varname></term>
16216 <listitem>
16217 <para>
16218 <indexterm role="concept">
16219 <primary><varname>$local_part_suffix</varname></primary>
16220 </indexterm>
16221 When an address is being routed or delivered, and a
16222 specific suffix for the local part was recognized, it is available in this
16223 variable, having been removed from <varname>$local_part</varname>.
16224 </para>
16225 </listitem></varlistentry>
16226 <varlistentry>
16227 <term><varname>$local_scan_data</varname></term>
16228 <listitem>
16229 <para>
16230 <indexterm role="concept">
16231 <primary><varname>$local_scan_data</varname></primary>
16232 </indexterm>
16233 This variable contains the text returned by the <function>local_scan()</function> function when
16234 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16235 </para>
16236 </listitem></varlistentry>
16237 <varlistentry>
16238 <term><varname>$local_user_gid</varname></term>
16239 <listitem>
16240 <para>
16241 <indexterm role="concept">
16242 <primary><varname>$local_user_gid</varname></primary>
16243 </indexterm>
16244 See <varname>$local_user_uid</varname>.
16245 </para>
16246 </listitem></varlistentry>
16247 <varlistentry>
16248 <term><varname>$local_user_uid</varname></term>
16249 <listitem>
16250 <para>
16251 <indexterm role="concept">
16252 <primary><varname>$local_user_uid</varname></primary>
16253 </indexterm>
16254 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16255 <option>check_local_user</option> router precondition succeeds. This means that their values
16256 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16257 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16258 router-specific expansions. At all other times, the values in these variables
16259 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16260 </para>
16261 </listitem></varlistentry>
16262 <varlistentry>
16263 <term><varname>$localhost_number</varname></term>
16264 <listitem>
16265 <para>
16266 <indexterm role="concept">
16267 <primary><varname>$localhost_number</varname></primary>
16268 </indexterm>
16269 This contains the expanded value of the
16270 <option>localhost_number</option> option. The expansion happens after the main options have
16271 been read.
16272 </para>
16273 </listitem></varlistentry>
16274 <varlistentry>
16275 <term><varname>$log_inodes</varname></term>
16276 <listitem>
16277 <para>
16278 <indexterm role="concept">
16279 <primary><varname>$log_inodes</varname></primary>
16280 </indexterm>
16281 The number of free inodes in the disk partition where Exim&#x2019;s
16282 log files are being written. The value is recalculated whenever the variable is
16283 referenced. If the relevant file system does not have the concept of inodes,
16284 the value of is -1. See also the <option>check_log_inodes</option> option.
16285 </para>
16286 </listitem></varlistentry>
16287 <varlistentry>
16288 <term><varname>$log_space</varname></term>
16289 <listitem>
16290 <para>
16291 <indexterm role="concept">
16292 <primary><varname>$log_space</varname></primary>
16293 </indexterm>
16294 The amount of free space (as a number of kilobytes) in the disk
16295 partition where Exim&#x2019;s log files are being written. The value is recalculated
16296 whenever the variable is referenced. If the operating system does not have the
16297 ability to find the amount of free space (only true for experimental systems),
16298 the space value is -1. See also the <option>check_log_space</option> option.
16299 </para>
16300 </listitem></varlistentry>
16301 <varlistentry>
16302 <term><varname>$mailstore_basename</varname></term>
16303 <listitem>
16304 <para>
16305 <indexterm role="concept">
16306 <primary><varname>$mailstore_basename</varname></primary>
16307 </indexterm>
16308 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16309 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16310 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16311 contains the basename of the files that are being written, that is, the name
16312 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16313 variable is empty.
16314 </para>
16315 </listitem></varlistentry>
16316 <varlistentry>
16317 <term><varname>$malware_name</varname></term>
16318 <listitem>
16319 <para>
16320 <indexterm role="concept">
16321 <primary><varname>$malware_name</varname></primary>
16322 </indexterm>
16323 This variable is available when Exim is compiled with the
16324 content-scanning extension. It is set to the name of the virus that was found
16325 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16326 </para>
16327 </listitem></varlistentry>
16328 <varlistentry>
16329 <term><varname>$message_age</varname></term>
16330 <listitem>
16331 <para>
16332 <indexterm role="concept">
16333 <primary>message</primary>
16334 <secondary>age of</secondary>
16335 </indexterm>
16336 <indexterm role="concept">
16337 <primary><varname>$message_age</varname></primary>
16338 </indexterm>
16339 This variable is set at the start of a delivery attempt to contain the number
16340 of seconds since the message was received. It does not change during a single
16341 delivery attempt.
16342 </para>
16343 </listitem></varlistentry>
16344 <varlistentry>
16345 <term><varname>$message_body</varname></term>
16346 <listitem>
16347 <para>
16348 <indexterm role="concept">
16349 <primary>body of message</primary>
16350 <secondary>expansion variable</secondary>
16351 </indexterm>
16352 <indexterm role="concept">
16353 <primary>message body</primary>
16354 <secondary>in expansion</secondary>
16355 </indexterm>
16356 <indexterm role="concept">
16357 <primary>binary zero</primary>
16358 <secondary>in message body</secondary>
16359 </indexterm>
16360 <indexterm role="concept">
16361 <primary><varname>$message_body</varname></primary>
16362 </indexterm>
16363 This variable contains the initial portion of a message&#x2019;s
16364 body while it is being delivered, and is intended mainly for use in filter
16365 files. The maximum number of characters of the body that are put into the
16366 variable is set by the <option>message_body_visible</option> configuration option; the
16367 default is 500. Newlines are converted into spaces to make it easier to search
16368 for phrases that might be split over a line break.
16369 Binary zeros are also converted into spaces.
16370 </para>
16371 </listitem></varlistentry>
16372 <varlistentry>
16373 <term><varname>$message_body_end</varname></term>
16374 <listitem>
16375 <para>
16376 <indexterm role="concept">
16377 <primary>body of message</primary>
16378 <secondary>expansion variable</secondary>
16379 </indexterm>
16380 <indexterm role="concept">
16381 <primary>message body</primary>
16382 <secondary>in expansion</secondary>
16383 </indexterm>
16384 <indexterm role="concept">
16385 <primary><varname>$message_body_end</varname></primary>
16386 </indexterm>
16387 This variable contains the final portion of a message&#x2019;s
16388 body while it is being delivered. The format and maximum size are as for
16389 <varname>$message_body</varname>.
16390 </para>
16391 </listitem></varlistentry>
16392 <varlistentry>
16393 <term><varname>$message_body_size</varname></term>
16394 <listitem>
16395 <para>
16396 <indexterm role="concept">
16397 <primary>body of message</primary>
16398 <secondary>size</secondary>
16399 </indexterm>
16400 <indexterm role="concept">
16401 <primary>message body</primary>
16402 <secondary>size</secondary>
16403 </indexterm>
16404 <indexterm role="concept">
16405 <primary><varname>$message_body_size</varname></primary>
16406 </indexterm>
16407 When a message is being delivered, this variable contains the size of the body
16408 in bytes. The count starts from the character after the blank line that
16409 separates the body from the header. Newlines are included in the count. See
16410 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16411 </para>
16412 </listitem></varlistentry>
16413 <varlistentry>
16414 <term><varname>$message_exim_id</varname></term>
16415 <listitem>
16416 <para>
16417 <indexterm role="concept">
16418 <primary><varname>$message_exim_id</varname></primary>
16419 </indexterm>
16420 When a message is being received or delivered, this variable contains the
16421 unique message id that is generated and used by Exim to identify the message.
16422 An id is not created for a message until after its header has been successfully
16423 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16424 line; it is the local id that Exim assigns to the message, for example:
16425 <literal>1BXTIK-0001yO-VA</literal>.
16426 </para>
16427 </listitem></varlistentry>
16428 <varlistentry>
16429 <term><varname>$message_headers</varname></term>
16430 <listitem>
16431 <para revisionflag="changed">
16432 <indexterm role="concept">
16433 <primary><varname>$message_headers</varname></primary>
16434 </indexterm>
16435 This variable contains a concatenation of all the header lines when a message
16436 is being processed, except for lines added by routers or transports. The header
16437 lines are separated by newline characters. Their contents are decoded in the
16438 same way as a header line that is inserted by <option>bheader</option>.
16439 </para>
16440 </listitem></varlistentry>
16441 <varlistentry revisionflag="changed">
16442 <term><varname>$message_headers_raw</varname></term>
16443 <listitem>
16444 <para revisionflag="changed">
16445 <indexterm role="concept">
16446 <primary><varname>$message_headers_raw</varname></primary>
16447 </indexterm>
16448 This variable is like <varname>$message_headers</varname> except that no processing of the
16449 contents of header lines is done.
16450 </para>
16451 </listitem></varlistentry>
16452 <varlistentry>
16453 <term><varname>$message_id</varname></term>
16454 <listitem>
16455 <para>
16456 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16457 </para>
16458 </listitem></varlistentry>
16459 <varlistentry>
16460 <term><varname>$message_linecount</varname></term>
16461 <listitem>
16462 <para>
16463 <indexterm role="concept">
16464 <primary><varname>$message_linecount</varname></primary>
16465 </indexterm>
16466 This variable contains the total number of lines in the header and body of the
16467 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16468 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16469 number of lines received. Before delivery happens (that is, before filters,
16470 routers, and transports run) the count is increased to include the
16471 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16472 lines that are added by ACLs. The blank line that separates the message header
16473 from the body is not counted. Here is an example of the use of this variable in
16474 a DATA ACL:
16475 </para>
16476 <literallayout class="monospaced">
16477 deny message   = Too many lines in message header
16478      condition = \
16479        ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16480 </literallayout>
16481 <para>
16482 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16483 message has not yet been received.
16484 </para>
16485 </listitem></varlistentry>
16486 <varlistentry>
16487 <term><varname>$message_size</varname></term>
16488 <listitem>
16489 <para>
16490 <indexterm role="concept">
16491 <primary>size</primary>
16492 <secondary>of message</secondary>
16493 </indexterm>
16494 <indexterm role="concept">
16495 <primary>message</primary>
16496 <secondary>size</secondary>
16497 </indexterm>
16498 <indexterm role="concept">
16499 <primary><varname>$message_size</varname></primary>
16500 </indexterm>
16501 When a message is being processed, this variable contains its size in bytes. In
16502 most cases, the size includes those headers that were received with the
16503 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16504 deliveries as they are written. However, there is one special case: during the
16505 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16506 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16507 precise size of the file that has been written. See also
16508 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16509 </para>
16510 <para>
16511 <indexterm role="concept">
16512 <primary>RCPT</primary>
16513 <secondary>value of <varname>$message_size</varname></secondary>
16514 </indexterm>
16515 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16516 contains the size supplied on the MAIL command, or -1 if no size was given. The
16517 value may not, of course, be truthful.
16518 </para>
16519 </listitem></varlistentry>
16520 <varlistentry>
16521 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16522 <listitem>
16523 <para>
16524 A number of variables whose names start with <varname>$mime</varname> are
16525 available when Exim is compiled with the content-scanning extension. For
16526 details, see section <xref linkend="SECTscanmimepart"/>.
16527 </para>
16528 </listitem></varlistentry>
16529 <varlistentry>
16530 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16531 <listitem>
16532 <para>
16533 These variables are counters that can be incremented by means
16534 of the <option>add</option> command in filter files.
16535 </para>
16536 </listitem></varlistentry>
16537 <varlistentry>
16538 <term><varname>$original_domain</varname></term>
16539 <listitem>
16540 <para>
16541 <indexterm role="concept">
16542 <primary><varname>$domain</varname></primary>
16543 </indexterm>
16544 <indexterm role="concept">
16545 <primary><varname>$original_domain</varname></primary>
16546 </indexterm>
16547 When a top-level address is being processed for delivery, this contains the
16548 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16549 generated by an alias, forward, or filter file) is being processed, this
16550 variable contains the domain of the original address (lower cased). This
16551 differs from <varname>$parent_domain</varname> only when there is more than one level of
16552 aliasing or forwarding. When more than one address is being delivered in a
16553 single transport run, <varname>$original_domain</varname> is not set.
16554 </para>
16555 <para>
16556 If a new address is created by means of a <option>deliver</option> command in a system
16557 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16558 part <emphasis>system-filter</emphasis> and the default qualify domain.
16559 </para>
16560 </listitem></varlistentry>
16561 <varlistentry>
16562 <term><varname>$original_local_part</varname></term>
16563 <listitem>
16564 <para>
16565 <indexterm role="concept">
16566 <primary><varname>$local_part</varname></primary>
16567 </indexterm>
16568 <indexterm role="concept">
16569 <primary><varname>$original_local_part</varname></primary>
16570 </indexterm>
16571 When a top-level address is being processed for delivery, this contains the
16572 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16573 local part, because <varname>$original_local_part</varname> always contains the full local
16574 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16575 filter file) is being processed, this variable contains the full local part of
16576 the original address.
16577 </para>
16578 <para>
16579 If the router that did the redirection processed the local part
16580 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16581 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16582 one level of aliasing or forwarding. When more than one address is being
16583 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16584 </para>
16585 <para>
16586 If a new address is created by means of a <option>deliver</option> command in a system
16587 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16588 part <emphasis>system-filter</emphasis> and the default qualify domain.
16589 </para>
16590 </listitem></varlistentry>
16591 <varlistentry>
16592 <term><varname>$originator_gid</varname></term>
16593 <listitem>
16594 <para>
16595 <indexterm role="concept">
16596 <primary>gid (group id)</primary>
16597 <secondary>of originating user</secondary>
16598 </indexterm>
16599 <indexterm role="concept">
16600 <primary>sender</primary>
16601 <secondary>gid</secondary>
16602 </indexterm>
16603 <indexterm role="concept">
16604 <primary><varname>$caller_gid</varname></primary>
16605 </indexterm>
16606 <indexterm role="concept">
16607 <primary><varname>$originator_gid</varname></primary>
16608 </indexterm>
16609 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16610 message was received. For messages received via the command line, this is the
16611 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16612 normally the gid of the Exim user.
16613 </para>
16614 </listitem></varlistentry>
16615 <varlistentry>
16616 <term><varname>$originator_uid</varname></term>
16617 <listitem>
16618 <para>
16619 <indexterm role="concept">
16620 <primary>uid (user id)</primary>
16621 <secondary>of originating user</secondary>
16622 </indexterm>
16623 <indexterm role="concept">
16624 <primary>sender</primary>
16625 <secondary>uid</secondary>
16626 </indexterm>
16627 <indexterm role="concept">
16628 <primary><varname>$caller_uid</varname></primary>
16629 </indexterm>
16630 <indexterm role="concept">
16631 <primary><varname>$originaltor_uid</varname></primary>
16632 </indexterm>
16633 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16634 messages received via the command line, this is the uid of the sending user.
16635 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16636 user.
16637 </para>
16638 </listitem></varlistentry>
16639 <varlistentry>
16640 <term><varname>$parent_domain</varname></term>
16641 <listitem>
16642 <para>
16643 <indexterm role="concept">
16644 <primary><varname>$parent_domain</varname></primary>
16645 </indexterm>
16646 This variable is similar to <varname>$original_domain</varname> (see
16647 above), except that it refers to the immediately preceding parent address.
16648 </para>
16649 </listitem></varlistentry>
16650 <varlistentry>
16651 <term><varname>$parent_local_part</varname></term>
16652 <listitem>
16653 <para>
16654 <indexterm role="concept">
16655 <primary><varname>$parent_local_part</varname></primary>
16656 </indexterm>
16657 This variable is similar to <varname>$original_local_part</varname>
16658 (see above), except that it refers to the immediately preceding parent address.
16659 </para>
16660 </listitem></varlistentry>
16661 <varlistentry>
16662 <term><varname>$pid</varname></term>
16663 <listitem>
16664 <para>
16665 <indexterm role="concept">
16666 <primary>pid (process id)</primary>
16667 <secondary>of current process</secondary>
16668 </indexterm>
16669 <indexterm role="concept">
16670 <primary><varname>$pid</varname></primary>
16671 </indexterm>
16672 This variable contains the current process id.
16673 </para>
16674 </listitem></varlistentry>
16675 <varlistentry>
16676 <term><varname>$pipe_addresses</varname></term>
16677 <listitem>
16678 <para>
16679 <indexterm role="concept">
16680 <primary>filter</primary>
16681 <secondary>transport filter</secondary>
16682 </indexterm>
16683 <indexterm role="concept">
16684 <primary>transport</primary>
16685 <secondary>filter</secondary>
16686 </indexterm>
16687 <indexterm role="concept">
16688 <primary><varname>$pipe_addresses</varname></primary>
16689 </indexterm>
16690 This is not an expansion variable, but is mentioned here because the string
16691 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
16692 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16693 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16694 It cannot be used in general expansion strings, and provokes an <quote>unknown
16695 variable</quote> error if encountered.
16696 </para>
16697 </listitem></varlistentry>
16698 <varlistentry>
16699 <term><varname>$primary_hostname</varname></term>
16700 <listitem>
16701 <para>
16702 <indexterm role="concept">
16703 <primary><varname>$primary_hostname</varname></primary>
16704 </indexterm>
16705 This variable contains the value set by <option>primary_hostname</option> in the
16706 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16707 a single-component name, Exim calls <function>gethostbyname()</function> (or
16708 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16709 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16710 </para>
16711 </listitem></varlistentry>
16712 <varlistentry>
16713 <term><varname>$prvscheck_address</varname></term>
16714 <listitem>
16715 <para>
16716 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16717 which is described in sections <xref linkend="SECTexpansionitems"/> and
16718 <xref linkend="SECTverifyPRVS"/>.
16719 </para>
16720 </listitem></varlistentry>
16721 <varlistentry>
16722 <term><varname>$prvscheck_keynum</varname></term>
16723 <listitem>
16724 <para>
16725 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16726 which is described in sections <xref linkend="SECTexpansionitems"/> and
16727 <xref linkend="SECTverifyPRVS"/>.
16728 </para>
16729 </listitem></varlistentry>
16730 <varlistentry>
16731 <term><varname>$prvscheck_result</varname></term>
16732 <listitem>
16733 <para>
16734 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16735 which is described in sections <xref linkend="SECTexpansionitems"/> and
16736 <xref linkend="SECTverifyPRVS"/>.
16737 </para>
16738 </listitem></varlistentry>
16739 <varlistentry>
16740 <term><varname>$qualify_domain</varname></term>
16741 <listitem>
16742 <para>
16743 <indexterm role="concept">
16744 <primary><varname>$qualify_domain</varname></primary>
16745 </indexterm>
16746 The value set for the <option>qualify_domain</option> option in the configuration file.
16747 </para>
16748 </listitem></varlistentry>
16749 <varlistentry>
16750 <term><varname>$qualify_recipient</varname></term>
16751 <listitem>
16752 <para>
16753 <indexterm role="concept">
16754 <primary><varname>$qualify_recipient</varname></primary>
16755 </indexterm>
16756 The value set for the <option>qualify_recipient</option> option in the configuration file,
16757 or if not set, the value of <varname>$qualify_domain</varname>.
16758 </para>
16759 </listitem></varlistentry>
16760 <varlistentry>
16761 <term><varname>$rcpt_count</varname></term>
16762 <listitem>
16763 <para>
16764 <indexterm role="concept">
16765 <primary><varname>$rcpt_count</varname></primary>
16766 </indexterm>
16767 When a message is being received by SMTP, this variable contains the number of
16768 RCPT commands received for the current message. If this variable is used in a
16769 RCPT ACL, its value includes the current command.
16770 </para>
16771 </listitem></varlistentry>
16772 <varlistentry>
16773 <term><varname>$rcpt_defer_count</varname></term>
16774 <listitem>
16775 <para>
16776 <indexterm role="concept">
16777 <primary><varname>$rcpt_defer_count</varname></primary>
16778 </indexterm>
16779 <indexterm role="concept">
16780 <primary>4<emphasis>xx</emphasis> responses</primary>
16781 <secondary>count of</secondary>
16782 </indexterm>
16783 When a message is being received by SMTP, this variable contains the number of
16784 RCPT commands in the current message that have previously been rejected with a
16785 temporary (4<emphasis>xx</emphasis>) response.
16786 </para>
16787 </listitem></varlistentry>
16788 <varlistentry>
16789 <term><varname>$rcpt_fail_count</varname></term>
16790 <listitem>
16791 <para>
16792 <indexterm role="concept">
16793 <primary><varname>$rcpt_fail_count</varname></primary>
16794 </indexterm>
16795 When a message is being received by SMTP, this variable contains the number of
16796 RCPT commands in the current message that have previously been rejected with a
16797 permanent (5<emphasis>xx</emphasis>) response.
16798 </para>
16799 </listitem></varlistentry>
16800 <varlistentry>
16801 <term><varname>$received_count</varname></term>
16802 <listitem>
16803 <para>
16804 <indexterm role="concept">
16805 <primary><varname>$received_count</varname></primary>
16806 </indexterm>
16807 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
16808 including the one added by Exim (so its value is always greater than zero). It
16809 is available in the DATA ACL, the non-SMTP ACL, and while routing and
16810 delivering.
16811 </para>
16812 </listitem></varlistentry>
16813 <varlistentry>
16814 <term><varname>$received_for</varname></term>
16815 <listitem>
16816 <para>
16817 <indexterm role="concept">
16818 <primary><varname>$received_for</varname></primary>
16819 </indexterm>
16820 If there is only a single recipient address in an incoming message, this
16821 variable contains that address when the <emphasis>Received:</emphasis> header line is being
16822 built. The value is copied after recipient rewriting has happened, but before
16823 the <function>local_scan()</function> function is run.
16824 </para>
16825 </listitem></varlistentry>
16826 <varlistentry revisionflag="changed">
16827 <term><varname>$received_ip_address</varname></term>
16828 <listitem>
16829 <para revisionflag="changed">
16830 <indexterm role="concept">
16831 <primary><varname>$received_ip_address</varname></primary>
16832 </indexterm>
16833 As soon as an Exim server starts processing an incoming TCP/IP connection, this
16834 variable is set to the address of the local IP interface, and <varname>$received_port</varname>
16835 is set to the local port number. (The remote IP address and port are in
16836 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
16837 the port value is -1 unless it has been set using the <option>-oMi</option> command line
16838 option.
16839 </para>
16840 <para revisionflag="changed">
16841 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
16842 could be used, for example, to make the file name for a TLS certificate depend
16843 on which interface and/or port is being used for the incoming connection. The
16844 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
16845 messages that are received, thus making these variables available at delivery
16846 time.
16847 </para>
16848 <para revisionflag="changed">
16849 <emphasis role="bold">Note:</emphasis> There are no equivalent variables for outgoing connections, because
16850 the values are unknown (unless they are explicitly set by options of the
16851 <command>smtp</command> transport).
16852 </para>
16853 </listitem></varlistentry>
16854 <varlistentry revisionflag="changed">
16855 <term><varname>$received_port</varname></term>
16856 <listitem>
16857 <para revisionflag="changed">
16858 <indexterm role="concept">
16859 <primary><varname>$received_port</varname></primary>
16860 </indexterm>
16861 See <varname>$received_ip_address</varname>.
16862 </para>
16863 </listitem></varlistentry>
16864 <varlistentry>
16865 <term><varname>$received_protocol</varname></term>
16866 <listitem>
16867 <para>
16868 <indexterm role="concept">
16869 <primary><varname>$received_protocol</varname></primary>
16870 </indexterm>
16871 When a message is being processed, this variable contains the name of the
16872 protocol by which it was received. Most of the names used by Exim are defined
16873 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
16874 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
16875 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
16876 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
16877 connection and the client was successfully authenticated.
16878 </para>
16879 <para>
16880 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
16881 automatically set up on connection without the use of STARTTLS (see
16882 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
16883 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
16884 where the client initially uses EHLO, sets up an encrypted connection using
16885 STARTTLS, and then uses HELO afterwards.
16886 </para>
16887 <para>
16888 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
16889 messages that are injected locally by trusted callers. This is commonly used to
16890 identify messages that are being re-injected after some kind of scanning.
16891 </para>
16892 </listitem></varlistentry>
16893 <varlistentry>
16894 <term><varname>$received_time</varname></term>
16895 <listitem>
16896 <para>
16897 <indexterm role="concept">
16898 <primary><varname>$received_time</varname></primary>
16899 </indexterm>
16900 This variable contains the date and time when the current message was received,
16901 as a number of seconds since the start of the Unix epoch.
16902 </para>
16903 </listitem></varlistentry>
16904 <varlistentry>
16905 <term><varname>$recipient_data</varname></term>
16906 <listitem>
16907 <para>
16908 <indexterm role="concept">
16909 <primary><varname>$recipient_data</varname></primary>
16910 </indexterm>
16911 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
16912 condition. It contains the data from the lookup, and the value remains set
16913 until the next <option>recipients</option> test. Thus, you can do things like this:
16914 </para>
16915 <literallayout>
16916 <literal>require recipients  = cdb*@;/some/file</literal>
16917 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
16918 </literallayout>
16919 <para>
16920 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16921 method in the address list, using the semicolon syntax as in the example above.
16922 The variable is not set for a lookup that is used as part of the string
16923 expansion that all such lists undergo before being interpreted.
16924 </para>
16925 </listitem></varlistentry>
16926 <varlistentry>
16927 <term><varname>$recipient_verify_failure</varname></term>
16928 <listitem>
16929 <para>
16930 <indexterm role="concept">
16931 <primary><varname>$recipient_verify_failure</varname></primary>
16932 </indexterm>
16933 In an ACL, when a recipient verification fails, this variable contains
16934 information about the failure. It is set to one of the following words:
16935 </para>
16936 <itemizedlist>
16937 <listitem>
16938 <para>
16939 <quote>qualify</quote>: The address was unqualified (no domain), and the message
16940 was neither local nor came from an exempted host.
16941 </para>
16942 </listitem>
16943 <listitem>
16944 <para>
16945 <quote>route</quote>: Routing failed.
16946 </para>
16947 </listitem>
16948 <listitem>
16949 <para>
16950 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
16951 or before the MAIL command (that is, on initial connection, HELO, or
16952 MAIL).
16953 </para>
16954 </listitem>
16955 <listitem>
16956 <para>
16957 <quote>recipient</quote>: The RCPT command in a callout was rejected.
16958 </para>
16959 </listitem>
16960 <listitem>
16961 <para>
16962 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
16963 </para>
16964 </listitem>
16965 </itemizedlist>
16966 <para>
16967 The main use of this variable is expected to be to distinguish between
16968 rejections of MAIL and rejections of RCPT.
16969 </para>
16970 </listitem></varlistentry>
16971 <varlistentry>
16972 <term><varname>$recipients</varname></term>
16973 <listitem>
16974 <para>
16975 <indexterm role="concept">
16976 <primary><varname>$recipients</varname></primary>
16977 </indexterm>
16978 This variable contains a list of envelope recipients for a
16979 message. A comma and a space separate the addresses in the replacement text.
16980 However, the variable is not generally available, to prevent exposure of Bcc
16981 recipients in unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only
16982 in these two cases:
16983 </para>
16984 <orderedlist numeration="arabic">
16985 <listitem>
16986 <para>
16987 In a system filter file.
16988 </para>
16989 </listitem>
16990 <listitem>
16991 <para>
16992 In the ACLs associated with the DATA command and with non-SMTP messages, that
16993 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
16994 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
16995 <option>acl_not_smtp_mime</option>.
16996 </para>
16997 </listitem>
16998 </orderedlist>
16999 </listitem></varlistentry>
17000 <varlistentry>
17001 <term><varname>$recipients_count</varname></term>
17002 <listitem>
17003 <para>
17004 <indexterm role="concept">
17005 <primary><varname>$recipients_count</varname></primary>
17006 </indexterm>
17007 When a message is being processed, this variable contains the number of
17008 envelope recipients that came with the message. Duplicates are not excluded
17009 from the count. While a message is being received over SMTP, the number
17010 increases for each accepted recipient. It can be referenced in an ACL.
17011 </para>
17012 </listitem></varlistentry>
17013 <varlistentry>
17014 <term><varname>$regex_match_string</varname></term>
17015 <listitem>
17016 <para>
17017 <indexterm role="concept">
17018 <primary><varname>$regex_match_string</varname></primary>
17019 </indexterm>
17020 This variable is set to contain the matching regular expression after a
17021 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
17022 </para>
17023 </listitem></varlistentry>
17024 <varlistentry>
17025 <term><varname>$reply_address</varname></term>
17026 <listitem>
17027 <para>
17028 <indexterm role="concept">
17029 <primary><varname>$reply_address</varname></primary>
17030 </indexterm>
17031 When a message is being processed, this variable contains the contents of the
17032 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
17033 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
17034 white space, the value is not processed in any way. In particular, no RFC 2047
17035 decoding or character code translation takes place.
17036 </para>
17037 </listitem></varlistentry>
17038 <varlistentry>
17039 <term><varname>$return_path</varname></term>
17040 <listitem>
17041 <para>
17042 <indexterm role="concept">
17043 <primary><varname>$return_path</varname></primary>
17044 </indexterm>
17045 When a message is being delivered, this variable contains the return path &ndash;
17046 the sender field that will be sent as part of the envelope. It is not enclosed
17047 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
17048 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
17049 mailing list has been expanded by a router which specifies a different address
17050 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
17051 address, whereas <varname>$sender_address</varname> always contains the original sender address
17052 that was received with the message. In other words, <varname>$sender_address</varname> contains
17053 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
17054 envelope sender.
17055 </para>
17056 </listitem></varlistentry>
17057 <varlistentry>
17058 <term><varname>$return_size_limit</varname></term>
17059 <listitem>
17060 <para>
17061 <indexterm role="concept">
17062 <primary><varname>$return_size_limit</varname></primary>
17063 </indexterm>
17064 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
17065 </para>
17066 </listitem></varlistentry>
17067 <varlistentry>
17068 <term><varname>$runrc</varname></term>
17069 <listitem>
17070 <para>
17071 <indexterm role="concept">
17072 <primary>return code</primary>
17073 <secondary>from <option>run</option> expansion</secondary>
17074 </indexterm>
17075 <indexterm role="concept">
17076 <primary><varname>$runrc</varname></primary>
17077 </indexterm>
17078 This variable contains the return code from a command that is run by the
17079 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
17080 assume the order in which option values are expanded, except for those
17081 preconditions whose order of testing is documented. Therefore, you cannot
17082 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
17083 another.
17084 </para>
17085 </listitem></varlistentry>
17086 <varlistentry>
17087 <term><varname>$self_hostname</varname></term>
17088 <listitem>
17089 <para>
17090 <indexterm role="concept">
17091 <primary><option>self</option> option</primary>
17092 <secondary>value of host name</secondary>
17093 </indexterm>
17094 <indexterm role="concept">
17095 <primary><varname>$self_hostname</varname></primary>
17096 </indexterm>
17097 When an address is routed to a supposedly remote host that turns out to be the
17098 local host, what happens is controlled by the <option>self</option> generic router option.
17099 One of its values causes the address to be passed to another router. When this
17100 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
17101 original router encountered. In other circumstances its contents are null.
17102 </para>
17103 </listitem></varlistentry>
17104 <varlistentry>
17105 <term><varname>$sender_address</varname></term>
17106 <listitem>
17107 <para revisionflag="changed">
17108 <indexterm role="concept">
17109 <primary><varname>$sender_address</varname></primary>
17110 </indexterm>
17111 When a message is being processed, this variable contains the sender&#x2019;s address
17112 that was received in the message&#x2019;s envelope. The case of letters in the address
17113 is retained, in both the local part and the domain. For bounce messages, the
17114 value of this variable is the empty string. See also <varname>$return_path</varname>.
17115 </para>
17116 </listitem></varlistentry>
17117 <varlistentry>
17118 <term><varname>$sender_address_data</varname></term>
17119 <listitem>
17120 <para>
17121 <indexterm role="concept">
17122 <primary><varname>$address_data</varname></primary>
17123 </indexterm>
17124 <indexterm role="concept">
17125 <primary><varname>$sender_address_data</varname></primary>
17126 </indexterm>
17127 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
17128 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
17129 distinguish it from data from a recipient address. The value does not persist
17130 after the end of the current ACL statement. If you want to preserve it for
17131 longer, you can save it in an ACL variable.
17132 </para>
17133 </listitem></varlistentry>
17134 <varlistentry>
17135 <term><varname>$sender_address_domain</varname></term>
17136 <listitem>
17137 <para>
17138 <indexterm role="concept">
17139 <primary><varname>$sender_address_domain</varname></primary>
17140 </indexterm>
17141 The domain portion of <varname>$sender_address</varname>.
17142 </para>
17143 </listitem></varlistentry>
17144 <varlistentry>
17145 <term><varname>$sender_address_local_part</varname></term>
17146 <listitem>
17147 <para>
17148 <indexterm role="concept">
17149 <primary><varname>$sender_address_local_part</varname></primary>
17150 </indexterm>
17151 The local part portion of <varname>$sender_address</varname>.
17152 </para>
17153 </listitem></varlistentry>
17154 <varlistentry>
17155 <term><varname>$sender_data</varname></term>
17156 <listitem>
17157 <para>
17158 <indexterm role="concept">
17159 <primary><varname>$sender_data</varname></primary>
17160 </indexterm>
17161 This variable is set after a lookup success in an ACL <option>senders</option> condition or
17162 in a router <option>senders</option> option. It contains the data from the lookup, and the
17163 value remains set until the next <option>senders</option> test. Thus, you can do things like
17164 this:
17165 </para>
17166 <literallayout>
17167 <literal>require senders      = cdb*@;/some/file</literal>
17168 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
17169 </literallayout>
17170 <para>
17171 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
17172 method in the address list, using the semicolon syntax as in the example above.
17173 The variable is not set for a lookup that is used as part of the string
17174 expansion that all such lists undergo before being interpreted.
17175 </para>
17176 </listitem></varlistentry>
17177 <varlistentry>
17178 <term><varname>$sender_fullhost</varname></term>
17179 <listitem>
17180 <para>
17181 <indexterm role="concept">
17182 <primary><varname>$sender_fullhost</varname></primary>
17183 </indexterm>
17184 When a message is received from a remote host, this variable contains the host
17185 name and IP address in a single string. It ends with the IP address in square
17186 brackets, followed by a colon and a port number if the logging of ports is
17187 enabled. The format of the rest of the string depends on whether the host
17188 issued a HELO or EHLO SMTP command, and whether the host name was verified by
17189 looking up its IP address. (Looking up the IP address can be forced by the
17190 <option>host_lookup</option> option, independent of verification.) A plain host name at the
17191 start of the string is a verified host name; if this is not present,
17192 verification either failed or was not requested. A host name in parentheses is
17193 the argument of a HELO or EHLO command. This is omitted if it is identical to
17194 the verified host name or to the host&#x2019;s IP address in square brackets.
17195 </para>
17196 </listitem></varlistentry>
17197 <varlistentry>
17198 <term><varname>$sender_helo_name</varname></term>
17199 <listitem>
17200 <para>
17201 <indexterm role="concept">
17202 <primary><varname>$sender_helo_name</varname></primary>
17203 </indexterm>
17204 When a message is received from a remote host that has issued a HELO or EHLO
17205 command, the argument of that command is placed in this variable. It is also
17206 set if HELO or EHLO is used when a message is received using SMTP locally via
17207 the <option>-bs</option> or <option>-bS</option> options.
17208 </para>
17209 </listitem></varlistentry>
17210 <varlistentry>
17211 <term><varname>$sender_host_address</varname></term>
17212 <listitem>
17213 <para>
17214 <indexterm role="concept">
17215 <primary><varname>$sender_host_address</varname></primary>
17216 </indexterm>
17217 When a message is received from a remote host, this variable contains that
17218 host&#x2019;s IP address. For locally submitted messages, it is empty.
17219 </para>
17220 </listitem></varlistentry>
17221 <varlistentry>
17222 <term><varname>$sender_host_authenticated</varname></term>
17223 <listitem>
17224 <para>
17225 <indexterm role="concept">
17226 <primary><varname>$sender_host_authenticated</varname></primary>
17227 </indexterm>
17228 This variable contains the name (not the public name) of the authenticator
17229 driver that successfully authenticated the client from which the message was
17230 received. It is empty if there was no successful authentication. See also
17231 <varname>$authenticated_id</varname>.
17232 </para>
17233 </listitem></varlistentry>
17234 <varlistentry>
17235 <term><varname>$sender_host_name</varname></term>
17236 <listitem>
17237 <para>
17238 <indexterm role="concept">
17239 <primary><varname>$sender_host_name</varname></primary>
17240 </indexterm>
17241 When a message is received from a remote host, this variable contains the
17242 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17243 other means, this variable is empty.
17244 </para>
17245 <para>
17246 <indexterm role="concept">
17247 <primary><varname>$host_lookup_failed</varname></primary>
17248 </indexterm>
17249 If the host name has not previously been looked up, a reference to
17250 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17251 A looked up name is accepted only if it leads back to the original IP address
17252 via a forward lookup. If either the reverse or the forward lookup fails to find
17253 any data, or if the forward lookup does not yield the original IP address,
17254 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17255 </para>
17256 <para>
17257 <indexterm role="concept">
17258 <primary><varname>$host_lookup_deferred</varname></primary>
17259 </indexterm>
17260 However, if either of the lookups cannot be completed (for example, there is a
17261 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17262 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17263 </para>
17264 <para>
17265 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17266 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17267 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17268 is set to <quote>1</quote>.
17269 </para>
17270 <para>
17271 Exim does not automatically look up every calling host&#x2019;s name. If you want
17272 maximum efficiency, you should arrange your configuration so that it avoids
17273 these lookups altogether. The lookup happens only if one or more of the
17274 following are true:
17275 </para>
17276 <itemizedlist>
17277 <listitem>
17278 <para>
17279 A string containing <varname>$sender_host_name</varname> is expanded.
17280 </para>
17281 </listitem>
17282 <listitem>
17283 <para>
17284 The calling host matches the list in <option>host_lookup</option>. In the default
17285 configuration, this option is set to *, so it must be changed if lookups are
17286 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17287 </para>
17288 </listitem>
17289 <listitem>
17290 <para>
17291 Exim needs the host name in order to test an item in a host list. The items
17292 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17293 <xref linkend="SECThoslispatnamsk"/>.
17294 </para>
17295 </listitem>
17296 <listitem>
17297 <para>
17298 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17299 In this case, the host name is required to compare with the name quoted in any
17300 EHLO or HELO commands that the client issues.
17301 </para>
17302 </listitem>
17303 <listitem>
17304 <para>
17305 The remote host issues a EHLO or HELO command that quotes one of the
17306 domains in <option>helo_lookup_domains</option>. The default value of this option is
17307 </para>
17308 <literallayout class="monospaced">
17309   helo_lookup_domains = @ : @[]
17310 </literallayout>
17311 <para>
17312 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17313 IP address in an EHLO or HELO command.
17314 </para>
17315 </listitem>
17316 </itemizedlist>
17317 </listitem></varlistentry>
17318 <varlistentry>
17319 <term><varname>$sender_host_port</varname></term>
17320 <listitem>
17321 <para>
17322 <indexterm role="concept">
17323 <primary><varname>$sender_host_port</varname></primary>
17324 </indexterm>
17325 When a message is received from a remote host, this variable contains the port
17326 number that was used on the remote host.
17327 </para>
17328 </listitem></varlistentry>
17329 <varlistentry>
17330 <term><varname>$sender_ident</varname></term>
17331 <listitem>
17332 <para>
17333 <indexterm role="concept">
17334 <primary><varname>$sender_ident</varname></primary>
17335 </indexterm>
17336 When a message is received from a remote host, this variable contains the
17337 identification received in response to an RFC 1413 request. When a message has
17338 been received locally, this variable contains the login name of the user that
17339 called Exim.
17340 </para>
17341 </listitem></varlistentry>
17342 <varlistentry>
17343 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17344 <listitem>
17345 <para>
17346 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17347 <option>ratelimit</option> ACL condition. Details are given in section
17348 <xref linkend="SECTratelimiting"/>.
17349 </para>
17350 </listitem></varlistentry>
17351 <varlistentry>
17352 <term><varname>$sender_rcvhost</varname></term>
17353 <listitem>
17354 <para>
17355 <indexterm role="concept">
17356 <primary>DNS</primary>
17357 <secondary>reverse lookup</secondary>
17358 </indexterm>
17359 <indexterm role="concept">
17360 <primary>reverse DNS lookup</primary>
17361 </indexterm>
17362 <indexterm role="concept">
17363 <primary><varname>$sender_rcvhost</varname></primary>
17364 </indexterm>
17365 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17366 either the verified host name (as obtained from a reverse DNS lookup) or, if
17367 there is no verified host name, the IP address in square brackets. After that
17368 there may be text in parentheses. When the first item is a verified host name,
17369 the first thing in the parentheses is the IP address in square brackets,
17370 followed by a colon and a port number if port logging is enabled. When the
17371 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17372 the parentheses.
17373 </para>
17374 <para>
17375 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17376 was used and its argument was not identical to the real host name or IP
17377 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17378 all three items are present in the parentheses, a newline and tab are inserted
17379 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17380 </para>
17381 </listitem></varlistentry>
17382 <varlistentry>
17383 <term><varname>$sender_verify_failure</varname></term>
17384 <listitem>
17385 <para>
17386 <indexterm role="concept">
17387 <primary><varname>$sender_verify_failure</varname></primary>
17388 </indexterm>
17389 In an ACL, when a sender verification fails, this variable contains information
17390 about the failure. The details are the same as for
17391 <varname>$recipient_verify_failure</varname>.
17392 </para>
17393 </listitem></varlistentry>
17394 <varlistentry>
17395 <term><varname>$smtp_active_hostname</varname></term>
17396 <listitem>
17397 <para>
17398 <indexterm role="concept">
17399 <primary><varname>$smtp_active_hostname</varname></primary>
17400 </indexterm>
17401 During an incoming SMTP session, this variable contains the value of the active
17402 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
17403 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17404 value can be consulted during routing and delivery.
17405 </para>
17406 </listitem></varlistentry>
17407 <varlistentry>
17408 <term><varname>$smtp_command</varname></term>
17409 <listitem>
17410 <para>
17411 <indexterm role="concept">
17412 <primary><varname>$smtp_command</varname></primary>
17413 </indexterm>
17414 During the processing of an incoming SMTP command, this variable contains the
17415 entire command. This makes it possible to distinguish between HELO and EHLO in
17416 the HELO ACL, and also to distinguish between commands such as these:
17417 </para>
17418 <literallayout class="monospaced">
17419 MAIL FROM:&lt;&gt;
17420 MAIL FROM: &lt;&gt;
17421 </literallayout>
17422 <para>
17423 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17424 command, the address in <varname>$smtp_command</varname> is the original address before any
17425 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17426 the address after SMTP-time rewriting.
17427 </para>
17428 </listitem></varlistentry>
17429 <varlistentry>
17430 <term><varname>$smtp_command_argument</varname></term>
17431 <listitem>
17432 <para>
17433 <indexterm role="concept">
17434 <primary>SMTP command</primary>
17435 <secondary>argument for</secondary>
17436 </indexterm>
17437 <indexterm role="concept">
17438 <primary><varname>$smtp_command_argument</varname></primary>
17439 </indexterm>
17440 While an ACL is running to check an SMTP command, this variable contains the
17441 argument, that is, the text that follows the command name, with leading white
17442 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17443 somewhat redundant, but is retained for backwards compatibility.
17444 </para>
17445 </listitem></varlistentry>
17446 <varlistentry>
17447 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17448 <listitem>
17449 <para>
17450 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17451 that were current at the end of the system filter file. This allows a system
17452 filter file to set values that can be tested in users&#x2019; filter files. For
17453 example, a system filter could set a value indicating how likely it is that a
17454 message is junk mail.
17455 </para>
17456 </listitem></varlistentry>
17457 <varlistentry>
17458 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17459 <listitem>
17460 <para>
17461 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17462 is compiled with the content-scanning extension. For details, see section
17463 <xref linkend="SECTscanspamass"/>.
17464 </para>
17465 </listitem></varlistentry>
17466 <varlistentry>
17467 <term><varname>$spool_directory</varname></term>
17468 <listitem>
17469 <para>
17470 <indexterm role="concept">
17471 <primary><varname>$spool_directory</varname></primary>
17472 </indexterm>
17473 The name of Exim&#x2019;s spool directory.
17474 </para>
17475 </listitem></varlistentry>
17476 <varlistentry>
17477 <term><varname>$spool_inodes</varname></term>
17478 <listitem>
17479 <para>
17480 <indexterm role="concept">
17481 <primary><varname>$spool_inodes</varname></primary>
17482 </indexterm>
17483 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17484 being written. The value is recalculated whenever the variable is referenced.
17485 If the relevant file system does not have the concept of inodes, the value of
17486 is -1. See also the <option>check_spool_inodes</option> option.
17487 </para>
17488 </listitem></varlistentry>
17489 <varlistentry>
17490 <term><varname>$spool_space</varname></term>
17491 <listitem>
17492 <para>
17493 <indexterm role="concept">
17494 <primary><varname>$spool_space</varname></primary>
17495 </indexterm>
17496 The amount of free space (as a number of kilobytes) in the disk partition where
17497 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17498 variable is referenced. If the operating system does not have the ability to
17499 find the amount of free space (only true for experimental systems), the space
17500 value is -1. For example, to check in an ACL that there is at least 50
17501 megabytes free on the spool, you could write:
17502 </para>
17503 <literallayout class="monospaced">
17504 condition = ${if &gt; {$spool_space}{50000}}
17505 </literallayout>
17506 <para>
17507 See also the <option>check_spool_space</option> option.
17508 </para>
17509 </listitem></varlistentry>
17510 <varlistentry>
17511 <term><varname>$thisaddress</varname></term>
17512 <listitem>
17513 <para>
17514 <indexterm role="concept">
17515 <primary><varname>$thisaddress</varname></primary>
17516 </indexterm>
17517 This variable is set only during the processing of the <option>foranyaddress</option>
17518 command in a filter file. Its use is explained in the description of that
17519 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
17520 interfaces to mail filtering</emphasis>.
17521 </para>
17522 </listitem></varlistentry>
17523 <varlistentry>
17524 <term><varname>$tls_certificate_verified</varname></term>
17525 <listitem>
17526 <para>
17527 <indexterm role="concept">
17528 <primary><varname>$tls_certificate_verified</varname></primary>
17529 </indexterm>
17530 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17531 message was received, and <quote>0</quote> otherwise.
17532 </para>
17533 </listitem></varlistentry>
17534 <varlistentry>
17535 <term><varname>$tls_cipher</varname></term>
17536 <listitem>
17537 <para>
17538 <indexterm role="concept">
17539 <primary><varname>$tls_cipher</varname></primary>
17540 </indexterm>
17541 When a message is received from a remote host over an encrypted SMTP
17542 connection, this variable is set to the cipher suite that was negotiated, for
17543 example DES-CBC3-SHA. In other circumstances, in particular, for message
17544 received over unencrypted connections, the variable is empty. See chapter
17545 <xref linkend="CHAPTLS"/> for details of TLS support.
17546 </para>
17547 </listitem></varlistentry>
17548 <varlistentry>
17549 <term><varname>$tls_peerdn</varname></term>
17550 <listitem>
17551 <para>
17552 <indexterm role="concept">
17553 <primary><varname>$tls_peerdn</varname></primary>
17554 </indexterm>
17555 When a message is received from a remote host over an encrypted SMTP
17556 connection, and Exim is configured to request a certificate from the client,
17557 the value of the Distinguished Name of the certificate is made available in the
17558 <varname>$tls_peerdn</varname> during subsequent processing.
17559 </para>
17560 </listitem></varlistentry>
17561 <varlistentry>
17562 <term><varname>$tod_bsdinbox</varname></term>
17563 <listitem>
17564 <para>
17565 <indexterm role="concept">
17566 <primary><varname>$tod_bsdinbox</varname></primary>
17567 </indexterm>
17568 The time of day and the date, in the format required for BSD-style mailbox
17569 files, for example: Thu Oct 17 17:14:09 1995.
17570 </para>
17571 </listitem></varlistentry>
17572 <varlistentry>
17573 <term><varname>$tod_epoch</varname></term>
17574 <listitem>
17575 <para>
17576 <indexterm role="concept">
17577 <primary><varname>$tod_epoch</varname></primary>
17578 </indexterm>
17579 The time and date as a number of seconds since the start of the Unix epoch.
17580 </para>
17581 </listitem></varlistentry>
17582 <varlistentry>
17583 <term><varname>$tod_full</varname></term>
17584 <listitem>
17585 <para>
17586 <indexterm role="concept">
17587 <primary><varname>$tod_full</varname></primary>
17588 </indexterm>
17589 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17590 +0100. The timezone is always given as a numerical offset from UTC, with
17591 positive values used for timezones that are ahead (east) of UTC, and negative
17592 values for those that are behind (west).
17593 </para>
17594 </listitem></varlistentry>
17595 <varlistentry>
17596 <term><varname>$tod_log</varname></term>
17597 <listitem>
17598 <para>
17599 <indexterm role="concept">
17600 <primary><varname>$tod_log</varname></primary>
17601 </indexterm>
17602 The time and date in the format used for writing Exim&#x2019;s log files, for example:
17603 1995-10-12 15:32:29, but without a timezone.
17604 </para>
17605 </listitem></varlistentry>
17606 <varlistentry>
17607 <term><varname>$tod_logfile</varname></term>
17608 <listitem>
17609 <para>
17610 <indexterm role="concept">
17611 <primary><varname>$tod_logfile</varname></primary>
17612 </indexterm>
17613 This variable contains the date in the format yyyymmdd. This is the format that
17614 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17615 flag.
17616 </para>
17617 </listitem></varlistentry>
17618 <varlistentry>
17619 <term><varname>$tod_zone</varname></term>
17620 <listitem>
17621 <para>
17622 <indexterm role="concept">
17623 <primary><varname>$tod_zone</varname></primary>
17624 </indexterm>
17625 This variable contains the numerical value of the local timezone, for example:
17626 -0500.
17627 </para>
17628 </listitem></varlistentry>
17629 <varlistentry>
17630 <term><varname>$tod_zulu</varname></term>
17631 <listitem>
17632 <para>
17633 <indexterm role="concept">
17634 <primary><varname>$tod_zulu</varname></primary>
17635 </indexterm>
17636 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17637 by ISO 8601, for example: 20030221154023Z.
17638 </para>
17639 </listitem></varlistentry>
17640 <varlistentry>
17641 <term><varname>$value</varname></term>
17642 <listitem>
17643 <para>
17644 <indexterm role="concept">
17645 <primary><varname>$value</varname></primary>
17646 </indexterm>
17647 This variable contains the result of an expansion lookup, extraction operation,
17648 or external command, as described above.
17649 </para>
17650 </listitem></varlistentry>
17651 <varlistentry>
17652 <term><varname>$version_number</varname></term>
17653 <listitem>
17654 <para>
17655 <indexterm role="concept">
17656 <primary><varname>$version_number</varname></primary>
17657 </indexterm>
17658 The version number of Exim.
17659 </para>
17660 </listitem></varlistentry>
17661 <varlistentry>
17662 <term><varname>$warn_message_delay</varname></term>
17663 <listitem>
17664 <para>
17665 <indexterm role="concept">
17666 <primary><varname>$warn_message_delay</varname></primary>
17667 </indexterm>
17668 This variable is set only during the creation of a message warning about a
17669 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17670 </para>
17671 </listitem></varlistentry>
17672 <varlistentry>
17673 <term><varname>$warn_message_recipients</varname></term>
17674 <listitem>
17675 <para>
17676 <indexterm role="concept">
17677 <primary><varname>$warn_message_recipients</varname></primary>
17678 </indexterm>
17679 This variable is set only during the creation of a message warning about a
17680 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17681 </para>
17682 </listitem></varlistentry>
17683 </variablelist>
17684 <para>
17685 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17686 </para>
17687 </section>
17688 </chapter>
17689
17690 <chapter id="CHAPperl">
17691 <title>Embedded Perl</title>
17692 <para>
17693 <indexterm role="concept" id="IIDperl" class="startofrange">
17694 <primary>Perl</primary>
17695 <secondary>calling from Exim</secondary>
17696 </indexterm>
17697 Exim can be built to include an embedded Perl interpreter. When this is done,
17698 Perl subroutines can be called as part of the string expansion process. To make
17699 use of the Perl support, you need version 5.004 or later of Perl installed on
17700 your system. To include the embedded interpreter in the Exim binary, include
17701 the line
17702 </para>
17703 <literallayout class="monospaced">
17704 EXIM_PERL = perl.o
17705 </literallayout>
17706 <para>
17707 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17708 </para>
17709 <section>
17710 <title>Setting up so Perl can be used</title>
17711 <para>
17712 <indexterm role="concept">
17713 <primary><option>perl_startup</option></primary>
17714 </indexterm>
17715 Access to Perl subroutines is via a global configuration option called
17716 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17717 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17718 interpreter is started and there is almost no overhead for Exim (since none of
17719 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17720 option then the associated value is taken to be Perl code which is executed in
17721 a newly created Perl interpreter.
17722 </para>
17723 <para>
17724 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17725 need backslashes before any characters to escape special meanings. The option
17726 should usually be something like
17727 </para>
17728 <literallayout class="monospaced">
17729 perl_startup = do '/etc/exim.pl'
17730 </literallayout>
17731 <para>
17732 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17733 use from Exim. Exim can be configured either to start up a Perl interpreter as
17734 soon as it is entered, or to wait until the first time it is needed. Starting
17735 the interpreter at the beginning ensures that it is done while Exim still has
17736 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17737 fact used in a particular run. Also, note that this does not mean that Exim is
17738 necessarily running as root when Perl is called at a later time. By default,
17739 the interpreter is started only when it is needed, but this can be changed in
17740 two ways:
17741 </para>
17742 <itemizedlist>
17743 <listitem>
17744 <para>
17745 <indexterm role="concept">
17746 <primary><option>perl_at_start</option></primary>
17747 </indexterm>
17748 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17749 a startup when Exim is entered.
17750 </para>
17751 </listitem>
17752 <listitem>
17753 <para>
17754 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17755 overriding the setting of <option>perl_at_start</option>.
17756 </para>
17757 </listitem>
17758 </itemizedlist>
17759 <para>
17760 There is also a command line option <option>-pd</option> (for delay) which suppresses the
17761 initial startup, even if <option>perl_at_start</option> is set.
17762 </para>
17763 </section>
17764 <section>
17765 <title>Calling Perl subroutines</title>
17766 <para>
17767 When the configuration file includes a <option>perl_startup</option> option you can make use
17768 of the string expansion item to call the Perl subroutines that are defined
17769 by the <option>perl_startup</option> code. The operator is used in any of the following
17770 forms:
17771 </para>
17772 <literallayout class="monospaced">
17773 ${perl{foo}}
17774 ${perl{foo}{argument}}
17775 ${perl{foo}{argument1}{argument2} ... }
17776 </literallayout>
17777 <para>
17778 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
17779 arguments may be passed. Passing more than this results in an expansion failure
17780 with an error message of the form
17781 </para>
17782 <literallayout class="monospaced">
17783 Too many arguments passed to Perl subroutine "foo" (max is 8)
17784 </literallayout>
17785 <para>
17786 The return value of the Perl subroutine is evaluated in a scalar context before
17787 it is passed back to Exim to be inserted into the expanded string. If the
17788 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
17789 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
17790 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
17791 that was passed to <option>die</option>.
17792 </para>
17793 </section>
17794 <section>
17795 <title>Calling Exim functions from Perl</title>
17796 <para>
17797 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
17798 is available to call back into Exim&#x2019;s string expansion function. For example,
17799 the Perl code
17800 </para>
17801 <literallayout class="monospaced">
17802 my $lp = Exim::expand_string('$local_part');
17803 </literallayout>
17804 <para>
17805 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
17806 Note those are single quotes and not double quotes to protect against
17807 <varname>$local_part</varname> being interpolated as a Perl variable.
17808 </para>
17809 <para>
17810 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
17811 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
17812 expansion string, the Perl call from the original expansion string fails with
17813 an appropriate error message, in the same way as if <option>die</option> were used.
17814 </para>
17815 <para>
17816 <indexterm role="concept">
17817 <primary>debugging</primary>
17818 <secondary>from embedded Perl</secondary>
17819 </indexterm>
17820 <indexterm role="concept">
17821 <primary>log</primary>
17822 <secondary>writing from embedded Perl</secondary>
17823 </indexterm>
17824 Two other Exim functions are available for use from within Perl code.
17825 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
17826 debugging is enabled. If you want a newline at the end, you must supply it.
17827 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
17828 timestamp. In this case, you should not supply a terminating newline.
17829 </para>
17830 </section>
17831 <section>
17832 <title>Use of standard output and error by Perl</title>
17833 <para>
17834 <indexterm role="concept">
17835 <primary>Perl</primary>
17836 <secondary>standard output and error</secondary>
17837 </indexterm>
17838 You should not write to the standard error or output streams from within your
17839 Perl code, as it is not defined how these are set up. In versions of Exim
17840 before 4.50, it is possible for the standard output or error to refer to the
17841 SMTP connection during message reception via the daemon. Writing to this stream
17842 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
17843 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
17844 avoided, but the output is lost.
17845 </para>
17846 <para>
17847 <indexterm role="concept">
17848 <primary>Perl</primary>
17849 <secondary>use of <option>warn</option></secondary>
17850 </indexterm>
17851 The Perl <option>warn</option> statement writes to the standard error stream by default.
17852 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
17853 you have no control. When Exim starts up the Perl interpreter, it arranges for
17854 output from the <option>warn</option> statement to be written to the Exim main log. You can
17855 change this by including appropriate Perl magic somewhere in your Perl code.
17856 For example, to discard <option>warn</option> output completely, you need this:
17857 </para>
17858 <literallayout class="monospaced">
17859 $SIG{__WARN__} = sub { };
17860 </literallayout>
17861 <para>
17862 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
17863 example, the code for the subroutine is empty, so it does nothing, but you can
17864 include any Perl code that you like. The text of the <option>warn</option> message is passed
17865 as the first subroutine argument.
17866 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
17867 </para>
17868 </section>
17869 </chapter>
17870
17871 <chapter id="CHAPinterfaces">
17872 <title>Starting the daemon and the use of network interfaces</title>
17873 <titleabbrev>Starting the daemon</titleabbrev>
17874 <para>
17875 <indexterm role="concept">
17876 <primary>daemon</primary>
17877 <secondary>starting</secondary>
17878 </indexterm>
17879 <indexterm role="concept">
17880 <primary>interface</primary>
17881 <secondary>listening</secondary>
17882 </indexterm>
17883 <indexterm role="concept">
17884 <primary>network interface</primary>
17885 </indexterm>
17886 <indexterm role="concept">
17887 <primary>interface</primary>
17888 <secondary>network</secondary>
17889 </indexterm>
17890 <indexterm role="concept">
17891 <primary>IP address</primary>
17892 <secondary>for listening</secondary>
17893 </indexterm>
17894 <indexterm role="concept">
17895 <primary>daemon</primary>
17896 <secondary>listening IP addresses</secondary>
17897 </indexterm>
17898 <indexterm role="concept">
17899 <primary>TCP/IP</primary>
17900 <secondary>setting listening interfaces</secondary>
17901 </indexterm>
17902 <indexterm role="concept">
17903 <primary>TCP/IP</primary>
17904 <secondary>setting listening ports</secondary>
17905 </indexterm>
17906 A host that is connected to a TCP/IP network may have one or more physical
17907 hardware network interfaces. Each of these interfaces may be configured as one
17908 or more <quote>logical</quote> interfaces, which are the entities that a program actually
17909 works with. Each of these logical interfaces is associated with an IP address.
17910 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
17911 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
17912 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
17913 </para>
17914 <orderedlist numeration="arabic">
17915 <listitem>
17916 <para>
17917 When a listening daemon is started, Exim needs to know which interfaces
17918 and ports to listen on.
17919 </para>
17920 </listitem>
17921 <listitem>
17922 <para>
17923 When Exim is routing an address, it needs to know which IP addresses
17924 are associated with local interfaces. This is required for the correct
17925 processing of MX lists by removing the local host and others with the
17926 same or higher priority values. Also, Exim needs to detect cases
17927 when an address is routed to an IP address that in fact belongs to the
17928 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
17929 option of the smtp transport is set (as appropriate), this is treated
17930 as an error situation.
17931 </para>
17932 </listitem>
17933 <listitem>
17934 <para>
17935 When Exim connects to a remote host, it may need to know which interface to use
17936 for the outgoing connection.
17937 </para>
17938 </listitem>
17939 </orderedlist>
17940 <para>
17941 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
17942 of cases. If your host has only one interface, and you want all its IP
17943 addresses to be treated in the same way, and you are using only the
17944 standard SMTP port, you should not need to take any special action. The
17945 rest of this chapter does not apply to you.
17946 </para>
17947 <para>
17948 In a more complicated situation you may want to listen only on certain
17949 interfaces, or on different ports, and for this reason there are a number of
17950 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
17951 chapter describes how they operate.
17952 </para>
17953 <para revisionflag="changed">
17954 When a message is received over TCP/IP, the interface and port that were
17955 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
17956 </para>
17957 <section>
17958 <title>Starting a listening daemon</title>
17959 <para>
17960 When a listening daemon is started (by means of the <option>-bd</option> command line
17961 option), the interfaces and ports on which it listens are controlled by the
17962 following options:
17963 </para>
17964 <itemizedlist>
17965 <listitem>
17966 <para>
17967 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
17968 compatibility, this option can also be specified in the singular.)
17969 </para>
17970 </listitem>
17971 <listitem>
17972 <para>
17973 <option>local_interfaces</option> contains list of interface IP addresses on which to
17974 listen. Each item may optionally also specify a port.
17975 </para>
17976 </listitem>
17977 </itemizedlist>
17978 <para>
17979 The default list separator in both cases is a colon, but this can be changed as
17980 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
17981 it is usually best to change the separator to avoid having to double all the
17982 colons. For example:
17983 </para>
17984 <literallayout class="monospaced">
17985 local_interfaces = &lt;; 127.0.0.1 ; \
17986                       192.168.23.65 ; \
17987                       ::1 ; \
17988                       3ffe:ffff:836f::fe86:a061
17989 </literallayout>
17990 <para>
17991 There are two different formats for specifying a port along with an IP address
17992 in <option>local_interfaces</option>:
17993 </para>
17994 <orderedlist numeration="arabic">
17995 <listitem>
17996 <para>
17997 The port is added onto the address with a dot separator. For example, to listen
17998 on port 1234 on two different IP addresses:
17999 </para>
18000 <literallayout class="monospaced">
18001 local_interfaces = &lt;; 192.168.23.65.1234 ; \
18002                       3ffe:ffff:836f::fe86:a061.1234
18003 </literallayout>
18004 </listitem>
18005 <listitem>
18006 <para>
18007 The IP address is enclosed in square brackets, and the port is added
18008 with a colon separator, for example:
18009 </para>
18010 <literallayout class="monospaced">
18011 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
18012                       [3ffe:ffff:836f::fe86:a061]:1234
18013 </literallayout>
18014 </listitem>
18015 </orderedlist>
18016 <para>
18017 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
18018 default setting contains just one port:
18019 </para>
18020 <literallayout class="monospaced">
18021 daemon_smtp_ports = smtp
18022 </literallayout>
18023 <para>
18024 If more than one port is listed, each interface that does not have its own port
18025 specified listens on all of them. Ports that are listed in
18026 <option>daemon_smtp_ports</option> can be identified either by name (defined in
18027 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
18028 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
18029 </para>
18030 </section>
18031 <section>
18032 <title>Special IP listening addresses</title>
18033 <para>
18034 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
18035 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
18036 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
18037 instead of setting up separate listening sockets for each interface. The
18038 default value of <option>local_interfaces</option> is
18039 </para>
18040 <literallayout class="monospaced">
18041 local_interfaces = 0.0.0.0
18042 </literallayout>
18043 <para>
18044 when Exim is built without IPv6 support; otherwise it is:
18045 </para>
18046 <literallayout class="monospaced">
18047 local_interfaces = &lt;; ::0 ; 0.0.0.0
18048 </literallayout>
18049 <para>
18050 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
18051 </para>
18052 </section>
18053 <section>
18054 <title>Overriding local_interfaces and daemon_smtp_ports</title>
18055 <para>
18056 The <option>-oX</option> command line option can be used to override the values of
18057 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
18058 instance. Another way of doing this would be to use macros and the <option>-D</option>
18059 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
18060 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
18061 exim.
18062 </para>
18063 <para>
18064 The value of <option>-oX</option> is a list of items. The default colon separator can be
18065 changed in the usual way if required. If there are any items that do not
18066 contain dots or colons (that is, are not IP addresses), the value of
18067 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
18068 items that do contain dots or colons, the value of <option>local_interfaces</option> is
18069 replaced by those items. Thus, for example,
18070 </para>
18071 <literallayout class="monospaced">
18072 -oX 1225
18073 </literallayout>
18074 <para>
18075 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
18076 whereas
18077 </para>
18078 <literallayout class="monospaced">
18079 -oX 192.168.34.5.1125
18080 </literallayout>
18081 <para>
18082 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
18083 (However, since <option>local_interfaces</option> now contains no items without ports, the
18084 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
18085 </para>
18086 </section>
18087 <section id="SECTsupobssmt">
18088 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
18089 <para>
18090 <indexterm role="concept">
18091 <primary>ssmtp protocol</primary>
18092 </indexterm>
18093 <indexterm role="concept">
18094 <primary>smtps protocol</primary>
18095 </indexterm>
18096 <indexterm role="concept">
18097 <primary>SMTP</primary>
18098 <secondary>ssmtp protocol</secondary>
18099 </indexterm>
18100 <indexterm role="concept">
18101 <primary>SMTP</primary>
18102 <secondary>smtps protocol</secondary>
18103 </indexterm>
18104 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
18105 before the STARTTLS command was standardized for SMTP. Some legacy clients
18106 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
18107 list of port numbers, connections to those ports must use SSMTP. The most
18108 common use of this option is expected to be
18109 </para>
18110 <literallayout class="monospaced">
18111 tls_on_connect_ports = 465
18112 </literallayout>
18113 <para>
18114 because 465 is the usual port number used by the legacy clients. There is also
18115 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
18116 this way when a daemon is started.
18117 </para>
18118 <para>
18119 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
18120 daemon to listen on those ports. You must still specify them in
18121 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
18122 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
18123 connections via the daemon.)
18124 </para>
18125 </section>
18126 <section>
18127 <title>IPv6 address scopes</title>
18128 <para>
18129 <indexterm role="concept">
18130 <primary>IPv6</primary>
18131 <secondary>address scopes</secondary>
18132 </indexterm>
18133 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
18134 can, in principle, have the same link-local IPv6 address on different
18135 interfaces. Thus, additional information is needed, over and above the IP
18136 address, to distinguish individual interfaces. A convention of using a
18137 percent sign followed by something (often the interface name) has been
18138 adopted in some cases, leading to addresses like this:
18139 </para>
18140 <literallayout class="monospaced">
18141 fe80::202:b3ff:fe03:45c1%eth0
18142 </literallayout>
18143 <para>
18144 To accommodate this usage, a percent sign followed by an arbitrary string is
18145 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
18146 to convert a textual IPv6 address for actual use. This function recognizes the
18147 percent convention in operating systems that support it, and it processes the
18148 address appropriately. Unfortunately, some older libraries have problems with
18149 <function>getaddrinfo()</function>. If
18150 </para>
18151 <literallayout class="monospaced">
18152 IPV6_USE_INET_PTON=yes
18153 </literallayout>
18154 <para>
18155 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
18156 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
18157 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
18158 function.) Of course, this means that the additional functionality of
18159 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
18160 </para>
18161 </section>
18162 <section>
18163 <title>Disabling IPv6</title>
18164 <para>
18165 <indexterm role="concept">
18166 <primary>IPv6</primary>
18167 <secondary>disabling</secondary>
18168 </indexterm>
18169 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
18170 run on a host whose kernel does not support IPv6. The binary will fall back to
18171 using IPv4, but it may waste resources looking up AAAA records, and trying to
18172 connect to IPv6 addresses, causing delays to mail delivery. If you set the
18173 <indexterm role="option">
18174 <primary><option>disable_ipv6</option></primary>
18175 </indexterm>
18176 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
18177 activities take place. AAAA records are never looked up, and any IPv6 addresses
18178 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
18179 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
18180 to handle IPv6 literal addresses.
18181 </para>
18182 <para>
18183 On the other hand, when IPv6 is in use, there may be times when you want to
18184 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
18185 option to globally suppress the lookup of AAAA records for specified domains,
18186 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
18187 IPv6 addresses in an individual router.
18188 </para>
18189 </section>
18190 <section>
18191 <title>Examples of starting a listening daemon</title>
18192 <para>
18193 The default case in an IPv6 environment is
18194 </para>
18195 <literallayout class="monospaced">
18196 daemon_smtp_ports = smtp
18197 local_interfaces = &lt;; ::0 ; 0.0.0.0
18198 </literallayout>
18199 <para>
18200 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
18201 Either one or two sockets may be used, depending on the characteristics of
18202 the TCP/IP stack. (This is complicated and messy; for more information,
18203 read the comments in the <filename>daemon.c</filename> source file.)
18204 </para>
18205 <para>
18206 To specify listening on ports 25 and 26 on all interfaces:
18207 </para>
18208 <literallayout class="monospaced">
18209 daemon_smtp_ports = 25 : 26
18210 </literallayout>
18211 <para>
18212 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
18213 </para>
18214 <literallayout class="monospaced">
18215 local_interfaces = &lt;; ::0.25     ; ::0.26 \
18216                       0.0.0.0.25 ; 0.0.0.0.26
18217 </literallayout>
18218 <para>
18219 To listen on the default port on all IPv4 interfaces, and on port 26 on the
18220 IPv4 loopback address only:
18221 </para>
18222 <literallayout class="monospaced">
18223 local_interfaces = 0.0.0.0 : 127.0.0.1.26
18224 </literallayout>
18225 <para>
18226 To specify listening on the default port on specific interfaces only:
18227 </para>
18228 <literallayout class="monospaced">
18229 local_interfaces = 192.168.34.67 : 192.168.34.67
18230 </literallayout>
18231 <para>
18232 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18233 </para>
18234 </section>
18235 <section id="SECTreclocipadd">
18236 <title>Recognising the local host</title>
18237 <para>
18238 The <option>local_interfaces</option> option is also used when Exim needs to determine
18239 whether or not an IP address refers to the local host. That is, the IP
18240 addresses of all the interfaces on which a daemon is listening are always
18241 treated as local.
18242 </para>
18243 <para>
18244 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18245 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18246 available interfaces from the operating system, and extracts the relevant
18247 (that is, IPv4 or IPv6) addresses to use for checking.
18248 </para>
18249 <para>
18250 Some systems set up large numbers of virtual interfaces in order to provide
18251 many virtual web servers. In this situation, you may want to listen for
18252 email on only a few of the available interfaces, but nevertheless treat all
18253 interfaces as local when routing. You can do this by setting
18254 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18255 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18256 used for listening. Consider this example:
18257 </para>
18258 <literallayout class="monospaced">
18259 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18260                       192.168.53.235 ; \
18261                       3ffe:2101:12:1:a00:20ff:fe86:a061
18262
18263 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18264 </literallayout>
18265 <para>
18266 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18267 address, but all available interface addresses are treated as local when
18268 Exim is routing.
18269 </para>
18270 <para>
18271 In some environments the local host name may be in an MX list, but with an IP
18272 address that is not assigned to any local interface. In other cases it may be
18273 desirable to treat other host names as if they referred to the local host. Both
18274 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18275 This contains host names rather than IP addresses. When a host is referenced
18276 during routing, either via an MX record or directly, it is treated as the local
18277 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18278 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18279 </para>
18280 </section>
18281 <section>
18282 <title>Delivering to a remote host</title>
18283 <para>
18284 Delivery to a remote host is handled by the smtp transport. By default, it
18285 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18286 there is more than one) when connecting to a remote host. However, the
18287 <option>interface</option> option can be set to specify which interface is used. See the
18288 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18289 details.
18290 </para>
18291 </section>
18292 </chapter>
18293
18294 <chapter id="CHAPmainconfig">
18295 <title>Main configuration</title>
18296 <para>
18297 <indexterm role="concept" id="IIDconfima" class="startofrange">
18298 <primary>configuration file</primary>
18299 <secondary>main section</secondary>
18300 </indexterm>
18301 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18302 <primary>main configuration</primary>
18303 </indexterm>
18304 The first part of the run time configuration file contains three types of item:
18305 </para>
18306 <itemizedlist>
18307 <listitem>
18308 <para>
18309 Macro definitions: These lines start with an upper case letter. See section
18310 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18311 </para>
18312 </listitem>
18313 <listitem>
18314 <para>
18315 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18316 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18317 section <xref linkend="SECTnamedlists"/>.
18318 </para>
18319 </listitem>
18320 <listitem>
18321 <para>
18322 Main configuration settings: Each setting occupies one line of the file
18323 (with possible continuations). If any setting is preceded by the word
18324 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18325 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18326 settings.
18327 </para>
18328 </listitem>
18329 </itemizedlist>
18330 <para>
18331 This chapter specifies all the main configuration options, along with their
18332 types and default values. For ease of finding a particular option, they appear
18333 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18334 are now so many options, they are first listed briefly in functional groups, as
18335 an aid to finding the name of the option you are looking for. Some options are
18336 listed in more than one group.
18337 </para>
18338 <section>
18339 <title>Miscellaneous</title>
18340 <informaltable frame="none">
18341 <tgroup cols="2" colsep="0" rowsep="0">
18342 <colspec colwidth="196pt" align="left"/>
18343 <colspec colwidth="254pt" align="left"/>
18344 <tbody>
18345 <row>
18346 <entry><option>bi_command</option></entry>
18347 <entry>to run for <option>-bi</option> command line option</entry>
18348 </row>
18349 <row>
18350 <entry><option>disable_ipv6</option></entry>
18351 <entry>do no IPv6 processing</entry>
18352 </row>
18353 <row>
18354 <entry><option>keep_malformed</option></entry>
18355 <entry>for broken files &ndash; should not happen</entry>
18356 </row>
18357 <row>
18358 <entry><option>localhost_number</option></entry>
18359 <entry>for unique message ids in clusters</entry>
18360 </row>
18361 <row>
18362 <entry><option>message_body_visible</option></entry>
18363 <entry>how much to show in <varname>$message_body</varname></entry>
18364 </row>
18365 <row>
18366 <entry><option>mua_wrapper</option></entry>
18367 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18368 </row>
18369 <row>
18370 <entry><option>print_topbitchars</option></entry>
18371 <entry>top-bit characters are printing</entry>
18372 </row>
18373 <row>
18374 <entry><option>timezone</option></entry>
18375 <entry>force time zone</entry>
18376 </row>
18377 </tbody>
18378 </tgroup>
18379 </informaltable>
18380 </section>
18381 <section>
18382 <title>Exim parameters</title>
18383 <informaltable frame="none">
18384 <tgroup cols="2" colsep="0" rowsep="0">
18385 <colspec colwidth="196pt" align="left"/>
18386 <colspec colwidth="254pt" align="left"/>
18387 <tbody>
18388 <row>
18389 <entry><option>exim_group</option></entry>
18390 <entry>override compiled-in value</entry>
18391 </row>
18392 <row>
18393 <entry><option>exim_path</option></entry>
18394 <entry>override compiled-in value</entry>
18395 </row>
18396 <row>
18397 <entry><option>exim_user</option></entry>
18398 <entry>override compiled-in value</entry>
18399 </row>
18400 <row>
18401 <entry><option>primary_hostname</option></entry>
18402 <entry>default from <function>uname()</function></entry>
18403 </row>
18404 <row>
18405 <entry><option>split_spool_directory</option></entry>
18406 <entry>use multiple directories</entry>
18407 </row>
18408 <row>
18409 <entry><option>spool_directory</option></entry>
18410 <entry>override compiled-in value</entry>
18411 </row>
18412 </tbody>
18413 </tgroup>
18414 </informaltable>
18415 </section>
18416 <section>
18417 <title>Privilege controls</title>
18418 <informaltable frame="none">
18419 <tgroup cols="2" colsep="0" rowsep="0">
18420 <colspec colwidth="196pt" align="left"/>
18421 <colspec colwidth="254pt" align="left"/>
18422 <tbody>
18423 <row>
18424 <entry><option>admin_groups</option></entry>
18425 <entry>groups that are Exim admin users</entry>
18426 </row>
18427 <row>
18428 <entry><option>deliver_drop_privilege</option></entry>
18429 <entry>drop root for delivery processes</entry>
18430 </row>
18431 <row>
18432 <entry><option>local_from_check</option></entry>
18433 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18434 </row>
18435 <row>
18436 <entry><option>local_from_prefix</option></entry>
18437 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18438 </row>
18439 <row>
18440 <entry><option>local_from_suffix</option></entry>
18441 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18442 </row>
18443 <row>
18444 <entry><option>local_sender_retain</option></entry>
18445 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18446 </row>
18447 <row>
18448 <entry><option>never_users</option></entry>
18449 <entry>do not run deliveries as these</entry>
18450 </row>
18451 <row>
18452 <entry><option>prod_requires_admin</option></entry>
18453 <entry>forced delivery requires admin user</entry>
18454 </row>
18455 <row>
18456 <entry><option>queue_list_requires_admin</option></entry>
18457 <entry>queue listing requires admin user</entry>
18458 </row>
18459 <row>
18460 <entry><option>trusted_groups</option></entry>
18461 <entry>groups that are trusted</entry>
18462 </row>
18463 <row>
18464 <entry><option>trusted_users</option></entry>
18465 <entry>users that are trusted</entry>
18466 </row>
18467 </tbody>
18468 </tgroup>
18469 </informaltable>
18470 </section>
18471 <section>
18472 <title>Logging</title>
18473 <informaltable frame="none">
18474 <tgroup cols="2" colsep="0" rowsep="0">
18475 <colspec colwidth="196pt" align="left"/>
18476 <colspec colwidth="254pt" align="left"/>
18477 <tbody>
18478 <row>
18479 <entry><option>hosts_connection_nolog</option></entry>
18480 <entry>exemption from connect logging</entry>
18481 </row>
18482 <row>
18483 <entry><option>log_file_path</option></entry>
18484 <entry>override compiled-in value</entry>
18485 </row>
18486 <row>
18487 <entry><option>log_selector</option></entry>
18488 <entry>set/unset optional logging</entry>
18489 </row>
18490 <row>
18491 <entry><option>log_timezone</option></entry>
18492 <entry>add timezone to log lines</entry>
18493 </row>
18494 <row>
18495 <entry><option>message_logs</option></entry>
18496 <entry>create per-message logs</entry>
18497 </row>
18498 <row>
18499 <entry><option>preserve_message_logs</option></entry>
18500 <entry>after message completion</entry>
18501 </row>
18502 <row>
18503 <entry><option>process_log_path</option></entry>
18504 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18505 </row>
18506 <row>
18507 <entry><option>syslog_duplication</option></entry>
18508 <entry>controls duplicate log lines on syslog</entry>
18509 </row>
18510 <row>
18511 <entry><option>syslog_facility</option></entry>
18512 <entry>set syslog <quote>facility</quote> field</entry>
18513 </row>
18514 <row>
18515 <entry><option>syslog_processname</option></entry>
18516 <entry>set syslog <quote>ident</quote> field</entry>
18517 </row>
18518 <row>
18519 <entry><option>syslog_timestamp</option></entry>
18520 <entry>timestamp syslog lines</entry>
18521 </row>
18522 <row>
18523 <entry><option>write_rejectlog</option></entry>
18524 <entry>control use of message log</entry>
18525 </row>
18526 </tbody>
18527 </tgroup>
18528 </informaltable>
18529 </section>
18530 <section>
18531 <title>Frozen messages</title>
18532 <informaltable frame="none">
18533 <tgroup cols="2" colsep="0" rowsep="0">
18534 <colspec colwidth="196pt" align="left"/>
18535 <colspec colwidth="254pt" align="left"/>
18536 <tbody>
18537 <row>
18538 <entry><option>auto_thaw</option></entry>
18539 <entry>sets time for retrying frozen messages</entry>
18540 </row>
18541 <row>
18542 <entry><option>freeze_tell</option></entry>
18543 <entry>send message when freezing</entry>
18544 </row>
18545 <row>
18546 <entry><option>move_frozen_messages</option></entry>
18547 <entry>to another directory</entry>
18548 </row>
18549 <row>
18550 <entry><option>timeout_frozen_after</option></entry>
18551 <entry>keep frozen messages only so long</entry>
18552 </row>
18553 </tbody>
18554 </tgroup>
18555 </informaltable>
18556 </section>
18557 <section>
18558 <title>Data lookups</title>
18559 <informaltable frame="none">
18560 <tgroup cols="2" colsep="0" rowsep="0">
18561 <colspec colwidth="196pt" align="left"/>
18562 <colspec colwidth="254pt" align="left"/>
18563 <tbody>
18564 <row>
18565 <entry><option>ldap_default_servers</option></entry>
18566 <entry>used if no server in query</entry>
18567 </row>
18568 <row>
18569 <entry><option>ldap_version</option></entry>
18570 <entry>set protocol version</entry>
18571 </row>
18572 <row>
18573 <entry><option>lookup_open_max</option></entry>
18574 <entry>lookup files held open</entry>
18575 </row>
18576 <row>
18577 <entry><option>mysql_servers</option></entry>
18578 <entry>as it says</entry>
18579 </row>
18580 <row>
18581 <entry><option>oracle_servers</option></entry>
18582 <entry>as it says</entry>
18583 </row>
18584 <row>
18585 <entry><option>pgsql_servers</option></entry>
18586 <entry>as it says</entry>
18587 </row>
18588 <row>
18589 <entry><option>sqlite_lock_timeout</option></entry>
18590 <entry>as it says</entry>
18591 </row>
18592 </tbody>
18593 </tgroup>
18594 </informaltable>
18595 </section>
18596 <section>
18597 <title>Message ids</title>
18598 <informaltable frame="none">
18599 <tgroup cols="2" colsep="0" rowsep="0">
18600 <colspec colwidth="196pt" align="left"/>
18601 <colspec colwidth="254pt" align="left"/>
18602 <tbody>
18603 <row>
18604 <entry><option>message_id_header_domain</option></entry>
18605 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18606 </row>
18607 <row>
18608 <entry><option>message_id_header_text</option></entry>
18609 <entry>ditto</entry>
18610 </row>
18611 </tbody>
18612 </tgroup>
18613 </informaltable>
18614 </section>
18615 <section>
18616 <title>Embedded Perl Startup</title>
18617 <informaltable frame="none">
18618 <tgroup cols="2" colsep="0" rowsep="0">
18619 <colspec colwidth="196pt" align="left"/>
18620 <colspec colwidth="254pt" align="left"/>
18621 <tbody>
18622 <row>
18623 <entry><option>perl_at_start</option></entry>
18624 <entry>always start the interpreter</entry>
18625 </row>
18626 <row>
18627 <entry><option>perl_startup</option></entry>
18628 <entry>code to obey when starting Perl</entry>
18629 </row>
18630 </tbody>
18631 </tgroup>
18632 </informaltable>
18633 </section>
18634 <section>
18635 <title>Daemon</title>
18636 <informaltable frame="none">
18637 <tgroup cols="2" colsep="0" rowsep="0">
18638 <colspec colwidth="196pt" align="left"/>
18639 <colspec colwidth="254pt" align="left"/>
18640 <tbody>
18641 <row>
18642 <entry><option>daemon_smtp_ports</option></entry>
18643 <entry>default ports</entry>
18644 </row>
18645 <row>
18646 <entry><option>daemon_startup_retries</option></entry>
18647 <entry>number of times to retry</entry>
18648 </row>
18649 <row>
18650 <entry><option>daemon_startup_sleep</option></entry>
18651 <entry>time to sleep between tries</entry>
18652 </row>
18653 <row>
18654 <entry><option>extra_local_interfaces</option></entry>
18655 <entry>not necessarily listened on</entry>
18656 </row>
18657 <row>
18658 <entry><option>local_interfaces</option></entry>
18659 <entry>on which to listen, with optional ports</entry>
18660 </row>
18661 <row>
18662 <entry><option>pid_file_path</option></entry>
18663 <entry>override compiled-in value</entry>
18664 </row>
18665 <row>
18666 <entry><option>queue_run_max</option></entry>
18667 <entry>maximum simultaneous queue runners</entry>
18668 </row>
18669 </tbody>
18670 </tgroup>
18671 </informaltable>
18672 </section>
18673 <section>
18674 <title>Resource control</title>
18675 <informaltable frame="none">
18676 <tgroup cols="2" colsep="0" rowsep="0">
18677 <colspec colwidth="196pt" align="left"/>
18678 <colspec colwidth="254pt" align="left"/>
18679 <tbody>
18680 <row>
18681 <entry><option>check_log_inodes</option></entry>
18682 <entry>before accepting a message</entry>
18683 </row>
18684 <row>
18685 <entry><option>check_log_space</option></entry>
18686 <entry>before accepting a message</entry>
18687 </row>
18688 <row>
18689 <entry><option>check_spool_inodes</option></entry>
18690 <entry>before accepting a message</entry>
18691 </row>
18692 <row>
18693 <entry><option>check_spool_space</option></entry>
18694 <entry>before accepting a message</entry>
18695 </row>
18696 <row>
18697 <entry><option>deliver_queue_load_max</option></entry>
18698 <entry>no queue deliveries if load high</entry>
18699 </row>
18700 <row>
18701 <entry><option>queue_only_load</option></entry>
18702 <entry>queue incoming if load high</entry>
18703 </row>
18704 <row>
18705 <entry><option>queue_run_max</option></entry>
18706 <entry>maximum simultaneous queue runners</entry>
18707 </row>
18708 <row>
18709 <entry><option>remote_max_parallel</option></entry>
18710 <entry>parallel SMTP delivery per message</entry>
18711 </row>
18712 <row>
18713 <entry><option>smtp_accept_max</option></entry>
18714 <entry>simultaneous incoming connections</entry>
18715 </row>
18716 <row>
18717 <entry><option>smtp_accept_max_nonmail</option></entry>
18718 <entry>non-mail commands</entry>
18719 </row>
18720 <row>
18721 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18722 <entry>hosts to which the limit applies</entry>
18723 </row>
18724 <row>
18725 <entry><option>smtp_accept_max_per_connection</option></entry>
18726 <entry>messages per connection</entry>
18727 </row>
18728 <row>
18729 <entry><option>smtp_accept_max_per_host</option></entry>
18730 <entry>connections from one host</entry>
18731 </row>
18732 <row>
18733 <entry><option>smtp_accept_queue</option></entry>
18734 <entry>queue mail if more connections</entry>
18735 </row>
18736 <row>
18737 <entry><option>smtp_accept_queue_per_connection</option></entry>
18738 <entry>queue if more messages per connection</entry>
18739 </row>
18740 <row>
18741 <entry><option>smtp_accept_reserve</option></entry>
18742 <entry>only reserve hosts if more connections</entry>
18743 </row>
18744 <row>
18745 <entry><option>smtp_check_spool_space</option></entry>
18746 <entry>from SIZE on MAIL command</entry>
18747 </row>
18748 <row>
18749 <entry><option>smtp_connect_backlog</option></entry>
18750 <entry>passed to TCP/IP stack</entry>
18751 </row>
18752 <row>
18753 <entry><option>smtp_load_reserve</option></entry>
18754 <entry>SMTP from reserved hosts if load high</entry>
18755 </row>
18756 <row>
18757 <entry><option>smtp_reserve_hosts</option></entry>
18758 <entry>these are the reserve hosts</entry>
18759 </row>
18760 </tbody>
18761 </tgroup>
18762 </informaltable>
18763 </section>
18764 <section>
18765 <title>Policy controls</title>
18766 <informaltable frame="none">
18767 <tgroup cols="2" colsep="0" rowsep="0">
18768 <colspec colwidth="196pt" align="left"/>
18769 <colspec colwidth="254pt" align="left"/>
18770 <tbody>
18771 <row>
18772 <entry><option>acl_not_smtp</option></entry>
18773 <entry>ACL for non-SMTP messages</entry>
18774 </row>
18775 <row>
18776 <entry><option>acl_not_smtp_mime</option></entry>
18777 <entry>ACL for non-SMTP MIME parts</entry>
18778 </row>
18779 <row>
18780 <entry><option>acl_not_smtp_start</option></entry>
18781 <entry>ACL for start of non-SMTP message</entry>
18782 </row>
18783 <row>
18784 <entry><option>acl_smtp_auth</option></entry>
18785 <entry>ACL for AUTH</entry>
18786 </row>
18787 <row>
18788 <entry><option>acl_smtp_connect</option></entry>
18789 <entry>ACL for connection</entry>
18790 </row>
18791 <row>
18792 <entry><option>acl_smtp_data</option></entry>
18793 <entry>ACL for DATA</entry>
18794 </row>
18795 <row>
18796 <entry><option>acl_smtp_etrn</option></entry>
18797 <entry>ACL for ETRN</entry>
18798 </row>
18799 <row>
18800 <entry><option>acl_smtp_expn</option></entry>
18801 <entry>ACL for EXPN</entry>
18802 </row>
18803 <row>
18804 <entry><option>acl_smtp_helo</option></entry>
18805 <entry>ACL for EHLO or HELO</entry>
18806 </row>
18807 <row>
18808 <entry><option>acl_smtp_mail</option></entry>
18809 <entry>ACL for MAIL</entry>
18810 </row>
18811 <row>
18812 <entry><option>acl_smtp_mailauth</option></entry>
18813 <entry>ACL for AUTH on MAIL command</entry>
18814 </row>
18815 <row>
18816 <entry><option>acl_smtp_mime</option></entry>
18817 <entry>ACL for MIME parts</entry>
18818 </row>
18819 <row>
18820 <entry><option>acl_smtp_predata</option></entry>
18821 <entry>ACL for start of data</entry>
18822 </row>
18823 <row>
18824 <entry><option>acl_smtp_quit</option></entry>
18825 <entry>ACL for QUIT</entry>
18826 </row>
18827 <row>
18828 <entry><option>acl_smtp_rcpt</option></entry>
18829 <entry>ACL for RCPT</entry>
18830 </row>
18831 <row>
18832 <entry><option>acl_smtp_starttls</option></entry>
18833 <entry>ACL for STARTTLS</entry>
18834 </row>
18835 <row>
18836 <entry><option>acl_smtp_vrfy</option></entry>
18837 <entry>ACL for VRFY</entry>
18838 </row>
18839 <row>
18840 <entry><option>av_scanner</option></entry>
18841 <entry>specify virus scanner</entry>
18842 </row>
18843 <row>
18844 <entry><option>check_rfc2047_length</option></entry>
18845 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18846 </row>
18847 <row>
18848 <entry><option>dns_csa_search_limit</option></entry>
18849 <entry>control CSA parent search depth</entry>
18850 </row>
18851 <row>
18852 <entry><option>dns_csa_use_reverse</option></entry>
18853 <entry>en/disable CSA IP reverse search</entry>
18854 </row>
18855 <row>
18856 <entry><option>header_maxsize</option></entry>
18857 <entry>total size of message header</entry>
18858 </row>
18859 <row>
18860 <entry><option>header_line_maxsize</option></entry>
18861 <entry>individual header line limit</entry>
18862 </row>
18863 <row>
18864 <entry><option>helo_accept_junk_hosts</option></entry>
18865 <entry>allow syntactic junk from these hosts</entry>
18866 </row>
18867 <row>
18868 <entry><option>helo_allow_chars</option></entry>
18869 <entry>allow illegal chars in HELO names</entry>
18870 </row>
18871 <row>
18872 <entry><option>helo_lookup_domains</option></entry>
18873 <entry>lookup hostname for these HELO names</entry>
18874 </row>
18875 <row>
18876 <entry><option>helo_try_verify_hosts</option></entry>
18877 <entry>HELO soft-checked for these hosts</entry>
18878 </row>
18879 <row>
18880 <entry><option>helo_verify_hosts</option></entry>
18881 <entry>HELO hard-checked for these hosts</entry>
18882 </row>
18883 <row>
18884 <entry><option>host_lookup</option></entry>
18885 <entry>host name looked up for these hosts</entry>
18886 </row>
18887 <row>
18888 <entry><option>host_lookup_order</option></entry>
18889 <entry>order of DNS and local name lookups</entry>
18890 </row>
18891 <row>
18892 <entry><option>host_reject_connection</option></entry>
18893 <entry>reject connection from these hosts</entry>
18894 </row>
18895 <row>
18896 <entry><option>hosts_treat_as_local</option></entry>
18897 <entry>useful in some cluster configurations</entry>
18898 </row>
18899 <row>
18900 <entry><option>local_scan_timeout</option></entry>
18901 <entry>timeout for <function>local_scan()</function></entry>
18902 </row>
18903 <row>
18904 <entry><option>message_size_limit</option></entry>
18905 <entry>for all messages</entry>
18906 </row>
18907 <row>
18908 <entry><option>percent_hack_domains</option></entry>
18909 <entry>recognize %-hack for these domains</entry>
18910 </row>
18911 <row>
18912 <entry><option>spamd_address</option></entry>
18913 <entry>set interface to SpamAssassin</entry>
18914 </row>
18915 <row>
18916 <entry><option>strict_acl_vars</option></entry>
18917 <entry>object to unset ACL variables</entry>
18918 </row>
18919 </tbody>
18920 </tgroup>
18921 </informaltable>
18922 </section>
18923 <section>
18924 <title>Callout cache</title>
18925 <informaltable frame="none">
18926 <tgroup cols="2" colsep="0" rowsep="0">
18927 <colspec colwidth="196pt" align="left"/>
18928 <colspec colwidth="254pt" align="left"/>
18929 <tbody>
18930 <row>
18931 <entry><option>callout_domain_negative_expire</option></entry>
18932 <entry>timeout for negative domain cache item</entry>
18933 </row>
18934 <row>
18935 <entry><option>callout_domain_positive_expire</option></entry>
18936 <entry>timeout for positive domain cache item</entry>
18937 </row>
18938 <row>
18939 <entry><option>callout_negative_expire</option></entry>
18940 <entry>timeout for negative address cache item</entry>
18941 </row>
18942 <row>
18943 <entry><option>callout_positive_expire</option></entry>
18944 <entry>timeout for positive address cache item</entry>
18945 </row>
18946 <row>
18947 <entry><option>callout_random_local_part</option></entry>
18948 <entry>string to use for <quote>random</quote> testing</entry>
18949 </row>
18950 </tbody>
18951 </tgroup>
18952 </informaltable>
18953 </section>
18954 <section>
18955 <title>TLS</title>
18956 <informaltable frame="none">
18957 <tgroup cols="2" colsep="0" rowsep="0">
18958 <colspec colwidth="196pt" align="left"/>
18959 <colspec colwidth="254pt" align="left"/>
18960 <tbody>
18961 <row>
18962 <entry><option>tls_advertise_hosts</option></entry>
18963 <entry>advertise TLS to these hosts</entry>
18964 </row>
18965 <row>
18966 <entry><option>tls_certificate</option></entry>
18967 <entry>location of server certificate</entry>
18968 </row>
18969 <row>
18970 <entry><option>tls_crl</option></entry>
18971 <entry>certificate revocation list</entry>
18972 </row>
18973 <row>
18974 <entry><option>tls_dhparam</option></entry>
18975 <entry>DH parameters for server</entry>
18976 </row>
18977 <row>
18978 <entry><option>tls_on_connect_ports</option></entry>
18979 <entry>specify SSMTP (SMTPS) ports</entry>
18980 </row>
18981 <row>
18982 <entry><option>tls_privatekey</option></entry>
18983 <entry>location of server private key</entry>
18984 </row>
18985 <row>
18986 <entry><option>tls_remember_esmtp</option></entry>
18987 <entry>don&#x2019;t reset after starting TLS</entry>
18988 </row>
18989 <row>
18990 <entry><option>tls_require_ciphers</option></entry>
18991 <entry>specify acceptable cipers</entry>
18992 </row>
18993 <row>
18994 <entry><option>tls_try_verify_hosts</option></entry>
18995 <entry>try to verify client certificate</entry>
18996 </row>
18997 <row>
18998 <entry><option>tls_verify_certificates</option></entry>
18999 <entry>expected client certificates</entry>
19000 </row>
19001 <row>
19002 <entry><option>tls_verify_hosts</option></entry>
19003 <entry>insist on client certificate verify</entry>
19004 </row>
19005 </tbody>
19006 </tgroup>
19007 </informaltable>
19008 </section>
19009 <section>
19010 <title>Local user handling</title>
19011 <informaltable frame="none">
19012 <tgroup cols="2" colsep="0" rowsep="0">
19013 <colspec colwidth="196pt" align="left"/>
19014 <colspec colwidth="254pt" align="left"/>
19015 <tbody>
19016 <row>
19017 <entry><option>finduser_retries</option></entry>
19018 <entry>useful in NIS environments</entry>
19019 </row>
19020 <row>
19021 <entry><option>gecos_name</option></entry>
19022 <entry>used when creating <emphasis>Sender:</emphasis></entry>
19023 </row>
19024 <row>
19025 <entry><option>gecos_pattern</option></entry>
19026 <entry>ditto</entry>
19027 </row>
19028 <row>
19029 <entry><option>max_username_length</option></entry>
19030 <entry>for systems that truncate</entry>
19031 </row>
19032 <row>
19033 <entry><option>unknown_login</option></entry>
19034 <entry>used when no login name found</entry>
19035 </row>
19036 <row>
19037 <entry><option>unknown_username</option></entry>
19038 <entry>ditto</entry>
19039 </row>
19040 <row>
19041 <entry><option>uucp_from_pattern</option></entry>
19042 <entry>for recognizing <quote>From </quote> lines</entry>
19043 </row>
19044 <row>
19045 <entry><option>uucp_from_sender</option></entry>
19046 <entry>ditto</entry>
19047 </row>
19048 </tbody>
19049 </tgroup>
19050 </informaltable>
19051 </section>
19052 <section>
19053 <title>All incoming messages (SMTP and non-SMTP)</title>
19054 <informaltable frame="none">
19055 <tgroup cols="2" colsep="0" rowsep="0">
19056 <colspec colwidth="196pt" align="left"/>
19057 <colspec colwidth="254pt" align="left"/>
19058 <tbody>
19059 <row>
19060 <entry><option>header_maxsize</option></entry>
19061 <entry>total size of message header</entry>
19062 </row>
19063 <row>
19064 <entry><option>header_line_maxsize</option></entry>
19065 <entry>individual header line limit</entry>
19066 </row>
19067 <row>
19068 <entry><option>message_size_limit</option></entry>
19069 <entry>applies to all messages</entry>
19070 </row>
19071 <row>
19072 <entry><option>percent_hack_domains</option></entry>
19073 <entry>recognize %-hack for these domains</entry>
19074 </row>
19075 <row>
19076 <entry><option>received_header_text</option></entry>
19077 <entry>expanded to make <emphasis>Received:</emphasis></entry>
19078 </row>
19079 <row>
19080 <entry><option>received_headers_max</option></entry>
19081 <entry>for mail loop detection</entry>
19082 </row>
19083 <row>
19084 <entry><option>recipients_max</option></entry>
19085 <entry>limit per message</entry>
19086 </row>
19087 <row>
19088 <entry><option>recipients_max_reject</option></entry>
19089 <entry>permanently reject excess</entry>
19090 </row>
19091 </tbody>
19092 </tgroup>
19093 </informaltable>
19094 </section>
19095 <section>
19096 <title>Non-SMTP incoming messages</title>
19097 <informaltable frame="none">
19098 <tgroup cols="2" colsep="0" rowsep="0">
19099 <colspec colwidth="196pt" align="left"/>
19100 <colspec colwidth="254pt" align="left"/>
19101 <tbody>
19102 <row>
19103 <entry><option>receive_timeout</option></entry>
19104 <entry>for non-SMTP messages</entry>
19105 </row>
19106 </tbody>
19107 </tgroup>
19108 </informaltable>
19109 </section>
19110 <section>
19111 <title>Incoming SMTP messages</title>
19112 <para>
19113 See also the <emphasis>Policy controls</emphasis> section above.
19114 </para>
19115 <informaltable frame="none">
19116 <tgroup cols="2" colsep="0" rowsep="0">
19117 <colspec colwidth="196pt" align="left"/>
19118 <colspec colwidth="254pt" align="left"/>
19119 <tbody>
19120 <row>
19121 <entry><option>host_lookup</option></entry>
19122 <entry>host name looked up for these hosts</entry>
19123 </row>
19124 <row>
19125 <entry><option>host_lookup_order</option></entry>
19126 <entry>order of DNS and local name lookups</entry>
19127 </row>
19128 <row>
19129 <entry><option>recipient_unqualified_hosts</option></entry>
19130 <entry>may send unqualified recipients</entry>
19131 </row>
19132 <row>
19133 <entry><option>rfc1413_hosts</option></entry>
19134 <entry>make ident calls to these hosts</entry>
19135 </row>
19136 <row>
19137 <entry><option>rfc1413_query_timeout</option></entry>
19138 <entry>zero disables ident calls</entry>
19139 </row>
19140 <row>
19141 <entry><option>sender_unqualified_hosts</option></entry>
19142 <entry>may send unqualified senders</entry>
19143 </row>
19144 <row>
19145 <entry><option>smtp_accept_keepalive</option></entry>
19146 <entry>some TCP/IP magic</entry>
19147 </row>
19148 <row>
19149 <entry><option>smtp_accept_max</option></entry>
19150 <entry>simultaneous incoming connections</entry>
19151 </row>
19152 <row>
19153 <entry><option>smtp_accept_max_nonmail</option></entry>
19154 <entry>non-mail commands</entry>
19155 </row>
19156 <row>
19157 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
19158 <entry>hosts to which the limit applies</entry>
19159 </row>
19160 <row>
19161 <entry><option>smtp_accept_max_per_connection</option></entry>
19162 <entry>messages per connection</entry>
19163 </row>
19164 <row>
19165 <entry><option>smtp_accept_max_per_host</option></entry>
19166 <entry>connections from one host</entry>
19167 </row>
19168 <row>
19169 <entry><option>smtp_accept_queue</option></entry>
19170 <entry>queue mail if more connections</entry>
19171 </row>
19172 <row>
19173 <entry><option>smtp_accept_queue_per_connection</option></entry>
19174 <entry>queue if more messages per connection</entry>
19175 </row>
19176 <row>
19177 <entry><option>smtp_accept_reserve</option></entry>
19178 <entry>only reserve hosts if more connections</entry>
19179 </row>
19180 <row>
19181 <entry><option>smtp_active_hostname</option></entry>
19182 <entry>host name to use in messages</entry>
19183 </row>
19184 <row>
19185 <entry><option>smtp_banner</option></entry>
19186 <entry>text for welcome banner</entry>
19187 </row>
19188 <row>
19189 <entry><option>smtp_check_spool_space</option></entry>
19190 <entry>from SIZE on MAIL command</entry>
19191 </row>
19192 <row>
19193 <entry><option>smtp_connect_backlog</option></entry>
19194 <entry>passed to TCP/IP stack</entry>
19195 </row>
19196 <row>
19197 <entry><option>smtp_enforce_sync</option></entry>
19198 <entry>of SMTP command/responses</entry>
19199 </row>
19200 <row>
19201 <entry><option>smtp_etrn_command</option></entry>
19202 <entry>what to run for ETRN</entry>
19203 </row>
19204 <row>
19205 <entry><option>smtp_etrn_serialize</option></entry>
19206 <entry>only one at once</entry>
19207 </row>
19208 <row>
19209 <entry><option>smtp_load_reserve</option></entry>
19210 <entry>only reserve hosts if this load</entry>
19211 </row>
19212 <row>
19213 <entry><option>smtp_max_unknown_commands</option></entry>
19214 <entry>before dropping connection</entry>
19215 </row>
19216 <row>
19217 <entry><option>smtp_ratelimit_hosts</option></entry>
19218 <entry>apply ratelimiting to these hosts</entry>
19219 </row>
19220 <row>
19221 <entry><option>smtp_ratelimit_mail</option></entry>
19222 <entry>ratelimit for MAIL commands</entry>
19223 </row>
19224 <row>
19225 <entry><option>smtp_ratelimit_rcpt</option></entry>
19226 <entry>ratelimit for RCPT commands</entry>
19227 </row>
19228 <row>
19229 <entry><option>smtp_receive_timeout</option></entry>
19230 <entry>per command or data line</entry>
19231 </row>
19232 <row>
19233 <entry><option>smtp_reserve_hosts</option></entry>
19234 <entry>these are the reserve hosts</entry>
19235 </row>
19236 <row>
19237 <entry><option>smtp_return_error_details</option></entry>
19238 <entry>give detail on rejections</entry>
19239 </row>
19240 </tbody>
19241 </tgroup>
19242 </informaltable>
19243 </section>
19244 <section>
19245 <title>SMTP extensions</title>
19246 <informaltable frame="none">
19247 <tgroup cols="2" colsep="0" rowsep="0">
19248 <colspec colwidth="196pt" align="left"/>
19249 <colspec colwidth="254pt" align="left"/>
19250 <tbody>
19251 <row>
19252 <entry><option>accept_8bitmime</option></entry>
19253 <entry>advertise 8BITMIME</entry>
19254 </row>
19255 <row>
19256 <entry><option>auth_advertise_hosts</option></entry>
19257 <entry>advertise AUTH to these hosts</entry>
19258 </row>
19259 <row>
19260 <entry><option>ignore_fromline_hosts</option></entry>
19261 <entry>allow <quote>From </quote> from these hosts</entry>
19262 </row>
19263 <row>
19264 <entry><option>ignore_fromline_local</option></entry>
19265 <entry>allow <quote>From </quote> from local SMTP</entry>
19266 </row>
19267 <row>
19268 <entry><option>pipelining_advertise_hosts</option></entry>
19269 <entry>advertise pipelining to these hosts</entry>
19270 </row>
19271 <row>
19272 <entry><option>tls_advertise_hosts</option></entry>
19273 <entry>advertise TLS to these hosts</entry>
19274 </row>
19275 </tbody>
19276 </tgroup>
19277 </informaltable>
19278 </section>
19279 <section>
19280 <title>Processing messages</title>
19281 <informaltable frame="none">
19282 <tgroup cols="2" colsep="0" rowsep="0">
19283 <colspec colwidth="196pt" align="left"/>
19284 <colspec colwidth="254pt" align="left"/>
19285 <tbody>
19286 <row>
19287 <entry><option>allow_domain_literals</option></entry>
19288 <entry>recognize domain literal syntax</entry>
19289 </row>
19290 <row>
19291 <entry><option>allow_mx_to_ip</option></entry>
19292 <entry>allow MX to point to IP address</entry>
19293 </row>
19294 <row>
19295 <entry><option>allow_utf8_domains</option></entry>
19296 <entry>in addresses</entry>
19297 </row>
19298 <row>
19299 <entry><option>check_rfc2047_length</option></entry>
19300 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19301 </row>
19302 <row>
19303 <entry><option>delivery_date_remove</option></entry>
19304 <entry>from incoming messages</entry>
19305 </row>
19306 <row>
19307 <entry><option>envelope_to_remove</option></entry>
19308 <entry>from incoming messages</entry>
19309 </row>
19310 <row>
19311 <entry><option>extract_addresses_remove_arguments</option></entry>
19312 <entry>affects <option>-t</option> processing</entry>
19313 </row>
19314 <row>
19315 <entry><option>headers_charset</option></entry>
19316 <entry>default for translations</entry>
19317 </row>
19318 <row>
19319 <entry><option>qualify_domain</option></entry>
19320 <entry>default for senders</entry>
19321 </row>
19322 <row>
19323 <entry><option>qualify_recipient</option></entry>
19324 <entry>default for recipients</entry>
19325 </row>
19326 <row>
19327 <entry><option>return_path_remove</option></entry>
19328 <entry>from incoming messages</entry>
19329 </row>
19330 <row>
19331 <entry><option>strip_excess_angle_brackets</option></entry>
19332 <entry>in addresses</entry>
19333 </row>
19334 <row>
19335 <entry><option>strip_trailing_dot</option></entry>
19336 <entry>at end of addresses</entry>
19337 </row>
19338 <row>
19339 <entry><option>untrusted_set_sender</option></entry>
19340 <entry>untrusted can set envelope sender</entry>
19341 </row>
19342 </tbody>
19343 </tgroup>
19344 </informaltable>
19345 </section>
19346 <section>
19347 <title>System filter</title>
19348 <informaltable frame="none">
19349 <tgroup cols="2" colsep="0" rowsep="0">
19350 <colspec colwidth="196pt" align="left"/>
19351 <colspec colwidth="254pt" align="left"/>
19352 <tbody>
19353 <row>
19354 <entry><option>system_filter</option></entry>
19355 <entry>locate system filter</entry>
19356 </row>
19357 <row>
19358 <entry><option>system_filter_directory_transport</option></entry>
19359 <entry>transport for delivery to a directory</entry>
19360 </row>
19361 <row>
19362 <entry><option>system_filter_file_transport</option></entry>
19363 <entry>transport for delivery to a file</entry>
19364 </row>
19365 <row>
19366 <entry><option>system_filter_group</option></entry>
19367 <entry>group for filter running</entry>
19368 </row>
19369 <row>
19370 <entry><option>system_filter_pipe_transport</option></entry>
19371 <entry>transport for delivery to a pipe</entry>
19372 </row>
19373 <row>
19374 <entry><option>system_filter_reply_transport</option></entry>
19375 <entry>transport for autoreply delivery</entry>
19376 </row>
19377 <row>
19378 <entry><option>system_filter_user</option></entry>
19379 <entry>user for filter running</entry>
19380 </row>
19381 </tbody>
19382 </tgroup>
19383 </informaltable>
19384 </section>
19385 <section>
19386 <title>Routing and delivery</title>
19387 <informaltable frame="none">
19388 <tgroup cols="2" colsep="0" rowsep="0">
19389 <colspec colwidth="196pt" align="left"/>
19390 <colspec colwidth="254pt" align="left"/>
19391 <tbody>
19392 <row>
19393 <entry><option>disable_ipv6</option></entry>
19394 <entry>do no IPv6 processing</entry>
19395 </row>
19396 <row>
19397 <entry><option>dns_again_means_nonexist</option></entry>
19398 <entry>for broken domains</entry>
19399 </row>
19400 <row>
19401 <entry><option>dns_check_names_pattern</option></entry>
19402 <entry>pre-DNS syntax check</entry>
19403 </row>
19404 <row>
19405 <entry><option>dns_ipv4_lookup</option></entry>
19406 <entry>only v4 lookup for these domains</entry>
19407 </row>
19408 <row>
19409 <entry><option>dns_retrans</option></entry>
19410 <entry>parameter for resolver</entry>
19411 </row>
19412 <row>
19413 <entry><option>dns_retry</option></entry>
19414 <entry>parameter for resolver</entry>
19415 </row>
19416 <row>
19417 <entry><option>hold_domains</option></entry>
19418 <entry>hold delivery for these domains</entry>
19419 </row>
19420 <row>
19421 <entry><option>local_interfaces</option></entry>
19422 <entry>for routing checks</entry>
19423 </row>
19424 <row>
19425 <entry><option>queue_domains</option></entry>
19426 <entry>no immediate delivery for these</entry>
19427 </row>
19428 <row>
19429 <entry><option>queue_only</option></entry>
19430 <entry>no immediate delivery at all</entry>
19431 </row>
19432 <row>
19433 <entry><option>queue_only_file</option></entry>
19434 <entry>no immediate delivery if file exists</entry>
19435 </row>
19436 <row>
19437 <entry><option>queue_only_load</option></entry>
19438 <entry>no immediate delivery if load is high</entry>
19439 </row>
19440 <row>
19441 <entry><option>queue_only_override</option></entry>
19442 <entry>allow command line to override</entry>
19443 </row>
19444 <row>
19445 <entry><option>queue_run_in_order</option></entry>
19446 <entry>order of arrival</entry>
19447 </row>
19448 <row>
19449 <entry><option>queue_run_max</option></entry>
19450 <entry>of simultaneous queue runners</entry>
19451 </row>
19452 <row>
19453 <entry><option>queue_smtp_domains</option></entry>
19454 <entry>no immediate SMTP delivery for these</entry>
19455 </row>
19456 <row>
19457 <entry><option>remote_max_parallel</option></entry>
19458 <entry>parallel SMTP delivery per message</entry>
19459 </row>
19460 <row>
19461 <entry><option>remote_sort_domains</option></entry>
19462 <entry>order of remote deliveries</entry>
19463 </row>
19464 <row>
19465 <entry><option>retry_data_expire</option></entry>
19466 <entry>timeout for retry data</entry>
19467 </row>
19468 <row>
19469 <entry><option>retry_interval_max</option></entry>
19470 <entry>safety net for retry rules</entry>
19471 </row>
19472 </tbody>
19473 </tgroup>
19474 </informaltable>
19475 </section>
19476 <section>
19477 <title>Bounce and warning messages</title>
19478 <informaltable frame="none">
19479 <tgroup cols="2" colsep="0" rowsep="0">
19480 <colspec colwidth="196pt" align="left"/>
19481 <colspec colwidth="254pt" align="left"/>
19482 <tbody>
19483 <row>
19484 <entry><option>bounce_message_file</option></entry>
19485 <entry>content of bounce</entry>
19486 </row>
19487 <row>
19488 <entry><option>bounce_message_text</option></entry>
19489 <entry>content of bounce</entry>
19490 </row>
19491 <row>
19492 <entry><option>bounce_return_body</option></entry>
19493 <entry>include body if returning message</entry>
19494 </row>
19495 <row>
19496 <entry><option>bounce_return_message</option></entry>
19497 <entry>include original message in bounce</entry>
19498 </row>
19499 <row>
19500 <entry><option>bounce_return_size_limit</option></entry>
19501 <entry>limit on returned message</entry>
19502 </row>
19503 <row>
19504 <entry><option>bounce_sender_authentication</option></entry>
19505 <entry>send authenticated sender with bounce</entry>
19506 </row>
19507 <row>
19508 <entry><option>errors_copy</option></entry>
19509 <entry>copy bounce messages</entry>
19510 </row>
19511 <row>
19512 <entry><option>errors_reply_to</option></entry>
19513 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19514 </row>
19515 <row>
19516 <entry><option>delay_warning</option></entry>
19517 <entry>time schedule</entry>
19518 </row>
19519 <row>
19520 <entry><option>delay_warning_condition</option></entry>
19521 <entry>condition for warning messages</entry>
19522 </row>
19523 <row>
19524 <entry><option>ignore_bounce_errors_after</option></entry>
19525 <entry>discard undeliverable bounces</entry>
19526 </row>
19527 <row>
19528 <entry><option>smtp_return_error_details</option></entry>
19529 <entry>give detail on rejections</entry>
19530 </row>
19531 <row>
19532 <entry><option>warn_message_file</option></entry>
19533 <entry>content of warning message</entry>
19534 </row>
19535 </tbody>
19536 </tgroup>
19537 </informaltable>
19538 </section>
19539 <section id="SECTalomo">
19540 <title>Alphabetical list of main options</title>
19541 <para>
19542 Those options that undergo string expansion before use are marked with
19543 &dagger;.
19544 </para>
19545 <para>
19546 <indexterm role="option">
19547 <primary><option>accept_8bitmime</option></primary>
19548 </indexterm>
19549 </para>
19550 <informaltable frame="all">
19551 <tgroup cols="4" colsep="0" rowsep="0">
19552 <colspec colwidth="8*" align="left"/>
19553 <colspec colwidth="5*" align="center"/>
19554 <colspec colwidth="5*" align="center"/>
19555 <colspec colwidth="6*" align="right"/>
19556 <tbody>
19557 <row>
19558 <entry><option>accept_8bitmime</option></entry>
19559 <entry>Use: <emphasis>main</emphasis></entry>
19560 <entry>Type: <emphasis>boolean</emphasis></entry>
19561 <entry>Default: <emphasis>false</emphasis></entry>
19562 </row>
19563 </tbody>
19564 </tgroup>
19565 </informaltable>
19566 <para>
19567 <indexterm role="concept">
19568 <primary>8BITMIME</primary>
19569 </indexterm>
19570 <indexterm role="concept">
19571 <primary>8-bit characters</primary>
19572 </indexterm>
19573 This option causes Exim to send 8BITMIME in its response to an SMTP
19574 EHLO command, and to accept the BODY= parameter on MAIL commands.
19575 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19576 takes no steps to do anything special with messages received by this route.
19577 Consequently, this option is turned off by default.
19578 </para>
19579 <para>
19580 <indexterm role="option">
19581 <primary><option>acl_not_smtp</option></primary>
19582 </indexterm>
19583 </para>
19584 <informaltable frame="all">
19585 <tgroup cols="4" colsep="0" rowsep="0">
19586 <colspec colwidth="8*" align="left"/>
19587 <colspec colwidth="5*" align="center"/>
19588 <colspec colwidth="5*" align="center"/>
19589 <colspec colwidth="6*" align="right"/>
19590 <tbody>
19591 <row>
19592 <entry><option>acl_not_smtp</option></entry>
19593 <entry>Use: <emphasis>main</emphasis></entry>
19594 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19595 <entry>Default: <emphasis>unset</emphasis></entry>
19596 </row>
19597 </tbody>
19598 </tgroup>
19599 </informaltable>
19600 <para>
19601 <indexterm role="concept">
19602 <primary>access control lists (ACLs)</primary>
19603 <secondary>for non-SMTP messages</secondary>
19604 </indexterm>
19605 <indexterm role="concept">
19606 <primary>non-SMTP messages</primary>
19607 <secondary>ACLs for</secondary>
19608 </indexterm>
19609 This option defines the ACL that is run when a non-SMTP message has been
19610 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
19611 further details.
19612 </para>
19613 <para>
19614 <indexterm role="option">
19615 <primary><option>acl_not_smtp_mime</option></primary>
19616 </indexterm>
19617 </para>
19618 <informaltable frame="all">
19619 <tgroup cols="4" colsep="0" rowsep="0">
19620 <colspec colwidth="8*" align="left"/>
19621 <colspec colwidth="5*" align="center"/>
19622 <colspec colwidth="5*" align="center"/>
19623 <colspec colwidth="6*" align="right"/>
19624 <tbody>
19625 <row>
19626 <entry><option>acl_not_smtp_mime</option></entry>
19627 <entry>Use: <emphasis>main</emphasis></entry>
19628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19629 <entry>Default: <emphasis>unset</emphasis></entry>
19630 </row>
19631 </tbody>
19632 </tgroup>
19633 </informaltable>
19634 <para>
19635 This option defines the ACL that is run for individual MIME parts of non-SMTP
19636 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19637 SMTP messages.
19638 </para>
19639 <para>
19640 <indexterm role="option">
19641 <primary><option>acl_not_smtp_start</option></primary>
19642 </indexterm>
19643 </para>
19644 <informaltable frame="all">
19645 <tgroup cols="4" colsep="0" rowsep="0">
19646 <colspec colwidth="8*" align="left"/>
19647 <colspec colwidth="5*" align="center"/>
19648 <colspec colwidth="5*" align="center"/>
19649 <colspec colwidth="6*" align="right"/>
19650 <tbody>
19651 <row>
19652 <entry><option>acl_not_smtp_start</option></entry>
19653 <entry>Use: <emphasis>main</emphasis></entry>
19654 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19655 <entry>Default: <emphasis>unset</emphasis></entry>
19656 </row>
19657 </tbody>
19658 </tgroup>
19659 </informaltable>
19660 <para>
19661 <indexterm role="concept">
19662 <primary>access control lists (ACLs)</primary>
19663 <secondary>at start of non-SMTP message</secondary>
19664 </indexterm>
19665 <indexterm role="concept">
19666 <primary>non-SMTP messages</primary>
19667 <secondary>ACLs for</secondary>
19668 </indexterm>
19669 This option defines the ACL that is run before Exim starts reading a
19670 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
19671 </para>
19672 <para>
19673 <indexterm role="option">
19674 <primary><option>acl_smtp_auth</option></primary>
19675 </indexterm>
19676 </para>
19677 <informaltable frame="all">
19678 <tgroup cols="4" colsep="0" rowsep="0">
19679 <colspec colwidth="8*" align="left"/>
19680 <colspec colwidth="5*" align="center"/>
19681 <colspec colwidth="5*" align="center"/>
19682 <colspec colwidth="6*" align="right"/>
19683 <tbody>
19684 <row>
19685 <entry><option>acl_smtp_auth</option></entry>
19686 <entry>Use: <emphasis>main</emphasis></entry>
19687 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19688 <entry>Default: <emphasis>unset</emphasis></entry>
19689 </row>
19690 </tbody>
19691 </tgroup>
19692 </informaltable>
19693 <para>
19694 <indexterm role="concept">
19695 <primary>access control lists (ACLs)</primary>
19696 <secondary>setting up for SMTP commands</secondary>
19697 </indexterm>
19698 <indexterm role="concept">
19699 <primary>AUTH</primary>
19700 <secondary>ACL for</secondary>
19701 </indexterm>
19702 This option defines the ACL that is run when an SMTP AUTH command is
19703 received. See chapter <xref linkend="CHAPACL"/> for further details.
19704 </para>
19705 <para>
19706 <indexterm role="option">
19707 <primary><option>acl_smtp_connect</option></primary>
19708 </indexterm>
19709 </para>
19710 <informaltable frame="all">
19711 <tgroup cols="4" colsep="0" rowsep="0">
19712 <colspec colwidth="8*" align="left"/>
19713 <colspec colwidth="5*" align="center"/>
19714 <colspec colwidth="5*" align="center"/>
19715 <colspec colwidth="6*" align="right"/>
19716 <tbody>
19717 <row>
19718 <entry><option>acl_smtp_connect</option></entry>
19719 <entry>Use: <emphasis>main</emphasis></entry>
19720 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19721 <entry>Default: <emphasis>unset</emphasis></entry>
19722 </row>
19723 </tbody>
19724 </tgroup>
19725 </informaltable>
19726 <para>
19727 <indexterm role="concept">
19728 <primary>access control lists (ACLs)</primary>
19729 <secondary>on SMTP connection</secondary>
19730 </indexterm>
19731 This option defines the ACL that is run when an SMTP connection is received.
19732 See chapter <xref linkend="CHAPACL"/> for further details.
19733 </para>
19734 <para>
19735 <indexterm role="option">
19736 <primary><option>acl_smtp_data</option></primary>
19737 </indexterm>
19738 </para>
19739 <informaltable frame="all">
19740 <tgroup cols="4" colsep="0" rowsep="0">
19741 <colspec colwidth="8*" align="left"/>
19742 <colspec colwidth="5*" align="center"/>
19743 <colspec colwidth="5*" align="center"/>
19744 <colspec colwidth="6*" align="right"/>
19745 <tbody>
19746 <row>
19747 <entry><option>acl_smtp_data</option></entry>
19748 <entry>Use: <emphasis>main</emphasis></entry>
19749 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19750 <entry>Default: <emphasis>unset</emphasis></entry>
19751 </row>
19752 </tbody>
19753 </tgroup>
19754 </informaltable>
19755 <para>
19756 <indexterm role="concept">
19757 <primary>DATA</primary>
19758 <secondary>ACL for</secondary>
19759 </indexterm>
19760 This option defines the ACL that is run after an SMTP DATA command has been
19761 processed and the message itself has been received, but before the final
19762 acknowledgement is sent. See chapter <xref linkend="CHAPACL"/> for further details.
19763 </para>
19764 <para>
19765 <indexterm role="option">
19766 <primary><option>acl_smtp_etrn</option></primary>
19767 </indexterm>
19768 </para>
19769 <informaltable frame="all">
19770 <tgroup cols="4" colsep="0" rowsep="0">
19771 <colspec colwidth="8*" align="left"/>
19772 <colspec colwidth="5*" align="center"/>
19773 <colspec colwidth="5*" align="center"/>
19774 <colspec colwidth="6*" align="right"/>
19775 <tbody>
19776 <row>
19777 <entry><option>acl_smtp_etrn</option></entry>
19778 <entry>Use: <emphasis>main</emphasis></entry>
19779 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19780 <entry>Default: <emphasis>unset</emphasis></entry>
19781 </row>
19782 </tbody>
19783 </tgroup>
19784 </informaltable>
19785 <para>
19786 <indexterm role="concept">
19787 <primary>ETRN</primary>
19788 <secondary>ACL for</secondary>
19789 </indexterm>
19790 This option defines the ACL that is run when an SMTP ETRN command is
19791 received. See chapter <xref linkend="CHAPACL"/> for further details.
19792 </para>
19793 <para>
19794 <indexterm role="option">
19795 <primary><option>acl_smtp_expn</option></primary>
19796 </indexterm>
19797 </para>
19798 <informaltable frame="all">
19799 <tgroup cols="4" colsep="0" rowsep="0">
19800 <colspec colwidth="8*" align="left"/>
19801 <colspec colwidth="5*" align="center"/>
19802 <colspec colwidth="5*" align="center"/>
19803 <colspec colwidth="6*" align="right"/>
19804 <tbody>
19805 <row>
19806 <entry><option>acl_smtp_expn</option></entry>
19807 <entry>Use: <emphasis>main</emphasis></entry>
19808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19809 <entry>Default: <emphasis>unset</emphasis></entry>
19810 </row>
19811 </tbody>
19812 </tgroup>
19813 </informaltable>
19814 <para>
19815 <indexterm role="concept">
19816 <primary>EXPN</primary>
19817 <secondary>ACL for</secondary>
19818 </indexterm>
19819 This option defines the ACL that is run when an SMTP EXPN command is
19820 received. See chapter <xref linkend="CHAPACL"/> for further details.
19821 </para>
19822 <para>
19823 <indexterm role="option">
19824 <primary><option>acl_smtp_helo</option></primary>
19825 </indexterm>
19826 </para>
19827 <informaltable frame="all">
19828 <tgroup cols="4" colsep="0" rowsep="0">
19829 <colspec colwidth="8*" align="left"/>
19830 <colspec colwidth="5*" align="center"/>
19831 <colspec colwidth="5*" align="center"/>
19832 <colspec colwidth="6*" align="right"/>
19833 <tbody>
19834 <row>
19835 <entry><option>acl_smtp_helo</option></entry>
19836 <entry>Use: <emphasis>main</emphasis></entry>
19837 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19838 <entry>Default: <emphasis>unset</emphasis></entry>
19839 </row>
19840 </tbody>
19841 </tgroup>
19842 </informaltable>
19843 <para>
19844 <indexterm role="concept">
19845 <primary>EHLO</primary>
19846 <secondary>ACL for</secondary>
19847 </indexterm>
19848 <indexterm role="concept">
19849 <primary>HELO</primary>
19850 <secondary>ACL for</secondary>
19851 </indexterm>
19852 This option defines the ACL that is run when an SMTP EHLO or HELO
19853 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
19854 </para>
19855 <para>
19856 <indexterm role="option">
19857 <primary><option>acl_smtp_mail</option></primary>
19858 </indexterm>
19859 </para>
19860 <informaltable frame="all">
19861 <tgroup cols="4" colsep="0" rowsep="0">
19862 <colspec colwidth="8*" align="left"/>
19863 <colspec colwidth="5*" align="center"/>
19864 <colspec colwidth="5*" align="center"/>
19865 <colspec colwidth="6*" align="right"/>
19866 <tbody>
19867 <row>
19868 <entry><option>acl_smtp_mail</option></entry>
19869 <entry>Use: <emphasis>main</emphasis></entry>
19870 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19871 <entry>Default: <emphasis>unset</emphasis></entry>
19872 </row>
19873 </tbody>
19874 </tgroup>
19875 </informaltable>
19876 <para>
19877 <indexterm role="concept">
19878 <primary>MAIL</primary>
19879 <secondary>ACL for</secondary>
19880 </indexterm>
19881 This option defines the ACL that is run when an SMTP MAIL command is
19882 received. See chapter <xref linkend="CHAPACL"/> for further details.
19883 </para>
19884 <para>
19885 <indexterm role="option">
19886 <primary><option>acl_smtp_mailauth</option></primary>
19887 </indexterm>
19888 </para>
19889 <informaltable frame="all">
19890 <tgroup cols="4" colsep="0" rowsep="0">
19891 <colspec colwidth="8*" align="left"/>
19892 <colspec colwidth="5*" align="center"/>
19893 <colspec colwidth="5*" align="center"/>
19894 <colspec colwidth="6*" align="right"/>
19895 <tbody>
19896 <row>
19897 <entry><option>acl_smtp_mailauth</option></entry>
19898 <entry>Use: <emphasis>main</emphasis></entry>
19899 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19900 <entry>Default: <emphasis>unset</emphasis></entry>
19901 </row>
19902 </tbody>
19903 </tgroup>
19904 </informaltable>
19905 <para>
19906 <indexterm role="concept">
19907 <primary>AUTH</primary>
19908 <secondary>on MAIL command</secondary>
19909 </indexterm>
19910 This option defines the ACL that is run when there is an AUTH parameter on
19911 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
19912 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
19913 </para>
19914 <para>
19915 <indexterm role="option">
19916 <primary><option>acl_smtp_mime</option></primary>
19917 </indexterm>
19918 </para>
19919 <informaltable frame="all">
19920 <tgroup cols="4" colsep="0" rowsep="0">
19921 <colspec colwidth="8*" align="left"/>
19922 <colspec colwidth="5*" align="center"/>
19923 <colspec colwidth="5*" align="center"/>
19924 <colspec colwidth="6*" align="right"/>
19925 <tbody>
19926 <row>
19927 <entry><option>acl_smtp_mime</option></entry>
19928 <entry>Use: <emphasis>main</emphasis></entry>
19929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19930 <entry>Default: <emphasis>unset</emphasis></entry>
19931 </row>
19932 </tbody>
19933 </tgroup>
19934 </informaltable>
19935 <para>
19936 <indexterm role="concept">
19937 <primary>MIME content scanning</primary>
19938 <secondary>ACL for</secondary>
19939 </indexterm>
19940 This option is available when Exim is built with the content-scanning
19941 extension. It defines the ACL that is run for each MIME part in a message. See
19942 section <xref linkend="SECTscanmimepart"/> for details.
19943 </para>
19944 <para>
19945 <indexterm role="option">
19946 <primary><option>acl_smtp_predata</option></primary>
19947 </indexterm>
19948 </para>
19949 <informaltable frame="all">
19950 <tgroup cols="4" colsep="0" rowsep="0">
19951 <colspec colwidth="8*" align="left"/>
19952 <colspec colwidth="5*" align="center"/>
19953 <colspec colwidth="5*" align="center"/>
19954 <colspec colwidth="6*" align="right"/>
19955 <tbody>
19956 <row>
19957 <entry><option>acl_smtp_predata</option></entry>
19958 <entry>Use: <emphasis>main</emphasis></entry>
19959 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19960 <entry>Default: <emphasis>unset</emphasis></entry>
19961 </row>
19962 </tbody>
19963 </tgroup>
19964 </informaltable>
19965 <para>
19966 This option defines the ACL that is run when an SMTP DATA command is
19967 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
19968 further details.
19969 </para>
19970 <para>
19971 <indexterm role="option">
19972 <primary><option>acl_smtp_quit</option></primary>
19973 </indexterm>
19974 </para>
19975 <informaltable frame="all">
19976 <tgroup cols="4" colsep="0" rowsep="0">
19977 <colspec colwidth="8*" align="left"/>
19978 <colspec colwidth="5*" align="center"/>
19979 <colspec colwidth="5*" align="center"/>
19980 <colspec colwidth="6*" align="right"/>
19981 <tbody>
19982 <row>
19983 <entry><option>acl_smtp_quit</option></entry>
19984 <entry>Use: <emphasis>main</emphasis></entry>
19985 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19986 <entry>Default: <emphasis>unset</emphasis></entry>
19987 </row>
19988 </tbody>
19989 </tgroup>
19990 </informaltable>
19991 <para>
19992 <indexterm role="concept">
19993 <primary>QUIT</primary>
19994 <secondary>ACL for</secondary>
19995 </indexterm>
19996 This option defines the ACL that is run when an SMTP QUIT command is
19997 received. See chapter <xref linkend="CHAPACL"/> for further details.
19998 </para>
19999 <para>
20000 <indexterm role="option">
20001 <primary><option>acl_smtp_rcpt</option></primary>
20002 </indexterm>
20003 </para>
20004 <informaltable frame="all">
20005 <tgroup cols="4" colsep="0" rowsep="0">
20006 <colspec colwidth="8*" align="left"/>
20007 <colspec colwidth="5*" align="center"/>
20008 <colspec colwidth="5*" align="center"/>
20009 <colspec colwidth="6*" align="right"/>
20010 <tbody>
20011 <row>
20012 <entry><option>acl_smtp_rcpt</option></entry>
20013 <entry>Use: <emphasis>main</emphasis></entry>
20014 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20015 <entry>Default: <emphasis>unset</emphasis></entry>
20016 </row>
20017 </tbody>
20018 </tgroup>
20019 </informaltable>
20020 <para>
20021 <indexterm role="concept">
20022 <primary>RCPT</primary>
20023 <secondary>ACL for</secondary>
20024 </indexterm>
20025 This option defines the ACL that is run when an SMTP RCPT command is
20026 received. See chapter <xref linkend="CHAPACL"/> for further details.
20027 </para>
20028 <para>
20029 <indexterm role="option">
20030 <primary><option>acl_smtp_starttls</option></primary>
20031 </indexterm>
20032 </para>
20033 <informaltable frame="all">
20034 <tgroup cols="4" colsep="0" rowsep="0">
20035 <colspec colwidth="8*" align="left"/>
20036 <colspec colwidth="5*" align="center"/>
20037 <colspec colwidth="5*" align="center"/>
20038 <colspec colwidth="6*" align="right"/>
20039 <tbody>
20040 <row>
20041 <entry><option>acl_smtp_starttls</option></entry>
20042 <entry>Use: <emphasis>main</emphasis></entry>
20043 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20044 <entry>Default: <emphasis>unset</emphasis></entry>
20045 </row>
20046 </tbody>
20047 </tgroup>
20048 </informaltable>
20049 <para>
20050 <indexterm role="concept">
20051 <primary>STARTTLS</primary>
20052 <secondary>ACL for</secondary>
20053 </indexterm>
20054 This option defines the ACL that is run when an SMTP STARTTLS command is
20055 received. See chapter <xref linkend="CHAPACL"/> for further details.
20056 </para>
20057 <para>
20058 <indexterm role="option">
20059 <primary><option>acl_smtp_vrfy</option></primary>
20060 </indexterm>
20061 </para>
20062 <informaltable frame="all">
20063 <tgroup cols="4" colsep="0" rowsep="0">
20064 <colspec colwidth="8*" align="left"/>
20065 <colspec colwidth="5*" align="center"/>
20066 <colspec colwidth="5*" align="center"/>
20067 <colspec colwidth="6*" align="right"/>
20068 <tbody>
20069 <row>
20070 <entry><option>acl_smtp_vrfy</option></entry>
20071 <entry>Use: <emphasis>main</emphasis></entry>
20072 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20073 <entry>Default: <emphasis>unset</emphasis></entry>
20074 </row>
20075 </tbody>
20076 </tgroup>
20077 </informaltable>
20078 <para>
20079 <indexterm role="concept">
20080 <primary>VRFY</primary>
20081 <secondary>ACL for</secondary>
20082 </indexterm>
20083 This option defines the ACL that is run when an SMTP VRFY command is
20084 received. See chapter <xref linkend="CHAPACL"/> for further details.
20085 </para>
20086 <para>
20087 <indexterm role="option">
20088 <primary><option>admin_groups</option></primary>
20089 </indexterm>
20090 </para>
20091 <informaltable frame="all">
20092 <tgroup cols="4" colsep="0" rowsep="0">
20093 <colspec colwidth="8*" align="left"/>
20094 <colspec colwidth="5*" align="center"/>
20095 <colspec colwidth="5*" align="center"/>
20096 <colspec colwidth="6*" align="right"/>
20097 <tbody>
20098 <row>
20099 <entry><option>admin_groups</option></entry>
20100 <entry>Use: <emphasis>main</emphasis></entry>
20101 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
20102 <entry>Default: <emphasis>unset</emphasis></entry>
20103 </row>
20104 </tbody>
20105 </tgroup>
20106 </informaltable>
20107 <para>
20108 <indexterm role="concept">
20109 <primary>admin user</primary>
20110 </indexterm>
20111 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
20112 current group or any of the supplementary groups of an Exim caller is in this
20113 colon-separated list, the caller has admin privileges. If all your system
20114 programmers are in a specific group, for example, you can give them all Exim
20115 admin privileges by putting that group in <option>admin_groups</option>. However, this does
20116 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
20117 To permit this, you have to add individuals to the Exim group.
20118 </para>
20119 <para>
20120 <indexterm role="option">
20121 <primary><option>allow_domain_literals</option></primary>
20122 </indexterm>
20123 </para>
20124 <informaltable frame="all">
20125 <tgroup cols="4" colsep="0" rowsep="0">
20126 <colspec colwidth="8*" align="left"/>
20127 <colspec colwidth="5*" align="center"/>
20128 <colspec colwidth="5*" align="center"/>
20129 <colspec colwidth="6*" align="right"/>
20130 <tbody>
20131 <row>
20132 <entry><option>allow_domain_literals</option></entry>
20133 <entry>Use: <emphasis>main</emphasis></entry>
20134 <entry>Type: <emphasis>boolean</emphasis></entry>
20135 <entry>Default: <emphasis>false</emphasis></entry>
20136 </row>
20137 </tbody>
20138 </tgroup>
20139 </informaltable>
20140 <para>
20141 <indexterm role="concept">
20142 <primary>domain literal</primary>
20143 </indexterm>
20144 If this option is set, the RFC 2822 domain literal format is permitted in
20145 email addresses. The option is not set by default, because the domain literal
20146 format is not normally required these days, and few people know about it. It
20147 has, however, been exploited by mail abusers.
20148 </para>
20149 <para>
20150 Unfortunately, it seems that some DNS black list maintainers are using this
20151 format to report black listing to postmasters. If you want to accept messages
20152 addressed to your hosts by IP address, you need to set
20153 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
20154 domains (defined in the named domain list <option>local_domains</option> in the default
20155 configuration). This <quote>magic string</quote> matches the domain literal form of all
20156 the local host&#x2019;s IP addresses.
20157 </para>
20158 <para>
20159 <indexterm role="option">
20160 <primary><option>allow_mx_to_ip</option></primary>
20161 </indexterm>
20162 </para>
20163 <informaltable frame="all">
20164 <tgroup cols="4" colsep="0" rowsep="0">
20165 <colspec colwidth="8*" align="left"/>
20166 <colspec colwidth="5*" align="center"/>
20167 <colspec colwidth="5*" align="center"/>
20168 <colspec colwidth="6*" align="right"/>
20169 <tbody>
20170 <row>
20171 <entry><option>allow_mx_to_ip</option></entry>
20172 <entry>Use: <emphasis>main</emphasis></entry>
20173 <entry>Type: <emphasis>boolean</emphasis></entry>
20174 <entry>Default: <emphasis>false</emphasis></entry>
20175 </row>
20176 </tbody>
20177 </tgroup>
20178 </informaltable>
20179 <para>
20180 <indexterm role="concept">
20181 <primary>MX record</primary>
20182 <secondary>pointing to IP address</secondary>
20183 </indexterm>
20184 It appears that more and more DNS zone administrators are breaking the rules
20185 and putting domain names that look like IP addresses on the right hand side of
20186 MX records. Exim follows the rules and rejects this, giving an error message
20187 that explains the mis-configuration. However, some other MTAs support this
20188 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
20189 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
20190 recommended, except when you have no other choice.
20191 </para>
20192 <para>
20193 <indexterm role="option">
20194 <primary><option>allow_utf8_domains</option></primary>
20195 </indexterm>
20196 </para>
20197 <informaltable frame="all">
20198 <tgroup cols="4" colsep="0" rowsep="0">
20199 <colspec colwidth="8*" align="left"/>
20200 <colspec colwidth="5*" align="center"/>
20201 <colspec colwidth="5*" align="center"/>
20202 <colspec colwidth="6*" align="right"/>
20203 <tbody>
20204 <row>
20205 <entry><option>allow_utf8_domains</option></entry>
20206 <entry>Use: <emphasis>main</emphasis></entry>
20207 <entry>Type: <emphasis>boolean</emphasis></entry>
20208 <entry>Default: <emphasis>false</emphasis></entry>
20209 </row>
20210 </tbody>
20211 </tgroup>
20212 </informaltable>
20213 <para>
20214 <indexterm role="concept">
20215 <primary>domain</primary>
20216 <secondary>UTF-8 characters in</secondary>
20217 </indexterm>
20218 <indexterm role="concept">
20219 <primary>UTF-8</primary>
20220 <secondary>in domain name</secondary>
20221 </indexterm>
20222 Lots of discussion is going on about internationalized domain names. One
20223 camp is strongly in favour of just using UTF-8 characters, and it seems
20224 that at least two other MTAs permit this. This option allows Exim users to
20225 experiment if they wish.
20226 </para>
20227 <para>
20228 If it is set true, Exim&#x2019;s domain parsing function allows valid
20229 UTF-8 multicharacters to appear in domain name components, in addition to
20230 letters, digits, and hyphens. However, just setting this option is not
20231 enough; if you want to look up these domain names in the DNS, you must also
20232 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
20233 suitable setting is:
20234 </para>
20235 <literallayout class="monospaced">
20236 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20237   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20238 </literallayout>
20239 <para>
20240 Alternatively, you can just disable this feature by setting
20241 </para>
20242 <literallayout class="monospaced">
20243 dns_check_names_pattern =
20244 </literallayout>
20245 <para>
20246 That is, set the option to an empty string so that no check is done.
20247 </para>
20248 <para>
20249 <indexterm role="option">
20250 <primary><option>auth_advertise_hosts</option></primary>
20251 </indexterm>
20252 </para>
20253 <informaltable frame="all">
20254 <tgroup cols="4" colsep="0" rowsep="0">
20255 <colspec colwidth="8*" align="left"/>
20256 <colspec colwidth="5*" align="center"/>
20257 <colspec colwidth="5*" align="center"/>
20258 <colspec colwidth="6*" align="right"/>
20259 <tbody>
20260 <row>
20261 <entry><option>auth_advertise_hosts</option></entry>
20262 <entry>Use: <emphasis>main</emphasis></entry>
20263 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20264 <entry>Default: <emphasis>*</emphasis></entry>
20265 </row>
20266 </tbody>
20267 </tgroup>
20268 </informaltable>
20269 <para>
20270 <indexterm role="concept">
20271 <primary>authentication</primary>
20272 <secondary>advertising</secondary>
20273 </indexterm>
20274 <indexterm role="concept">
20275 <primary>AUTH</primary>
20276 <secondary>advertising</secondary>
20277 </indexterm>
20278 If any server authentication mechanisms are configured, Exim advertises them in
20279 response to an EHLO command only if the calling host matches this list.
20280 Otherwise, Exim does not advertise AUTH.
20281 Exim does not accept AUTH commands from clients to which it has not
20282 advertised the availability of AUTH. The advertising of individual
20283 authentication mechanisms can be controlled by the use of the
20284 <option>server_advertise_condition</option> generic authenticator option on the individual
20285 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20286 </para>
20287 <para>
20288 Certain mail clients (for example, Netscape) require the user to provide a name
20289 and password for authentication if AUTH is advertised, even though it may
20290 not be needed (the host may accept messages from hosts on its local LAN without
20291 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20292 to make these clients more friendly by excluding them from the set of hosts to
20293 which Exim advertises AUTH.
20294 </para>
20295 <para>
20296 <indexterm role="concept">
20297 <primary>AUTH</primary>
20298 <secondary>advertising when encrypted</secondary>
20299 </indexterm>
20300 If you want to advertise the availability of AUTH only when the connection
20301 is encrypted using TLS, you can make use of the fact that the value of this
20302 option is expanded, with a setting like this:
20303 </para>
20304 <literallayout class="monospaced">
20305 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20306 </literallayout>
20307 <para>
20308 <indexterm role="concept">
20309 <primary><varname>$tls_cipher</varname></primary>
20310 </indexterm>
20311 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20312 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20313 expansion is *, which matches all hosts.
20314 </para>
20315 <para>
20316 <indexterm role="option">
20317 <primary><option>auto_thaw</option></primary>
20318 </indexterm>
20319 </para>
20320 <informaltable frame="all">
20321 <tgroup cols="4" colsep="0" rowsep="0">
20322 <colspec colwidth="8*" align="left"/>
20323 <colspec colwidth="5*" align="center"/>
20324 <colspec colwidth="5*" align="center"/>
20325 <colspec colwidth="6*" align="right"/>
20326 <tbody>
20327 <row>
20328 <entry><option>auto_thaw</option></entry>
20329 <entry>Use: <emphasis>main</emphasis></entry>
20330 <entry>Type: <emphasis>time</emphasis></entry>
20331 <entry>Default: <emphasis>0s</emphasis></entry>
20332 </row>
20333 </tbody>
20334 </tgroup>
20335 </informaltable>
20336 <para>
20337 <indexterm role="concept">
20338 <primary>thawing messages</primary>
20339 </indexterm>
20340 <indexterm role="concept">
20341 <primary>unfreezing messages</primary>
20342 </indexterm>
20343 If this option is set to a time greater than zero, a queue runner will try a
20344 new delivery attempt on any frozen message, other than a bounce message, if
20345 this much time has passed since it was frozen. This may result in the message
20346 being re-frozen if nothing has changed since the last attempt. It is a way of
20347 saying <quote>keep on trying, even though there are big problems</quote>.
20348 </para>
20349 <para>
20350 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20351 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20352 thought to be very useful any more, and its use should probably be avoided.
20353 </para>
20354 <para>
20355 <indexterm role="option">
20356 <primary><option>av_scanner</option></primary>
20357 </indexterm>
20358 </para>
20359 <informaltable frame="all">
20360 <tgroup cols="4" colsep="0" rowsep="0">
20361 <colspec colwidth="8*" align="left"/>
20362 <colspec colwidth="5*" align="center"/>
20363 <colspec colwidth="5*" align="center"/>
20364 <colspec colwidth="6*" align="right"/>
20365 <tbody>
20366 <row>
20367 <entry><option>av_scanner</option></entry>
20368 <entry>Use: <emphasis>main</emphasis></entry>
20369 <entry>Type: <emphasis>string</emphasis></entry>
20370 <entry>Default: <emphasis>see below</emphasis></entry>
20371 </row>
20372 </tbody>
20373 </tgroup>
20374 </informaltable>
20375 <para>
20376 This option is available if Exim is built with the content-scanning extension.
20377 It specifies which anti-virus scanner to use. The default value is:
20378 </para>
20379 <literallayout class="monospaced">
20380 sophie:/var/run/sophie
20381 </literallayout>
20382 <para>
20383 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20384 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20385 </para>
20386 <para>
20387 <indexterm role="option">
20388 <primary><option>bi_command</option></primary>
20389 </indexterm>
20390 </para>
20391 <informaltable frame="all">
20392 <tgroup cols="4" colsep="0" rowsep="0">
20393 <colspec colwidth="8*" align="left"/>
20394 <colspec colwidth="5*" align="center"/>
20395 <colspec colwidth="5*" align="center"/>
20396 <colspec colwidth="6*" align="right"/>
20397 <tbody>
20398 <row>
20399 <entry><option>bi_command</option></entry>
20400 <entry>Use: <emphasis>main</emphasis></entry>
20401 <entry>Type: <emphasis>string</emphasis></entry>
20402 <entry>Default: <emphasis>unset</emphasis></entry>
20403 </row>
20404 </tbody>
20405 </tgroup>
20406 </informaltable>
20407 <para>
20408 <indexterm role="concept">
20409 <primary><option>-bi</option> option</primary>
20410 </indexterm>
20411 This option supplies the name of a command that is run when Exim is called with
20412 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20413 just the command name, it is not a complete command line. If an argument is
20414 required, it must come from the <option>-oA</option> command line option.
20415 </para>
20416 <para>
20417 <indexterm role="option">
20418 <primary><option>bounce_message_file</option></primary>
20419 </indexterm>
20420 </para>
20421 <informaltable frame="all">
20422 <tgroup cols="4" colsep="0" rowsep="0">
20423 <colspec colwidth="8*" align="left"/>
20424 <colspec colwidth="5*" align="center"/>
20425 <colspec colwidth="5*" align="center"/>
20426 <colspec colwidth="6*" align="right"/>
20427 <tbody>
20428 <row>
20429 <entry><option>bounce_message_file</option></entry>
20430 <entry>Use: <emphasis>main</emphasis></entry>
20431 <entry>Type: <emphasis>string</emphasis></entry>
20432 <entry>Default: <emphasis>unset</emphasis></entry>
20433 </row>
20434 </tbody>
20435 </tgroup>
20436 </informaltable>
20437 <para>
20438 <indexterm role="concept">
20439 <primary>bounce message</primary>
20440 <secondary>customizing</secondary>
20441 </indexterm>
20442 <indexterm role="concept">
20443 <primary>customizing</primary>
20444 <secondary>bounce message</secondary>
20445 </indexterm>
20446 This option defines a template file containing paragraphs of text to be used
20447 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20448 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20449 </para>
20450 <para>
20451 <indexterm role="option">
20452 <primary><option>bounce_message_text</option></primary>
20453 </indexterm>
20454 </para>
20455 <informaltable frame="all">
20456 <tgroup cols="4" colsep="0" rowsep="0">
20457 <colspec colwidth="8*" align="left"/>
20458 <colspec colwidth="5*" align="center"/>
20459 <colspec colwidth="5*" align="center"/>
20460 <colspec colwidth="6*" align="right"/>
20461 <tbody>
20462 <row>
20463 <entry><option>bounce_message_text</option></entry>
20464 <entry>Use: <emphasis>main</emphasis></entry>
20465 <entry>Type: <emphasis>string</emphasis></entry>
20466 <entry>Default: <emphasis>unset</emphasis></entry>
20467 </row>
20468 </tbody>
20469 </tgroup>
20470 </informaltable>
20471 <para>
20472 When this option is set, its contents are included in the default bounce
20473 message immediately after <quote>This message was created automatically by mail
20474 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20475 </para>
20476 <para>
20477 <indexterm role="option">
20478 <primary><option>bounce_return_body</option></primary>
20479 </indexterm>
20480 </para>
20481 <informaltable frame="all">
20482 <tgroup cols="4" colsep="0" rowsep="0">
20483 <colspec colwidth="8*" align="left"/>
20484 <colspec colwidth="5*" align="center"/>
20485 <colspec colwidth="5*" align="center"/>
20486 <colspec colwidth="6*" align="right"/>
20487 <tbody>
20488 <row>
20489 <entry><option>bounce_return_body</option></entry>
20490 <entry>Use: <emphasis>main</emphasis></entry>
20491 <entry>Type: <emphasis>boolean</emphasis></entry>
20492 <entry>Default: <emphasis>true</emphasis></entry>
20493 </row>
20494 </tbody>
20495 </tgroup>
20496 </informaltable>
20497 <para>
20498 <indexterm role="concept">
20499 <primary>bounce message</primary>
20500 <secondary>including body</secondary>
20501 </indexterm>
20502 This option controls whether the body of an incoming message is included in a
20503 bounce message when <option>bounce_return_message</option> is true. The default setting
20504 causes the entire message, both header and body, to be returned (subject to the
20505 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20506 message header is included. In the case of a non-SMTP message containing an
20507 error that is detected during reception, only those header lines preceding the
20508 point at which the error was detected are returned.
20509 <indexterm role="concept">
20510 <primary>bounce message</primary>
20511 <secondary>including original</secondary>
20512 </indexterm>
20513 </para>
20514 <para>
20515 <indexterm role="option">
20516 <primary><option>bounce_return_message</option></primary>
20517 </indexterm>
20518 </para>
20519 <informaltable frame="all">
20520 <tgroup cols="4" colsep="0" rowsep="0">
20521 <colspec colwidth="8*" align="left"/>
20522 <colspec colwidth="5*" align="center"/>
20523 <colspec colwidth="5*" align="center"/>
20524 <colspec colwidth="6*" align="right"/>
20525 <tbody>
20526 <row>
20527 <entry><option>bounce_return_message</option></entry>
20528 <entry>Use: <emphasis>main</emphasis></entry>
20529 <entry>Type: <emphasis>boolean</emphasis></entry>
20530 <entry>Default: <emphasis>true</emphasis></entry>
20531 </row>
20532 </tbody>
20533 </tgroup>
20534 </informaltable>
20535 <para>
20536 If this option is set false, none of the original message is included in
20537 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20538 <option>bounce_return_body</option>.
20539 </para>
20540 <para>
20541 <indexterm role="option">
20542 <primary><option>bounce_return_size_limit</option></primary>
20543 </indexterm>
20544 </para>
20545 <informaltable frame="all">
20546 <tgroup cols="4" colsep="0" rowsep="0">
20547 <colspec colwidth="8*" align="left"/>
20548 <colspec colwidth="5*" align="center"/>
20549 <colspec colwidth="5*" align="center"/>
20550 <colspec colwidth="6*" align="right"/>
20551 <tbody>
20552 <row>
20553 <entry><option>bounce_return_size_limit</option></entry>
20554 <entry>Use: <emphasis>main</emphasis></entry>
20555 <entry>Type: <emphasis>integer</emphasis></entry>
20556 <entry>Default: <emphasis>100K</emphasis></entry>
20557 </row>
20558 </tbody>
20559 </tgroup>
20560 </informaltable>
20561 <para>
20562 <indexterm role="concept">
20563 <primary>size limit</primary>
20564 <secondary>of bounce</secondary>
20565 </indexterm>
20566 <indexterm role="concept">
20567 <primary>bounce message</primary>
20568 <secondary>size limit</secondary>
20569 </indexterm>
20570 <indexterm role="concept">
20571 <primary>limit</primary>
20572 <secondary>bounce message size</secondary>
20573 </indexterm>
20574 This option sets a limit in bytes on the size of messages that are returned to
20575 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20576 limit should be less than the value of the global <option>message_size_limit</option> and of
20577 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20578 that Exim generates. If this option is set to zero there is no limit.
20579 </para>
20580 <para>
20581 When the body of any message that is to be included in a bounce message is
20582 greater than the limit, it is truncated, and a comment pointing this out is
20583 added at the top. The actual cutoff may be greater than the value given, owing
20584 to the use of buffering for transferring the message in chunks (typically 8K in
20585 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20586 messages.
20587 </para>
20588 <para>
20589 <indexterm role="option">
20590 <primary><option>bounce_sender_authentication</option></primary>
20591 </indexterm>
20592 </para>
20593 <informaltable frame="all">
20594 <tgroup cols="4" colsep="0" rowsep="0">
20595 <colspec colwidth="8*" align="left"/>
20596 <colspec colwidth="5*" align="center"/>
20597 <colspec colwidth="5*" align="center"/>
20598 <colspec colwidth="6*" align="right"/>
20599 <tbody>
20600 <row>
20601 <entry><option>bounce_sender_authentication</option></entry>
20602 <entry>Use: <emphasis>main</emphasis></entry>
20603 <entry>Type: <emphasis>string</emphasis></entry>
20604 <entry>Default: <emphasis>unset</emphasis></entry>
20605 </row>
20606 </tbody>
20607 </tgroup>
20608 </informaltable>
20609 <para>
20610 <indexterm role="concept">
20611 <primary>bounce message</primary>
20612 <secondary>sender authentication</secondary>
20613 </indexterm>
20614 <indexterm role="concept">
20615 <primary>authentication</primary>
20616 <secondary>bounce message</secondary>
20617 </indexterm>
20618 <indexterm role="concept">
20619 <primary>AUTH</primary>
20620 <secondary>on bounce message</secondary>
20621 </indexterm>
20622 This option provides an authenticated sender address that is sent with any
20623 bounce messages generated by Exim that are sent over an authenticated SMTP
20624 connection. A typical setting might be:
20625 </para>
20626 <literallayout class="monospaced">
20627 bounce_sender_authentication = mailer-daemon@my.domain.example
20628 </literallayout>
20629 <para>
20630 which would cause bounce messages to be sent using the SMTP command:
20631 </para>
20632 <literallayout class="monospaced">
20633 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
20634 </literallayout>
20635 <para>
20636 The value of <option>bounce_sender_authentication</option> must always be a complete email
20637 address.
20638 </para>
20639 <para>
20640 <indexterm role="option">
20641 <primary><option>callout_domain_negative_expire</option></primary>
20642 </indexterm>
20643 </para>
20644 <informaltable frame="all">
20645 <tgroup cols="4" colsep="0" rowsep="0">
20646 <colspec colwidth="8*" align="left"/>
20647 <colspec colwidth="5*" align="center"/>
20648 <colspec colwidth="5*" align="center"/>
20649 <colspec colwidth="6*" align="right"/>
20650 <tbody>
20651 <row>
20652 <entry><option>callout_domain_negative_expire</option></entry>
20653 <entry>Use: <emphasis>main</emphasis></entry>
20654 <entry>Type: <emphasis>time</emphasis></entry>
20655 <entry>Default: <emphasis>3h</emphasis></entry>
20656 </row>
20657 </tbody>
20658 </tgroup>
20659 </informaltable>
20660 <para>
20661 <indexterm role="concept">
20662 <primary>caching</primary>
20663 <secondary>callout timeouts</secondary>
20664 </indexterm>
20665 <indexterm role="concept">
20666 <primary>callout</primary>
20667 <secondary>caching timeouts</secondary>
20668 </indexterm>
20669 This option specifies the expiry time for negative callout cache data for a
20670 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20671 section <xref linkend="SECTcallvercache"/> for details of the caching.
20672 </para>
20673 <para>
20674 <indexterm role="option">
20675 <primary><option>callout_domain_positive_expire</option></primary>
20676 </indexterm>
20677 </para>
20678 <informaltable frame="all">
20679 <tgroup cols="4" colsep="0" rowsep="0">
20680 <colspec colwidth="8*" align="left"/>
20681 <colspec colwidth="5*" align="center"/>
20682 <colspec colwidth="5*" align="center"/>
20683 <colspec colwidth="6*" align="right"/>
20684 <tbody>
20685 <row>
20686 <entry><option>callout_domain_positive_expire</option></entry>
20687 <entry>Use: <emphasis>main</emphasis></entry>
20688 <entry>Type: <emphasis>time</emphasis></entry>
20689 <entry>Default: <emphasis>7d</emphasis></entry>
20690 </row>
20691 </tbody>
20692 </tgroup>
20693 </informaltable>
20694 <para>
20695 This option specifies the expiry time for positive callout cache data for a
20696 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20697 section <xref linkend="SECTcallvercache"/> for details of the caching.
20698 </para>
20699 <para>
20700 <indexterm role="option">
20701 <primary><option>callout_negative_expire</option></primary>
20702 </indexterm>
20703 </para>
20704 <informaltable frame="all">
20705 <tgroup cols="4" colsep="0" rowsep="0">
20706 <colspec colwidth="8*" align="left"/>
20707 <colspec colwidth="5*" align="center"/>
20708 <colspec colwidth="5*" align="center"/>
20709 <colspec colwidth="6*" align="right"/>
20710 <tbody>
20711 <row>
20712 <entry><option>callout_negative_expire</option></entry>
20713 <entry>Use: <emphasis>main</emphasis></entry>
20714 <entry>Type: <emphasis>time</emphasis></entry>
20715 <entry>Default: <emphasis>2h</emphasis></entry>
20716 </row>
20717 </tbody>
20718 </tgroup>
20719 </informaltable>
20720 <para>
20721 This option specifies the expiry time for negative callout cache data for an
20722 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20723 section <xref linkend="SECTcallvercache"/> for details of the caching.
20724 </para>
20725 <para>
20726 <indexterm role="option">
20727 <primary><option>callout_positive_expire</option></primary>
20728 </indexterm>
20729 </para>
20730 <informaltable frame="all">
20731 <tgroup cols="4" colsep="0" rowsep="0">
20732 <colspec colwidth="8*" align="left"/>
20733 <colspec colwidth="5*" align="center"/>
20734 <colspec colwidth="5*" align="center"/>
20735 <colspec colwidth="6*" align="right"/>
20736 <tbody>
20737 <row>
20738 <entry><option>callout_positive_expire</option></entry>
20739 <entry>Use: <emphasis>main</emphasis></entry>
20740 <entry>Type: <emphasis>time</emphasis></entry>
20741 <entry>Default: <emphasis>24h</emphasis></entry>
20742 </row>
20743 </tbody>
20744 </tgroup>
20745 </informaltable>
20746 <para>
20747 This option specifies the expiry time for positive callout cache data for an
20748 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20749 section <xref linkend="SECTcallvercache"/> for details of the caching.
20750 </para>
20751 <para>
20752 <indexterm role="option">
20753 <primary><option>callout_random_local_part</option></primary>
20754 </indexterm>
20755 </para>
20756 <informaltable frame="all">
20757 <tgroup cols="4" colsep="0" rowsep="0">
20758 <colspec colwidth="8*" align="left"/>
20759 <colspec colwidth="5*" align="center"/>
20760 <colspec colwidth="5*" align="center"/>
20761 <colspec colwidth="6*" align="right"/>
20762 <tbody>
20763 <row>
20764 <entry><option>callout_random_local_part</option></entry>
20765 <entry>Use: <emphasis>main</emphasis></entry>
20766 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20767 <entry>Default: <emphasis>see below</emphasis></entry>
20768 </row>
20769 </tbody>
20770 </tgroup>
20771 </informaltable>
20772 <para>
20773 This option defines the <quote>random</quote> local part that can be used as part of
20774 callout verification. The default value is
20775 </para>
20776 <literallayout class="monospaced">
20777 $primary_host_name-$tod_epoch-testing
20778 </literallayout>
20779 <para>
20780 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
20781 </para>
20782 <para>
20783 <indexterm role="option">
20784 <primary><option>check_log_inodes</option></primary>
20785 </indexterm>
20786 </para>
20787 <informaltable frame="all">
20788 <tgroup cols="4" colsep="0" rowsep="0">
20789 <colspec colwidth="8*" align="left"/>
20790 <colspec colwidth="5*" align="center"/>
20791 <colspec colwidth="5*" align="center"/>
20792 <colspec colwidth="6*" align="right"/>
20793 <tbody>
20794 <row>
20795 <entry><option>check_log_inodes</option></entry>
20796 <entry>Use: <emphasis>main</emphasis></entry>
20797 <entry>Type: <emphasis>integer</emphasis></entry>
20798 <entry>Default: <emphasis>0</emphasis></entry>
20799 </row>
20800 </tbody>
20801 </tgroup>
20802 </informaltable>
20803 <para>
20804 See <option>check_spool_space</option> below.
20805 </para>
20806 <para>
20807 <indexterm role="option">
20808 <primary><option>check_log_space</option></primary>
20809 </indexterm>
20810 </para>
20811 <informaltable frame="all">
20812 <tgroup cols="4" colsep="0" rowsep="0">
20813 <colspec colwidth="8*" align="left"/>
20814 <colspec colwidth="5*" align="center"/>
20815 <colspec colwidth="5*" align="center"/>
20816 <colspec colwidth="6*" align="right"/>
20817 <tbody>
20818 <row>
20819 <entry><option>check_log_space</option></entry>
20820 <entry>Use: <emphasis>main</emphasis></entry>
20821 <entry>Type: <emphasis>integer</emphasis></entry>
20822 <entry>Default: <emphasis>0</emphasis></entry>
20823 </row>
20824 </tbody>
20825 </tgroup>
20826 </informaltable>
20827 <para>
20828 See <option>check_spool_space</option> below.
20829 </para>
20830 <para>
20831 <indexterm role="option">
20832 <primary><option>check_rfc2047_length</option></primary>
20833 </indexterm>
20834 <indexterm role="concept">
20835 <primary>RFC 2047</primary>
20836 <secondary>disabling length check</secondary>
20837 </indexterm>
20838 <indexterm role="option">
20839 <primary><option>check_rfc2047_length</option></primary>
20840 </indexterm>
20841 </para>
20842 <informaltable frame="all">
20843 <tgroup cols="4" colsep="0" rowsep="0">
20844 <colspec colwidth="8*" align="left"/>
20845 <colspec colwidth="5*" align="center"/>
20846 <colspec colwidth="5*" align="center"/>
20847 <colspec colwidth="6*" align="right"/>
20848 <tbody>
20849 <row>
20850 <entry><option>check_rfc2047_length</option></entry>
20851 <entry>Use: <emphasis> User: main</emphasis></entry>
20852 <entry>Type: <emphasis>boolean</emphasis></entry>
20853 <entry>Default: <emphasis>true</emphasis></entry>
20854 </row>
20855 </tbody>
20856 </tgroup>
20857 </informaltable>
20858 <para>
20859 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
20860 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
20861 word; strings to be encoded that exceed this length are supposed to use
20862 multiple encoded words. By default, Exim does not recognize encoded words that
20863 exceed the maximum length. However, it seems that some software, in violation
20864 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
20865 set false, Exim recognizes encoded words of any length.
20866 </para>
20867 <para>
20868 <indexterm role="option">
20869 <primary><option>check_spool_inodes</option></primary>
20870 </indexterm>
20871 </para>
20872 <informaltable frame="all">
20873 <tgroup cols="4" colsep="0" rowsep="0">
20874 <colspec colwidth="8*" align="left"/>
20875 <colspec colwidth="5*" align="center"/>
20876 <colspec colwidth="5*" align="center"/>
20877 <colspec colwidth="6*" align="right"/>
20878 <tbody>
20879 <row>
20880 <entry><option>check_spool_inodes</option></entry>
20881 <entry>Use: <emphasis>main</emphasis></entry>
20882 <entry>Type: <emphasis>integer</emphasis></entry>
20883 <entry>Default: <emphasis>0</emphasis></entry>
20884 </row>
20885 </tbody>
20886 </tgroup>
20887 </informaltable>
20888 <para>
20889 See <option>check_spool_space</option> below.
20890 </para>
20891 <para>
20892 <indexterm role="option">
20893 <primary><option>check_spool_space</option></primary>
20894 </indexterm>
20895 </para>
20896 <informaltable frame="all">
20897 <tgroup cols="4" colsep="0" rowsep="0">
20898 <colspec colwidth="8*" align="left"/>
20899 <colspec colwidth="5*" align="center"/>
20900 <colspec colwidth="5*" align="center"/>
20901 <colspec colwidth="6*" align="right"/>
20902 <tbody>
20903 <row>
20904 <entry><option>check_spool_space</option></entry>
20905 <entry>Use: <emphasis>main</emphasis></entry>
20906 <entry>Type: <emphasis>integer</emphasis></entry>
20907 <entry>Default: <emphasis>0</emphasis></entry>
20908 </row>
20909 </tbody>
20910 </tgroup>
20911 </informaltable>
20912 <para>
20913 <indexterm role="concept">
20914 <primary>checking disk space</primary>
20915 </indexterm>
20916 <indexterm role="concept">
20917 <primary>disk space</primary>
20918 <secondary>checking</secondary>
20919 </indexterm>
20920 <indexterm role="concept">
20921 <primary>spool directory</primary>
20922 <secondary>checking space</secondary>
20923 </indexterm>
20924 The four <option>check_...</option> options allow for checking of disk resources before a
20925 message is accepted.
20926 </para>
20927 <para>
20928 <indexterm role="concept">
20929 <primary><varname>$log_inodes</varname></primary>
20930 </indexterm>
20931 <indexterm role="concept">
20932 <primary><varname>$log_space</varname></primary>
20933 </indexterm>
20934 <indexterm role="concept">
20935 <primary><varname>$spool_inodes</varname></primary>
20936 </indexterm>
20937 <indexterm role="concept">
20938 <primary><varname>$spool_space</varname></primary>
20939 </indexterm>
20940 When any of these options are set, they apply to all incoming messages. If you
20941 want to apply different checks to different kinds of message, you can do so by
20942 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
20943 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
20944 </para>
20945 <para>
20946 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
20947 either value is greater than zero, for example:
20948 </para>
20949 <literallayout class="monospaced">
20950 check_spool_space = 10M
20951 check_spool_inodes = 100
20952 </literallayout>
20953 <para>
20954 The spool partition is the one that contains the directory defined by
20955 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
20956 transit.
20957 </para>
20958 <para>
20959 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
20960 files are written if either is greater than zero. These should be set only if
20961 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
20962 </para>
20963 <para>
20964 If there is less space or fewer inodes than requested, Exim refuses to accept
20965 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
20966 error response to the MAIL command. If ESMTP is in use and there was a
20967 SIZE parameter on the MAIL command, its value is added to the
20968 <option>check_spool_space</option> value, and the check is performed even if
20969 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
20970 </para>
20971 <para>
20972 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
20973 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
20974 </para>
20975 <para>
20976 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
20977 failure a message is written to stderr and Exim exits with a non-zero code, as
20978 it obviously cannot send an error message of any kind.
20979 </para>
20980 <para>
20981 <indexterm role="option">
20982 <primary><option>daemon_smtp_ports</option></primary>
20983 </indexterm>
20984 </para>
20985 <informaltable frame="all">
20986 <tgroup cols="4" colsep="0" rowsep="0">
20987 <colspec colwidth="8*" align="left"/>
20988 <colspec colwidth="5*" align="center"/>
20989 <colspec colwidth="5*" align="center"/>
20990 <colspec colwidth="6*" align="right"/>
20991 <tbody>
20992 <row>
20993 <entry><option>daemon_smtp_ports</option></entry>
20994 <entry>Use: <emphasis>main</emphasis></entry>
20995 <entry>Type: <emphasis>string</emphasis></entry>
20996 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
20997 </row>
20998 </tbody>
20999 </tgroup>
21000 </informaltable>
21001 <para>
21002 <indexterm role="concept">
21003 <primary>port</primary>
21004 <secondary>for daemon</secondary>
21005 </indexterm>
21006 <indexterm role="concept">
21007 <primary>TCP/IP</primary>
21008 <secondary>setting listening ports</secondary>
21009 </indexterm>
21010 This option specifies one or more default SMTP ports on which the Exim daemon
21011 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
21012 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
21013 </para>
21014 <para>
21015 <indexterm role="option">
21016 <primary><option>daemon_startup_retries</option></primary>
21017 </indexterm>
21018 </para>
21019 <informaltable frame="all">
21020 <tgroup cols="4" colsep="0" rowsep="0">
21021 <colspec colwidth="8*" align="left"/>
21022 <colspec colwidth="5*" align="center"/>
21023 <colspec colwidth="5*" align="center"/>
21024 <colspec colwidth="6*" align="right"/>
21025 <tbody>
21026 <row>
21027 <entry><option>daemon_startup_retries</option></entry>
21028 <entry>Use: <emphasis>main</emphasis></entry>
21029 <entry>Type: <emphasis>integer</emphasis></entry>
21030 <entry>Default: <emphasis>9</emphasis></entry>
21031 </row>
21032 </tbody>
21033 </tgroup>
21034 </informaltable>
21035 <para>
21036 <indexterm role="concept">
21037 <primary>daemon startup</primary>
21038 <secondary>retrying</secondary>
21039 </indexterm>
21040 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
21041 the daemon at startup when it cannot immediately bind a listening socket
21042 (typically because the socket is already in use): <option>daemon_startup_retries</option>
21043 defines the number of retries after the first failure, and
21044 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
21045 </para>
21046 <para>
21047 <indexterm role="option">
21048 <primary><option>daemon_startup_sleep</option></primary>
21049 </indexterm>
21050 </para>
21051 <informaltable frame="all">
21052 <tgroup cols="4" colsep="0" rowsep="0">
21053 <colspec colwidth="8*" align="left"/>
21054 <colspec colwidth="5*" align="center"/>
21055 <colspec colwidth="5*" align="center"/>
21056 <colspec colwidth="6*" align="right"/>
21057 <tbody>
21058 <row>
21059 <entry><option>daemon_startup_sleep</option></entry>
21060 <entry>Use: <emphasis>main</emphasis></entry>
21061 <entry>Type: <emphasis>time</emphasis></entry>
21062 <entry>Default: <emphasis>30s</emphasis></entry>
21063 </row>
21064 </tbody>
21065 </tgroup>
21066 </informaltable>
21067 <para>
21068 See <option>daemon_startup_retries</option>.
21069 </para>
21070 <para>
21071 <indexterm role="option">
21072 <primary><option>delay_warning</option></primary>
21073 </indexterm>
21074 </para>
21075 <informaltable frame="all">
21076 <tgroup cols="4" colsep="0" rowsep="0">
21077 <colspec colwidth="8*" align="left"/>
21078 <colspec colwidth="5*" align="center"/>
21079 <colspec colwidth="5*" align="center"/>
21080 <colspec colwidth="6*" align="right"/>
21081 <tbody>
21082 <row>
21083 <entry><option>delay_warning</option></entry>
21084 <entry>Use: <emphasis>main</emphasis></entry>
21085 <entry>Type: <emphasis>time list</emphasis></entry>
21086 <entry>Default: <emphasis>24h</emphasis></entry>
21087 </row>
21088 </tbody>
21089 </tgroup>
21090 </informaltable>
21091 <para>
21092 <indexterm role="concept">
21093 <primary>warning of delay</primary>
21094 </indexterm>
21095 <indexterm role="concept">
21096 <primary>delay warning</primary>
21097 <secondary>specifying</secondary>
21098 </indexterm>
21099 When a message is delayed, Exim sends a warning message to the sender at
21100 intervals specified by this option. The data is a colon-separated list of times
21101 after which to send warning messages. If the value of the option is an empty
21102 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
21103 message has been on the queue for longer than the last time, the last interval
21104 between the times is used to compute subsequent warning times. For example,
21105 with
21106 </para>
21107 <literallayout class="monospaced">
21108 delay_warning = 4h:8h:24h
21109 </literallayout>
21110 <para>
21111 the first message is sent after 4 hours, the second after 8 hours, and
21112 the third one after 24 hours. After that, messages are sent every 16 hours,
21113 because that is the interval between the last two times on the list. If you set
21114 just one time, it specifies the repeat interval. For example, with:
21115 </para>
21116 <literallayout class="monospaced">
21117 delay_warning = 6h
21118 </literallayout>
21119 <para>
21120 messages are repeated every six hours. To stop warnings after a given time, set
21121 a very large time at the end of the list. For example:
21122 </para>
21123 <literallayout class="monospaced">
21124 delay_warning = 2h:12h:99d
21125 </literallayout>
21126 <para>
21127 <indexterm role="option">
21128 <primary><option>delay_warning_condition</option></primary>
21129 </indexterm>
21130 </para>
21131 <informaltable frame="all">
21132 <tgroup cols="4" colsep="0" rowsep="0">
21133 <colspec colwidth="8*" align="left"/>
21134 <colspec colwidth="5*" align="center"/>
21135 <colspec colwidth="5*" align="center"/>
21136 <colspec colwidth="6*" align="right"/>
21137 <tbody>
21138 <row>
21139 <entry><option>delay_warning_condition</option></entry>
21140 <entry>Use: <emphasis>main</emphasis></entry>
21141 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21142 <entry>Default: <emphasis>see below</emphasis></entry>
21143 </row>
21144 </tbody>
21145 </tgroup>
21146 </informaltable>
21147 <para>
21148 <indexterm role="concept">
21149 <primary><varname>$domain</varname></primary>
21150 </indexterm>
21151 The string is expanded at the time a warning message might be sent. If all the
21152 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
21153 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
21154 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
21155 <quote>false</quote> (the comparison being done caselessly) then the warning message is
21156 not sent. The default is:
21157 </para>
21158 <literallayout class="monospaced">
21159 delay_warning_condition = ${if or {\
21160   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
21161   { match{$h_precedence:}{(?i)bulk|list|junk} }\
21162   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
21163   } {no}{yes}}
21164 </literallayout>
21165 <para>
21166 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
21167 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
21168 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
21169 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
21170 </para>
21171 <para>
21172 <indexterm role="option">
21173 <primary><option>deliver_drop_privilege</option></primary>
21174 </indexterm>
21175 </para>
21176 <informaltable frame="all">
21177 <tgroup cols="4" colsep="0" rowsep="0">
21178 <colspec colwidth="8*" align="left"/>
21179 <colspec colwidth="5*" align="center"/>
21180 <colspec colwidth="5*" align="center"/>
21181 <colspec colwidth="6*" align="right"/>
21182 <tbody>
21183 <row>
21184 <entry><option>deliver_drop_privilege</option></entry>
21185 <entry>Use: <emphasis>main</emphasis></entry>
21186 <entry>Type: <emphasis>boolean</emphasis></entry>
21187 <entry>Default: <emphasis>false</emphasis></entry>
21188 </row>
21189 </tbody>
21190 </tgroup>
21191 </informaltable>
21192 <para>
21193 <indexterm role="concept">
21194 <primary>unprivileged delivery</primary>
21195 </indexterm>
21196 <indexterm role="concept">
21197 <primary>delivery</primary>
21198 <secondary>unprivileged</secondary>
21199 </indexterm>
21200 If this option is set true, Exim drops its root privilege at the start of a
21201 delivery process, and runs as the Exim user throughout. This severely restricts
21202 the kinds of local delivery that are possible, but is viable in certain types
21203 of configuration. There is a discussion about the use of root privilege in
21204 chapter <xref linkend="CHAPsecurity"/>.
21205 </para>
21206 <para>
21207 <indexterm role="option">
21208 <primary><option>deliver_queue_load_max</option></primary>
21209 </indexterm>
21210 </para>
21211 <informaltable frame="all">
21212 <tgroup cols="4" colsep="0" rowsep="0">
21213 <colspec colwidth="8*" align="left"/>
21214 <colspec colwidth="5*" align="center"/>
21215 <colspec colwidth="5*" align="center"/>
21216 <colspec colwidth="6*" align="right"/>
21217 <tbody>
21218 <row>
21219 <entry><option>deliver_queue_load_max</option></entry>
21220 <entry>Use: <emphasis>main</emphasis></entry>
21221 <entry>Type: <emphasis>fixed-point</emphasis></entry>
21222 <entry>Default: <emphasis>unset</emphasis></entry>
21223 </row>
21224 </tbody>
21225 </tgroup>
21226 </informaltable>
21227 <para>
21228 <indexterm role="concept">
21229 <primary>load average</primary>
21230 </indexterm>
21231 <indexterm role="concept">
21232 <primary>queue runner</primary>
21233 <secondary>abandoning</secondary>
21234 </indexterm>
21235 When this option is set, a queue run is abandoned if the system load average
21236 becomes greater than the value of the option. The option has no effect on
21237 ancient operating systems on which Exim cannot determine the load average.
21238 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21239 </para>
21240 <para>
21241 <indexterm role="option">
21242 <primary><option>delivery_date_remove</option></primary>
21243 </indexterm>
21244 </para>
21245 <informaltable frame="all">
21246 <tgroup cols="4" colsep="0" rowsep="0">
21247 <colspec colwidth="8*" align="left"/>
21248 <colspec colwidth="5*" align="center"/>
21249 <colspec colwidth="5*" align="center"/>
21250 <colspec colwidth="6*" align="right"/>
21251 <tbody>
21252 <row>
21253 <entry><option>delivery_date_remove</option></entry>
21254 <entry>Use: <emphasis>main</emphasis></entry>
21255 <entry>Type: <emphasis>boolean</emphasis></entry>
21256 <entry>Default: <emphasis>true</emphasis></entry>
21257 </row>
21258 </tbody>
21259 </tgroup>
21260 </informaltable>
21261 <para>
21262 <indexterm role="concept">
21263 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21264 </indexterm>
21265 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21266 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21267 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21268 should not be present in incoming messages, and this option causes them to be
21269 removed at the time the message is received, to avoid any problems that might
21270 occur when a delivered message is subsequently sent on to some other recipient.
21271 </para>
21272 <para>
21273 <indexterm role="option">
21274 <primary><option>disable_ipv6</option></primary>
21275 </indexterm>
21276 </para>
21277 <informaltable frame="all">
21278 <tgroup cols="4" colsep="0" rowsep="0">
21279 <colspec colwidth="8*" align="left"/>
21280 <colspec colwidth="5*" align="center"/>
21281 <colspec colwidth="5*" align="center"/>
21282 <colspec colwidth="6*" align="right"/>
21283 <tbody>
21284 <row>
21285 <entry><option>disable_ipv6</option></entry>
21286 <entry>Use: <emphasis>main</emphasis></entry>
21287 <entry>Type: <emphasis>boolean</emphasis></entry>
21288 <entry>Default: <emphasis>false</emphasis></entry>
21289 </row>
21290 </tbody>
21291 </tgroup>
21292 </informaltable>
21293 <para>
21294 <indexterm role="concept">
21295 <primary>IPv6</primary>
21296 <secondary>disabling</secondary>
21297 </indexterm>
21298 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21299 activities take place. AAAA records are never looked up, and any IPv6 addresses
21300 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21301 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21302 to handle IPv6 literal addresses.
21303 </para>
21304 <para>
21305 <indexterm role="option">
21306 <primary><option>dns_again_means_nonexist</option></primary>
21307 </indexterm>
21308 </para>
21309 <informaltable frame="all">
21310 <tgroup cols="4" colsep="0" rowsep="0">
21311 <colspec colwidth="8*" align="left"/>
21312 <colspec colwidth="5*" align="center"/>
21313 <colspec colwidth="5*" align="center"/>
21314 <colspec colwidth="6*" align="right"/>
21315 <tbody>
21316 <row>
21317 <entry><option>dns_again_means_nonexist</option></entry>
21318 <entry>Use: <emphasis>main</emphasis></entry>
21319 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21320 <entry>Default: <emphasis>unset</emphasis></entry>
21321 </row>
21322 </tbody>
21323 </tgroup>
21324 </informaltable>
21325 <para>
21326 <indexterm role="concept">
21327 <primary>DNS</primary>
21328 <secondary><quote>try again</quote> response; overriding</secondary>
21329 </indexterm>
21330 DNS lookups give a <quote>try again</quote> response for the DNS errors
21331 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21332 keep trying to deliver a message, or to give repeated temporary errors to
21333 incoming mail. Sometimes the effect is caused by a badly set up name server and
21334 may persist for a long time. If a domain which exhibits this problem matches
21335 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21336 This option should be used with care. You can make it apply to reverse lookups
21337 by a setting such as this:
21338 </para>
21339 <literallayout class="monospaced">
21340 dns_again_means_nonexist = *.in-addr.arpa
21341 </literallayout>
21342 <para>
21343 This option applies to all DNS lookups that Exim does. It also applies when the
21344 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21345 since these are most likely to be caused by DNS lookup problems. The
21346 <command>dnslookup</command> router has some options of its own for controlling what happens
21347 when lookups for MX or SRV records give temporary errors. These more specific
21348 options are applied after this global option.
21349 </para>
21350 <para>
21351 <indexterm role="option">
21352 <primary><option>dns_check_names_pattern</option></primary>
21353 </indexterm>
21354 </para>
21355 <informaltable frame="all">
21356 <tgroup cols="4" colsep="0" rowsep="0">
21357 <colspec colwidth="8*" align="left"/>
21358 <colspec colwidth="5*" align="center"/>
21359 <colspec colwidth="5*" align="center"/>
21360 <colspec colwidth="6*" align="right"/>
21361 <tbody>
21362 <row>
21363 <entry><option>dns_check_names_pattern</option></entry>
21364 <entry>Use: <emphasis>main</emphasis></entry>
21365 <entry>Type: <emphasis>string</emphasis></entry>
21366 <entry>Default: <emphasis>see below</emphasis></entry>
21367 </row>
21368 </tbody>
21369 </tgroup>
21370 </informaltable>
21371 <para>
21372 <indexterm role="concept">
21373 <primary>DNS</primary>
21374 <secondary>pre-check of name syntax</secondary>
21375 </indexterm>
21376 When this option is set to a non-empty string, it causes Exim to check domain
21377 names for characters that are not allowed in host names before handing them to
21378 the DNS resolver, because some resolvers give temporary errors for names that
21379 contain unusual characters. If a domain name contains any unwanted characters,
21380 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21381 done by matching the domain name against a regular expression, which is the
21382 value of this option. The default pattern is
21383 </para>
21384 <literallayout class="monospaced">
21385 dns_check_names_pattern = \
21386   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21387 </literallayout>
21388 <para>
21389 which permits only letters, digits, slashes, and hyphens in components, but
21390 they must start and end with a letter or digit. Hyphens are not, in fact,
21391 permitted in host names, but they are found in certain NS records (which can be
21392 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21393 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21394 empty string.
21395 </para>
21396 <para>
21397 <indexterm role="option">
21398 <primary><option>dns_csa_search_limit</option></primary>
21399 </indexterm>
21400 </para>
21401 <informaltable frame="all">
21402 <tgroup cols="4" colsep="0" rowsep="0">
21403 <colspec colwidth="8*" align="left"/>
21404 <colspec colwidth="5*" align="center"/>
21405 <colspec colwidth="5*" align="center"/>
21406 <colspec colwidth="6*" align="right"/>
21407 <tbody>
21408 <row>
21409 <entry><option>dns_csa_search_limit</option></entry>
21410 <entry>Use: <emphasis>main</emphasis></entry>
21411 <entry>Type: <emphasis>integer</emphasis></entry>
21412 <entry>Default: <emphasis>5</emphasis></entry>
21413 </row>
21414 </tbody>
21415 </tgroup>
21416 </informaltable>
21417 <para>
21418 This option controls the depth of parental searching for CSA SRV records in the
21419 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21420 </para>
21421 <para>
21422 <indexterm role="option">
21423 <primary><option>dns_csa_use_reverse</option></primary>
21424 </indexterm>
21425 </para>
21426 <informaltable frame="all">
21427 <tgroup cols="4" colsep="0" rowsep="0">
21428 <colspec colwidth="8*" align="left"/>
21429 <colspec colwidth="5*" align="center"/>
21430 <colspec colwidth="5*" align="center"/>
21431 <colspec colwidth="6*" align="right"/>
21432 <tbody>
21433 <row>
21434 <entry><option>dns_csa_use_reverse</option></entry>
21435 <entry>Use: <emphasis>main</emphasis></entry>
21436 <entry>Type: <emphasis>boolean</emphasis></entry>
21437 <entry>Default: <emphasis>true</emphasis></entry>
21438 </row>
21439 </tbody>
21440 </tgroup>
21441 </informaltable>
21442 <para>
21443 This option controls whether or not an IP address, given as a CSA domain, is
21444 reversed and looked up in the reverse DNS, as described in more detail in
21445 section <xref linkend="SECTverifyCSA"/>.
21446 </para>
21447 <para>
21448 <indexterm role="option">
21449 <primary><option>dns_ipv4_lookup</option></primary>
21450 </indexterm>
21451 </para>
21452 <informaltable frame="all">
21453 <tgroup cols="4" colsep="0" rowsep="0">
21454 <colspec colwidth="8*" align="left"/>
21455 <colspec colwidth="5*" align="center"/>
21456 <colspec colwidth="5*" align="center"/>
21457 <colspec colwidth="6*" align="right"/>
21458 <tbody>
21459 <row>
21460 <entry><option>dns_ipv4_lookup</option></entry>
21461 <entry>Use: <emphasis>main</emphasis></entry>
21462 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21463 <entry>Default: <emphasis>unset</emphasis></entry>
21464 </row>
21465 </tbody>
21466 </tgroup>
21467 </informaltable>
21468 <para>
21469 <indexterm role="concept">
21470 <primary>IPv6</primary>
21471 <secondary>DNS lookup for AAAA records</secondary>
21472 </indexterm>
21473 <indexterm role="concept">
21474 <primary>DNS</primary>
21475 <secondary>IPv6 lookup for AAAA records</secondary>
21476 </indexterm>
21477 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21478 looks for IPv6 address records (AAAA records) as well as IPv4 address records
21479 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
21480 domain matches this list.
21481 </para>
21482 <para>
21483 This is a fudge to help with name servers that give big delays or otherwise do
21484 not work for the AAAA record type. In due course, when the world&#x2019;s name
21485 servers have all been upgraded, there should be no need for this option.
21486 </para>
21487 <para>
21488 <indexterm role="option">
21489 <primary><option>dns_retrans</option></primary>
21490 </indexterm>
21491 </para>
21492 <informaltable frame="all">
21493 <tgroup cols="4" colsep="0" rowsep="0">
21494 <colspec colwidth="8*" align="left"/>
21495 <colspec colwidth="5*" align="center"/>
21496 <colspec colwidth="5*" align="center"/>
21497 <colspec colwidth="6*" align="right"/>
21498 <tbody>
21499 <row>
21500 <entry><option>dns_retrans</option></entry>
21501 <entry>Use: <emphasis>main</emphasis></entry>
21502 <entry>Type: <emphasis>time</emphasis></entry>
21503 <entry>Default: <emphasis>0s</emphasis></entry>
21504 </row>
21505 </tbody>
21506 </tgroup>
21507 </informaltable>
21508 <para>
21509 <indexterm role="concept">
21510 <primary>DNS</primary>
21511 <secondary>resolver options</secondary>
21512 </indexterm>
21513 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21514 retransmission and retry parameters for DNS lookups. Values of zero (the
21515 defaults) leave the system default settings unchanged. The first value is the
21516 time between retries, and the second is the number of retries. It isn&#x2019;t
21517 totally clear exactly how these settings affect the total time a DNS lookup may
21518 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
21519 parameter values are available in the external resolver interface structure,
21520 but nowhere does it seem to describe how they are used or what you might want
21521 to set in them.
21522 </para>
21523 <para>
21524 <indexterm role="option">
21525 <primary><option>dns_retry</option></primary>
21526 </indexterm>
21527 </para>
21528 <informaltable frame="all">
21529 <tgroup cols="4" colsep="0" rowsep="0">
21530 <colspec colwidth="8*" align="left"/>
21531 <colspec colwidth="5*" align="center"/>
21532 <colspec colwidth="5*" align="center"/>
21533 <colspec colwidth="6*" align="right"/>
21534 <tbody>
21535 <row>
21536 <entry><option>dns_retry</option></entry>
21537 <entry>Use: <emphasis>main</emphasis></entry>
21538 <entry>Type: <emphasis>integer</emphasis></entry>
21539 <entry>Default: <emphasis>0</emphasis></entry>
21540 </row>
21541 </tbody>
21542 </tgroup>
21543 </informaltable>
21544 <para>
21545 See <option>dns_retrans</option> above.
21546 </para>
21547 <para>
21548 <indexterm role="option">
21549 <primary><option>drop_cr</option></primary>
21550 </indexterm>
21551 </para>
21552 <informaltable frame="all">
21553 <tgroup cols="4" colsep="0" rowsep="0">
21554 <colspec colwidth="8*" align="left"/>
21555 <colspec colwidth="5*" align="center"/>
21556 <colspec colwidth="5*" align="center"/>
21557 <colspec colwidth="6*" align="right"/>
21558 <tbody>
21559 <row>
21560 <entry><option>drop_cr</option></entry>
21561 <entry>Use: <emphasis>main</emphasis></entry>
21562 <entry>Type: <emphasis>boolean</emphasis></entry>
21563 <entry>Default: <emphasis>false</emphasis></entry>
21564 </row>
21565 </tbody>
21566 </tgroup>
21567 </informaltable>
21568 <para>
21569 This is an obsolete option that is now a no-op. It used to affect the way Exim
21570 handled CR and LF characters in incoming messages. What happens now is
21571 described in section <xref linkend="SECTlineendings"/>.
21572 </para>
21573 <para>
21574 <indexterm role="option">
21575 <primary><option>envelope_to_remove</option></primary>
21576 </indexterm>
21577 </para>
21578 <informaltable frame="all">
21579 <tgroup cols="4" colsep="0" rowsep="0">
21580 <colspec colwidth="8*" align="left"/>
21581 <colspec colwidth="5*" align="center"/>
21582 <colspec colwidth="5*" align="center"/>
21583 <colspec colwidth="6*" align="right"/>
21584 <tbody>
21585 <row>
21586 <entry><option>envelope_to_remove</option></entry>
21587 <entry>Use: <emphasis>main</emphasis></entry>
21588 <entry>Type: <emphasis>boolean</emphasis></entry>
21589 <entry>Default: <emphasis>true</emphasis></entry>
21590 </row>
21591 </tbody>
21592 </tgroup>
21593 </informaltable>
21594 <para>
21595 <indexterm role="concept">
21596 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21597 </indexterm>
21598 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21599 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21600 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21601 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
21602 be present in incoming messages, and this option causes them to be removed at
21603 the time the message is received, to avoid any problems that might occur when a
21604 delivered message is subsequently sent on to some other recipient.
21605 </para>
21606 <para>
21607 <indexterm role="option">
21608 <primary><option>errors_copy</option></primary>
21609 </indexterm>
21610 </para>
21611 <informaltable frame="all">
21612 <tgroup cols="4" colsep="0" rowsep="0">
21613 <colspec colwidth="8*" align="left"/>
21614 <colspec colwidth="5*" align="center"/>
21615 <colspec colwidth="5*" align="center"/>
21616 <colspec colwidth="6*" align="right"/>
21617 <tbody>
21618 <row>
21619 <entry><option>errors_copy</option></entry>
21620 <entry>Use: <emphasis>main</emphasis></entry>
21621 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
21622 <entry>Default: <emphasis>unset</emphasis></entry>
21623 </row>
21624 </tbody>
21625 </tgroup>
21626 </informaltable>
21627 <para>
21628 <indexterm role="concept">
21629 <primary>bounce message</primary>
21630 <secondary>copy to other address</secondary>
21631 </indexterm>
21632 <indexterm role="concept">
21633 <primary>copy of bounce message</primary>
21634 </indexterm>
21635 Setting this option causes Exim to send bcc copies of bounce messages that it
21636 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21637 coming from elsewhere. The value of the option is a colon-separated list of
21638 items. Each item consists of a pattern, terminated by white space, followed by
21639 a comma-separated list of email addresses. If a pattern contains spaces, it
21640 must be enclosed in double quotes.
21641 </para>
21642 <para>
21643 Each pattern is processed in the same way as a single item in an address list
21644 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21645 the bounce message, the message is copied to the addresses on the list. The
21646 items are scanned in order, and once a matching one is found, no further items
21647 are examined. For example:
21648 </para>
21649 <literallayout class="monospaced">
21650 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
21651               rqps@mydomain   hostmaster@mydomain.example,\
21652                               postmaster@mydomain.example
21653 </literallayout>
21654 <para>
21655 <indexterm role="concept">
21656 <primary><varname>$domain</varname></primary>
21657 </indexterm>
21658 <indexterm role="concept">
21659 <primary><varname>$local_part</varname></primary>
21660 </indexterm>
21661 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21662 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21663 there was any wildcard matching in the pattern, the expansion
21664 <indexterm role="concept">
21665 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21666 <secondary>in <option>errors_copy</option></secondary>
21667 </indexterm>
21668 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
21669 </para>
21670 <para>
21671 <indexterm role="option">
21672 <primary><option>errors_reply_to</option></primary>
21673 </indexterm>
21674 </para>
21675 <informaltable frame="all">
21676 <tgroup cols="4" colsep="0" rowsep="0">
21677 <colspec colwidth="8*" align="left"/>
21678 <colspec colwidth="5*" align="center"/>
21679 <colspec colwidth="5*" align="center"/>
21680 <colspec colwidth="6*" align="right"/>
21681 <tbody>
21682 <row>
21683 <entry><option>errors_reply_to</option></entry>
21684 <entry>Use: <emphasis>main</emphasis></entry>
21685 <entry>Type: <emphasis>string</emphasis></entry>
21686 <entry>Default: <emphasis>unset</emphasis></entry>
21687 </row>
21688 </tbody>
21689 </tgroup>
21690 </informaltable>
21691 <para>
21692 <indexterm role="concept">
21693 <primary>bounce message</primary>
21694 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
21695 </indexterm>
21696 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
21697 </para>
21698 <literallayout>
21699 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
21700 </literallayout>
21701 <para>
21702 <indexterm role="option">
21703 <primary><option>quota_warn_message</option></primary>
21704 </indexterm>
21705 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
21706 A warning message that is generated by the <option>quota_warn_message</option> option in an
21707 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
21708 overrides the default.
21709 </para>
21710 <para>
21711 Experience shows that people reply to bounce messages. If the
21712 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
21713 and warning messages. For example:
21714 </para>
21715 <literallayout class="monospaced">
21716 errors_reply_to = postmaster@my.domain.example
21717 </literallayout>
21718 <para>
21719 The value of the option is not expanded. It must specify a valid RFC 2822
21720 address. However, if a warning message that is generated by the
21721 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
21722 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
21723 not used.
21724 </para>
21725 <para>
21726 <indexterm role="option">
21727 <primary><option>exim_group</option></primary>
21728 </indexterm>
21729 </para>
21730 <informaltable frame="all">
21731 <tgroup cols="4" colsep="0" rowsep="0">
21732 <colspec colwidth="8*" align="left"/>
21733 <colspec colwidth="5*" align="center"/>
21734 <colspec colwidth="5*" align="center"/>
21735 <colspec colwidth="6*" align="right"/>
21736 <tbody>
21737 <row>
21738 <entry><option>exim_group</option></entry>
21739 <entry>Use: <emphasis>main</emphasis></entry>
21740 <entry>Type: <emphasis>string</emphasis></entry>
21741 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21742 </row>
21743 </tbody>
21744 </tgroup>
21745 </informaltable>
21746 <para>
21747 <indexterm role="concept">
21748 <primary>gid (group id)</primary>
21749 <secondary>Exim&#x2019;s own</secondary>
21750 </indexterm>
21751 <indexterm role="concept">
21752 <primary>Exim group</primary>
21753 </indexterm>
21754 This option changes the gid under which Exim runs when it gives up root
21755 privilege. The default value is compiled into the binary. The value of this
21756 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
21757 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
21758 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
21759 security issues.
21760 </para>
21761 <para>
21762 <indexterm role="option">
21763 <primary><option>exim_path</option></primary>
21764 </indexterm>
21765 </para>
21766 <informaltable frame="all">
21767 <tgroup cols="4" colsep="0" rowsep="0">
21768 <colspec colwidth="8*" align="left"/>
21769 <colspec colwidth="5*" align="center"/>
21770 <colspec colwidth="5*" align="center"/>
21771 <colspec colwidth="6*" align="right"/>
21772 <tbody>
21773 <row>
21774 <entry><option>exim_path</option></entry>
21775 <entry>Use: <emphasis>main</emphasis></entry>
21776 <entry>Type: <emphasis>string</emphasis></entry>
21777 <entry>Default: <emphasis>see below</emphasis></entry>
21778 </row>
21779 </tbody>
21780 </tgroup>
21781 </informaltable>
21782 <para>
21783 <indexterm role="concept">
21784 <primary>Exim binary</primary>
21785 <secondary>path name</secondary>
21786 </indexterm>
21787 This option specifies the path name of the Exim binary, which is used when Exim
21788 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
21789 the directory configured at compile time by the BIN_DIRECTORY setting. It
21790 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
21791 other place.
21792 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
21793 you will break those Exim utilities that scan the configuration file to find
21794 where the binary is. (They then use the <option>-bP</option> option to extract option
21795 settings such as the value of <option>spool_directory</option>.)
21796 </para>
21797 <para>
21798 <indexterm role="option">
21799 <primary><option>exim_user</option></primary>
21800 </indexterm>
21801 </para>
21802 <informaltable frame="all">
21803 <tgroup cols="4" colsep="0" rowsep="0">
21804 <colspec colwidth="8*" align="left"/>
21805 <colspec colwidth="5*" align="center"/>
21806 <colspec colwidth="5*" align="center"/>
21807 <colspec colwidth="6*" align="right"/>
21808 <tbody>
21809 <row>
21810 <entry><option>exim_user</option></entry>
21811 <entry>Use: <emphasis>main</emphasis></entry>
21812 <entry>Type: <emphasis>string</emphasis></entry>
21813 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21814 </row>
21815 </tbody>
21816 </tgroup>
21817 </informaltable>
21818 <para>
21819 <indexterm role="concept">
21820 <primary>uid (user id)</primary>
21821 <secondary>Exim&#x2019;s own</secondary>
21822 </indexterm>
21823 <indexterm role="concept">
21824 <primary>Exim user</primary>
21825 </indexterm>
21826 This option changes the uid under which Exim runs when it gives up root
21827 privilege. The default value is compiled into the binary. Ownership of the run
21828 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
21829 options is checked against the values in the binary, not what is set here.
21830 </para>
21831 <para>
21832 Unless it consists entirely of digits, the string is looked up using
21833 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
21834 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
21835 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
21836 </para>
21837 <para>
21838 <indexterm role="option">
21839 <primary><option>extra_local_interfaces</option></primary>
21840 </indexterm>
21841 </para>
21842 <informaltable frame="all">
21843 <tgroup cols="4" colsep="0" rowsep="0">
21844 <colspec colwidth="8*" align="left"/>
21845 <colspec colwidth="5*" align="center"/>
21846 <colspec colwidth="5*" align="center"/>
21847 <colspec colwidth="6*" align="right"/>
21848 <tbody>
21849 <row>
21850 <entry><option>extra_local_interfaces</option></entry>
21851 <entry>Use: <emphasis>main</emphasis></entry>
21852 <entry>Type: <emphasis>string list</emphasis></entry>
21853 <entry>Default: <emphasis>unset</emphasis></entry>
21854 </row>
21855 </tbody>
21856 </tgroup>
21857 </informaltable>
21858 <para>
21859 This option defines network interfaces that are to be considered local when
21860 routing, but which are not used for listening by the daemon. See section
21861 <xref linkend="SECTreclocipadd"/> for details.
21862 </para>
21863 <para>
21864 <indexterm role="option">
21865 <primary><option>extract_addresses_remove_ &nbsp;arguments</option></primary>
21866 </indexterm>
21867 </para>
21868 <informaltable frame="all">
21869 <tgroup cols="4" colsep="0" rowsep="0">
21870 <colspec colwidth="8*" align="left"/>
21871 <colspec colwidth="5*" align="center"/>
21872 <colspec colwidth="5*" align="center"/>
21873 <colspec colwidth="6*" align="right"/>
21874 <tbody>
21875 <row>
21876 <entry><option>extract_addresses_remove_ &nbsp;arguments</option></entry>
21877 <entry>Use: <emphasis>main</emphasis></entry>
21878 <entry>Type: <emphasis>boolean</emphasis></entry>
21879 <entry>Default: <emphasis>true</emphasis></entry>
21880 </row>
21881 </tbody>
21882 </tgroup>
21883 </informaltable>
21884 <para>
21885 <indexterm role="concept">
21886 <primary><option>-t</option> option</primary>
21887 </indexterm>
21888 <indexterm role="concept">
21889 <primary>command line</primary>
21890 <secondary>addresses with <option>-t</option></secondary>
21891 </indexterm>
21892 <indexterm role="concept">
21893 <primary>Sendmail compatibility</primary>
21894 <secondary><option>-t</option> option</secondary>
21895 </indexterm>
21896 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
21897 are present on the command line when the <option>-t</option> option is used to build an
21898 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
21899 line addresses are removed from the recipients list. This is also how Smail
21900 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
21901 command line addresses are added to those obtained from the header lines. When
21902 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
21903 argument headers. If it is set false, Exim adds rather than removes argument
21904 addresses.
21905 </para>
21906 <para>
21907 <indexterm role="option">
21908 <primary><option>finduser_retries</option></primary>
21909 </indexterm>
21910 </para>
21911 <informaltable frame="all">
21912 <tgroup cols="4" colsep="0" rowsep="0">
21913 <colspec colwidth="8*" align="left"/>
21914 <colspec colwidth="5*" align="center"/>
21915 <colspec colwidth="5*" align="center"/>
21916 <colspec colwidth="6*" align="right"/>
21917 <tbody>
21918 <row>
21919 <entry><option>finduser_retries</option></entry>
21920 <entry>Use: <emphasis>main</emphasis></entry>
21921 <entry>Type: <emphasis>integer</emphasis></entry>
21922 <entry>Default: <emphasis>0</emphasis></entry>
21923 </row>
21924 </tbody>
21925 </tgroup>
21926 </informaltable>
21927 <para>
21928 <indexterm role="concept">
21929 <primary>NIS</primary>
21930 <secondary>looking up users; retrying</secondary>
21931 </indexterm>
21932 On systems running NIS or other schemes in which user and group information is
21933 distributed from a remote system, there can be times when <function>getpwnam()</function> and
21934 related functions fail, even when given valid data, because things time out.
21935 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
21936 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
21937 many extra times to find a user or a group, waiting for one second between
21938 retries.
21939 </para>
21940 <para>
21941 <indexterm role="concept">
21942 <primary><filename>/etc/passwd</filename></primary>
21943 <secondary>multiple reading of</secondary>
21944 </indexterm>
21945 You should not set this option greater than zero if your user information is in
21946 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
21947 search the file multiple times for non-existent users, and also cause delay.
21948 </para>
21949 <para>
21950 <indexterm role="option">
21951 <primary><option>freeze_tell</option></primary>
21952 </indexterm>
21953 </para>
21954 <informaltable frame="all">
21955 <tgroup cols="4" colsep="0" rowsep="0">
21956 <colspec colwidth="8*" align="left"/>
21957 <colspec colwidth="5*" align="center"/>
21958 <colspec colwidth="5*" align="center"/>
21959 <colspec colwidth="6*" align="right"/>
21960 <tbody>
21961 <row>
21962 <entry><option>freeze_tell</option></entry>
21963 <entry>Use: <emphasis>main</emphasis></entry>
21964 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
21965 <entry>Default: <emphasis>unset</emphasis></entry>
21966 </row>
21967 </tbody>
21968 </tgroup>
21969 </informaltable>
21970 <para>
21971 <indexterm role="concept">
21972 <primary>freezing messages</primary>
21973 <secondary>sending a message when freezing</secondary>
21974 </indexterm>
21975 On encountering certain errors, or when configured to do so in a system filter,
21976 ACL, or special router, Exim freezes a message. This means that no further
21977 delivery attempts take place until an administrator thaws the message, or the
21978 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
21979 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
21980 warning message whenever it freezes something, unless the message it is
21981 freezing is a locally-generated bounce message. (Without this exception there
21982 is the possibility of looping.) The warning message is sent to the addresses
21983 supplied as the comma-separated value of this option. If several of the
21984 message&#x2019;s addresses cause freezing, only a single message is sent. If the
21985 freezing was automatic, the reason(s) for freezing can be found in the message
21986 log. If you configure freezing in a filter or ACL, you must arrange for any
21987 logging that you require.
21988 </para>
21989 <para>
21990 <indexterm role="option">
21991 <primary><option>gecos_name</option></primary>
21992 </indexterm>
21993 </para>
21994 <informaltable frame="all">
21995 <tgroup cols="4" colsep="0" rowsep="0">
21996 <colspec colwidth="8*" align="left"/>
21997 <colspec colwidth="5*" align="center"/>
21998 <colspec colwidth="5*" align="center"/>
21999 <colspec colwidth="6*" align="right"/>
22000 <tbody>
22001 <row>
22002 <entry><option>gecos_name</option></entry>
22003 <entry>Use: <emphasis>main</emphasis></entry>
22004 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22005 <entry>Default: <emphasis>unset</emphasis></entry>
22006 </row>
22007 </tbody>
22008 </tgroup>
22009 </informaltable>
22010 <para>
22011 <indexterm role="concept">
22012 <primary>HP-UX</primary>
22013 </indexterm>
22014 <indexterm role="concept">
22015 <primary><quote>gecos</quote> field</primary>
22016 <secondary>parsing</secondary>
22017 </indexterm>
22018 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
22019 password file to hold other information in addition to users&#x2019; real names. Exim
22020 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
22021 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
22022 of the field are used unchanged, except that, if an ampersand is encountered,
22023 it is replaced by the user&#x2019;s login name with the first character forced to
22024 upper case, since this is a convention that is observed on many systems.
22025 </para>
22026 <para>
22027 When these options are set, <option>gecos_pattern</option> is treated as a regular
22028 expression that is to be applied to the field (again with &amp; replaced by the
22029 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
22030 user&#x2019;s name.
22031 </para>
22032 <para>
22033 <indexterm role="concept">
22034 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
22035 <secondary>in <option>gecos_name</option></secondary>
22036 </indexterm>
22037 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
22038 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
22039 name terminates at the first comma, the following can be used:
22040 </para>
22041 <literallayout class="monospaced">
22042 gecos_pattern = ([^,]*)
22043 gecos_name = $1
22044 </literallayout>
22045 <para>
22046 <indexterm role="option">
22047 <primary><option>gecos_pattern</option></primary>
22048 </indexterm>
22049 </para>
22050 <informaltable frame="all">
22051 <tgroup cols="4" colsep="0" rowsep="0">
22052 <colspec colwidth="8*" align="left"/>
22053 <colspec colwidth="5*" align="center"/>
22054 <colspec colwidth="5*" align="center"/>
22055 <colspec colwidth="6*" align="right"/>
22056 <tbody>
22057 <row>
22058 <entry><option>gecos_pattern</option></entry>
22059 <entry>Use: <emphasis>main</emphasis></entry>
22060 <entry>Type: <emphasis>string</emphasis></entry>
22061 <entry>Default: <emphasis>unset</emphasis></entry>
22062 </row>
22063 </tbody>
22064 </tgroup>
22065 </informaltable>
22066 <para>
22067 See <option>gecos_name</option> above.
22068 </para>
22069 <para>
22070 <indexterm role="option">
22071 <primary><option>headers_charset</option></primary>
22072 </indexterm>
22073 </para>
22074 <informaltable frame="all">
22075 <tgroup cols="4" colsep="0" rowsep="0">
22076 <colspec colwidth="8*" align="left"/>
22077 <colspec colwidth="5*" align="center"/>
22078 <colspec colwidth="5*" align="center"/>
22079 <colspec colwidth="6*" align="right"/>
22080 <tbody>
22081 <row>
22082 <entry><option>headers_charset</option></entry>
22083 <entry>Use: <emphasis>main</emphasis></entry>
22084 <entry>Type: <emphasis>string</emphasis></entry>
22085 <entry>Default: <emphasis>see below</emphasis></entry>
22086 </row>
22087 </tbody>
22088 </tgroup>
22089 </informaltable>
22090 <para>
22091 This option sets a default character set for translating from encoded MIME
22092 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
22093 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
22094 ultimate default is ISO-8859-1. For more details see the description of header
22095 insertions in section <xref linkend="SECTexpansionitems"/>.
22096 </para>
22097 <para>
22098 <indexterm role="option">
22099 <primary><option>header_maxsize</option></primary>
22100 </indexterm>
22101 </para>
22102 <informaltable frame="all">
22103 <tgroup cols="4" colsep="0" rowsep="0">
22104 <colspec colwidth="8*" align="left"/>
22105 <colspec colwidth="5*" align="center"/>
22106 <colspec colwidth="5*" align="center"/>
22107 <colspec colwidth="6*" align="right"/>
22108 <tbody>
22109 <row>
22110 <entry><option>header_maxsize</option></entry>
22111 <entry>Use: <emphasis>main</emphasis></entry>
22112 <entry>Type: <emphasis>integer</emphasis></entry>
22113 <entry>Default: <emphasis>see below</emphasis></entry>
22114 </row>
22115 </tbody>
22116 </tgroup>
22117 </informaltable>
22118 <para>
22119 <indexterm role="concept">
22120 <primary>header section</primary>
22121 <secondary>maximum size of</secondary>
22122 </indexterm>
22123 <indexterm role="concept">
22124 <primary>limit</primary>
22125 <secondary>size of message header section</secondary>
22126 </indexterm>
22127 This option controls the overall maximum size of a message&#x2019;s header
22128 section. The default is the value of HEADER_MAXSIZE in
22129 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
22130 sections are rejected.
22131 </para>
22132 <para>
22133 <indexterm role="option">
22134 <primary><option>header_line_maxsize</option></primary>
22135 </indexterm>
22136 </para>
22137 <informaltable frame="all">
22138 <tgroup cols="4" colsep="0" rowsep="0">
22139 <colspec colwidth="8*" align="left"/>
22140 <colspec colwidth="5*" align="center"/>
22141 <colspec colwidth="5*" align="center"/>
22142 <colspec colwidth="6*" align="right"/>
22143 <tbody>
22144 <row>
22145 <entry><option>header_line_maxsize</option></entry>
22146 <entry>Use: <emphasis>main</emphasis></entry>
22147 <entry>Type: <emphasis>integer</emphasis></entry>
22148 <entry>Default: <emphasis>0</emphasis></entry>
22149 </row>
22150 </tbody>
22151 </tgroup>
22152 </informaltable>
22153 <para>
22154 <indexterm role="concept">
22155 <primary>header lines</primary>
22156 <secondary>maximum size of</secondary>
22157 </indexterm>
22158 <indexterm role="concept">
22159 <primary>limit</primary>
22160 <secondary>size of one header line</secondary>
22161 </indexterm>
22162 This option limits the length of any individual header line in a message, after
22163 all the continuations have been joined together. Messages with individual
22164 header lines that are longer than the limit are rejected. The default value of
22165 zero means <quote>no limit</quote>.
22166 </para>
22167 <para>
22168 <indexterm role="option">
22169 <primary><option>helo_accept_junk_hosts</option></primary>
22170 </indexterm>
22171 </para>
22172 <informaltable frame="all">
22173 <tgroup cols="4" colsep="0" rowsep="0">
22174 <colspec colwidth="8*" align="left"/>
22175 <colspec colwidth="5*" align="center"/>
22176 <colspec colwidth="5*" align="center"/>
22177 <colspec colwidth="6*" align="right"/>
22178 <tbody>
22179 <row>
22180 <entry><option>helo_accept_junk_hosts</option></entry>
22181 <entry>Use: <emphasis>main</emphasis></entry>
22182 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22183 <entry>Default: <emphasis>unset</emphasis></entry>
22184 </row>
22185 </tbody>
22186 </tgroup>
22187 </informaltable>
22188 <para>
22189 <indexterm role="concept">
22190 <primary>HELO</primary>
22191 <secondary>accepting junk data</secondary>
22192 </indexterm>
22193 <indexterm role="concept">
22194 <primary>EHLO</primary>
22195 <secondary>accepting junk data</secondary>
22196 </indexterm>
22197 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
22198 mail, and gives an error response for invalid data. Unfortunately, there are
22199 some SMTP clients that send syntactic junk. They can be accommodated by setting
22200 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
22201 if you want to do semantic checking.
22202 See also <option>helo_allow_chars</option> for a way of extending the permitted character
22203 set.
22204 </para>
22205 <para>
22206 <indexterm role="option">
22207 <primary><option>helo_allow_chars</option></primary>
22208 </indexterm>
22209 </para>
22210 <informaltable frame="all">
22211 <tgroup cols="4" colsep="0" rowsep="0">
22212 <colspec colwidth="8*" align="left"/>
22213 <colspec colwidth="5*" align="center"/>
22214 <colspec colwidth="5*" align="center"/>
22215 <colspec colwidth="6*" align="right"/>
22216 <tbody>
22217 <row>
22218 <entry><option>helo_allow_chars</option></entry>
22219 <entry>Use: <emphasis>main</emphasis></entry>
22220 <entry>Type: <emphasis>string</emphasis></entry>
22221 <entry>Default: <emphasis>unset</emphasis></entry>
22222 </row>
22223 </tbody>
22224 </tgroup>
22225 </informaltable>
22226 <para>
22227 <indexterm role="concept">
22228 <primary>HELO</primary>
22229 <secondary>underscores in</secondary>
22230 </indexterm>
22231 <indexterm role="concept">
22232 <primary>EHLO</primary>
22233 <secondary>underscores in</secondary>
22234 </indexterm>
22235 <indexterm role="concept">
22236 <primary>underscore in EHLO/HELO</primary>
22237 </indexterm>
22238 This option can be set to a string of rogue characters that are permitted in
22239 all EHLO and HELO names in addition to the standard letters, digits,
22240 hyphens, and dots. If you really must allow underscores, you can set
22241 </para>
22242 <literallayout class="monospaced">
22243 helo_allow_chars = _
22244 </literallayout>
22245 <para>
22246 Note that the value is one string, not a list.
22247 </para>
22248 <para>
22249 <indexterm role="option">
22250 <primary><option>helo_lookup_domains</option></primary>
22251 </indexterm>
22252 </para>
22253 <informaltable frame="all">
22254 <tgroup cols="4" colsep="0" rowsep="0">
22255 <colspec colwidth="8*" align="left"/>
22256 <colspec colwidth="5*" align="center"/>
22257 <colspec colwidth="5*" align="center"/>
22258 <colspec colwidth="6*" align="right"/>
22259 <tbody>
22260 <row>
22261 <entry><option>helo_lookup_domains</option></entry>
22262 <entry>Use: <emphasis>main</emphasis></entry>
22263 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22264 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22265 </row>
22266 </tbody>
22267 </tgroup>
22268 </informaltable>
22269 <para>
22270 <indexterm role="concept">
22271 <primary>HELO</primary>
22272 <secondary>forcing reverse lookup</secondary>
22273 </indexterm>
22274 <indexterm role="concept">
22275 <primary>EHLO</primary>
22276 <secondary>forcing reverse lookup</secondary>
22277 </indexterm>
22278 If the domain given by a client in a HELO or EHLO command matches this
22279 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22280 default forces a lookup if the client host gives the server&#x2019;s name or any of
22281 its IP addresses (in brackets), something that broken clients have been seen to
22282 do.
22283 </para>
22284 <para>
22285 <indexterm role="option">
22286 <primary><option>helo_try_verify_hosts</option></primary>
22287 </indexterm>
22288 </para>
22289 <informaltable frame="all">
22290 <tgroup cols="4" colsep="0" rowsep="0">
22291 <colspec colwidth="8*" align="left"/>
22292 <colspec colwidth="5*" align="center"/>
22293 <colspec colwidth="5*" align="center"/>
22294 <colspec colwidth="6*" align="right"/>
22295 <tbody>
22296 <row>
22297 <entry><option>helo_try_verify_hosts</option></entry>
22298 <entry>Use: <emphasis>main</emphasis></entry>
22299 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22300 <entry>Default: <emphasis>unset</emphasis></entry>
22301 </row>
22302 </tbody>
22303 </tgroup>
22304 </informaltable>
22305 <para>
22306 <indexterm role="concept">
22307 <primary>HELO verifying</primary>
22308 <secondary>optional</secondary>
22309 </indexterm>
22310 <indexterm role="concept">
22311 <primary>EHLO verifying</primary>
22312 <secondary>optional</secondary>
22313 </indexterm>
22314 By default, Exim just checks the syntax of HELO and EHLO commands (see
22315 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22316 to do more extensive checking of the data supplied by these commands. The ACL
22317 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22318 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22319 to force the check to occur. From release 4.53 onwards, this is no longer
22320 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22321 encountered, it is done at that time. Consequently, this option is obsolete.
22322 Its specification is retained here for backwards compatibility.
22323 </para>
22324 <para>
22325 When an EHLO or HELO command is received, if the calling host matches
22326 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22327 EHLO command either:
22328 </para>
22329 <itemizedlist>
22330 <listitem>
22331 <para>
22332 is an IP literal matching the calling address of the host, or
22333 </para>
22334 </listitem>
22335 <listitem>
22336 <para>
22337 <indexterm role="concept">
22338 <primary>DNS</primary>
22339 <secondary>reverse lookup</secondary>
22340 </indexterm>
22341 <indexterm role="concept">
22342 <primary>reverse DNS lookup</primary>
22343 </indexterm>
22344 matches the host name that Exim obtains by doing a reverse lookup of the
22345 calling host address, or
22346 </para>
22347 </listitem>
22348 <listitem>
22349 <para>
22350 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22351 available) yields the calling host address.
22352 </para>
22353 </listitem>
22354 </itemizedlist>
22355 <para>
22356 However, the EHLO or HELO command is not rejected if any of the checks
22357 fail. Processing continues, but the result of the check is remembered, and can
22358 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22359 </para>
22360 <para>
22361 <indexterm role="option">
22362 <primary><option>helo_verify_hosts</option></primary>
22363 </indexterm>
22364 </para>
22365 <informaltable frame="all">
22366 <tgroup cols="4" colsep="0" rowsep="0">
22367 <colspec colwidth="8*" align="left"/>
22368 <colspec colwidth="5*" align="center"/>
22369 <colspec colwidth="5*" align="center"/>
22370 <colspec colwidth="6*" align="right"/>
22371 <tbody>
22372 <row>
22373 <entry><option>helo_verify_hosts</option></entry>
22374 <entry>Use: <emphasis>main</emphasis></entry>
22375 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22376 <entry>Default: <emphasis>unset</emphasis></entry>
22377 </row>
22378 </tbody>
22379 </tgroup>
22380 </informaltable>
22381 <para>
22382 <indexterm role="concept">
22383 <primary>HELO verifying</primary>
22384 <secondary>mandatory</secondary>
22385 </indexterm>
22386 <indexterm role="concept">
22387 <primary>EHLO verifying</primary>
22388 <secondary>mandatory</secondary>
22389 </indexterm>
22390 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
22391 backwards compatibility. For hosts that match this option, Exim checks the host
22392 name given in the HELO or EHLO in the same way as for
22393 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
22394 rejected with a 550 error, and entries are written to the main and reject logs.
22395 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
22396 error.
22397 </para>
22398 <para>
22399 <indexterm role="option">
22400 <primary><option>hold_domains</option></primary>
22401 </indexterm>
22402 </para>
22403 <informaltable frame="all">
22404 <tgroup cols="4" colsep="0" rowsep="0">
22405 <colspec colwidth="8*" align="left"/>
22406 <colspec colwidth="5*" align="center"/>
22407 <colspec colwidth="5*" align="center"/>
22408 <colspec colwidth="6*" align="right"/>
22409 <tbody>
22410 <row>
22411 <entry><option>hold_domains</option></entry>
22412 <entry>Use: <emphasis>main</emphasis></entry>
22413 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22414 <entry>Default: <emphasis>unset</emphasis></entry>
22415 </row>
22416 </tbody>
22417 </tgroup>
22418 </informaltable>
22419 <para>
22420 <indexterm role="concept">
22421 <primary>domain</primary>
22422 <secondary>delaying delivery</secondary>
22423 </indexterm>
22424 <indexterm role="concept">
22425 <primary>delivery</primary>
22426 <secondary>delaying certain domains</secondary>
22427 </indexterm>
22428 This option allows mail for particular domains to be held on the queue
22429 manually. The option is overridden if a message delivery is forced with the
22430 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
22431 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
22432 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
22433 it is deferred every time the message is looked at.
22434 </para>
22435 <para>
22436 This option is intended as a temporary operational measure for delaying the
22437 delivery of mail while some problem is being sorted out, or some new
22438 configuration tested. If you just want to delay the processing of some
22439 domains until a queue run occurs, you should use <option>queue_domains</option> or
22440 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
22441 </para>
22442 <para>
22443 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
22444 messages from the queue if they have been there longer than the longest retry
22445 time in any retry rule. If you want to hold messages for longer than the normal
22446 retry times, insert a dummy retry rule with a long retry time.
22447 </para>
22448 <para>
22449 <indexterm role="option">
22450 <primary><option>host_lookup</option></primary>
22451 </indexterm>
22452 </para>
22453 <informaltable frame="all">
22454 <tgroup cols="4" colsep="0" rowsep="0">
22455 <colspec colwidth="8*" align="left"/>
22456 <colspec colwidth="5*" align="center"/>
22457 <colspec colwidth="5*" align="center"/>
22458 <colspec colwidth="6*" align="right"/>
22459 <tbody>
22460 <row>
22461 <entry><option>host_lookup</option></entry>
22462 <entry>Use: <emphasis>main</emphasis></entry>
22463 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22464 <entry>Default: <emphasis>unset</emphasis></entry>
22465 </row>
22466 </tbody>
22467 </tgroup>
22468 </informaltable>
22469 <para>
22470 <indexterm role="concept">
22471 <primary>host name lookup</primary>
22472 <secondary>forcing</secondary>
22473 </indexterm>
22474 Exim does not look up the name of a calling host from its IP address unless it
22475 is required to compare against some host list, or the host matches
22476 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
22477 option (which normally contains IP addresses rather than host names). The
22478 default configuration file contains
22479 </para>
22480 <literallayout class="monospaced">
22481 host_lookup = *
22482 </literallayout>
22483 <para>
22484 which causes a lookup to happen for all hosts. If the expense of these lookups
22485 is felt to be too great, the setting can be changed or removed.
22486 </para>
22487 <para>
22488 After a successful reverse lookup, Exim does a forward lookup on the name it
22489 has obtained, to verify that it yields the IP address that it started with. If
22490 this check fails, Exim behaves as if the name lookup failed.
22491 </para>
22492 <para>
22493 <indexterm role="concept">
22494 <primary><varname>$host_lookup_failed</varname></primary>
22495 </indexterm>
22496 <indexterm role="concept">
22497 <primary><varname>$sender_host_name</varname></primary>
22498 </indexterm>
22499 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22500 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22501 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22502 <literal>reverse_host_lookup</literal> in ACLs.
22503 </para>
22504 <para>
22505 <indexterm role="option">
22506 <primary><option>host_lookup_order</option></primary>
22507 </indexterm>
22508 </para>
22509 <informaltable frame="all">
22510 <tgroup cols="4" colsep="0" rowsep="0">
22511 <colspec colwidth="8*" align="left"/>
22512 <colspec colwidth="5*" align="center"/>
22513 <colspec colwidth="5*" align="center"/>
22514 <colspec colwidth="6*" align="right"/>
22515 <tbody>
22516 <row>
22517 <entry><option>host_lookup_order</option></entry>
22518 <entry>Use: <emphasis>main</emphasis></entry>
22519 <entry>Type: <emphasis>string list</emphasis></entry>
22520 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22521 </row>
22522 </tbody>
22523 </tgroup>
22524 </informaltable>
22525 <para>
22526 This option specifies the order of different lookup methods when Exim is trying
22527 to find a host name from an IP address. The default is to do a DNS lookup
22528 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22529 if that fails. You can change the order of these lookups, or omit one entirely,
22530 if you want.
22531 </para>
22532 <para>
22533 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22534 multiple PTR records in the DNS and the IP address is not listed in
22535 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22536 case. That is why the default tries a DNS lookup first.
22537 </para>
22538 <para>
22539 <indexterm role="option">
22540 <primary><option>host_reject_connection</option></primary>
22541 </indexterm>
22542 </para>
22543 <informaltable frame="all">
22544 <tgroup cols="4" colsep="0" rowsep="0">
22545 <colspec colwidth="8*" align="left"/>
22546 <colspec colwidth="5*" align="center"/>
22547 <colspec colwidth="5*" align="center"/>
22548 <colspec colwidth="6*" align="right"/>
22549 <tbody>
22550 <row>
22551 <entry><option>host_reject_connection</option></entry>
22552 <entry>Use: <emphasis>main</emphasis></entry>
22553 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22554 <entry>Default: <emphasis>unset</emphasis></entry>
22555 </row>
22556 </tbody>
22557 </tgroup>
22558 </informaltable>
22559 <para>
22560 <indexterm role="concept">
22561 <primary>host</primary>
22562 <secondary>rejecting connections from</secondary>
22563 </indexterm>
22564 If this option is set, incoming SMTP calls from the hosts listed are rejected
22565 as soon as the connection is made.
22566 This option is obsolete, and retained only for backward compatibility, because
22567 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22568 connections immediately.
22569 </para>
22570 <para>
22571 The ability to give an immediate rejection (either by this option or using an
22572 ACL) is provided for use in unusual cases. Many hosts will just try again,
22573 sometimes without much delay. Normally, it is better to use an ACL to reject
22574 incoming messages at a later stage, such as after RCPT commands. See
22575 chapter <xref linkend="CHAPACL"/>.
22576 </para>
22577 <para>
22578 <indexterm role="option">
22579 <primary><option>hosts_connection_nolog</option></primary>
22580 </indexterm>
22581 </para>
22582 <informaltable frame="all">
22583 <tgroup cols="4" colsep="0" rowsep="0">
22584 <colspec colwidth="8*" align="left"/>
22585 <colspec colwidth="5*" align="center"/>
22586 <colspec colwidth="5*" align="center"/>
22587 <colspec colwidth="6*" align="right"/>
22588 <tbody>
22589 <row>
22590 <entry><option>hosts_connection_nolog</option></entry>
22591 <entry>Use: <emphasis>main</emphasis></entry>
22592 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22593 <entry>Default: <emphasis>unset</emphasis></entry>
22594 </row>
22595 </tbody>
22596 </tgroup>
22597 </informaltable>
22598 <para>
22599 <indexterm role="concept">
22600 <primary>host</primary>
22601 <secondary>not logging connections from</secondary>
22602 </indexterm>
22603 This option defines a list of hosts for which connection logging does not
22604 happen, even though the <option>smtp_connection</option> log selector is set. For example,
22605 you might want not to log SMTP connections from local processes, or from
22606 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
22607 the daemon; you should therefore strive to restrict its value to a short inline
22608 list of IP addresses and networks. To disable logging SMTP connections from
22609 local processes, you must create a host list with an empty item. For example:
22610 </para>
22611 <literallayout class="monospaced">
22612 hosts_connection_nolog = :
22613 </literallayout>
22614 <para>
22615 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
22616 </para>
22617 <para>
22618 <indexterm role="option">
22619 <primary><option>hosts_treat_as_local</option></primary>
22620 </indexterm>
22621 </para>
22622 <informaltable frame="all">
22623 <tgroup cols="4" colsep="0" rowsep="0">
22624 <colspec colwidth="8*" align="left"/>
22625 <colspec colwidth="5*" align="center"/>
22626 <colspec colwidth="5*" align="center"/>
22627 <colspec colwidth="6*" align="right"/>
22628 <tbody>
22629 <row>
22630 <entry><option>hosts_treat_as_local</option></entry>
22631 <entry>Use: <emphasis>main</emphasis></entry>
22632 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22633 <entry>Default: <emphasis>unset</emphasis></entry>
22634 </row>
22635 </tbody>
22636 </tgroup>
22637 </informaltable>
22638 <para>
22639 <indexterm role="concept">
22640 <primary>local host</primary>
22641 <secondary>domains treated as</secondary>
22642 </indexterm>
22643 <indexterm role="concept">
22644 <primary>host</primary>
22645 <secondary>treated as local</secondary>
22646 </indexterm>
22647 If this option is set, any host names that match the domain list are treated as
22648 if they were the local host when Exim is scanning host lists obtained from MX
22649 records
22650 or other sources. Note that the value of this option is a domain list, not a
22651 host list, because it is always used to check host names, not IP addresses.
22652 </para>
22653 <para>
22654 This option also applies when Exim is matching the special items
22655 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
22656 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
22657 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
22658 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
22659 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
22660 interfaces and recognising the local host.
22661 </para>
22662 <para>
22663 <indexterm role="option">
22664 <primary><option>ignore_bounce_errors_after</option></primary>
22665 </indexterm>
22666 </para>
22667 <informaltable frame="all">
22668 <tgroup cols="4" colsep="0" rowsep="0">
22669 <colspec colwidth="8*" align="left"/>
22670 <colspec colwidth="5*" align="center"/>
22671 <colspec colwidth="5*" align="center"/>
22672 <colspec colwidth="6*" align="right"/>
22673 <tbody>
22674 <row>
22675 <entry><option>ignore_bounce_errors_after</option></entry>
22676 <entry>Use: <emphasis>main</emphasis></entry>
22677 <entry>Type: <emphasis>time</emphasis></entry>
22678 <entry>Default: <emphasis>10w</emphasis></entry>
22679 </row>
22680 </tbody>
22681 </tgroup>
22682 </informaltable>
22683 <para>
22684 <indexterm role="concept">
22685 <primary>bounce message</primary>
22686 <secondary>discarding</secondary>
22687 </indexterm>
22688 <indexterm role="concept">
22689 <primary>discarding bounce message</primary>
22690 </indexterm>
22691 This option affects the processing of bounce messages that cannot be delivered,
22692 that is, those that suffer a permanent delivery failure. (Bounce messages that
22693 suffer temporary delivery failures are of course retried in the usual way.)
22694 </para>
22695 <para>
22696 After a permanent delivery failure, bounce messages are frozen,
22697 because there is no sender to whom they can be returned. When a frozen bounce
22698 message has been on the queue for more than the given time, it is unfrozen at
22699 the next queue run, and a further delivery is attempted. If delivery fails
22700 again, the bounce message is discarded. This makes it possible to keep failed
22701 bounce messages around for a shorter time than the normal maximum retry time
22702 for frozen messages. For example,
22703 </para>
22704 <literallayout class="monospaced">
22705 ignore_bounce_errors_after = 12h
22706 </literallayout>
22707 <para>
22708 retries failed bounce message deliveries after 12 hours, discarding any further
22709 failures. If the value of this option is set to a zero time period, bounce
22710 failures are discarded immediately. Setting a very long time (as in the default
22711 value) has the effect of disabling this option. For ways of automatically
22712 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
22713 <option>timeout_frozen_after</option>.
22714 </para>
22715 <para>
22716 <indexterm role="option">
22717 <primary><option>ignore_fromline_hosts</option></primary>
22718 </indexterm>
22719 </para>
22720 <informaltable frame="all">
22721 <tgroup cols="4" colsep="0" rowsep="0">
22722 <colspec colwidth="8*" align="left"/>
22723 <colspec colwidth="5*" align="center"/>
22724 <colspec colwidth="5*" align="center"/>
22725 <colspec colwidth="6*" align="right"/>
22726 <tbody>
22727 <row>
22728 <entry><option>ignore_fromline_hosts</option></entry>
22729 <entry>Use: <emphasis>main</emphasis></entry>
22730 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22731 <entry>Default: <emphasis>unset</emphasis></entry>
22732 </row>
22733 </tbody>
22734 </tgroup>
22735 </informaltable>
22736 <para>
22737 <indexterm role="concept">
22738 <primary><quote>From</quote> line</primary>
22739 </indexterm>
22740 <indexterm role="concept">
22741 <primary>UUCP</primary>
22742 <secondary><quote>From</quote> line</secondary>
22743 </indexterm>
22744 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
22745 the headers of a message. By default this is treated as the start of the
22746 message&#x2019;s body, which means that any following headers are not recognized as
22747 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
22748 match those hosts that insist on sending it. If the sender is actually a local
22749 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
22750 <option>ignore_fromline_local</option> must be set to achieve this effect.
22751 </para>
22752 <para>
22753 <indexterm role="option">
22754 <primary><option>ignore_fromline_local</option></primary>
22755 </indexterm>
22756 </para>
22757 <informaltable frame="all">
22758 <tgroup cols="4" colsep="0" rowsep="0">
22759 <colspec colwidth="8*" align="left"/>
22760 <colspec colwidth="5*" align="center"/>
22761 <colspec colwidth="5*" align="center"/>
22762 <colspec colwidth="6*" align="right"/>
22763 <tbody>
22764 <row>
22765 <entry><option>ignore_fromline_local</option></entry>
22766 <entry>Use: <emphasis>main</emphasis></entry>
22767 <entry>Type: <emphasis>boolean</emphasis></entry>
22768 <entry>Default: <emphasis>false</emphasis></entry>
22769 </row>
22770 </tbody>
22771 </tgroup>
22772 </informaltable>
22773 <para>
22774 See <option>ignore_fromline_hosts</option> above.
22775 </para>
22776 <para>
22777 <indexterm role="option">
22778 <primary><option>keep_malformed</option></primary>
22779 </indexterm>
22780 </para>
22781 <informaltable frame="all">
22782 <tgroup cols="4" colsep="0" rowsep="0">
22783 <colspec colwidth="8*" align="left"/>
22784 <colspec colwidth="5*" align="center"/>
22785 <colspec colwidth="5*" align="center"/>
22786 <colspec colwidth="6*" align="right"/>
22787 <tbody>
22788 <row>
22789 <entry><option>keep_malformed</option></entry>
22790 <entry>Use: <emphasis>main</emphasis></entry>
22791 <entry>Type: <emphasis>time</emphasis></entry>
22792 <entry>Default: <emphasis>4d</emphasis></entry>
22793 </row>
22794 </tbody>
22795 </tgroup>
22796 </informaltable>
22797 <para>
22798 This option specifies the length of time to keep messages whose spool files
22799 have been corrupted in some way. This should, of course, never happen. At the
22800 next attempt to deliver such a message, it gets removed. The incident is
22801 logged.
22802 </para>
22803 <para>
22804 <indexterm role="option">
22805 <primary><option>ldap_default_servers</option></primary>
22806 </indexterm>
22807 </para>
22808 <informaltable frame="all">
22809 <tgroup cols="4" colsep="0" rowsep="0">
22810 <colspec colwidth="8*" align="left"/>
22811 <colspec colwidth="5*" align="center"/>
22812 <colspec colwidth="5*" align="center"/>
22813 <colspec colwidth="6*" align="right"/>
22814 <tbody>
22815 <row>
22816 <entry><option>ldap_default_servers</option></entry>
22817 <entry>Use: <emphasis>main</emphasis></entry>
22818 <entry>Type: <emphasis>string list</emphasis></entry>
22819 <entry>Default: <emphasis>unset</emphasis></entry>
22820 </row>
22821 </tbody>
22822 </tgroup>
22823 </informaltable>
22824 <para>
22825 <indexterm role="concept">
22826 <primary>LDAP</primary>
22827 <secondary>default servers</secondary>
22828 </indexterm>
22829 This option provides a list of LDAP servers which are tried in turn when an
22830 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
22831 details of LDAP queries. This option is available only when Exim has been built
22832 with LDAP support.
22833 </para>
22834 <para>
22835 <indexterm role="option">
22836 <primary><option>ldap_version</option></primary>
22837 </indexterm>
22838 </para>
22839 <informaltable frame="all">
22840 <tgroup cols="4" colsep="0" rowsep="0">
22841 <colspec colwidth="8*" align="left"/>
22842 <colspec colwidth="5*" align="center"/>
22843 <colspec colwidth="5*" align="center"/>
22844 <colspec colwidth="6*" align="right"/>
22845 <tbody>
22846 <row>
22847 <entry><option>ldap_version</option></entry>
22848 <entry>Use: <emphasis>main</emphasis></entry>
22849 <entry>Type: <emphasis>integer</emphasis></entry>
22850 <entry>Default: <emphasis>unset</emphasis></entry>
22851 </row>
22852 </tbody>
22853 </tgroup>
22854 </informaltable>
22855 <para>
22856 <indexterm role="concept">
22857 <primary>LDAP protocol version</primary>
22858 <secondary>forcing</secondary>
22859 </indexterm>
22860 This option can be used to force Exim to set a specific protocol version for
22861 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
22862 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
22863 the LDAP headers; otherwise it is 2. This option is available only when Exim
22864 has been built with LDAP support.
22865 </para>
22866 <para>
22867 <indexterm role="option">
22868 <primary><option>local_from_check</option></primary>
22869 </indexterm>
22870 </para>
22871 <informaltable frame="all">
22872 <tgroup cols="4" colsep="0" rowsep="0">
22873 <colspec colwidth="8*" align="left"/>
22874 <colspec colwidth="5*" align="center"/>
22875 <colspec colwidth="5*" align="center"/>
22876 <colspec colwidth="6*" align="right"/>
22877 <tbody>
22878 <row>
22879 <entry><option>local_from_check</option></entry>
22880 <entry>Use: <emphasis>main</emphasis></entry>
22881 <entry>Type: <emphasis>boolean</emphasis></entry>
22882 <entry>Default: <emphasis>true</emphasis></entry>
22883 </row>
22884 </tbody>
22885 </tgroup>
22886 </informaltable>
22887 <para>
22888 <indexterm role="concept">
22889 <primary><emphasis>Sender:</emphasis> header line</primary>
22890 <secondary>disabling addition of</secondary>
22891 </indexterm>
22892 <indexterm role="concept">
22893 <primary><emphasis>From:</emphasis> header line</primary>
22894 <secondary>disabling checking of</secondary>
22895 </indexterm>
22896 When a message is submitted locally (that is, not over a TCP/IP connection) by
22897 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
22898 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
22899 the domain specified by <option>qualify_domain</option>.
22900 </para>
22901 <para>
22902 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
22903 locally submitted message is automatically qualified by Exim, unless the
22904 <option>-bnq</option> command line option is used.
22905 </para>
22906 <para>
22907 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
22908 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
22909 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
22910 and the default qualify domain.
22911 </para>
22912 <para>
22913 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
22914 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
22915 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
22916 <option>local_sender_retain</option> to be true.
22917 </para>
22918 <para>
22919 <indexterm role="concept">
22920 <primary>envelope sender</primary>
22921 </indexterm>
22922 These options affect only the header lines in the message. The envelope sender
22923 is still forced to be the login id at the qualify domain unless
22924 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
22925 </para>
22926 <para>
22927 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
22928 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
22929 has more details about <emphasis>Sender:</emphasis> processing.
22930 </para>
22931 <para>
22932 <indexterm role="option">
22933 <primary><option>local_from_prefix</option></primary>
22934 </indexterm>
22935 </para>
22936 <informaltable frame="all">
22937 <tgroup cols="4" colsep="0" rowsep="0">
22938 <colspec colwidth="8*" align="left"/>
22939 <colspec colwidth="5*" align="center"/>
22940 <colspec colwidth="5*" align="center"/>
22941 <colspec colwidth="6*" align="right"/>
22942 <tbody>
22943 <row>
22944 <entry><option>local_from_prefix</option></entry>
22945 <entry>Use: <emphasis>main</emphasis></entry>
22946 <entry>Type: <emphasis>string</emphasis></entry>
22947 <entry>Default: <emphasis>unset</emphasis></entry>
22948 </row>
22949 </tbody>
22950 </tgroup>
22951 </informaltable>
22952 <para>
22953 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
22954 matching the login id (see <option>local_from_check</option> above), it can be configured to
22955 ignore certain prefixes and suffixes in the local part of the address. This is
22956 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
22957 appropriate lists, in the same form as the <option>local_part_prefix</option> and
22958 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
22959 example, if
22960 </para>
22961 <literallayout class="monospaced">
22962 local_from_prefix = *-
22963 </literallayout>
22964 <para>
22965 is set, a <emphasis>From:</emphasis> line containing
22966 </para>
22967 <literallayout class="monospaced">
22968 From: anything-user@your.domain.example
22969 </literallayout>
22970 <para>
22971 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
22972 matches the actual sender address that is constructed from the login name and
22973 qualify domain.
22974 </para>
22975 <para>
22976 <indexterm role="option">
22977 <primary><option>local_from_suffix</option></primary>
22978 </indexterm>
22979 </para>
22980 <informaltable frame="all">
22981 <tgroup cols="4" colsep="0" rowsep="0">
22982 <colspec colwidth="8*" align="left"/>
22983 <colspec colwidth="5*" align="center"/>
22984 <colspec colwidth="5*" align="center"/>
22985 <colspec colwidth="6*" align="right"/>
22986 <tbody>
22987 <row>
22988 <entry><option>local_from_suffix</option></entry>
22989 <entry>Use: <emphasis>main</emphasis></entry>
22990 <entry>Type: <emphasis>string</emphasis></entry>
22991 <entry>Default: <emphasis>unset</emphasis></entry>
22992 </row>
22993 </tbody>
22994 </tgroup>
22995 </informaltable>
22996 <para>
22997 See <option>local_from_prefix</option> above.
22998 </para>
22999 <para>
23000 <indexterm role="option">
23001 <primary><option>local_interfaces</option></primary>
23002 </indexterm>
23003 </para>
23004 <informaltable frame="all">
23005 <tgroup cols="4" colsep="0" rowsep="0">
23006 <colspec colwidth="8*" align="left"/>
23007 <colspec colwidth="5*" align="center"/>
23008 <colspec colwidth="5*" align="center"/>
23009 <colspec colwidth="6*" align="right"/>
23010 <tbody>
23011 <row>
23012 <entry><option>local_interfaces</option></entry>
23013 <entry>Use: <emphasis>main</emphasis></entry>
23014 <entry>Type: <emphasis>string list</emphasis></entry>
23015 <entry>Default: <emphasis>see below</emphasis></entry>
23016 </row>
23017 </tbody>
23018 </tgroup>
23019 </informaltable>
23020 <para>
23021 This option controls which network interfaces are used by the daemon for
23022 listening; they are also used to identify the local host when routing. Chapter
23023 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
23024 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
23025 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
23026 <option>local_interfaces</option> is
23027 </para>
23028 <literallayout class="monospaced">
23029 local_interfaces = 0.0.0.0
23030 </literallayout>
23031 <para>
23032 when Exim is built without IPv6 support; otherwise it is
23033 </para>
23034 <literallayout class="monospaced">
23035 local_interfaces = &lt;; ::0 ; 0.0.0.0
23036 </literallayout>
23037 <para>
23038 <indexterm role="option">
23039 <primary><option>local_scan_timeout</option></primary>
23040 </indexterm>
23041 </para>
23042 <informaltable frame="all">
23043 <tgroup cols="4" colsep="0" rowsep="0">
23044 <colspec colwidth="8*" align="left"/>
23045 <colspec colwidth="5*" align="center"/>
23046 <colspec colwidth="5*" align="center"/>
23047 <colspec colwidth="6*" align="right"/>
23048 <tbody>
23049 <row>
23050 <entry><option>local_scan_timeout</option></entry>
23051 <entry>Use: <emphasis>main</emphasis></entry>
23052 <entry>Type: <emphasis>time</emphasis></entry>
23053 <entry>Default: <emphasis>5m</emphasis></entry>
23054 </row>
23055 </tbody>
23056 </tgroup>
23057 </informaltable>
23058 <para>
23059 <indexterm role="concept">
23060 <primary>timeout</primary>
23061 <secondary>for <function>local_scan()</function> function</secondary>
23062 </indexterm>
23063 <indexterm role="concept">
23064 <primary><function>local_scan()</function> function</primary>
23065 <secondary>timeout</secondary>
23066 </indexterm>
23067 This timeout applies to the <function>local_scan()</function> function (see chapter
23068 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
23069 the incoming message is rejected with a temporary error if it is an SMTP
23070 message. For a non-SMTP message, the message is dropped and Exim ends with a
23071 non-zero code. The incident is logged on the main and reject logs.
23072 </para>
23073 <para>
23074 <indexterm role="option">
23075 <primary><option>local_sender_retain</option></primary>
23076 </indexterm>
23077 </para>
23078 <informaltable frame="all">
23079 <tgroup cols="4" colsep="0" rowsep="0">
23080 <colspec colwidth="8*" align="left"/>
23081 <colspec colwidth="5*" align="center"/>
23082 <colspec colwidth="5*" align="center"/>
23083 <colspec colwidth="6*" align="right"/>
23084 <tbody>
23085 <row>
23086 <entry><option>local_sender_retain</option></entry>
23087 <entry>Use: <emphasis>main</emphasis></entry>
23088 <entry>Type: <emphasis>boolean</emphasis></entry>
23089 <entry>Default: <emphasis>false</emphasis></entry>
23090 </row>
23091 </tbody>
23092 </tgroup>
23093 </informaltable>
23094 <para>
23095 <indexterm role="concept">
23096 <primary><emphasis>Sender:</emphasis> header line</primary>
23097 <secondary>retaining from local submission</secondary>
23098 </indexterm>
23099 When a message is submitted locally (that is, not over a TCP/IP connection) by
23100 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
23101 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
23102 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
23103 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
23104 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
23105 </para>
23106 <para>
23107 <indexterm role="option">
23108 <primary><option>localhost_number</option></primary>
23109 </indexterm>
23110 </para>
23111 <informaltable frame="all">
23112 <tgroup cols="4" colsep="0" rowsep="0">
23113 <colspec colwidth="8*" align="left"/>
23114 <colspec colwidth="5*" align="center"/>
23115 <colspec colwidth="5*" align="center"/>
23116 <colspec colwidth="6*" align="right"/>
23117 <tbody>
23118 <row>
23119 <entry><option>localhost_number</option></entry>
23120 <entry>Use: <emphasis>main</emphasis></entry>
23121 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23122 <entry>Default: <emphasis>unset</emphasis></entry>
23123 </row>
23124 </tbody>
23125 </tgroup>
23126 </informaltable>
23127 <para>
23128 <indexterm role="concept">
23129 <primary>host</primary>
23130 <secondary>locally unique number for</secondary>
23131 </indexterm>
23132 <indexterm role="concept">
23133 <primary>message ids</primary>
23134 <secondary>with multiple hosts</secondary>
23135 </indexterm>
23136 <indexterm role="concept">
23137 <primary><varname>$localhost_number</varname></primary>
23138 </indexterm>
23139 Exim&#x2019;s message ids are normally unique only within the local host. If
23140 uniqueness among a set of hosts is required, each host must set a different
23141 value for the <option>localhost_number</option> option. The string is expanded immediately
23142 after reading the configuration file (so that a number can be computed from the
23143 host name, for example) and the result of the expansion must be a number in the
23144 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
23145 systems). This is available in subsequent string expansions via the variable
23146 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
23147 characters of the message id, instead of just being a fractional part of the
23148 time, are computed from the time and the local host number as described in
23149 section <xref linkend="SECTmessiden"/>.
23150 </para>
23151 <para>
23152 <indexterm role="option">
23153 <primary><option>log_file_path</option></primary>
23154 </indexterm>
23155 </para>
23156 <informaltable frame="all">
23157 <tgroup cols="4" colsep="0" rowsep="0">
23158 <colspec colwidth="8*" align="left"/>
23159 <colspec colwidth="5*" align="center"/>
23160 <colspec colwidth="5*" align="center"/>
23161 <colspec colwidth="6*" align="right"/>
23162 <tbody>
23163 <row>
23164 <entry><option>log_file_path</option></entry>
23165 <entry>Use: <emphasis>main</emphasis></entry>
23166 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23167 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23168 </row>
23169 </tbody>
23170 </tgroup>
23171 </informaltable>
23172 <para>
23173 <indexterm role="concept">
23174 <primary>log</primary>
23175 <secondary>file path for</secondary>
23176 </indexterm>
23177 This option sets the path which is used to determine the names of Exim&#x2019;s log
23178 files, or indicates that logging is to be to syslog, or both. It is expanded
23179 when Exim is entered, so it can, for example, contain a reference to the host
23180 name. If no specific path is set for the log files at compile or run time, they
23181 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
23182 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
23183 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
23184 used. If this string is fixed at your installation (contains no expansion
23185 variables) it is recommended that you do not set this option in the
23186 configuration file, but instead supply the path using LOG_FILE_PATH in
23187 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
23188 early on &ndash; in particular, failure to read the configuration file.
23189 </para>
23190 <para>
23191 <indexterm role="option">
23192 <primary><option>log_selector</option></primary>
23193 </indexterm>
23194 </para>
23195 <informaltable frame="all">
23196 <tgroup cols="4" colsep="0" rowsep="0">
23197 <colspec colwidth="8*" align="left"/>
23198 <colspec colwidth="5*" align="center"/>
23199 <colspec colwidth="5*" align="center"/>
23200 <colspec colwidth="6*" align="right"/>
23201 <tbody>
23202 <row>
23203 <entry><option>log_selector</option></entry>
23204 <entry>Use: <emphasis>main</emphasis></entry>
23205 <entry>Type: <emphasis>string</emphasis></entry>
23206 <entry>Default: <emphasis>unset</emphasis></entry>
23207 </row>
23208 </tbody>
23209 </tgroup>
23210 </informaltable>
23211 <para>
23212 <indexterm role="concept">
23213 <primary>log</primary>
23214 <secondary>selectors</secondary>
23215 </indexterm>
23216 This option can be used to reduce or increase the number of things that Exim
23217 writes to its log files. Its argument is made up of names preceded by plus or
23218 minus characters. For example:
23219 </para>
23220 <literallayout class="monospaced">
23221 log_selector = +arguments -retry_defer
23222 </literallayout>
23223 <para>
23224 A list of possible names and what they control is given in the chapter on
23225 logging, in section <xref linkend="SECTlogselector"/>.
23226 </para>
23227 <para>
23228 <indexterm role="option">
23229 <primary><option>log_timezone</option></primary>
23230 </indexterm>
23231 </para>
23232 <informaltable frame="all">
23233 <tgroup cols="4" colsep="0" rowsep="0">
23234 <colspec colwidth="8*" align="left"/>
23235 <colspec colwidth="5*" align="center"/>
23236 <colspec colwidth="5*" align="center"/>
23237 <colspec colwidth="6*" align="right"/>
23238 <tbody>
23239 <row>
23240 <entry><option>log_timezone</option></entry>
23241 <entry>Use: <emphasis>main</emphasis></entry>
23242 <entry>Type: <emphasis>boolean</emphasis></entry>
23243 <entry>Default: <emphasis>false</emphasis></entry>
23244 </row>
23245 </tbody>
23246 </tgroup>
23247 </informaltable>
23248 <para>
23249 <indexterm role="concept">
23250 <primary>log</primary>
23251 <secondary>timezone for entries</secondary>
23252 </indexterm>
23253 <indexterm role="concept">
23254 <primary><varname>$tod_log</varname></primary>
23255 </indexterm>
23256 <indexterm role="concept">
23257 <primary><varname>$tod_zone</varname></primary>
23258 </indexterm>
23259 By default, the timestamps on log lines are in local time without the
23260 timezone. This means that if your timezone changes twice a year, the timestamps
23261 in log lines are ambiguous for an hour when the clocks go back. One way of
23262 avoiding this problem is to set the timezone to UTC. An alternative is to set
23263 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23264 timestamps in log lines. Turning on this option can add quite a lot to the size
23265 of log files because each line is extended by 6 characters. Note that the
23266 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23267 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23268 </para>
23269 <para>
23270 <indexterm role="option">
23271 <primary><option>lookup_open_max</option></primary>
23272 </indexterm>
23273 </para>
23274 <informaltable frame="all">
23275 <tgroup cols="4" colsep="0" rowsep="0">
23276 <colspec colwidth="8*" align="left"/>
23277 <colspec colwidth="5*" align="center"/>
23278 <colspec colwidth="5*" align="center"/>
23279 <colspec colwidth="6*" align="right"/>
23280 <tbody>
23281 <row>
23282 <entry><option>lookup_open_max</option></entry>
23283 <entry>Use: <emphasis>main</emphasis></entry>
23284 <entry>Type: <emphasis>integer</emphasis></entry>
23285 <entry>Default: <emphasis>25</emphasis></entry>
23286 </row>
23287 </tbody>
23288 </tgroup>
23289 </informaltable>
23290 <para>
23291 <indexterm role="concept">
23292 <primary>too many open files</primary>
23293 </indexterm>
23294 <indexterm role="concept">
23295 <primary>open files</primary>
23296 <secondary>too many</secondary>
23297 </indexterm>
23298 <indexterm role="concept">
23299 <primary>file</primary>
23300 <secondary>too many open</secondary>
23301 </indexterm>
23302 <indexterm role="concept">
23303 <primary>lookup</primary>
23304 <secondary>maximum open files</secondary>
23305 </indexterm>
23306 <indexterm role="concept">
23307 <primary>limit</primary>
23308 <secondary>open files for lookups</secondary>
23309 </indexterm>
23310 This option limits the number of simultaneously open files for single-key
23311 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23312 Exim normally keeps these files open during routing, because often the same
23313 file is required several times. If the limit is reached, Exim closes the least
23314 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23315 actually opens two files for each logical DBM database, though it still counts
23316 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23317 open files</quote> errors with NDBM, you need to reduce the value of
23318 <option>lookup_open_max</option>.
23319 </para>
23320 <para>
23321 <indexterm role="option">
23322 <primary><option>max_username_length</option></primary>
23323 </indexterm>
23324 </para>
23325 <informaltable frame="all">
23326 <tgroup cols="4" colsep="0" rowsep="0">
23327 <colspec colwidth="8*" align="left"/>
23328 <colspec colwidth="5*" align="center"/>
23329 <colspec colwidth="5*" align="center"/>
23330 <colspec colwidth="6*" align="right"/>
23331 <tbody>
23332 <row>
23333 <entry><option>max_username_length</option></entry>
23334 <entry>Use: <emphasis>main</emphasis></entry>
23335 <entry>Type: <emphasis>integer</emphasis></entry>
23336 <entry>Default: <emphasis>0</emphasis></entry>
23337 </row>
23338 </tbody>
23339 </tgroup>
23340 </informaltable>
23341 <para>
23342 <indexterm role="concept">
23343 <primary>length</primary>
23344 <secondary>of login name</secondary>
23345 </indexterm>
23346 <indexterm role="concept">
23347 <primary>user name</primary>
23348 <secondary>maximum length</secondary>
23349 </indexterm>
23350 <indexterm role="concept">
23351 <primary>limit</primary>
23352 <secondary>user name length</secondary>
23353 </indexterm>
23354 Some operating systems are broken in that they truncate long arguments to
23355 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
23356 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
23357 an argument that is longer behaves as if <function>getpwnam()</function> failed.
23358 </para>
23359 <para>
23360 <indexterm role="option">
23361 <primary><option>message_body_visible</option></primary>
23362 </indexterm>
23363 </para>
23364 <informaltable frame="all">
23365 <tgroup cols="4" colsep="0" rowsep="0">
23366 <colspec colwidth="8*" align="left"/>
23367 <colspec colwidth="5*" align="center"/>
23368 <colspec colwidth="5*" align="center"/>
23369 <colspec colwidth="6*" align="right"/>
23370 <tbody>
23371 <row>
23372 <entry><option>message_body_visible</option></entry>
23373 <entry>Use: <emphasis>main</emphasis></entry>
23374 <entry>Type: <emphasis>integer</emphasis></entry>
23375 <entry>Default: <emphasis>500</emphasis></entry>
23376 </row>
23377 </tbody>
23378 </tgroup>
23379 </informaltable>
23380 <para>
23381 <indexterm role="concept">
23382 <primary>body of message</primary>
23383 <secondary>visible size</secondary>
23384 </indexterm>
23385 <indexterm role="concept">
23386 <primary>message body</primary>
23387 <secondary>visible size</secondary>
23388 </indexterm>
23389 <indexterm role="concept">
23390 <primary><varname>$message_body</varname></primary>
23391 </indexterm>
23392 <indexterm role="concept">
23393 <primary><varname>$message_body_end</varname></primary>
23394 </indexterm>
23395 This option specifies how much of a message&#x2019;s body is to be included in the
23396 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
23397 </para>
23398 <para>
23399 <indexterm role="option">
23400 <primary><option>message_id_header_domain</option></primary>
23401 </indexterm>
23402 </para>
23403 <informaltable frame="all">
23404 <tgroup cols="4" colsep="0" rowsep="0">
23405 <colspec colwidth="8*" align="left"/>
23406 <colspec colwidth="5*" align="center"/>
23407 <colspec colwidth="5*" align="center"/>
23408 <colspec colwidth="6*" align="right"/>
23409 <tbody>
23410 <row>
23411 <entry><option>message_id_header_domain</option></entry>
23412 <entry>Use: <emphasis>main</emphasis></entry>
23413 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23414 <entry>Default: <emphasis>unset</emphasis></entry>
23415 </row>
23416 </tbody>
23417 </tgroup>
23418 </informaltable>
23419 <para>
23420 <indexterm role="concept">
23421 <primary><emphasis>Message-ID:</emphasis> header line</primary>
23422 </indexterm>
23423 If this option is set, the string is expanded and used as the right hand side
23424 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
23425 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
23426 means <quote>not received over TCP/IP.</quote>
23427 Otherwise, the primary host name is used.
23428 Only letters, digits, dot and hyphen are accepted; any other characters are
23429 replaced by hyphens. If the expansion is forced to fail, or if the result is an
23430 empty string, the option is ignored.
23431 </para>
23432 <para>
23433 <indexterm role="option">
23434 <primary><option>message_id_header_text</option></primary>
23435 </indexterm>
23436 </para>
23437 <informaltable frame="all">
23438 <tgroup cols="4" colsep="0" rowsep="0">
23439 <colspec colwidth="8*" align="left"/>
23440 <colspec colwidth="5*" align="center"/>
23441 <colspec colwidth="5*" align="center"/>
23442 <colspec colwidth="6*" align="right"/>
23443 <tbody>
23444 <row>
23445 <entry><option>message_id_header_text</option></entry>
23446 <entry>Use: <emphasis>main</emphasis></entry>
23447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23448 <entry>Default: <emphasis>unset</emphasis></entry>
23449 </row>
23450 </tbody>
23451 </tgroup>
23452 </informaltable>
23453 <para>
23454 If this variable is set, the string is expanded and used to augment the text of
23455 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
23456 message does not have one. The text of this header is required by RFC 2822 to
23457 take the form of an address. By default, Exim uses its internal message id as
23458 the local part, and the primary host name as the domain. If this option is set,
23459 it is expanded, and provided the expansion is not forced to fail, and does not
23460 yield an empty string, the result is inserted into the header immediately
23461 before the @, separated from the internal message id by a dot. Any characters
23462 that are illegal in an address are automatically converted into hyphens. This
23463 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
23464 colons will become hyphens.
23465 </para>
23466 <para>
23467 <indexterm role="option">
23468 <primary><option>message_logs</option></primary>
23469 </indexterm>
23470 </para>
23471 <informaltable frame="all">
23472 <tgroup cols="4" colsep="0" rowsep="0">
23473 <colspec colwidth="8*" align="left"/>
23474 <colspec colwidth="5*" align="center"/>
23475 <colspec colwidth="5*" align="center"/>
23476 <colspec colwidth="6*" align="right"/>
23477 <tbody>
23478 <row>
23479 <entry><option>message_logs</option></entry>
23480 <entry>Use: <emphasis>main</emphasis></entry>
23481 <entry>Type: <emphasis>boolean</emphasis></entry>
23482 <entry>Default: <emphasis>true</emphasis></entry>
23483 </row>
23484 </tbody>
23485 </tgroup>
23486 </informaltable>
23487 <para>
23488 <indexterm role="concept">
23489 <primary>message log</primary>
23490 <secondary>disabling</secondary>
23491 </indexterm>
23492 <indexterm role="concept">
23493 <primary>log</primary>
23494 <secondary>message log; disabling</secondary>
23495 </indexterm>
23496 If this option is turned off, per-message log files are not created in the
23497 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23498 Exim, by reducing the number of files involved in handling a message from a
23499 minimum of four (header spool file, body spool file, delivery journal, and
23500 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
23501 which is not affected by this option.
23502 </para>
23503 <para>
23504 <indexterm role="option">
23505 <primary><option>message_size_limit</option></primary>
23506 </indexterm>
23507 </para>
23508 <informaltable frame="all">
23509 <tgroup cols="4" colsep="0" rowsep="0">
23510 <colspec colwidth="8*" align="left"/>
23511 <colspec colwidth="5*" align="center"/>
23512 <colspec colwidth="5*" align="center"/>
23513 <colspec colwidth="6*" align="right"/>
23514 <tbody>
23515 <row>
23516 <entry><option>message_size_limit</option></entry>
23517 <entry>Use: <emphasis>main</emphasis></entry>
23518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23519 <entry>Default: <emphasis>50M</emphasis></entry>
23520 </row>
23521 </tbody>
23522 </tgroup>
23523 </informaltable>
23524 <para>
23525 <indexterm role="concept">
23526 <primary>message</primary>
23527 <secondary>size limit</secondary>
23528 </indexterm>
23529 <indexterm role="concept">
23530 <primary>limit</primary>
23531 <secondary>message size</secondary>
23532 </indexterm>
23533 <indexterm role="concept">
23534 <primary>size of message</primary>
23535 <secondary>limit</secondary>
23536 </indexterm>
23537 This option limits the maximum size of message that Exim will process. The
23538 value is expanded for each incoming
23539 connection so, for example, it can be made to depend on the IP address of the
23540 remote host for messages arriving via TCP/IP. <emphasis role="bold">Note</emphasis>: This limit cannot be
23541 made to depend on a message&#x2019;s sender or any other properties of an individual
23542 message, because it has to be advertised in the server&#x2019;s response to EHLO.
23543 String expansion failure causes a temporary error. A value of zero means no
23544 limit, but its use is not recommended. See also <option>bounce_return_size_limit</option>.
23545 </para>
23546 <para>
23547 Incoming SMTP messages are failed with a 552 error if the limit is
23548 exceeded; locally-generated messages either get a stderr message or a delivery
23549 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23550 an oversized message is logged in both the main and the reject logs. See also
23551 the generic transport option <option>message_size_limit</option>, which limits the size of
23552 message that an individual transport can process.
23553 </para>
23554 <para>
23555 <indexterm role="option">
23556 <primary><option>move_frozen_messages</option></primary>
23557 </indexterm>
23558 </para>
23559 <informaltable frame="all">
23560 <tgroup cols="4" colsep="0" rowsep="0">
23561 <colspec colwidth="8*" align="left"/>
23562 <colspec colwidth="5*" align="center"/>
23563 <colspec colwidth="5*" align="center"/>
23564 <colspec colwidth="6*" align="right"/>
23565 <tbody>
23566 <row>
23567 <entry><option>move_frozen_messages</option></entry>
23568 <entry>Use: <emphasis>main</emphasis></entry>
23569 <entry>Type: <emphasis>boolean</emphasis></entry>
23570 <entry>Default: <emphasis>false</emphasis></entry>
23571 </row>
23572 </tbody>
23573 </tgroup>
23574 </informaltable>
23575 <para>
23576 <indexterm role="concept">
23577 <primary>frozen messages</primary>
23578 <secondary>moving</secondary>
23579 </indexterm>
23580 This option, which is available only if Exim has been built with the setting
23581 </para>
23582 <literallayout class="monospaced">
23583 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23584 </literallayout>
23585 <para>
23586 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23587 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23588 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23589 standard utilities for handling such moved messages, and they do not show up in
23590 lists generated by <option>-bp</option> or by the Exim monitor.
23591 </para>
23592 <para>
23593 <indexterm role="option">
23594 <primary><option>mua_wrapper</option></primary>
23595 </indexterm>
23596 </para>
23597 <informaltable frame="all">
23598 <tgroup cols="4" colsep="0" rowsep="0">
23599 <colspec colwidth="8*" align="left"/>
23600 <colspec colwidth="5*" align="center"/>
23601 <colspec colwidth="5*" align="center"/>
23602 <colspec colwidth="6*" align="right"/>
23603 <tbody>
23604 <row>
23605 <entry><option>mua_wrapper</option></entry>
23606 <entry>Use: <emphasis>main</emphasis></entry>
23607 <entry>Type: <emphasis>boolean</emphasis></entry>
23608 <entry>Default: <emphasis>false</emphasis></entry>
23609 </row>
23610 </tbody>
23611 </tgroup>
23612 </informaltable>
23613 <para>
23614 Setting this option true causes Exim to run in a very restrictive mode in which
23615 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
23616 contains a full description of this facility.
23617 </para>
23618 <para>
23619 <indexterm role="option">
23620 <primary><option>mysql_servers</option></primary>
23621 </indexterm>
23622 </para>
23623 <informaltable frame="all">
23624 <tgroup cols="4" colsep="0" rowsep="0">
23625 <colspec colwidth="8*" align="left"/>
23626 <colspec colwidth="5*" align="center"/>
23627 <colspec colwidth="5*" align="center"/>
23628 <colspec colwidth="6*" align="right"/>
23629 <tbody>
23630 <row>
23631 <entry><option>mysql_servers</option></entry>
23632 <entry>Use: <emphasis>main</emphasis></entry>
23633 <entry>Type: <emphasis>string list</emphasis></entry>
23634 <entry>Default: <emphasis>unset</emphasis></entry>
23635 </row>
23636 </tbody>
23637 </tgroup>
23638 </informaltable>
23639 <para>
23640 <indexterm role="concept">
23641 <primary>MySQL</primary>
23642 <secondary>server list</secondary>
23643 </indexterm>
23644 This option provides a list of MySQL servers and associated connection data, to
23645 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
23646 option is available only if Exim has been built with MySQL support.
23647 </para>
23648 <para>
23649 <indexterm role="option">
23650 <primary><option>never_users</option></primary>
23651 </indexterm>
23652 </para>
23653 <informaltable frame="all">
23654 <tgroup cols="4" colsep="0" rowsep="0">
23655 <colspec colwidth="8*" align="left"/>
23656 <colspec colwidth="5*" align="center"/>
23657 <colspec colwidth="5*" align="center"/>
23658 <colspec colwidth="6*" align="right"/>
23659 <tbody>
23660 <row>
23661 <entry><option>never_users</option></entry>
23662 <entry>Use: <emphasis>main</emphasis></entry>
23663 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23664 <entry>Default: <emphasis>unset</emphasis></entry>
23665 </row>
23666 </tbody>
23667 </tgroup>
23668 </informaltable>
23669 <para>
23670 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
23671 message deliveries are normally run in processes that are setuid to the
23672 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
23673 It is usually desirable to prevent any deliveries from running as root, as a
23674 safety precaution.
23675 </para>
23676 <para>
23677 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
23678 list of users that must not be used for local deliveries. This list is fixed in
23679 the binary and cannot be overridden by the configuration file. By default, it
23680 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
23681 can be used to add more users to the fixed list.
23682 </para>
23683 <para>
23684 If a message is to be delivered as one of the users on the fixed list or the
23685 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
23686 example is
23687 </para>
23688 <literallayout class="monospaced">
23689 never_users = root:daemon:bin
23690 </literallayout>
23691 <para>
23692 Including root is redundant if it is also on the fixed list, but it does no
23693 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
23694 transport driver.
23695 </para>
23696 <para>
23697 <indexterm role="option">
23698 <primary><option>oracle_servers</option></primary>
23699 </indexterm>
23700 </para>
23701 <informaltable frame="all">
23702 <tgroup cols="4" colsep="0" rowsep="0">
23703 <colspec colwidth="8*" align="left"/>
23704 <colspec colwidth="5*" align="center"/>
23705 <colspec colwidth="5*" align="center"/>
23706 <colspec colwidth="6*" align="right"/>
23707 <tbody>
23708 <row>
23709 <entry><option>oracle_servers</option></entry>
23710 <entry>Use: <emphasis>main</emphasis></entry>
23711 <entry>Type: <emphasis>string list</emphasis></entry>
23712 <entry>Default: <emphasis>unset</emphasis></entry>
23713 </row>
23714 </tbody>
23715 </tgroup>
23716 </informaltable>
23717 <para>
23718 <indexterm role="concept">
23719 <primary>Oracle</primary>
23720 <secondary>server list</secondary>
23721 </indexterm>
23722 This option provides a list of Oracle servers and associated connection data,
23723 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
23724 The option is available only if Exim has been built with Oracle support.
23725 </para>
23726 <para>
23727 <indexterm role="option">
23728 <primary><option>percent_hack_domains</option></primary>
23729 </indexterm>
23730 </para>
23731 <informaltable frame="all">
23732 <tgroup cols="4" colsep="0" rowsep="0">
23733 <colspec colwidth="8*" align="left"/>
23734 <colspec colwidth="5*" align="center"/>
23735 <colspec colwidth="5*" align="center"/>
23736 <colspec colwidth="6*" align="right"/>
23737 <tbody>
23738 <row>
23739 <entry><option>percent_hack_domains</option></entry>
23740 <entry>Use: <emphasis>main</emphasis></entry>
23741 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23742 <entry>Default: <emphasis>unset</emphasis></entry>
23743 </row>
23744 </tbody>
23745 </tgroup>
23746 </informaltable>
23747 <para>
23748 <indexterm role="concept">
23749 <primary><quote>percent hack</quote></primary>
23750 </indexterm>
23751 <indexterm role="concept">
23752 <primary>source routing</primary>
23753 <secondary>in email address</secondary>
23754 </indexterm>
23755 <indexterm role="concept">
23756 <primary>address</primary>
23757 <secondary>source-routed</secondary>
23758 </indexterm>
23759 The <quote>percent hack</quote> is the convention whereby a local part containing a
23760 percent sign is re-interpreted as a new email address, with the percent
23761 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
23762 also applied to RFC 2822 addresses that begin with an @ character. If this
23763 option is set, Exim implements the percent facility for those domains listed,
23764 but no others. This happens before an incoming SMTP address is tested against
23765 an ACL.
23766 </para>
23767 <para>
23768 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
23769 trying to get round relaying restrictions. For this reason, it is best avoided
23770 if at all possible. Unfortunately, a number of less security-conscious MTAs
23771 implement it unconditionally. If you are running Exim on a gateway host, and
23772 routing mail through to internal MTAs without processing the local parts, it is
23773 a good idea to reject recipient addresses with percent characters in their
23774 local parts. Exim&#x2019;s default configuration does this.
23775 </para>
23776 <para>
23777 <indexterm role="option">
23778 <primary><option>perl_at_start</option></primary>
23779 </indexterm>
23780 </para>
23781 <informaltable frame="all">
23782 <tgroup cols="4" colsep="0" rowsep="0">
23783 <colspec colwidth="8*" align="left"/>
23784 <colspec colwidth="5*" align="center"/>
23785 <colspec colwidth="5*" align="center"/>
23786 <colspec colwidth="6*" align="right"/>
23787 <tbody>
23788 <row>
23789 <entry><option>perl_at_start</option></entry>
23790 <entry>Use: <emphasis>main</emphasis></entry>
23791 <entry>Type: <emphasis>boolean</emphasis></entry>
23792 <entry>Default: <emphasis>false</emphasis></entry>
23793 </row>
23794 </tbody>
23795 </tgroup>
23796 </informaltable>
23797 <para>
23798 This option is available only when Exim is built with an embedded Perl
23799 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23800 </para>
23801 <para>
23802 <indexterm role="option">
23803 <primary><option>perl_startup</option></primary>
23804 </indexterm>
23805 </para>
23806 <informaltable frame="all">
23807 <tgroup cols="4" colsep="0" rowsep="0">
23808 <colspec colwidth="8*" align="left"/>
23809 <colspec colwidth="5*" align="center"/>
23810 <colspec colwidth="5*" align="center"/>
23811 <colspec colwidth="6*" align="right"/>
23812 <tbody>
23813 <row>
23814 <entry><option>perl_startup</option></entry>
23815 <entry>Use: <emphasis>main</emphasis></entry>
23816 <entry>Type: <emphasis>string</emphasis></entry>
23817 <entry>Default: <emphasis>unset</emphasis></entry>
23818 </row>
23819 </tbody>
23820 </tgroup>
23821 </informaltable>
23822 <para>
23823 This option is available only when Exim is built with an embedded Perl
23824 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23825 </para>
23826 <para>
23827 <indexterm role="option">
23828 <primary><option>pgsql_servers</option></primary>
23829 </indexterm>
23830 </para>
23831 <informaltable frame="all">
23832 <tgroup cols="4" colsep="0" rowsep="0">
23833 <colspec colwidth="8*" align="left"/>
23834 <colspec colwidth="5*" align="center"/>
23835 <colspec colwidth="5*" align="center"/>
23836 <colspec colwidth="6*" align="right"/>
23837 <tbody>
23838 <row>
23839 <entry><option>pgsql_servers</option></entry>
23840 <entry>Use: <emphasis>main</emphasis></entry>
23841 <entry>Type: <emphasis>string list</emphasis></entry>
23842 <entry>Default: <emphasis>unset</emphasis></entry>
23843 </row>
23844 </tbody>
23845 </tgroup>
23846 </informaltable>
23847 <para>
23848 <indexterm role="concept">
23849 <primary>PostgreSQL lookup type</primary>
23850 <secondary>server list</secondary>
23851 </indexterm>
23852 This option provides a list of PostgreSQL servers and associated connection
23853 data, to be used in conjunction with <command>pgsql</command> lookups (see section
23854 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
23855 PostgreSQL support.
23856 </para>
23857 <para>
23858 <indexterm role="option">
23859 <primary><option>pid_file_path</option></primary>
23860 </indexterm>
23861 </para>
23862 <informaltable frame="all">
23863 <tgroup cols="4" colsep="0" rowsep="0">
23864 <colspec colwidth="8*" align="left"/>
23865 <colspec colwidth="5*" align="center"/>
23866 <colspec colwidth="5*" align="center"/>
23867 <colspec colwidth="6*" align="right"/>
23868 <tbody>
23869 <row>
23870 <entry><option>pid_file_path</option></entry>
23871 <entry>Use: <emphasis>main</emphasis></entry>
23872 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23873 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23874 </row>
23875 </tbody>
23876 </tgroup>
23877 </informaltable>
23878 <para>
23879 <indexterm role="concept">
23880 <primary>daemon</primary>
23881 <secondary>pid file path</secondary>
23882 </indexterm>
23883 <indexterm role="concept">
23884 <primary>pid file</primary>
23885 <secondary>path for</secondary>
23886 </indexterm>
23887 This option sets the name of the file to which the Exim daemon writes its
23888 process id. The string is expanded, so it can contain, for example, references
23889 to the host name:
23890 </para>
23891 <literallayout class="monospaced">
23892 pid_file_path = /var/log/$primary_hostname/exim.pid
23893 </literallayout>
23894 <para>
23895 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
23896 spool directory.
23897 The value set by the option can be overridden by the <option>-oP</option> command line
23898 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
23899 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
23900 </para>
23901 <para>
23902 <indexterm role="option">
23903 <primary><option>pipelining_advertise_hosts</option></primary>
23904 </indexterm>
23905 </para>
23906 <informaltable frame="all">
23907 <tgroup cols="4" colsep="0" rowsep="0">
23908 <colspec colwidth="8*" align="left"/>
23909 <colspec colwidth="5*" align="center"/>
23910 <colspec colwidth="5*" align="center"/>
23911 <colspec colwidth="6*" align="right"/>
23912 <tbody>
23913 <row>
23914 <entry><option>pipelining_advertise_hosts</option></entry>
23915 <entry>Use: <emphasis>main</emphasis></entry>
23916 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23917 <entry>Default: <emphasis>*</emphasis></entry>
23918 </row>
23919 </tbody>
23920 </tgroup>
23921 </informaltable>
23922 <para>
23923 <indexterm role="concept">
23924 <primary>PIPELINING advertising</primary>
23925 <secondary>suppressing</secondary>
23926 </indexterm>
23927 This option can be used to suppress the advertisement of the SMTP
23928 PIPELINING extension to specific hosts. When PIPELINING is not
23929 advertised and <option>smtp_enforce_sync</option> is true, an Exim server enforces strict
23930 synchronization for each SMTP command and response.
23931 When PIPELINING is advertised, Exim assumes that clients will use it; <quote>out
23932 of order</quote> commands that are <quote>expected</quote> do not count as protocol errors (see
23933 <option>smtp_max_synprot_errors</option>).
23934 </para>
23935 <para>
23936 <indexterm role="option">
23937 <primary><option>preserve_message_logs</option></primary>
23938 </indexterm>
23939 </para>
23940 <informaltable frame="all">
23941 <tgroup cols="4" colsep="0" rowsep="0">
23942 <colspec colwidth="8*" align="left"/>
23943 <colspec colwidth="5*" align="center"/>
23944 <colspec colwidth="5*" align="center"/>
23945 <colspec colwidth="6*" align="right"/>
23946 <tbody>
23947 <row>
23948 <entry><option>preserve_message_logs</option></entry>
23949 <entry>Use: <emphasis>main</emphasis></entry>
23950 <entry>Type: <emphasis>boolean</emphasis></entry>
23951 <entry>Default: <emphasis>false</emphasis></entry>
23952 </row>
23953 </tbody>
23954 </tgroup>
23955 </informaltable>
23956 <para>
23957 <indexterm role="concept">
23958 <primary>message logs</primary>
23959 <secondary>preserving</secondary>
23960 </indexterm>
23961 If this option is set, message log files are not deleted when messages are
23962 completed. Instead, they are moved to a sub-directory of the spool directory
23963 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
23964 purposes. This is a dangerous option to set on systems with any appreciable
23965 volume of mail. Use with care!
23966 </para>
23967 <para>
23968 <indexterm role="option">
23969 <primary><option>primary_hostname</option></primary>
23970 </indexterm>
23971 </para>
23972 <informaltable frame="all">
23973 <tgroup cols="4" colsep="0" rowsep="0">
23974 <colspec colwidth="8*" align="left"/>
23975 <colspec colwidth="5*" align="center"/>
23976 <colspec colwidth="5*" align="center"/>
23977 <colspec colwidth="6*" align="right"/>
23978 <tbody>
23979 <row>
23980 <entry><option>primary_hostname</option></entry>
23981 <entry>Use: <emphasis>main</emphasis></entry>
23982 <entry>Type: <emphasis>string</emphasis></entry>
23983 <entry>Default: <emphasis>see below</emphasis></entry>
23984 </row>
23985 </tbody>
23986 </tgroup>
23987 </informaltable>
23988 <para>
23989 <indexterm role="concept">
23990 <primary>name</primary>
23991 <secondary>of local host</secondary>
23992 </indexterm>
23993 <indexterm role="concept">
23994 <primary>host</primary>
23995 <secondary>name of local</secondary>
23996 </indexterm>
23997 <indexterm role="concept">
23998 <primary>local host</primary>
23999 <secondary>name of</secondary>
24000 </indexterm>
24001 <indexterm role="concept">
24002 <primary><varname>$primary_hostname</varname></primary>
24003 </indexterm>
24004 This specifies the name of the current host. It is used in the default EHLO or
24005 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
24006 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
24007 The value is also used by default in some SMTP response messages from an Exim
24008 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
24009 </para>
24010 <para>
24011 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
24012 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
24013 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
24014 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
24015 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
24016 explicitly by this option, or defaulted.
24017 </para>
24018 <para>
24019 <indexterm role="option">
24020 <primary><option>print_topbitchars</option></primary>
24021 </indexterm>
24022 </para>
24023 <informaltable frame="all">
24024 <tgroup cols="4" colsep="0" rowsep="0">
24025 <colspec colwidth="8*" align="left"/>
24026 <colspec colwidth="5*" align="center"/>
24027 <colspec colwidth="5*" align="center"/>
24028 <colspec colwidth="6*" align="right"/>
24029 <tbody>
24030 <row>
24031 <entry><option>print_topbitchars</option></entry>
24032 <entry>Use: <emphasis>main</emphasis></entry>
24033 <entry>Type: <emphasis>boolean</emphasis></entry>
24034 <entry>Default: <emphasis>false</emphasis></entry>
24035 </row>
24036 </tbody>
24037 </tgroup>
24038 </informaltable>
24039 <para>
24040 <indexterm role="concept">
24041 <primary>printing characters</primary>
24042 </indexterm>
24043 <indexterm role="concept">
24044 <primary>8-bit characters</primary>
24045 </indexterm>
24046 By default, Exim considers only those characters whose codes lie in the range
24047 32&ndash;126 to be printing characters. In a number of circumstances (for example,
24048 when writing log entries) non-printing characters are converted into escape
24049 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
24050 is set, code values of 128 and above are also considered to be printing
24051 characters.
24052 </para>
24053 <para>
24054 This option also affects the header syntax checks performed by the
24055 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
24056 the user&#x2019;s full name when constructing From: and Sender: addresses (as
24057 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
24058 Exim to generate eight bit message headers that do not conform to the
24059 standards.
24060 </para>
24061 <para>
24062 <indexterm role="option">
24063 <primary><option>process_log_path</option></primary>
24064 </indexterm>
24065 </para>
24066 <informaltable frame="all">
24067 <tgroup cols="4" colsep="0" rowsep="0">
24068 <colspec colwidth="8*" align="left"/>
24069 <colspec colwidth="5*" align="center"/>
24070 <colspec colwidth="5*" align="center"/>
24071 <colspec colwidth="6*" align="right"/>
24072 <tbody>
24073 <row>
24074 <entry><option>process_log_path</option></entry>
24075 <entry>Use: <emphasis>main</emphasis></entry>
24076 <entry>Type: <emphasis>string</emphasis></entry>
24077 <entry>Default: <emphasis>unset</emphasis></entry>
24078 </row>
24079 </tbody>
24080 </tgroup>
24081 </informaltable>
24082 <para>
24083 <indexterm role="concept">
24084 <primary>process log path</primary>
24085 </indexterm>
24086 <indexterm role="concept">
24087 <primary>log</primary>
24088 <secondary>process log</secondary>
24089 </indexterm>
24090 <indexterm role="concept">
24091 <primary><emphasis>exiwhat</emphasis></primary>
24092 </indexterm>
24093 This option sets the name of the file to which an Exim process writes its
24094 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
24095 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
24096 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
24097 can be useful in environments where two different Exims are running, using
24098 different spool directories.
24099 </para>
24100 <para>
24101 <indexterm role="option">
24102 <primary><option>prod_requires_admin</option></primary>
24103 </indexterm>
24104 </para>
24105 <informaltable frame="all">
24106 <tgroup cols="4" colsep="0" rowsep="0">
24107 <colspec colwidth="8*" align="left"/>
24108 <colspec colwidth="5*" align="center"/>
24109 <colspec colwidth="5*" align="center"/>
24110 <colspec colwidth="6*" align="right"/>
24111 <tbody>
24112 <row>
24113 <entry><option>prod_requires_admin</option></entry>
24114 <entry>Use: <emphasis>main</emphasis></entry>
24115 <entry>Type: <emphasis>boolean</emphasis></entry>
24116 <entry>Default: <emphasis>true</emphasis></entry>
24117 </row>
24118 </tbody>
24119 </tgroup>
24120 </informaltable>
24121 <para>
24122 <indexterm role="concept">
24123 <primary><option>-M</option> option</primary>
24124 </indexterm>
24125 <indexterm role="concept">
24126 <primary><option>-R</option> option</primary>
24127 </indexterm>
24128 <indexterm role="concept">
24129 <primary><option>-q</option> option</primary>
24130 </indexterm>
24131 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
24132 admin user unless <option>prod_requires_admin</option> is set false. See also
24133 <option>queue_list_requires_admin</option>.
24134 </para>
24135 <para>
24136 <indexterm role="option">
24137 <primary><option>qualify_domain</option></primary>
24138 </indexterm>
24139 </para>
24140 <informaltable frame="all">
24141 <tgroup cols="4" colsep="0" rowsep="0">
24142 <colspec colwidth="8*" align="left"/>
24143 <colspec colwidth="5*" align="center"/>
24144 <colspec colwidth="5*" align="center"/>
24145 <colspec colwidth="6*" align="right"/>
24146 <tbody>
24147 <row>
24148 <entry><option>qualify_domain</option></entry>
24149 <entry>Use: <emphasis>main</emphasis></entry>
24150 <entry>Type: <emphasis>string</emphasis></entry>
24151 <entry>Default: <emphasis>see below</emphasis></entry>
24152 </row>
24153 </tbody>
24154 </tgroup>
24155 </informaltable>
24156 <para>
24157 <indexterm role="concept">
24158 <primary>domain</primary>
24159 <secondary>for qualifying addresses</secondary>
24160 </indexterm>
24161 <indexterm role="concept">
24162 <primary>address</primary>
24163 <secondary>qualification</secondary>
24164 </indexterm>
24165 This option specifies the domain name that is added to any envelope sender
24166 addresses that do not have a domain qualification. It also applies to
24167 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
24168 are accepted by default only for locally-generated messages. Qualification is
24169 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
24170 locally-generated messages, unless the <option>-bnq</option> command line option is used.
24171 </para>
24172 <para>
24173 Messages from external sources must always contain fully qualified addresses,
24174 unless the sending host matches <option>sender_unqualified_hosts</option> or
24175 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
24176 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
24177 necessary. Internally, Exim always works with fully qualified envelope
24178 addresses. If <option>qualify_domain</option> is not set, it defaults to the
24179 <option>primary_hostname</option> value.
24180 </para>
24181 <para>
24182 <indexterm role="option">
24183 <primary><option>qualify_recipient</option></primary>
24184 </indexterm>
24185 </para>
24186 <informaltable frame="all">
24187 <tgroup cols="4" colsep="0" rowsep="0">
24188 <colspec colwidth="8*" align="left"/>
24189 <colspec colwidth="5*" align="center"/>
24190 <colspec colwidth="5*" align="center"/>
24191 <colspec colwidth="6*" align="right"/>
24192 <tbody>
24193 <row>
24194 <entry><option>qualify_recipient</option></entry>
24195 <entry>Use: <emphasis>main</emphasis></entry>
24196 <entry>Type: <emphasis>string</emphasis></entry>
24197 <entry>Default: <emphasis>see below</emphasis></entry>
24198 </row>
24199 </tbody>
24200 </tgroup>
24201 </informaltable>
24202 <para>
24203 This option allows you to specify a different domain for qualifying recipient
24204 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
24205 </para>
24206 <para>
24207 <indexterm role="option">
24208 <primary><option>queue_domains</option></primary>
24209 </indexterm>
24210 </para>
24211 <informaltable frame="all">
24212 <tgroup cols="4" colsep="0" rowsep="0">
24213 <colspec colwidth="8*" align="left"/>
24214 <colspec colwidth="5*" align="center"/>
24215 <colspec colwidth="5*" align="center"/>
24216 <colspec colwidth="6*" align="right"/>
24217 <tbody>
24218 <row>
24219 <entry><option>queue_domains</option></entry>
24220 <entry>Use: <emphasis>main</emphasis></entry>
24221 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24222 <entry>Default: <emphasis>unset</emphasis></entry>
24223 </row>
24224 </tbody>
24225 </tgroup>
24226 </informaltable>
24227 <para>
24228 <indexterm role="concept">
24229 <primary>domain</primary>
24230 <secondary>specifying non-immediate delivery</secondary>
24231 </indexterm>
24232 <indexterm role="concept">
24233 <primary>queueing incoming messages</primary>
24234 </indexterm>
24235 <indexterm role="concept">
24236 <primary>message</primary>
24237 <secondary>queueing certain domains</secondary>
24238 </indexterm>
24239 This option lists domains for which immediate delivery is not required.
24240 A delivery process is started whenever a message is received, but only those
24241 domains that do not match are processed. All other deliveries wait until the
24242 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24243 </para>
24244 <para>
24245 <indexterm role="option">
24246 <primary><option>queue_list_requires_admin</option></primary>
24247 </indexterm>
24248 </para>
24249 <informaltable frame="all">
24250 <tgroup cols="4" colsep="0" rowsep="0">
24251 <colspec colwidth="8*" align="left"/>
24252 <colspec colwidth="5*" align="center"/>
24253 <colspec colwidth="5*" align="center"/>
24254 <colspec colwidth="6*" align="right"/>
24255 <tbody>
24256 <row>
24257 <entry><option>queue_list_requires_admin</option></entry>
24258 <entry>Use: <emphasis>main</emphasis></entry>
24259 <entry>Type: <emphasis>boolean</emphasis></entry>
24260 <entry>Default: <emphasis>true</emphasis></entry>
24261 </row>
24262 </tbody>
24263 </tgroup>
24264 </informaltable>
24265 <para>
24266 <indexterm role="concept">
24267 <primary><option>-bp</option> option</primary>
24268 </indexterm>
24269 The <option>-bp</option> command-line option, which lists the messages that are on the
24270 queue, requires the caller to be an admin user unless
24271 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24272 </para>
24273 <para>
24274 <indexterm role="option">
24275 <primary><option>queue_only</option></primary>
24276 </indexterm>
24277 </para>
24278 <informaltable frame="all">
24279 <tgroup cols="4" colsep="0" rowsep="0">
24280 <colspec colwidth="8*" align="left"/>
24281 <colspec colwidth="5*" align="center"/>
24282 <colspec colwidth="5*" align="center"/>
24283 <colspec colwidth="6*" align="right"/>
24284 <tbody>
24285 <row>
24286 <entry><option>queue_only</option></entry>
24287 <entry>Use: <emphasis>main</emphasis></entry>
24288 <entry>Type: <emphasis>boolean</emphasis></entry>
24289 <entry>Default: <emphasis>false</emphasis></entry>
24290 </row>
24291 </tbody>
24292 </tgroup>
24293 </informaltable>
24294 <para>
24295 <indexterm role="concept">
24296 <primary>queueing incoming messages</primary>
24297 </indexterm>
24298 <indexterm role="concept">
24299 <primary>message</primary>
24300 <secondary>queueing unconditionally</secondary>
24301 </indexterm>
24302 If <option>queue_only</option> is set, a delivery process is not automatically started
24303 whenever a message is received. Instead, the message waits on the queue for the
24304 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
24305 delivered immediately when certain conditions (such as heavy load) occur.
24306 </para>
24307 <para>
24308 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
24309 and <option>-odi</option> command line options override <option>queue_only</option> unless
24310 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
24311 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
24312 </para>
24313 <para>
24314 <indexterm role="option">
24315 <primary><option>queue_only_file</option></primary>
24316 </indexterm>
24317 </para>
24318 <informaltable frame="all">
24319 <tgroup cols="4" colsep="0" rowsep="0">
24320 <colspec colwidth="8*" align="left"/>
24321 <colspec colwidth="5*" align="center"/>
24322 <colspec colwidth="5*" align="center"/>
24323 <colspec colwidth="6*" align="right"/>
24324 <tbody>
24325 <row>
24326 <entry><option>queue_only_file</option></entry>
24327 <entry>Use: <emphasis>main</emphasis></entry>
24328 <entry>Type: <emphasis>string</emphasis></entry>
24329 <entry>Default: <emphasis>unset</emphasis></entry>
24330 </row>
24331 </tbody>
24332 </tgroup>
24333 </informaltable>
24334 <para>
24335 <indexterm role="concept">
24336 <primary>queueing incoming messages</primary>
24337 </indexterm>
24338 <indexterm role="concept">
24339 <primary>message</primary>
24340 <secondary>queueing by file existence</secondary>
24341 </indexterm>
24342 This option can be set to a colon-separated list of absolute path names, each
24343 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
24344 it tests for the existence of each listed path using a call to <function>stat()</function>. For
24345 each path that exists, the corresponding queuing option is set.
24346 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
24347 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
24348 </para>
24349 <literallayout class="monospaced">
24350 queue_only_file = smtp/some/file
24351 </literallayout>
24352 <para>
24353 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
24354 <filename>/some/file</filename> exists.
24355 </para>
24356 <para>
24357 <indexterm role="option">
24358 <primary><option>queue_only_load</option></primary>
24359 </indexterm>
24360 </para>
24361 <informaltable frame="all">
24362 <tgroup cols="4" colsep="0" rowsep="0">
24363 <colspec colwidth="8*" align="left"/>
24364 <colspec colwidth="5*" align="center"/>
24365 <colspec colwidth="5*" align="center"/>
24366 <colspec colwidth="6*" align="right"/>
24367 <tbody>
24368 <row>
24369 <entry><option>queue_only_load</option></entry>
24370 <entry>Use: <emphasis>main</emphasis></entry>
24371 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24372 <entry>Default: <emphasis>unset</emphasis></entry>
24373 </row>
24374 </tbody>
24375 </tgroup>
24376 </informaltable>
24377 <para>
24378 <indexterm role="concept">
24379 <primary>load average</primary>
24380 </indexterm>
24381 <indexterm role="concept">
24382 <primary>queueing incoming messages</primary>
24383 </indexterm>
24384 <indexterm role="concept">
24385 <primary>message</primary>
24386 <secondary>queueing by load</secondary>
24387 </indexterm>
24388 If the system load average is higher than this value, incoming messages from
24389 all sources are queued, and no automatic deliveries are started. If this
24390 happens during local or remote SMTP input, all subsequent messages on the same
24391 connection are queued. Deliveries will subsequently be performed by queue
24392 runner processes. This option has no effect on ancient operating systems on
24393 which Exim cannot determine the load average. See also
24394 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
24395 </para>
24396 <para>
24397 <indexterm role="option">
24398 <primary><option>queue_only_override</option></primary>
24399 </indexterm>
24400 </para>
24401 <informaltable frame="all">
24402 <tgroup cols="4" colsep="0" rowsep="0">
24403 <colspec colwidth="8*" align="left"/>
24404 <colspec colwidth="5*" align="center"/>
24405 <colspec colwidth="5*" align="center"/>
24406 <colspec colwidth="6*" align="right"/>
24407 <tbody>
24408 <row>
24409 <entry><option>queue_only_override</option></entry>
24410 <entry>Use: <emphasis>main</emphasis></entry>
24411 <entry>Type: <emphasis>boolean</emphasis></entry>
24412 <entry>Default: <emphasis>true</emphasis></entry>
24413 </row>
24414 </tbody>
24415 </tgroup>
24416 </informaltable>
24417 <para>
24418 <indexterm role="concept">
24419 <primary>queueing incoming messages</primary>
24420 </indexterm>
24421 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
24422 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
24423 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
24424 to override; they are accepted, but ignored.
24425 </para>
24426 <para>
24427 <indexterm role="option">
24428 <primary><option>queue_run_in_order</option></primary>
24429 </indexterm>
24430 </para>
24431 <informaltable frame="all">
24432 <tgroup cols="4" colsep="0" rowsep="0">
24433 <colspec colwidth="8*" align="left"/>
24434 <colspec colwidth="5*" align="center"/>
24435 <colspec colwidth="5*" align="center"/>
24436 <colspec colwidth="6*" align="right"/>
24437 <tbody>
24438 <row>
24439 <entry><option>queue_run_in_order</option></entry>
24440 <entry>Use: <emphasis>main</emphasis></entry>
24441 <entry>Type: <emphasis>boolean</emphasis></entry>
24442 <entry>Default: <emphasis>false</emphasis></entry>
24443 </row>
24444 </tbody>
24445 </tgroup>
24446 </informaltable>
24447 <para>
24448 <indexterm role="concept">
24449 <primary>queue runner</primary>
24450 <secondary>processing messages in order</secondary>
24451 </indexterm>
24452 If this option is set, queue runs happen in order of message arrival instead of
24453 in an arbitrary order. For this to happen, a complete list of the entire queue
24454 must be set up before the deliveries start. When the queue is all held in a
24455 single directory (the default), a single list is created for both the ordered
24456 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
24457 single list is not created when <option>queue_run_in_order</option> is false. In this case,
24458 the sub-directories are processed one at a time (in a random order), and this
24459 avoids setting up one huge list for the whole queue. Thus, setting
24460 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
24461 when the queue is large, because of the extra work in setting up the single,
24462 large list. In most situations, <option>queue_run_in_order</option> should not be set.
24463 </para>
24464 <para>
24465 <indexterm role="option">
24466 <primary><option>queue_run_max</option></primary>
24467 </indexterm>
24468 </para>
24469 <informaltable frame="all">
24470 <tgroup cols="4" colsep="0" rowsep="0">
24471 <colspec colwidth="8*" align="left"/>
24472 <colspec colwidth="5*" align="center"/>
24473 <colspec colwidth="5*" align="center"/>
24474 <colspec colwidth="6*" align="right"/>
24475 <tbody>
24476 <row>
24477 <entry><option>queue_run_max</option></entry>
24478 <entry>Use: <emphasis>main</emphasis></entry>
24479 <entry>Type: <emphasis>integer</emphasis></entry>
24480 <entry>Default: <emphasis>5</emphasis></entry>
24481 </row>
24482 </tbody>
24483 </tgroup>
24484 </informaltable>
24485 <para>
24486 <indexterm role="concept">
24487 <primary>queue runner</primary>
24488 <secondary>maximum number of</secondary>
24489 </indexterm>
24490 This controls the maximum number of queue runner processes that an Exim daemon
24491 can run simultaneously. This does not mean that it starts them all at once,
24492 but rather that if the maximum number are still running when the time comes to
24493 start another one, it refrains from starting another one. This can happen with
24494 very large queues and/or very sluggish deliveries. This option does not,
24495 however, interlock with other processes, so additional queue runners can be
24496 started by other means, or by killing and restarting the daemon.
24497 </para>
24498 <para>
24499 Setting this option to zero does not suppress queue runs; rather, it disables
24500 the limit, allowing any number of simultaneous queue runner processes to be
24501 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24502 the daemon&#x2019;s command line.
24503 </para>
24504 <para>
24505 <indexterm role="option">
24506 <primary><option>queue_smtp_domains</option></primary>
24507 </indexterm>
24508 </para>
24509 <informaltable frame="all">
24510 <tgroup cols="4" colsep="0" rowsep="0">
24511 <colspec colwidth="8*" align="left"/>
24512 <colspec colwidth="5*" align="center"/>
24513 <colspec colwidth="5*" align="center"/>
24514 <colspec colwidth="6*" align="right"/>
24515 <tbody>
24516 <row>
24517 <entry><option>queue_smtp_domains</option></entry>
24518 <entry>Use: <emphasis>main</emphasis></entry>
24519 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24520 <entry>Default: <emphasis>unset</emphasis></entry>
24521 </row>
24522 </tbody>
24523 </tgroup>
24524 </informaltable>
24525 <para>
24526 <indexterm role="concept">
24527 <primary>queueing incoming messages</primary>
24528 </indexterm>
24529 <indexterm role="concept">
24530 <primary>message</primary>
24531 <secondary>queueing remote deliveries</secondary>
24532 </indexterm>
24533 When this option is set, a delivery process is started whenever a message is
24534 received, routing is performed, and local deliveries take place.
24535 However, if any SMTP deliveries are required for domains that match
24536 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24537 message waits on the queue for the next queue run. Since routing of the message
24538 has taken place, Exim knows to which remote hosts it must be delivered, and so
24539 when the queue run happens, multiple messages for the same host are delivered
24540 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24541 SMTP deliveries to be queued in this way, and is equivalent to setting
24542 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24543 <option>queue_domains</option>.
24544 </para>
24545 <para>
24546 <indexterm role="option">
24547 <primary><option>receive_timeout</option></primary>
24548 </indexterm>
24549 </para>
24550 <informaltable frame="all">
24551 <tgroup cols="4" colsep="0" rowsep="0">
24552 <colspec colwidth="8*" align="left"/>
24553 <colspec colwidth="5*" align="center"/>
24554 <colspec colwidth="5*" align="center"/>
24555 <colspec colwidth="6*" align="right"/>
24556 <tbody>
24557 <row>
24558 <entry><option>receive_timeout</option></entry>
24559 <entry>Use: <emphasis>main</emphasis></entry>
24560 <entry>Type: <emphasis>time</emphasis></entry>
24561 <entry>Default: <emphasis>0s</emphasis></entry>
24562 </row>
24563 </tbody>
24564 </tgroup>
24565 </informaltable>
24566 <para>
24567 <indexterm role="concept">
24568 <primary>timeout</primary>
24569 <secondary>for non-SMTP input</secondary>
24570 </indexterm>
24571 This option sets the timeout for accepting a non-SMTP message, that is, the
24572 maximum time that Exim waits when reading a message on the standard input. If
24573 the value is zero, it will wait for ever. This setting is overridden by the
24574 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24575 controlled by <option>smtp_receive_timeout</option>.
24576 </para>
24577 <para>
24578 <indexterm role="option">
24579 <primary><option>received_header_text</option></primary>
24580 </indexterm>
24581 </para>
24582 <informaltable frame="all">
24583 <tgroup cols="4" colsep="0" rowsep="0">
24584 <colspec colwidth="8*" align="left"/>
24585 <colspec colwidth="5*" align="center"/>
24586 <colspec colwidth="5*" align="center"/>
24587 <colspec colwidth="6*" align="right"/>
24588 <tbody>
24589 <row>
24590 <entry><option>received_header_text</option></entry>
24591 <entry>Use: <emphasis>main</emphasis></entry>
24592 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24593 <entry>Default: <emphasis>see below</emphasis></entry>
24594 </row>
24595 </tbody>
24596 </tgroup>
24597 </informaltable>
24598 <para>
24599 <indexterm role="concept">
24600 <primary>customizing</primary>
24601 <secondary><emphasis>Received:</emphasis> header</secondary>
24602 </indexterm>
24603 <indexterm role="concept">
24604 <primary><emphasis>Received:</emphasis> header line</primary>
24605 <secondary>customizing</secondary>
24606 </indexterm>
24607 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
24608 added to each message, except for the timestamp, which is automatically added
24609 on at the end (preceded by a semicolon). The string is expanded each time it is
24610 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
24611 added to the message. Otherwise, the string should start with the text
24612 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
24613 header lines. The default setting is:
24614 </para>
24615 <literallayout class="monospaced">
24616 received_header_text = Received: \
24617   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
24618   {${if def:sender_ident \
24619   {from ${quote_local_part:$sender_ident} }}\
24620   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
24621   by $primary_hostname \
24622   ${if def:received_protocol {with $received_protocol}} \
24623   ${if def:tls_cipher {($tls_cipher)\n\t}}\
24624   (Exim $version_number)\n\t\
24625   ${if def:sender_address \
24626   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
24627   id $message_exim_id\
24628   ${if def:received_for {\n\tfor $received_for}}
24629 </literallayout>
24630 <para>
24631 The reference to the TLS cipher is omitted when Exim is built without TLS
24632 support. The use of conditional expansions ensures that this works for both
24633 locally generated messages and messages received from remote hosts, giving
24634 header lines such as the following:
24635 </para>
24636 <literallayout class="monospaced">
24637 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
24638 by marley.carol.example with esmtp (Exim 4.00)
24639 (envelope-from &lt;bob@carol.example&gt;)
24640 id 16IOWa-00019l-00
24641 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
24642 Received: by scrooge.carol.example with local (Exim 4.00)
24643 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
24644 </literallayout>
24645 <para>
24646 Until the body of the message has been received, the timestamp is the time when
24647 the message started to be received. Once the body has arrived, and all policy
24648 checks have taken place, the timestamp is updated to the time at which the
24649 message was accepted.
24650 </para>
24651 <para>
24652 <indexterm role="option">
24653 <primary><option>received_headers_max</option></primary>
24654 </indexterm>
24655 </para>
24656 <informaltable frame="all">
24657 <tgroup cols="4" colsep="0" rowsep="0">
24658 <colspec colwidth="8*" align="left"/>
24659 <colspec colwidth="5*" align="center"/>
24660 <colspec colwidth="5*" align="center"/>
24661 <colspec colwidth="6*" align="right"/>
24662 <tbody>
24663 <row>
24664 <entry><option>received_headers_max</option></entry>
24665 <entry>Use: <emphasis>main</emphasis></entry>
24666 <entry>Type: <emphasis>integer</emphasis></entry>
24667 <entry>Default: <emphasis>30</emphasis></entry>
24668 </row>
24669 </tbody>
24670 </tgroup>
24671 </informaltable>
24672 <para>
24673 <indexterm role="concept">
24674 <primary>loop</primary>
24675 <secondary>prevention</secondary>
24676 </indexterm>
24677 <indexterm role="concept">
24678 <primary>mail loop prevention</primary>
24679 </indexterm>
24680 <indexterm role="concept">
24681 <primary><emphasis>Received:</emphasis> header line</primary>
24682 <secondary>counting</secondary>
24683 </indexterm>
24684 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
24685 counted, and if it is greater than this parameter, a mail loop is assumed to
24686 have occurred, the delivery is abandoned, and an error message is generated.
24687 This applies to both local and remote deliveries.
24688 </para>
24689 <para>
24690 <indexterm role="option">
24691 <primary><option>recipient_unqualified_hosts</option></primary>
24692 </indexterm>
24693 </para>
24694 <informaltable frame="all">
24695 <tgroup cols="4" colsep="0" rowsep="0">
24696 <colspec colwidth="8*" align="left"/>
24697 <colspec colwidth="5*" align="center"/>
24698 <colspec colwidth="5*" align="center"/>
24699 <colspec colwidth="6*" align="right"/>
24700 <tbody>
24701 <row>
24702 <entry><option>recipient_unqualified_hosts</option></entry>
24703 <entry>Use: <emphasis>main</emphasis></entry>
24704 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24705 <entry>Default: <emphasis>unset</emphasis></entry>
24706 </row>
24707 </tbody>
24708 </tgroup>
24709 </informaltable>
24710 <para>
24711 <indexterm role="concept">
24712 <primary>unqualified addresses</primary>
24713 </indexterm>
24714 <indexterm role="concept">
24715 <primary>host</primary>
24716 <secondary>unqualified addresses from</secondary>
24717 </indexterm>
24718 This option lists those hosts from which Exim is prepared to accept unqualified
24719 recipient addresses in message envelopes. The addresses are made fully
24720 qualified by the addition of the <option>qualify_recipient</option> value. This option also
24721 affects message header lines. Exim does not reject unqualified recipient
24722 addresses in headers, but it qualifies them only if the message came from a
24723 host that matches <option>recipient_unqualified_hosts</option>,
24724 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
24725 option was not set.
24726 </para>
24727 <para>
24728 <indexterm role="option">
24729 <primary><option>recipients_max</option></primary>
24730 </indexterm>
24731 </para>
24732 <informaltable frame="all">
24733 <tgroup cols="4" colsep="0" rowsep="0">
24734 <colspec colwidth="8*" align="left"/>
24735 <colspec colwidth="5*" align="center"/>
24736 <colspec colwidth="5*" align="center"/>
24737 <colspec colwidth="6*" align="right"/>
24738 <tbody>
24739 <row>
24740 <entry><option>recipients_max</option></entry>
24741 <entry>Use: <emphasis>main</emphasis></entry>
24742 <entry>Type: <emphasis>integer</emphasis></entry>
24743 <entry>Default: <emphasis>0</emphasis></entry>
24744 </row>
24745 </tbody>
24746 </tgroup>
24747 </informaltable>
24748 <para>
24749 <indexterm role="concept">
24750 <primary>limit</primary>
24751 <secondary>number of recipients</secondary>
24752 </indexterm>
24753 <indexterm role="concept">
24754 <primary>recipient</primary>
24755 <secondary>maximum number</secondary>
24756 </indexterm>
24757 If this option is set greater than zero, it specifies the maximum number of
24758 original recipients for any message. Additional recipients that are generated
24759 by aliasing or forwarding do not count. SMTP messages get a 452 response for
24760 all recipients over the limit; earlier recipients are delivered as normal.
24761 Non-SMTP messages with too many recipients are failed, and no deliveries are
24762 done.
24763 </para>
24764 <para>
24765 <indexterm role="concept">
24766 <primary>RCPT</primary>
24767 <secondary>maximum number of incoming</secondary>
24768 </indexterm>
24769 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
24770 RCPT commands in a single message.
24771 </para>
24772 <para>
24773 <indexterm role="option">
24774 <primary><option>recipients_max_reject</option></primary>
24775 </indexterm>
24776 </para>
24777 <informaltable frame="all">
24778 <tgroup cols="4" colsep="0" rowsep="0">
24779 <colspec colwidth="8*" align="left"/>
24780 <colspec colwidth="5*" align="center"/>
24781 <colspec colwidth="5*" align="center"/>
24782 <colspec colwidth="6*" align="right"/>
24783 <tbody>
24784 <row>
24785 <entry><option>recipients_max_reject</option></entry>
24786 <entry>Use: <emphasis>main</emphasis></entry>
24787 <entry>Type: <emphasis>boolean</emphasis></entry>
24788 <entry>Default: <emphasis>false</emphasis></entry>
24789 </row>
24790 </tbody>
24791 </tgroup>
24792 </informaltable>
24793 <para>
24794 If this option is set true, Exim rejects SMTP messages containing too many
24795 recipients by giving 552 errors to the surplus RCPT commands, and a 554
24796 error to the eventual DATA command. Otherwise (the default) it gives a 452
24797 error to the surplus RCPT commands and accepts the message on behalf of the
24798 initial set of recipients. The remote server should then re-send the message
24799 for the remaining recipients at a later time.
24800 </para>
24801 <para>
24802 <indexterm role="option">
24803 <primary><option>remote_max_parallel</option></primary>
24804 </indexterm>
24805 </para>
24806 <informaltable frame="all">
24807 <tgroup cols="4" colsep="0" rowsep="0">
24808 <colspec colwidth="8*" align="left"/>
24809 <colspec colwidth="5*" align="center"/>
24810 <colspec colwidth="5*" align="center"/>
24811 <colspec colwidth="6*" align="right"/>
24812 <tbody>
24813 <row>
24814 <entry><option>remote_max_parallel</option></entry>
24815 <entry>Use: <emphasis>main</emphasis></entry>
24816 <entry>Type: <emphasis>integer</emphasis></entry>
24817 <entry>Default: <emphasis>2</emphasis></entry>
24818 </row>
24819 </tbody>
24820 </tgroup>
24821 </informaltable>
24822 <para>
24823 <indexterm role="concept">
24824 <primary>delivery</primary>
24825 <secondary>parallelism for remote</secondary>
24826 </indexterm>
24827 This option controls parallel delivery of one message to a number of remote
24828 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
24829 does all the remote deliveries for a message one by one. Otherwise, if a single
24830 message has to be delivered to more than one remote host, or if several copies
24831 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
24832 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
24833 deliveries are required, the maximum number of processes are started, and as
24834 each one finishes, another is begun. The order of starting processes is the
24835 same as if sequential delivery were being done, and can be controlled by the
24836 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
24837 with debugging turned on, the debugging output from each delivery process is
24838 tagged with its process id.
24839 </para>
24840 <para>
24841 This option controls only the maximum number of parallel deliveries for one
24842 message in one Exim delivery process. Because Exim has no central queue
24843 manager, there is no way of controlling the total number of simultaneous
24844 deliveries if the configuration allows a delivery attempt as soon as a message
24845 is received.
24846 </para>
24847 <para>
24848 <indexterm role="concept">
24849 <primary>number of deliveries</primary>
24850 </indexterm>
24851 <indexterm role="concept">
24852 <primary>delivery</primary>
24853 <secondary>maximum number of</secondary>
24854 </indexterm>
24855 If you want to control the total number of deliveries on the system, you
24856 need to set the <option>queue_only</option> option. This ensures that all incoming messages
24857 are added to the queue without starting a delivery process. Then set up an Exim
24858 daemon to start queue runner processes at appropriate intervals (probably
24859 fairly often, for example, every minute), and limit the total number of queue
24860 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
24861 delivers only one message at a time, the maximum number of deliveries that can
24862 then take place at once is <option>queue_run_max</option> multiplied by
24863 <option>remote_max_parallel</option>.
24864 </para>
24865 <para>
24866 If it is purely remote deliveries you want to control, use
24867 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
24868 doing the SMTP routing before queuing, so that several messages for the same
24869 host will eventually get delivered down the same connection.
24870 </para>
24871 <para>
24872 <indexterm role="option">
24873 <primary><option>remote_sort_domains</option></primary>
24874 </indexterm>
24875 </para>
24876 <informaltable frame="all">
24877 <tgroup cols="4" colsep="0" rowsep="0">
24878 <colspec colwidth="8*" align="left"/>
24879 <colspec colwidth="5*" align="center"/>
24880 <colspec colwidth="5*" align="center"/>
24881 <colspec colwidth="6*" align="right"/>
24882 <tbody>
24883 <row>
24884 <entry><option>remote_sort_domains</option></entry>
24885 <entry>Use: <emphasis>main</emphasis></entry>
24886 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24887 <entry>Default: <emphasis>unset</emphasis></entry>
24888 </row>
24889 </tbody>
24890 </tgroup>
24891 </informaltable>
24892 <para>
24893 <indexterm role="concept">
24894 <primary>sorting remote deliveries</primary>
24895 </indexterm>
24896 <indexterm role="concept">
24897 <primary>delivery</primary>
24898 <secondary>sorting remote</secondary>
24899 </indexterm>
24900 When there are a number of remote deliveries for a message, they are sorted by
24901 domain into the order given by this list. For example,
24902 </para>
24903 <literallayout class="monospaced">
24904 remote_sort_domains = *.cam.ac.uk:*.uk
24905 </literallayout>
24906 <para>
24907 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
24908 then to those in the <option>uk</option> domain, then to any others.
24909 </para>
24910 <para>
24911 <indexterm role="option">
24912 <primary><option>retry_data_expire</option></primary>
24913 </indexterm>
24914 </para>
24915 <informaltable frame="all">
24916 <tgroup cols="4" colsep="0" rowsep="0">
24917 <colspec colwidth="8*" align="left"/>
24918 <colspec colwidth="5*" align="center"/>
24919 <colspec colwidth="5*" align="center"/>
24920 <colspec colwidth="6*" align="right"/>
24921 <tbody>
24922 <row>
24923 <entry><option>retry_data_expire</option></entry>
24924 <entry>Use: <emphasis>main</emphasis></entry>
24925 <entry>Type: <emphasis>time</emphasis></entry>
24926 <entry>Default: <emphasis>7d</emphasis></entry>
24927 </row>
24928 </tbody>
24929 </tgroup>
24930 </informaltable>
24931 <para>
24932 <indexterm role="concept">
24933 <primary>hints database</primary>
24934 <secondary>data expiry</secondary>
24935 </indexterm>
24936 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
24937 database. Any older retry data is ignored. This means that, for example, once a
24938 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
24939 past failures.
24940 </para>
24941 <para>
24942 <indexterm role="option">
24943 <primary><option>retry_interval_max</option></primary>
24944 </indexterm>
24945 </para>
24946 <informaltable frame="all">
24947 <tgroup cols="4" colsep="0" rowsep="0">
24948 <colspec colwidth="8*" align="left"/>
24949 <colspec colwidth="5*" align="center"/>
24950 <colspec colwidth="5*" align="center"/>
24951 <colspec colwidth="6*" align="right"/>
24952 <tbody>
24953 <row>
24954 <entry><option>retry_interval_max</option></entry>
24955 <entry>Use: <emphasis>main</emphasis></entry>
24956 <entry>Type: <emphasis>time</emphasis></entry>
24957 <entry>Default: <emphasis>24h</emphasis></entry>
24958 </row>
24959 </tbody>
24960 </tgroup>
24961 </informaltable>
24962 <para>
24963 <indexterm role="concept">
24964 <primary>retry</primary>
24965 <secondary>limit on interval</secondary>
24966 </indexterm>
24967 <indexterm role="concept">
24968 <primary>limit</primary>
24969 <secondary>on retry interval</secondary>
24970 </indexterm>
24971 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
24972 intervals between delivery attempts for messages that cannot be delivered
24973 straight away. This option sets an overall limit to the length of time between
24974 retries. It cannot be set greater than 24 hours; any attempt to do so forces
24975 the default value.
24976 </para>
24977 <para>
24978 <indexterm role="option">
24979 <primary><option>return_path_remove</option></primary>
24980 </indexterm>
24981 </para>
24982 <informaltable frame="all">
24983 <tgroup cols="4" colsep="0" rowsep="0">
24984 <colspec colwidth="8*" align="left"/>
24985 <colspec colwidth="5*" align="center"/>
24986 <colspec colwidth="5*" align="center"/>
24987 <colspec colwidth="6*" align="right"/>
24988 <tbody>
24989 <row>
24990 <entry><option>return_path_remove</option></entry>
24991 <entry>Use: <emphasis>main</emphasis></entry>
24992 <entry>Type: <emphasis>boolean</emphasis></entry>
24993 <entry>Default: <emphasis>true</emphasis></entry>
24994 </row>
24995 </tbody>
24996 </tgroup>
24997 </informaltable>
24998 <para>
24999 <indexterm role="concept">
25000 <primary><emphasis>Return-path:</emphasis> header line</primary>
25001 <secondary>removing</secondary>
25002 </indexterm>
25003 RFC 2821, section 4.4, states that an SMTP server must insert a
25004 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
25005 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
25006 MAIL command. This description implies that this header should not be present
25007 in an incoming message. If <option>return_path_remove</option> is true, any existing
25008 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
25009 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
25010 the time of delivery. They are normally used only for final local deliveries.
25011 </para>
25012 <para>
25013 <indexterm role="option">
25014 <primary><option>return_size_limit</option></primary>
25015 </indexterm>
25016 </para>
25017 <informaltable frame="all">
25018 <tgroup cols="4" colsep="0" rowsep="0">
25019 <colspec colwidth="8*" align="left"/>
25020 <colspec colwidth="5*" align="center"/>
25021 <colspec colwidth="5*" align="center"/>
25022 <colspec colwidth="6*" align="right"/>
25023 <tbody>
25024 <row>
25025 <entry><option>return_size_limit</option></entry>
25026 <entry>Use: <emphasis>main</emphasis></entry>
25027 <entry>Type: <emphasis>integer</emphasis></entry>
25028 <entry>Default: <emphasis>100K</emphasis></entry>
25029 </row>
25030 </tbody>
25031 </tgroup>
25032 </informaltable>
25033 <para>
25034 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
25035 </para>
25036 <para>
25037 <indexterm role="option">
25038 <primary><option>rfc1413_hosts</option></primary>
25039 </indexterm>
25040 </para>
25041 <informaltable frame="all">
25042 <tgroup cols="4" colsep="0" rowsep="0">
25043 <colspec colwidth="8*" align="left"/>
25044 <colspec colwidth="5*" align="center"/>
25045 <colspec colwidth="5*" align="center"/>
25046 <colspec colwidth="6*" align="right"/>
25047 <tbody>
25048 <row>
25049 <entry><option>rfc1413_hosts</option></entry>
25050 <entry>Use: <emphasis>main</emphasis></entry>
25051 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25052 <entry>Default: <emphasis>*</emphasis></entry>
25053 </row>
25054 </tbody>
25055 </tgroup>
25056 </informaltable>
25057 <para>
25058 <indexterm role="concept">
25059 <primary>RFC 1413</primary>
25060 </indexterm>
25061 <indexterm role="concept">
25062 <primary>host</primary>
25063 <secondary>for RFC 1413 calls</secondary>
25064 </indexterm>
25065 RFC 1413 identification calls are made to any client host which matches an item
25066 in the list.
25067 </para>
25068 <para>
25069 <indexterm role="option">
25070 <primary><option>rfc1413_query_timeout</option></primary>
25071 </indexterm>
25072 </para>
25073 <informaltable frame="all">
25074 <tgroup cols="4" colsep="0" rowsep="0">
25075 <colspec colwidth="8*" align="left"/>
25076 <colspec colwidth="5*" align="center"/>
25077 <colspec colwidth="5*" align="center"/>
25078 <colspec colwidth="6*" align="right"/>
25079 <tbody>
25080 <row>
25081 <entry><option>rfc1413_query_timeout</option></entry>
25082 <entry>Use: <emphasis>main</emphasis></entry>
25083 <entry>Type: <emphasis>time</emphasis></entry>
25084 <entry>Default: <emphasis>5s</emphasis></entry>
25085 </row>
25086 </tbody>
25087 </tgroup>
25088 </informaltable>
25089 <para>
25090 <indexterm role="concept">
25091 <primary>RFC 1413</primary>
25092 <secondary>query timeout</secondary>
25093 </indexterm>
25094 <indexterm role="concept">
25095 <primary>timeout</primary>
25096 <secondary>for RFC 1413 call</secondary>
25097 </indexterm>
25098 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
25099 no RFC 1413 calls are ever made.
25100 </para>
25101 <para>
25102 <indexterm role="option">
25103 <primary><option>sender_unqualified_hosts</option></primary>
25104 </indexterm>
25105 </para>
25106 <informaltable frame="all">
25107 <tgroup cols="4" colsep="0" rowsep="0">
25108 <colspec colwidth="8*" align="left"/>
25109 <colspec colwidth="5*" align="center"/>
25110 <colspec colwidth="5*" align="center"/>
25111 <colspec colwidth="6*" align="right"/>
25112 <tbody>
25113 <row>
25114 <entry><option>sender_unqualified_hosts</option></entry>
25115 <entry>Use: <emphasis>main</emphasis></entry>
25116 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25117 <entry>Default: <emphasis>unset</emphasis></entry>
25118 </row>
25119 </tbody>
25120 </tgroup>
25121 </informaltable>
25122 <para>
25123 <indexterm role="concept">
25124 <primary>unqualified addresses</primary>
25125 </indexterm>
25126 <indexterm role="concept">
25127 <primary>host</primary>
25128 <secondary>unqualified addresses from</secondary>
25129 </indexterm>
25130 This option lists those hosts from which Exim is prepared to accept unqualified
25131 sender addresses. The addresses are made fully qualified by the addition of
25132 <option>qualify_domain</option>. This option also affects message header lines. Exim does
25133 not reject unqualified addresses in headers that contain sender addresses, but
25134 it qualifies them only if the message came from a host that matches
25135 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
25136 using TCP/IP), and the <option>-bnq</option> option was not set.
25137 </para>
25138 <para>
25139 <indexterm role="option">
25140 <primary><option>smtp_accept_keepalive</option></primary>
25141 </indexterm>
25142 </para>
25143 <informaltable frame="all">
25144 <tgroup cols="4" colsep="0" rowsep="0">
25145 <colspec colwidth="8*" align="left"/>
25146 <colspec colwidth="5*" align="center"/>
25147 <colspec colwidth="5*" align="center"/>
25148 <colspec colwidth="6*" align="right"/>
25149 <tbody>
25150 <row>
25151 <entry><option>smtp_accept_keepalive</option></entry>
25152 <entry>Use: <emphasis>main</emphasis></entry>
25153 <entry>Type: <emphasis>boolean</emphasis></entry>
25154 <entry>Default: <emphasis>true</emphasis></entry>
25155 </row>
25156 </tbody>
25157 </tgroup>
25158 </informaltable>
25159 <para>
25160 <indexterm role="concept">
25161 <primary>keepalive</primary>
25162 <secondary>on incoming connection</secondary>
25163 </indexterm>
25164 This option controls the setting of the SO_KEEPALIVE option on incoming
25165 TCP/IP socket connections. When set, it causes the kernel to probe idle
25166 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
25167 other end of the connection should send an acknowledgement if the connection is
25168 still okay or a reset if the connection has been aborted. The reason for doing
25169 this is that it has the beneficial effect of freeing up certain types of
25170 connection that can get stuck when the remote host is disconnected without
25171 tidying up the TCP/IP call properly. The keepalive mechanism takes several
25172 hours to detect unreachable hosts.
25173 </para>
25174 <para>
25175 <indexterm role="option">
25176 <primary><option>smtp_accept_max</option></primary>
25177 </indexterm>
25178 </para>
25179 <informaltable frame="all">
25180 <tgroup cols="4" colsep="0" rowsep="0">
25181 <colspec colwidth="8*" align="left"/>
25182 <colspec colwidth="5*" align="center"/>
25183 <colspec colwidth="5*" align="center"/>
25184 <colspec colwidth="6*" align="right"/>
25185 <tbody>
25186 <row>
25187 <entry><option>smtp_accept_max</option></entry>
25188 <entry>Use: <emphasis>main</emphasis></entry>
25189 <entry>Type: <emphasis>integer</emphasis></entry>
25190 <entry>Default: <emphasis>20</emphasis></entry>
25191 </row>
25192 </tbody>
25193 </tgroup>
25194 </informaltable>
25195 <para>
25196 <indexterm role="concept">
25197 <primary>limit</primary>
25198 <secondary>incoming SMTP connections</secondary>
25199 </indexterm>
25200 <indexterm role="concept">
25201 <primary>SMTP</primary>
25202 <secondary>incoming connection count</secondary>
25203 </indexterm>
25204 <indexterm role="concept">
25205 <primary>inetd</primary>
25206 </indexterm>
25207 This option specifies the maximum number of simultaneous incoming SMTP calls
25208 that Exim will accept. It applies only to the listening daemon; there is no
25209 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
25210 value is set to zero, no limit is applied. However, it is required to be
25211 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
25212 set. See also <option>smtp_accept_reserve</option>.
25213 </para>
25214 <para>
25215 <indexterm role="option">
25216 <primary><option>smtp_accept_max_nonmail</option></primary>
25217 </indexterm>
25218 </para>
25219 <informaltable frame="all">
25220 <tgroup cols="4" colsep="0" rowsep="0">
25221 <colspec colwidth="8*" align="left"/>
25222 <colspec colwidth="5*" align="center"/>
25223 <colspec colwidth="5*" align="center"/>
25224 <colspec colwidth="6*" align="right"/>
25225 <tbody>
25226 <row>
25227 <entry><option>smtp_accept_max_nonmail</option></entry>
25228 <entry>Use: <emphasis>main</emphasis></entry>
25229 <entry>Type: <emphasis>integer</emphasis></entry>
25230 <entry>Default: <emphasis>10</emphasis></entry>
25231 </row>
25232 </tbody>
25233 </tgroup>
25234 </informaltable>
25235 <para>
25236 <indexterm role="concept">
25237 <primary>limit</primary>
25238 <secondary>non-mail SMTP commands</secondary>
25239 </indexterm>
25240 <indexterm role="concept">
25241 <primary>SMTP</primary>
25242 <secondary>limiting non-mail commands</secondary>
25243 </indexterm>
25244 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25245 the connection if there are too many. This option defines <quote>too many</quote>. The
25246 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
25247 client looping sending EHLO, for example. The check is applied only if the
25248 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
25249 </para>
25250 <para>
25251 When a new message is expected, one occurrence of RSET is not counted. This
25252 allows a client to send one RSET between messages (this is not necessary,
25253 but some clients do it). Exim also allows one uncounted occurence of HELO
25254 or EHLO, and one occurrence of STARTTLS between messages. After
25255 starting up a TLS session, another EHLO is expected, and so it too is not
25256 counted. The first occurrence of AUTH in a connection, or immediately
25257 following STARTTLS is not counted. Otherwise, all commands other than
25258 MAIL, RCPT, DATA, and QUIT are counted.
25259 </para>
25260 <para>
25261 <indexterm role="option">
25262 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
25263 </indexterm>
25264 </para>
25265 <informaltable frame="all">
25266 <tgroup cols="4" colsep="0" rowsep="0">
25267 <colspec colwidth="8*" align="left"/>
25268 <colspec colwidth="5*" align="center"/>
25269 <colspec colwidth="5*" align="center"/>
25270 <colspec colwidth="6*" align="right"/>
25271 <tbody>
25272 <row>
25273 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
25274 <entry>Use: <emphasis>main</emphasis></entry>
25275 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25276 <entry>Default: <emphasis>*</emphasis></entry>
25277 </row>
25278 </tbody>
25279 </tgroup>
25280 </informaltable>
25281 <para>
25282 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
25283 check by setting this option. The default value makes it apply to all hosts. By
25284 changing the value, you can exclude any badly-behaved hosts that you have to
25285 live with.
25286 </para>
25287 <para>
25288 <indexterm role="option">
25289 <primary><option>smtp_accept_max_per_connection</option></primary>
25290 </indexterm>
25291 </para>
25292 <informaltable frame="all">
25293 <tgroup cols="4" colsep="0" rowsep="0">
25294 <colspec colwidth="8*" align="left"/>
25295 <colspec colwidth="5*" align="center"/>
25296 <colspec colwidth="5*" align="center"/>
25297 <colspec colwidth="6*" align="right"/>
25298 <tbody>
25299 <row>
25300 <entry><option>smtp_accept_max_per_connection</option></entry>
25301 <entry>Use: <emphasis>main</emphasis></entry>
25302 <entry>Type: <emphasis>integer</emphasis></entry>
25303 <entry>Default: <emphasis>1000</emphasis></entry>
25304 </row>
25305 </tbody>
25306 </tgroup>
25307 </informaltable>
25308 <para>
25309 <indexterm role="concept">
25310 <primary>SMTP incoming message count</primary>
25311 <secondary>limiting</secondary>
25312 </indexterm>
25313 <indexterm role="concept">
25314 <primary>limit</primary>
25315 <secondary>messages per SMTP connection</secondary>
25316 </indexterm>
25317 The value of this option limits the number of MAIL commands that Exim is
25318 prepared to accept over a single SMTP connection, whether or not each command
25319 results in the transfer of a message. After the limit is reached, a 421
25320 response is given to subsequent MAIL commands. This limit is a safety
25321 precaution against a client that goes mad (incidents of this type have been
25322 seen).
25323 </para>
25324 <para>
25325 <indexterm role="option">
25326 <primary><option>smtp_accept_max_per_host</option></primary>
25327 </indexterm>
25328 </para>
25329 <informaltable frame="all">
25330 <tgroup cols="4" colsep="0" rowsep="0">
25331 <colspec colwidth="8*" align="left"/>
25332 <colspec colwidth="5*" align="center"/>
25333 <colspec colwidth="5*" align="center"/>
25334 <colspec colwidth="6*" align="right"/>
25335 <tbody>
25336 <row>
25337 <entry><option>smtp_accept_max_per_host</option></entry>
25338 <entry>Use: <emphasis>main</emphasis></entry>
25339 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25340 <entry>Default: <emphasis>unset</emphasis></entry>
25341 </row>
25342 </tbody>
25343 </tgroup>
25344 </informaltable>
25345 <para>
25346 <indexterm role="concept">
25347 <primary>limit</primary>
25348 <secondary>SMTP connections from one host</secondary>
25349 </indexterm>
25350 <indexterm role="concept">
25351 <primary>host</primary>
25352 <secondary>limiting SMTP connections from</secondary>
25353 </indexterm>
25354 This option restricts the number of simultaneous IP connections from a single
25355 host (strictly, from a single IP address) to the Exim daemon. The option is
25356 expanded, to enable different limits to be applied to different hosts by
25357 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
25358 connection attempts from the same host are rejected with error code 421. The
25359 default value of zero imposes no limit. If this option is set, it is required
25360 that <option>smtp_accept_max</option> be non-zero.
25361 </para>
25362 <para>
25363 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
25364 constructions that take an appreciable amount of time. The expansion and test
25365 happen in the main daemon loop, in order to reject additional connections
25366 without forking additional processes (otherwise a denial-of-service attack
25367 could cause a vast number or processes to be created). While the daemon is
25368 doing this processing, it cannot accept any other incoming connections.
25369 </para>
25370 <para>
25371 <indexterm role="option">
25372 <primary><option>smtp_accept_queue</option></primary>
25373 </indexterm>
25374 </para>
25375 <informaltable frame="all">
25376 <tgroup cols="4" colsep="0" rowsep="0">
25377 <colspec colwidth="8*" align="left"/>
25378 <colspec colwidth="5*" align="center"/>
25379 <colspec colwidth="5*" align="center"/>
25380 <colspec colwidth="6*" align="right"/>
25381 <tbody>
25382 <row>
25383 <entry><option>smtp_accept_queue</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>integer</emphasis></entry>
25386 <entry>Default: <emphasis>0</emphasis></entry>
25387 </row>
25388 </tbody>
25389 </tgroup>
25390 </informaltable>
25391 <para>
25392 <indexterm role="concept">
25393 <primary>SMTP</primary>
25394 <secondary>incoming connection count</secondary>
25395 </indexterm>
25396 <indexterm role="concept">
25397 <primary>queueing incoming messages</primary>
25398 </indexterm>
25399 <indexterm role="concept">
25400 <primary>message</primary>
25401 <secondary>queueing by SMTP connection count</secondary>
25402 </indexterm>
25403 If the number of simultaneous incoming SMTP calls handled via the listening
25404 daemon exceeds this value, messages received by SMTP are just placed on the
25405 queue; no delivery processes are started automatically. A value of zero implies
25406 no limit, and clearly any non-zero value is useful only if it is less than the
25407 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
25408 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
25409 command line options.
25410 </para>
25411 <para>
25412 <indexterm role="option">
25413 <primary><option>smtp_accept_queue_per_connection</option></primary>
25414 </indexterm>
25415 </para>
25416 <informaltable frame="all">
25417 <tgroup cols="4" colsep="0" rowsep="0">
25418 <colspec colwidth="8*" align="left"/>
25419 <colspec colwidth="5*" align="center"/>
25420 <colspec colwidth="5*" align="center"/>
25421 <colspec colwidth="6*" align="right"/>
25422 <tbody>
25423 <row>
25424 <entry><option>smtp_accept_queue_per_connection</option></entry>
25425 <entry>Use: <emphasis>main</emphasis></entry>
25426 <entry>Type: <emphasis>integer</emphasis></entry>
25427 <entry>Default: <emphasis>10</emphasis></entry>
25428 </row>
25429 </tbody>
25430 </tgroup>
25431 </informaltable>
25432 <para>
25433 <indexterm role="concept">
25434 <primary>queueing incoming messages</primary>
25435 </indexterm>
25436 <indexterm role="concept">
25437 <primary>message</primary>
25438 <secondary>queueing by message count</secondary>
25439 </indexterm>
25440 This option limits the number of delivery processes that Exim starts
25441 automatically when receiving messages via SMTP, whether via the daemon or by
25442 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
25443 and the number of messages received in a single SMTP session exceeds this
25444 number, subsequent messages are placed on the queue, but no delivery processes
25445 are started. This helps to limit the number of Exim processes when a server
25446 restarts after downtime and there is a lot of mail waiting for it on other
25447 systems. On large systems, the default should probably be increased, and on
25448 dial-in client systems it should probably be set to zero (that is, disabled).
25449 </para>
25450 <para>
25451 <indexterm role="option">
25452 <primary><option>smtp_accept_reserve</option></primary>
25453 </indexterm>
25454 </para>
25455 <informaltable frame="all">
25456 <tgroup cols="4" colsep="0" rowsep="0">
25457 <colspec colwidth="8*" align="left"/>
25458 <colspec colwidth="5*" align="center"/>
25459 <colspec colwidth="5*" align="center"/>
25460 <colspec colwidth="6*" align="right"/>
25461 <tbody>
25462 <row>
25463 <entry><option>smtp_accept_reserve</option></entry>
25464 <entry>Use: <emphasis>main</emphasis></entry>
25465 <entry>Type: <emphasis>integer</emphasis></entry>
25466 <entry>Default: <emphasis>0</emphasis></entry>
25467 </row>
25468 </tbody>
25469 </tgroup>
25470 </informaltable>
25471 <para>
25472 <indexterm role="concept">
25473 <primary>SMTP</primary>
25474 <secondary>incoming call count</secondary>
25475 </indexterm>
25476 <indexterm role="concept">
25477 <primary>host</primary>
25478 <secondary>reserved</secondary>
25479 </indexterm>
25480 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
25481 number of SMTP connections that are reserved for connections from the hosts
25482 that are specified in <option>smtp_reserve_hosts</option>. The value set in
25483 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
25484 restricted to this number of connections; the option specifies a minimum number
25485 of connection slots for them, not a maximum. It is a guarantee that that group
25486 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
25487 </para>
25488 <para>
25489 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
25490 set to 5, once there are 45 active connections (from any hosts), new
25491 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>.
25492 See also <option>smtp_accept_max_per_host</option>.
25493 </para>
25494 <para>
25495 <indexterm role="option">
25496 <primary><option>smtp_active_hostname</option></primary>
25497 </indexterm>
25498 </para>
25499 <informaltable frame="all">
25500 <tgroup cols="4" colsep="0" rowsep="0">
25501 <colspec colwidth="8*" align="left"/>
25502 <colspec colwidth="5*" align="center"/>
25503 <colspec colwidth="5*" align="center"/>
25504 <colspec colwidth="6*" align="right"/>
25505 <tbody>
25506 <row>
25507 <entry><option>smtp_active_hostname</option></entry>
25508 <entry>Use: <emphasis>main</emphasis></entry>
25509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25510 <entry>Default: <emphasis>unset</emphasis></entry>
25511 </row>
25512 </tbody>
25513 </tgroup>
25514 </informaltable>
25515 <para revisionflag="changed">
25516 <indexterm role="concept">
25517 <primary>host</primary>
25518 <secondary>name in SMTP responses</secondary>
25519 </indexterm>
25520 <indexterm role="concept">
25521 <primary>SMTP</primary>
25522 <secondary>host name in responses</secondary>
25523 </indexterm>
25524 <indexterm role="concept">
25525 <primary><varname>$primary_hostname</varname></primary>
25526 </indexterm>
25527 This option is provided for multi-homed servers that want to masquerade as
25528 several different hosts. At the start of an incoming SMTP connection, its value
25529 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25530 responses. For example, it is used as domain name in the response to an
25531 incoming HELO or EHLO command.
25532 </para>
25533 <para revisionflag="changed">
25534 <indexterm role="concept">
25535 <primary><varname>$smtp_active_hostname</varname></primary>
25536 </indexterm>
25537 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
25538 is saved with any messages that are received. It is therefore available for use
25539 in routers and transports when the message is later delivered.
25540 </para>
25541 <para revisionflag="changed">
25542 If this option is unset, or if its expansion is forced to fail, or if the
25543 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25544 used. Other expansion failures cause a message to be written to the main and
25545 panic logs, and the SMTP command receives a temporary error. Typically, the
25546 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25547 For example:
25548 </para>
25549 <literallayout class="monospaced" revisionflag="changed">
25550 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
25551   {cox.mydomain}{box.mydomain}}
25552 </literallayout>
25553 <para revisionflag="changed">
25554 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
25555 messages, it is also used as the default for HELO commands in callout
25556 verification if there is no remote transport from which to obtain a
25557 <option>helo_data</option> value.
25558 </para>
25559 <para>
25560 <indexterm role="option">
25561 <primary><option>smtp_banner</option></primary>
25562 </indexterm>
25563 </para>
25564 <informaltable frame="all">
25565 <tgroup cols="4" colsep="0" rowsep="0">
25566 <colspec colwidth="8*" align="left"/>
25567 <colspec colwidth="5*" align="center"/>
25568 <colspec colwidth="5*" align="center"/>
25569 <colspec colwidth="6*" align="right"/>
25570 <tbody>
25571 <row>
25572 <entry><option>smtp_banner</option></entry>
25573 <entry>Use: <emphasis>main</emphasis></entry>
25574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25575 <entry>Default: <emphasis>see below</emphasis></entry>
25576 </row>
25577 </tbody>
25578 </tgroup>
25579 </informaltable>
25580 <para>
25581 <indexterm role="concept">
25582 <primary>SMTP</primary>
25583 <secondary>welcome banner</secondary>
25584 </indexterm>
25585 <indexterm role="concept">
25586 <primary>banner for SMTP</primary>
25587 </indexterm>
25588 <indexterm role="concept">
25589 <primary>welcome banner for SMTP</primary>
25590 </indexterm>
25591 <indexterm role="concept">
25592 <primary>customizing</primary>
25593 <secondary>SMTP banner</secondary>
25594 </indexterm>
25595 This string, which is expanded every time it is used, is output as the initial
25596 positive response to an SMTP connection. The default setting is:
25597 </para>
25598 <literallayout class="monospaced">
25599 smtp_banner = $smtp_active_hostname ESMTP Exim \
25600   $version_number $tod_full
25601 </literallayout>
25602 <para>
25603 Failure to expand the string causes a panic error. If you want to create a
25604 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
25605 appropriate points, but not at the end. Note that the 220 code is not included
25606 in this string. Exim adds it automatically (several times in the case of a
25607 multiline response).
25608 </para>
25609 <para>
25610 <indexterm role="option">
25611 <primary><option>smtp_check_spool_space</option></primary>
25612 </indexterm>
25613 </para>
25614 <informaltable frame="all">
25615 <tgroup cols="4" colsep="0" rowsep="0">
25616 <colspec colwidth="8*" align="left"/>
25617 <colspec colwidth="5*" align="center"/>
25618 <colspec colwidth="5*" align="center"/>
25619 <colspec colwidth="6*" align="right"/>
25620 <tbody>
25621 <row>
25622 <entry><option>smtp_check_spool_space</option></entry>
25623 <entry>Use: <emphasis>main</emphasis></entry>
25624 <entry>Type: <emphasis>boolean</emphasis></entry>
25625 <entry>Default: <emphasis>true</emphasis></entry>
25626 </row>
25627 </tbody>
25628 </tgroup>
25629 </informaltable>
25630 <para>
25631 <indexterm role="concept">
25632 <primary>checking disk space</primary>
25633 </indexterm>
25634 <indexterm role="concept">
25635 <primary>disk space</primary>
25636 <secondary>checking</secondary>
25637 </indexterm>
25638 <indexterm role="concept">
25639 <primary>spool directory</primary>
25640 <secondary>checking space</secondary>
25641 </indexterm>
25642 When this option is set, if an incoming SMTP session encounters the SIZE
25643 option on a MAIL command, it checks that there is enough space in the
25644 spool directory&#x2019;s partition to accept a message of that size, while still
25645 leaving free the amount specified by <option>check_spool_space</option> (even if that value
25646 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
25647 </para>
25648 <para>
25649 <indexterm role="option">
25650 <primary><option>smtp_connect_backlog</option></primary>
25651 </indexterm>
25652 </para>
25653 <informaltable frame="all">
25654 <tgroup cols="4" colsep="0" rowsep="0">
25655 <colspec colwidth="8*" align="left"/>
25656 <colspec colwidth="5*" align="center"/>
25657 <colspec colwidth="5*" align="center"/>
25658 <colspec colwidth="6*" align="right"/>
25659 <tbody>
25660 <row>
25661 <entry><option>smtp_connect_backlog</option></entry>
25662 <entry>Use: <emphasis>main</emphasis></entry>
25663 <entry>Type: <emphasis>integer</emphasis></entry>
25664 <entry>Default: <emphasis>20</emphasis></entry>
25665 </row>
25666 </tbody>
25667 </tgroup>
25668 </informaltable>
25669 <para>
25670 <indexterm role="concept">
25671 <primary>connection backlog</primary>
25672 </indexterm>
25673 <indexterm role="concept">
25674 <primary>SMTP</primary>
25675 <secondary>connection backlog</secondary>
25676 </indexterm>
25677 <indexterm role="concept">
25678 <primary>backlog of connections</primary>
25679 </indexterm>
25680 This option specifies a maximum number of waiting SMTP connections. Exim passes
25681 this value to the TCP/IP system when it sets up its listener. Once this number
25682 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
25683 attempts are refused at the TCP/IP level. At least, that is what the manuals
25684 say; in some circumstances such connection attempts have been observed to time
25685 out instead. For large systems it is probably a good idea to increase the
25686 value (to 50, say). It also gives some protection against denial-of-service
25687 attacks by SYN flooding.
25688 </para>
25689 <para>
25690 <indexterm role="option">
25691 <primary><option>smtp_enforce_sync</option></primary>
25692 </indexterm>
25693 </para>
25694 <informaltable frame="all">
25695 <tgroup cols="4" colsep="0" rowsep="0">
25696 <colspec colwidth="8*" align="left"/>
25697 <colspec colwidth="5*" align="center"/>
25698 <colspec colwidth="5*" align="center"/>
25699 <colspec colwidth="6*" align="right"/>
25700 <tbody>
25701 <row>
25702 <entry><option>smtp_enforce_sync</option></entry>
25703 <entry>Use: <emphasis>main</emphasis></entry>
25704 <entry>Type: <emphasis>boolean</emphasis></entry>
25705 <entry>Default: <emphasis>true</emphasis></entry>
25706 </row>
25707 </tbody>
25708 </tgroup>
25709 </informaltable>
25710 <para>
25711 <indexterm role="concept">
25712 <primary>SMTP</primary>
25713 <secondary>synchronization checking</secondary>
25714 </indexterm>
25715 <indexterm role="concept">
25716 <primary>synchronization checking in SMTP</primary>
25717 </indexterm>
25718 The SMTP protocol specification requires the client to wait for a response from
25719 the server at certain points in the dialogue. Without PIPELINING these
25720 synchronization points are after every command; with PIPELINING they are
25721 fewer, but they still exist.
25722 </para>
25723 <para>
25724 Some spamming sites send out a complete set of SMTP commands without waiting
25725 for any response. Exim protects against this by rejecting a message if the
25726 client has sent further input when it should not have. The error response <quote>554
25727 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
25728 for this error cannot be perfect because of transmission delays (unexpected
25729 input may be on its way but not yet received when Exim checks). However, it
25730 does detect many instances.
25731 </para>
25732 <para>
25733 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
25734 If you want to disable the check selectively (for example, only for certain
25735 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
25736 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
25737 </para>
25738 <para>
25739 <indexterm role="option">
25740 <primary><option>smtp_etrn_command</option></primary>
25741 </indexterm>
25742 </para>
25743 <informaltable frame="all">
25744 <tgroup cols="4" colsep="0" rowsep="0">
25745 <colspec colwidth="8*" align="left"/>
25746 <colspec colwidth="5*" align="center"/>
25747 <colspec colwidth="5*" align="center"/>
25748 <colspec colwidth="6*" align="right"/>
25749 <tbody>
25750 <row>
25751 <entry><option>smtp_etrn_command</option></entry>
25752 <entry>Use: <emphasis>main</emphasis></entry>
25753 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25754 <entry>Default: <emphasis>unset</emphasis></entry>
25755 </row>
25756 </tbody>
25757 </tgroup>
25758 </informaltable>
25759 <para>
25760 <indexterm role="concept">
25761 <primary>ETRN</primary>
25762 <secondary>command to be run</secondary>
25763 </indexterm>
25764 <indexterm role="concept">
25765 <primary><varname>$domain</varname></primary>
25766 </indexterm>
25767 If this option is set, the given command is run whenever an SMTP ETRN
25768 command is received from a host that is permitted to issue such commands (see
25769 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
25770 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
25771 argument of the ETRN command, and no syntax checking is done on it. For
25772 example:
25773 </para>
25774 <literallayout class="monospaced">
25775 smtp_etrn_command = /etc/etrn_command $domain \
25776                     $sender_host_address
25777 </literallayout>
25778 <para>
25779 A new process is created to run the command, but Exim does not wait for it to
25780 complete. Consequently, its status cannot be checked. If the command cannot be
25781 run, a line is written to the panic log, but the ETRN caller still receives
25782 a 250 success response. Exim is normally running under its own uid when
25783 receiving SMTP, so it is not possible for it to change the uid before running
25784 the command.
25785 </para>
25786 <para>
25787 <indexterm role="option">
25788 <primary><option>smtp_etrn_serialize</option></primary>
25789 </indexterm>
25790 </para>
25791 <informaltable frame="all">
25792 <tgroup cols="4" colsep="0" rowsep="0">
25793 <colspec colwidth="8*" align="left"/>
25794 <colspec colwidth="5*" align="center"/>
25795 <colspec colwidth="5*" align="center"/>
25796 <colspec colwidth="6*" align="right"/>
25797 <tbody>
25798 <row>
25799 <entry><option>smtp_etrn_serialize</option></entry>
25800 <entry>Use: <emphasis>main</emphasis></entry>
25801 <entry>Type: <emphasis>boolean</emphasis></entry>
25802 <entry>Default: <emphasis>true</emphasis></entry>
25803 </row>
25804 </tbody>
25805 </tgroup>
25806 </informaltable>
25807 <para>
25808 <indexterm role="concept">
25809 <primary>ETRN</primary>
25810 <secondary>serializing</secondary>
25811 </indexterm>
25812 When this option is set, it prevents the simultaneous execution of more than
25813 one identical command as a result of ETRN in an SMTP connection. See
25814 section <xref linkend="SECTETRN"/> for details.
25815 </para>
25816 <para>
25817 <indexterm role="option">
25818 <primary><option>smtp_load_reserve</option></primary>
25819 </indexterm>
25820 </para>
25821 <informaltable frame="all">
25822 <tgroup cols="4" colsep="0" rowsep="0">
25823 <colspec colwidth="8*" align="left"/>
25824 <colspec colwidth="5*" align="center"/>
25825 <colspec colwidth="5*" align="center"/>
25826 <colspec colwidth="6*" align="right"/>
25827 <tbody>
25828 <row>
25829 <entry><option>smtp_load_reserve</option></entry>
25830 <entry>Use: <emphasis>main</emphasis></entry>
25831 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25832 <entry>Default: <emphasis>unset</emphasis></entry>
25833 </row>
25834 </tbody>
25835 </tgroup>
25836 </informaltable>
25837 <para>
25838 <indexterm role="concept">
25839 <primary>load average</primary>
25840 </indexterm>
25841 If the system load average ever gets higher than this, incoming SMTP calls are
25842 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
25843 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
25844 the load is over the limit. The option has no effect on ancient operating
25845 systems on which Exim cannot determine the load average. See also
25846 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
25847 </para>
25848 <para>
25849 <indexterm role="option">
25850 <primary><option>smtp_max_synprot_errors</option></primary>
25851 </indexterm>
25852 </para>
25853 <informaltable frame="all">
25854 <tgroup cols="4" colsep="0" rowsep="0">
25855 <colspec colwidth="8*" align="left"/>
25856 <colspec colwidth="5*" align="center"/>
25857 <colspec colwidth="5*" align="center"/>
25858 <colspec colwidth="6*" align="right"/>
25859 <tbody>
25860 <row>
25861 <entry><option>smtp_max_synprot_errors</option></entry>
25862 <entry>Use: <emphasis>main</emphasis></entry>
25863 <entry>Type: <emphasis>integer</emphasis></entry>
25864 <entry>Default: <emphasis>3</emphasis></entry>
25865 </row>
25866 </tbody>
25867 </tgroup>
25868 </informaltable>
25869 <para>
25870 <indexterm role="concept">
25871 <primary>SMTP</primary>
25872 <secondary>limiting syntax and protocol errors</secondary>
25873 </indexterm>
25874 <indexterm role="concept">
25875 <primary>limit</primary>
25876 <secondary>SMTP syntax and protocol errors</secondary>
25877 </indexterm>
25878 Exim rejects SMTP commands that contain syntax or protocol errors. In
25879 particular, a syntactically invalid email address, as in this command:
25880 </para>
25881 <literallayout class="monospaced">
25882 RCPT TO:&lt;abc xyz@a.b.c&gt;
25883 </literallayout>
25884 <para>
25885 causes immediate rejection of the command, before any other tests are done.
25886 (The ACL cannot be run if there is no valid address to set up for it.) An
25887 example of a protocol error is receiving RCPT before MAIL. If there are
25888 too many syntax or protocol errors in one SMTP session, the connection is
25889 dropped. The limit is set by this option.
25890 </para>
25891 <para>
25892 <indexterm role="concept">
25893 <primary>PIPELINING</primary>
25894 <secondary>expected errors</secondary>
25895 </indexterm>
25896 When the PIPELINING extension to SMTP is in use, some protocol errors are
25897 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
25898 Exim assumes that PIPELINING will be used if it advertises it (see
25899 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
25900 not count towards the limit.
25901 </para>
25902 <para>
25903 <indexterm role="option">
25904 <primary><option>smtp_max_unknown_commands</option></primary>
25905 </indexterm>
25906 </para>
25907 <informaltable frame="all">
25908 <tgroup cols="4" colsep="0" rowsep="0">
25909 <colspec colwidth="8*" align="left"/>
25910 <colspec colwidth="5*" align="center"/>
25911 <colspec colwidth="5*" align="center"/>
25912 <colspec colwidth="6*" align="right"/>
25913 <tbody>
25914 <row>
25915 <entry><option>smtp_max_unknown_commands</option></entry>
25916 <entry>Use: <emphasis>main</emphasis></entry>
25917 <entry>Type: <emphasis>integer</emphasis></entry>
25918 <entry>Default: <emphasis>3</emphasis></entry>
25919 </row>
25920 </tbody>
25921 </tgroup>
25922 </informaltable>
25923 <para>
25924 <indexterm role="concept">
25925 <primary>SMTP</primary>
25926 <secondary>limiting unknown commands</secondary>
25927 </indexterm>
25928 <indexterm role="concept">
25929 <primary>limit</primary>
25930 <secondary>unknown SMTP commands</secondary>
25931 </indexterm>
25932 If there are too many unrecognized commands in an incoming SMTP session, an
25933 Exim server drops the connection. This is a defence against some kinds of abuse
25934 that subvert web
25935 clients
25936 into making connections to SMTP ports; in these circumstances, a number of
25937 non-SMTP command lines are sent first.
25938 </para>
25939 <para>
25940 <indexterm role="option">
25941 <primary><option>smtp_ratelimit_hosts</option></primary>
25942 </indexterm>
25943 </para>
25944 <informaltable frame="all">
25945 <tgroup cols="4" colsep="0" rowsep="0">
25946 <colspec colwidth="8*" align="left"/>
25947 <colspec colwidth="5*" align="center"/>
25948 <colspec colwidth="5*" align="center"/>
25949 <colspec colwidth="6*" align="right"/>
25950 <tbody>
25951 <row>
25952 <entry><option>smtp_ratelimit_hosts</option></entry>
25953 <entry>Use: <emphasis>main</emphasis></entry>
25954 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25955 <entry>Default: <emphasis>unset</emphasis></entry>
25956 </row>
25957 </tbody>
25958 </tgroup>
25959 </informaltable>
25960 <para>
25961 <indexterm role="concept">
25962 <primary>SMTP</primary>
25963 <secondary>rate limiting</secondary>
25964 </indexterm>
25965 <indexterm role="concept">
25966 <primary>limit</primary>
25967 <secondary>rate of message arrival</secondary>
25968 </indexterm>
25969 <indexterm role="concept">
25970 <primary>RCPT</primary>
25971 <secondary>rate limiting</secondary>
25972 </indexterm>
25973 Some sites find it helpful to be able to limit the rate at which certain hosts
25974 can send them messages, and the rate at which an individual message can specify
25975 recipients.
25976 </para>
25977 <para>
25978 Exim has two rate-limiting facilities. This section describes the older
25979 facility, which can limit rates within a single connection. The newer
25980 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
25981 <xref linkend="SECTratelimiting"/> for details of the newer facility.
25982 </para>
25983 <para>
25984 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
25985 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
25986 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
25987 respectively. Each option, if set, must contain a set of four comma-separated
25988 values:
25989 </para>
25990 <itemizedlist>
25991 <listitem>
25992 <para>
25993 A threshold, before which there is no rate limiting.
25994 </para>
25995 </listitem>
25996 <listitem>
25997 <para>
25998 An initial time delay. Unlike other times in Exim, numbers with decimal
25999 fractional parts are allowed here.
26000 </para>
26001 </listitem>
26002 <listitem>
26003 <para>
26004 A factor by which to increase the delay each time.
26005 </para>
26006 </listitem>
26007 <listitem>
26008 <para>
26009 A maximum value for the delay. This should normally be less than 5 minutes,
26010 because after that time, the client is liable to timeout the SMTP command.
26011 </para>
26012 </listitem>
26013 </itemizedlist>
26014 <para>
26015 For example, these settings have been used successfully at the site which
26016 first suggested this feature, for controlling mail from their customers:
26017 </para>
26018 <literallayout class="monospaced">
26019 smtp_ratelimit_mail = 2,0.5s,1.05,4m
26020 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
26021 </literallayout>
26022 <para>
26023 The first setting specifies delays that are applied to MAIL commands after
26024 two have been received over a single connection. The initial delay is 0.5
26025 seconds, increasing by a factor of 1.05 each time. The second setting applies
26026 delays to RCPT commands when more than four occur in a single message.
26027 </para>
26028 <para>
26029 <indexterm role="option">
26030 <primary><option>smtp_ratelimit_mail</option></primary>
26031 </indexterm>
26032 </para>
26033 <informaltable frame="all">
26034 <tgroup cols="4" colsep="0" rowsep="0">
26035 <colspec colwidth="8*" align="left"/>
26036 <colspec colwidth="5*" align="center"/>
26037 <colspec colwidth="5*" align="center"/>
26038 <colspec colwidth="6*" align="right"/>
26039 <tbody>
26040 <row>
26041 <entry><option>smtp_ratelimit_mail</option></entry>
26042 <entry>Use: <emphasis>main</emphasis></entry>
26043 <entry>Type: <emphasis>string</emphasis></entry>
26044 <entry>Default: <emphasis>unset</emphasis></entry>
26045 </row>
26046 </tbody>
26047 </tgroup>
26048 </informaltable>
26049 <para>
26050 See <option>smtp_ratelimit_hosts</option> above.
26051 </para>
26052 <para>
26053 <indexterm role="option">
26054 <primary><option>smtp_ratelimit_rcpt</option></primary>
26055 </indexterm>
26056 </para>
26057 <informaltable frame="all">
26058 <tgroup cols="4" colsep="0" rowsep="0">
26059 <colspec colwidth="8*" align="left"/>
26060 <colspec colwidth="5*" align="center"/>
26061 <colspec colwidth="5*" align="center"/>
26062 <colspec colwidth="6*" align="right"/>
26063 <tbody>
26064 <row>
26065 <entry><option>smtp_ratelimit_rcpt</option></entry>
26066 <entry>Use: <emphasis>main</emphasis></entry>
26067 <entry>Type: <emphasis>string</emphasis></entry>
26068 <entry>Default: <emphasis>unset</emphasis></entry>
26069 </row>
26070 </tbody>
26071 </tgroup>
26072 </informaltable>
26073 <para>
26074 See <option>smtp_ratelimit_hosts</option> above.
26075 </para>
26076 <para>
26077 <indexterm role="option">
26078 <primary><option>smtp_receive_timeout</option></primary>
26079 </indexterm>
26080 </para>
26081 <informaltable frame="all">
26082 <tgroup cols="4" colsep="0" rowsep="0">
26083 <colspec colwidth="8*" align="left"/>
26084 <colspec colwidth="5*" align="center"/>
26085 <colspec colwidth="5*" align="center"/>
26086 <colspec colwidth="6*" align="right"/>
26087 <tbody>
26088 <row>
26089 <entry><option>smtp_receive_timeout</option></entry>
26090 <entry>Use: <emphasis>main</emphasis></entry>
26091 <entry>Type: <emphasis>time</emphasis></entry>
26092 <entry>Default: <emphasis>5m</emphasis></entry>
26093 </row>
26094 </tbody>
26095 </tgroup>
26096 </informaltable>
26097 <para>
26098 <indexterm role="concept">
26099 <primary>timeout</primary>
26100 <secondary>for SMTP input</secondary>
26101 </indexterm>
26102 <indexterm role="concept">
26103 <primary>SMTP timeout</primary>
26104 <secondary>input</secondary>
26105 </indexterm>
26106 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
26107 input, including batch SMTP. If a line of input (either an SMTP command or a
26108 data line) is not received within this time, the SMTP connection is dropped and
26109 the message is abandoned.
26110 A line is written to the log containing one of the following messages:
26111 </para>
26112 <literallayout class="monospaced">
26113 SMTP command timeout on connection from...
26114 SMTP data timeout on connection from...
26115 </literallayout>
26116 <para>
26117 The former means that Exim was expecting to read an SMTP command; the latter
26118 means that it was in the DATA phase, reading the contents of a message.
26119 </para>
26120 <para>
26121 <indexterm role="concept">
26122 <primary><option>-os</option> option</primary>
26123 </indexterm>
26124 The value set by this option can be overridden by the
26125 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
26126 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
26127 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
26128 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
26129 </para>
26130 <para>
26131 <indexterm role="option">
26132 <primary><option>smtp_reserve_hosts</option></primary>
26133 </indexterm>
26134 </para>
26135 <informaltable frame="all">
26136 <tgroup cols="4" colsep="0" rowsep="0">
26137 <colspec colwidth="8*" align="left"/>
26138 <colspec colwidth="5*" align="center"/>
26139 <colspec colwidth="5*" align="center"/>
26140 <colspec colwidth="6*" align="right"/>
26141 <tbody>
26142 <row>
26143 <entry><option>smtp_reserve_hosts</option></entry>
26144 <entry>Use: <emphasis>main</emphasis></entry>
26145 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26146 <entry>Default: <emphasis>unset</emphasis></entry>
26147 </row>
26148 </tbody>
26149 </tgroup>
26150 </informaltable>
26151 <para>
26152 This option defines hosts for which SMTP connections are reserved; see
26153 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
26154 </para>
26155 <para>
26156 <indexterm role="option">
26157 <primary><option>smtp_return_error_details</option></primary>
26158 </indexterm>
26159 </para>
26160 <informaltable frame="all">
26161 <tgroup cols="4" colsep="0" rowsep="0">
26162 <colspec colwidth="8*" align="left"/>
26163 <colspec colwidth="5*" align="center"/>
26164 <colspec colwidth="5*" align="center"/>
26165 <colspec colwidth="6*" align="right"/>
26166 <tbody>
26167 <row>
26168 <entry><option>smtp_return_error_details</option></entry>
26169 <entry>Use: <emphasis>main</emphasis></entry>
26170 <entry>Type: <emphasis>boolean</emphasis></entry>
26171 <entry>Default: <emphasis>false</emphasis></entry>
26172 </row>
26173 </tbody>
26174 </tgroup>
26175 </informaltable>
26176 <para>
26177 <indexterm role="concept">
26178 <primary>SMTP</primary>
26179 <secondary>details policy failures</secondary>
26180 </indexterm>
26181 <indexterm role="concept">
26182 <primary>policy control rejection</primary>
26183 <secondary>returning details</secondary>
26184 </indexterm>
26185 In the default state, Exim uses bland messages such as
26186 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
26187 reasons. Many sysadmins like this because it gives away little information
26188 to spammers. However, some other syadmins who are applying strict checking
26189 policies want to give out much fuller information about failures. Setting
26190 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
26191 example, instead of <quote>Administrative prohibition</quote>, it might give:
26192 </para>
26193 <literallayout class="monospaced">
26194 550-Rejected after DATA: '&gt;' missing at end of address:
26195 550 failing address in "From" header is: &lt;user@dom.ain
26196 </literallayout>
26197 <para>
26198 <indexterm role="option">
26199 <primary><option>spamd_address</option></primary>
26200 </indexterm>
26201 </para>
26202 <informaltable frame="all">
26203 <tgroup cols="4" colsep="0" rowsep="0">
26204 <colspec colwidth="8*" align="left"/>
26205 <colspec colwidth="5*" align="center"/>
26206 <colspec colwidth="5*" align="center"/>
26207 <colspec colwidth="6*" align="right"/>
26208 <tbody>
26209 <row>
26210 <entry><option>spamd_address</option></entry>
26211 <entry>Use: <emphasis>main</emphasis></entry>
26212 <entry>Type: <emphasis>string</emphasis></entry>
26213 <entry>Default: <emphasis>see below</emphasis></entry>
26214 </row>
26215 </tbody>
26216 </tgroup>
26217 </informaltable>
26218 <para>
26219 This option is available when Exim is compiled with the content-scanning
26220 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
26221 The default value is
26222 </para>
26223 <literallayout class="monospaced">
26224 127.0.0.1 783
26225 </literallayout>
26226 <para>
26227 See section <xref linkend="SECTscanspamass"/> for more details.
26228 </para>
26229 <para>
26230 <indexterm role="option">
26231 <primary><option>split_spool_directory</option></primary>
26232 </indexterm>
26233 </para>
26234 <informaltable frame="all">
26235 <tgroup cols="4" colsep="0" rowsep="0">
26236 <colspec colwidth="8*" align="left"/>
26237 <colspec colwidth="5*" align="center"/>
26238 <colspec colwidth="5*" align="center"/>
26239 <colspec colwidth="6*" align="right"/>
26240 <tbody>
26241 <row>
26242 <entry><option>split_spool_directory</option></entry>
26243 <entry>Use: <emphasis>main</emphasis></entry>
26244 <entry>Type: <emphasis>boolean</emphasis></entry>
26245 <entry>Default: <emphasis>false</emphasis></entry>
26246 </row>
26247 </tbody>
26248 </tgroup>
26249 </informaltable>
26250 <para>
26251 <indexterm role="concept">
26252 <primary>multiple spool directories</primary>
26253 </indexterm>
26254 <indexterm role="concept">
26255 <primary>spool directory</primary>
26256 <secondary>split</secondary>
26257 </indexterm>
26258 <indexterm role="concept">
26259 <primary>directories</primary>
26260 <secondary>multiple</secondary>
26261 </indexterm>
26262 If this option is set, it causes Exim to split its input directory into 62
26263 subdirectories, each with a single alphanumeric character as its name. The
26264 sixth character of the message id is used to allocate messages to
26265 subdirectories; this is the least significant base-62 digit of the time of
26266 arrival of the message.
26267 </para>
26268 <para>
26269 Splitting up the spool in this way may provide better performance on systems
26270 where there are long mail queues, by reducing the number of files in any one
26271 directory. The msglog directory is also split up in a similar way to the input
26272 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
26273 are still placed in the single directory <filename>msglog.OLD</filename>.
26274 </para>
26275 <para>
26276 It is not necessary to take any special action for existing messages when
26277 changing <option>split_spool_directory</option>. Exim notices messages that are in the
26278 <quote>wrong</quote> place, and continues to process them. If the option is turned off
26279 after a period of being on, the subdirectories will eventually empty and be
26280 automatically deleted.
26281 </para>
26282 <para>
26283 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
26284 changes. Instead of creating a list of all messages in the queue, and then
26285 trying to deliver each one in turn, it constructs a list of those in one
26286 sub-directory and tries to deliver them, before moving on to the next
26287 sub-directory. The sub-directories are processed in a random order. This
26288 spreads out the scanning of the input directories, and uses less memory. It is
26289 particularly beneficial when there are lots of messages on the queue. However,
26290 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
26291 entire queue has to be scanned and sorted before any deliveries can start.
26292 </para>
26293 <para>
26294 <indexterm role="option">
26295 <primary><option>spool_directory</option></primary>
26296 </indexterm>
26297 </para>
26298 <informaltable frame="all">
26299 <tgroup cols="4" colsep="0" rowsep="0">
26300 <colspec colwidth="8*" align="left"/>
26301 <colspec colwidth="5*" align="center"/>
26302 <colspec colwidth="5*" align="center"/>
26303 <colspec colwidth="6*" align="right"/>
26304 <tbody>
26305 <row>
26306 <entry><option>spool_directory</option></entry>
26307 <entry>Use: <emphasis>main</emphasis></entry>
26308 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26309 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26310 </row>
26311 </tbody>
26312 </tgroup>
26313 </informaltable>
26314 <para>
26315 <indexterm role="concept">
26316 <primary>spool directory</primary>
26317 <secondary>path to</secondary>
26318 </indexterm>
26319 This defines the directory in which Exim keeps its spool, that is, the messages
26320 it is waiting to deliver. The default value is taken from the compile-time
26321 configuration setting, if there is one. If not, this option must be set. The
26322 string is expanded, so it can contain, for example, a reference to
26323 <varname>$primary_hostname</varname>.
26324 </para>
26325 <para>
26326 If the spool directory name is fixed on your installation, it is recommended
26327 that you set it at build time rather than from this option, particularly if the
26328 log files are being written to the spool directory (see <option>log_file_path</option>).
26329 Otherwise log files cannot be used for errors that are detected early on, such
26330 as failures in the configuration file.
26331 </para>
26332 <para>
26333 By using this option to override the compiled-in path, it is possible to run
26334 tests of Exim without using the standard spool.
26335 </para>
26336 <para>
26337 <indexterm role="option">
26338 <primary><option>sqlite_lock_timeout</option></primary>
26339 </indexterm>
26340 </para>
26341 <informaltable frame="all">
26342 <tgroup cols="4" colsep="0" rowsep="0">
26343 <colspec colwidth="8*" align="left"/>
26344 <colspec colwidth="5*" align="center"/>
26345 <colspec colwidth="5*" align="center"/>
26346 <colspec colwidth="6*" align="right"/>
26347 <tbody>
26348 <row>
26349 <entry><option>sqlite_lock_timeout</option></entry>
26350 <entry>Use: <emphasis>main</emphasis></entry>
26351 <entry>Type: <emphasis>time</emphasis></entry>
26352 <entry>Default: <emphasis>5s</emphasis></entry>
26353 </row>
26354 </tbody>
26355 </tgroup>
26356 </informaltable>
26357 <para>
26358 <indexterm role="concept">
26359 <primary>sqlite</primary>
26360 <secondary>lock timeout</secondary>
26361 </indexterm>
26362 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
26363 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
26364 </para>
26365 <para revisionflag="changed">
26366 <indexterm role="option">
26367 <primary><option>strict_acl_vars</option></primary>
26368 </indexterm>
26369 </para>
26370 <informaltable frame="all" revisionflag="changed">
26371 <tgroup cols="4" colsep="0" rowsep="0">
26372 <colspec colwidth="8*" align="left"/>
26373 <colspec colwidth="5*" align="center"/>
26374 <colspec colwidth="5*" align="center"/>
26375 <colspec colwidth="6*" align="right"/>
26376 <tbody>
26377 <row>
26378 <entry><option>strict_acl_vars</option></entry>
26379 <entry>Use: <emphasis>main</emphasis></entry>
26380 <entry>Type: <emphasis>boolean</emphasis></entry>
26381 <entry>Default: <emphasis>false</emphasis></entry>
26382 </row>
26383 </tbody>
26384 </tgroup>
26385 </informaltable>
26386 <para revisionflag="changed">
26387 <indexterm role="concept">
26388 <primary>ACL variables</primary>
26389 <secondary>handling unset</secondary>
26390 </indexterm>
26391 This option controls what happens if a syntactically valid but undefined ACL
26392 variable is referenced. If it is false (the default), an empty string
26393 is substituted; if it is true, an error is generated. See section
26394 <xref linkend="SECTaclvariables"/> for details of ACL variables.
26395 </para>
26396 <para>
26397 <indexterm role="option">
26398 <primary><option>strip_excess_angle_brackets</option></primary>
26399 </indexterm>
26400 </para>
26401 <informaltable frame="all">
26402 <tgroup cols="4" colsep="0" rowsep="0">
26403 <colspec colwidth="8*" align="left"/>
26404 <colspec colwidth="5*" align="center"/>
26405 <colspec colwidth="5*" align="center"/>
26406 <colspec colwidth="6*" align="right"/>
26407 <tbody>
26408 <row>
26409 <entry><option>strip_excess_angle_brackets</option></entry>
26410 <entry>Use: <emphasis>main</emphasis></entry>
26411 <entry>Type: <emphasis>boolean</emphasis></entry>
26412 <entry>Default: <emphasis>false</emphasis></entry>
26413 </row>
26414 </tbody>
26415 </tgroup>
26416 </informaltable>
26417 <para>
26418 <indexterm role="concept">
26419 <primary>angle brackets</primary>
26420 <secondary>excess</secondary>
26421 </indexterm>
26422 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
26423 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
26424 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
26425 passed on to another MTA, the excess angle brackets are not passed on. If this
26426 option is not set, multiple pairs of angle brackets cause a syntax error.
26427 </para>
26428 <para>
26429 <indexterm role="option">
26430 <primary><option>strip_trailing_dot</option></primary>
26431 </indexterm>
26432 </para>
26433 <informaltable frame="all">
26434 <tgroup cols="4" colsep="0" rowsep="0">
26435 <colspec colwidth="8*" align="left"/>
26436 <colspec colwidth="5*" align="center"/>
26437 <colspec colwidth="5*" align="center"/>
26438 <colspec colwidth="6*" align="right"/>
26439 <tbody>
26440 <row>
26441 <entry><option>strip_trailing_dot</option></entry>
26442 <entry>Use: <emphasis>main</emphasis></entry>
26443 <entry>Type: <emphasis>boolean</emphasis></entry>
26444 <entry>Default: <emphasis>false</emphasis></entry>
26445 </row>
26446 </tbody>
26447 </tgroup>
26448 </informaltable>
26449 <para>
26450 <indexterm role="concept">
26451 <primary>trailing dot on domain</primary>
26452 </indexterm>
26453 <indexterm role="concept">
26454 <primary>dot</primary>
26455 <secondary>trailing on domain</secondary>
26456 </indexterm>
26457 If this option is set, a trailing dot at the end of a domain in an address is
26458 ignored. If this is in the envelope and the message is passed on to another
26459 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
26460 domain causes a syntax error.
26461 However, addresses in header lines are checked only when an ACL requests header
26462 syntax checking.
26463 </para>
26464 <para>
26465 <indexterm role="option">
26466 <primary><option>syslog_duplication</option></primary>
26467 </indexterm>
26468 </para>
26469 <informaltable frame="all">
26470 <tgroup cols="4" colsep="0" rowsep="0">
26471 <colspec colwidth="8*" align="left"/>
26472 <colspec colwidth="5*" align="center"/>
26473 <colspec colwidth="5*" align="center"/>
26474 <colspec colwidth="6*" align="right"/>
26475 <tbody>
26476 <row>
26477 <entry><option>syslog_duplication</option></entry>
26478 <entry>Use: <emphasis>main</emphasis></entry>
26479 <entry>Type: <emphasis>boolean</emphasis></entry>
26480 <entry>Default: <emphasis>true</emphasis></entry>
26481 </row>
26482 </tbody>
26483 </tgroup>
26484 </informaltable>
26485 <para>
26486 <indexterm role="concept">
26487 <primary>syslog</primary>
26488 <secondary>duplicate log lines; suppressing</secondary>
26489 </indexterm>
26490 When Exim is logging to syslog, it writes the log lines for its three
26491 separate logs at different syslog priorities so that they can in principle
26492 be separated on the logging hosts. Some installations do not require this
26493 separation, and in those cases, the duplication of certain log lines is a
26494 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
26495 particular log line is written to syslog. For lines that normally go to
26496 both the main log and the reject log, the reject log version (possibly
26497 containing message header lines) is written, at LOG_NOTICE priority.
26498 Lines that normally go to both the main and the panic log are written at
26499 the LOG_ALERT priority.
26500 </para>
26501 <para>
26502 <indexterm role="option">
26503 <primary><option>syslog_facility</option></primary>
26504 </indexterm>
26505 </para>
26506 <informaltable frame="all">
26507 <tgroup cols="4" colsep="0" rowsep="0">
26508 <colspec colwidth="8*" align="left"/>
26509 <colspec colwidth="5*" align="center"/>
26510 <colspec colwidth="5*" align="center"/>
26511 <colspec colwidth="6*" align="right"/>
26512 <tbody>
26513 <row>
26514 <entry><option>syslog_facility</option></entry>
26515 <entry>Use: <emphasis>main</emphasis></entry>
26516 <entry>Type: <emphasis>string</emphasis></entry>
26517 <entry>Default: <emphasis>unset</emphasis></entry>
26518 </row>
26519 </tbody>
26520 </tgroup>
26521 </informaltable>
26522 <para>
26523 <indexterm role="concept">
26524 <primary>syslog</primary>
26525 <secondary>facility; setting</secondary>
26526 </indexterm>
26527 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
26528 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
26529 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
26530 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
26531 details of Exim&#x2019;s logging.
26532 </para>
26533 <para>
26534 <indexterm role="option">
26535 <primary><option>syslog_processname</option></primary>
26536 </indexterm>
26537 </para>
26538 <informaltable frame="all">
26539 <tgroup cols="4" colsep="0" rowsep="0">
26540 <colspec colwidth="8*" align="left"/>
26541 <colspec colwidth="5*" align="center"/>
26542 <colspec colwidth="5*" align="center"/>
26543 <colspec colwidth="6*" align="right"/>
26544 <tbody>
26545 <row>
26546 <entry><option>syslog_processname</option></entry>
26547 <entry>Use: <emphasis>main</emphasis></entry>
26548 <entry>Type: <emphasis>string</emphasis></entry>
26549 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26550 </row>
26551 </tbody>
26552 </tgroup>
26553 </informaltable>
26554 <para>
26555 <indexterm role="concept">
26556 <primary>syslog</primary>
26557 <secondary>process name; setting</secondary>
26558 </indexterm>
26559 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26560 syslog. The value must be no longer than 32 characters. See chapter
26561 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
26562 </para>
26563 <para>
26564 <indexterm role="option">
26565 <primary><option>syslog_timestamp</option></primary>
26566 </indexterm>
26567 </para>
26568 <informaltable frame="all">
26569 <tgroup cols="4" colsep="0" rowsep="0">
26570 <colspec colwidth="8*" align="left"/>
26571 <colspec colwidth="5*" align="center"/>
26572 <colspec colwidth="5*" align="center"/>
26573 <colspec colwidth="6*" align="right"/>
26574 <tbody>
26575 <row>
26576 <entry><option>syslog_timestamp</option></entry>
26577 <entry>Use: <emphasis>main</emphasis></entry>
26578 <entry>Type: <emphasis>boolean</emphasis></entry>
26579 <entry>Default: <emphasis>true</emphasis></entry>
26580 </row>
26581 </tbody>
26582 </tgroup>
26583 </informaltable>
26584 <para>
26585 <indexterm role="concept">
26586 <primary>syslog</primary>
26587 <secondary>timestamps</secondary>
26588 </indexterm>
26589 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
26590 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
26591 details of Exim&#x2019;s logging.
26592 </para>
26593 <para>
26594 <indexterm role="option">
26595 <primary><option>system_filter</option></primary>
26596 </indexterm>
26597 </para>
26598 <informaltable frame="all">
26599 <tgroup cols="4" colsep="0" rowsep="0">
26600 <colspec colwidth="8*" align="left"/>
26601 <colspec colwidth="5*" align="center"/>
26602 <colspec colwidth="5*" align="center"/>
26603 <colspec colwidth="6*" align="right"/>
26604 <tbody>
26605 <row>
26606 <entry><option>system_filter</option></entry>
26607 <entry>Use: <emphasis>main</emphasis></entry>
26608 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26609 <entry>Default: <emphasis>unset</emphasis></entry>
26610 </row>
26611 </tbody>
26612 </tgroup>
26613 </informaltable>
26614 <para>
26615 <indexterm role="concept">
26616 <primary>filter</primary>
26617 <secondary>system filter</secondary>
26618 </indexterm>
26619 <indexterm role="concept">
26620 <primary>system filter</primary>
26621 <secondary>specifying</secondary>
26622 </indexterm>
26623 <indexterm role="concept">
26624 <primary>Sieve filter</primary>
26625 <secondary>not available for system filter</secondary>
26626 </indexterm>
26627 This option specifies an Exim filter file that is applied to all messages at
26628 the start of each delivery attempt, before any routing is done. System filters
26629 must be Exim filters; they cannot be Sieve filters. If the system filter
26630 generates any deliveries to files or pipes, or any new mail messages, the
26631 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
26632 which transports are to be used. Details of this facility are given in chapter
26633 <xref linkend="CHAPsystemfilter"/>.
26634 </para>
26635 <para>
26636 <indexterm role="option">
26637 <primary><option>system_filter_directory_transport</option></primary>
26638 </indexterm>
26639 </para>
26640 <informaltable frame="all">
26641 <tgroup cols="4" colsep="0" rowsep="0">
26642 <colspec colwidth="8*" align="left"/>
26643 <colspec colwidth="5*" align="center"/>
26644 <colspec colwidth="5*" align="center"/>
26645 <colspec colwidth="6*" align="right"/>
26646 <tbody>
26647 <row>
26648 <entry><option>system_filter_directory_transport</option></entry>
26649 <entry>Use: <emphasis>main</emphasis></entry>
26650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26651 <entry>Default: <emphasis>unset</emphasis></entry>
26652 </row>
26653 </tbody>
26654 </tgroup>
26655 </informaltable>
26656 <para>
26657 <indexterm role="concept">
26658 <primary><varname>$address_file</varname></primary>
26659 </indexterm>
26660 This sets the name of the transport driver that is to be used when the
26661 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
26662 implying delivery of each message into a separate file in some directory.
26663 During the delivery, the variable <varname>$address_file</varname> contains the path name.
26664 </para>
26665 <para>
26666 <indexterm role="option">
26667 <primary><option>system_filter_file_transport</option></primary>
26668 </indexterm>
26669 </para>
26670 <informaltable frame="all">
26671 <tgroup cols="4" colsep="0" rowsep="0">
26672 <colspec colwidth="8*" align="left"/>
26673 <colspec colwidth="5*" align="center"/>
26674 <colspec colwidth="5*" align="center"/>
26675 <colspec colwidth="6*" align="right"/>
26676 <tbody>
26677 <row>
26678 <entry><option>system_filter_file_transport</option></entry>
26679 <entry>Use: <emphasis>main</emphasis></entry>
26680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26681 <entry>Default: <emphasis>unset</emphasis></entry>
26682 </row>
26683 </tbody>
26684 </tgroup>
26685 </informaltable>
26686 <para>
26687 <indexterm role="concept">
26688 <primary>file</primary>
26689 <secondary>transport for system filter</secondary>
26690 </indexterm>
26691 This sets the name of the transport driver that is to be used when the <option>save</option>
26692 command in a system message filter specifies a path not ending in <quote>/</quote>. During
26693 the delivery, the variable <varname>$address_file</varname> contains the path name.
26694 </para>
26695 <para>
26696 <indexterm role="option">
26697 <primary><option>system_filter_group</option></primary>
26698 </indexterm>
26699 </para>
26700 <informaltable frame="all">
26701 <tgroup cols="4" colsep="0" rowsep="0">
26702 <colspec colwidth="8*" align="left"/>
26703 <colspec colwidth="5*" align="center"/>
26704 <colspec colwidth="5*" align="center"/>
26705 <colspec colwidth="6*" align="right"/>
26706 <tbody>
26707 <row>
26708 <entry><option>system_filter_group</option></entry>
26709 <entry>Use: <emphasis>main</emphasis></entry>
26710 <entry>Type: <emphasis>string</emphasis></entry>
26711 <entry>Default: <emphasis>unset</emphasis></entry>
26712 </row>
26713 </tbody>
26714 </tgroup>
26715 </informaltable>
26716 <para>
26717 <indexterm role="concept">
26718 <primary>gid (group id)</primary>
26719 <secondary>system filter</secondary>
26720 </indexterm>
26721 This option is used only when <option>system_filter_user</option> is also set. It sets the
26722 gid under which the system filter is run, overriding any gid that is associated
26723 with the user. The value may be numerical or symbolic.
26724 </para>
26725 <para>
26726 <indexterm role="option">
26727 <primary><option>system_filter_pipe_transport</option></primary>
26728 </indexterm>
26729 </para>
26730 <informaltable frame="all">
26731 <tgroup cols="4" colsep="0" rowsep="0">
26732 <colspec colwidth="8*" align="left"/>
26733 <colspec colwidth="5*" align="center"/>
26734 <colspec colwidth="5*" align="center"/>
26735 <colspec colwidth="6*" align="right"/>
26736 <tbody>
26737 <row>
26738 <entry><option>system_filter_pipe_transport</option></entry>
26739 <entry>Use: <emphasis>main</emphasis></entry>
26740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26741 <entry>Default: <emphasis>unset</emphasis></entry>
26742 </row>
26743 </tbody>
26744 </tgroup>
26745 </informaltable>
26746 <para>
26747 <indexterm role="concept">
26748 <primary><command>pipe</command> transport</primary>
26749 <secondary>for system filter</secondary>
26750 </indexterm>
26751 <indexterm role="concept">
26752 <primary><varname>$address_pipe</varname></primary>
26753 </indexterm>
26754 This specifies the transport driver that is to be used when a <option>pipe</option> command
26755 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
26756 contains the pipe command.
26757 </para>
26758 <para>
26759 <indexterm role="option">
26760 <primary><option>system_filter_reply_transport</option></primary>
26761 </indexterm>
26762 </para>
26763 <informaltable frame="all">
26764 <tgroup cols="4" colsep="0" rowsep="0">
26765 <colspec colwidth="8*" align="left"/>
26766 <colspec colwidth="5*" align="center"/>
26767 <colspec colwidth="5*" align="center"/>
26768 <colspec colwidth="6*" align="right"/>
26769 <tbody>
26770 <row>
26771 <entry><option>system_filter_reply_transport</option></entry>
26772 <entry>Use: <emphasis>main</emphasis></entry>
26773 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26774 <entry>Default: <emphasis>unset</emphasis></entry>
26775 </row>
26776 </tbody>
26777 </tgroup>
26778 </informaltable>
26779 <para>
26780 <indexterm role="concept">
26781 <primary><command>autoreply</command> transport</primary>
26782 <secondary>for system filter</secondary>
26783 </indexterm>
26784 This specifies the transport driver that is to be used when a <option>mail</option> command
26785 is used in a system filter.
26786 </para>
26787 <para>
26788 <indexterm role="option">
26789 <primary><option>system_filter_user</option></primary>
26790 </indexterm>
26791 </para>
26792 <informaltable frame="all">
26793 <tgroup cols="4" colsep="0" rowsep="0">
26794 <colspec colwidth="8*" align="left"/>
26795 <colspec colwidth="5*" align="center"/>
26796 <colspec colwidth="5*" align="center"/>
26797 <colspec colwidth="6*" align="right"/>
26798 <tbody>
26799 <row>
26800 <entry><option>system_filter_user</option></entry>
26801 <entry>Use: <emphasis>main</emphasis></entry>
26802 <entry>Type: <emphasis>string</emphasis></entry>
26803 <entry>Default: <emphasis>unset</emphasis></entry>
26804 </row>
26805 </tbody>
26806 </tgroup>
26807 </informaltable>
26808 <para>
26809 <indexterm role="concept">
26810 <primary>uid (user id)</primary>
26811 <secondary>system filter</secondary>
26812 </indexterm>
26813 If this option is not set, the system filter is run in the main Exim delivery
26814 process, as root. When the option is set, the system filter runs in a separate
26815 process, as the given user. Unless the string consists entirely of digits, it
26816 is looked up in the password data. Failure to find the named user causes a
26817 configuration error. The gid is either taken from the password data, or
26818 specified by <option>system_filter_group</option>. When the uid is specified numerically,
26819 <option>system_filter_group</option> is required to be set.
26820 </para>
26821 <para>
26822 If the system filter generates any pipe, file, or reply deliveries, the uid
26823 under which the filter is run is used when transporting them, unless a
26824 transport option overrides. Normally you should set <option>system_filter_user</option> if
26825 your system filter generates these kinds of delivery.
26826 </para>
26827 <para>
26828 <indexterm role="option">
26829 <primary><option>tcp_nodelay</option></primary>
26830 </indexterm>
26831 </para>
26832 <informaltable frame="all">
26833 <tgroup cols="4" colsep="0" rowsep="0">
26834 <colspec colwidth="8*" align="left"/>
26835 <colspec colwidth="5*" align="center"/>
26836 <colspec colwidth="5*" align="center"/>
26837 <colspec colwidth="6*" align="right"/>
26838 <tbody>
26839 <row>
26840 <entry><option>tcp_nodelay</option></entry>
26841 <entry>Use: <emphasis>main</emphasis></entry>
26842 <entry>Type: <emphasis>boolean</emphasis></entry>
26843 <entry>Default: <emphasis>true</emphasis></entry>
26844 </row>
26845 </tbody>
26846 </tgroup>
26847 </informaltable>
26848 <para>
26849 <indexterm role="concept">
26850 <primary>daemon</primary>
26851 <secondary>TCP_NODELAY on sockets</secondary>
26852 </indexterm>
26853 <indexterm role="concept">
26854 <primary>Nagle algorithm</primary>
26855 </indexterm>
26856 <indexterm role="concept">
26857 <primary>TCP_NODELAY on listening sockets</primary>
26858 </indexterm>
26859 If this option is set false, it stops the Exim daemon setting the
26860 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
26861 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
26862 performance in interactive (character-by-character) situations. Turning it off
26863 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
26864 However, it appears that some broken clients cannot cope, and time out. Hence
26865 this option. It affects only those sockets that are set up for listening by the
26866 daemon. Sockets created by the smtp transport for delivering mail always set
26867 TCP_NODELAY.
26868 </para>
26869 <para>
26870 <indexterm role="option">
26871 <primary><option>timeout_frozen_after</option></primary>
26872 </indexterm>
26873 </para>
26874 <informaltable frame="all">
26875 <tgroup cols="4" colsep="0" rowsep="0">
26876 <colspec colwidth="8*" align="left"/>
26877 <colspec colwidth="5*" align="center"/>
26878 <colspec colwidth="5*" align="center"/>
26879 <colspec colwidth="6*" align="right"/>
26880 <tbody>
26881 <row>
26882 <entry><option>timeout_frozen_after</option></entry>
26883 <entry>Use: <emphasis>main</emphasis></entry>
26884 <entry>Type: <emphasis>time</emphasis></entry>
26885 <entry>Default: <emphasis>0s</emphasis></entry>
26886 </row>
26887 </tbody>
26888 </tgroup>
26889 </informaltable>
26890 <para>
26891 <indexterm role="concept">
26892 <primary>frozen messages</primary>
26893 <secondary>timing out</secondary>
26894 </indexterm>
26895 <indexterm role="concept">
26896 <primary>timeout</primary>
26897 <secondary>frozen messages</secondary>
26898 </indexterm>
26899 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
26900 message of any kind that has been on the queue for longer than the given time
26901 is automatically cancelled at the next queue run. If the frozen message is a
26902 bounce message, it is just discarded; otherwise, a bounce is sent to the
26903 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
26904 If you want to timeout frozen bounce messages earlier than other kinds of
26905 frozen message, see <option>ignore_bounce_errors_after</option>.
26906 </para>
26907 <para revisionflag="changed">
26908 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
26909 frozen messages remain on the queue forever (except for any frozen bounce
26910 messages that are released by <option>ignore_bounce_errors_after</option>).
26911 </para>
26912 <para>
26913 <indexterm role="option">
26914 <primary><option>timezone</option></primary>
26915 </indexterm>
26916 </para>
26917 <informaltable frame="all">
26918 <tgroup cols="4" colsep="0" rowsep="0">
26919 <colspec colwidth="8*" align="left"/>
26920 <colspec colwidth="5*" align="center"/>
26921 <colspec colwidth="5*" align="center"/>
26922 <colspec colwidth="6*" align="right"/>
26923 <tbody>
26924 <row>
26925 <entry><option>timezone</option></entry>
26926 <entry>Use: <emphasis>main</emphasis></entry>
26927 <entry>Type: <emphasis>string</emphasis></entry>
26928 <entry>Default: <emphasis>unset</emphasis></entry>
26929 </row>
26930 </tbody>
26931 </tgroup>
26932 </informaltable>
26933 <para>
26934 <indexterm role="concept">
26935 <primary>timezone</primary>
26936 <secondary>setting</secondary>
26937 </indexterm>
26938 The value of <option>timezone</option> is used to set the environment variable TZ while
26939 running Exim (if it is different on entry). This ensures that all timestamps
26940 created by Exim are in the required timezone. If you want all your timestamps
26941 to be in UTC (aka GMT) you should set
26942 </para>
26943 <literallayout class="monospaced">
26944 timezone = UTC
26945 </literallayout>
26946 <para>
26947 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
26948 or, if that is not set, from the value of the TZ environment variable when Exim
26949 is built. If <option>timezone</option> is set to the empty string, either at build or run
26950 time, any existing TZ variable is removed from the environment when Exim
26951 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
26952 unfortunately not all, operating systems.
26953 </para>
26954 <para>
26955 <indexterm role="option">
26956 <primary><option>tls_advertise_hosts</option></primary>
26957 </indexterm>
26958 </para>
26959 <informaltable frame="all">
26960 <tgroup cols="4" colsep="0" rowsep="0">
26961 <colspec colwidth="8*" align="left"/>
26962 <colspec colwidth="5*" align="center"/>
26963 <colspec colwidth="5*" align="center"/>
26964 <colspec colwidth="6*" align="right"/>
26965 <tbody>
26966 <row>
26967 <entry><option>tls_advertise_hosts</option></entry>
26968 <entry>Use: <emphasis>main</emphasis></entry>
26969 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26970 <entry>Default: <emphasis>unset</emphasis></entry>
26971 </row>
26972 </tbody>
26973 </tgroup>
26974 </informaltable>
26975 <para>
26976 <indexterm role="concept">
26977 <primary>TLS</primary>
26978 <secondary>advertising</secondary>
26979 </indexterm>
26980 <indexterm role="concept">
26981 <primary>encryption</primary>
26982 <secondary>on SMTP connection</secondary>
26983 </indexterm>
26984 <indexterm role="concept">
26985 <primary>SMTP</primary>
26986 <secondary>encrypted connection</secondary>
26987 </indexterm>
26988 When Exim is built with support for TLS encrypted connections, the availability
26989 of the STARTTLS command to set up an encrypted session is advertised in
26990 response to EHLO only to those client hosts that match this option. See
26991 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
26992 </para>
26993 <para>
26994 <indexterm role="option">
26995 <primary><option>tls_certificate</option></primary>
26996 </indexterm>
26997 </para>
26998 <informaltable frame="all">
26999 <tgroup cols="4" colsep="0" rowsep="0">
27000 <colspec colwidth="8*" align="left"/>
27001 <colspec colwidth="5*" align="center"/>
27002 <colspec colwidth="5*" align="center"/>
27003 <colspec colwidth="6*" align="right"/>
27004 <tbody>
27005 <row>
27006 <entry><option>tls_certificate</option></entry>
27007 <entry>Use: <emphasis>main</emphasis></entry>
27008 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27009 <entry>Default: <emphasis>unset</emphasis></entry>
27010 </row>
27011 </tbody>
27012 </tgroup>
27013 </informaltable>
27014 <para>
27015 <indexterm role="concept">
27016 <primary>TLS</primary>
27017 <secondary>server certificate; location of</secondary>
27018 </indexterm>
27019 <indexterm role="concept">
27020 <primary>certificate for server</primary>
27021 <secondary>location of</secondary>
27022 </indexterm>
27023 The value of this option is expanded, and must then be the absolute path to a
27024 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
27025 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
27026 <xref linkend="CHAPTLS"/> for further details.
27027 </para>
27028 <para>
27029 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
27030 receiving incoming messages as a server. If you want to supply certificates for
27031 use when sending messages as a client, you must set the <option>tls_certificate</option>
27032 option in the relevant <command>smtp</command> transport.
27033 </para>
27034 <para>
27035 <indexterm role="option">
27036 <primary><option>tls_crl</option></primary>
27037 </indexterm>
27038 </para>
27039 <informaltable frame="all">
27040 <tgroup cols="4" colsep="0" rowsep="0">
27041 <colspec colwidth="8*" align="left"/>
27042 <colspec colwidth="5*" align="center"/>
27043 <colspec colwidth="5*" align="center"/>
27044 <colspec colwidth="6*" align="right"/>
27045 <tbody>
27046 <row>
27047 <entry><option>tls_crl</option></entry>
27048 <entry>Use: <emphasis>main</emphasis></entry>
27049 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27050 <entry>Default: <emphasis>unset</emphasis></entry>
27051 </row>
27052 </tbody>
27053 </tgroup>
27054 </informaltable>
27055 <para>
27056 <indexterm role="concept">
27057 <primary>TLS</primary>
27058 <secondary>server certificate revocation list</secondary>
27059 </indexterm>
27060 <indexterm role="concept">
27061 <primary>certificate</primary>
27062 <secondary>revocation list for server</secondary>
27063 </indexterm>
27064 This option specifies a certificate revocation list. The expanded value must
27065 be the name of a file that contains a CRL in PEM format.
27066 </para>
27067 <para>
27068 <indexterm role="option">
27069 <primary><option>tls_dhparam</option></primary>
27070 </indexterm>
27071 </para>
27072 <informaltable frame="all">
27073 <tgroup cols="4" colsep="0" rowsep="0">
27074 <colspec colwidth="8*" align="left"/>
27075 <colspec colwidth="5*" align="center"/>
27076 <colspec colwidth="5*" align="center"/>
27077 <colspec colwidth="6*" align="right"/>
27078 <tbody>
27079 <row>
27080 <entry><option>tls_dhparam</option></entry>
27081 <entry>Use: <emphasis>main</emphasis></entry>
27082 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27083 <entry>Default: <emphasis>unset</emphasis></entry>
27084 </row>
27085 </tbody>
27086 </tgroup>
27087 </informaltable>
27088 <para>
27089 <indexterm role="concept">
27090 <primary>TLS</primary>
27091 <secondary>D-H parameters for server</secondary>
27092 </indexterm>
27093 The value of this option is expanded, and must then be the absolute path to
27094 a file which contains the server&#x2019;s DH parameter values.
27095 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
27096 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
27097 </para>
27098 <para>
27099 <indexterm role="option">
27100 <primary><option>tls_on_connect_ports</option></primary>
27101 </indexterm>
27102 </para>
27103 <informaltable frame="all">
27104 <tgroup cols="4" colsep="0" rowsep="0">
27105 <colspec colwidth="8*" align="left"/>
27106 <colspec colwidth="5*" align="center"/>
27107 <colspec colwidth="5*" align="center"/>
27108 <colspec colwidth="6*" align="right"/>
27109 <tbody>
27110 <row>
27111 <entry><option>tls_on_connect_ports</option></entry>
27112 <entry>Use: <emphasis>main</emphasis></entry>
27113 <entry>Type: <emphasis>string list</emphasis></entry>
27114 <entry>Default: <emphasis>unset</emphasis></entry>
27115 </row>
27116 </tbody>
27117 </tgroup>
27118 </informaltable>
27119 <para>
27120 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
27121 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
27122 set up without waiting for the client to issue a STARTTLS command. For
27123 further details, see section <xref linkend="SECTsupobssmt"/>.
27124 </para>
27125 <para>
27126 <indexterm role="option">
27127 <primary><option>tls_privatekey</option></primary>
27128 </indexterm>
27129 </para>
27130 <informaltable frame="all">
27131 <tgroup cols="4" colsep="0" rowsep="0">
27132 <colspec colwidth="8*" align="left"/>
27133 <colspec colwidth="5*" align="center"/>
27134 <colspec colwidth="5*" align="center"/>
27135 <colspec colwidth="6*" align="right"/>
27136 <tbody>
27137 <row>
27138 <entry><option>tls_privatekey</option></entry>
27139 <entry>Use: <emphasis>main</emphasis></entry>
27140 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27141 <entry>Default: <emphasis>unset</emphasis></entry>
27142 </row>
27143 </tbody>
27144 </tgroup>
27145 </informaltable>
27146 <para>
27147 <indexterm role="concept">
27148 <primary>TLS</primary>
27149 <secondary>server private key; location of</secondary>
27150 </indexterm>
27151 The value of this option is expanded, and must then be the absolute path to a
27152 file which contains the server&#x2019;s private key. If this option is unset, or if
27153 the expansion is forced to fail, or the result is an empty string, the private
27154 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
27155 <xref linkend="CHAPTLS"/> for further details.
27156 </para>
27157 <para>
27158 <indexterm role="option">
27159 <primary><option>tls_remember_esmtp</option></primary>
27160 </indexterm>
27161 </para>
27162 <informaltable frame="all">
27163 <tgroup cols="4" colsep="0" rowsep="0">
27164 <colspec colwidth="8*" align="left"/>
27165 <colspec colwidth="5*" align="center"/>
27166 <colspec colwidth="5*" align="center"/>
27167 <colspec colwidth="6*" align="right"/>
27168 <tbody>
27169 <row>
27170 <entry><option>tls_remember_esmtp</option></entry>
27171 <entry>Use: <emphasis>main</emphasis></entry>
27172 <entry>Type: <emphasis>boolean</emphasis></entry>
27173 <entry>Default: <emphasis>false</emphasis></entry>
27174 </row>
27175 </tbody>
27176 </tgroup>
27177 </informaltable>
27178 <para>
27179 <indexterm role="concept">
27180 <primary>TLS</primary>
27181 <secondary>esmtp state; remembering</secondary>
27182 </indexterm>
27183 <indexterm role="concept">
27184 <primary>TLS</primary>
27185 <secondary>broken clients</secondary>
27186 </indexterm>
27187 If this option is set true, Exim violates the RFCs by remembering that it is in
27188 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
27189 support for broken clients that fail to send a new EHLO after starting a
27190 TLS session.
27191 </para>
27192 <para>
27193 <indexterm role="option">
27194 <primary><option>tls_require_ciphers</option></primary>
27195 </indexterm>
27196 </para>
27197 <informaltable frame="all">
27198 <tgroup cols="4" colsep="0" rowsep="0">
27199 <colspec colwidth="8*" align="left"/>
27200 <colspec colwidth="5*" align="center"/>
27201 <colspec colwidth="5*" align="center"/>
27202 <colspec colwidth="6*" align="right"/>
27203 <tbody>
27204 <row>
27205 <entry><option>tls_require_ciphers</option></entry>
27206 <entry>Use: <emphasis>main</emphasis></entry>
27207 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27208 <entry>Default: <emphasis>unset</emphasis></entry>
27209 </row>
27210 </tbody>
27211 </tgroup>
27212 </informaltable>
27213 <para>
27214 <indexterm role="concept">
27215 <primary>TLS</primary>
27216 <secondary>requiring specific ciphers</secondary>
27217 </indexterm>
27218 <indexterm role="concept">
27219 <primary>cipher</primary>
27220 <secondary>requiring specific</secondary>
27221 </indexterm>
27222 This option controls which ciphers can be used for incoming TLS connections.
27223 The <command>smtp</command> transport has an option of the same name for controlling outgoing
27224 connections. This option is expanded for each connection, so can be varied for
27225 different clients if required. The value of this option must be a list of
27226 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
27227 in somewhat different ways. If GnuTLS is being used, the client controls the
27228 preference order of the available ciphers. Details are given in sections
27229 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
27230 </para>
27231 <para>
27232 <indexterm role="option">
27233 <primary><option>tls_try_verify_hosts</option></primary>
27234 </indexterm>
27235 </para>
27236 <informaltable frame="all">
27237 <tgroup cols="4" colsep="0" rowsep="0">
27238 <colspec colwidth="8*" align="left"/>
27239 <colspec colwidth="5*" align="center"/>
27240 <colspec colwidth="5*" align="center"/>
27241 <colspec colwidth="6*" align="right"/>
27242 <tbody>
27243 <row>
27244 <entry><option>tls_try_verify_hosts</option></entry>
27245 <entry>Use: <emphasis>main</emphasis></entry>
27246 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27247 <entry>Default: <emphasis>unset</emphasis></entry>
27248 </row>
27249 </tbody>
27250 </tgroup>
27251 </informaltable>
27252 <para>
27253 <indexterm role="concept">
27254 <primary>TLS</primary>
27255 <secondary>client certificate verification</secondary>
27256 </indexterm>
27257 <indexterm role="concept">
27258 <primary>certificate</primary>
27259 <secondary>verification of client</secondary>
27260 </indexterm>
27261 See <option>tls_verify_hosts</option> below.
27262 </para>
27263 <para>
27264 <indexterm role="option">
27265 <primary><option>tls_verify_certificates</option></primary>
27266 </indexterm>
27267 </para>
27268 <informaltable frame="all">
27269 <tgroup cols="4" colsep="0" rowsep="0">
27270 <colspec colwidth="8*" align="left"/>
27271 <colspec colwidth="5*" align="center"/>
27272 <colspec colwidth="5*" align="center"/>
27273 <colspec colwidth="6*" align="right"/>
27274 <tbody>
27275 <row>
27276 <entry><option>tls_verify_certificates</option></entry>
27277 <entry>Use: <emphasis>main</emphasis></entry>
27278 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27279 <entry>Default: <emphasis>unset</emphasis></entry>
27280 </row>
27281 </tbody>
27282 </tgroup>
27283 </informaltable>
27284 <para>
27285 <indexterm role="concept">
27286 <primary>TLS</primary>
27287 <secondary>client certificate verification</secondary>
27288 </indexterm>
27289 <indexterm role="concept">
27290 <primary>certificate</primary>
27291 <secondary>verification of client</secondary>
27292 </indexterm>
27293 The value of this option is expanded, and must then be the absolute path to
27294 a file containing permitted certificates for clients that
27295 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
27296 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
27297 directory containing certificate files. This does not work with GnuTLS; the
27298 option must be set to the name of a single file if you are using GnuTLS.
27299 </para>
27300 <para>
27301 <indexterm role="option">
27302 <primary><option>tls_verify_hosts</option></primary>
27303 </indexterm>
27304 </para>
27305 <informaltable frame="all">
27306 <tgroup cols="4" colsep="0" rowsep="0">
27307 <colspec colwidth="8*" align="left"/>
27308 <colspec colwidth="5*" align="center"/>
27309 <colspec colwidth="5*" align="center"/>
27310 <colspec colwidth="6*" align="right"/>
27311 <tbody>
27312 <row>
27313 <entry><option>tls_verify_hosts</option></entry>
27314 <entry>Use: <emphasis>main</emphasis></entry>
27315 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27316 <entry>Default: <emphasis>unset</emphasis></entry>
27317 </row>
27318 </tbody>
27319 </tgroup>
27320 </informaltable>
27321 <para>
27322 <indexterm role="concept">
27323 <primary>TLS</primary>
27324 <secondary>client certificate verification</secondary>
27325 </indexterm>
27326 <indexterm role="concept">
27327 <primary>certificate</primary>
27328 <secondary>verification of client</secondary>
27329 </indexterm>
27330 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
27331 certificates from clients.
27332 The expected certificates are defined by <option>tls_verify_certificates</option>, which
27333 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
27334 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
27335 </para>
27336 <para>
27337 Any client that matches <option>tls_verify_hosts</option> is constrained by
27338 <option>tls_verify_certificates</option>. The client must present one of the listed
27339 certificates. If it does not, the connection is aborted.
27340 </para>
27341 <para>
27342 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
27343 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
27344 certificate and checks it against <option>tls_verify_certificates</option>, but does not
27345 abort the connection if there is no certificate or if it does not match. This
27346 state can be detected in an ACL, which makes it possible to implement policies
27347 such as <quote>accept for relay only if a verified certificate has been received,
27348 but accept for local delivery if encrypted, even without a verified
27349 certificate</quote>.
27350 </para>
27351 <para>
27352 Client hosts that match neither of these lists are not asked to present
27353 certificates.
27354 </para>
27355 <para>
27356 <indexterm role="option">
27357 <primary><option>trusted_groups</option></primary>
27358 </indexterm>
27359 </para>
27360 <informaltable frame="all">
27361 <tgroup cols="4" colsep="0" rowsep="0">
27362 <colspec colwidth="8*" align="left"/>
27363 <colspec colwidth="5*" align="center"/>
27364 <colspec colwidth="5*" align="center"/>
27365 <colspec colwidth="6*" align="right"/>
27366 <tbody>
27367 <row>
27368 <entry><option>trusted_groups</option></entry>
27369 <entry>Use: <emphasis>main</emphasis></entry>
27370 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27371 <entry>Default: <emphasis>unset</emphasis></entry>
27372 </row>
27373 </tbody>
27374 </tgroup>
27375 </informaltable>
27376 <para>
27377 <indexterm role="concept">
27378 <primary>trusted group</primary>
27379 </indexterm>
27380 <indexterm role="concept">
27381 <primary>group</primary>
27382 <secondary>trusted</secondary>
27383 </indexterm>
27384 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27385 option is set, any process that is running in one of the listed groups, or
27386 which has one of them as a supplementary group, is trusted. The groups can be
27387 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
27388 details of what trusted callers are permitted to do. If neither
27389 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
27390 are trusted.
27391 </para>
27392 <para>
27393 <indexterm role="option">
27394 <primary><option>trusted_users</option></primary>
27395 </indexterm>
27396 </para>
27397 <informaltable frame="all">
27398 <tgroup cols="4" colsep="0" rowsep="0">
27399 <colspec colwidth="8*" align="left"/>
27400 <colspec colwidth="5*" align="center"/>
27401 <colspec colwidth="5*" align="center"/>
27402 <colspec colwidth="6*" align="right"/>
27403 <tbody>
27404 <row>
27405 <entry><option>trusted_users</option></entry>
27406 <entry>Use: <emphasis>main</emphasis></entry>
27407 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27408 <entry>Default: <emphasis>unset</emphasis></entry>
27409 </row>
27410 </tbody>
27411 </tgroup>
27412 </informaltable>
27413 <para>
27414 <indexterm role="concept">
27415 <primary>trusted user</primary>
27416 </indexterm>
27417 <indexterm role="concept">
27418 <primary>user</primary>
27419 <secondary>trusted</secondary>
27420 </indexterm>
27421 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27422 option is set, any process that is running as one of the listed users is
27423 trusted. The users can be specified numerically or by name. See section
27424 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
27425 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
27426 Exim user are trusted.
27427 </para>
27428 <para>
27429 <indexterm role="option">
27430 <primary><option>unknown_login</option></primary>
27431 </indexterm>
27432 </para>
27433 <informaltable frame="all">
27434 <tgroup cols="4" colsep="0" rowsep="0">
27435 <colspec colwidth="8*" align="left"/>
27436 <colspec colwidth="5*" align="center"/>
27437 <colspec colwidth="5*" align="center"/>
27438 <colspec colwidth="6*" align="right"/>
27439 <tbody>
27440 <row>
27441 <entry><option>unknown_login</option></entry>
27442 <entry>Use: <emphasis>main</emphasis></entry>
27443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27444 <entry>Default: <emphasis>unset</emphasis></entry>
27445 </row>
27446 </tbody>
27447 </tgroup>
27448 </informaltable>
27449 <para>
27450 <indexterm role="concept">
27451 <primary>uid (user id)</primary>
27452 <secondary>unknown caller</secondary>
27453 </indexterm>
27454 <indexterm role="concept">
27455 <primary><varname>$caller_uid</varname></primary>
27456 </indexterm>
27457 This is a specialized feature for use in unusual configurations. By default, if
27458 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
27459 gives up. The <option>unknown_login</option> option can be used to set a login name to be
27460 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
27461 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
27462 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
27463 <option>-F</option> option.
27464 </para>
27465 <para>
27466 <indexterm role="option">
27467 <primary><option>unknown_username</option></primary>
27468 </indexterm>
27469 </para>
27470 <informaltable frame="all">
27471 <tgroup cols="4" colsep="0" rowsep="0">
27472 <colspec colwidth="8*" align="left"/>
27473 <colspec colwidth="5*" align="center"/>
27474 <colspec colwidth="5*" align="center"/>
27475 <colspec colwidth="6*" align="right"/>
27476 <tbody>
27477 <row>
27478 <entry><option>unknown_username</option></entry>
27479 <entry>Use: <emphasis>main</emphasis></entry>
27480 <entry>Type: <emphasis>string</emphasis></entry>
27481 <entry>Default: <emphasis>unset</emphasis></entry>
27482 </row>
27483 </tbody>
27484 </tgroup>
27485 </informaltable>
27486 <para>
27487 See <option>unknown_login</option>.
27488 </para>
27489 <para>
27490 <indexterm role="option">
27491 <primary><option>untrusted_set_sender</option></primary>
27492 </indexterm>
27493 </para>
27494 <informaltable frame="all">
27495 <tgroup cols="4" colsep="0" rowsep="0">
27496 <colspec colwidth="8*" align="left"/>
27497 <colspec colwidth="5*" align="center"/>
27498 <colspec colwidth="5*" align="center"/>
27499 <colspec colwidth="6*" align="right"/>
27500 <tbody>
27501 <row>
27502 <entry><option>untrusted_set_sender</option></entry>
27503 <entry>Use: <emphasis>main</emphasis></entry>
27504 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
27505 <entry>Default: <emphasis>unset</emphasis></entry>
27506 </row>
27507 </tbody>
27508 </tgroup>
27509 </informaltable>
27510 <para>
27511 <indexterm role="concept">
27512 <primary>trusted user</primary>
27513 </indexterm>
27514 <indexterm role="concept">
27515 <primary>sender</primary>
27516 <secondary>setting by untrusted user</secondary>
27517 </indexterm>
27518 <indexterm role="concept">
27519 <primary>untrusted user</primary>
27520 <secondary>setting sender</secondary>
27521 </indexterm>
27522 <indexterm role="concept">
27523 <primary>user</primary>
27524 <secondary>untrusted setting sender</secondary>
27525 </indexterm>
27526 <indexterm role="concept">
27527 <primary>envelope sender</primary>
27528 </indexterm>
27529 When an untrusted user submits a message to Exim using the standard input, Exim
27530 normally creates an envelope sender address from the user&#x2019;s login and the
27531 default qualification domain. Data from the <option>-f</option> option (for setting envelope
27532 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
27533 is used) is ignored.
27534 </para>
27535 <para>
27536 However, untrusted users are permitted to set an empty envelope sender address,
27537 to declare that a message should never generate any bounces. For example:
27538 </para>
27539 <literallayout class="monospaced">
27540 exim -f '&lt;&gt;' user@domain.example
27541 </literallayout>
27542 <para>
27543 <indexterm role="concept">
27544 <primary><varname>$sender_ident</varname></primary>
27545 </indexterm>
27546 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27547 other envelope sender addresses in a controlled way. When it is set, untrusted
27548 users are allowed to set envelope sender addresses that match any of the
27549 patterns in the list. Like all address lists, the string is expanded. The
27550 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27551 users to setting senders that start with their login ids
27552 followed by a hyphen
27553 by a setting like this:
27554 </para>
27555 <literallayout class="monospaced">
27556 untrusted_set_sender = ^$sender_ident-
27557 </literallayout>
27558 <para>
27559 If you want to allow untrusted users to set envelope sender addresses without
27560 restriction, you can use
27561 </para>
27562 <literallayout class="monospaced">
27563 untrusted_set_sender = *
27564 </literallayout>
27565 <para>
27566 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27567 only to the setting of the envelope sender. It does not permit untrusted users
27568 to use the other options which trusted user can use to override message
27569 parameters. Furthermore, it does not stop Exim from removing an existing
27570 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27571 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27572 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27573 described in section <xref linkend="SECTthesenhea"/>.
27574 </para>
27575 <para>
27576 The log line for a message&#x2019;s arrival shows the envelope sender following
27577 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
27578 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27579 envelope sender address, the user&#x2019;s login is shown in parentheses after the
27580 sender address.
27581 </para>
27582 <para>
27583 <indexterm role="option">
27584 <primary><option>uucp_from_pattern</option></primary>
27585 </indexterm>
27586 </para>
27587 <informaltable frame="all">
27588 <tgroup cols="4" colsep="0" rowsep="0">
27589 <colspec colwidth="8*" align="left"/>
27590 <colspec colwidth="5*" align="center"/>
27591 <colspec colwidth="5*" align="center"/>
27592 <colspec colwidth="6*" align="right"/>
27593 <tbody>
27594 <row>
27595 <entry><option>uucp_from_pattern</option></entry>
27596 <entry>Use: <emphasis>main</emphasis></entry>
27597 <entry>Type: <emphasis>string</emphasis></entry>
27598 <entry>Default: <emphasis>see below</emphasis></entry>
27599 </row>
27600 </tbody>
27601 </tgroup>
27602 </informaltable>
27603 <para>
27604 <indexterm role="concept">
27605 <primary><quote>From</quote> line</primary>
27606 </indexterm>
27607 <indexterm role="concept">
27608 <primary>UUCP</primary>
27609 <secondary><quote>From</quote> line</secondary>
27610 </indexterm>
27611 Some applications that pass messages to an MTA via a command line interface use
27612 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
27613 particular, this is used by UUCP software. Exim recognizes such a line by means
27614 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
27615 matches, the sender address is constructed by expanding the contents of
27616 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
27617 default pattern recognizes lines in the following two forms:
27618 </para>
27619 <literallayout class="monospaced">
27620 From ph10 Fri Jan  5 12:35 GMT 1996
27621 From ph10 Fri, 7 Jan 97 14:00:00 GMT
27622 </literallayout>
27623 <para>
27624 The pattern can be seen by running
27625 </para>
27626 <literallayout class="monospaced">
27627 exim -bP uucp_from_pattern
27628 </literallayout>
27629 <para>
27630 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
27631 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
27632 regular expression by a parenthesized subpattern. The default value for
27633 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
27634 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
27635 <option>ignore_fromline_hosts</option>.
27636 </para>
27637 <para>
27638 <indexterm role="option">
27639 <primary><option>uucp_from_sender</option></primary>
27640 </indexterm>
27641 </para>
27642 <informaltable frame="all">
27643 <tgroup cols="4" colsep="0" rowsep="0">
27644 <colspec colwidth="8*" align="left"/>
27645 <colspec colwidth="5*" align="center"/>
27646 <colspec colwidth="5*" align="center"/>
27647 <colspec colwidth="6*" align="right"/>
27648 <tbody>
27649 <row>
27650 <entry><option>uucp_from_sender</option></entry>
27651 <entry>Use: <emphasis>main</emphasis></entry>
27652 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27653 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
27654 </row>
27655 </tbody>
27656 </tgroup>
27657 </informaltable>
27658 <para>
27659 See <option>uucp_from_pattern</option> above.
27660 </para>
27661 <para>
27662 <indexterm role="option">
27663 <primary><option>warn_message_file</option></primary>
27664 </indexterm>
27665 </para>
27666 <informaltable frame="all">
27667 <tgroup cols="4" colsep="0" rowsep="0">
27668 <colspec colwidth="8*" align="left"/>
27669 <colspec colwidth="5*" align="center"/>
27670 <colspec colwidth="5*" align="center"/>
27671 <colspec colwidth="6*" align="right"/>
27672 <tbody>
27673 <row>
27674 <entry><option>warn_message_file</option></entry>
27675 <entry>Use: <emphasis>main</emphasis></entry>
27676 <entry>Type: <emphasis>string</emphasis></entry>
27677 <entry>Default: <emphasis>unset</emphasis></entry>
27678 </row>
27679 </tbody>
27680 </tgroup>
27681 </informaltable>
27682 <para>
27683 <indexterm role="concept">
27684 <primary>warning of delay</primary>
27685 <secondary>customizing the message</secondary>
27686 </indexterm>
27687 <indexterm role="concept">
27688 <primary>customizing</primary>
27689 <secondary>warning message</secondary>
27690 </indexterm>
27691 This option defines a template file containing paragraphs of text to be used
27692 for constructing the warning message which is sent by Exim when a message has
27693 been on the queue for a specified amount of time, as specified by
27694 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
27695 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
27696 </para>
27697 <para>
27698 <indexterm role="option">
27699 <primary><option>write_rejectlog</option></primary>
27700 </indexterm>
27701 </para>
27702 <informaltable frame="all">
27703 <tgroup cols="4" colsep="0" rowsep="0">
27704 <colspec colwidth="8*" align="left"/>
27705 <colspec colwidth="5*" align="center"/>
27706 <colspec colwidth="5*" align="center"/>
27707 <colspec colwidth="6*" align="right"/>
27708 <tbody>
27709 <row>
27710 <entry><option>write_rejectlog</option></entry>
27711 <entry>Use: <emphasis>main</emphasis></entry>
27712 <entry>Type: <emphasis>boolean</emphasis></entry>
27713 <entry>Default: <emphasis>true</emphasis></entry>
27714 </row>
27715 </tbody>
27716 </tgroup>
27717 </informaltable>
27718 <para>
27719 <indexterm role="concept">
27720 <primary>reject log</primary>
27721 <secondary>disabling</secondary>
27722 </indexterm>
27723 If this option is set false, Exim no longer writes anything to the reject log.
27724 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
27725 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
27726 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
27727 </para>
27728 </section>
27729 </chapter>
27730
27731 <chapter id="CHAProutergeneric">
27732 <title>Generic options for routers</title>
27733 <para>
27734 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
27735 <primary>options</primary>
27736 <secondary>generic; for routers</secondary>
27737 </indexterm>
27738 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
27739 <primary>generic options</primary>
27740 <secondary>router</secondary>
27741 </indexterm>
27742 This chapter describes the generic options that apply to all routers.
27743 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
27744 </para>
27745 <para>
27746 For a general description of how a router operates, see sections
27747 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
27748 which the preconditions are tested. The order of expansion of the options that
27749 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
27750 <option>headers_remove</option>, <option>transport</option>.
27751 </para>
27752 <para>
27753 <indexterm role="option">
27754 <primary><option>address_data</option></primary>
27755 </indexterm>
27756 </para>
27757 <informaltable frame="all">
27758 <tgroup cols="4" colsep="0" rowsep="0">
27759 <colspec colwidth="8*" align="left"/>
27760 <colspec colwidth="5*" align="center"/>
27761 <colspec colwidth="5*" align="center"/>
27762 <colspec colwidth="6*" align="right"/>
27763 <tbody>
27764 <row>
27765 <entry><option>address_data</option></entry>
27766 <entry>Use: <emphasis>routers</emphasis></entry>
27767 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27768 <entry>Default: <emphasis>unset</emphasis></entry>
27769 </row>
27770 </tbody>
27771 </tgroup>
27772 </informaltable>
27773 <para>
27774 <indexterm role="concept">
27775 <primary>router</primary>
27776 <secondary>data attached to address</secondary>
27777 </indexterm>
27778 The string is expanded just before the router is run, that is, after all the
27779 precondition tests have succeeded. If the expansion is forced to fail, the
27780 router declines, the value of <option>address_data</option> remains unchanged, and the
27781 <option>more</option> option controls what happens next. Other expansion failures cause
27782 delivery of the address to be deferred.
27783 </para>
27784 <para>
27785 <indexterm role="concept">
27786 <primary><varname>$address_data</varname></primary>
27787 </indexterm>
27788 When the expansion succeeds, the value is retained with the address, and can be
27789 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
27790 routers, and the eventual transport.
27791 </para>
27792 <para>
27793 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
27794 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
27795 in the filter. This is not normally a problem, because such data is usually
27796 either not confidential or it <quote>belongs</quote> to the current user, but if you do
27797 put confidential data into <varname>$address_data</varname> you need to remember this point.
27798 </para>
27799 <para>
27800 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
27801 with the address, though it can be changed by another <option>address_data</option> setting
27802 on a subsequent router. If a router generates child addresses, the value of
27803 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
27804 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
27805 </para>
27806 <para>
27807 The idea of <option>address_data</option> is that you can use it to look up a lot of data
27808 for the address once, and then pick out parts of the data later. For example,
27809 you could use a single LDAP lookup to return a string of the form
27810 </para>
27811 <literallayout class="monospaced">
27812 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
27813 </literallayout>
27814 <para>
27815 In the transport you could pick out the mailbox by a setting such as
27816 </para>
27817 <literallayout class="monospaced">
27818 file = ${extract{mailbox}{$address_data}}
27819 </literallayout>
27820 <para>
27821 This makes the configuration file less messy, and also reduces the number of
27822 lookups (though Exim does cache lookups).
27823 </para>
27824 <para>
27825 The <option>address_data</option> facility is also useful as a means of passing information
27826 from one router to another, and from a router to a transport. In addition, if
27827 </para>
27828 <para>
27829 <indexterm role="concept">
27830 <primary><varname>$sender_address_data</varname></primary>
27831 </indexterm>
27832 <indexterm role="concept">
27833 <primary><varname>$address_data</varname></primary>
27834 </indexterm>
27835 When <varname>$address_data</varname> is set by a router when verifying a recipient address
27836 from an ACL, it remains available for use in the rest of the ACL statement.
27837 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
27838 </para>
27839 <para>
27840 <indexterm role="option">
27841 <primary><option>address_test</option></primary>
27842 </indexterm>
27843 </para>
27844 <informaltable frame="all">
27845 <tgroup cols="4" colsep="0" rowsep="0">
27846 <colspec colwidth="8*" align="left"/>
27847 <colspec colwidth="5*" align="center"/>
27848 <colspec colwidth="5*" align="center"/>
27849 <colspec colwidth="6*" align="right"/>
27850 <tbody>
27851 <row>
27852 <entry><option>address_test</option></entry>
27853 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
27854 <entry>Type: <emphasis>boolean</emphasis></entry>
27855 <entry>Default: <emphasis>true</emphasis></entry>
27856 </row>
27857 </tbody>
27858 </tgroup>
27859 </informaltable>
27860 <para>
27861 <indexterm role="concept">
27862 <primary><option>-bt</option> option</primary>
27863 </indexterm>
27864 <indexterm role="concept">
27865 <primary>router</primary>
27866 <secondary>skipping when address testing</secondary>
27867 </indexterm>
27868 If this option is set false, the router is skipped when routing is being tested
27869 by means of the <option>-bt</option> command line option. This can be a convenience when
27870 your first router sends messages to an external scanner, because it saves you
27871 having to set the <quote>already scanned</quote> indicator when testing real address
27872 routing.
27873 </para>
27874 <para>
27875 <indexterm role="option">
27876 <primary><option>cannot_route_message</option></primary>
27877 </indexterm>
27878 </para>
27879 <informaltable frame="all">
27880 <tgroup cols="4" colsep="0" rowsep="0">
27881 <colspec colwidth="8*" align="left"/>
27882 <colspec colwidth="5*" align="center"/>
27883 <colspec colwidth="5*" align="center"/>
27884 <colspec colwidth="6*" align="right"/>
27885 <tbody>
27886 <row>
27887 <entry><option>cannot_route_message</option></entry>
27888 <entry>Use: <emphasis>routers</emphasis></entry>
27889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27890 <entry>Default: <emphasis>unset</emphasis></entry>
27891 </row>
27892 </tbody>
27893 </tgroup>
27894 </informaltable>
27895 <para>
27896 <indexterm role="concept">
27897 <primary>router</primary>
27898 <secondary>customizing <quote>cannot route</quote> message</secondary>
27899 </indexterm>
27900 <indexterm role="concept">
27901 <primary>customizing</primary>
27902 <secondary><quote>cannot route</quote> message</secondary>
27903 </indexterm>
27904 This option specifies a text message that is used when an address cannot be
27905 routed because Exim has run out of routers. The default message is
27906 <quote>Unrouteable address</quote>. This option is useful only on routers that have
27907 <option>more</option> set false, or on the very last router in a configuration, because the
27908 value that is used is taken from the last router that is considered. This
27909 includes a router that is skipped because its preconditions are not met, as
27910 well as a router that declines. For example, using the default configuration,
27911 you could put:
27912 </para>
27913 <literallayout class="monospaced">
27914 cannot_route_message = Remote domain not found in DNS
27915 </literallayout>
27916 <para>
27917 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
27918 and
27919 </para>
27920 <literallayout class="monospaced">
27921 cannot_route_message = Unknown local user
27922 </literallayout>
27923 <para>
27924 on the final router that checks for local users. If string expansion fails for
27925 this option, the default message is used. Unless the expansion failure was
27926 explicitly forced, a message about the failure is written to the main and panic
27927 logs, in addition to the normal message about the routing failure.
27928 </para>
27929 <para>
27930 <indexterm role="option">
27931 <primary><option>caseful_local_part</option></primary>
27932 </indexterm>
27933 </para>
27934 <informaltable frame="all">
27935 <tgroup cols="4" colsep="0" rowsep="0">
27936 <colspec colwidth="8*" align="left"/>
27937 <colspec colwidth="5*" align="center"/>
27938 <colspec colwidth="5*" align="center"/>
27939 <colspec colwidth="6*" align="right"/>
27940 <tbody>
27941 <row>
27942 <entry><option>caseful_local_part</option></entry>
27943 <entry>Use: <emphasis>routers</emphasis></entry>
27944 <entry>Type: <emphasis>boolean</emphasis></entry>
27945 <entry>Default: <emphasis>false</emphasis></entry>
27946 </row>
27947 </tbody>
27948 </tgroup>
27949 </informaltable>
27950 <para>
27951 <indexterm role="concept">
27952 <primary>case of local parts</primary>
27953 </indexterm>
27954 <indexterm role="concept">
27955 <primary>router</primary>
27956 <secondary>case of local parts</secondary>
27957 </indexterm>
27958 By default, routers handle the local parts of addresses in a case-insensitive
27959 manner, though the actual case is preserved for transmission with the message.
27960 If you want the case of letters to be significant in a router, you must set
27961 this option true. For individual router options that contain address or local
27962 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
27963 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
27964 more details.
27965 </para>
27966 <para>
27967 <indexterm role="concept">
27968 <primary><varname>$local_part</varname></primary>
27969 </indexterm>
27970 <indexterm role="concept">
27971 <primary><varname>$original_local_part</varname></primary>
27972 </indexterm>
27973 <indexterm role="concept">
27974 <primary><varname>$parent_local_part</varname></primary>
27975 </indexterm>
27976 The value of the <varname>$local_part</varname> variable is forced to lower case while a
27977 router is running unless <option>caseful_local_part</option> is set. When a router assigns
27978 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
27979 is the same as it was in the router. Similarly, when a router generates child
27980 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
27981 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
27982 </para>
27983 <para>
27984 This option applies to the processing of an address by a router. When a
27985 recipient address is being processed in an ACL, there is a separate <option>control</option>
27986 modifier that can be used to specify case-sensitive processing within the ACL
27987 (see section <xref linkend="SECTcontrols"/>).
27988 </para>
27989 <para>
27990 <indexterm role="option">
27991 <primary><option>check_local_user</option></primary>
27992 </indexterm>
27993 </para>
27994 <informaltable frame="all">
27995 <tgroup cols="4" colsep="0" rowsep="0">
27996 <colspec colwidth="8*" align="left"/>
27997 <colspec colwidth="5*" align="center"/>
27998 <colspec colwidth="5*" align="center"/>
27999 <colspec colwidth="6*" align="right"/>
28000 <tbody>
28001 <row>
28002 <entry><option>check_local_user</option></entry>
28003 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28004 <entry>Type: <emphasis>boolean</emphasis></entry>
28005 <entry>Default: <emphasis>false</emphasis></entry>
28006 </row>
28007 </tbody>
28008 </tgroup>
28009 </informaltable>
28010 <para>
28011 <indexterm role="concept">
28012 <primary>local user</primary>
28013 <secondary>checking in router</secondary>
28014 </indexterm>
28015 <indexterm role="concept">
28016 <primary>router</primary>
28017 <secondary>checking for local user</secondary>
28018 </indexterm>
28019 <indexterm role="concept">
28020 <primary><filename>/etc/passwd</filename></primary>
28021 </indexterm>
28022 <indexterm role="concept">
28023 <primary><varname>$home</varname></primary>
28024 </indexterm>
28025 When this option is true, Exim checks that the local part of the recipient
28026 address (with affixes removed if relevant) is the name of an account on the
28027 local system. The check is done by calling the <function>getpwnam()</function> function rather
28028 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
28029 holding password data (such as NIS) are supported. If the local part is a local
28030 user, <varname>$home</varname> is set from the password data, and can be tested in other
28031 preconditions that are evaluated after this one (the order of evaluation is
28032 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
28033 overridden by <option>router_home_directory</option>. If the local part is not a local user,
28034 the router is skipped.
28035 </para>
28036 <para>
28037 If you want to check that the local part is either the name of a local user
28038 or matches something else, you cannot combine <option>check_local_user</option> with a
28039 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
28040 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
28041 setting to achieve this. For example:
28042 </para>
28043 <literallayout class="monospaced">
28044 local_parts = passwd;$local_part : lsearch;/etc/other/users
28045 </literallayout>
28046 <para>
28047 Note, however, that the side effects of <option>check_local_user</option> (such as setting
28048 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
28049 <option>local_parts</option> (or any other) precondition.
28050 </para>
28051 <para>
28052 <indexterm role="option">
28053 <primary><option>condition</option></primary>
28054 </indexterm>
28055 </para>
28056 <informaltable frame="all">
28057 <tgroup cols="4" colsep="0" rowsep="0">
28058 <colspec colwidth="8*" align="left"/>
28059 <colspec colwidth="5*" align="center"/>
28060 <colspec colwidth="5*" align="center"/>
28061 <colspec colwidth="6*" align="right"/>
28062 <tbody>
28063 <row>
28064 <entry><option>condition</option></entry>
28065 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28066 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28067 <entry>Default: <emphasis>unset</emphasis></entry>
28068 </row>
28069 </tbody>
28070 </tgroup>
28071 </informaltable>
28072 <para>
28073 <indexterm role="concept">
28074 <primary>router</primary>
28075 <secondary>customized precondition</secondary>
28076 </indexterm>
28077 This option specifies a general precondition test that has to succeed for the
28078 router to be called. The <option>condition</option> option is the last precondition to be
28079 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
28080 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
28081 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
28082 router is skipped, and the address is offered to the next one.
28083 </para>
28084 <para>
28085 If the result is any other value, the router is run (as this is the last
28086 precondition to be evaluated, all the other preconditions must be true).
28087 </para>
28088 <para>
28089 The <option>condition</option> option provides a means of applying custom conditions to the
28090 running of routers. Note that in the case of a simple conditional expansion,
28091 the default expansion values are exactly what is wanted. For example:
28092 </para>
28093 <literallayout class="monospaced">
28094 condition = ${if &gt;{$message_age}{600}}
28095 </literallayout>
28096 <para>
28097 Because of the default behaviour of the string expansion, this is equivalent to
28098 </para>
28099 <literallayout class="monospaced">
28100 condition = ${if &gt;{$message_age}{600}{true}{}}
28101 </literallayout>
28102 <para>
28103 If the expansion fails (other than forced failure) delivery is deferred. Some
28104 of the other precondition options are common special cases that could in fact
28105 be specified using <option>condition</option>.
28106 </para>
28107 <para>
28108 <indexterm role="option">
28109 <primary><option>debug_print</option></primary>
28110 </indexterm>
28111 </para>
28112 <informaltable frame="all">
28113 <tgroup cols="4" colsep="0" rowsep="0">
28114 <colspec colwidth="8*" align="left"/>
28115 <colspec colwidth="5*" align="center"/>
28116 <colspec colwidth="5*" align="center"/>
28117 <colspec colwidth="6*" align="right"/>
28118 <tbody>
28119 <row>
28120 <entry><option>debug_print</option></entry>
28121 <entry>Use: <emphasis>routers</emphasis></entry>
28122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28123 <entry>Default: <emphasis>unset</emphasis></entry>
28124 </row>
28125 </tbody>
28126 </tgroup>
28127 </informaltable>
28128 <para>
28129 <indexterm role="concept">
28130 <primary>testing</primary>
28131 <secondary>variables in drivers</secondary>
28132 </indexterm>
28133 If this option is set and debugging is enabled (see the <option>-d</option> command line
28134 option), the string is expanded and included in the debugging output.
28135 If expansion of the string fails, the error message is written to the debugging
28136 output, and Exim carries on processing.
28137 This option is provided to help with checking out the values of variables and
28138 so on when debugging router configurations. For example, if a <option>condition</option>
28139 option appears not to be working, <option>debug_print</option> can be used to output the
28140 variables it references. The output happens after checks for <option>domains</option>,
28141 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
28142 are tested. A newline is added to the text if it does not end with one.
28143 </para>
28144 <para>
28145 <indexterm role="option">
28146 <primary><option>disable_logging</option></primary>
28147 </indexterm>
28148 </para>
28149 <informaltable frame="all">
28150 <tgroup cols="4" colsep="0" rowsep="0">
28151 <colspec colwidth="8*" align="left"/>
28152 <colspec colwidth="5*" align="center"/>
28153 <colspec colwidth="5*" align="center"/>
28154 <colspec colwidth="6*" align="right"/>
28155 <tbody>
28156 <row>
28157 <entry><option>disable_logging</option></entry>
28158 <entry>Use: <emphasis>routers</emphasis></entry>
28159 <entry>Type: <emphasis>boolean</emphasis></entry>
28160 <entry>Default: <emphasis>false</emphasis></entry>
28161 </row>
28162 </tbody>
28163 </tgroup>
28164 </informaltable>
28165 <para>
28166 If this option is set true, nothing is logged for any routing errors
28167 or for any deliveries caused by this router. You should not set this option
28168 unless you really, really know what you are doing. See also the generic
28169 transport option of the same name.
28170 </para>
28171 <para>
28172 <indexterm role="option">
28173 <primary><option>domains</option></primary>
28174 </indexterm>
28175 </para>
28176 <informaltable frame="all">
28177 <tgroup cols="4" colsep="0" rowsep="0">
28178 <colspec colwidth="8*" align="left"/>
28179 <colspec colwidth="5*" align="center"/>
28180 <colspec colwidth="5*" align="center"/>
28181 <colspec colwidth="6*" align="right"/>
28182 <tbody>
28183 <row>
28184 <entry><option>domains</option></entry>
28185 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28186 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28187 <entry>Default: <emphasis>unset</emphasis></entry>
28188 </row>
28189 </tbody>
28190 </tgroup>
28191 </informaltable>
28192 <para>
28193 <indexterm role="concept">
28194 <primary>router</primary>
28195 <secondary>restricting to specific domains</secondary>
28196 </indexterm>
28197 <indexterm role="concept">
28198 <primary><varname>$domain_data</varname></primary>
28199 </indexterm>
28200 If this option is set, the router is skipped unless the current domain matches
28201 the list. If the match is achieved by means of a file lookup, the data that the
28202 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
28203 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
28204 a list of the order in which preconditions are evaluated.
28205 </para>
28206 <para>
28207 <indexterm role="option">
28208 <primary><option>driver</option></primary>
28209 </indexterm>
28210 </para>
28211 <informaltable frame="all">
28212 <tgroup cols="4" colsep="0" rowsep="0">
28213 <colspec colwidth="8*" align="left"/>
28214 <colspec colwidth="5*" align="center"/>
28215 <colspec colwidth="5*" align="center"/>
28216 <colspec colwidth="6*" align="right"/>
28217 <tbody>
28218 <row>
28219 <entry><option>driver</option></entry>
28220 <entry>Use: <emphasis>routers</emphasis></entry>
28221 <entry>Type: <emphasis>string</emphasis></entry>
28222 <entry>Default: <emphasis>unset</emphasis></entry>
28223 </row>
28224 </tbody>
28225 </tgroup>
28226 </informaltable>
28227 <para>
28228 This option must always be set. It specifies which of the available routers is
28229 to be used.
28230 </para>
28231 <para>
28232 <indexterm role="option">
28233 <primary><option>errors_to</option></primary>
28234 </indexterm>
28235 </para>
28236 <informaltable frame="all">
28237 <tgroup cols="4" colsep="0" rowsep="0">
28238 <colspec colwidth="8*" align="left"/>
28239 <colspec colwidth="5*" align="center"/>
28240 <colspec colwidth="5*" align="center"/>
28241 <colspec colwidth="6*" align="right"/>
28242 <tbody>
28243 <row>
28244 <entry><option>errors_to</option></entry>
28245 <entry>Use: <emphasis>routers</emphasis></entry>
28246 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28247 <entry>Default: <emphasis>unset</emphasis></entry>
28248 </row>
28249 </tbody>
28250 </tgroup>
28251 </informaltable>
28252 <para>
28253 <indexterm role="concept">
28254 <primary>envelope sender</primary>
28255 </indexterm>
28256 <indexterm role="concept">
28257 <primary>router</primary>
28258 <secondary>changing address for errors</secondary>
28259 </indexterm>
28260 If a router successfully handles an address, it may assign the address to a
28261 transport for delivery or it may generate child addresses. In both cases, if
28262 there is a delivery problem during later processing, the resulting bounce
28263 message is sent to the address that results from expanding this string,
28264 provided that the address verifies successfully. The <option>errors_to</option> option is
28265 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
28266 </para>
28267 <para>
28268 The <option>errors_to</option> setting associated with an address can be overridden if it
28269 subsequently passes through other routers that have their own <option>errors_to</option>
28270 settings, or if the message is delivered by a transport with a <option>return_path</option>
28271 setting.
28272 </para>
28273 <para>
28274 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
28275 the expansion fails to verify, the errors address associated with the incoming
28276 address is used. At top level, this is the envelope sender. A non-forced
28277 expansion failure causes delivery to be deferred.
28278 </para>
28279 <para>
28280 If an address for which <option>errors_to</option> has been set ends up being delivered over
28281 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
28282 any bounces that are generated by other MTAs on the delivery route are also
28283 sent there. You can set <option>errors_to</option> to the empty string by either of these
28284 settings:
28285 </para>
28286 <literallayout class="monospaced">
28287 errors_to =
28288 errors_to = ""
28289 </literallayout>
28290 <para>
28291 An expansion item that yields an empty string has the same effect. If you do
28292 this, a locally detected delivery error for addresses processed by this router
28293 no longer gives rise to a bounce message; the error is discarded. If the
28294 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
28295 overridden by the <option>return_path</option> option on the transport.
28296 </para>
28297 <para>
28298 <indexterm role="concept">
28299 <primary><varname>$address_data</varname></primary>
28300 </indexterm>
28301 If for some reason you want to discard local errors, but use a non-empty
28302 MAIL command for remote delivery, you can preserve the original return
28303 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
28304 setting <option>return_path</option>.
28305 </para>
28306 <para>
28307 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
28308 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
28309 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
28310 </para>
28311 <para>
28312 <indexterm role="option">
28313 <primary><option>expn</option></primary>
28314 </indexterm>
28315 </para>
28316 <informaltable frame="all">
28317 <tgroup cols="4" colsep="0" rowsep="0">
28318 <colspec colwidth="8*" align="left"/>
28319 <colspec colwidth="5*" align="center"/>
28320 <colspec colwidth="5*" align="center"/>
28321 <colspec colwidth="6*" align="right"/>
28322 <tbody>
28323 <row>
28324 <entry><option>expn</option></entry>
28325 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28326 <entry>Type: <emphasis>boolean</emphasis></entry>
28327 <entry>Default: <emphasis>true</emphasis></entry>
28328 </row>
28329 </tbody>
28330 </tgroup>
28331 </informaltable>
28332 <para>
28333 <indexterm role="concept">
28334 <primary>address</primary>
28335 <secondary>testing</secondary>
28336 </indexterm>
28337 <indexterm role="concept">
28338 <primary>testing</primary>
28339 <secondary>addresses</secondary>
28340 </indexterm>
28341 <indexterm role="concept">
28342 <primary>EXPN</primary>
28343 <secondary>router skipping</secondary>
28344 </indexterm>
28345 <indexterm role="concept">
28346 <primary>router</primary>
28347 <secondary>skipping for EXPN</secondary>
28348 </indexterm>
28349 If this option is turned off, the router is skipped when testing an address
28350 as a result of processing an SMTP EXPN command. You might, for example,
28351 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
28352 on for the system alias file.
28353 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28354 are evaluated.
28355 </para>
28356 <para>
28357 The use of the SMTP EXPN command is controlled by an ACL (see chapter
28358 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
28359 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
28360 </para>
28361 <para>
28362 <indexterm role="option">
28363 <primary><option>fail_verify</option></primary>
28364 </indexterm>
28365 </para>
28366 <informaltable frame="all">
28367 <tgroup cols="4" colsep="0" rowsep="0">
28368 <colspec colwidth="8*" align="left"/>
28369 <colspec colwidth="5*" align="center"/>
28370 <colspec colwidth="5*" align="center"/>
28371 <colspec colwidth="6*" align="right"/>
28372 <tbody>
28373 <row>
28374 <entry><option>fail_verify</option></entry>
28375 <entry>Use: <emphasis>routers</emphasis></entry>
28376 <entry>Type: <emphasis>boolean</emphasis></entry>
28377 <entry>Default: <emphasis>false</emphasis></entry>
28378 </row>
28379 </tbody>
28380 </tgroup>
28381 </informaltable>
28382 <para>
28383 <indexterm role="concept">
28384 <primary>router</primary>
28385 <secondary>forcing verification failure</secondary>
28386 </indexterm>
28387 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
28388 <option>fail_verify_recipient</option> to the same value.
28389 </para>
28390 <para>
28391 <indexterm role="option">
28392 <primary><option>fail_verify_recipient</option></primary>
28393 </indexterm>
28394 </para>
28395 <informaltable frame="all">
28396 <tgroup cols="4" colsep="0" rowsep="0">
28397 <colspec colwidth="8*" align="left"/>
28398 <colspec colwidth="5*" align="center"/>
28399 <colspec colwidth="5*" align="center"/>
28400 <colspec colwidth="6*" align="right"/>
28401 <tbody>
28402 <row>
28403 <entry><option>fail_verify_recipient</option></entry>
28404 <entry>Use: <emphasis>routers</emphasis></entry>
28405 <entry>Type: <emphasis>boolean</emphasis></entry>
28406 <entry>Default: <emphasis>false</emphasis></entry>
28407 </row>
28408 </tbody>
28409 </tgroup>
28410 </informaltable>
28411 <para>
28412 If this option is true and an address is accepted by this router when
28413 verifying a recipient, verification fails.
28414 </para>
28415 <para>
28416 <indexterm role="option">
28417 <primary><option>fail_verify_sender</option></primary>
28418 </indexterm>
28419 </para>
28420 <informaltable frame="all">
28421 <tgroup cols="4" colsep="0" rowsep="0">
28422 <colspec colwidth="8*" align="left"/>
28423 <colspec colwidth="5*" align="center"/>
28424 <colspec colwidth="5*" align="center"/>
28425 <colspec colwidth="6*" align="right"/>
28426 <tbody>
28427 <row>
28428 <entry><option>fail_verify_sender</option></entry>
28429 <entry>Use: <emphasis>routers</emphasis></entry>
28430 <entry>Type: <emphasis>boolean</emphasis></entry>
28431 <entry>Default: <emphasis>false</emphasis></entry>
28432 </row>
28433 </tbody>
28434 </tgroup>
28435 </informaltable>
28436 <para>
28437 If this option is true and an address is accepted by this router when
28438 verifying a sender, verification fails.
28439 </para>
28440 <para>
28441 <indexterm role="option">
28442 <primary><option>fallback_hosts</option></primary>
28443 </indexterm>
28444 </para>
28445 <informaltable frame="all">
28446 <tgroup cols="4" colsep="0" rowsep="0">
28447 <colspec colwidth="8*" align="left"/>
28448 <colspec colwidth="5*" align="center"/>
28449 <colspec colwidth="5*" align="center"/>
28450 <colspec colwidth="6*" align="right"/>
28451 <tbody>
28452 <row>
28453 <entry><option>fallback_hosts</option></entry>
28454 <entry>Use: <emphasis>routers</emphasis></entry>
28455 <entry>Type: <emphasis>string list</emphasis></entry>
28456 <entry>Default: <emphasis>unset</emphasis></entry>
28457 </row>
28458 </tbody>
28459 </tgroup>
28460 </informaltable>
28461 <para>
28462 <indexterm role="concept">
28463 <primary>router</primary>
28464 <secondary>fallback hosts</secondary>
28465 </indexterm>
28466 <indexterm role="concept">
28467 <primary>fallback</primary>
28468 <secondary>hosts specified on router</secondary>
28469 </indexterm>
28470 String expansion is not applied to this option. The argument must be a
28471 colon-separated list of host names or IP addresses. The list separator can be
28472 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
28473 each name or address. In fact, the format of each item is exactly the same as
28474 defined for the list of hosts in a <command>manualroute</command> router (see section
28475 <xref linkend="SECTformatonehostitem"/>).
28476 </para>
28477 <para>
28478 If a router queues an address for a remote transport, this host list is
28479 associated with the address, and used instead of the transport&#x2019;s fallback host
28480 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
28481 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
28482 transport for further details.
28483 </para>
28484 <para>
28485 <indexterm role="option">
28486 <primary><option>group</option></primary>
28487 </indexterm>
28488 </para>
28489 <informaltable frame="all">
28490 <tgroup cols="4" colsep="0" rowsep="0">
28491 <colspec colwidth="8*" align="left"/>
28492 <colspec colwidth="5*" align="center"/>
28493 <colspec colwidth="5*" align="center"/>
28494 <colspec colwidth="6*" align="right"/>
28495 <tbody>
28496 <row>
28497 <entry><option>group</option></entry>
28498 <entry>Use: <emphasis>routers</emphasis></entry>
28499 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28500 <entry>Default: <emphasis>see below</emphasis></entry>
28501 </row>
28502 </tbody>
28503 </tgroup>
28504 </informaltable>
28505 <para>
28506 <indexterm role="concept">
28507 <primary>gid (group id)</primary>
28508 <secondary>local delivery</secondary>
28509 </indexterm>
28510 <indexterm role="concept">
28511 <primary>local transports</primary>
28512 <secondary>uid and gid</secondary>
28513 </indexterm>
28514 <indexterm role="concept">
28515 <primary>transport</primary>
28516 <secondary>local</secondary>
28517 </indexterm>
28518 <indexterm role="concept">
28519 <primary>router</primary>
28520 <secondary>setting group</secondary>
28521 </indexterm>
28522 When a router queues an address for a transport, and the transport does not
28523 specify a group, the group given here is used when running the delivery
28524 process.
28525 The group may be specified numerically or by name. If expansion fails, the
28526 error is logged and delivery is deferred.
28527 The default is unset, unless <option>check_local_user</option> is set, when the default
28528 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
28529 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28530 </para>
28531 <para>
28532 <indexterm role="option">
28533 <primary><option>headers_add</option></primary>
28534 </indexterm>
28535 </para>
28536 <informaltable frame="all">
28537 <tgroup cols="4" colsep="0" rowsep="0">
28538 <colspec colwidth="8*" align="left"/>
28539 <colspec colwidth="5*" align="center"/>
28540 <colspec colwidth="5*" align="center"/>
28541 <colspec colwidth="6*" align="right"/>
28542 <tbody>
28543 <row>
28544 <entry><option>headers_add</option></entry>
28545 <entry>Use: <emphasis>routers</emphasis></entry>
28546 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28547 <entry>Default: <emphasis>unset</emphasis></entry>
28548 </row>
28549 </tbody>
28550 </tgroup>
28551 </informaltable>
28552 <para>
28553 <indexterm role="concept">
28554 <primary>header lines</primary>
28555 <secondary>adding</secondary>
28556 </indexterm>
28557 <indexterm role="concept">
28558 <primary>router</primary>
28559 <secondary>adding header lines</secondary>
28560 </indexterm>
28561 This option specifies a string of text that is expanded at routing time, and
28562 associated with any addresses that are accepted by the router. However, this
28563 option has no effect when an address is just being verified. The way in which
28564 the text is used to add header lines at transport time is described in section
28565 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28566 message is in the process of being transported. This means that references to
28567 header lines in string expansions in the transport&#x2019;s configuration do not
28568 <quote>see</quote> the added header lines.
28569 </para>
28570 <para>
28571 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28572 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28573 the expansion is forced to fail, the option has no effect. Other expansion
28574 failures are treated as configuration errors.
28575 </para>
28576 <para>
28577 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28578 router that has the <option>one_time</option> option set.
28579 </para>
28580 <para>
28581 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28582 additions are deleted when the address is passed on to subsequent routers.
28583 </para>
28584 <para>
28585 <indexterm role="option">
28586 <primary><option>headers_remove</option></primary>
28587 </indexterm>
28588 </para>
28589 <informaltable frame="all">
28590 <tgroup cols="4" colsep="0" rowsep="0">
28591 <colspec colwidth="8*" align="left"/>
28592 <colspec colwidth="5*" align="center"/>
28593 <colspec colwidth="5*" align="center"/>
28594 <colspec colwidth="6*" align="right"/>
28595 <tbody>
28596 <row>
28597 <entry><option>headers_remove</option></entry>
28598 <entry>Use: <emphasis>routers</emphasis></entry>
28599 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28600 <entry>Default: <emphasis>unset</emphasis></entry>
28601 </row>
28602 </tbody>
28603 </tgroup>
28604 </informaltable>
28605 <para>
28606 <indexterm role="concept">
28607 <primary>header lines</primary>
28608 <secondary>removing</secondary>
28609 </indexterm>
28610 <indexterm role="concept">
28611 <primary>router</primary>
28612 <secondary>removing header lines</secondary>
28613 </indexterm>
28614 This option specifies a string of text that is expanded at routing time, and
28615 associated with any addresses that are accepted by the router. However, this
28616 option has no effect when an address is just being verified. The way in which
28617 the text is used to remove header lines at transport time is described in
28618 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
28619 the message is in the process of being transported. This means that references
28620 to header lines in string expansions in the transport&#x2019;s configuration still
28621 <quote>see</quote> the original header lines.
28622 </para>
28623 <para>
28624 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
28625 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
28626 the option has no effect. Other expansion failures are treated as configuration
28627 errors.
28628 </para>
28629 <para>
28630 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
28631 router that has the <option>one_time</option> option set.
28632 </para>
28633 <para>
28634 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28635 removal requests are deleted when the address is passed on to subsequent
28636 routers.
28637 </para>
28638 <para>
28639 <indexterm role="option">
28640 <primary><option>ignore_target_hosts</option></primary>
28641 </indexterm>
28642 </para>
28643 <informaltable frame="all">
28644 <tgroup cols="4" colsep="0" rowsep="0">
28645 <colspec colwidth="8*" align="left"/>
28646 <colspec colwidth="5*" align="center"/>
28647 <colspec colwidth="5*" align="center"/>
28648 <colspec colwidth="6*" align="right"/>
28649 <tbody>
28650 <row>
28651 <entry><option>ignore_target_hosts</option></entry>
28652 <entry>Use: <emphasis>routers</emphasis></entry>
28653 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28654 <entry>Default: <emphasis>unset</emphasis></entry>
28655 </row>
28656 </tbody>
28657 </tgroup>
28658 </informaltable>
28659 <para>
28660 <indexterm role="concept">
28661 <primary>IP address</primary>
28662 <secondary>discarding</secondary>
28663 </indexterm>
28664 <indexterm role="concept">
28665 <primary>router</primary>
28666 <secondary>discarding IP addresses</secondary>
28667 </indexterm>
28668 Although this option is a host list, it should normally contain IP address
28669 entries rather than names. If any host that is looked up by the router has an
28670 IP address that matches an item in this list, Exim behaves as if that IP
28671 address did not exist. This option allows you to cope with rogue DNS entries
28672 like
28673 </para>
28674 <literallayout class="monospaced">
28675 remote.domain.example.  A  127.0.0.1
28676 </literallayout>
28677 <para>
28678 by setting
28679 </para>
28680 <literallayout class="monospaced">
28681 ignore_target_hosts = 127.0.0.1
28682 </literallayout>
28683 <para>
28684 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
28685 discarded in this way, the router declines. In a conventional configuration, an
28686 attempt to mail to such a domain would normally provoke the <quote>unrouteable
28687 domain</quote> error, and an attempt to verify an address in the domain would fail.
28688 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
28689 router declines if presented with one of the listed addresses.
28690 </para>
28691 <para>
28692 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
28693 means of the first or the second of the following settings, respectively:
28694 </para>
28695 <literallayout class="monospaced">
28696 ignore_target_hosts = 0.0.0.0/0
28697 ignore_target_hosts = &lt;; 0::0/0
28698 </literallayout>
28699 <para>
28700 The pattern in the first line matches all IPv4 addresses, whereas the pattern
28701 in the second line matches all IPv6 addresses.
28702 </para>
28703 <para>
28704 This option may also be useful for ignoring link-local and site-local IPv6
28705 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
28706 is expanded before use as a list, it is possible to make it dependent on the
28707 domain that is being routed.
28708 </para>
28709 <para>
28710 <indexterm role="concept">
28711 <primary><varname>$host_address</varname></primary>
28712 </indexterm>
28713 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
28714 checked.
28715 </para>
28716 <para>
28717 <indexterm role="option">
28718 <primary><option>initgroups</option></primary>
28719 </indexterm>
28720 </para>
28721 <informaltable frame="all">
28722 <tgroup cols="4" colsep="0" rowsep="0">
28723 <colspec colwidth="8*" align="left"/>
28724 <colspec colwidth="5*" align="center"/>
28725 <colspec colwidth="5*" align="center"/>
28726 <colspec colwidth="6*" align="right"/>
28727 <tbody>
28728 <row>
28729 <entry><option>initgroups</option></entry>
28730 <entry>Use: <emphasis>routers</emphasis></entry>
28731 <entry>Type: <emphasis>boolean</emphasis></entry>
28732 <entry>Default: <emphasis>false</emphasis></entry>
28733 </row>
28734 </tbody>
28735 </tgroup>
28736 </informaltable>
28737 <para>
28738 <indexterm role="concept">
28739 <primary>additional groups</primary>
28740 </indexterm>
28741 <indexterm role="concept">
28742 <primary>groups</primary>
28743 <secondary>additional</secondary>
28744 </indexterm>
28745 <indexterm role="concept">
28746 <primary>local transports</primary>
28747 <secondary>uid and gid</secondary>
28748 </indexterm>
28749 <indexterm role="concept">
28750 <primary>transport</primary>
28751 <secondary>local</secondary>
28752 </indexterm>
28753 If the router queues an address for a transport, and this option is true, and
28754 the uid supplied by the router is not overridden by the transport, the
28755 <function>initgroups()</function> function is called when running the transport to ensure that
28756 any additional groups associated with the uid are set up. See also <option>group</option>
28757 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28758 </para>
28759 <para>
28760 <indexterm role="option">
28761 <primary><option>local_part_prefix</option></primary>
28762 </indexterm>
28763 </para>
28764 <informaltable frame="all">
28765 <tgroup cols="4" colsep="0" rowsep="0">
28766 <colspec colwidth="8*" align="left"/>
28767 <colspec colwidth="5*" align="center"/>
28768 <colspec colwidth="5*" align="center"/>
28769 <colspec colwidth="6*" align="right"/>
28770 <tbody>
28771 <row>
28772 <entry><option>local_part_prefix</option></entry>
28773 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28774 <entry>Type: <emphasis>string list</emphasis></entry>
28775 <entry>Default: <emphasis>unset</emphasis></entry>
28776 </row>
28777 </tbody>
28778 </tgroup>
28779 </informaltable>
28780 <para>
28781 <indexterm role="concept">
28782 <primary>router</primary>
28783 <secondary>prefix for local part</secondary>
28784 </indexterm>
28785 <indexterm role="concept">
28786 <primary>prefix</primary>
28787 <secondary>for local part; used in router</secondary>
28788 </indexterm>
28789 If this option is set, the router is skipped unless the local part starts with
28790 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
28791 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
28792 evaluated.
28793 </para>
28794 <para>
28795 The list is scanned from left to right, and the first prefix that matches is
28796 used. A limited form of wildcard is available; if the prefix begins with an
28797 asterisk, it matches the longest possible sequence of arbitrary characters at
28798 the start of the local part. An asterisk should therefore always be followed by
28799 some character that does not occur in normal local parts.
28800 <indexterm role="concept">
28801 <primary>multiple mailboxes</primary>
28802 </indexterm>
28803 <indexterm role="concept">
28804 <primary>mailbox</primary>
28805 <secondary>multiple</secondary>
28806 </indexterm>
28807 Wildcarding can be used to set up multiple user mailboxes, as described in
28808 section <xref linkend="SECTmulbox"/>.
28809 </para>
28810 <para>
28811 <indexterm role="concept">
28812 <primary><varname>$local_part</varname></primary>
28813 </indexterm>
28814 <indexterm role="concept">
28815 <primary><varname>$local_part_prefix</varname></primary>
28816 </indexterm>
28817 During the testing of the <option>local_parts</option> option, and while the router is
28818 running, the prefix is removed from the local part, and is available in the
28819 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
28820 the router accepts the address, this remains true during subsequent delivery by
28821 a transport. In particular, the local part that is transmitted in the RCPT
28822 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
28823 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
28824 the relevant transport.
28825 </para>
28826 <para>
28827 When an address is being verified, <option>local_part_prefix</option> affects only the
28828 behaviour of the router. If the callout feature of verification is in use, this
28829 means that the full address, including the prefix, will be used during the
28830 callout.
28831 </para>
28832 <para>
28833 The prefix facility is commonly used to handle local parts of the form
28834 <option>owner-something</option>. Another common use is to support local parts of the form
28835 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
28836 to tell a user their forwarding is broken &ndash; by placing a router like this one
28837 immediately before the router that handles <filename>.forward</filename> files:
28838 </para>
28839 <literallayout class="monospaced">
28840 real_localuser:
28841   driver = accept
28842   local_part_prefix = real-
28843   check_local_user
28844   transport = local_delivery
28845 </literallayout>
28846 <para>
28847 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
28848 both conditions must be met if not optional. Care must be taken if wildcards
28849 are used in both a prefix and a suffix on the same router. Different
28850 separator characters must be used to avoid ambiguity.
28851 </para>
28852 <para>
28853 <indexterm role="option">
28854 <primary><option>local_part_prefix_optional</option></primary>
28855 </indexterm>
28856 </para>
28857 <informaltable frame="all">
28858 <tgroup cols="4" colsep="0" rowsep="0">
28859 <colspec colwidth="8*" align="left"/>
28860 <colspec colwidth="5*" align="center"/>
28861 <colspec colwidth="5*" align="center"/>
28862 <colspec colwidth="6*" align="right"/>
28863 <tbody>
28864 <row>
28865 <entry><option>local_part_prefix_optional</option></entry>
28866 <entry>Use: <emphasis>routers</emphasis></entry>
28867 <entry>Type: <emphasis>boolean</emphasis></entry>
28868 <entry>Default: <emphasis>false</emphasis></entry>
28869 </row>
28870 </tbody>
28871 </tgroup>
28872 </informaltable>
28873 <para>
28874 See <option>local_part_prefix</option> above.
28875 </para>
28876 <para>
28877 <indexterm role="option">
28878 <primary><option>local_part_suffix</option></primary>
28879 </indexterm>
28880 </para>
28881 <informaltable frame="all">
28882 <tgroup cols="4" colsep="0" rowsep="0">
28883 <colspec colwidth="8*" align="left"/>
28884 <colspec colwidth="5*" align="center"/>
28885 <colspec colwidth="5*" align="center"/>
28886 <colspec colwidth="6*" align="right"/>
28887 <tbody>
28888 <row>
28889 <entry><option>local_part_suffix</option></entry>
28890 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28891 <entry>Type: <emphasis>string list</emphasis></entry>
28892 <entry>Default: <emphasis>unset</emphasis></entry>
28893 </row>
28894 </tbody>
28895 </tgroup>
28896 </informaltable>
28897 <para>
28898 <indexterm role="concept">
28899 <primary>router</primary>
28900 <secondary>suffix for local part</secondary>
28901 </indexterm>
28902 <indexterm role="concept">
28903 <primary>suffix for local part</primary>
28904 <secondary>used in router</secondary>
28905 </indexterm>
28906 This option operates in the same way as <option>local_part_prefix</option>, except that the
28907 local part must end (rather than start) with the given string, the
28908 <option>local_part_suffix_optional</option> option determines whether the suffix is
28909 mandatory, and the wildcard * character, if present, must be the last
28910 character of the suffix. This option facility is commonly used to handle local
28911 parts of the form <option>something-request</option> and multiple user mailboxes of the form
28912 <option>username-foo</option>.
28913 </para>
28914 <para>
28915 <indexterm role="option">
28916 <primary><option>local_part_suffix_optional</option></primary>
28917 </indexterm>
28918 </para>
28919 <informaltable frame="all">
28920 <tgroup cols="4" colsep="0" rowsep="0">
28921 <colspec colwidth="8*" align="left"/>
28922 <colspec colwidth="5*" align="center"/>
28923 <colspec colwidth="5*" align="center"/>
28924 <colspec colwidth="6*" align="right"/>
28925 <tbody>
28926 <row>
28927 <entry><option>local_part_suffix_optional</option></entry>
28928 <entry>Use: <emphasis>routers</emphasis></entry>
28929 <entry>Type: <emphasis>boolean</emphasis></entry>
28930 <entry>Default: <emphasis>false</emphasis></entry>
28931 </row>
28932 </tbody>
28933 </tgroup>
28934 </informaltable>
28935 <para>
28936 See <option>local_part_suffix</option> above.
28937 </para>
28938 <para>
28939 <indexterm role="option">
28940 <primary><option>local_parts</option></primary>
28941 </indexterm>
28942 </para>
28943 <informaltable frame="all">
28944 <tgroup cols="4" colsep="0" rowsep="0">
28945 <colspec colwidth="8*" align="left"/>
28946 <colspec colwidth="5*" align="center"/>
28947 <colspec colwidth="5*" align="center"/>
28948 <colspec colwidth="6*" align="right"/>
28949 <tbody>
28950 <row>
28951 <entry><option>local_parts</option></entry>
28952 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28953 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
28954 <entry>Default: <emphasis>unset</emphasis></entry>
28955 </row>
28956 </tbody>
28957 </tgroup>
28958 </informaltable>
28959 <para>
28960 <indexterm role="concept">
28961 <primary>router</primary>
28962 <secondary>restricting to specific local parts</secondary>
28963 </indexterm>
28964 <indexterm role="concept">
28965 <primary>local part</primary>
28966 <secondary>checking in router</secondary>
28967 </indexterm>
28968 The router is run only if the local part of the address matches the list.
28969 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28970 are evaluated, and
28971 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
28972 string is expanded, it is possible to make it depend on the domain, for
28973 example:
28974 </para>
28975 <literallayout class="monospaced">
28976 local_parts = dbm;/usr/local/specials/$domain
28977 </literallayout>
28978 <para>
28979 <indexterm role="concept">
28980 <primary><varname>$local_part_data</varname></primary>
28981 </indexterm>
28982 If the match is achieved by a lookup, the data that the lookup returned
28983 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
28984 expansions of the router&#x2019;s private options. You might use this option, for
28985 example, if you have a large number of local virtual domains, and you want to
28986 send all postmaster mail to the same place without having to set up an alias in
28987 each virtual domain:
28988 </para>
28989 <literallayout class="monospaced">
28990 postmaster:
28991   driver = redirect
28992   local_parts = postmaster
28993   data = postmaster@real.domain.example
28994 </literallayout>
28995 <para>
28996 <indexterm role="option">
28997 <primary><option>log_as_local</option></primary>
28998 </indexterm>
28999 </para>
29000 <informaltable frame="all">
29001 <tgroup cols="4" colsep="0" rowsep="0">
29002 <colspec colwidth="8*" align="left"/>
29003 <colspec colwidth="5*" align="center"/>
29004 <colspec colwidth="5*" align="center"/>
29005 <colspec colwidth="6*" align="right"/>
29006 <tbody>
29007 <row>
29008 <entry><option>log_as_local</option></entry>
29009 <entry>Use: <emphasis>routers</emphasis></entry>
29010 <entry>Type: <emphasis>boolean</emphasis></entry>
29011 <entry>Default: <emphasis>see below</emphasis></entry>
29012 </row>
29013 </tbody>
29014 </tgroup>
29015 </informaltable>
29016 <para>
29017 <indexterm role="concept">
29018 <primary>log</primary>
29019 <secondary>delivery line</secondary>
29020 </indexterm>
29021 <indexterm role="concept">
29022 <primary>delivery</primary>
29023 <secondary>log line format</secondary>
29024 </indexterm>
29025 Exim has two logging styles for delivery, the idea being to make local
29026 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
29027 recipient address is given just as the local part, without a domain. The use of
29028 this style is controlled by this option. It defaults to true for the <command>accept</command>
29029 router, and false for all the others. This option applies only when a
29030 router assigns an address to a transport. It has no effect on routers that
29031 redirect addresses.
29032 </para>
29033 <para>
29034 <indexterm role="option">
29035 <primary><option>more</option></primary>
29036 </indexterm>
29037 </para>
29038 <informaltable frame="all">
29039 <tgroup cols="4" colsep="0" rowsep="0">
29040 <colspec colwidth="8*" align="left"/>
29041 <colspec colwidth="5*" align="center"/>
29042 <colspec colwidth="5*" align="center"/>
29043 <colspec colwidth="6*" align="right"/>
29044 <tbody>
29045 <row>
29046 <entry><option>more</option></entry>
29047 <entry>Use: <emphasis>routers</emphasis></entry>
29048 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29049 <entry>Default: <emphasis>true</emphasis></entry>
29050 </row>
29051 </tbody>
29052 </tgroup>
29053 </informaltable>
29054 <para>
29055 The result of string expansion for this option must be a valid boolean value,
29056 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29057 result causes an error, and delivery is deferred. If the expansion is forced to
29058 fail, the default value for the option (true) is used. Other failures cause
29059 delivery to be deferred.
29060 </para>
29061 <para>
29062 If this option is set false, and the router declines to handle the address, no
29063 further routers are tried, routing fails, and the address is bounced.
29064 <indexterm role="concept">
29065 <primary><option>self</option> option</primary>
29066 </indexterm>
29067 However, if the router explicitly passes an address to the following router by
29068 means of the setting
29069 </para>
29070 <literallayout class="monospaced">
29071 self = pass
29072 </literallayout>
29073 <para>
29074 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
29075 does not affect the behaviour if one of the precondition tests fails. In that
29076 case, the address is always passed to the next router.
29077 </para>
29078 <para>
29079 Note that <option>address_data</option> is not considered to be a precondition. If its
29080 expansion is forced to fail, the router declines, and the value of <option>more</option>
29081 controls what happens next.
29082 </para>
29083 <para>
29084 <indexterm role="option">
29085 <primary><option>pass_on_timeout</option></primary>
29086 </indexterm>
29087 </para>
29088 <informaltable frame="all">
29089 <tgroup cols="4" colsep="0" rowsep="0">
29090 <colspec colwidth="8*" align="left"/>
29091 <colspec colwidth="5*" align="center"/>
29092 <colspec colwidth="5*" align="center"/>
29093 <colspec colwidth="6*" align="right"/>
29094 <tbody>
29095 <row>
29096 <entry><option>pass_on_timeout</option></entry>
29097 <entry>Use: <emphasis>routers</emphasis></entry>
29098 <entry>Type: <emphasis>boolean</emphasis></entry>
29099 <entry>Default: <emphasis>false</emphasis></entry>
29100 </row>
29101 </tbody>
29102 </tgroup>
29103 </informaltable>
29104 <para>
29105 <indexterm role="concept">
29106 <primary>timeout</primary>
29107 <secondary>of router</secondary>
29108 </indexterm>
29109 <indexterm role="concept">
29110 <primary>router</primary>
29111 <secondary>timeout</secondary>
29112 </indexterm>
29113 If a router times out during a host lookup, it normally causes deferral of the
29114 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
29115 router, overriding <option>no_more</option>. This may be helpful for systems that are
29116 intermittently connected to the Internet, or those that want to pass to a smart
29117 host any messages that cannot immediately be delivered.
29118 </para>
29119 <para>
29120 There are occasional other temporary errors that can occur while doing DNS
29121 lookups. They are treated in the same way as a timeout, and this option
29122 applies to all of them.
29123 </para>
29124 <para>
29125 <indexterm role="option">
29126 <primary><option>pass_router</option></primary>
29127 </indexterm>
29128 </para>
29129 <informaltable frame="all">
29130 <tgroup cols="4" colsep="0" rowsep="0">
29131 <colspec colwidth="8*" align="left"/>
29132 <colspec colwidth="5*" align="center"/>
29133 <colspec colwidth="5*" align="center"/>
29134 <colspec colwidth="6*" align="right"/>
29135 <tbody>
29136 <row>
29137 <entry><option>pass_router</option></entry>
29138 <entry>Use: <emphasis>routers</emphasis></entry>
29139 <entry>Type: <emphasis>string</emphasis></entry>
29140 <entry>Default: <emphasis>unset</emphasis></entry>
29141 </row>
29142 </tbody>
29143 </tgroup>
29144 </informaltable>
29145 <para>
29146 <indexterm role="concept">
29147 <primary>router</primary>
29148 <secondary>go to after <quote>pass</quote></secondary>
29149 </indexterm>
29150 When a router returns <quote>pass</quote>, the address is normally handed on to the next
29151 router in sequence. This can be changed by setting <option>pass_router</option> to the name
29152 of another router. However (unlike <option>redirect_router</option>) the named router must
29153 be below the current router, to avoid loops. Note that this option applies only
29154 to the special case of <quote>pass</quote>. It does not apply when a router returns
29155 <quote>decline</quote>.
29156 </para>
29157 <para>
29158 <indexterm role="option">
29159 <primary><option>redirect_router</option></primary>
29160 </indexterm>
29161 </para>
29162 <informaltable frame="all">
29163 <tgroup cols="4" colsep="0" rowsep="0">
29164 <colspec colwidth="8*" align="left"/>
29165 <colspec colwidth="5*" align="center"/>
29166 <colspec colwidth="5*" align="center"/>
29167 <colspec colwidth="6*" align="right"/>
29168 <tbody>
29169 <row>
29170 <entry><option>redirect_router</option></entry>
29171 <entry>Use: <emphasis>routers</emphasis></entry>
29172 <entry>Type: <emphasis>string</emphasis></entry>
29173 <entry>Default: <emphasis>unset</emphasis></entry>
29174 </row>
29175 </tbody>
29176 </tgroup>
29177 </informaltable>
29178 <para>
29179 <indexterm role="concept">
29180 <primary>router</primary>
29181 <secondary>start at after redirection</secondary>
29182 </indexterm>
29183 Sometimes an administrator knows that it is pointless to reprocess addresses
29184 generated from alias or forward files with the same router again. For
29185 example, if an alias file translates real names into login ids there is no
29186 point searching the alias file a second time, especially if it is a large file.
29187 </para>
29188 <para>
29189 The <option>redirect_router</option> option can be set to the name of any router instance.
29190 It causes the routing of any generated addresses to start at the named router
29191 instead of at the first router. This option has no effect if the router in
29192 which it is set does not generate new addresses.
29193 </para>
29194 <para>
29195 <indexterm role="option">
29196 <primary><option>require_files</option></primary>
29197 </indexterm>
29198 </para>
29199 <informaltable frame="all">
29200 <tgroup cols="4" colsep="0" rowsep="0">
29201 <colspec colwidth="8*" align="left"/>
29202 <colspec colwidth="5*" align="center"/>
29203 <colspec colwidth="5*" align="center"/>
29204 <colspec colwidth="6*" align="right"/>
29205 <tbody>
29206 <row>
29207 <entry><option>require_files</option></entry>
29208 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29209 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29210 <entry>Default: <emphasis>unset</emphasis></entry>
29211 </row>
29212 </tbody>
29213 </tgroup>
29214 </informaltable>
29215 <para>
29216 <indexterm role="concept">
29217 <primary>file</primary>
29218 <secondary>requiring for router</secondary>
29219 </indexterm>
29220 <indexterm role="concept">
29221 <primary>router</primary>
29222 <secondary>requiring file existence</secondary>
29223 </indexterm>
29224 This option provides a general mechanism for predicating the running of a
29225 router on the existence or non-existence of certain files or directories.
29226 Before running a router, as one of its precondition tests, Exim works its way
29227 through the <option>require_files</option> list, expanding each item separately.
29228 </para>
29229 <para>
29230 Because the list is split before expansion, any colons in expansion items must
29231 be doubled, or the facility for using a different list separator must be used.
29232 If any expansion is forced to fail, the item is ignored. Other expansion
29233 failures cause routing of the address to be deferred.
29234 </para>
29235 <para>
29236 If any expanded string is empty, it is ignored. Otherwise, except as described
29237 below, each string must be a fully qualified file path, optionally preceded by
29238 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
29239 existence of the files or directories. The router is skipped if any paths not
29240 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
29241 </para>
29242 <para>
29243 <indexterm role="concept">
29244 <primary>NFS</primary>
29245 </indexterm>
29246 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
29247 the message is deferred. This can happen when NFS-mounted filesystems are
29248 unavailable.
29249 </para>
29250 <para>
29251 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
29252 options, so you cannot use it to check for the existence of a file in which to
29253 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
29254 full list of the order in which preconditions are evaluated.) However, as
29255 these options are all expanded, you can use the <option>exists</option> expansion condition
29256 to make such tests. The <option>require_files</option> option is intended for checking files
29257 that the router may be going to use internally, or which are needed by a
29258 transport (for example <filename>.procmailrc</filename>).
29259 </para>
29260 <para>
29261 During delivery, the <function>stat()</function> function is run as root, but there is a
29262 facility for some checking of the accessibility of a file by another user.
29263 This is not a proper permissions check, but just a <quote>rough</quote> check that
29264 operates as follows:
29265 </para>
29266 <para>
29267 If an item in a <option>require_files</option> list does not contain any forward slash
29268 characters, it is taken to be the user (and optional group, separated by a
29269 comma) to be checked for subsequent files in the list. If no group is specified
29270 but the user is specified symbolically, the gid associated with the uid is
29271 used. For example:
29272 </para>
29273 <literallayout class="monospaced">
29274 require_files = mail:/some/file
29275 require_files = $local_part:$home/.procmailrc
29276 </literallayout>
29277 <para>
29278 If a user or group name in a <option>require_files</option> list does not exist, the
29279 <option>require_files</option> condition fails.
29280 </para>
29281 <para>
29282 Exim performs the check by scanning along the components of the file path, and
29283 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
29284 directories, and <quote>r</quote> access on the final file. Note that this means that file
29285 access control lists, if the operating system has them, are ignored.
29286 </para>
29287 <para>
29288 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
29289 incoming SMTP message, Exim is not running as root, but under its own uid. This
29290 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
29291 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
29292 user is not permitted to read one of the directories on the file&#x2019;s path.
29293 </para>
29294 <para>
29295 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
29296 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
29297 without root access. In this case, if a check for access by a particular user
29298 is requested, Exim creates a subprocess that runs as that user, and tries the
29299 check again in that process.
29300 </para>
29301 <para>
29302 The default action for handling an unresolved EACCES is to consider it to
29303 be caused by a configuration error, and routing is deferred because the
29304 existence or non-existence of the file cannot be determined. However, in some
29305 circumstances it may be desirable to treat this condition as if the file did
29306 not exist. If the file name (or the exclamation mark that precedes the file
29307 name for non-existence) is preceded by a plus sign, the EACCES error is treated
29308 as if the file did not exist. For example:
29309 </para>
29310 <literallayout class="monospaced">
29311 require_files = +/some/file
29312 </literallayout>
29313 <para>
29314 If the router is not an essential part of verification (for example, it
29315 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
29316 option false so that the router is skipped when verifying.
29317 </para>
29318 <para>
29319 <indexterm role="option">
29320 <primary><option>retry_use_local_part</option></primary>
29321 </indexterm>
29322 </para>
29323 <informaltable frame="all">
29324 <tgroup cols="4" colsep="0" rowsep="0">
29325 <colspec colwidth="8*" align="left"/>
29326 <colspec colwidth="5*" align="center"/>
29327 <colspec colwidth="5*" align="center"/>
29328 <colspec colwidth="6*" align="right"/>
29329 <tbody>
29330 <row>
29331 <entry><option>retry_use_local_part</option></entry>
29332 <entry>Use: <emphasis>routers</emphasis></entry>
29333 <entry>Type: <emphasis>boolean</emphasis></entry>
29334 <entry>Default: <emphasis>see below</emphasis></entry>
29335 </row>
29336 </tbody>
29337 </tgroup>
29338 </informaltable>
29339 <para>
29340 <indexterm role="concept">
29341 <primary>hints database</primary>
29342 <secondary>retry keys</secondary>
29343 </indexterm>
29344 <indexterm role="concept">
29345 <primary>local part</primary>
29346 <secondary>in retry keys</secondary>
29347 </indexterm>
29348 When a delivery suffers a temporary routing failure, a retry record is created
29349 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
29350 domain, the key for the retry record should not involve the local part, but for
29351 other addresses, both the domain and the local part should be included.
29352 Usually, remote routing is of the former kind, and local routing is of the
29353 latter kind.
29354 </para>
29355 <para>
29356 This option controls whether the local part is used to form the key for retry
29357 hints for addresses that suffer temporary errors while being handled by this
29358 router. The default value is true for any router that has <option>check_local_user</option>
29359 set, and false otherwise. Note that this option does not apply to hints keys
29360 for transport delays; they are controlled by a generic transport option of the
29361 same name.
29362 </para>
29363 <para>
29364 The setting of <option>retry_use_local_part</option> applies only to the router on which it
29365 appears. If the router generates child addresses, they are routed
29366 independently; this setting does not become attached to them.
29367 </para>
29368 <para>
29369 <indexterm role="option">
29370 <primary><option>router_home_directory</option></primary>
29371 </indexterm>
29372 </para>
29373 <informaltable frame="all">
29374 <tgroup cols="4" colsep="0" rowsep="0">
29375 <colspec colwidth="8*" align="left"/>
29376 <colspec colwidth="5*" align="center"/>
29377 <colspec colwidth="5*" align="center"/>
29378 <colspec colwidth="6*" align="right"/>
29379 <tbody>
29380 <row>
29381 <entry><option>router_home_directory</option></entry>
29382 <entry>Use: <emphasis>routers</emphasis></entry>
29383 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29384 <entry>Default: <emphasis>unset</emphasis></entry>
29385 </row>
29386 </tbody>
29387 </tgroup>
29388 </informaltable>
29389 <para>
29390 <indexterm role="concept">
29391 <primary>router</primary>
29392 <secondary>home directory for</secondary>
29393 </indexterm>
29394 <indexterm role="concept">
29395 <primary>home directory</primary>
29396 <secondary>for router</secondary>
29397 </indexterm>
29398 <indexterm role="concept">
29399 <primary><varname>$home</varname></primary>
29400 </indexterm>
29401 This option sets a home directory for use while the router is running. (Compare
29402 <option>transport_home_directory</option>, which sets a home directory for later
29403 transporting.) In particular, if used on a <command>redirect</command> router, this option
29404 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
29405 forced expansion failure causes the option to be ignored &ndash; other failures
29406 cause the router to defer.
29407 </para>
29408 <para>
29409 Expansion of <option>router_home_directory</option> happens immediately after the
29410 <option>check_local_user</option> test (if configured), before any further expansions take
29411 place.
29412 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29413 are evaluated.)
29414 While the router is running, <option>router_home_directory</option> overrides the value of
29415 <varname>$home</varname> that came from <option>check_local_user</option>.
29416 </para>
29417 <para>
29418 When a router accepts an address and assigns it to a local transport (including
29419 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
29420 delivery), the home directory setting for the transport is taken from the first
29421 of these values that is set:
29422 </para>
29423 <itemizedlist>
29424 <listitem>
29425 <para>
29426 The <option>home_directory</option> option on the transport;
29427 </para>
29428 </listitem>
29429 <listitem>
29430 <para>
29431 The <option>transport_home_directory</option> option on the router;
29432 </para>
29433 </listitem>
29434 <listitem>
29435 <para>
29436 The password data if <option>check_local_user</option> is set on the router;
29437 </para>
29438 </listitem>
29439 <listitem>
29440 <para>
29441 The <option>router_home_directory</option> option on the router.
29442 </para>
29443 </listitem>
29444 </itemizedlist>
29445 <para>
29446 In other words, <option>router_home_directory</option> overrides the password data for the
29447 router, but not for the transport.
29448 </para>
29449 <para>
29450 <indexterm role="option">
29451 <primary><option>self</option></primary>
29452 </indexterm>
29453 </para>
29454 <informaltable frame="all">
29455 <tgroup cols="4" colsep="0" rowsep="0">
29456 <colspec colwidth="8*" align="left"/>
29457 <colspec colwidth="5*" align="center"/>
29458 <colspec colwidth="5*" align="center"/>
29459 <colspec colwidth="6*" align="right"/>
29460 <tbody>
29461 <row>
29462 <entry><option>self</option></entry>
29463 <entry>Use: <emphasis>routers</emphasis></entry>
29464 <entry>Type: <emphasis>string</emphasis></entry>
29465 <entry>Default: <emphasis>freeze</emphasis></entry>
29466 </row>
29467 </tbody>
29468 </tgroup>
29469 </informaltable>
29470 <para>
29471 <indexterm role="concept">
29472 <primary>MX record</primary>
29473 <secondary>pointing to local host</secondary>
29474 </indexterm>
29475 <indexterm role="concept">
29476 <primary>local host</primary>
29477 <secondary>MX pointing to</secondary>
29478 </indexterm>
29479 This option applies to those routers that use a recipient address to find a
29480 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
29481 and <command>manualroute</command> routers.
29482 Certain configurations of the <command>queryprogram</command> router can also specify a list
29483 of remote hosts.
29484 Usually such routers are configured to send the message to a remote host via an
29485 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
29486 host on the list turns out to be the local host.
29487 The way in which Exim checks for the local host is described in section
29488 <xref linkend="SECTreclocipadd"/>.
29489 </para>
29490 <para>
29491 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
29492 example, the router should be configured not to process this domain), or an
29493 error in the DNS (for example, the MX should not point to this host). For this
29494 reason, the default action is to log the incident, defer the address, and
29495 freeze the message. The following alternatives are provided for use in special
29496 cases:
29497 </para>
29498 <variablelist>
29499 <varlistentry>
29500 <term><option>defer</option></term>
29501 <listitem>
29502 <para>
29503 Delivery of the message is tried again later, but the message is not frozen.
29504 </para>
29505 </listitem></varlistentry>
29506 <varlistentry>
29507 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
29508 <listitem>
29509 <para>
29510 The domain is changed to the given domain, and the address is passed back to
29511 be reprocessed by the routers. No rewriting of headers takes place. This
29512 behaviour is essentially a redirection.
29513 </para>
29514 </listitem></varlistentry>
29515 <varlistentry>
29516 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
29517 <listitem>
29518 <para>
29519 The domain is changed to the given domain, and the address is passed back to be
29520 reprocessed by the routers. Any headers that contain the original domain are
29521 rewritten.
29522 </para>
29523 </listitem></varlistentry>
29524 <varlistentry>
29525 <term><option>pass</option></term>
29526 <listitem>
29527 <para>
29528 <indexterm role="concept">
29529 <primary><option>more</option> option</primary>
29530 </indexterm>
29531 <indexterm role="concept">
29532 <primary><varname>$self_hostname</varname></primary>
29533 </indexterm>
29534 The router passes the address to the next router, or to the router named in the
29535 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
29536 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
29537 name of the local host that the router encountered. This can be used to
29538 distinguish between different cases for hosts with multiple names. The
29539 combination
29540 </para>
29541 <literallayout class="monospaced">
29542 self = pass
29543 no_more
29544 </literallayout>
29545 <para>
29546 ensures that only those addresses that routed to the local host are passed on.
29547 Without <option>no_more</option>, addresses that were declined for other reasons would also
29548 be passed to the next router.
29549 </para>
29550 </listitem></varlistentry>
29551 <varlistentry>
29552 <term><option>fail</option></term>
29553 <listitem>
29554 <para>
29555 Delivery fails and an error report is generated.
29556 </para>
29557 </listitem></varlistentry>
29558 <varlistentry>
29559 <term><option>send</option></term>
29560 <listitem>
29561 <para>
29562 <indexterm role="concept">
29563 <primary>local host</primary>
29564 <secondary>sending to</secondary>
29565 </indexterm>
29566 The anomaly is ignored and the address is queued for the transport. This
29567 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29568 makes sense only in cases where the program that is listening on the SMTP port
29569 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29570 different configuration file that handles the domain in another way.
29571 </para>
29572 </listitem></varlistentry>
29573 </variablelist>
29574 <para>
29575 <indexterm role="option">
29576 <primary><option>senders</option></primary>
29577 </indexterm>
29578 </para>
29579 <informaltable frame="all">
29580 <tgroup cols="4" colsep="0" rowsep="0">
29581 <colspec colwidth="8*" align="left"/>
29582 <colspec colwidth="5*" align="center"/>
29583 <colspec colwidth="5*" align="center"/>
29584 <colspec colwidth="6*" align="right"/>
29585 <tbody>
29586 <row>
29587 <entry><option>senders</option></entry>
29588 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29589 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
29590 <entry>Default: <emphasis>unset</emphasis></entry>
29591 </row>
29592 </tbody>
29593 </tgroup>
29594 </informaltable>
29595 <para>
29596 <indexterm role="concept">
29597 <primary>router</primary>
29598 <secondary>checking senders</secondary>
29599 </indexterm>
29600 If this option is set, the router is skipped unless the message&#x2019;s sender
29601 address matches something on the list.
29602 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29603 are evaluated.
29604 </para>
29605 <para>
29606 There are issues concerning verification when the running of routers is
29607 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
29608 setting, it sets the sender to the null string. When using the <option>-bt</option> option
29609 to check a configuration file, it is necessary also to use the <option>-f</option> option to
29610 set an appropriate sender. For incoming mail, the sender is unset when
29611 verifying the sender, but is available when verifying any recipients. If the
29612 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
29613 matters.
29614 </para>
29615 <para>
29616 <indexterm role="option">
29617 <primary><option>translate_ip_address</option></primary>
29618 </indexterm>
29619 </para>
29620 <informaltable frame="all">
29621 <tgroup cols="4" colsep="0" rowsep="0">
29622 <colspec colwidth="8*" align="left"/>
29623 <colspec colwidth="5*" align="center"/>
29624 <colspec colwidth="5*" align="center"/>
29625 <colspec colwidth="6*" align="right"/>
29626 <tbody>
29627 <row>
29628 <entry><option>translate_ip_address</option></entry>
29629 <entry>Use: <emphasis>routers</emphasis></entry>
29630 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29631 <entry>Default: <emphasis>unset</emphasis></entry>
29632 </row>
29633 </tbody>
29634 </tgroup>
29635 </informaltable>
29636 <para>
29637 <indexterm role="concept">
29638 <primary>IP address</primary>
29639 <secondary>translating</secondary>
29640 </indexterm>
29641 <indexterm role="concept">
29642 <primary>packet radio</primary>
29643 </indexterm>
29644 <indexterm role="concept">
29645 <primary>router</primary>
29646 <secondary>IP address translation</secondary>
29647 </indexterm>
29648 There exist some rare networking situations (for example, packet radio) where
29649 it is helpful to be able to translate IP addresses generated by normal routing
29650 mechanisms into other IP addresses, thus performing a kind of manual IP
29651 routing. This should be done only if the normal IP routing of the TCP/IP stack
29652 is inadequate or broken. Because this is an extremely uncommon requirement, the
29653 code to support this option is not included in the Exim binary unless
29654 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
29655 </para>
29656 <para>
29657 <indexterm role="concept">
29658 <primary><varname>$host_address</varname></primary>
29659 </indexterm>
29660 The <option>translate_ip_address</option> string is expanded for every IP address generated
29661 by the router, with the generated address set in <varname>$host_address</varname>. If the
29662 expansion is forced to fail, no action is taken.
29663 For any other expansion error, delivery of the message is deferred.
29664 If the result of the expansion is an IP address, that replaces the original
29665 address; otherwise the result is assumed to be a host name &ndash; this is looked
29666 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
29667 produce one or more replacement IP addresses. For example, to subvert all IP
29668 addresses in some specific networks, this could be added to a router:
29669 </para>
29670 <literallayout class="monospaced">
29671 translate_ip_address = \
29672   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
29673     {$value}fail}}
29674 </literallayout>
29675 <para>
29676 The file would contain lines like
29677 </para>
29678 <literallayout class="monospaced">
29679 10.2.3.128/26    some.host
29680 10.8.4.34/26     10.44.8.15
29681 </literallayout>
29682 <para>
29683 You should not make use of this facility unless you really understand what you
29684 are doing.
29685 </para>
29686 <para>
29687 <indexterm role="option">
29688 <primary><option>transport</option></primary>
29689 </indexterm>
29690 </para>
29691 <informaltable frame="all">
29692 <tgroup cols="4" colsep="0" rowsep="0">
29693 <colspec colwidth="8*" align="left"/>
29694 <colspec colwidth="5*" align="center"/>
29695 <colspec colwidth="5*" align="center"/>
29696 <colspec colwidth="6*" align="right"/>
29697 <tbody>
29698 <row>
29699 <entry><option>transport</option></entry>
29700 <entry>Use: <emphasis>routers</emphasis></entry>
29701 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29702 <entry>Default: <emphasis>unset</emphasis></entry>
29703 </row>
29704 </tbody>
29705 </tgroup>
29706 </informaltable>
29707 <para>
29708 This option specifies the transport to be used when a router accepts an address
29709 and sets it up for delivery. A transport is never needed if a router is used
29710 only for verification. The value of the option is expanded at routing time,
29711 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
29712 and result must be the name of one of the configured transports. If it is not,
29713 delivery is deferred.
29714 </para>
29715 <para>
29716 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
29717 have some private options that set up transports for pipe and file deliveries
29718 (see chapter <xref linkend="CHAPredirect"/>).
29719 </para>
29720 <para>
29721 <indexterm role="option">
29722 <primary><option>transport_current_directory</option></primary>
29723 </indexterm>
29724 </para>
29725 <informaltable frame="all">
29726 <tgroup cols="4" colsep="0" rowsep="0">
29727 <colspec colwidth="8*" align="left"/>
29728 <colspec colwidth="5*" align="center"/>
29729 <colspec colwidth="5*" align="center"/>
29730 <colspec colwidth="6*" align="right"/>
29731 <tbody>
29732 <row>
29733 <entry><option>transport_current_directory</option></entry>
29734 <entry>Use: <emphasis>routers</emphasis></entry>
29735 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29736 <entry>Default: <emphasis>unset</emphasis></entry>
29737 </row>
29738 </tbody>
29739 </tgroup>
29740 </informaltable>
29741 <para>
29742 <indexterm role="concept">
29743 <primary>current directory for local transport</primary>
29744 </indexterm>
29745 This option associates a current directory with any address that is routed
29746 to a local transport. This can happen either because a transport is
29747 explicitly configured for the router, or because it generates a delivery to a
29748 file or a pipe. During the delivery process (that is, at transport time), this
29749 option string is expanded and is set as the current directory, unless
29750 overridden by a setting on the transport.
29751 If the expansion fails for any reason, including forced failure, an error is
29752 logged, and delivery is deferred.
29753 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
29754 environment.
29755 </para>
29756 <para>
29757 <indexterm role="option">
29758 <primary><option>transport_home_directory</option></primary>
29759 </indexterm>
29760 </para>
29761 <informaltable frame="all">
29762 <tgroup cols="4" colsep="0" rowsep="0">
29763 <colspec colwidth="8*" align="left"/>
29764 <colspec colwidth="5*" align="center"/>
29765 <colspec colwidth="5*" align="center"/>
29766 <colspec colwidth="6*" align="right"/>
29767 <tbody>
29768 <row>
29769 <entry><option>transport_home_directory</option></entry>
29770 <entry>Use: <emphasis>routers</emphasis></entry>
29771 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29772 <entry>Default: <emphasis>see below</emphasis></entry>
29773 </row>
29774 </tbody>
29775 </tgroup>
29776 </informaltable>
29777 <para>
29778 <indexterm role="concept">
29779 <primary>home directory</primary>
29780 <secondary>for local transport</secondary>
29781 </indexterm>
29782 This option associates a home directory with any address that is routed to a
29783 local transport. This can happen either because a transport is explicitly
29784 configured for the router, or because it generates a delivery to a file or a
29785 pipe. During the delivery process (that is, at transport time), the option
29786 string is expanded and is set as the home directory, unless overridden by a
29787 setting of <option>home_directory</option> on the transport.
29788 If the expansion fails for any reason, including forced failure, an error is
29789 logged, and delivery is deferred.
29790 </para>
29791 <para>
29792 If the transport does not specify a home directory, and
29793 <option>transport_home_directory</option> is not set for the router, the home directory for
29794 the tranport is taken from the password data if <option>check_local_user</option> is set for
29795 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
29796 is set; if not, no home directory is set for the transport.
29797 </para>
29798 <para>
29799 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
29800 environment.
29801 </para>
29802 <para>
29803 <indexterm role="option">
29804 <primary><option>unseen</option></primary>
29805 </indexterm>
29806 </para>
29807 <informaltable frame="all">
29808 <tgroup cols="4" colsep="0" rowsep="0">
29809 <colspec colwidth="8*" align="left"/>
29810 <colspec colwidth="5*" align="center"/>
29811 <colspec colwidth="5*" align="center"/>
29812 <colspec colwidth="6*" align="right"/>
29813 <tbody>
29814 <row>
29815 <entry><option>unseen</option></entry>
29816 <entry>Use: <emphasis>routers</emphasis></entry>
29817 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29818 <entry>Default: <emphasis>false</emphasis></entry>
29819 </row>
29820 </tbody>
29821 </tgroup>
29822 </informaltable>
29823 <para>
29824 <indexterm role="concept">
29825 <primary>router</primary>
29826 <secondary>carrying on after success</secondary>
29827 </indexterm>
29828 The result of string expansion for this option must be a valid boolean value,
29829 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29830 result causes an error, and delivery is deferred. If the expansion is forced to
29831 fail, the default value for the option (false) is used. Other failures cause
29832 delivery to be deferred.
29833 </para>
29834 <para>
29835 When this option is set true, routing does not cease if the router accepts the
29836 address. Instead, a copy of the incoming address is passed to the next router,
29837 overriding a false setting of <option>more</option>. There is little point in setting
29838 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
29839 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
29840 sometimes true and sometimes false).
29841 </para>
29842 <para>
29843 <indexterm role="concept">
29844 <primary>copy of message (<option>unseen</option> option)</primary>
29845 </indexterm>
29846 The <option>unseen</option> option can be used to cause copies of messages to be delivered
29847 to some other destination, while also carrying out a normal delivery. In
29848 effect, the current address is made into a <quote>parent</quote> that has two children &ndash;
29849 one that is delivered as specified by this router, and a clone that goes on to
29850 be routed further. For this reason, <option>unseen</option> may not be combined with the
29851 <option>one_time</option> option in a <command>redirect</command> router.
29852 </para>
29853 <para>
29854 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
29855 this router or by previous routers affect the <quote>unseen</quote> copy of the message
29856 only. The clone that continues to be processed by further routers starts with
29857 no added headers and none specified for removal. However, any data that was set
29858 by the <option>address_data</option> option in the current or previous routers is passed on.
29859 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
29860 qualifier in filter files.
29861 </para>
29862 <para>
29863 <indexterm role="option">
29864 <primary><option>user</option></primary>
29865 </indexterm>
29866 </para>
29867 <informaltable frame="all">
29868 <tgroup cols="4" colsep="0" rowsep="0">
29869 <colspec colwidth="8*" align="left"/>
29870 <colspec colwidth="5*" align="center"/>
29871 <colspec colwidth="5*" align="center"/>
29872 <colspec colwidth="6*" align="right"/>
29873 <tbody>
29874 <row>
29875 <entry><option>user</option></entry>
29876 <entry>Use: <emphasis>routers</emphasis></entry>
29877 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29878 <entry>Default: <emphasis>see below</emphasis></entry>
29879 </row>
29880 </tbody>
29881 </tgroup>
29882 </informaltable>
29883 <para>
29884 <indexterm role="concept">
29885 <primary>uid (user id)</primary>
29886 <secondary>local delivery</secondary>
29887 </indexterm>
29888 <indexterm role="concept">
29889 <primary>local transports</primary>
29890 <secondary>uid and gid</secondary>
29891 </indexterm>
29892 <indexterm role="concept">
29893 <primary>transport</primary>
29894 <secondary>local</secondary>
29895 </indexterm>
29896 <indexterm role="concept">
29897 <primary>router</primary>
29898 <secondary>user for filter processing</secondary>
29899 </indexterm>
29900 <indexterm role="concept">
29901 <primary>filter</primary>
29902 <secondary>user for processing</secondary>
29903 </indexterm>
29904 When a router queues an address for a transport, and the transport does not
29905 specify a user, the user given here is used when running the delivery process.
29906 The user may be specified numerically or by name. If expansion fails, the
29907 error is logged and delivery is deferred.
29908 This user is also used by the <command>redirect</command> router when running a filter file.
29909 The default is unset, except when <option>check_local_user</option> is set. In this case,
29910 the default is taken from the password information. If the user is specified as
29911 a name, and <option>group</option> is not set, the group associated with the user is used.
29912 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
29913 <xref linkend="CHAPenvironment"/>.
29914 </para>
29915 <para>
29916 <indexterm role="option">
29917 <primary><option>verify</option></primary>
29918 </indexterm>
29919 </para>
29920 <informaltable frame="all">
29921 <tgroup cols="4" colsep="0" rowsep="0">
29922 <colspec colwidth="8*" align="left"/>
29923 <colspec colwidth="5*" align="center"/>
29924 <colspec colwidth="5*" align="center"/>
29925 <colspec colwidth="6*" align="right"/>
29926 <tbody>
29927 <row>
29928 <entry><option>verify</option></entry>
29929 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29930 <entry>Type: <emphasis>boolean</emphasis></entry>
29931 <entry>Default: <emphasis>true</emphasis></entry>
29932 </row>
29933 </tbody>
29934 </tgroup>
29935 </informaltable>
29936 <para>
29937 Setting this option has the effect of setting <option>verify_sender</option> and
29938 <option>verify_recipient</option> to the same value.
29939 </para>
29940 <para>
29941 <indexterm role="option">
29942 <primary><option>verify_only</option></primary>
29943 </indexterm>
29944 </para>
29945 <informaltable frame="all">
29946 <tgroup cols="4" colsep="0" rowsep="0">
29947 <colspec colwidth="8*" align="left"/>
29948 <colspec colwidth="5*" align="center"/>
29949 <colspec colwidth="5*" align="center"/>
29950 <colspec colwidth="6*" align="right"/>
29951 <tbody>
29952 <row>
29953 <entry><option>verify_only</option></entry>
29954 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29955 <entry>Type: <emphasis>boolean</emphasis></entry>
29956 <entry>Default: <emphasis>false</emphasis></entry>
29957 </row>
29958 </tbody>
29959 </tgroup>
29960 </informaltable>
29961 <para>
29962 <indexterm role="concept">
29963 <primary>EXPN</primary>
29964 <secondary>with <option>verify_only</option></secondary>
29965 </indexterm>
29966 <indexterm role="concept">
29967 <primary><option>-bv</option> option</primary>
29968 </indexterm>
29969 <indexterm role="concept">
29970 <primary>router</primary>
29971 <secondary>used only when verifying</secondary>
29972 </indexterm>
29973 If this option is set, the router is used only when verifying an address or
29974 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
29975 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
29976 restricted to verifying only senders or recipients by means of
29977 <option>verify_sender</option> and <option>verify_recipient</option>.
29978 </para>
29979 <para>
29980 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
29981 SMTP message, Exim is not running as root, but under its own uid. If the router
29982 accesses any files, you need to make sure that they are accessible to the Exim
29983 user or group.
29984 </para>
29985 <para>
29986 <indexterm role="option">
29987 <primary><option>verify_recipient</option></primary>
29988 </indexterm>
29989 </para>
29990 <informaltable frame="all">
29991 <tgroup cols="4" colsep="0" rowsep="0">
29992 <colspec colwidth="8*" align="left"/>
29993 <colspec colwidth="5*" align="center"/>
29994 <colspec colwidth="5*" align="center"/>
29995 <colspec colwidth="6*" align="right"/>
29996 <tbody>
29997 <row>
29998 <entry><option>verify_recipient</option></entry>
29999 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30000 <entry>Type: <emphasis>boolean</emphasis></entry>
30001 <entry>Default: <emphasis>true</emphasis></entry>
30002 </row>
30003 </tbody>
30004 </tgroup>
30005 </informaltable>
30006 <para>
30007 If this option is false, the router is skipped when verifying recipient
30008 addresses
30009 or testing recipient verification using <option>-bv</option>.
30010 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30011 are evaluated.
30012 </para>
30013 <para>
30014 <indexterm role="option">
30015 <primary><option>verify_sender</option></primary>
30016 </indexterm>
30017 </para>
30018 <informaltable frame="all">
30019 <tgroup cols="4" colsep="0" rowsep="0">
30020 <colspec colwidth="8*" align="left"/>
30021 <colspec colwidth="5*" align="center"/>
30022 <colspec colwidth="5*" align="center"/>
30023 <colspec colwidth="6*" align="right"/>
30024 <tbody>
30025 <row>
30026 <entry><option>verify_sender</option></entry>
30027 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
30028 <entry>Type: <emphasis>boolean</emphasis></entry>
30029 <entry>Default: <emphasis>true</emphasis></entry>
30030 </row>
30031 </tbody>
30032 </tgroup>
30033 </informaltable>
30034 <para>
30035 If this option is false, the router is skipped when verifying sender addresses
30036 or testing sender verification using <option>-bvs</option>.
30037 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
30038 are evaluated.
30039 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
30040 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
30041 </para>
30042 </chapter>
30043
30044 <chapter>
30045 <title>The accept router</title>
30046 <para>
30047 <indexterm role="concept">
30048 <primary><command>accept</command> router</primary>
30049 </indexterm>
30050 <indexterm role="concept">
30051 <primary>routers</primary>
30052 <secondary><command>accept</command></secondary>
30053 </indexterm>
30054 The <command>accept</command> router has no private options of its own. Unless it is being
30055 used purely for verification (see <option>verify_only</option>) a transport is required to
30056 be defined by the generic <option>transport</option> option. If the preconditions that are
30057 specified by generic options are met, the router accepts the address and queues
30058 it for the given transport. The most common use of this router is for setting
30059 up deliveries to local mailboxes. For example:
30060 </para>
30061 <literallayout class="monospaced">
30062 localusers:
30063   driver = accept
30064   domains = mydomain.example
30065   check_local_user
30066   transport = local_delivery
30067 </literallayout>
30068 <para>
30069 The <option>domains</option> condition in this example checks the domain of the address, and
30070 <option>check_local_user</option> checks that the local part is the login of a local user.
30071 When both preconditions are met, the <command>accept</command> router runs, and queues the
30072 address for the <command>local_delivery</command> transport.
30073 </para>
30074 </chapter>
30075
30076 <chapter id="CHAPdnslookup">
30077 <title>The dnslookup router</title>
30078 <para>
30079 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
30080 <primary><command>dnslookup</command> router</primary>
30081 </indexterm>
30082 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
30083 <primary>routers</primary>
30084 <secondary><command>dnslookup</command></secondary>
30085 </indexterm>
30086 The <command>dnslookup</command> router looks up the hosts that handle mail for the
30087 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
30088 unless <option>verify_only</option> is set.
30089 </para>
30090 <para>
30091 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
30092 SRV records. If none are found, or if SRV support is not configured,
30093 MX records are looked up. If no MX records exist, address records are sought.
30094 However, <option>mx_domains</option> can be set to disable the direct use of address
30095 records.
30096 </para>
30097 <para>
30098 MX records of equal priority are sorted by Exim into a random order. Exim then
30099 looks for address records for the host names obtained from MX or SRV records.
30100 When a host has more than one IP address, they are sorted into a random order,
30101 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
30102 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
30103 generic option, the router declines.
30104 </para>
30105 <para>
30106 Unless they have the highest priority (lowest MX value), MX records that point
30107 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
30108 are discarded, together with any other MX records of equal or lower priority.
30109 </para>
30110 <para>
30111 <indexterm role="concept">
30112 <primary>MX record</primary>
30113 <secondary>pointing to local host</secondary>
30114 </indexterm>
30115 <indexterm role="concept">
30116 <primary>local host</primary>
30117 <secondary>MX pointing to</secondary>
30118 </indexterm>
30119 <indexterm role="concept">
30120 <primary><option>self</option> option</primary>
30121 <secondary>in <command>dnslookup</command> router</secondary>
30122 </indexterm>
30123 If the host pointed to by the highest priority MX record, or looked up as an
30124 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
30125 happens is controlled by the generic <option>self</option> option.
30126 </para>
30127 <section id="SECTprowitdnsloo">
30128 <title>Problems with DNS lookups</title>
30129 <para>
30130 There have been problems with DNS servers when SRV records are looked up.
30131 Some mis-behaving servers return a DNS error or timeout when a non-existent
30132 SRV record is sought. Similar problems have in the past been reported for
30133 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
30134 problem, but it is heavy-handed because it is a global option.
30135 </para>
30136 <para>
30137 For this reason, there are two options, <option>srv_fail_domains</option> and
30138 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
30139 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
30140 an attempt to look up an SRV or MX record causes one of these results, and the
30141 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
30142 such record</quote>. In the case of an SRV lookup, this means that the router
30143 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
30144 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
30145 case routing fails.
30146 </para>
30147 </section>
30148 <section>
30149 <title>Private options for dnslookup</title>
30150 <para>
30151 <indexterm role="concept">
30152 <primary>options</primary>
30153 <secondary><command>dnslookup</command> router</secondary>
30154 </indexterm>
30155 The private options for the <command>dnslookup</command> router are as follows:
30156 </para>
30157 <para>
30158 <indexterm role="option">
30159 <primary><option>check_secondary_mx</option></primary>
30160 </indexterm>
30161 </para>
30162 <informaltable frame="all">
30163 <tgroup cols="4" colsep="0" rowsep="0">
30164 <colspec colwidth="8*" align="left"/>
30165 <colspec colwidth="5*" align="center"/>
30166 <colspec colwidth="5*" align="center"/>
30167 <colspec colwidth="6*" align="right"/>
30168 <tbody>
30169 <row>
30170 <entry><option>check_secondary_mx</option></entry>
30171 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30172 <entry>Type: <emphasis>boolean</emphasis></entry>
30173 <entry>Default: <emphasis>false</emphasis></entry>
30174 </row>
30175 </tbody>
30176 </tgroup>
30177 </informaltable>
30178 <para>
30179 <indexterm role="concept">
30180 <primary>MX record</primary>
30181 <secondary>checking for secondary</secondary>
30182 </indexterm>
30183 If this option is set, the router declines unless the local host is found in
30184 (and removed from) the list of hosts obtained by MX lookup. This can be used to
30185 process domains for which the local host is a secondary mail exchanger
30186 differently to other domains. The way in which Exim decides whether a host is
30187 the local host is described in section <xref linkend="SECTreclocipadd"/>.
30188 </para>
30189 <para>
30190 <indexterm role="option">
30191 <primary><option>check_srv</option></primary>
30192 </indexterm>
30193 </para>
30194 <informaltable frame="all">
30195 <tgroup cols="4" colsep="0" rowsep="0">
30196 <colspec colwidth="8*" align="left"/>
30197 <colspec colwidth="5*" align="center"/>
30198 <colspec colwidth="5*" align="center"/>
30199 <colspec colwidth="6*" align="right"/>
30200 <tbody>
30201 <row>
30202 <entry><option>check_srv</option></entry>
30203 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30204 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30205 <entry>Default: <emphasis>unset</emphasis></entry>
30206 </row>
30207 </tbody>
30208 </tgroup>
30209 </informaltable>
30210 <para>
30211 <indexterm role="concept">
30212 <primary>SRV record</primary>
30213 <secondary>enabling use of</secondary>
30214 </indexterm>
30215 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
30216 addition to MX and address records. The support is disabled by default. To
30217 enable SRV support, set the <option>check_srv</option> option to the name of the service
30218 required. For example,
30219 </para>
30220 <literallayout class="monospaced">
30221 check_srv = smtp
30222 </literallayout>
30223 <para>
30224 looks for SRV records that refer to the normal smtp service. The option is
30225 expanded, so the service name can vary from message to message or address
30226 to address. This might be helpful if SRV records are being used for a
30227 submission service. If the expansion is forced to fail, the <option>check_srv</option>
30228 option is ignored, and the router proceeds to look for MX records in the
30229 normal way.
30230 </para>
30231 <para>
30232 When the expansion succeeds, the router searches first for SRV records for
30233 the given service (it assumes TCP protocol). A single SRV record with a
30234 host name that consists of just a single dot indicates <quote>no such service for
30235 this domain</quote>; if this is encountered, the router declines. If other kinds of
30236 SRV record are found, they are used to construct a host list for delivery
30237 according to the rules of RFC 2782. MX records are not sought in this case.
30238 </para>
30239 <para>
30240 When no SRV records are found, MX records (and address records) are sought in
30241 the traditional way. In other words, SRV records take precedence over MX
30242 records, just as MX records take precedence over address records. Note that
30243 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
30244 defined it. It is apparently believed that MX records are sufficient for email
30245 and that SRV records should not be used for this purpose. However, SRV records
30246 have an additional <quote>weight</quote> feature which some people might find useful when
30247 trying to split an SMTP load between hosts of different power.
30248 </para>
30249 <para>
30250 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
30251 when there is a DNS lookup error.
30252 </para>
30253 <para>
30254 <indexterm role="option">
30255 <primary><option>mx_domains</option></primary>
30256 </indexterm>
30257 </para>
30258 <informaltable frame="all">
30259 <tgroup cols="4" colsep="0" rowsep="0">
30260 <colspec colwidth="8*" align="left"/>
30261 <colspec colwidth="5*" align="center"/>
30262 <colspec colwidth="5*" align="center"/>
30263 <colspec colwidth="6*" align="right"/>
30264 <tbody>
30265 <row>
30266 <entry><option>mx_domains</option></entry>
30267 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30268 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30269 <entry>Default: <emphasis>unset</emphasis></entry>
30270 </row>
30271 </tbody>
30272 </tgroup>
30273 </informaltable>
30274 <para>
30275 <indexterm role="concept">
30276 <primary>MX record</primary>
30277 <secondary>required to exist</secondary>
30278 </indexterm>
30279 <indexterm role="concept">
30280 <primary>SRV record</primary>
30281 <secondary>required to exist</secondary>
30282 </indexterm>
30283 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
30284 record in order to be recognised. (The name of this option could be improved.)
30285 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
30286 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
30287 setting:
30288 </para>
30289 <literallayout class="monospaced">
30290 mx_domains = ! *.discworld.fict.example : *.fict.example
30291 </literallayout>
30292 <para>
30293 This specifies that messages addressed to a domain that matches the list but
30294 has no MX record should be bounced immediately instead of being routed using
30295 the address record.
30296 </para>
30297 <para>
30298 <indexterm role="option">
30299 <primary><option>mx_fail_domains</option></primary>
30300 </indexterm>
30301 </para>
30302 <informaltable frame="all">
30303 <tgroup cols="4" colsep="0" rowsep="0">
30304 <colspec colwidth="8*" align="left"/>
30305 <colspec colwidth="5*" align="center"/>
30306 <colspec colwidth="5*" align="center"/>
30307 <colspec colwidth="6*" align="right"/>
30308 <tbody>
30309 <row>
30310 <entry><option>mx_fail_domains</option></entry>
30311 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30312 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30313 <entry>Default: <emphasis>unset</emphasis></entry>
30314 </row>
30315 </tbody>
30316 </tgroup>
30317 </informaltable>
30318 <para>
30319 If the DNS lookup for MX records for one of the domains in this list causes a
30320 DNS lookup error, Exim behaves as if no MX records were found. See section
30321 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30322 </para>
30323 <para>
30324 <indexterm role="option">
30325 <primary><option>qualify_single</option></primary>
30326 </indexterm>
30327 </para>
30328 <informaltable frame="all">
30329 <tgroup cols="4" colsep="0" rowsep="0">
30330 <colspec colwidth="8*" align="left"/>
30331 <colspec colwidth="5*" align="center"/>
30332 <colspec colwidth="5*" align="center"/>
30333 <colspec colwidth="6*" align="right"/>
30334 <tbody>
30335 <row>
30336 <entry><option>qualify_single</option></entry>
30337 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30338 <entry>Type: <emphasis>boolean</emphasis></entry>
30339 <entry>Default: <emphasis>true</emphasis></entry>
30340 </row>
30341 </tbody>
30342 </tgroup>
30343 </informaltable>
30344 <para>
30345 <indexterm role="concept">
30346 <primary>DNS</primary>
30347 <secondary>resolver options</secondary>
30348 </indexterm>
30349 <indexterm role="concept">
30350 <primary>DNS</primary>
30351 <secondary>qualifying single-component names</secondary>
30352 </indexterm>
30353 When this option is true, the resolver option RES_DEFNAMES is set for DNS
30354 lookups. Typically, but not standardly, this causes the resolver to qualify
30355 single-component names with the default domain. For example, on a machine
30356 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
30357 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
30358 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
30359 <emphasis>resolv.conf</emphasis>.
30360 </para>
30361 <para>
30362 <indexterm role="option">
30363 <primary><option>rewrite_headers</option></primary>
30364 </indexterm>
30365 </para>
30366 <informaltable frame="all">
30367 <tgroup cols="4" colsep="0" rowsep="0">
30368 <colspec colwidth="8*" align="left"/>
30369 <colspec colwidth="5*" align="center"/>
30370 <colspec colwidth="5*" align="center"/>
30371 <colspec colwidth="6*" align="right"/>
30372 <tbody>
30373 <row>
30374 <entry><option>rewrite_headers</option></entry>
30375 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30376 <entry>Type: <emphasis>boolean</emphasis></entry>
30377 <entry>Default: <emphasis>true</emphasis></entry>
30378 </row>
30379 </tbody>
30380 </tgroup>
30381 </informaltable>
30382 <para>
30383 <indexterm role="concept">
30384 <primary>rewriting</primary>
30385 <secondary>header lines</secondary>
30386 </indexterm>
30387 <indexterm role="concept">
30388 <primary>header lines</primary>
30389 <secondary>rewriting</secondary>
30390 </indexterm>
30391 If the domain name in the address that is being processed is not fully
30392 qualified, it may be expanded to its full form by a DNS lookup. For example, if
30393 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
30394 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
30395 occur as a result of setting the <option>widen_domains</option> option. If
30396 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
30397 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
30398 header lines of the message are rewritten with the full domain name.
30399 </para>
30400 <para>
30401 This option should be turned off only when it is known that no message is
30402 ever going to be sent outside an environment where the abbreviation makes
30403 sense.
30404 </para>
30405 <para>
30406 When an MX record is looked up in the DNS and matches a wildcard record, name
30407 servers normally return a record containing the name that has been looked up,
30408 making it impossible to detect whether a wildcard was present or not. However,
30409 some name servers have recently been seen to return the wildcard entry. If the
30410 name returned by a DNS lookup begins with an asterisk, it is not used for
30411 header rewriting.
30412 </para>
30413 <para>
30414 <indexterm role="option">
30415 <primary><option>same_domain_copy_routing</option></primary>
30416 </indexterm>
30417 </para>
30418 <informaltable frame="all">
30419 <tgroup cols="4" colsep="0" rowsep="0">
30420 <colspec colwidth="8*" align="left"/>
30421 <colspec colwidth="5*" align="center"/>
30422 <colspec colwidth="5*" align="center"/>
30423 <colspec colwidth="6*" align="right"/>
30424 <tbody>
30425 <row>
30426 <entry><option>same_domain_copy_routing</option></entry>
30427 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30428 <entry>Type: <emphasis>boolean</emphasis></entry>
30429 <entry>Default: <emphasis>false</emphasis></entry>
30430 </row>
30431 </tbody>
30432 </tgroup>
30433 </informaltable>
30434 <para>
30435 <indexterm role="concept">
30436 <primary>address</primary>
30437 <secondary>copying routing</secondary>
30438 </indexterm>
30439 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
30440 to the same list of hosts. However, this cannot be presumed, because the router
30441 options and preconditions may refer to the local part of the address. By
30442 default, therefore, Exim routes each address in a message independently. DNS
30443 servers run caches, so repeated DNS lookups are not normally expensive, and in
30444 any case, personal messages rarely have more than a few recipients.
30445 </para>
30446 <para>
30447 If you are running mailing lists with large numbers of subscribers at the same
30448 domain, and you are using a <command>dnslookup</command> router which is independent of the
30449 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30450 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
30451 routes an address to a remote transport, any other unrouted addresses in the
30452 message that have the same domain are automatically given the same routing
30453 without processing them independently,
30454 provided the following conditions are met:
30455 </para>
30456 <itemizedlist>
30457 <listitem>
30458 <para>
30459 No router that processed the address specified <option>headers_add</option> or
30460 <option>headers_remove</option>.
30461 </para>
30462 </listitem>
30463 <listitem>
30464 <para>
30465 The router did not change the address in any way, for example, by <quote>widening</quote>
30466 the domain.
30467 </para>
30468 </listitem>
30469 </itemizedlist>
30470 <para>
30471 <indexterm role="option">
30472 <primary><option>search_parents</option></primary>
30473 </indexterm>
30474 </para>
30475 <informaltable frame="all">
30476 <tgroup cols="4" colsep="0" rowsep="0">
30477 <colspec colwidth="8*" align="left"/>
30478 <colspec colwidth="5*" align="center"/>
30479 <colspec colwidth="5*" align="center"/>
30480 <colspec colwidth="6*" align="right"/>
30481 <tbody>
30482 <row>
30483 <entry><option>search_parents</option></entry>
30484 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30485 <entry>Type: <emphasis>boolean</emphasis></entry>
30486 <entry>Default: <emphasis>false</emphasis></entry>
30487 </row>
30488 </tbody>
30489 </tgroup>
30490 </informaltable>
30491 <para>
30492 <indexterm role="concept">
30493 <primary>DNS</primary>
30494 <secondary>resolver options</secondary>
30495 </indexterm>
30496 When this option is true, the resolver option RES_DNSRCH is set for DNS
30497 lookups. This is different from the <option>qualify_single</option> option in that it
30498 applies to domains containing dots. Typically, but not standardly, it causes
30499 the resolver to search for the name in the current domain and in parent
30500 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
30501 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
30502 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
30503 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
30504 </para>
30505 <para>
30506 Setting this option true can cause problems in domains that have a wildcard MX
30507 record, because any domain that does not have its own MX record matches the
30508 local wildcard.
30509 </para>
30510 <para>
30511 <indexterm role="option">
30512 <primary><option>srv_fail_domains</option></primary>
30513 </indexterm>
30514 </para>
30515 <informaltable frame="all">
30516 <tgroup cols="4" colsep="0" rowsep="0">
30517 <colspec colwidth="8*" align="left"/>
30518 <colspec colwidth="5*" align="center"/>
30519 <colspec colwidth="5*" align="center"/>
30520 <colspec colwidth="6*" align="right"/>
30521 <tbody>
30522 <row>
30523 <entry><option>srv_fail_domains</option></entry>
30524 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30525 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30526 <entry>Default: <emphasis>unset</emphasis></entry>
30527 </row>
30528 </tbody>
30529 </tgroup>
30530 </informaltable>
30531 <para>
30532 If the DNS lookup for SRV records for one of the domains in this list causes a
30533 DNS lookup error, Exim behaves as if no SRV records were found. See section
30534 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30535 </para>
30536 <para>
30537 <indexterm role="option">
30538 <primary><option>widen_domains</option></primary>
30539 </indexterm>
30540 </para>
30541 <informaltable frame="all">
30542 <tgroup cols="4" colsep="0" rowsep="0">
30543 <colspec colwidth="8*" align="left"/>
30544 <colspec colwidth="5*" align="center"/>
30545 <colspec colwidth="5*" align="center"/>
30546 <colspec colwidth="6*" align="right"/>
30547 <tbody>
30548 <row>
30549 <entry><option>widen_domains</option></entry>
30550 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30551 <entry>Type: <emphasis>string list</emphasis></entry>
30552 <entry>Default: <emphasis>unset</emphasis></entry>
30553 </row>
30554 </tbody>
30555 </tgroup>
30556 </informaltable>
30557 <para>
30558 <indexterm role="concept">
30559 <primary>domain</primary>
30560 <secondary>partial; widening</secondary>
30561 </indexterm>
30562 If a DNS lookup fails and this option is set, each of its strings in turn is
30563 added onto the end of the domain, and the lookup is tried again. For example,
30564 if
30565 </para>
30566 <literallayout class="monospaced">
30567 widen_domains = fict.example:ref.example
30568 </literallayout>
30569 <para>
30570 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
30571 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
30572 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
30573 and <option>search_parents</option> options can cause some widening to be undertaken inside
30574 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
30575 when verifying, unless <option>rewrite_headers</option> is false (not the default).
30576 </para>
30577 </section>
30578 <section>
30579 <title>Effect of qualify_single and search_parents</title>
30580 <para>
30581 When a domain from an envelope recipient is changed by the resolver as a result
30582 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
30583 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
30584 is set false. Exim then re-routes the address, using the full domain.
30585 </para>
30586 <para>
30587 These two options affect only the DNS lookup that takes place inside the router
30588 for the domain of the address that is being routed. They do not affect lookups
30589 such as that implied by
30590 </para>
30591 <literallayout class="monospaced">
30592 domains = @mx_any
30593 </literallayout>
30594 <para>
30595 that may happen while processing a router precondition before the router is
30596 entered. No widening ever takes place for these lookups.
30597 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
30598 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
30599 </para>
30600 </section>
30601 </chapter>
30602
30603 <chapter>
30604 <title>The ipliteral router</title>
30605 <para>
30606 <indexterm role="concept">
30607 <primary><command>ipliteral</command> router</primary>
30608 </indexterm>
30609 <indexterm role="concept">
30610 <primary>domain literal</primary>
30611 <secondary>routing</secondary>
30612 </indexterm>
30613 <indexterm role="concept">
30614 <primary>routers</primary>
30615 <secondary><command>ipliteral</command></secondary>
30616 </indexterm>
30617 This router has no private options. Unless it is being used purely for
30618 verification (see <option>verify_only</option>) a transport is required to be defined by the
30619 generic <option>transport</option> option. The router accepts the address if its domain part
30620 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
30621 router handles the address
30622 </para>
30623 <literallayout class="monospaced">
30624 root@[192.168.1.1]
30625 </literallayout>
30626 <para>
30627 by setting up delivery to the host with that IP address. IPv4 domain literals
30628 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
30629 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
30630 </para>
30631 <literallayout class="monospaced">
30632 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
30633 </literallayout>
30634 <para>
30635 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
30636 grounds that sooner or later somebody will try it.
30637 </para>
30638 <para>
30639 <indexterm role="concept">
30640 <primary><option>self</option> option</primary>
30641 <secondary>in <command>ipliteral</command> router</secondary>
30642 </indexterm>
30643 If the IP address matches something in <option>ignore_target_hosts</option>, the router
30644 declines. If an IP literal turns out to refer to the local host, the generic
30645 <option>self</option> option determines what happens.
30646 </para>
30647 <para>
30648 The RFCs require support for domain literals; however, their use is
30649 controversial in today&#x2019;s Internet. If you want to use this router, you must
30650 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
30651 Exim will not recognize the domain literal syntax in addresses.
30652 </para>
30653 </chapter>
30654
30655 <chapter>
30656 <title>The iplookup router</title>
30657 <para>
30658 <indexterm role="concept">
30659 <primary><command>iplookup</command> router</primary>
30660 </indexterm>
30661 <indexterm role="concept">
30662 <primary>routers</primary>
30663 <secondary><command>iplookup</command></secondary>
30664 </indexterm>
30665 The <command>iplookup</command> router was written to fulfil a specific requirement in
30666 Cambridge University (which in fact no longer exists). For this reason, it is
30667 not included in the binary of Exim by default. If you want to include it, you
30668 must set
30669 </para>
30670 <literallayout class="monospaced">
30671 ROUTER_IPLOOKUP=yes
30672 </literallayout>
30673 <para>
30674 in your <filename>Local/Makefile</filename> configuration file.
30675 </para>
30676 <para>
30677 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
30678 connection to one or more specific hosts. The host can then return the same or
30679 a different address &ndash; in effect rewriting the recipient address in the
30680 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
30681 this process fails, the address can be passed on to other routers, or delivery
30682 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
30683 must not be specified for it.
30684 </para>
30685 <para>
30686 <indexterm role="concept">
30687 <primary>options</primary>
30688 <secondary><command>iplookup</command> router</secondary>
30689 </indexterm>
30690 <indexterm role="option">
30691 <primary><option>hosts</option></primary>
30692 </indexterm>
30693 </para>
30694 <informaltable frame="all">
30695 <tgroup cols="4" colsep="0" rowsep="0">
30696 <colspec colwidth="8*" align="left"/>
30697 <colspec colwidth="5*" align="center"/>
30698 <colspec colwidth="5*" align="center"/>
30699 <colspec colwidth="6*" align="right"/>
30700 <tbody>
30701 <row>
30702 <entry><option>hosts</option></entry>
30703 <entry>Use: <emphasis>iplookup</emphasis></entry>
30704 <entry>Type: <emphasis>string</emphasis></entry>
30705 <entry>Default: <emphasis>unset</emphasis></entry>
30706 </row>
30707 </tbody>
30708 </tgroup>
30709 </informaltable>
30710 <para>
30711 This option must be supplied. Its value is a colon-separated list of host
30712 names. The hosts are looked up using <function>gethostbyname()</function>
30713 (or <function>getipnodebyname()</function> when available)
30714 and are tried in order until one responds to the query. If none respond, what
30715 happens is controlled by <option>optional</option>.
30716 </para>
30717 <para>
30718 <indexterm role="option">
30719 <primary><option>optional</option></primary>
30720 </indexterm>
30721 </para>
30722 <informaltable frame="all">
30723 <tgroup cols="4" colsep="0" rowsep="0">
30724 <colspec colwidth="8*" align="left"/>
30725 <colspec colwidth="5*" align="center"/>
30726 <colspec colwidth="5*" align="center"/>
30727 <colspec colwidth="6*" align="right"/>
30728 <tbody>
30729 <row>
30730 <entry><option>optional</option></entry>
30731 <entry>Use: <emphasis>iplookup</emphasis></entry>
30732 <entry>Type: <emphasis>boolean</emphasis></entry>
30733 <entry>Default: <emphasis>false</emphasis></entry>
30734 </row>
30735 </tbody>
30736 </tgroup>
30737 </informaltable>
30738 <para>
30739 If <option>optional</option> is true, if no response is obtained from any host, the address
30740 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
30741 delivery to the address is deferred.
30742 </para>
30743 <para>
30744 <indexterm role="option">
30745 <primary><option>port</option></primary>
30746 </indexterm>
30747 </para>
30748 <informaltable frame="all">
30749 <tgroup cols="4" colsep="0" rowsep="0">
30750 <colspec colwidth="8*" align="left"/>
30751 <colspec colwidth="5*" align="center"/>
30752 <colspec colwidth="5*" align="center"/>
30753 <colspec colwidth="6*" align="right"/>
30754 <tbody>
30755 <row>
30756 <entry><option>port</option></entry>
30757 <entry>Use: <emphasis>iplookup</emphasis></entry>
30758 <entry>Type: <emphasis>integer</emphasis></entry>
30759 <entry>Default: <emphasis>0</emphasis></entry>
30760 </row>
30761 </tbody>
30762 </tgroup>
30763 </informaltable>
30764 <para>
30765 <indexterm role="concept">
30766 <primary>port</primary>
30767 <secondary><command>iplookup</command> router</secondary>
30768 </indexterm>
30769 This option must be supplied. It specifies the port number for the TCP or UDP
30770 call.
30771 </para>
30772 <para>
30773 <indexterm role="option">
30774 <primary><option>protocol</option></primary>
30775 </indexterm>
30776 </para>
30777 <informaltable frame="all">
30778 <tgroup cols="4" colsep="0" rowsep="0">
30779 <colspec colwidth="8*" align="left"/>
30780 <colspec colwidth="5*" align="center"/>
30781 <colspec colwidth="5*" align="center"/>
30782 <colspec colwidth="6*" align="right"/>
30783 <tbody>
30784 <row>
30785 <entry><option>protocol</option></entry>
30786 <entry>Use: <emphasis>iplookup</emphasis></entry>
30787 <entry>Type: <emphasis>string</emphasis></entry>
30788 <entry>Default: <emphasis>udp</emphasis></entry>
30789 </row>
30790 </tbody>
30791 </tgroup>
30792 </informaltable>
30793 <para>
30794 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
30795 protocols is to be used.
30796 </para>
30797 <para>
30798 <indexterm role="option">
30799 <primary><option>query</option></primary>
30800 </indexterm>
30801 </para>
30802 <informaltable frame="all">
30803 <tgroup cols="4" colsep="0" rowsep="0">
30804 <colspec colwidth="8*" align="left"/>
30805 <colspec colwidth="5*" align="center"/>
30806 <colspec colwidth="5*" align="center"/>
30807 <colspec colwidth="6*" align="right"/>
30808 <tbody>
30809 <row>
30810 <entry><option>query</option></entry>
30811 <entry>Use: <emphasis>iplookup</emphasis></entry>
30812 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30813 <entry>Default: <emphasis><literal>$local_part@$domain $local_part@$domain</literal></emphasis></entry>
30814 </row>
30815 </tbody>
30816 </tgroup>
30817 </informaltable>
30818 <para>
30819 This defines the content of the query that is sent to the remote hosts. The
30820 repetition serves as a way of checking that a response is to the correct query
30821 in the default case (see <option>response_pattern</option> below).
30822 </para>
30823 <para>
30824 <indexterm role="option">
30825 <primary><option>reroute</option></primary>
30826 </indexterm>
30827 </para>
30828 <informaltable frame="all">
30829 <tgroup cols="4" colsep="0" rowsep="0">
30830 <colspec colwidth="8*" align="left"/>
30831 <colspec colwidth="5*" align="center"/>
30832 <colspec colwidth="5*" align="center"/>
30833 <colspec colwidth="6*" align="right"/>
30834 <tbody>
30835 <row>
30836 <entry><option>reroute</option></entry>
30837 <entry>Use: <emphasis>iplookup</emphasis></entry>
30838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30839 <entry>Default: <emphasis>unset</emphasis></entry>
30840 </row>
30841 </tbody>
30842 </tgroup>
30843 </informaltable>
30844 <para>
30845 If this option is not set, the rerouted address is precisely the byte string
30846 returned by the remote host, up to the first white space, if any. If set, the
30847 string is expanded to form the rerouted address. It can include parts matched
30848 in the response by <option>response_pattern</option> by means of numeric variables such as
30849 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
30850 whether or not a pattern is in use. In all cases, the rerouted address must end
30851 up in the form <emphasis>local_part@domain</emphasis>.
30852 </para>
30853 <para>
30854 <indexterm role="option">
30855 <primary><option>response_pattern</option></primary>
30856 </indexterm>
30857 </para>
30858 <informaltable frame="all">
30859 <tgroup cols="4" colsep="0" rowsep="0">
30860 <colspec colwidth="8*" align="left"/>
30861 <colspec colwidth="5*" align="center"/>
30862 <colspec colwidth="5*" align="center"/>
30863 <colspec colwidth="6*" align="right"/>
30864 <tbody>
30865 <row>
30866 <entry><option>response_pattern</option></entry>
30867 <entry>Use: <emphasis>iplookup</emphasis></entry>
30868 <entry>Type: <emphasis>string</emphasis></entry>
30869 <entry>Default: <emphasis>unset</emphasis></entry>
30870 </row>
30871 </tbody>
30872 </tgroup>
30873 </informaltable>
30874 <para>
30875 This option can be set to a regular expression that is applied to the string
30876 returned from the remote host. If the pattern does not match the response, the
30877 router declines. If <option>response_pattern</option> is not set, no checking of the
30878 response is done, unless the query was defaulted, in which case there is a
30879 check that the text returned after the first white space is the original
30880 address. This checks that the answer that has been received is in response to
30881 the correct question. For example, if the response is just a new domain, the
30882 following could be used:
30883 </para>
30884 <literallayout class="monospaced">
30885 response_pattern = ^([^@]+)$
30886 reroute = $local_part@$1
30887 </literallayout>
30888 <para>
30889 <indexterm role="option">
30890 <primary><option>timeout</option></primary>
30891 </indexterm>
30892 </para>
30893 <informaltable frame="all">
30894 <tgroup cols="4" colsep="0" rowsep="0">
30895 <colspec colwidth="8*" align="left"/>
30896 <colspec colwidth="5*" align="center"/>
30897 <colspec colwidth="5*" align="center"/>
30898 <colspec colwidth="6*" align="right"/>
30899 <tbody>
30900 <row>
30901 <entry><option>timeout</option></entry>
30902 <entry>Use: <emphasis>iplookup</emphasis></entry>
30903 <entry>Type: <emphasis>time</emphasis></entry>
30904 <entry>Default: <emphasis>5s</emphasis></entry>
30905 </row>
30906 </tbody>
30907 </tgroup>
30908 </informaltable>
30909 <para>
30910 This specifies the amount of time to wait for a response from the remote
30911 machine. The same timeout is used for the <function>connect()</function> function for a TCP
30912 call. It does not apply to UDP.
30913 </para>
30914 </chapter>
30915
30916 <chapter>
30917 <title>The manualroute router</title>
30918 <para>
30919 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
30920 <primary><command>manualroute</command> router</primary>
30921 </indexterm>
30922 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
30923 <primary>routers</primary>
30924 <secondary><command>manualroute</command></secondary>
30925 </indexterm>
30926 <indexterm role="concept">
30927 <primary>domain</primary>
30928 <secondary>manually routing</secondary>
30929 </indexterm>
30930 The <command>manualroute</command> router is so-called because it provides a way of manually
30931 routing an address according to its domain. It is mainly used when you want to
30932 route addresses to remote hosts according to your own rules, bypassing the
30933 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
30934 route to local transports, a facility that may be useful if you want to save
30935 messages for dial-in hosts in local files.
30936 </para>
30937 <para>
30938 The <command>manualroute</command> router compares a list of domain patterns with the domain
30939 it is trying to route. If there is no match, the router declines. Each pattern
30940 has associated with it a list of hosts and some other optional data, which may
30941 include a transport. The combination of a pattern and its data is called a
30942 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
30943 generic <option>transport</option> option must specify a transport, unless the router is
30944 being used purely for verification (see <option>verify_only</option>).
30945 </para>
30946 <para>
30947 <indexterm role="concept">
30948 <primary><varname>$host</varname></primary>
30949 </indexterm>
30950 In the case of verification, matching the domain pattern is sufficient for the
30951 router to accept the address. When actually routing an address for delivery,
30952 an address that matches a domain pattern is queued for the associated
30953 transport. If the transport is not a local one, a host list must be associated
30954 with the pattern; IP addresses are looked up for the hosts, and these are
30955 passed to the transport along with the mail address. For local transports, a
30956 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
30957 text string.
30958 </para>
30959 <para>
30960 The list of routing rules can be provided as an inline string in
30961 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
30962 or database by setting <option>route_data</option>. Only one of these settings may appear in
30963 any one instance of <command>manualroute</command>. The format of routing rules is described
30964 below, following the list of private options.
30965 </para>
30966 <section id="SECTprioptman">
30967 <title>Private options for manualroute</title>
30968 <para>
30969 <indexterm role="concept">
30970 <primary>options</primary>
30971 <secondary><command>manualroute</command> router</secondary>
30972 </indexterm>
30973 The private options for the <command>manualroute</command> router are as follows:
30974 </para>
30975 <para>
30976 <indexterm role="option">
30977 <primary><option>host_find_failed</option></primary>
30978 </indexterm>
30979 </para>
30980 <informaltable frame="all">
30981 <tgroup cols="4" colsep="0" rowsep="0">
30982 <colspec colwidth="8*" align="left"/>
30983 <colspec colwidth="5*" align="center"/>
30984 <colspec colwidth="5*" align="center"/>
30985 <colspec colwidth="6*" align="right"/>
30986 <tbody>
30987 <row>
30988 <entry><option>host_find_failed</option></entry>
30989 <entry>Use: <emphasis>manualroute</emphasis></entry>
30990 <entry>Type: <emphasis>string</emphasis></entry>
30991 <entry>Default: <emphasis>freeze</emphasis></entry>
30992 </row>
30993 </tbody>
30994 </tgroup>
30995 </informaltable>
30996 <para>
30997 This option controls what happens when <command>manualroute</command> tries to find an IP
30998 address for a host, and the host does not exist. The option can be set to one
30999 of
31000 </para>
31001 <literallayout class="monospaced">
31002 decline
31003 defer
31004 fail
31005 freeze
31006 pass
31007 </literallayout>
31008 <para>
31009 The default assumes that this state is a serious configuration error. The
31010 difference between <quote>pass</quote> and <quote>decline</quote> is that the former forces the
31011 address to be passed to the next router (or the router defined by
31012 <option>pass_router</option>),
31013 <indexterm role="concept">
31014 <primary><option>more</option> option</primary>
31015 </indexterm>
31016 overriding <option>no_more</option>, whereas the latter passes the address to the next
31017 router only if <option>more</option> is true.
31018 </para>
31019 <para>
31020 This option applies only to a definite <quote>does not exist</quote> state; if a host
31021 lookup gets a temporary error, delivery is deferred unless the generic
31022 <option>pass_on_timeout</option> option is set.
31023 </para>
31024 <para>
31025 <indexterm role="option">
31026 <primary><option>hosts_randomize</option></primary>
31027 </indexterm>
31028 </para>
31029 <informaltable frame="all">
31030 <tgroup cols="4" colsep="0" rowsep="0">
31031 <colspec colwidth="8*" align="left"/>
31032 <colspec colwidth="5*" align="center"/>
31033 <colspec colwidth="5*" align="center"/>
31034 <colspec colwidth="6*" align="right"/>
31035 <tbody>
31036 <row>
31037 <entry><option>hosts_randomize</option></entry>
31038 <entry>Use: <emphasis>manualroute</emphasis></entry>
31039 <entry>Type: <emphasis>boolean</emphasis></entry>
31040 <entry>Default: <emphasis>false</emphasis></entry>
31041 </row>
31042 </tbody>
31043 </tgroup>
31044 </informaltable>
31045 <para>
31046 <indexterm role="concept">
31047 <primary>randomized host list</primary>
31048 </indexterm>
31049 <indexterm role="concept">
31050 <primary>host</primary>
31051 <secondary>list of; randomized</secondary>
31052 </indexterm>
31053 If this option is set, the order of the items in a host list in a routing rule
31054 is randomized each time the list is used, unless an option in the routing rule
31055 overrides (see below). Randomizing the order of a host list can be used to do
31056 crude load sharing. However, if more than one mail address is routed by the
31057 same router to the same host list, the host lists are considered to be the same
31058 (even though they may be randomized into different orders) for the purpose of
31059 deciding whether to batch the deliveries into a single SMTP transaction.
31060 </para>
31061 <para>
31062 When <option>hosts_randomize</option> is true, a host list may be split
31063 into groups whose order is separately randomized. This makes it possible to
31064 set up MX-like behaviour. The boundaries between groups are indicated by an
31065 item that is just <literal>+</literal> in the host list. For example:
31066 </para>
31067 <literallayout class="monospaced">
31068 route_list = * host1:host2:host3:+:host4:host5
31069 </literallayout>
31070 <para>
31071 The order of the first three hosts and the order of the last two hosts is
31072 randomized for each use, but the first three always end up before the last two.
31073 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
31074 randomized host list is passed to an <command>smtp</command> transport that also has
31075 <option>hosts_randomize set</option>, the list is not re-randomized.
31076 </para>
31077 <para>
31078 <indexterm role="option">
31079 <primary><option>route_data</option></primary>
31080 </indexterm>
31081 </para>
31082 <informaltable frame="all">
31083 <tgroup cols="4" colsep="0" rowsep="0">
31084 <colspec colwidth="8*" align="left"/>
31085 <colspec colwidth="5*" align="center"/>
31086 <colspec colwidth="5*" align="center"/>
31087 <colspec colwidth="6*" align="right"/>
31088 <tbody>
31089 <row>
31090 <entry><option>route_data</option></entry>
31091 <entry>Use: <emphasis>manualroute</emphasis></entry>
31092 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31093 <entry>Default: <emphasis>unset</emphasis></entry>
31094 </row>
31095 </tbody>
31096 </tgroup>
31097 </informaltable>
31098 <para>
31099 If this option is set, it must expand to yield the data part of a routing rule.
31100 Typically, the expansion string includes a lookup based on the domain. For
31101 example:
31102 </para>
31103 <literallayout class="monospaced">
31104 route_data = ${lookup{$domain}dbm{/etc/routes}}
31105 </literallayout>
31106 <para>
31107 If the expansion is forced to fail, or the result is an empty string, the
31108 router declines. Other kinds of expansion failure cause delivery to be
31109 deferred.
31110 </para>
31111 <para>
31112 <indexterm role="option">
31113 <primary><option>route_list</option></primary>
31114 </indexterm>
31115 </para>
31116 <informaltable frame="all">
31117 <tgroup cols="4" colsep="0" rowsep="0">
31118 <colspec colwidth="8*" align="left"/>
31119 <colspec colwidth="5*" align="center"/>
31120 <colspec colwidth="5*" align="center"/>
31121 <colspec colwidth="6*" align="right"/>
31122 <tbody>
31123 <row>
31124 <entry><option>route_list</option></entry>
31125 <entry>Use: <emphasis>manualroute</emphasis></entry>
31126 <entry>Type: <emphasis> </emphasis></entry>
31127 <entry>Default: <emphasis>string</emphasis></entry>
31128 </row>
31129 </tbody>
31130 </tgroup>
31131 </informaltable>
31132 <para>
31133 This string is a list of routing rules, in the form defined below. Note that,
31134 unlike most string lists, the items are separated by semicolons. This is so
31135 that they may contain colon-separated host lists.
31136 </para>
31137 <para>
31138 <indexterm role="option">
31139 <primary><option>same_domain_copy_routing</option></primary>
31140 </indexterm>
31141 </para>
31142 <informaltable frame="all">
31143 <tgroup cols="4" colsep="0" rowsep="0">
31144 <colspec colwidth="8*" align="left"/>
31145 <colspec colwidth="5*" align="center"/>
31146 <colspec colwidth="5*" align="center"/>
31147 <colspec colwidth="6*" align="right"/>
31148 <tbody>
31149 <row>
31150 <entry><option>same_domain_copy_routing</option></entry>
31151 <entry>Use: <emphasis>manualroute</emphasis></entry>
31152 <entry>Type: <emphasis>boolean</emphasis></entry>
31153 <entry>Default: <emphasis>false</emphasis></entry>
31154 </row>
31155 </tbody>
31156 </tgroup>
31157 </informaltable>
31158 <para>
31159 <indexterm role="concept">
31160 <primary>address</primary>
31161 <secondary>copying routing</secondary>
31162 </indexterm>
31163 Addresses with the same domain are normally routed by the <command>manualroute</command>
31164 router to the same list of hosts. However, this cannot be presumed, because the
31165 router options and preconditions may refer to the local part of the address. By
31166 default, therefore, Exim routes each address in a message independently. DNS
31167 servers run caches, so repeated DNS lookups are not normally expensive, and in
31168 any case, personal messages rarely have more than a few recipients.
31169 </para>
31170 <para>
31171 If you are running mailing lists with large numbers of subscribers at the same
31172 domain, and you are using a <command>manualroute</command> router which is independent of the
31173 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
31174 lookups for identical domains in one message. In this case, when
31175 <command>manualroute</command> routes an address to a remote transport, any other unrouted
31176 addresses in the message that have the same domain are automatically given the
31177 same routing without processing them independently. However, this is only done
31178 if <option>headers_add</option> and <option>headers_remove</option> are unset.
31179 </para>
31180 </section>
31181 <section>
31182 <title>Routing rules in route_list</title>
31183 <para>
31184 The value of <option>route_list</option> is a string consisting of a sequence of routing
31185 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
31186 entered as two semicolons. Alternatively, the list separator can be changed as
31187 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
31188 Empty rules are ignored. The format of each rule is
31189 </para>
31190 <literallayout>
31191 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
31192 </literallayout>
31193 <para>
31194 The following example contains two rules, each with a simple domain pattern and
31195 no options:
31196 </para>
31197 <literallayout class="monospaced">
31198 route_list = \
31199   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
31200   thes.ref.example  mail-3.ref.example:mail-4.ref.example
31201 </literallayout>
31202 <para>
31203 The three parts of a rule are separated by white space. The pattern and the
31204 list of hosts can be enclosed in quotes if necessary, and if they are, the
31205 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
31206 single domain pattern, which is the only mandatory item in the rule. The
31207 pattern is in the same format as one item in a domain list (see section
31208 <xref linkend="SECTdomainlist"/>),
31209 except that it may not be the name of an interpolated file.
31210 That is, it may be wildcarded, or a regular expression, or a file or database
31211 lookup (with semicolons doubled, because of the use of semicolon as a separator
31212 in a <option>route_list</option>).
31213 </para>
31214 <para>
31215 The rules in <option>route_list</option> are searched in order until one of the patterns
31216 matches the domain that is being routed. The list of hosts and then options are
31217 then used as described below. If there is no match, the router declines. When
31218 <option>route_list</option> is set, <option>route_data</option> must not be set.
31219 </para>
31220 </section>
31221 <section>
31222 <title>Routing rules in route_data</title>
31223 <para>
31224 The use of <option>route_list</option> is convenient when there are only a small number of
31225 routing rules. For larger numbers, it is easier to use a file or database to
31226 hold the routing information, and use the <option>route_data</option> option instead.
31227 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
31228 Most commonly, <option>route_data</option> is set as a string that contains an
31229 expansion lookup. For example, suppose we place two routing rules in a file
31230 like this:
31231 </para>
31232 <literallayout class="monospaced">
31233 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
31234 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
31235 </literallayout>
31236 <para>
31237 This data can be accessed by setting
31238 </para>
31239 <literallayout class="monospaced">
31240 route_data = ${lookup{$domain}lsearch{/the/file/name}}
31241 </literallayout>
31242 <para>
31243 Failure of the lookup results in an empty string, causing the router to
31244 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
31245 requirement is that the result of expanding the string is a list of hosts,
31246 possibly followed by options, separated by white space. The list of hosts must
31247 be enclosed in quotes if it contains white space.
31248 </para>
31249 </section>
31250 <section>
31251 <title>Format of the list of hosts</title>
31252 <para>
31253 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
31254 always separately expanded before use. If the expansion fails, the router
31255 declines. The result of the expansion must be a colon-separated list of names
31256 and/or IP addresses, optionally also including ports. The format of each item
31257 in the list is described in the next section. The list separator can be changed
31258 as described in section <xref linkend="SECTlistconstruct"/>.
31259 </para>
31260 <para>
31261 If the list of hosts was obtained from a <option>route_list</option> item, the following
31262 variables are set during its expansion:
31263 </para>
31264 <itemizedlist>
31265 <listitem>
31266 <para>
31267 <indexterm role="concept">
31268 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
31269 <secondary>in <command>manualroute</command> router</secondary>
31270 </indexterm>
31271 If the domain was matched against a regular expression, the numeric variables
31272 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
31273 </para>
31274 <literallayout class="monospaced">
31275 route_list = ^domain(\d+)   host-$1.text.example
31276 </literallayout>
31277 </listitem>
31278 <listitem>
31279 <para>
31280 <varname>$0</varname> is always set to the entire domain.
31281 </para>
31282 </listitem>
31283 <listitem>
31284 <para>
31285 <varname>$1</varname> is also set when partial matching is done in a file lookup.
31286 </para>
31287 </listitem>
31288 <listitem>
31289 <para>
31290 <indexterm role="concept">
31291 <primary><varname>$value</varname></primary>
31292 </indexterm>
31293 If the pattern that matched the domain was a lookup item, the data that was
31294 looked up is available in the expansion variable <varname>$value</varname>. For example:
31295 </para>
31296 <literallayout class="monospaced">
31297 route_list = lsearch;;/some/file.routes  $value
31298 </literallayout>
31299 </listitem>
31300 </itemizedlist>
31301 <para>
31302 Note the doubling of the semicolon in the pattern that is necessary because
31303 semicolon is the default route list separator.
31304 </para>
31305 </section>
31306 <section id="SECTformatonehostitem">
31307 <title>Format of one host item</title>
31308 <para>
31309 Each item in the list of hosts is either a host name or an IP address,
31310 optionally with an attached port number. When no port is given, an IP address
31311 is not enclosed in brackets. When a port is specified, it overrides the port
31312 specification on the transport. The port is separated from the name or address
31313 by a colon. This leads to some complications:
31314 </para>
31315 <itemizedlist>
31316 <listitem>
31317 <para>
31318 Because colon is the default separator for the list of hosts, either
31319 the colon that specifies a port must be doubled, or the list separator must
31320 be changed. The following two examples have the same effect:
31321 </para>
31322 <literallayout class="monospaced">
31323 route_list = * "host1.tld::1225 : host2.tld::1226"
31324 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
31325 </literallayout>
31326 </listitem>
31327 <listitem>
31328 <para>
31329 When IPv6 addresses are involved, it gets worse, because they contain
31330 colons of their own. To make this case easier, it is permitted to
31331 enclose an IP address (either v4 or v6) in square brackets if a port
31332 number follows. For example:
31333 </para>
31334 <literallayout class="monospaced">
31335 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
31336 </literallayout>
31337 </listitem>
31338 </itemizedlist>
31339 </section>
31340 <section id="SECThostshowused">
31341 <title>How the list of hosts is used</title>
31342 <para>
31343 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
31344 the hosts is tried, in the order specified, when carrying out the SMTP
31345 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
31346 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
31347 transport.
31348 </para>
31349 <para>
31350 Hosts may be listed by name or by IP address. An unadorned name in the list of
31351 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
31352 interpreted as an indirection to a sublist of hosts obtained by looking up MX
31353 records in the DNS. For example:
31354 </para>
31355 <literallayout class="monospaced">
31356 route_list = *  x.y.z:p.q.r/MX:e.f.g
31357 </literallayout>
31358 <para>
31359 If this feature is used with a port specifier, the port must come last. For
31360 example:
31361 </para>
31362 <literallayout class="monospaced">
31363 route_list = *  dom1.tld/mx::1225
31364 </literallayout>
31365 <para>
31366 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
31367 randomized before any lookups are done. Exim then scans the list; for any name
31368 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
31369 be an interface on the local host and the item is not the first in the list,
31370 Exim discards it and any subsequent items. If it is the first item, what
31371 happens is controlled by the
31372 <indexterm role="concept">
31373 <primary><option>self</option> option</primary>
31374 <secondary>in <command>manualroute</command> router</secondary>
31375 </indexterm>
31376 <option>self</option> option of the router.
31377 </para>
31378 <para>
31379 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
31380 hosts obtained by looking up MX records for the name. This is always a DNS
31381 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
31382 below) are not relevant here. The order of these hosts is determined by the
31383 preference values in the MX records, according to the usual rules. Because
31384 randomizing happens before the MX lookup, it does not affect the order that is
31385 defined by MX preferences.
31386 </para>
31387 <para>
31388 If the local host is present in the sublist obtained from MX records, but is
31389 not the most preferred host in that list, it and any equally or less
31390 preferred hosts are removed before the sublist is inserted into the main list.
31391 </para>
31392 <para>
31393 If the local host is the most preferred host in the MX list, what happens
31394 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
31395 is not the first item (that is, there are previous hosts in the main list),
31396 Exim discards this name and any subsequent items in the main list.
31397 </para>
31398 <para>
31399 If the MX item is first in the list of hosts, and the local host is the
31400 most preferred host, what happens is controlled by the <option>self</option> option of the
31401 router.
31402 </para>
31403 <para>
31404 DNS failures when lookup up the MX records are treated in the same way as DNS
31405 failures when looking up IP addresses: <option>pass_on_timeout</option> and
31406 <option>host_find_failed</option> are used when relevant.
31407 </para>
31408 <para>
31409 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
31410 whether obtained from an MX lookup or not.
31411 </para>
31412 </section>
31413 <section id="SECThowoptused">
31414 <title>How the options are used</title>
31415 <para>
31416 The options are a sequence of words; in practice no more than three are ever
31417 present. One of the words can be the name of a transport; this overrides the
31418 <option>transport</option> option on the router for this particular routing rule only. The
31419 other words (if present) control randomization of the list of hosts on a
31420 per-rule basis, and how the IP addresses of the hosts are to be found when
31421 routing to a remote transport. These options are as follows:
31422 </para>
31423 <itemizedlist>
31424 <listitem>
31425 <para>
31426 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
31427 setting of <option>hosts_randomize</option> for this routing rule only.
31428 </para>
31429 </listitem>
31430 <listitem>
31431 <para>
31432 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
31433 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
31434 </para>
31435 </listitem>
31436 <listitem>
31437 <para>
31438 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
31439 find IP addresses. This function may ultimately cause a DNS lookup, but it may
31440 also look in <filename>/etc/hosts</filename> or other sources of information.
31441 </para>
31442 </listitem>
31443 <listitem>
31444 <para>
31445 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
31446 no address records are found. If there is a temporary DNS error (such as a
31447 timeout), delivery is deferred.
31448 </para>
31449 </listitem>
31450 </itemizedlist>
31451 <para>
31452 For example:
31453 </para>
31454 <literallayout class="monospaced">
31455 route_list = domain1  host1:host2:host3  randomize bydns;\
31456              domain2  host4:host5
31457 </literallayout>
31458 <para>
31459 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
31460 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
31461 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
31462 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
31463 call.
31464 </para>
31465 <para>
31466 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
31467 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
31468 instead of TRY_AGAIN. That is why the default action is to try a DNS
31469 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
31470 function called.
31471 </para>
31472 <para>
31473 If no IP address for a host can be found, what happens is controlled by the
31474 <option>host_find_failed</option> option.
31475 </para>
31476 <para>
31477 <indexterm role="concept">
31478 <primary><varname>$host</varname></primary>
31479 </indexterm>
31480 When an address is routed to a local transport, IP addresses are not looked up.
31481 The host list is passed to the transport in the <varname>$host</varname> variable.
31482 </para>
31483 </section>
31484 <section>
31485 <title>Manualroute examples</title>
31486 <para>
31487 In some of the examples that follow, the presence of the <option>remote_smtp</option>
31488 transport, as defined in the default configuration file, is assumed:
31489 </para>
31490 <itemizedlist>
31491 <listitem>
31492 <para>
31493 <indexterm role="concept">
31494 <primary>smart host</primary>
31495 <secondary>example router</secondary>
31496 </indexterm>
31497 The <command>manualroute</command> router can be used to forward all external mail to a
31498 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
31499 named domain list that contains your local domains, for example:
31500 </para>
31501 <literallayout class="monospaced">
31502 domainlist local_domains = my.domain.example
31503 </literallayout>
31504 <para>
31505 You can arrange for all other domains to be routed to a smart host by making
31506 your first router something like this:
31507 </para>
31508 <literallayout class="monospaced">
31509 smart_route:
31510   driver = manualroute
31511   domains = !+local_domains
31512   transport = remote_smtp
31513   route_list = * smarthost.ref.example
31514 </literallayout>
31515 <para>
31516 This causes all non-local addresses to be sent to the single host
31517 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
31518 they are tried in order
31519 (but you can use <option>hosts_randomize</option> to vary the order each time).
31520 Another way of configuring the same thing is this:
31521 </para>
31522 <literallayout class="monospaced">
31523 smart_route:
31524   driver = manualroute
31525   transport = remote_smtp
31526   route_list = !+local_domains  smarthost.ref.example
31527 </literallayout>
31528 <para>
31529 There is no difference in behaviour between these two routers as they stand.
31530 However, they behave differently if <option>no_more</option> is added to them. In the first
31531 example, the router is skipped if the domain does not match the <option>domains</option>
31532 precondition; the following router is always tried. If the router runs, it
31533 always matches the domain and so can never decline. Therefore, <option>no_more</option>
31534 would have no effect. In the second case, the router is never skipped; it
31535 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
31536 <option>no_more</option> would prevent subsequent routers from running.
31537 </para>
31538 </listitem>
31539 <listitem>
31540 <para>
31541 <indexterm role="concept">
31542 <primary>mail hub example</primary>
31543 </indexterm>
31544 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
31545 records in the DNS and delivers it via its own private routing mechanism. Often
31546 the final destinations are behind a firewall, with the mail hub being the one
31547 machine that can connect to machines both inside and outside the firewall. The
31548 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
31549 to the correct hosts. For a small number of domains, the routing can be inline,
31550 using the <option>route_list</option> option, but for a larger number a file or database
31551 lookup is easier to manage.
31552 </para>
31553 <para>
31554 If the domain names are in fact the names of the machines to which the mail is
31555 to be sent by the mail hub, the configuration can be quite simple. For
31556 example:
31557 </para>
31558 <literallayout class="monospaced">
31559 hub_route:
31560   driver = manualroute
31561   transport = remote_smtp
31562   route_list = *.rhodes.tvs.example  $domain
31563 </literallayout>
31564 <para>
31565 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
31566 whose names are the same as the mail domains. A similar approach can be taken
31567 if the host name can be obtained from the domain name by a string manipulation
31568 that the expansion facilities can handle. Otherwise, a lookup based on the
31569 domain can be used to find the host:
31570 </para>
31571 <literallayout class="monospaced">
31572 through_firewall:
31573   driver = manualroute
31574   transport = remote_smtp
31575   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
31576 </literallayout>
31577 <para>
31578 The result of the lookup must be the name or IP address of the host (or
31579 hosts) to which the address is to be routed. If the lookup fails, the route
31580 data is empty, causing the router to decline. The address then passes to the
31581 next router.
31582 </para>
31583 </listitem>
31584 <listitem>
31585 <para>
31586 <indexterm role="concept">
31587 <primary>batched SMTP output example</primary>
31588 </indexterm>
31589 <indexterm role="concept">
31590 <primary>SMTP</primary>
31591 <secondary>batched outgoing; example</secondary>
31592 </indexterm>
31593 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
31594 SMTP format for onward transportation by some other means. This is one way of
31595 storing mail for a dial-up host when it is not connected. The route list entry
31596 can be as simple as a single domain name in a configuration like this:
31597 </para>
31598 <literallayout class="monospaced">
31599 save_in_file:
31600   driver = manualroute
31601   transport = batchsmtp_appendfile
31602   route_list = saved.domain.example
31603 </literallayout>
31604 <para>
31605 though often a pattern is used to pick up more than one domain. If there are
31606 several domains or groups of domains with different transport requirements,
31607 different transports can be listed in the routing information:
31608 </para>
31609 <literallayout class="monospaced">
31610 save_in_file:
31611   driver = manualroute
31612   route_list = \
31613     *.saved.domain1.example  $domain  batch_appendfile; \
31614     *.saved.domain2.example  \
31615       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
31616       batch_pipe
31617 </literallayout>
31618 <para>
31619 <indexterm role="concept">
31620 <primary><varname>$domain</varname></primary>
31621 </indexterm>
31622 <indexterm role="concept">
31623 <primary><varname>$host</varname></primary>
31624 </indexterm>
31625 The first of these just passes the domain in the <varname>$host</varname> variable, which
31626 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
31627 file lookup to find a value to pass, causing the router to decline to handle
31628 the address if the lookup fails.
31629 </para>
31630 </listitem>
31631 <listitem>
31632 <para>
31633 <indexterm role="concept">
31634 <primary>UUCP</primary>
31635 <secondary>example of router for</secondary>
31636 </indexterm>
31637 Routing mail directly to UUCP software is a specific case of the use of
31638 <command>manualroute</command> in a gateway to another mail environment. This is an example of
31639 one way it can be done:
31640 </para>
31641 <literallayout class="monospaced">
31642 # Transport
31643 uucp:
31644   driver = pipe
31645   user = nobody
31646   command = /usr/local/bin/uux -r - \
31647     ${substr_-5:$host}!rmail ${local_part}
31648   return_fail_output = true
31649
31650 # Router
31651 uucphost:
31652   transport = uucp
31653   driver = manualroute
31654   route_data = \
31655     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
31656 </literallayout>
31657 <para>
31658 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
31659 </para>
31660 <literallayout class="monospaced">
31661 darksite.ethereal.example:           darksite.UUCP
31662 </literallayout>
31663 <para>
31664 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
31665 makes clear the distinction between the domain name
31666 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
31667 </para>
31668 </listitem>
31669 </itemizedlist>
31670 <para>
31671 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
31672 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
31673 </para>
31674 </section>
31675 </chapter>
31676
31677 <chapter id="CHAPdriverlast">
31678 <title>The queryprogram router</title>
31679 <para>
31680 <indexterm role="concept" id="IIDquerou1" class="startofrange">
31681 <primary><command>queryprogram</command> router</primary>
31682 </indexterm>
31683 <indexterm role="concept" id="IIDquerou2" class="startofrange">
31684 <primary>routers</primary>
31685 <secondary><command>queryprogram</command></secondary>
31686 </indexterm>
31687 <indexterm role="concept">
31688 <primary>routing</primary>
31689 <secondary>by external program</secondary>
31690 </indexterm>
31691 The <command>queryprogram</command> router routes an address by running an external command
31692 and acting on its output. This is an expensive way to route, and is intended
31693 mainly for use in lightly-loaded systems, or for performing experiments.
31694 However, if it is possible to use the precondition options (<option>domains</option>,
31695 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
31696 be used in special cases, even on a busy host. There are the following private
31697 options:
31698 <indexterm role="concept">
31699 <primary>options</primary>
31700 <secondary><command>queryprogram</command> router</secondary>
31701 </indexterm>
31702 </para>
31703 <para>
31704 <indexterm role="option">
31705 <primary><option>command</option></primary>
31706 </indexterm>
31707 </para>
31708 <informaltable frame="all">
31709 <tgroup cols="4" colsep="0" rowsep="0">
31710 <colspec colwidth="8*" align="left"/>
31711 <colspec colwidth="5*" align="center"/>
31712 <colspec colwidth="5*" align="center"/>
31713 <colspec colwidth="6*" align="right"/>
31714 <tbody>
31715 <row>
31716 <entry><option>command</option></entry>
31717 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31718 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31719 <entry>Default: <emphasis>unset</emphasis></entry>
31720 </row>
31721 </tbody>
31722 </tgroup>
31723 </informaltable>
31724 <para>
31725 This option must be set. It specifies the command that is to be run. The
31726 command is split up into a command name and arguments, and then each is
31727 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
31728 <xref linkend="CHAPpipetransport"/>).
31729 </para>
31730 <para>
31731 <indexterm role="option">
31732 <primary><option>command_group</option></primary>
31733 </indexterm>
31734 </para>
31735 <informaltable frame="all">
31736 <tgroup cols="4" colsep="0" rowsep="0">
31737 <colspec colwidth="8*" align="left"/>
31738 <colspec colwidth="5*" align="center"/>
31739 <colspec colwidth="5*" align="center"/>
31740 <colspec colwidth="6*" align="right"/>
31741 <tbody>
31742 <row>
31743 <entry><option>command_group</option></entry>
31744 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31745 <entry>Type: <emphasis>string</emphasis></entry>
31746 <entry>Default: <emphasis>unset</emphasis></entry>
31747 </row>
31748 </tbody>
31749 </tgroup>
31750 </informaltable>
31751 <para>
31752 <indexterm role="concept">
31753 <primary>gid (group id)</primary>
31754 <secondary>in <command>queryprogram</command> router</secondary>
31755 </indexterm>
31756 This option specifies a gid to be set when running the command while routing an
31757 address for deliver. It must be set if <option>command_user</option> specifies a numerical
31758 uid. If it begins with a digit, it is interpreted as the numerical value of the
31759 gid. Otherwise it is looked up using <function>getgrnam()</function>.
31760 </para>
31761 <para>
31762 <indexterm role="option">
31763 <primary><option>command_user</option></primary>
31764 </indexterm>
31765 </para>
31766 <informaltable frame="all">
31767 <tgroup cols="4" colsep="0" rowsep="0">
31768 <colspec colwidth="8*" align="left"/>
31769 <colspec colwidth="5*" align="center"/>
31770 <colspec colwidth="5*" align="center"/>
31771 <colspec colwidth="6*" align="right"/>
31772 <tbody>
31773 <row>
31774 <entry><option>command_user</option></entry>
31775 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31776 <entry>Type: <emphasis>string</emphasis></entry>
31777 <entry>Default: <emphasis>unset</emphasis></entry>
31778 </row>
31779 </tbody>
31780 </tgroup>
31781 </informaltable>
31782 <para>
31783 <indexterm role="concept">
31784 <primary>uid (user id)</primary>
31785 <secondary>for <command>queryprogram</command></secondary>
31786 </indexterm>
31787 This option must be set. It specifies the uid which is set when running the
31788 command while routing an address for delivery. If the value begins with a digit,
31789 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
31790 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
31791 not set, a value for the gid also.
31792 </para>
31793 <para>
31794 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
31795 root, which it does during a normal delivery in a conventional configuration.
31796 However, when an address is being verified during message reception, Exim is
31797 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
31798 is called from a non-root process, Exim cannot change uid or gid before running
31799 the command. In this circumstance the command runs under the current uid and
31800 gid.
31801 </para>
31802 <para>
31803 <indexterm role="option">
31804 <primary><option>current_directory</option></primary>
31805 </indexterm>
31806 </para>
31807 <informaltable frame="all">
31808 <tgroup cols="4" colsep="0" rowsep="0">
31809 <colspec colwidth="8*" align="left"/>
31810 <colspec colwidth="5*" align="center"/>
31811 <colspec colwidth="5*" align="center"/>
31812 <colspec colwidth="6*" align="right"/>
31813 <tbody>
31814 <row>
31815 <entry><option>current_directory</option></entry>
31816 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31817 <entry>Type: <emphasis>string</emphasis></entry>
31818 <entry>Default: <emphasis>/</emphasis></entry>
31819 </row>
31820 </tbody>
31821 </tgroup>
31822 </informaltable>
31823 <para>
31824 This option specifies an absolute path which is made the current directory
31825 before running the command.
31826 </para>
31827 <para>
31828 <indexterm role="option">
31829 <primary><option>timeout</option></primary>
31830 </indexterm>
31831 </para>
31832 <informaltable frame="all">
31833 <tgroup cols="4" colsep="0" rowsep="0">
31834 <colspec colwidth="8*" align="left"/>
31835 <colspec colwidth="5*" align="center"/>
31836 <colspec colwidth="5*" align="center"/>
31837 <colspec colwidth="6*" align="right"/>
31838 <tbody>
31839 <row>
31840 <entry><option>timeout</option></entry>
31841 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31842 <entry>Type: <emphasis>time</emphasis></entry>
31843 <entry>Default: <emphasis>1h</emphasis></entry>
31844 </row>
31845 </tbody>
31846 </tgroup>
31847 </informaltable>
31848 <para>
31849 If the command does not complete within the timeout period, its process group
31850 is killed and the message is frozen. A value of zero time specifies no
31851 timeout.
31852 </para>
31853 <para>
31854 The standard output of the command is connected to a pipe, which is read when
31855 the command terminates. It should consist of a single line of output,
31856 containing up to five fields, separated by white space. The maximum length of
31857 the line is 1023 characters. Longer lines are silently truncated. The first
31858 field is one of the following words (case-insensitive):
31859 </para>
31860 <itemizedlist>
31861 <listitem>
31862 <para>
31863 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
31864 below).
31865 </para>
31866 </listitem>
31867 <listitem>
31868 <para>
31869 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
31870 <option>no_more</option> is set.
31871 </para>
31872 </listitem>
31873 <listitem>
31874 <para>
31875 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
31876 subsequent text on the line is an error message. If the router is run as part
31877 of address verification during an incoming SMTP message, the message is
31878 included in the SMTP response.
31879 </para>
31880 </listitem>
31881 <listitem>
31882 <para>
31883 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
31884 subsequent text on the line is an error message which is logged. It is not
31885 included in any SMTP response.
31886 </para>
31887 </listitem>
31888 <listitem>
31889 <para>
31890 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
31891 </para>
31892 </listitem>
31893 <listitem>
31894 <para>
31895 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
31896 <option>pass_router</option>), overriding <option>no_more</option>.
31897 </para>
31898 </listitem>
31899 <listitem>
31900 <para>
31901 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
31902 new addresses, which are routed independently, starting with the first router,
31903 or the router specified by <option>redirect_router</option>, if set.
31904 </para>
31905 </listitem>
31906 </itemizedlist>
31907 <para>
31908 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
31909 number of keyed data values, as follows (split into two lines here, to fit on
31910 the page):
31911 </para>
31912 <literallayout class="monospaced">
31913 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
31914 LOOKUP=byname|bydns DATA=&lt;text&gt;
31915 </literallayout>
31916 <para>
31917 The data items can be given in any order, and all are optional. If no transport
31918 is included, the transport specified by the generic <option>transport</option> option is
31919 used. The list of hosts and the lookup type are needed only if the transport is
31920 an <command>smtp</command> transport that does not itself supply a list of hosts.
31921 </para>
31922 <para>
31923 The format of the list of hosts is the same as for the <command>manualroute</command> router.
31924 As well as host names and IP addresses with optional port numbers, as described
31925 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
31926 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
31927 (see section <xref linkend="SECThostshowused"/>).
31928 </para>
31929 <para>
31930 If the lookup type is not specified, Exim behaves as follows when trying to
31931 find an IP address for each host: First, a DNS lookup is done. If this yields
31932 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
31933 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
31934 result of the lookup is the result of that call.
31935 </para>
31936 <para>
31937 <indexterm role="concept">
31938 <primary><varname>$address_data</varname></primary>
31939 </indexterm>
31940 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
31941 variable. For example, this return line
31942 </para>
31943 <literallayout class="monospaced">
31944 accept hosts=x1.y.example:x2.y.example data="rule1"
31945 </literallayout>
31946 <para>
31947 routes the address to the default transport, passing a list of two hosts. When
31948 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
31949 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
31950 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
31951 </para>
31952 </chapter>
31953
31954 <chapter id="CHAPredirect">
31955 <title>The redirect router</title>
31956 <para>
31957 <indexterm role="concept" id="IIDredrou1" class="startofrange">
31958 <primary><command>redirect</command> router</primary>
31959 </indexterm>
31960 <indexterm role="concept" id="IIDredrou2" class="startofrange">
31961 <primary>routers</primary>
31962 <secondary><command>redirect</command></secondary>
31963 </indexterm>
31964 <indexterm role="concept">
31965 <primary>alias file</primary>
31966 <secondary>in a <command>redirect</command> router</secondary>
31967 </indexterm>
31968 <indexterm role="concept">
31969 <primary>address redirection</primary>
31970 <secondary><command>redirect</command> router</secondary>
31971 </indexterm>
31972 The <command>redirect</command> router handles several kinds of address redirection. Its most
31973 common uses are for resolving local part aliases from a central alias file
31974 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
31975 files, but it has many other potential uses. The incoming address can be
31976 redirected in several different ways:
31977 </para>
31978 <itemizedlist>
31979 <listitem>
31980 <para>
31981 It can be replaced by one or more new addresses which are themselves routed
31982 independently.
31983 </para>
31984 </listitem>
31985 <listitem>
31986 <para>
31987 It can be routed to be delivered to a given file or directory.
31988 </para>
31989 </listitem>
31990 <listitem>
31991 <para>
31992 It can be routed to be delivered to a specified pipe command.
31993 </para>
31994 </listitem>
31995 <listitem>
31996 <para>
31997 It can cause an automatic reply to be generated.
31998 </para>
31999 </listitem>
32000 <listitem>
32001 <para>
32002 It can be forced to fail, with a custom error message.
32003 </para>
32004 </listitem>
32005 <listitem>
32006 <para>
32007 It can be temporarily deferred.
32008 </para>
32009 </listitem>
32010 <listitem>
32011 <para>
32012 It can be discarded.
32013 </para>
32014 </listitem>
32015 </itemizedlist>
32016 <para>
32017 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
32018 However, there are some private options which define transports for delivery to
32019 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
32020 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
32021 </para>
32022 <section>
32023 <title>Redirection data</title>
32024 <para>
32025 The router operates by interpreting a text string which it obtains either by
32026 expanding the contents of the <option>data</option> option, or by reading the entire
32027 contents of a file whose name is given in the <option>file</option> option. These two
32028 options are mutually exclusive. The first is commonly used for handling system
32029 aliases, in a configuration like this:
32030 </para>
32031 <literallayout class="monospaced">
32032 system_aliases:
32033   driver = redirect
32034   data = ${lookup{$local_part}lsearch{/etc/aliases}}
32035 </literallayout>
32036 <para>
32037 If the lookup fails, the expanded string in this example is empty. When the
32038 expansion of <option>data</option> results in an empty string, the router declines. A forced
32039 expansion failure also causes the router to decline; other expansion failures
32040 cause delivery to be deferred.
32041 </para>
32042 <para>
32043 A configuration using <option>file</option> is commonly used for handling users&#x2019;
32044 <filename>.forward</filename> files, like this:
32045 </para>
32046 <literallayout class="monospaced">
32047 userforward:
32048   driver = redirect
32049   check_local_user
32050   file = $home/.forward
32051   no_verify
32052 </literallayout>
32053 <para>
32054 If the file does not exist, or causes no action to be taken (for example, it is
32055 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
32056 is not the case when the file contains syntactically valid items that happen to
32057 yield empty addresses, for example, items containing only RFC 2822 address
32058 comments.
32059 </para>
32060 </section>
32061 <section>
32062 <title>Forward files and address verification</title>
32063 <para>
32064 <indexterm role="concept">
32065 <primary>address redirection</primary>
32066 <secondary>while verifying</secondary>
32067 </indexterm>
32068 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
32069 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
32070 </para>
32071 <itemizedlist>
32072 <listitem>
32073 <para>
32074 When Exim is receiving an incoming SMTP message from a remote host, it is
32075 running under the Exim uid, not as root. Exim is unable to change uid to read
32076 the file as the user, and it may not be able to read it as the Exim user. So in
32077 practice the router may not be able to operate.
32078 </para>
32079 </listitem>
32080 <listitem>
32081 <para>
32082 However, even when the router can operate, the existence of a <filename>.forward</filename> file
32083 is unimportant when verifying an address. What should be checked is whether the
32084 local part is a valid user name or not. Cutting out the redirection processing
32085 saves some resources.
32086 </para>
32087 </listitem>
32088 </itemizedlist>
32089 </section>
32090 <section>
32091 <title>Interpreting redirection data</title>
32092 <para>
32093 <indexterm role="concept">
32094 <primary>Sieve filter</primary>
32095 <secondary>specifying in redirection data</secondary>
32096 </indexterm>
32097 <indexterm role="concept">
32098 <primary>filter</primary>
32099 <secondary>specifying in redirection data</secondary>
32100 </indexterm>
32101 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
32102 can be interpreted in two different ways:
32103 </para>
32104 <itemizedlist>
32105 <listitem>
32106 <para>
32107 If the <option>allow_filter</option> option is set true, and the data begins with the text
32108 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
32109 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
32110 respectively. Details of the syntax and semantics of filter files are described
32111 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
32112 document is intended for use by end users.
32113 </para>
32114 </listitem>
32115 <listitem>
32116 <para>
32117 Otherwise, the data must be a comma-separated list of redirection items, as
32118 described in the next section.
32119 </para>
32120 </listitem>
32121 </itemizedlist>
32122 <para>
32123 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
32124 in a non-filter redirection list must always be an absolute path. A filter may
32125 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
32126 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
32127 for the <command>appendfile</command> transport.
32128 </para>
32129 </section>
32130 <section id="SECTitenonfilred">
32131 <title>Items in a non-filter redirection list</title>
32132 <para>
32133 <indexterm role="concept">
32134 <primary>address redirection</primary>
32135 <secondary>non-filter list items</secondary>
32136 </indexterm>
32137 When the redirection data is not an Exim or Sieve filter, for example, if it
32138 comes from a conventional alias or forward file, it consists of a list of
32139 addresses, file names, pipe commands, or certain special items (see section
32140 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
32141 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
32142 depending on their default values. The items in the list are separated by
32143 commas or newlines.
32144 If a comma is required in an item, the entire item must be enclosed in double
32145 quotes.
32146 </para>
32147 <para>
32148 Lines starting with a # character are comments, and are ignored, and # may
32149 also appear following a comma, in which case everything between the # and the
32150 next newline character is ignored.
32151 </para>
32152 <para>
32153 If an item is entirely enclosed in double quotes, these are removed. Otherwise
32154 double quotes are retained because some forms of mail address require their use
32155 (but never to enclose the entire address). In the following description,
32156 <quote>item</quote> refers to what remains after any surrounding double quotes have been
32157 removed.
32158 </para>
32159 <para>
32160 <indexterm role="concept">
32161 <primary><varname>$local_part</varname></primary>
32162 </indexterm>
32163 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
32164 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
32165 of the <option>quote_local_part</option> expansion operator, in case the local part contains
32166 special characters. For example, to redirect all mail for the domain
32167 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
32168 setting:
32169 </para>
32170 <literallayout class="monospaced">
32171 data = ${quote_local_part:$local_part}@newdomain.example
32172 </literallayout>
32173 </section>
32174 <section id="SECTredlocmai">
32175 <title>Redirecting to a local mailbox</title>
32176 <para>
32177 <indexterm role="concept">
32178 <primary>routing</primary>
32179 <secondary>loops in</secondary>
32180 </indexterm>
32181 <indexterm role="concept">
32182 <primary>loop while routing</primary>
32183 <secondary>avoidance of</secondary>
32184 </indexterm>
32185 <indexterm role="concept">
32186 <primary>address redirection</primary>
32187 <secondary>to local mailbox</secondary>
32188 </indexterm>
32189 A redirection item may safely be the same as the address currently under
32190 consideration. This does not cause a routing loop, because a router is
32191 automatically skipped if any ancestor of the address that is being processed
32192 is the same as the current address and was processed by the current router.
32193 Such an address is therefore passed to the following routers, so it is handled
32194 as if there were no redirection. When making this loop-avoidance test, the
32195 complete local part, including any prefix or suffix, is used.
32196 </para>
32197 <para>
32198 <indexterm role="concept">
32199 <primary>address redirection</primary>
32200 <secondary>local part without domain</secondary>
32201 </indexterm>
32202 Specifying the same local part without a domain is a common usage in personal
32203 filter files when the user wants to have messages delivered to the local
32204 mailbox and also forwarded elsewhere. For example, the user whose login is
32205 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
32206 </para>
32207 <literallayout class="monospaced">
32208 cleo, cleopatra@egypt.example
32209 </literallayout>
32210 <para>
32211 <indexterm role="concept">
32212 <primary>backslash in alias file</primary>
32213 </indexterm>
32214 <indexterm role="concept">
32215 <primary>alias file</primary>
32216 <secondary>backslash in</secondary>
32217 </indexterm>
32218 For compatibility with other MTAs, such unqualified local parts may be
32219 preceeded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
32220 it does make a difference if more than one domain is being handled
32221 synonymously.
32222 </para>
32223 <para>
32224 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
32225 2822 address that does not include a domain, the item is qualified using the
32226 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
32227 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
32228 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
32229 </para>
32230 <para>
32231 Care must be taken if there are alias names for local users.
32232 Consider an MTA handling a single local domain where the system alias file
32233 contains:
32234 </para>
32235 <literallayout class="monospaced">
32236 Sam.Reman: spqr
32237 </literallayout>
32238 <para>
32239 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
32240 messages in the local mailbox, and also forward copies elsewhere. He creates
32241 this forward file:
32242 </para>
32243 <literallayout class="monospaced">
32244 Sam.Reman, spqr@reme.elsewhere.example
32245 </literallayout>
32246 <para>
32247 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
32248 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
32249 second time round, because it has previously routed it,
32250 and the following routers presumably cannot handle the alias. The forward file
32251 should really contain
32252 </para>
32253 <literallayout class="monospaced">
32254 spqr, spqr@reme.elsewhere.example
32255 </literallayout>
32256 <para>
32257 but because this is such a common error, the <option>check_ancestor</option> option (see
32258 below) exists to provide a way to get round it. This is normally set on a
32259 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
32260 </para>
32261 </section>
32262 <section id="SECTspecitredli">
32263 <title>Special items in redirection lists</title>
32264 <para>
32265 In addition to addresses, the following types of item may appear in redirection
32266 lists (that is, in non-filter redirection data):
32267 </para>
32268 <itemizedlist>
32269 <listitem>
32270 <para>
32271 <indexterm role="concept">
32272 <primary>pipe</primary>
32273 <secondary>in redirection list</secondary>
32274 </indexterm>
32275 <indexterm role="concept">
32276 <primary>address redirection</primary>
32277 <secondary>to pipe</secondary>
32278 </indexterm>
32279 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
32280 as a valid RFC 2822 address that includes a domain. A transport for running the
32281 command must be specified by the <option>pipe_transport</option> option.
32282 Normally, either the router or the transport specifies a user and a group under
32283 which to run the delivery. The default is to use the Exim user and group.
32284 </para>
32285 <para>
32286 Single or double quotes can be used for enclosing the individual arguments of
32287 the pipe command; no interpretation of escapes is done for single quotes. If
32288 the command contains a comma character, it is necessary to put the whole item
32289 in double quotes, for example:
32290 </para>
32291 <literallayout class="monospaced">
32292 "|/some/command ready,steady,go"
32293 </literallayout>
32294 <para>
32295 since items in redirection lists are terminated by commas. Do not, however,
32296 quote just the command. An item such as
32297 </para>
32298 <literallayout class="monospaced">
32299 |"/some/command ready,steady,go"
32300 </literallayout>
32301 <para>
32302 is interpreted as a pipe with a rather strange command name, and no arguments.
32303 </para>
32304 </listitem>
32305 <listitem>
32306 <para>
32307 <indexterm role="concept">
32308 <primary>file</primary>
32309 <secondary>in redirection list</secondary>
32310 </indexterm>
32311 <indexterm role="concept">
32312 <primary>address redirection</primary>
32313 <secondary>to file</secondary>
32314 </indexterm>
32315 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
32316 parse as a valid RFC 2822 address that includes a domain. For example,
32317 </para>
32318 <literallayout class="monospaced">
32319 /home/world/minbari
32320 </literallayout>
32321 <para>
32322 is treated as a file name, but
32323 </para>
32324 <literallayout class="monospaced">
32325 /s=molari/o=babylon/@x400gate.way
32326 </literallayout>
32327 <para>
32328 is treated as an address. For a file name, a transport must be specified using
32329 the <option>file_transport</option> option. However, if the generated path name ends with a
32330 forward slash character, it is interpreted as a directory name rather than a
32331 file name, and <option>directory_transport</option> is used instead.
32332 </para>
32333 <para>
32334 Normally, either the router or the transport specifies a user and a group under
32335 which to run the delivery. The default is to use the Exim user and group.
32336 </para>
32337 <para>
32338 <indexterm role="concept">
32339 <primary><filename>/dev/null</filename></primary>
32340 </indexterm>
32341 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
32342 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
32343 instead of a transport name. In this case the user and group are not used.
32344 </para>
32345 </listitem>
32346 <listitem>
32347 <para>
32348 <indexterm role="concept">
32349 <primary>included address list</primary>
32350 </indexterm>
32351 <indexterm role="concept">
32352 <primary>address redirection</primary>
32353 <secondary>included external list</secondary>
32354 </indexterm>
32355 If an item is of the form
32356 </para>
32357 <literallayout class="monospaced">
32358 :include:&lt;path name&gt;
32359 </literallayout>
32360 <para>
32361 a list of further items is taken from the given file and included at that
32362 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
32363 out-of-line addition to the list. The items in the included list are separated
32364 by commas or newlines and are not subject to expansion. If this is the first
32365 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
32366 the alias name. This example is incorrect:
32367 </para>
32368 <literallayout class="monospaced">
32369 list1    :include:/opt/lists/list1
32370 </literallayout>
32371 <para>
32372 It must be given as
32373 </para>
32374 <literallayout class="monospaced">
32375 list1:   :include:/opt/lists/list1
32376 </literallayout>
32377 </listitem>
32378 <listitem>
32379 <para>
32380 <indexterm role="concept">
32381 <primary>address redirection</primary>
32382 <secondary>to black hole</secondary>
32383 </indexterm>
32384 Sometimes you want to throw away mail to a particular local part. Making the
32385 <option>data</option> option expand to an empty string does not work, because that causes
32386 the router to decline. Instead, the alias item
32387 <indexterm role="concept">
32388 <primary>black hole</primary>
32389 </indexterm>
32390 <indexterm role="concept">
32391 <primary>abandoning mail</primary>
32392 </indexterm>
32393 </para>
32394 <literallayout class="monospaced">
32395 :blackhole:
32396 </literallayout>
32397 <para>
32398 can be used. It does what its name implies. No delivery is done, and no error
32399 message is generated. This has the same effect as specifing <filename>/dev/null</filename>, but
32400 can be independently disabled.
32401 </para>
32402 <para>
32403 <emphasis role="bold">Warning</emphasis>: If <literal>:blackhole:</literal> appears anywhere in a redirection list, no
32404 delivery is done for the original local part, even if other redirection items
32405 are present. If you are generating a multi-item list (for example, by reading a
32406 database) and need the ability to provide a no-op item, you must use
32407 <filename>/dev/null</filename>.
32408 </para>
32409 </listitem>
32410 <listitem>
32411 <para>
32412 <indexterm role="concept">
32413 <primary>delivery</primary>
32414 <secondary>forcing failure</secondary>
32415 </indexterm>
32416 <indexterm role="concept">
32417 <primary>delivery</primary>
32418 <secondary>forcing deferral</secondary>
32419 </indexterm>
32420 <indexterm role="concept">
32421 <primary>failing delivery</primary>
32422 <secondary>forcing</secondary>
32423 </indexterm>
32424 <indexterm role="concept">
32425 <primary>deferred delivery</primary>
32426 <secondary>forcing</secondary>
32427 </indexterm>
32428 <indexterm role="concept">
32429 <primary>customizing</primary>
32430 <secondary>failure message</secondary>
32431 </indexterm>
32432 An attempt to deliver a particular address can be deferred or forced to fail by
32433 redirection items of the form
32434 </para>
32435 <literallayout class="monospaced">
32436 :defer:
32437 :fail:
32438 </literallayout>
32439 <para>
32440 respectively. When a redirection list contains such an item, it applies to the
32441 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
32442 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
32443 text associated with the failure. For example, an alias file might contain:
32444 </para>
32445 <literallayout class="monospaced">
32446 X.Employee:  :fail: Gone away, no forwarding address
32447 </literallayout>
32448 <para>
32449 In the case of an address that is being verified from an ACL or as the subject
32450 of a
32451 <indexterm role="concept">
32452 <primary>VRFY error text</primary>
32453 <secondary>display of</secondary>
32454 </indexterm>
32455 VRFY command, the text is included in the SMTP error response by
32456 default.
32457 <indexterm role="concept">
32458 <primary>EXPN error text</primary>
32459 <secondary>display of</secondary>
32460 </indexterm>
32461 The text is not included in the response to an EXPN command. In non-SMTP cases
32462 the text is included in the error message that Exim generates.
32463 </para>
32464 <para>
32465 <indexterm role="concept">
32466 <primary>SMTP</primary>
32467 <secondary>error codes</secondary>
32468 </indexterm>
32469 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
32470 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
32471 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
32472 followed by a space, and the very first digit is the same as the default error
32473 code, the code from the message is used instead. If the very first digit is
32474 incorrect, a panic error is logged, and the default code is used. You can
32475 suppress the use of the supplied code in a redirect router by setting the
32476 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
32477 ignored.
32478 </para>
32479 <para>
32480 <indexterm role="concept">
32481 <primary><varname>$acl_verify_message</varname></primary>
32482 </indexterm>
32483 In an ACL, an explicitly provided message overrides the default, but the
32484 default message is available in the variable <varname>$acl_verify_message</varname> and can
32485 therefore be included in a custom message if this is desired.
32486 </para>
32487 <para>
32488 Normally the error text is the rest of the redirection list &ndash; a comma does
32489 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
32490 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
32491 as part of the continuation process, but they may exist in other kinds of
32492 lookup and in <emphasis>:include:</emphasis> files.
32493 </para>
32494 <para>
32495 During routing for message delivery (as opposed to verification), a redirection
32496 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
32497 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
32498 subsequent delivery attempt can happen at a later time. If an address is
32499 deferred for too long, it will ultimately fail, because the normal retry
32500 rules still apply.
32501 </para>
32502 </listitem>
32503 <listitem>
32504 <para>
32505 <indexterm role="concept">
32506 <primary>alias file</primary>
32507 <secondary>exception to default</secondary>
32508 </indexterm>
32509 Sometimes it is useful to use a single-key search type with a default (see
32510 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
32511 for exceptions to the default. These can be handled by aliasing them to
32512 </para>
32513 <literallayout class="monospaced">
32514 :unknown:
32515 </literallayout>
32516 <para>
32517 This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command> router to
32518 decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which results in
32519 an empty redirection list has the same effect.
32520 </para>
32521 </listitem>
32522 </itemizedlist>
32523 </section>
32524 <section>
32525 <title>Duplicate addresses</title>
32526 <para>
32527 <indexterm role="concept">
32528 <primary>duplicate addresses</primary>
32529 </indexterm>
32530 <indexterm role="concept">
32531 <primary>address duplicate</primary>
32532 <secondary>discarding</secondary>
32533 </indexterm>
32534 <indexterm role="concept">
32535 <primary>pipe</primary>
32536 <secondary>duplicated</secondary>
32537 </indexterm>
32538 Exim removes duplicate addresses from the list to which it is delivering, so as
32539 to deliver just one copy to each address. This does not apply to deliveries
32540 routed to pipes by different immediate parent addresses, but an indirect
32541 aliasing scheme of the type
32542 </para>
32543 <literallayout class="monospaced">
32544 pipe:       |/some/command $local_part
32545 localpart1: pipe
32546 localpart2: pipe
32547 </literallayout>
32548 <para>
32549 does not work with a message that is addressed to both local parts, because
32550 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
32551 discarded as being the same as a previously handled address. However, a scheme
32552 such as
32553 </para>
32554 <literallayout class="monospaced">
32555 localpart1: |/some/command $local_part
32556 localpart2: |/some/command $local_part
32557 </literallayout>
32558 <para>
32559 does result in two different pipe deliveries, because the immediate parents of
32560 the pipes are distinct.
32561 </para>
32562 </section>
32563 <section>
32564 <title>Repeated redirection expansion</title>
32565 <para>
32566 <indexterm role="concept">
32567 <primary>repeated redirection expansion</primary>
32568 </indexterm>
32569 <indexterm role="concept">
32570 <primary>address redirection</primary>
32571 <secondary>repeated for each delivery attempt</secondary>
32572 </indexterm>
32573 When a message cannot be delivered to all of its recipients immediately,
32574 leading to two or more delivery attempts, redirection expansion is carried out
32575 afresh each time for those addresses whose children were not all previously
32576 delivered. If redirection is being used as a mailing list, this can lead to new
32577 members of the list receiving copies of old messages. The <option>one_time</option> option
32578 can be used to avoid this.
32579 </para>
32580 </section>
32581 <section>
32582 <title>Errors in redirection lists</title>
32583 <para>
32584 <indexterm role="concept">
32585 <primary>address redirection</primary>
32586 <secondary>errors</secondary>
32587 </indexterm>
32588 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
32589 error is skipped, and an entry is written to the main log. This may be useful
32590 for mailing lists that are automatically managed. Otherwise, if an error is
32591 detected while generating the list of new addresses, the original address is
32592 deferred. See also <option>syntax_errors_to</option>.
32593 </para>
32594 </section>
32595 <section>
32596 <title>Private options for the redirect router</title>
32597 <para>
32598 <indexterm role="concept">
32599 <primary>options</primary>
32600 <secondary><command>redirect</command> router</secondary>
32601 </indexterm>
32602 The private options for the <command>redirect</command> router are as follows:
32603 </para>
32604 <para>
32605 <indexterm role="option">
32606 <primary><option>allow_defer</option></primary>
32607 </indexterm>
32608 </para>
32609 <informaltable frame="all">
32610 <tgroup cols="4" colsep="0" rowsep="0">
32611 <colspec colwidth="8*" align="left"/>
32612 <colspec colwidth="5*" align="center"/>
32613 <colspec colwidth="5*" align="center"/>
32614 <colspec colwidth="6*" align="right"/>
32615 <tbody>
32616 <row>
32617 <entry><option>allow_defer</option></entry>
32618 <entry>Use: <emphasis>redirect</emphasis></entry>
32619 <entry>Type: <emphasis>boolean</emphasis></entry>
32620 <entry>Default: <emphasis>false</emphasis></entry>
32621 </row>
32622 </tbody>
32623 </tgroup>
32624 </informaltable>
32625 <para>
32626 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
32627 data, or the <option>defer</option> command in an Exim filter file.
32628 </para>
32629 <para>
32630 <indexterm role="option">
32631 <primary><option>allow_fail</option></primary>
32632 </indexterm>
32633 </para>
32634 <informaltable frame="all">
32635 <tgroup cols="4" colsep="0" rowsep="0">
32636 <colspec colwidth="8*" align="left"/>
32637 <colspec colwidth="5*" align="center"/>
32638 <colspec colwidth="5*" align="center"/>
32639 <colspec colwidth="6*" align="right"/>
32640 <tbody>
32641 <row>
32642 <entry><option>allow_fail</option></entry>
32643 <entry>Use: <emphasis>redirect</emphasis></entry>
32644 <entry>Type: <emphasis>boolean</emphasis></entry>
32645 <entry>Default: <emphasis>false</emphasis></entry>
32646 </row>
32647 </tbody>
32648 </tgroup>
32649 </informaltable>
32650 <para>
32651 <indexterm role="concept">
32652 <primary>failing delivery</primary>
32653 <secondary>from filter</secondary>
32654 </indexterm>
32655 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
32656 and the <option>fail</option> command may be used in an Exim filter file.
32657 </para>
32658 <para>
32659 <indexterm role="option">
32660 <primary><option>allow_filter</option></primary>
32661 </indexterm>
32662 </para>
32663 <informaltable frame="all">
32664 <tgroup cols="4" colsep="0" rowsep="0">
32665 <colspec colwidth="8*" align="left"/>
32666 <colspec colwidth="5*" align="center"/>
32667 <colspec colwidth="5*" align="center"/>
32668 <colspec colwidth="6*" align="right"/>
32669 <tbody>
32670 <row>
32671 <entry><option>allow_filter</option></entry>
32672 <entry>Use: <emphasis>redirect</emphasis></entry>
32673 <entry>Type: <emphasis>boolean</emphasis></entry>
32674 <entry>Default: <emphasis>false</emphasis></entry>
32675 </row>
32676 </tbody>
32677 </tgroup>
32678 </informaltable>
32679 <para>
32680 <indexterm role="concept">
32681 <primary>filter</primary>
32682 <secondary>enabling use of</secondary>
32683 </indexterm>
32684 <indexterm role="concept">
32685 <primary>Sieve filter</primary>
32686 <secondary>enabling use of</secondary>
32687 </indexterm>
32688 Setting this option allows Exim to interpret redirection data that starts with
32689 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
32690 are some features of Exim filter files that some administrators may wish to
32691 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
32692 </para>
32693 <para>
32694 It is also possible to lock out Exim filters or Sieve filters while allowing
32695 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
32696 </para>
32697 <para>
32698 The filter is run using the uid and gid set by the generic <option>user</option> and
32699 <option>group</option> options. These take their defaults from the password data if
32700 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
32701 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
32702 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
32703 </para>
32704 <para>
32705 <indexterm role="option">
32706 <primary><option>allow_freeze</option></primary>
32707 </indexterm>
32708 </para>
32709 <informaltable frame="all">
32710 <tgroup cols="4" colsep="0" rowsep="0">
32711 <colspec colwidth="8*" align="left"/>
32712 <colspec colwidth="5*" align="center"/>
32713 <colspec colwidth="5*" align="center"/>
32714 <colspec colwidth="6*" align="right"/>
32715 <tbody>
32716 <row>
32717 <entry><option>allow_freeze</option></entry>
32718 <entry>Use: <emphasis>redirect</emphasis></entry>
32719 <entry>Type: <emphasis>boolean</emphasis></entry>
32720 <entry>Default: <emphasis>false</emphasis></entry>
32721 </row>
32722 </tbody>
32723 </tgroup>
32724 </informaltable>
32725 <para>
32726 <indexterm role="concept">
32727 <primary>freezing messages</primary>
32728 <secondary>allowing in filter</secondary>
32729 </indexterm>
32730 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
32731 This command is more normally encountered in system filters, and is disabled by
32732 default for redirection filters because it isn&#x2019;t something you usually want to
32733 let ordinary users do.
32734 </para>
32735 <para>
32736 <indexterm role="option">
32737 <primary><option>check_ancestor</option></primary>
32738 </indexterm>
32739 </para>
32740 <informaltable frame="all">
32741 <tgroup cols="4" colsep="0" rowsep="0">
32742 <colspec colwidth="8*" align="left"/>
32743 <colspec colwidth="5*" align="center"/>
32744 <colspec colwidth="5*" align="center"/>
32745 <colspec colwidth="6*" align="right"/>
32746 <tbody>
32747 <row>
32748 <entry><option>check_ancestor</option></entry>
32749 <entry>Use: <emphasis>redirect</emphasis></entry>
32750 <entry>Type: <emphasis>boolean</emphasis></entry>
32751 <entry>Default: <emphasis>false</emphasis></entry>
32752 </row>
32753 </tbody>
32754 </tgroup>
32755 </informaltable>
32756 <para>
32757 This option is concerned with handling generated addresses that are the same
32758 as some address in the list of redirection ancestors of the current address.
32759 Although it is turned off by default in the code, it is set in the default
32760 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
32761 for this use of the <command>redirect</command> router.
32762 </para>
32763 <para>
32764 When <option>check_ancestor</option> is set, if a generated address (including the domain)
32765 is the same as any ancestor of the current address, it is replaced by a copy of
32766 the current address. This helps in the case where local part A is aliased to B,
32767 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
32768 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
32769 <filename>&nbsp;jb/.forward</filename> contains:
32770 </para>
32771 <literallayout class="monospaced">
32772 \Joe.Bloggs, &lt;other item(s)&gt;
32773 </literallayout>
32774 <para>
32775 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
32776 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
32777 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
32778 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
32779 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
32780 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
32781 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
32782 original address. See also the <option>repeat_use</option> option below.
32783 </para>
32784 <para>
32785 <indexterm role="option">
32786 <primary><option>check_group</option></primary>
32787 </indexterm>
32788 </para>
32789 <informaltable frame="all">
32790 <tgroup cols="4" colsep="0" rowsep="0">
32791 <colspec colwidth="8*" align="left"/>
32792 <colspec colwidth="5*" align="center"/>
32793 <colspec colwidth="5*" align="center"/>
32794 <colspec colwidth="6*" align="right"/>
32795 <tbody>
32796 <row>
32797 <entry><option>check_group</option></entry>
32798 <entry>Use: <emphasis>redirect</emphasis></entry>
32799 <entry>Type: <emphasis>boolean</emphasis></entry>
32800 <entry>Default: <emphasis>see below</emphasis></entry>
32801 </row>
32802 </tbody>
32803 </tgroup>
32804 </informaltable>
32805 <para>
32806 When the <option>file</option> option is used, the group owner of the file is checked only
32807 when this option is set. The permitted groups are those listed in the
32808 <option>owngroups</option> option, together with the user&#x2019;s default group if
32809 <option>check_local_user</option> is set. If the file has the wrong group, routing is
32810 deferred. The default setting for this option is true if <option>check_local_user</option>
32811 is set and the <option>modemask</option> option permits the group write bit, or if the
32812 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
32813 </para>
32814 <para>
32815 <indexterm role="option">
32816 <primary><option>check_owner</option></primary>
32817 </indexterm>
32818 </para>
32819 <informaltable frame="all">
32820 <tgroup cols="4" colsep="0" rowsep="0">
32821 <colspec colwidth="8*" align="left"/>
32822 <colspec colwidth="5*" align="center"/>
32823 <colspec colwidth="5*" align="center"/>
32824 <colspec colwidth="6*" align="right"/>
32825 <tbody>
32826 <row>
32827 <entry><option>check_owner</option></entry>
32828 <entry>Use: <emphasis>redirect</emphasis></entry>
32829 <entry>Type: <emphasis>boolean</emphasis></entry>
32830 <entry>Default: <emphasis>see below</emphasis></entry>
32831 </row>
32832 </tbody>
32833 </tgroup>
32834 </informaltable>
32835 <para>
32836 When the <option>file</option> option is used, the owner of the file is checked only when
32837 this option is set. If <option>check_local_user</option> is set, the local user is
32838 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
32839 option. The default value for this option is true if <option>check_local_user</option> or
32840 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
32841 </para>
32842 <para>
32843 <indexterm role="option">
32844 <primary><option>data</option></primary>
32845 </indexterm>
32846 </para>
32847 <informaltable frame="all">
32848 <tgroup cols="4" colsep="0" rowsep="0">
32849 <colspec colwidth="8*" align="left"/>
32850 <colspec colwidth="5*" align="center"/>
32851 <colspec colwidth="5*" align="center"/>
32852 <colspec colwidth="6*" align="right"/>
32853 <tbody>
32854 <row>
32855 <entry><option>data</option></entry>
32856 <entry>Use: <emphasis>redirect</emphasis></entry>
32857 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32858 <entry>Default: <emphasis>unset</emphasis></entry>
32859 </row>
32860 </tbody>
32861 </tgroup>
32862 </informaltable>
32863 <para>
32864 This option is mutually exclusive with <option>file</option>. One or other of them must be
32865 set, but not both. The contents of <option>data</option> are expanded, and then used as the
32866 list of forwarding items, or as a set of filtering instructions. If the
32867 expansion is forced to fail, or the result is an empty string or a string that
32868 has no effect (consists entirely of comments), the router declines.
32869 </para>
32870 <para>
32871 When filtering instructions are used, the string must begin with <quote>#Exim
32872 filter</quote>, and all comments in the string, including this initial one, must be
32873 terminated with newline characters. For example:
32874 </para>
32875 <literallayout class="monospaced">
32876 data = #Exim filter\n\
32877        if $h_to: contains Exim then save $home/mail/exim endif
32878 </literallayout>
32879 <para>
32880 If you are reading the data from a database where newlines cannot be included,
32881 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
32882 choice into a newline.
32883 </para>
32884 <para>
32885 <indexterm role="option">
32886 <primary><option>directory_transport</option></primary>
32887 </indexterm>
32888 </para>
32889 <informaltable frame="all">
32890 <tgroup cols="4" colsep="0" rowsep="0">
32891 <colspec colwidth="8*" align="left"/>
32892 <colspec colwidth="5*" align="center"/>
32893 <colspec colwidth="5*" align="center"/>
32894 <colspec colwidth="6*" align="right"/>
32895 <tbody>
32896 <row>
32897 <entry><option>directory_transport</option></entry>
32898 <entry>Use: <emphasis>redirect</emphasis></entry>
32899 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32900 <entry>Default: <emphasis>unset</emphasis></entry>
32901 </row>
32902 </tbody>
32903 </tgroup>
32904 </informaltable>
32905 <para>
32906 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
32907 ending with a slash is specified as a new <quote>address</quote>. The transport used is
32908 specified by this option, which, after expansion, must be the name of a
32909 configured transport. This should normally be an <command>appendfile</command> transport.
32910 </para>
32911 <para>
32912 <indexterm role="option">
32913 <primary><option>file</option></primary>
32914 </indexterm>
32915 </para>
32916 <informaltable frame="all">
32917 <tgroup cols="4" colsep="0" rowsep="0">
32918 <colspec colwidth="8*" align="left"/>
32919 <colspec colwidth="5*" align="center"/>
32920 <colspec colwidth="5*" align="center"/>
32921 <colspec colwidth="6*" align="right"/>
32922 <tbody>
32923 <row>
32924 <entry><option>file</option></entry>
32925 <entry>Use: <emphasis>redirect</emphasis></entry>
32926 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32927 <entry>Default: <emphasis>unset</emphasis></entry>
32928 </row>
32929 </tbody>
32930 </tgroup>
32931 </informaltable>
32932 <para>
32933 This option specifies the name of a file that contains the redirection data. It
32934 is mutually exclusive with the <option>data</option> option. The string is expanded before
32935 use; if the expansion is forced to fail, the router declines. Other expansion
32936 failures cause delivery to be deferred. The result of a successful expansion
32937 must be an absolute path. The entire file is read and used as the redirection
32938 data. If the data is an empty string or a string that has no effect (consists
32939 entirely of comments), the router declines.
32940 </para>
32941 <para>
32942 <indexterm role="concept">
32943 <primary>NFS</primary>
32944 <secondary>checking for file existence</secondary>
32945 </indexterm>
32946 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
32947 runs a check on the containing directory,
32948 unless <option>ignore_enotdir</option> is true (see below).
32949 If the directory does not appear to exist, delivery is deferred. This can
32950 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
32951 is a mount problem. If the containing directory does exist, but the file does
32952 not, the router declines.
32953 </para>
32954 <para>
32955 <indexterm role="option">
32956 <primary><option>file_transport</option></primary>
32957 </indexterm>
32958 </para>
32959 <informaltable frame="all">
32960 <tgroup cols="4" colsep="0" rowsep="0">
32961 <colspec colwidth="8*" align="left"/>
32962 <colspec colwidth="5*" align="center"/>
32963 <colspec colwidth="5*" align="center"/>
32964 <colspec colwidth="6*" align="right"/>
32965 <tbody>
32966 <row>
32967 <entry><option>file_transport</option></entry>
32968 <entry>Use: <emphasis>redirect</emphasis></entry>
32969 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32970 <entry>Default: <emphasis>unset</emphasis></entry>
32971 </row>
32972 </tbody>
32973 </tgroup>
32974 </informaltable>
32975 <para>
32976 <indexterm role="concept">
32977 <primary><varname>$address_file</varname></primary>
32978 </indexterm>
32979 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
32980 ending in a slash is specified as a new <quote>address</quote>. The transport used is
32981 specified by this option, which, after expansion, must be the name of a
32982 configured transport. This should normally be an <command>appendfile</command> transport. When
32983 it is running, the file name is in <varname>$address_file</varname>.
32984 </para>
32985 <para>
32986 <indexterm role="option">
32987 <primary><option>filter_prepend_home</option></primary>
32988 </indexterm>
32989 </para>
32990 <informaltable frame="all">
32991 <tgroup cols="4" colsep="0" rowsep="0">
32992 <colspec colwidth="8*" align="left"/>
32993 <colspec colwidth="5*" align="center"/>
32994 <colspec colwidth="5*" align="center"/>
32995 <colspec colwidth="6*" align="right"/>
32996 <tbody>
32997 <row>
32998 <entry><option>filter_prepend_home</option></entry>
32999 <entry>Use: <emphasis>redirect</emphasis></entry>
33000 <entry>Type: <emphasis>boolean</emphasis></entry>
33001 <entry>Default: <emphasis>true</emphasis></entry>
33002 </row>
33003 </tbody>
33004 </tgroup>
33005 </informaltable>
33006 <para>
33007 When this option is true, if a <command>save</command> command in an Exim filter specifies a
33008 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
33009 relative path. If this option is set false, this action does not happen. The
33010 relative path is then passed to the transport unmodified.
33011 </para>
33012 <para>
33013 <indexterm role="option">
33014 <primary><option>forbid_blackhole</option></primary>
33015 </indexterm>
33016 </para>
33017 <informaltable frame="all">
33018 <tgroup cols="4" colsep="0" rowsep="0">
33019 <colspec colwidth="8*" align="left"/>
33020 <colspec colwidth="5*" align="center"/>
33021 <colspec colwidth="5*" align="center"/>
33022 <colspec colwidth="6*" align="right"/>
33023 <tbody>
33024 <row>
33025 <entry><option>forbid_blackhole</option></entry>
33026 <entry>Use: <emphasis>redirect</emphasis></entry>
33027 <entry>Type: <emphasis>boolean</emphasis></entry>
33028 <entry>Default: <emphasis>false</emphasis></entry>
33029 </row>
33030 </tbody>
33031 </tgroup>
33032 </informaltable>
33033 <para>
33034 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
33035 redirection list.
33036 </para>
33037 <para>
33038 <indexterm role="option">
33039 <primary><option>forbid_exim_filter</option></primary>
33040 </indexterm>
33041 </para>
33042 <informaltable frame="all">
33043 <tgroup cols="4" colsep="0" rowsep="0">
33044 <colspec colwidth="8*" align="left"/>
33045 <colspec colwidth="5*" align="center"/>
33046 <colspec colwidth="5*" align="center"/>
33047 <colspec colwidth="6*" align="right"/>
33048 <tbody>
33049 <row>
33050 <entry><option>forbid_exim_filter</option></entry>
33051 <entry>Use: <emphasis>redirect</emphasis></entry>
33052 <entry>Type: <emphasis>boolean</emphasis></entry>
33053 <entry>Default: <emphasis>false</emphasis></entry>
33054 </row>
33055 </tbody>
33056 </tgroup>
33057 </informaltable>
33058 <para>
33059 If this option is set true, only Sieve filters are permitted when
33060 <option>allow_filter</option> is true.
33061 </para>
33062 <para>
33063 <indexterm role="option">
33064 <primary><option>forbid_file</option></primary>
33065 </indexterm>
33066 </para>
33067 <informaltable frame="all">
33068 <tgroup cols="4" colsep="0" rowsep="0">
33069 <colspec colwidth="8*" align="left"/>
33070 <colspec colwidth="5*" align="center"/>
33071 <colspec colwidth="5*" align="center"/>
33072 <colspec colwidth="6*" align="right"/>
33073 <tbody>
33074 <row>
33075 <entry><option>forbid_file</option></entry>
33076 <entry>Use: <emphasis>redirect</emphasis></entry>
33077 <entry>Type: <emphasis>boolean</emphasis></entry>
33078 <entry>Default: <emphasis>false</emphasis></entry>
33079 </row>
33080 </tbody>
33081 </tgroup>
33082 </informaltable>
33083 <para>
33084 <indexterm role="concept">
33085 <primary>delivery</primary>
33086 <secondary>to file; forbidding</secondary>
33087 </indexterm>
33088 <indexterm role="concept">
33089 <primary>Sieve filter</primary>
33090 <secondary>forbidding delivery to a file</secondary>
33091 </indexterm>
33092 <indexterm role="concept">
33093 <primary>Sieve filter</primary>
33094 <secondary><quote>keep</quote> facility; disabling</secondary>
33095 </indexterm>
33096 If this option is true, this router may not generate a new address that
33097 specifies delivery to a local file or directory, either from a filter or from a
33098 conventional forward file. This option is forced to be true if <option>one_time</option> is
33099 set. It applies to Sieve filters as well as to Exim filters, but if true, it
33100 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
33101 </para>
33102 <para>
33103 <indexterm role="option">
33104 <primary><option>forbid_filter_dlfunc</option></primary>
33105 </indexterm>
33106 </para>
33107 <informaltable frame="all">
33108 <tgroup cols="4" colsep="0" rowsep="0">
33109 <colspec colwidth="8*" align="left"/>
33110 <colspec colwidth="5*" align="center"/>
33111 <colspec colwidth="5*" align="center"/>
33112 <colspec colwidth="6*" align="right"/>
33113 <tbody>
33114 <row>
33115 <entry><option>forbid_filter_dlfunc</option></entry>
33116 <entry>Use: <emphasis>redirect</emphasis></entry>
33117 <entry>Type: <emphasis>boolean</emphasis></entry>
33118 <entry>Default: <emphasis>false</emphasis></entry>
33119 </row>
33120 </tbody>
33121 </tgroup>
33122 </informaltable>
33123 <para>
33124 <indexterm role="concept">
33125 <primary>filter</primary>
33126 <secondary>locking out certain features</secondary>
33127 </indexterm>
33128 If this option is true, string expansions in Exim filters are not allowed to
33129 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
33130 functions.
33131 </para>
33132 <para>
33133 <indexterm role="option">
33134 <primary><option>forbid_filter_existstest</option></primary>
33135 </indexterm>
33136 </para>
33137 <informaltable frame="all">
33138 <tgroup cols="4" colsep="0" rowsep="0">
33139 <colspec colwidth="8*" align="left"/>
33140 <colspec colwidth="5*" align="center"/>
33141 <colspec colwidth="5*" align="center"/>
33142 <colspec colwidth="6*" align="right"/>
33143 <tbody>
33144 <row>
33145 <entry><option>forbid_filter_existstest</option></entry>
33146 <entry>Use: <emphasis>redirect</emphasis></entry>
33147 <entry>Type: <emphasis>boolean</emphasis></entry>
33148 <entry>Default: <emphasis>false</emphasis></entry>
33149 </row>
33150 </tbody>
33151 </tgroup>
33152 </informaltable>
33153 <para>
33154 <indexterm role="concept">
33155 <primary>expansion</primary>
33156 <secondary>statting a file</secondary>
33157 </indexterm>
33158 If this option is true, string expansions in Exim filters are not allowed to
33159 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
33160 </para>
33161 <para>
33162 <indexterm role="option">
33163 <primary><option>forbid_filter_logwrite</option></primary>
33164 </indexterm>
33165 </para>
33166 <informaltable frame="all">
33167 <tgroup cols="4" colsep="0" rowsep="0">
33168 <colspec colwidth="8*" align="left"/>
33169 <colspec colwidth="5*" align="center"/>
33170 <colspec colwidth="5*" align="center"/>
33171 <colspec colwidth="6*" align="right"/>
33172 <tbody>
33173 <row>
33174 <entry><option>forbid_filter_logwrite</option></entry>
33175 <entry>Use: <emphasis>redirect</emphasis></entry>
33176 <entry>Type: <emphasis>boolean</emphasis></entry>
33177 <entry>Default: <emphasis>false</emphasis></entry>
33178 </row>
33179 </tbody>
33180 </tgroup>
33181 </informaltable>
33182 <para>
33183 If this option is true, use of the logging facility in Exim filters is not
33184 permitted. Logging is in any case available only if the filter is being run
33185 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
33186 <filename>.forward</filename> files).
33187 </para>
33188 <para>
33189 <indexterm role="option">
33190 <primary><option>forbid_filter_lookup</option></primary>
33191 </indexterm>
33192 </para>
33193 <informaltable frame="all">
33194 <tgroup cols="4" colsep="0" rowsep="0">
33195 <colspec colwidth="8*" align="left"/>
33196 <colspec colwidth="5*" align="center"/>
33197 <colspec colwidth="5*" align="center"/>
33198 <colspec colwidth="6*" align="right"/>
33199 <tbody>
33200 <row>
33201 <entry><option>forbid_filter_lookup</option></entry>
33202 <entry>Use: <emphasis>redirect</emphasis></entry>
33203 <entry>Type: <emphasis>boolean</emphasis></entry>
33204 <entry>Default: <emphasis>false</emphasis></entry>
33205 </row>
33206 </tbody>
33207 </tgroup>
33208 </informaltable>
33209 <para>
33210 If this option is true, string expansions in Exim filter files are not allowed
33211 to make use of <option>lookup</option> items.
33212 </para>
33213 <para>
33214 <indexterm role="option">
33215 <primary><option>forbid_filter_perl</option></primary>
33216 </indexterm>
33217 </para>
33218 <informaltable frame="all">
33219 <tgroup cols="4" colsep="0" rowsep="0">
33220 <colspec colwidth="8*" align="left"/>
33221 <colspec colwidth="5*" align="center"/>
33222 <colspec colwidth="5*" align="center"/>
33223 <colspec colwidth="6*" align="right"/>
33224 <tbody>
33225 <row>
33226 <entry><option>forbid_filter_perl</option></entry>
33227 <entry>Use: <emphasis>redirect</emphasis></entry>
33228 <entry>Type: <emphasis>boolean</emphasis></entry>
33229 <entry>Default: <emphasis>false</emphasis></entry>
33230 </row>
33231 </tbody>
33232 </tgroup>
33233 </informaltable>
33234 <para>
33235 This option has an effect only if Exim is built with embedded Perl support. If
33236 it is true, string expansions in Exim filter files are not allowed to make use
33237 of the embedded Perl support.
33238 </para>
33239 <para>
33240 <indexterm role="option">
33241 <primary><option>forbid_filter_readfile</option></primary>
33242 </indexterm>
33243 </para>
33244 <informaltable frame="all">
33245 <tgroup cols="4" colsep="0" rowsep="0">
33246 <colspec colwidth="8*" align="left"/>
33247 <colspec colwidth="5*" align="center"/>
33248 <colspec colwidth="5*" align="center"/>
33249 <colspec colwidth="6*" align="right"/>
33250 <tbody>
33251 <row>
33252 <entry><option>forbid_filter_readfile</option></entry>
33253 <entry>Use: <emphasis>redirect</emphasis></entry>
33254 <entry>Type: <emphasis>boolean</emphasis></entry>
33255 <entry>Default: <emphasis>false</emphasis></entry>
33256 </row>
33257 </tbody>
33258 </tgroup>
33259 </informaltable>
33260 <para>
33261 If this option is true, string expansions in Exim filter files are not allowed
33262 to make use of <option>readfile</option> items.
33263 </para>
33264 <para>
33265 <indexterm role="option">
33266 <primary><option>forbid_filter_readsocket</option></primary>
33267 </indexterm>
33268 </para>
33269 <informaltable frame="all">
33270 <tgroup cols="4" colsep="0" rowsep="0">
33271 <colspec colwidth="8*" align="left"/>
33272 <colspec colwidth="5*" align="center"/>
33273 <colspec colwidth="5*" align="center"/>
33274 <colspec colwidth="6*" align="right"/>
33275 <tbody>
33276 <row>
33277 <entry><option>forbid_filter_readsocket</option></entry>
33278 <entry>Use: <emphasis>redirect</emphasis></entry>
33279 <entry>Type: <emphasis>boolean</emphasis></entry>
33280 <entry>Default: <emphasis>false</emphasis></entry>
33281 </row>
33282 </tbody>
33283 </tgroup>
33284 </informaltable>
33285 <para>
33286 If this option is true, string expansions in Exim filter files are not allowed
33287 to make use of <option>readsocket</option> items.
33288 </para>
33289 <para>
33290 <indexterm role="option">
33291 <primary><option>forbid_filter_reply</option></primary>
33292 </indexterm>
33293 </para>
33294 <informaltable frame="all">
33295 <tgroup cols="4" colsep="0" rowsep="0">
33296 <colspec colwidth="8*" align="left"/>
33297 <colspec colwidth="5*" align="center"/>
33298 <colspec colwidth="5*" align="center"/>
33299 <colspec colwidth="6*" align="right"/>
33300 <tbody>
33301 <row>
33302 <entry><option>forbid_filter_reply</option></entry>
33303 <entry>Use: <emphasis>redirect</emphasis></entry>
33304 <entry>Type: <emphasis>boolean</emphasis></entry>
33305 <entry>Default: <emphasis>false</emphasis></entry>
33306 </row>
33307 </tbody>
33308 </tgroup>
33309 </informaltable>
33310 <para>
33311 If this option is true, this router may not generate an automatic reply
33312 message. Automatic replies can be generated only from Exim or Sieve filter
33313 files, not from traditional forward files. This option is forced to be true if
33314 <option>one_time</option> is set.
33315 </para>
33316 <para>
33317 <indexterm role="option">
33318 <primary><option>forbid_filter_run</option></primary>
33319 </indexterm>
33320 </para>
33321 <informaltable frame="all">
33322 <tgroup cols="4" colsep="0" rowsep="0">
33323 <colspec colwidth="8*" align="left"/>
33324 <colspec colwidth="5*" align="center"/>
33325 <colspec colwidth="5*" align="center"/>
33326 <colspec colwidth="6*" align="right"/>
33327 <tbody>
33328 <row>
33329 <entry><option>forbid_filter_run</option></entry>
33330 <entry>Use: <emphasis>redirect</emphasis></entry>
33331 <entry>Type: <emphasis>boolean</emphasis></entry>
33332 <entry>Default: <emphasis>false</emphasis></entry>
33333 </row>
33334 </tbody>
33335 </tgroup>
33336 </informaltable>
33337 <para>
33338 If this option is true, string expansions in Exim filter files are not allowed
33339 to make use of <option>run</option> items.
33340 </para>
33341 <para>
33342 <indexterm role="option">
33343 <primary><option>forbid_include</option></primary>
33344 </indexterm>
33345 </para>
33346 <informaltable frame="all">
33347 <tgroup cols="4" colsep="0" rowsep="0">
33348 <colspec colwidth="8*" align="left"/>
33349 <colspec colwidth="5*" align="center"/>
33350 <colspec colwidth="5*" align="center"/>
33351 <colspec colwidth="6*" align="right"/>
33352 <tbody>
33353 <row>
33354 <entry><option>forbid_include</option></entry>
33355 <entry>Use: <emphasis>redirect</emphasis></entry>
33356 <entry>Type: <emphasis>boolean</emphasis></entry>
33357 <entry>Default: <emphasis>false</emphasis></entry>
33358 </row>
33359 </tbody>
33360 </tgroup>
33361 </informaltable>
33362 <para>
33363 If this option is true, items of the form
33364 </para>
33365 <literallayout class="monospaced">
33366 :include:&lt;path name&gt;
33367 </literallayout>
33368 <para>
33369 are not permitted in non-filter redirection lists.
33370 </para>
33371 <para>
33372 <indexterm role="option">
33373 <primary><option>forbid_pipe</option></primary>
33374 </indexterm>
33375 </para>
33376 <informaltable frame="all">
33377 <tgroup cols="4" colsep="0" rowsep="0">
33378 <colspec colwidth="8*" align="left"/>
33379 <colspec colwidth="5*" align="center"/>
33380 <colspec colwidth="5*" align="center"/>
33381 <colspec colwidth="6*" align="right"/>
33382 <tbody>
33383 <row>
33384 <entry><option>forbid_pipe</option></entry>
33385 <entry>Use: <emphasis>redirect</emphasis></entry>
33386 <entry>Type: <emphasis>boolean</emphasis></entry>
33387 <entry>Default: <emphasis>false</emphasis></entry>
33388 </row>
33389 </tbody>
33390 </tgroup>
33391 </informaltable>
33392 <para>
33393 <indexterm role="concept">
33394 <primary>delivery</primary>
33395 <secondary>to pipe; forbidding</secondary>
33396 </indexterm>
33397 If this option is true, this router may not generate a new address which
33398 specifies delivery to a pipe, either from an Exim filter or from a conventional
33399 forward file. This option is forced to be true if <option>one_time</option> is set.
33400 </para>
33401 <para>
33402 <indexterm role="option">
33403 <primary><option>forbid_sieve_filter</option></primary>
33404 </indexterm>
33405 </para>
33406 <informaltable frame="all">
33407 <tgroup cols="4" colsep="0" rowsep="0">
33408 <colspec colwidth="8*" align="left"/>
33409 <colspec colwidth="5*" align="center"/>
33410 <colspec colwidth="5*" align="center"/>
33411 <colspec colwidth="6*" align="right"/>
33412 <tbody>
33413 <row>
33414 <entry><option>forbid_sieve_filter</option></entry>
33415 <entry>Use: <emphasis>redirect</emphasis></entry>
33416 <entry>Type: <emphasis>boolean</emphasis></entry>
33417 <entry>Default: <emphasis>false</emphasis></entry>
33418 </row>
33419 </tbody>
33420 </tgroup>
33421 </informaltable>
33422 <para>
33423 If this option is set true, only Exim filters are permitted when
33424 <option>allow_filter</option> is true.
33425 </para>
33426 <para>
33427 <indexterm role="concept">
33428 <primary>SMTP</primary>
33429 <secondary>error codes</secondary>
33430 </indexterm>
33431 <indexterm role="option">
33432 <primary><option>forbid_smtp_code</option></primary>
33433 </indexterm>
33434 </para>
33435 <informaltable frame="all">
33436 <tgroup cols="4" colsep="0" rowsep="0">
33437 <colspec colwidth="8*" align="left"/>
33438 <colspec colwidth="5*" align="center"/>
33439 <colspec colwidth="5*" align="center"/>
33440 <colspec colwidth="6*" align="right"/>
33441 <tbody>
33442 <row>
33443 <entry><option>forbid_smtp_code</option></entry>
33444 <entry>Use: <emphasis>redirect</emphasis></entry>
33445 <entry>Type: <emphasis>boolean</emphasis></entry>
33446 <entry>Default: <emphasis>false</emphasis></entry>
33447 </row>
33448 </tbody>
33449 </tgroup>
33450 </informaltable>
33451 <para>
33452 If this option is set true, any SMTP error codes that are present at the start
33453 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
33454 the default codes (451 and 550, respectively) are always used.
33455 </para>
33456 <para>
33457 <indexterm role="option">
33458 <primary><option>hide_child_in_errmsg</option></primary>
33459 </indexterm>
33460 </para>
33461 <informaltable frame="all">
33462 <tgroup cols="4" colsep="0" rowsep="0">
33463 <colspec colwidth="8*" align="left"/>
33464 <colspec colwidth="5*" align="center"/>
33465 <colspec colwidth="5*" align="center"/>
33466 <colspec colwidth="6*" align="right"/>
33467 <tbody>
33468 <row>
33469 <entry><option>hide_child_in_errmsg</option></entry>
33470 <entry>Use: <emphasis>redirect</emphasis></entry>
33471 <entry>Type: <emphasis>boolean</emphasis></entry>
33472 <entry>Default: <emphasis>false</emphasis></entry>
33473 </row>
33474 </tbody>
33475 </tgroup>
33476 </informaltable>
33477 <para>
33478 <indexterm role="concept">
33479 <primary>bounce message</primary>
33480 <secondary>redirection details; suppressing</secondary>
33481 </indexterm>
33482 If this option is true, it prevents Exim from quoting a child address if it
33483 generates a bounce or delay message for it. Instead it says <quote>an address
33484 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
33485 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
33486 bounce may well quote the generated address.
33487 </para>
33488 <para>
33489 <indexterm role="option">
33490 <primary><option>ignore_eacces</option></primary>
33491 </indexterm>
33492 </para>
33493 <informaltable frame="all">
33494 <tgroup cols="4" colsep="0" rowsep="0">
33495 <colspec colwidth="8*" align="left"/>
33496 <colspec colwidth="5*" align="center"/>
33497 <colspec colwidth="5*" align="center"/>
33498 <colspec colwidth="6*" align="right"/>
33499 <tbody>
33500 <row>
33501 <entry><option>ignore_eacces</option></entry>
33502 <entry>Use: <emphasis>redirect</emphasis></entry>
33503 <entry>Type: <emphasis>boolean</emphasis></entry>
33504 <entry>Default: <emphasis>false</emphasis></entry>
33505 </row>
33506 </tbody>
33507 </tgroup>
33508 </informaltable>
33509 <para>
33510 <indexterm role="concept">
33511 <primary>EACCES</primary>
33512 </indexterm>
33513 If this option is set and an attempt to open a redirection file yields the
33514 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
33515 file did not exist.
33516 </para>
33517 <para>
33518 <indexterm role="option">
33519 <primary><option>ignore_enotdir</option></primary>
33520 </indexterm>
33521 </para>
33522 <informaltable frame="all">
33523 <tgroup cols="4" colsep="0" rowsep="0">
33524 <colspec colwidth="8*" align="left"/>
33525 <colspec colwidth="5*" align="center"/>
33526 <colspec colwidth="5*" align="center"/>
33527 <colspec colwidth="6*" align="right"/>
33528 <tbody>
33529 <row>
33530 <entry><option>ignore_enotdir</option></entry>
33531 <entry>Use: <emphasis>redirect</emphasis></entry>
33532 <entry>Type: <emphasis>boolean</emphasis></entry>
33533 <entry>Default: <emphasis>false</emphasis></entry>
33534 </row>
33535 </tbody>
33536 </tgroup>
33537 </informaltable>
33538 <para>
33539 <indexterm role="concept">
33540 <primary>ENOTDIR</primary>
33541 </indexterm>
33542 If this option is set and an attempt to open a redirection file yields the
33543 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
33544 router behaves as if the file did not exist.
33545 </para>
33546 <para>
33547 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
33548 router that has the <option>file</option> option set discovers that the file does not exist
33549 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
33550 against unmounted NFS directories. If the parent can not be statted, delivery
33551 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
33552 is set, because that option tells Exim to ignore <quote>something on the path is not
33553 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
33554 that some operating systems give ENOENT where others give ENOTDIR.
33555 </para>
33556 <para>
33557 <indexterm role="option">
33558 <primary><option>include_directory</option></primary>
33559 </indexterm>
33560 </para>
33561 <informaltable frame="all">
33562 <tgroup cols="4" colsep="0" rowsep="0">
33563 <colspec colwidth="8*" align="left"/>
33564 <colspec colwidth="5*" align="center"/>
33565 <colspec colwidth="5*" align="center"/>
33566 <colspec colwidth="6*" align="right"/>
33567 <tbody>
33568 <row>
33569 <entry><option>include_directory</option></entry>
33570 <entry>Use: <emphasis>redirect</emphasis></entry>
33571 <entry>Type: <emphasis>string</emphasis></entry>
33572 <entry>Default: <emphasis>unset</emphasis></entry>
33573 </row>
33574 </tbody>
33575 </tgroup>
33576 </informaltable>
33577 <para>
33578 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
33579 redirection list must start with this directory.
33580 </para>
33581 <para>
33582 <indexterm role="option">
33583 <primary><option>modemask</option></primary>
33584 </indexterm>
33585 </para>
33586 <informaltable frame="all">
33587 <tgroup cols="4" colsep="0" rowsep="0">
33588 <colspec colwidth="8*" align="left"/>
33589 <colspec colwidth="5*" align="center"/>
33590 <colspec colwidth="5*" align="center"/>
33591 <colspec colwidth="6*" align="right"/>
33592 <tbody>
33593 <row>
33594 <entry><option>modemask</option></entry>
33595 <entry>Use: <emphasis>redirect</emphasis></entry>
33596 <entry>Type: <emphasis>octal integer</emphasis></entry>
33597 <entry>Default: <emphasis>022</emphasis></entry>
33598 </row>
33599 </tbody>
33600 </tgroup>
33601 </informaltable>
33602 <para>
33603 This specifies mode bits which must not be set for a file specified by the
33604 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
33605 </para>
33606 <para>
33607 <indexterm role="option">
33608 <primary><option>one_time</option></primary>
33609 </indexterm>
33610 </para>
33611 <informaltable frame="all">
33612 <tgroup cols="4" colsep="0" rowsep="0">
33613 <colspec colwidth="8*" align="left"/>
33614 <colspec colwidth="5*" align="center"/>
33615 <colspec colwidth="5*" align="center"/>
33616 <colspec colwidth="6*" align="right"/>
33617 <tbody>
33618 <row>
33619 <entry><option>one_time</option></entry>
33620 <entry>Use: <emphasis>redirect</emphasis></entry>
33621 <entry>Type: <emphasis>boolean</emphasis></entry>
33622 <entry>Default: <emphasis>false</emphasis></entry>
33623 </row>
33624 </tbody>
33625 </tgroup>
33626 </informaltable>
33627 <para>
33628 <indexterm role="concept">
33629 <primary>one-time aliasing/forwarding expansion</primary>
33630 </indexterm>
33631 <indexterm role="concept">
33632 <primary>alias file</primary>
33633 <secondary>one-time expansion</secondary>
33634 </indexterm>
33635 <indexterm role="concept">
33636 <primary>forward file</primary>
33637 <secondary>one-time expansion</secondary>
33638 </indexterm>
33639 <indexterm role="concept">
33640 <primary>mailing lists</primary>
33641 <secondary>one-time expansion</secondary>
33642 </indexterm>
33643 <indexterm role="concept">
33644 <primary>address redirection</primary>
33645 <secondary>one-time expansion</secondary>
33646 </indexterm>
33647 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
33648 files each time it tries to deliver a message causes a problem when one or more
33649 of the generated addresses fails be delivered at the first attempt. The problem
33650 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
33651 but of what happens when the redirection list changes during the time that the
33652 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
33653 lists, where new subscribers might receive copies of messages that were posted
33654 before they subscribed.
33655 </para>
33656 <para>
33657 If <option>one_time</option> is set and any addresses generated by the router fail to
33658 deliver at the first attempt, the failing addresses are added to the message as
33659 <quote>top level</quote> addresses, and the parent address that generated them is marked
33660 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
33661 attempt.
33662 </para>
33663 <para>
33664 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
33665 router would be lost if delivery did not succeed at the first attempt. For this
33666 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
33667 permitted when <option>one_time</option> is set.
33668 </para>
33669 <para>
33670 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
33671 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
33672 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
33673 </para>
33674 <para>
33675 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
33676 <option>one_time</option>.
33677 </para>
33678 <para>
33679 The original top-level address is remembered with each of the generated
33680 addresses, and is output in any log messages. However, any intermediate parent
33681 addresses are not recorded. This makes a difference to the log only if
33682 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
33683 typically be used for mailing lists, where there is normally just one level of
33684 expansion.
33685 </para>
33686 <para>
33687 <indexterm role="option">
33688 <primary><option>owners</option></primary>
33689 </indexterm>
33690 </para>
33691 <informaltable frame="all">
33692 <tgroup cols="4" colsep="0" rowsep="0">
33693 <colspec colwidth="8*" align="left"/>
33694 <colspec colwidth="5*" align="center"/>
33695 <colspec colwidth="5*" align="center"/>
33696 <colspec colwidth="6*" align="right"/>
33697 <tbody>
33698 <row>
33699 <entry><option>owners</option></entry>
33700 <entry>Use: <emphasis>redirect</emphasis></entry>
33701 <entry>Type: <emphasis>string list</emphasis></entry>
33702 <entry>Default: <emphasis>unset</emphasis></entry>
33703 </row>
33704 </tbody>
33705 </tgroup>
33706 </informaltable>
33707 <para>
33708 <indexterm role="concept">
33709 <primary>ownership</primary>
33710 <secondary>alias file</secondary>
33711 </indexterm>
33712 <indexterm role="concept">
33713 <primary>ownership</primary>
33714 <secondary>forward file</secondary>
33715 </indexterm>
33716 <indexterm role="concept">
33717 <primary>alias file</primary>
33718 <secondary>ownership</secondary>
33719 </indexterm>
33720 <indexterm role="concept">
33721 <primary>forward file</primary>
33722 <secondary>ownership</secondary>
33723 </indexterm>
33724 This specifies a list of permitted owners for the file specified by <option>file</option>.
33725 This list is in addition to the local user when <option>check_local_user</option> is set.
33726 See <option>check_owner</option> above.
33727 </para>
33728 <para>
33729 <indexterm role="option">
33730 <primary><option>owngroups</option></primary>
33731 </indexterm>
33732 </para>
33733 <informaltable frame="all">
33734 <tgroup cols="4" colsep="0" rowsep="0">
33735 <colspec colwidth="8*" align="left"/>
33736 <colspec colwidth="5*" align="center"/>
33737 <colspec colwidth="5*" align="center"/>
33738 <colspec colwidth="6*" align="right"/>
33739 <tbody>
33740 <row>
33741 <entry><option>owngroups</option></entry>
33742 <entry>Use: <emphasis>redirect</emphasis></entry>
33743 <entry>Type: <emphasis>string list</emphasis></entry>
33744 <entry>Default: <emphasis>unset</emphasis></entry>
33745 </row>
33746 </tbody>
33747 </tgroup>
33748 </informaltable>
33749 <para>
33750 This specifies a list of permitted groups for the file specified by <option>file</option>.
33751 The list is in addition to the local user&#x2019;s primary group when
33752 <option>check_local_user</option> is set. See <option>check_group</option> above.
33753 </para>
33754 <para>
33755 <indexterm role="option">
33756 <primary><option>pipe_transport</option></primary>
33757 </indexterm>
33758 </para>
33759 <informaltable frame="all">
33760 <tgroup cols="4" colsep="0" rowsep="0">
33761 <colspec colwidth="8*" align="left"/>
33762 <colspec colwidth="5*" align="center"/>
33763 <colspec colwidth="5*" align="center"/>
33764 <colspec colwidth="6*" align="right"/>
33765 <tbody>
33766 <row>
33767 <entry><option>pipe_transport</option></entry>
33768 <entry>Use: <emphasis>redirect</emphasis></entry>
33769 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33770 <entry>Default: <emphasis>unset</emphasis></entry>
33771 </row>
33772 </tbody>
33773 </tgroup>
33774 </informaltable>
33775 <para>
33776 <indexterm role="concept">
33777 <primary><varname>$address_pipe</varname></primary>
33778 </indexterm>
33779 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
33780 starting with a vertical bar character is specified as a new <quote>address</quote>. The
33781 transport used is specified by this option, which, after expansion, must be the
33782 name of a configured transport. This should normally be a <command>pipe</command> transport.
33783 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
33784 </para>
33785 <para>
33786 <indexterm role="option">
33787 <primary><option>qualify_domain</option></primary>
33788 </indexterm>
33789 </para>
33790 <informaltable frame="all">
33791 <tgroup cols="4" colsep="0" rowsep="0">
33792 <colspec colwidth="8*" align="left"/>
33793 <colspec colwidth="5*" align="center"/>
33794 <colspec colwidth="5*" align="center"/>
33795 <colspec colwidth="6*" align="right"/>
33796 <tbody>
33797 <row>
33798 <entry><option>qualify_domain</option></entry>
33799 <entry>Use: <emphasis>redirect</emphasis></entry>
33800 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33801 <entry>Default: <emphasis>unset</emphasis></entry>
33802 </row>
33803 </tbody>
33804 </tgroup>
33805 </informaltable>
33806 <para>
33807 <indexterm role="concept">
33808 <primary><varname>$qualify_recipient</varname></primary>
33809 </indexterm>
33810 If this option is set, and an unqualified address (one without a domain) is
33811 generated, and that address would normally be qualified by the global setting
33812 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
33813 expanding this string. If the expansion fails, the router declines. If you want
33814 to revert to the default, you can have the expansion generate
33815 <varname>$qualify_recipient</varname>.
33816 </para>
33817 <para>
33818 This option applies to all unqualified addresses generated by Exim filters,
33819 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
33820 not preceded by a backslash. Sieve filters cannot generate unqualified
33821 addresses.
33822 </para>
33823 <para>
33824 <indexterm role="option">
33825 <primary><option>qualify_preserve_domain</option></primary>
33826 </indexterm>
33827 </para>
33828 <informaltable frame="all">
33829 <tgroup cols="4" colsep="0" rowsep="0">
33830 <colspec colwidth="8*" align="left"/>
33831 <colspec colwidth="5*" align="center"/>
33832 <colspec colwidth="5*" align="center"/>
33833 <colspec colwidth="6*" align="right"/>
33834 <tbody>
33835 <row>
33836 <entry><option>qualify_preserve_domain</option></entry>
33837 <entry>Use: <emphasis>redirect</emphasis></entry>
33838 <entry>Type: <emphasis>boolean</emphasis></entry>
33839 <entry>Default: <emphasis>false</emphasis></entry>
33840 </row>
33841 </tbody>
33842 </tgroup>
33843 </informaltable>
33844 <para>
33845 <indexterm role="concept">
33846 <primary>domain</primary>
33847 <secondary>in redirection; preserving</secondary>
33848 </indexterm>
33849 <indexterm role="concept">
33850 <primary>preserving domain in redirection</primary>
33851 </indexterm>
33852 <indexterm role="concept">
33853 <primary>address redirection</primary>
33854 <secondary>domain; preserving</secondary>
33855 </indexterm>
33856 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
33857 set (a configuration error occurs if it is). If an unqualified address (one
33858 without a domain) is generated, it is qualified with the domain of the parent
33859 address (the immediately preceding ancestor) instead of the global
33860 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
33861 this applies whether or not the address is preceded by a backslash.
33862 </para>
33863 <para>
33864 <indexterm role="option">
33865 <primary><option>repeat_use</option></primary>
33866 </indexterm>
33867 </para>
33868 <informaltable frame="all">
33869 <tgroup cols="4" colsep="0" rowsep="0">
33870 <colspec colwidth="8*" align="left"/>
33871 <colspec colwidth="5*" align="center"/>
33872 <colspec colwidth="5*" align="center"/>
33873 <colspec colwidth="6*" align="right"/>
33874 <tbody>
33875 <row>
33876 <entry><option>repeat_use</option></entry>
33877 <entry>Use: <emphasis>redirect</emphasis></entry>
33878 <entry>Type: <emphasis>boolean</emphasis></entry>
33879 <entry>Default: <emphasis>true</emphasis></entry>
33880 </row>
33881 </tbody>
33882 </tgroup>
33883 </informaltable>
33884 <para>
33885 If this option is set false, the router is skipped for a child address that has
33886 any ancestor that was routed by this router. This test happens before any of
33887 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
33888 only when the ancestor is the same as the current address. See also
33889 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
33890 </para>
33891 <para>
33892 <indexterm role="option">
33893 <primary><option>reply_transport</option></primary>
33894 </indexterm>
33895 </para>
33896 <informaltable frame="all">
33897 <tgroup cols="4" colsep="0" rowsep="0">
33898 <colspec colwidth="8*" align="left"/>
33899 <colspec colwidth="5*" align="center"/>
33900 <colspec colwidth="5*" align="center"/>
33901 <colspec colwidth="6*" align="right"/>
33902 <tbody>
33903 <row>
33904 <entry><option>reply_transport</option></entry>
33905 <entry>Use: <emphasis>redirect</emphasis></entry>
33906 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33907 <entry>Default: <emphasis>unset</emphasis></entry>
33908 </row>
33909 </tbody>
33910 </tgroup>
33911 </informaltable>
33912 <para>
33913 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
33914 <option>vacation</option> command is used in a filter file. The transport used is specified
33915 by this option, which, after expansion, must be the name of a configured
33916 transport. This should normally be an <command>autoreply</command> transport. Other transports
33917 are unlikely to do anything sensible or useful.
33918 </para>
33919 <para>
33920 <indexterm role="option">
33921 <primary><option>rewrite</option></primary>
33922 </indexterm>
33923 </para>
33924 <informaltable frame="all">
33925 <tgroup cols="4" colsep="0" rowsep="0">
33926 <colspec colwidth="8*" align="left"/>
33927 <colspec colwidth="5*" align="center"/>
33928 <colspec colwidth="5*" align="center"/>
33929 <colspec colwidth="6*" align="right"/>
33930 <tbody>
33931 <row>
33932 <entry><option>rewrite</option></entry>
33933 <entry>Use: <emphasis>redirect</emphasis></entry>
33934 <entry>Type: <emphasis>boolean</emphasis></entry>
33935 <entry>Default: <emphasis>true</emphasis></entry>
33936 </row>
33937 </tbody>
33938 </tgroup>
33939 </informaltable>
33940 <para>
33941 <indexterm role="concept">
33942 <primary>address redirection</primary>
33943 <secondary>disabling rewriting</secondary>
33944 </indexterm>
33945 If this option is set false, addresses generated by the router are not
33946 subject to address rewriting. Otherwise, they are treated like new addresses
33947 and are rewritten according to the global rewriting rules.
33948 </para>
33949 <para>
33950 <indexterm role="option">
33951 <primary><option>sieve_subaddress</option></primary>
33952 </indexterm>
33953 </para>
33954 <informaltable frame="all">
33955 <tgroup cols="4" colsep="0" rowsep="0">
33956 <colspec colwidth="8*" align="left"/>
33957 <colspec colwidth="5*" align="center"/>
33958 <colspec colwidth="5*" align="center"/>
33959 <colspec colwidth="6*" align="right"/>
33960 <tbody>
33961 <row>
33962 <entry><option>sieve_subaddress</option></entry>
33963 <entry>Use: <emphasis>redirect</emphasis></entry>
33964 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33965 <entry>Default: <emphasis>unset</emphasis></entry>
33966 </row>
33967 </tbody>
33968 </tgroup>
33969 </informaltable>
33970 <para>
33971 The value of this option is passed to a Sieve filter to specify the
33972 :subaddress part of an address.
33973 </para>
33974 <para>
33975 <indexterm role="option">
33976 <primary><option>sieve_useraddress</option></primary>
33977 </indexterm>
33978 </para>
33979 <informaltable frame="all">
33980 <tgroup cols="4" colsep="0" rowsep="0">
33981 <colspec colwidth="8*" align="left"/>
33982 <colspec colwidth="5*" align="center"/>
33983 <colspec colwidth="5*" align="center"/>
33984 <colspec colwidth="6*" align="right"/>
33985 <tbody>
33986 <row>
33987 <entry><option>sieve_useraddress</option></entry>
33988 <entry>Use: <emphasis>redirect</emphasis></entry>
33989 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33990 <entry>Default: <emphasis>unset</emphasis></entry>
33991 </row>
33992 </tbody>
33993 </tgroup>
33994 </informaltable>
33995 <para>
33996 The value of this option is passed to a Sieve filter to specify the :user part
33997 of an address. However, if it is unset, the entire original local part
33998 (including any prefix or suffix) is used for :user.
33999 </para>
34000 <para>
34001 <indexterm role="option">
34002 <primary><option>sieve_vacation_directory</option></primary>
34003 </indexterm>
34004 </para>
34005 <informaltable frame="all">
34006 <tgroup cols="4" colsep="0" rowsep="0">
34007 <colspec colwidth="8*" align="left"/>
34008 <colspec colwidth="5*" align="center"/>
34009 <colspec colwidth="5*" align="center"/>
34010 <colspec colwidth="6*" align="right"/>
34011 <tbody>
34012 <row>
34013 <entry><option>sieve_vacation_directory</option></entry>
34014 <entry>Use: <emphasis>redirect</emphasis></entry>
34015 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34016 <entry>Default: <emphasis>unset</emphasis></entry>
34017 </row>
34018 </tbody>
34019 </tgroup>
34020 </informaltable>
34021 <para>
34022 <indexterm role="concept">
34023 <primary>Sieve filter</primary>
34024 <secondary>vacation directory</secondary>
34025 </indexterm>
34026 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
34027 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
34028 (do not put anything else in that directory), and ensure that the
34029 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
34030 needs their own directory; Exim will create it if necessary.
34031 </para>
34032 <para>
34033 <indexterm role="option">
34034 <primary><option>skip_syntax_errors</option></primary>
34035 </indexterm>
34036 </para>
34037 <informaltable frame="all">
34038 <tgroup cols="4" colsep="0" rowsep="0">
34039 <colspec colwidth="8*" align="left"/>
34040 <colspec colwidth="5*" align="center"/>
34041 <colspec colwidth="5*" align="center"/>
34042 <colspec colwidth="6*" align="right"/>
34043 <tbody>
34044 <row>
34045 <entry><option>skip_syntax_errors</option></entry>
34046 <entry>Use: <emphasis>redirect</emphasis></entry>
34047 <entry>Type: <emphasis>boolean</emphasis></entry>
34048 <entry>Default: <emphasis>false</emphasis></entry>
34049 </row>
34050 </tbody>
34051 </tgroup>
34052 </informaltable>
34053 <para>
34054 <indexterm role="concept">
34055 <primary>forward file</primary>
34056 <secondary>broken</secondary>
34057 </indexterm>
34058 <indexterm role="concept">
34059 <primary>address redirection</primary>
34060 <secondary>broken files</secondary>
34061 </indexterm>
34062 <indexterm role="concept">
34063 <primary>alias file</primary>
34064 <secondary>broken</secondary>
34065 </indexterm>
34066 <indexterm role="concept">
34067 <primary>broken alias or forward files</primary>
34068 </indexterm>
34069 <indexterm role="concept">
34070 <primary>ignoring faulty addresses</primary>
34071 </indexterm>
34072 <indexterm role="concept">
34073 <primary>skipping faulty addresses</primary>
34074 </indexterm>
34075 <indexterm role="concept">
34076 <primary>error</primary>
34077 <secondary>skipping bad syntax</secondary>
34078 </indexterm>
34079 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
34080 non-filter redirection data are skipped, and each failing address is logged. If
34081 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
34082 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
34083 are expanded and placed at the head of the error message generated by
34084 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
34085 be the same address as the generic <option>errors_to</option> option. The
34086 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
34087 </para>
34088 <para>
34089 If all the addresses in a redirection list are skipped because of syntax
34090 errors, the router declines to handle the original address, and it is passed to
34091 the following routers.
34092 </para>
34093 <para>
34094 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
34095 error in the filter causes filtering to be abandoned without any action being
34096 taken. The incident is logged, and the router declines to handle the address,
34097 so it is passed to the following routers.
34098 </para>
34099 <para>
34100 <indexterm role="concept">
34101 <primary>Sieve filter</primary>
34102 <secondary>syntax errors in</secondary>
34103 </indexterm>
34104 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
34105 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
34106 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
34107 </para>
34108 <para>
34109 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
34110 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
34111 option, used with an address that does not get redirected, can be used to
34112 notify users of these errors, by means of a router like this:
34113 </para>
34114 <literallayout class="monospaced">
34115 userforward:
34116   driver = redirect
34117   allow_filter
34118   check_local_user
34119   file = $home/.forward
34120   file_transport = address_file
34121   pipe_transport = address_pipe
34122   reply_transport = address_reply
34123   no_verify
34124   skip_syntax_errors
34125   syntax_errors_to = real-$local_part@$domain
34126   syntax_errors_text = \
34127    This is an automatically generated message. An error has\n\
34128    been found in your .forward file. Details of the error are\n\
34129    reported below. While this error persists, you will receive\n\
34130    a copy of this message for every message that is addressed\n\
34131    to you. If your .forward file is a filter file, or if it is\n\
34132    a non-filter file containing no valid forwarding addresses,\n\
34133    a copy of each incoming message will be put in your normal\n\
34134    mailbox. If a non-filter file contains at least one valid\n\
34135    forwarding address, forwarding to the valid addresses will\n\
34136    happen, and those will be the only deliveries that occur.
34137 </literallayout>
34138 <para>
34139 You also need a router to ensure that local addresses that are prefixed by
34140 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
34141 put this immediately before the <command>userforward</command> router:
34142 </para>
34143 <literallayout class="monospaced">
34144 real_localuser:
34145   driver = accept
34146   check_local_user
34147   local_part_prefix = real-
34148   transport = local_delivery
34149 </literallayout>
34150 <para>
34151 <indexterm role="option">
34152 <primary><option>syntax_errors_text</option></primary>
34153 </indexterm>
34154 </para>
34155 <informaltable frame="all">
34156 <tgroup cols="4" colsep="0" rowsep="0">
34157 <colspec colwidth="8*" align="left"/>
34158 <colspec colwidth="5*" align="center"/>
34159 <colspec colwidth="5*" align="center"/>
34160 <colspec colwidth="6*" align="right"/>
34161 <tbody>
34162 <row>
34163 <entry><option>syntax_errors_text</option></entry>
34164 <entry>Use: <emphasis>redirect</emphasis></entry>
34165 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34166 <entry>Default: <emphasis>unset</emphasis></entry>
34167 </row>
34168 </tbody>
34169 </tgroup>
34170 </informaltable>
34171 <para>
34172 See <option>skip_syntax_errors</option> above.
34173 </para>
34174 <para>
34175 <indexterm role="option">
34176 <primary><option>syntax_errors_to</option></primary>
34177 </indexterm>
34178 </para>
34179 <informaltable frame="all">
34180 <tgroup cols="4" colsep="0" rowsep="0">
34181 <colspec colwidth="8*" align="left"/>
34182 <colspec colwidth="5*" align="center"/>
34183 <colspec colwidth="5*" align="center"/>
34184 <colspec colwidth="6*" align="right"/>
34185 <tbody>
34186 <row>
34187 <entry><option>syntax_errors_to</option></entry>
34188 <entry>Use: <emphasis>redirect</emphasis></entry>
34189 <entry>Type: <emphasis>string</emphasis></entry>
34190 <entry>Default: <emphasis>unset</emphasis></entry>
34191 </row>
34192 </tbody>
34193 </tgroup>
34194 </informaltable>
34195 <para>
34196 See <option>skip_syntax_errors</option> above.
34197 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
34198 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
34199 </para>
34200 </section>
34201 </chapter>
34202
34203 <chapter id="CHAPenvironment">
34204 <title>Environment for running local transports</title>
34205 <titleabbrev>Environment for local transports</titleabbrev>
34206 <para>
34207 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
34208 <primary>local transports</primary>
34209 <secondary>environment for</secondary>
34210 </indexterm>
34211 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
34212 <primary>environment for local transports</primary>
34213 </indexterm>
34214 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
34215 <primary>transport</primary>
34216 <secondary>local; environment for</secondary>
34217 </indexterm>
34218 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
34219 transport can be thought of as similar to a pipe.) Exim always runs transports
34220 in subprocesses, under specified uids and gids. Typical deliveries to local
34221 mailboxes run under the uid and gid of the local user.
34222 </para>
34223 <para>
34224 Exim also sets a specific current directory while running the transport; for
34225 some transports a home directory setting is also relevant. The <command>pipe</command>
34226 transport is the only one that sets up environment variables; see section
34227 <xref linkend="SECTpipeenv"/> for details.
34228 </para>
34229 <para>
34230 The values used for the uid, gid, and the directories may come from several
34231 different places. In many cases, the router that handles the address associates
34232 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
34233 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
34234 configuration, and these override anything that comes from the router.
34235 </para>
34236 <section>
34237 <title>Concurrent deliveries</title>
34238 <para>
34239 <indexterm role="concept">
34240 <primary>concurrent deliveries</primary>
34241 </indexterm>
34242 <indexterm role="concept">
34243 <primary>simultaneous deliveries</primary>
34244 </indexterm>
34245 If two different messages for the same local recpient arrive more or less
34246 simultaneously, the two delivery processes are likely to run concurrently. When
34247 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
34248 rules to stop concurrent processes from writing to the same file at the same
34249 time.
34250 </para>
34251 <para>
34252 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
34253 locking that is needed. Here is a silly example:
34254 </para>
34255 <literallayout class="monospaced">
34256 my_transport:
34257   driver = pipe
34258   command = /bin/sh -c 'cat &gt;&gt;/some/file'
34259 </literallayout>
34260 <para>
34261 This is supposed to write the message at the end of the file. However, if two
34262 messages arrive at the same time, the file will be scrambled. You can use the
34263 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
34264 file using the same algorithm that Exim itself uses.
34265 </para>
34266 </section>
34267 <section id="SECTenvuidgid">
34268 <title>Uids and gids</title>
34269 <para>
34270 <indexterm role="concept">
34271 <primary>local transports</primary>
34272 <secondary>uid and gid</secondary>
34273 </indexterm>
34274 <indexterm role="concept">
34275 <primary>transport</primary>
34276 <secondary>local; uid and gid</secondary>
34277 </indexterm>
34278 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
34279 overrides any group that the router set in the address, even if <option>user</option> is not
34280 set for the transport. This makes it possible, for example, to run local mail
34281 delivery under the uid of the recipient (set by the router), but in a special
34282 group (set by the transport). For example:
34283 </para>
34284 <literallayout class="monospaced">
34285 # Routers ...
34286 # User/group are set by check_local_user in this router
34287 local_users:
34288   driver = accept
34289   check_local_user
34290   transport = group_delivery
34291
34292 # Transports ...
34293 # This transport overrides the group
34294 group_delivery:
34295   driver = appendfile
34296   file = /var/spool/mail/$local_part
34297   group = mail
34298 </literallayout>
34299 <para>
34300 If <option>user</option> is set for a transport, its value overrides what is set in the
34301 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
34302 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
34303 set.
34304 </para>
34305 <para>
34306 <indexterm role="concept">
34307 <primary><option>initgroups</option> option</primary>
34308 </indexterm>
34309 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
34310 function is called for the groups associated with that uid if the
34311 <option>initgroups</option> option is set for the transport. When the uid is not specified
34312 by the transport, but is associated with the address by a router, the option
34313 for calling <function>initgroups()</function> is taken from the router configuration.
34314 </para>
34315 <para>
34316 <indexterm role="concept">
34317 <primary><command>pipe</command> transport</primary>
34318 <secondary>uid for</secondary>
34319 </indexterm>
34320 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
34321 is set and <option>user</option> is not set, the uid of the process that called Exim to
34322 receive the message is used, and if <option>group</option> is not set, the corresponding
34323 original gid is also used.
34324 </para>
34325 <para>
34326 This is the detailed preference order for obtaining a gid; the first of the
34327 following that is set is used:
34328 </para>
34329 <itemizedlist>
34330 <listitem>
34331 <para>
34332 A <option>group</option> setting of the transport;
34333 </para>
34334 </listitem>
34335 <listitem>
34336 <para>
34337 A <option>group</option> setting of the router;
34338 </para>
34339 </listitem>
34340 <listitem>
34341 <para>
34342 A gid associated with a user setting of the router, either as a result of
34343 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
34344 </para>
34345 </listitem>
34346 <listitem>
34347 <para>
34348 The group associated with a non-numeric <option>user</option> setting of the transport;
34349 </para>
34350 </listitem>
34351 <listitem>
34352 <para>
34353 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
34354 the uid is the creator&#x2019;s uid;
34355 </para>
34356 </listitem>
34357 <listitem>
34358 <para>
34359 The Exim gid if the Exim uid is being used as a default.
34360 </para>
34361 </listitem>
34362 </itemizedlist>
34363 <para>
34364 If, for example, the user is specified numerically on the router and there are
34365 no group settings, no gid is available. In this situation, an error occurs.
34366 This is different for the uid, for which there always is an ultimate default.
34367 The first of the following that is set is used:
34368 </para>
34369 <itemizedlist>
34370 <listitem>
34371 <para>
34372 A <option>user</option> setting of the transport;
34373 </para>
34374 </listitem>
34375 <listitem>
34376 <para>
34377 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
34378 </para>
34379 </listitem>
34380 <listitem>
34381 <para>
34382 A <option>user</option> setting of the router;
34383 </para>
34384 </listitem>
34385 <listitem>
34386 <para>
34387 A <option>check_local_user</option> setting of the router;
34388 </para>
34389 </listitem>
34390 <listitem>
34391 <para>
34392 The Exim uid.
34393 </para>
34394 </listitem>
34395 </itemizedlist>
34396 <para>
34397 Of course, an error will still occur if the uid that is chosen is on the
34398 <option>never_users</option> list.
34399 </para>
34400 </section>
34401 <section>
34402 <title>Current and home directories</title>
34403 <para>
34404 <indexterm role="concept">
34405 <primary>current directory for local transport</primary>
34406 </indexterm>
34407 <indexterm role="concept">
34408 <primary>home directory</primary>
34409 <secondary>for local transport</secondary>
34410 </indexterm>
34411 <indexterm role="concept">
34412 <primary>transport</primary>
34413 <secondary>local; home directory for</secondary>
34414 </indexterm>
34415 <indexterm role="concept">
34416 <primary>transport</primary>
34417 <secondary>local; current directory for</secondary>
34418 </indexterm>
34419 Routers may set current and home directories for local transports by means of
34420 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
34421 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
34422 are set, they override the router&#x2019;s values. In detail, the home directory
34423 for a local transport is taken from the first of these values that is set:
34424 </para>
34425 <itemizedlist>
34426 <listitem>
34427 <para>
34428 The <option>home_directory</option> option on the transport;
34429 </para>
34430 </listitem>
34431 <listitem>
34432 <para>
34433 The <option>transport_home_directory</option> option on the router;
34434 </para>
34435 </listitem>
34436 <listitem>
34437 <para>
34438 The password data if <option>check_local_user</option> is set on the router;
34439 </para>
34440 </listitem>
34441 <listitem>
34442 <para>
34443 The <option>router_home_directory</option> option on the router.
34444 </para>
34445 </listitem>
34446 </itemizedlist>
34447 <para>
34448 The current directory is taken from the first of these values that is set:
34449 </para>
34450 <itemizedlist>
34451 <listitem>
34452 <para>
34453 The <option>current_directory</option> option on the transport;
34454 </para>
34455 </listitem>
34456 <listitem>
34457 <para>
34458 The <option>transport_current_directory</option> option on the router.
34459 </para>
34460 </listitem>
34461 </itemizedlist>
34462 <para>
34463 If neither the router nor the transport sets a current directory, Exim uses the
34464 value of the home directory, if it is set. Otherwise it sets the current
34465 directory to <filename>/</filename> before running a local transport.
34466 </para>
34467 </section>
34468 <section>
34469 <title>Expansion variables derived from the address</title>
34470 <para>
34471 <indexterm role="concept">
34472 <primary><varname>$domain</varname></primary>
34473 </indexterm>
34474 <indexterm role="concept">
34475 <primary><varname>$local_part</varname></primary>
34476 </indexterm>
34477 <indexterm role="concept">
34478 <primary><varname>$original_domain</varname></primary>
34479 </indexterm>
34480 Normally a local delivery is handling a single address, and in that case the
34481 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
34482 deliveries. However, in some circumstances more than one address may be handled
34483 at once (for example, while writing batch SMTP for onward transmission by some
34484 other means). In this case, the variables associated with the local part are
34485 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
34486 and <varname>$original_domain</varname> is never set.
34487 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
34488 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
34489 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
34490 </para>
34491 </section>
34492 </chapter>
34493
34494 <chapter id="CHAPtransportgeneric">
34495 <title>Generic options for transports</title>
34496 <para>
34497 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
34498 <primary>generic options</primary>
34499 <secondary>transport</secondary>
34500 </indexterm>
34501 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
34502 <primary>options</primary>
34503 <secondary>generic; for transports</secondary>
34504 </indexterm>
34505 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
34506 <primary>transport</primary>
34507 <secondary>generic options for</secondary>
34508 </indexterm>
34509 The following generic options apply to all transports:
34510 </para>
34511 <para>
34512 <indexterm role="option">
34513 <primary><option>body_only</option></primary>
34514 </indexterm>
34515 </para>
34516 <informaltable frame="all">
34517 <tgroup cols="4" colsep="0" rowsep="0">
34518 <colspec colwidth="8*" align="left"/>
34519 <colspec colwidth="5*" align="center"/>
34520 <colspec colwidth="5*" align="center"/>
34521 <colspec colwidth="6*" align="right"/>
34522 <tbody>
34523 <row>
34524 <entry><option>body_only</option></entry>
34525 <entry>Use: <emphasis>transports</emphasis></entry>
34526 <entry>Type: <emphasis>boolean</emphasis></entry>
34527 <entry>Default: <emphasis>false</emphasis></entry>
34528 </row>
34529 </tbody>
34530 </tgroup>
34531 </informaltable>
34532 <para>
34533 <indexterm role="concept">
34534 <primary>transport</primary>
34535 <secondary>body only</secondary>
34536 </indexterm>
34537 <indexterm role="concept">
34538 <primary>message</primary>
34539 <secondary>transporting body only</secondary>
34540 </indexterm>
34541 <indexterm role="concept">
34542 <primary>body of message</primary>
34543 <secondary>transporting</secondary>
34544 </indexterm>
34545 If this option is set, the message&#x2019;s headers are not transported. It is
34546 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
34547 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
34548 <option>message_suffix</option> should be checked, because this option does not
34549 automatically suppress them.
34550 </para>
34551 <para>
34552 <indexterm role="option">
34553 <primary><option>current_directory</option></primary>
34554 </indexterm>
34555 </para>
34556 <informaltable frame="all">
34557 <tgroup cols="4" colsep="0" rowsep="0">
34558 <colspec colwidth="8*" align="left"/>
34559 <colspec colwidth="5*" align="center"/>
34560 <colspec colwidth="5*" align="center"/>
34561 <colspec colwidth="6*" align="right"/>
34562 <tbody>
34563 <row>
34564 <entry><option>current_directory</option></entry>
34565 <entry>Use: <emphasis>transports</emphasis></entry>
34566 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34567 <entry>Default: <emphasis>unset</emphasis></entry>
34568 </row>
34569 </tbody>
34570 </tgroup>
34571 </informaltable>
34572 <para>
34573 <indexterm role="concept">
34574 <primary>transport</primary>
34575 <secondary>current directory for</secondary>
34576 </indexterm>
34577 This specifies the current directory that is to be set while running the
34578 transport, overriding any value that may have been set by the router.
34579 If the expansion fails for any reason, including forced failure, an error is
34580 logged, and delivery is deferred.
34581 </para>
34582 <para>
34583 <indexterm role="option">
34584 <primary><option>disable_logging</option></primary>
34585 </indexterm>
34586 </para>
34587 <informaltable frame="all">
34588 <tgroup cols="4" colsep="0" rowsep="0">
34589 <colspec colwidth="8*" align="left"/>
34590 <colspec colwidth="5*" align="center"/>
34591 <colspec colwidth="5*" align="center"/>
34592 <colspec colwidth="6*" align="right"/>
34593 <tbody>
34594 <row>
34595 <entry><option>disable_logging</option></entry>
34596 <entry>Use: <emphasis>transports</emphasis></entry>
34597 <entry>Type: <emphasis>boolean</emphasis></entry>
34598 <entry>Default: <emphasis>false</emphasis></entry>
34599 </row>
34600 </tbody>
34601 </tgroup>
34602 </informaltable>
34603 <para>
34604 If this option is set true, nothing is logged for any
34605 deliveries by the transport or for any
34606 transport errors. You should not set this option unless you really, really know
34607 what you are doing.
34608 </para>
34609 <para>
34610 <indexterm role="option">
34611 <primary><option>debug_print</option></primary>
34612 </indexterm>
34613 </para>
34614 <informaltable frame="all">
34615 <tgroup cols="4" colsep="0" rowsep="0">
34616 <colspec colwidth="8*" align="left"/>
34617 <colspec colwidth="5*" align="center"/>
34618 <colspec colwidth="5*" align="center"/>
34619 <colspec colwidth="6*" align="right"/>
34620 <tbody>
34621 <row>
34622 <entry><option>debug_print</option></entry>
34623 <entry>Use: <emphasis>transports</emphasis></entry>
34624 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34625 <entry>Default: <emphasis>unset</emphasis></entry>
34626 </row>
34627 </tbody>
34628 </tgroup>
34629 </informaltable>
34630 <para>
34631 <indexterm role="concept">
34632 <primary>testing</primary>
34633 <secondary>variables in drivers</secondary>
34634 </indexterm>
34635 If this option is set and debugging is enabled (see the <option>-d</option> command line
34636 option), the string is expanded and included in the debugging output when the
34637 transport is run.
34638 If expansion of the string fails, the error message is written to the debugging
34639 output, and Exim carries on processing.
34640 This facility is provided to help with checking out the values of variables and
34641 so on when debugging driver configurations. For example, if a <option>headers_add</option>
34642 option is not working properly, <option>debug_print</option> could be used to output the
34643 variables it references. A newline is added to the text if it does not end with
34644 one.
34645 </para>
34646 <para>
34647 <indexterm role="option">
34648 <primary><option>delivery_date_add</option></primary>
34649 </indexterm>
34650 </para>
34651 <informaltable frame="all">
34652 <tgroup cols="4" colsep="0" rowsep="0">
34653 <colspec colwidth="8*" align="left"/>
34654 <colspec colwidth="5*" align="center"/>
34655 <colspec colwidth="5*" align="center"/>
34656 <colspec colwidth="6*" align="right"/>
34657 <tbody>
34658 <row>
34659 <entry><option>delivery_date_add</option></entry>
34660 <entry>Use: <emphasis>transports</emphasis></entry>
34661 <entry>Type: <emphasis>boolean</emphasis></entry>
34662 <entry>Default: <emphasis>false</emphasis></entry>
34663 </row>
34664 </tbody>
34665 </tgroup>
34666 </informaltable>
34667 <para>
34668 <indexterm role="concept">
34669 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
34670 </indexterm>
34671 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
34672 This gives the actual time the delivery was made. As this is not a standard
34673 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
34674 requests its removal from incoming messages, so that delivered messages can
34675 safely be resent to other recipients.
34676 </para>
34677 <para>
34678 <indexterm role="option">
34679 <primary><option>driver</option></primary>
34680 </indexterm>
34681 </para>
34682 <informaltable frame="all">
34683 <tgroup cols="4" colsep="0" rowsep="0">
34684 <colspec colwidth="8*" align="left"/>
34685 <colspec colwidth="5*" align="center"/>
34686 <colspec colwidth="5*" align="center"/>
34687 <colspec colwidth="6*" align="right"/>
34688 <tbody>
34689 <row>
34690 <entry><option>driver</option></entry>
34691 <entry>Use: <emphasis>transports</emphasis></entry>
34692 <entry>Type: <emphasis>string</emphasis></entry>
34693 <entry>Default: <emphasis>unset</emphasis></entry>
34694 </row>
34695 </tbody>
34696 </tgroup>
34697 </informaltable>
34698 <para>
34699 This specifies which of the available transport drivers is to be used.
34700 There is no default, and this option must be set for every transport.
34701 </para>
34702 <para>
34703 <indexterm role="option">
34704 <primary><option>envelope_to_add</option></primary>
34705 </indexterm>
34706 </para>
34707 <informaltable frame="all">
34708 <tgroup cols="4" colsep="0" rowsep="0">
34709 <colspec colwidth="8*" align="left"/>
34710 <colspec colwidth="5*" align="center"/>
34711 <colspec colwidth="5*" align="center"/>
34712 <colspec colwidth="6*" align="right"/>
34713 <tbody>
34714 <row>
34715 <entry><option>envelope_to_add</option></entry>
34716 <entry>Use: <emphasis>transports</emphasis></entry>
34717 <entry>Type: <emphasis>boolean</emphasis></entry>
34718 <entry>Default: <emphasis>false</emphasis></entry>
34719 </row>
34720 </tbody>
34721 </tgroup>
34722 </informaltable>
34723 <para>
34724 <indexterm role="concept">
34725 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
34726 </indexterm>
34727 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
34728 This gives the original address(es) in the incoming envelope that caused this
34729 delivery to happen. More than one address may be present if the transport is
34730 configured to handle several addresses at once, or if more than one original
34731 address was redirected to the same final address. As this is not a standard
34732 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
34733 its removal from incoming messages, so that delivered messages can safely be
34734 resent to other recipients.
34735 </para>
34736 <para>
34737 <indexterm role="option">
34738 <primary><option>group</option></primary>
34739 </indexterm>
34740 </para>
34741 <informaltable frame="all">
34742 <tgroup cols="4" colsep="0" rowsep="0">
34743 <colspec colwidth="8*" align="left"/>
34744 <colspec colwidth="5*" align="center"/>
34745 <colspec colwidth="5*" align="center"/>
34746 <colspec colwidth="6*" align="right"/>
34747 <tbody>
34748 <row>
34749 <entry><option>group</option></entry>
34750 <entry>Use: <emphasis>transports</emphasis></entry>
34751 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34752 <entry>Default: <emphasis>Exim group</emphasis></entry>
34753 </row>
34754 </tbody>
34755 </tgroup>
34756 </informaltable>
34757 <para>
34758 <indexterm role="concept">
34759 <primary>transport</primary>
34760 <secondary>group; specifying</secondary>
34761 </indexterm>
34762 This option specifies a gid for running the transport process, overriding any
34763 value that the router supplies, and also overriding any value associated with
34764 <option>user</option> (see below).
34765 </para>
34766 <para>
34767 <indexterm role="option">
34768 <primary><option>headers_add</option></primary>
34769 </indexterm>
34770 </para>
34771 <informaltable frame="all">
34772 <tgroup cols="4" colsep="0" rowsep="0">
34773 <colspec colwidth="8*" align="left"/>
34774 <colspec colwidth="5*" align="center"/>
34775 <colspec colwidth="5*" align="center"/>
34776 <colspec colwidth="6*" align="right"/>
34777 <tbody>
34778 <row>
34779 <entry><option>headers_add</option></entry>
34780 <entry>Use: <emphasis>transports</emphasis></entry>
34781 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34782 <entry>Default: <emphasis>unset</emphasis></entry>
34783 </row>
34784 </tbody>
34785 </tgroup>
34786 </informaltable>
34787 <para>
34788 <indexterm role="concept">
34789 <primary>header lines</primary>
34790 <secondary>adding in transport</secondary>
34791 </indexterm>
34792 <indexterm role="concept">
34793 <primary>transport</primary>
34794 <secondary>header lines; adding</secondary>
34795 </indexterm>
34796 This option specifies a string of text that is expanded and added to the header
34797 portion of a message as it is transported, as described in section
34798 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
34799 routers. If the result of the expansion is an empty string, or if the expansion
34800 is forced to fail, no action is taken. Other expansion failures are treated as
34801 errors and cause the delivery to be deferred.
34802 </para>
34803 <para>
34804 <indexterm role="option">
34805 <primary><option>headers_only</option></primary>
34806 </indexterm>
34807 </para>
34808 <informaltable frame="all">
34809 <tgroup cols="4" colsep="0" rowsep="0">
34810 <colspec colwidth="8*" align="left"/>
34811 <colspec colwidth="5*" align="center"/>
34812 <colspec colwidth="5*" align="center"/>
34813 <colspec colwidth="6*" align="right"/>
34814 <tbody>
34815 <row>
34816 <entry><option>headers_only</option></entry>
34817 <entry>Use: <emphasis>transports</emphasis></entry>
34818 <entry>Type: <emphasis>boolean</emphasis></entry>
34819 <entry>Default: <emphasis>false</emphasis></entry>
34820 </row>
34821 </tbody>
34822 </tgroup>
34823 </informaltable>
34824 <para>
34825 <indexterm role="concept">
34826 <primary>transport</primary>
34827 <secondary>header lines only</secondary>
34828 </indexterm>
34829 <indexterm role="concept">
34830 <primary>message</primary>
34831 <secondary>transporting headers only</secondary>
34832 </indexterm>
34833 <indexterm role="concept">
34834 <primary>header lines</primary>
34835 <secondary>transporting</secondary>
34836 </indexterm>
34837 If this option is set, the message&#x2019;s body is not transported. It is mutually
34838 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
34839 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
34840 checked, since this option does not automatically suppress them.
34841 </para>
34842 <para>
34843 <indexterm role="option">
34844 <primary><option>headers_remove</option></primary>
34845 </indexterm>
34846 </para>
34847 <informaltable frame="all">
34848 <tgroup cols="4" colsep="0" rowsep="0">
34849 <colspec colwidth="8*" align="left"/>
34850 <colspec colwidth="5*" align="center"/>
34851 <colspec colwidth="5*" align="center"/>
34852 <colspec colwidth="6*" align="right"/>
34853 <tbody>
34854 <row>
34855 <entry><option>headers_remove</option></entry>
34856 <entry>Use: <emphasis>transports</emphasis></entry>
34857 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34858 <entry>Default: <emphasis>unset</emphasis></entry>
34859 </row>
34860 </tbody>
34861 </tgroup>
34862 </informaltable>
34863 <para>
34864 <indexterm role="concept">
34865 <primary>header lines</primary>
34866 <secondary>removing</secondary>
34867 </indexterm>
34868 <indexterm role="concept">
34869 <primary>transport</primary>
34870 <secondary>header lines; removing</secondary>
34871 </indexterm>
34872 This option specifies a string that is expanded into a list of header names;
34873 these headers are omitted from the message as it is transported, as described
34874 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
34875 routers. If the result of the expansion is an empty string, or if the expansion
34876 is forced to fail, no action is taken. Other expansion failures are treated as
34877 errors and cause the delivery to be deferred.
34878 </para>
34879 <para>
34880 <indexterm role="option">
34881 <primary><option>headers_rewrite</option></primary>
34882 </indexterm>
34883 </para>
34884 <informaltable frame="all">
34885 <tgroup cols="4" colsep="0" rowsep="0">
34886 <colspec colwidth="8*" align="left"/>
34887 <colspec colwidth="5*" align="center"/>
34888 <colspec colwidth="5*" align="center"/>
34889 <colspec colwidth="6*" align="right"/>
34890 <tbody>
34891 <row>
34892 <entry><option>headers_rewrite</option></entry>
34893 <entry>Use: <emphasis>transports</emphasis></entry>
34894 <entry>Type: <emphasis>string</emphasis></entry>
34895 <entry>Default: <emphasis>unset</emphasis></entry>
34896 </row>
34897 </tbody>
34898 </tgroup>
34899 </informaltable>
34900 <para>
34901 <indexterm role="concept">
34902 <primary>transport</primary>
34903 <secondary>header lines; rewriting</secondary>
34904 </indexterm>
34905 <indexterm role="concept">
34906 <primary>rewriting</primary>
34907 <secondary>at transport time</secondary>
34908 </indexterm>
34909 This option allows addresses in header lines to be rewritten at transport time,
34910 that is, as the message is being copied to its destination. The contents of the
34911 option are a colon-separated list of rewriting rules. Each rule is in exactly
34912 the same form as one of the general rewriting rules that are applied when a
34913 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
34914 example,
34915 </para>
34916 <literallayout class="monospaced">
34917 headers_rewrite = a@b c@d f : \
34918                   x@y w@z
34919 </literallayout>
34920 <para>
34921 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
34922 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
34923 header lines just before they are written out at transport time, so they affect
34924 only those copies of the message that pass through the transport. However, only
34925 the message&#x2019;s original header lines, and any that were added by a system
34926 filter, are rewritten. If a router or transport adds header lines, they are not
34927 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
34928 envelope. You can change the return path using <option>return_path</option>, but you cannot
34929 change envelope recipients at this time.
34930 </para>
34931 <para>
34932 <indexterm role="option">
34933 <primary><option>home_directory</option></primary>
34934 </indexterm>
34935 </para>
34936 <informaltable frame="all">
34937 <tgroup cols="4" colsep="0" rowsep="0">
34938 <colspec colwidth="8*" align="left"/>
34939 <colspec colwidth="5*" align="center"/>
34940 <colspec colwidth="5*" align="center"/>
34941 <colspec colwidth="6*" align="right"/>
34942 <tbody>
34943 <row>
34944 <entry><option>home_directory</option></entry>
34945 <entry>Use: <emphasis>transports</emphasis></entry>
34946 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34947 <entry>Default: <emphasis>unset</emphasis></entry>
34948 </row>
34949 </tbody>
34950 </tgroup>
34951 </informaltable>
34952 <para>
34953 <indexterm role="concept">
34954 <primary>transport</primary>
34955 <secondary>home directory for</secondary>
34956 </indexterm>
34957 <indexterm role="concept">
34958 <primary><varname>$home</varname></primary>
34959 </indexterm>
34960 This option specifies a home directory setting for a local transport,
34961 overriding any value that may be set by the router. The home directory is
34962 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
34963 used as the current directory if no current directory is set by the
34964 <option>current_directory</option> option on the transport or the
34965 <option>transport_current_directory</option> option on the router. If the expansion fails
34966 for any reason, including forced failure, an error is logged, and delivery is
34967 deferred.
34968 </para>
34969 <para>
34970 <indexterm role="option">
34971 <primary><option>initgroups</option></primary>
34972 </indexterm>
34973 </para>
34974 <informaltable frame="all">
34975 <tgroup cols="4" colsep="0" rowsep="0">
34976 <colspec colwidth="8*" align="left"/>
34977 <colspec colwidth="5*" align="center"/>
34978 <colspec colwidth="5*" align="center"/>
34979 <colspec colwidth="6*" align="right"/>
34980 <tbody>
34981 <row>
34982 <entry><option>initgroups</option></entry>
34983 <entry>Use: <emphasis>transports</emphasis></entry>
34984 <entry>Type: <emphasis>boolean</emphasis></entry>
34985 <entry>Default: <emphasis>false</emphasis></entry>
34986 </row>
34987 </tbody>
34988 </tgroup>
34989 </informaltable>
34990 <para>
34991 <indexterm role="concept">
34992 <primary>additional groups</primary>
34993 </indexterm>
34994 <indexterm role="concept">
34995 <primary>groups</primary>
34996 <secondary>additional</secondary>
34997 </indexterm>
34998 <indexterm role="concept">
34999 <primary>transport</primary>
35000 <secondary>group; additional</secondary>
35001 </indexterm>
35002 If this option is true and the uid for the delivery process is provided by the
35003 transport, the <function>initgroups()</function> function is called when running the transport
35004 to ensure that any additional groups associated with the uid are set up.
35005 </para>
35006 <para>
35007 <indexterm role="option">
35008 <primary><option>message_size_limit</option></primary>
35009 </indexterm>
35010 </para>
35011 <informaltable frame="all">
35012 <tgroup cols="4" colsep="0" rowsep="0">
35013 <colspec colwidth="8*" align="left"/>
35014 <colspec colwidth="5*" align="center"/>
35015 <colspec colwidth="5*" align="center"/>
35016 <colspec colwidth="6*" align="right"/>
35017 <tbody>
35018 <row>
35019 <entry><option>message_size_limit</option></entry>
35020 <entry>Use: <emphasis>transports</emphasis></entry>
35021 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35022 <entry>Default: <emphasis>0</emphasis></entry>
35023 </row>
35024 </tbody>
35025 </tgroup>
35026 </informaltable>
35027 <para>
35028 <indexterm role="concept">
35029 <primary>limit</primary>
35030 <secondary>message size per transport</secondary>
35031 </indexterm>
35032 <indexterm role="concept">
35033 <primary>size of message</primary>
35034 <secondary>limit</secondary>
35035 </indexterm>
35036 <indexterm role="concept">
35037 <primary>transport</primary>
35038 <secondary>message size; limiting</secondary>
35039 </indexterm>
35040 This option controls the size of messages passed through the transport. It is
35041 expanded before use; the result of the expansion must be a sequence of digits,
35042 optionally followed by K or M.
35043 If the expansion fails for any reason, including forced failure, or if the
35044 result is not of the required form, delivery is deferred.
35045 If the value is greater than zero and the size of a message exceeds this
35046 limit, the address is failed. If there is any chance that the resulting bounce
35047 message could be routed to the same transport, you should ensure that
35048 <option>return_size_limit</option> is less than the transport&#x2019;s <option>message_size_limit</option>, as
35049 otherwise the bounce message will fail to get delivered.
35050 </para>
35051 <para>
35052 <indexterm role="option">
35053 <primary><option>rcpt_include_affixes</option></primary>
35054 </indexterm>
35055 </para>
35056 <informaltable frame="all">
35057 <tgroup cols="4" colsep="0" rowsep="0">
35058 <colspec colwidth="8*" align="left"/>
35059 <colspec colwidth="5*" align="center"/>
35060 <colspec colwidth="5*" align="center"/>
35061 <colspec colwidth="6*" align="right"/>
35062 <tbody>
35063 <row>
35064 <entry><option>rcpt_include_affixes</option></entry>
35065 <entry>Use: <emphasis>transports</emphasis></entry>
35066 <entry>Type: <emphasis>boolean</emphasis></entry>
35067 <entry>Default: <emphasis>false</emphasis></entry>
35068 </row>
35069 </tbody>
35070 </tgroup>
35071 </informaltable>
35072 <para>
35073 <indexterm role="concept">
35074 <primary>prefix</primary>
35075 <secondary>for local part; including in envelope</secondary>
35076 </indexterm>
35077 <indexterm role="concept">
35078 <primary>suffix</primary>
35079 <secondary>for local part; including in envelope</secondary>
35080 </indexterm>
35081 <indexterm role="concept">
35082 <primary>local part</primary>
35083 <secondary>prefix</secondary>
35084 </indexterm>
35085 <indexterm role="concept">
35086 <primary>local part</primary>
35087 <secondary>suffix</secondary>
35088 </indexterm>
35089 When this option is false (the default), and an address that has had any
35090 affixes (prefixes or suffixes) removed from the local part is delivered by any
35091 form of SMTP or LMTP, the affixes are not included. For example, if a router
35092 that contains
35093 </para>
35094 <literallayout class="monospaced">
35095 local_part_prefix = *-
35096 </literallayout>
35097 <para>
35098 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
35099 is delivered with
35100 </para>
35101 <literallayout class="monospaced">
35102 RCPT TO:&lt;xyz@some.domain&gt;
35103 </literallayout>
35104 <para>
35105 This is also the case when an ACL-time callout is being used to verify a
35106 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
35107 whole local part is included in the RCPT command. This option applies to BSMTP
35108 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
35109 <command>lmtp</command> and <command>smtp</command> transports.
35110 </para>
35111 <para>
35112 <indexterm role="option">
35113 <primary><option>retry_use_local_part</option></primary>
35114 </indexterm>
35115 </para>
35116 <informaltable frame="all">
35117 <tgroup cols="4" colsep="0" rowsep="0">
35118 <colspec colwidth="8*" align="left"/>
35119 <colspec colwidth="5*" align="center"/>
35120 <colspec colwidth="5*" align="center"/>
35121 <colspec colwidth="6*" align="right"/>
35122 <tbody>
35123 <row>
35124 <entry><option>retry_use_local_part</option></entry>
35125 <entry>Use: <emphasis>transports</emphasis></entry>
35126 <entry>Type: <emphasis>boolean</emphasis></entry>
35127 <entry>Default: <emphasis>see below</emphasis></entry>
35128 </row>
35129 </tbody>
35130 </tgroup>
35131 </informaltable>
35132 <para>
35133 <indexterm role="concept">
35134 <primary>hints database</primary>
35135 <secondary>retry keys</secondary>
35136 </indexterm>
35137 When a delivery suffers a temporary failure, a retry record is created
35138 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
35139 is based on the name and/or IP address of the failing remote host. For local
35140 deliveries, the key is normally the entire address, including both the local
35141 part and the domain. This is suitable for most common cases of local delivery
35142 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
35143 deliveries to that mailbox, not to the whole domain.
35144 </para>
35145 <para>
35146 However, in some special cases you may want to treat a temporary local delivery
35147 as a failure associated with the domain, and not with a particular local part.
35148 (For example, if you are storing all mail for some domain in files.) You can do
35149 this by setting <option>retry_use_local_part</option> false.
35150 </para>
35151 <para>
35152 For all the local transports, its default value is true. For remote transports,
35153 the default value is false for tidiness, but changing the value has no effect
35154 on a remote transport in the current implementation.
35155 </para>
35156 <para>
35157 <indexterm role="option">
35158 <primary><option>return_path</option></primary>
35159 </indexterm>
35160 </para>
35161 <informaltable frame="all">
35162 <tgroup cols="4" colsep="0" rowsep="0">
35163 <colspec colwidth="8*" align="left"/>
35164 <colspec colwidth="5*" align="center"/>
35165 <colspec colwidth="5*" align="center"/>
35166 <colspec colwidth="6*" align="right"/>
35167 <tbody>
35168 <row>
35169 <entry><option>return_path</option></entry>
35170 <entry>Use: <emphasis>transports</emphasis></entry>
35171 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35172 <entry>Default: <emphasis>unset</emphasis></entry>
35173 </row>
35174 </tbody>
35175 </tgroup>
35176 </informaltable>
35177 <para>
35178 <indexterm role="concept">
35179 <primary>envelope sender</primary>
35180 </indexterm>
35181 <indexterm role="concept">
35182 <primary>transport</primary>
35183 <secondary>return path; changing</secondary>
35184 </indexterm>
35185 <indexterm role="concept">
35186 <primary>return path</primary>
35187 <secondary>changing in transport</secondary>
35188 </indexterm>
35189 If this option is set, the string is expanded at transport time and replaces
35190 the existing return path (envelope sender) value in the copy of the message
35191 that is being delivered. An empty return path is permitted. This feature is
35192 designed for remote deliveries, where the value of this option is used in the
35193 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
35194 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
35195 header line, if one is added to the message (see the next option).
35196 </para>
35197 <para>
35198 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
35199 <option>return_path_on_delivery</option> to the log selector.
35200 </para>
35201 <para>
35202 <indexterm role="concept">
35203 <primary><varname>$return_path</varname></primary>
35204 </indexterm>
35205 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
35206 either the message&#x2019;s envelope sender, or an address set by the
35207 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
35208 replacement occurs; if it fails for another reason, delivery is deferred. This
35209 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
35210 section <xref linkend="SECTverp"/>.
35211 </para>
35212 <para>
35213 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
35214 remote server rejects a message at SMTP time, the bounce message is not sent to
35215 the value of this option. It is sent to the previously set errors address.
35216 This defaults to the incoming sender address, but can be changed by setting
35217 <option>errors_to</option> in a router.
35218 </para>
35219 <para>
35220 <indexterm role="option">
35221 <primary><option>return_path_add</option></primary>
35222 </indexterm>
35223 </para>
35224 <informaltable frame="all">
35225 <tgroup cols="4" colsep="0" rowsep="0">
35226 <colspec colwidth="8*" align="left"/>
35227 <colspec colwidth="5*" align="center"/>
35228 <colspec colwidth="5*" align="center"/>
35229 <colspec colwidth="6*" align="right"/>
35230 <tbody>
35231 <row>
35232 <entry><option>return_path_add</option></entry>
35233 <entry>Use: <emphasis>transports</emphasis></entry>
35234 <entry>Type: <emphasis>boolean</emphasis></entry>
35235 <entry>Default: <emphasis>false</emphasis></entry>
35236 </row>
35237 </tbody>
35238 </tgroup>
35239 </informaltable>
35240 <para>
35241 <indexterm role="concept">
35242 <primary><emphasis>Return-path:</emphasis> header line</primary>
35243 </indexterm>
35244 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
35245 Although the return path is normally available in the prefix line of BSD
35246 mailboxes, this is commonly not displayed by MUAs, and so the user does not
35247 have easy access to it.
35248 </para>
35249 <para>
35250 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
35251 the delivery SMTP server makes the final delivery</quote>. This implies that this
35252 header should not be present in incoming messages. Exim has a configuration
35253 option, <option>return_path_remove</option>, which requests removal of this header from
35254 incoming messages, so that delivered messages can safely be resent to other
35255 recipients.
35256 </para>
35257 <para>
35258 <indexterm role="option">
35259 <primary><option>shadow_condition</option></primary>
35260 </indexterm>
35261 </para>
35262 <informaltable frame="all">
35263 <tgroup cols="4" colsep="0" rowsep="0">
35264 <colspec colwidth="8*" align="left"/>
35265 <colspec colwidth="5*" align="center"/>
35266 <colspec colwidth="5*" align="center"/>
35267 <colspec colwidth="6*" align="right"/>
35268 <tbody>
35269 <row>
35270 <entry><option>shadow_condition</option></entry>
35271 <entry>Use: <emphasis>transports</emphasis></entry>
35272 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35273 <entry>Default: <emphasis>unset</emphasis></entry>
35274 </row>
35275 </tbody>
35276 </tgroup>
35277 </informaltable>
35278 <para>
35279 See <option>shadow_transport</option> below.
35280 </para>
35281 <para>
35282 <indexterm role="option">
35283 <primary><option>shadow_transport</option></primary>
35284 </indexterm>
35285 </para>
35286 <informaltable frame="all">
35287 <tgroup cols="4" colsep="0" rowsep="0">
35288 <colspec colwidth="8*" align="left"/>
35289 <colspec colwidth="5*" align="center"/>
35290 <colspec colwidth="5*" align="center"/>
35291 <colspec colwidth="6*" align="right"/>
35292 <tbody>
35293 <row>
35294 <entry><option>shadow_transport</option></entry>
35295 <entry>Use: <emphasis>transports</emphasis></entry>
35296 <entry>Type: <emphasis>string</emphasis></entry>
35297 <entry>Default: <emphasis>unset</emphasis></entry>
35298 </row>
35299 </tbody>
35300 </tgroup>
35301 </informaltable>
35302 <para>
35303 <indexterm role="concept">
35304 <primary>shadow transport</primary>
35305 </indexterm>
35306 <indexterm role="concept">
35307 <primary>transport</primary>
35308 <secondary>shadow</secondary>
35309 </indexterm>
35310 A local transport may set the <option>shadow_transport</option> option to the name of
35311 another local transport. Shadow remote transports are not supported.
35312 </para>
35313 <para>
35314 Whenever a delivery to the main transport succeeds, and either
35315 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
35316 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
35317 passed to the shadow transport, with the same delivery address or addresses. If
35318 expansion fails, no action is taken except that non-forced expansion failures
35319 cause a log line to be written.
35320 </para>
35321 <para>
35322 The result of the shadow transport is discarded and does not affect the
35323 subsequent processing of the message. Only a single level of shadowing is
35324 provided; the <option>shadow_transport</option> option is ignored on any transport when it
35325 is running as a shadow. Options concerned with output from pipes are also
35326 ignored. The log line for the successful delivery has an item added on the end,
35327 of the form
35328 </para>
35329 <literallayout class="monospaced">
35330 ST=&lt;shadow transport name&gt;
35331 </literallayout>
35332 <para>
35333 If the shadow transport did not succeed, the error message is put in
35334 parentheses afterwards. Shadow transports can be used for a number of different
35335 purposes, including keeping more detailed log information than Exim normally
35336 provides, and implementing automatic acknowledgement policies based on message
35337 headers that some sites insist on.
35338 </para>
35339 <para>
35340 <indexterm role="option">
35341 <primary><option>transport_filter</option></primary>
35342 </indexterm>
35343 </para>
35344 <informaltable frame="all">
35345 <tgroup cols="4" colsep="0" rowsep="0">
35346 <colspec colwidth="8*" align="left"/>
35347 <colspec colwidth="5*" align="center"/>
35348 <colspec colwidth="5*" align="center"/>
35349 <colspec colwidth="6*" align="right"/>
35350 <tbody>
35351 <row>
35352 <entry><option>transport_filter</option></entry>
35353 <entry>Use: <emphasis>transports</emphasis></entry>
35354 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35355 <entry>Default: <emphasis>unset</emphasis></entry>
35356 </row>
35357 </tbody>
35358 </tgroup>
35359 </informaltable>
35360 <para>
35361 <indexterm role="concept">
35362 <primary>transport</primary>
35363 <secondary>filter</secondary>
35364 </indexterm>
35365 <indexterm role="concept">
35366 <primary>filter</primary>
35367 <secondary>transport filter</secondary>
35368 </indexterm>
35369 This option sets up a filtering (in the Unix shell sense) process for messages
35370 at transport time. It should not be confused with mail filtering as set up by
35371 individual users or via a system filter.
35372 </para>
35373 <para>
35374 When the message is about to be written out, the command specified by
35375 <option>transport_filter</option> is started up in a separate, parallel process, and
35376 the entire message, including the header lines, is passed to it on its standard
35377 input (this in fact is done from a third process, to avoid deadlock). The
35378 command must be specified as an absolute path.
35379 </para>
35380 <para>
35381 The lines of the message that are written to the transport filter are
35382 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
35383 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
35384 lines beginning with a dot, and also before any processing implied by the
35385 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
35386 <command>pipe</command> transports.
35387 </para>
35388 <para>
35389 The standard error for the filter process is set to the same destination as its
35390 standard output; this is read and written to the message&#x2019;s ultimate
35391 destination. The process that writes the message to the filter, the
35392 filter itself, and the original process that reads the result and delivers it
35393 are all run in parallel, like a shell pipeline.
35394 </para>
35395 <para>
35396 The filter can perform any transformations it likes, but of course should take
35397 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
35398 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
35399 show the possibilities. Exim does not check the result, except to test for a
35400 final newline when SMTP is in use. All messages transmitted over SMTP must end
35401 with a newline, so Exim supplies one if it is missing.
35402 </para>
35403 <para>
35404 <indexterm role="concept">
35405 <primary>content scanning</primary>
35406 <secondary>per user</secondary>
35407 </indexterm>
35408 A transport filter can be used to provide content-scanning on a per-user basis
35409 at delivery time if the only required effect of the scan is to modify the
35410 message. For example, a content scan could insert a new header line containing
35411 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
35412 not possible to discard a message at this stage.
35413 </para>
35414 <para>
35415 <indexterm role="concept">
35416 <primary>SMTP</primary>
35417 <secondary>SIZE</secondary>
35418 </indexterm>
35419 A problem might arise if the filter increases the size of a message that is
35420 being sent down an SMTP connection. If the receiving SMTP server has indicated
35421 support for the SIZE parameter, Exim will have sent the size of the message
35422 at the start of the SMTP session. If what is actually sent is substantially
35423 more, the server might reject the message. This can be worked round by setting
35424 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
35425 additions to the message, or to disable the use of SIZE altogether.
35426 </para>
35427 <para>
35428 <indexterm role="concept">
35429 <primary><varname>$pipe_addresses</varname></primary>
35430 </indexterm>
35431 The value of the <option>transport_filter</option> option is the command string for starting
35432 the filter, which is run directly from Exim, not under a shell. The string is
35433 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
35434 Exim breaks it up into arguments and then expands each argument separately (see
35435 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
35436 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
35437 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
35438 an ideal name for this feature here, but as it was already implemented for the
35439 <command>pipe</command> transport, it seemed sensible not to change it.)
35440 </para>
35441 <para>
35442 <indexterm role="concept">
35443 <primary><varname>$host</varname></primary>
35444 </indexterm>
35445 <indexterm role="concept">
35446 <primary><varname>$host_address</varname></primary>
35447 </indexterm>
35448 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
35449 transport is a remote one. They contain the name and IP address of the host to
35450 which the message is being sent. For example:
35451 </para>
35452 <literallayout class="monospaced">
35453 transport_filter = /some/directory/transport-filter.pl \
35454   $host $host_address $sender_address $pipe_addresses
35455 </literallayout>
35456 <para>
35457 Two problems arise if you want to use more complicated expansion items to
35458 generate transport filter commands, both of which due to the fact that the
35459 command is split up <emphasis>before</emphasis> expansion.
35460 </para>
35461 <itemizedlist>
35462 <listitem>
35463 <para>
35464 If an expansion item contains white space, you must quote it, so that it is all
35465 part of the same command item. If the entire option setting is one such
35466 expansion item, you have to take care what kind of quoting you use. For
35467 example:
35468 </para>
35469 <literallayout class="monospaced">
35470 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
35471 </literallayout>
35472 <para>
35473 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
35474 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
35475 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
35476 the single quotes were missing, the line would be split into two items,
35477 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
35478 Exim tried to expand the first one.
35479 </para>
35480 </listitem>
35481 <listitem>
35482 <para>
35483 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
35484 expansion cannot generate multiple arguments, or a command name followed by
35485 arguments. Consider this example:
35486 </para>
35487 <literallayout class="monospaced">
35488 transport_filter = ${lookup{$host}lsearch{/some/file}\
35489                     {$value}{/bin/cat}}
35490 </literallayout>
35491 <para>
35492 The result of the lookup is interpreted as the name of the command, even
35493 if it contains white space. The simplest way round this is to use a shell:
35494 </para>
35495 <literallayout class="monospaced">
35496 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\
35497                                {$value}{/bin/cat}}
35498 </literallayout>
35499 </listitem>
35500 </itemizedlist>
35501 <para>
35502 The filter process is run under the same uid and gid as the normal delivery.
35503 For remote deliveries this is the Exim uid/gid by default. The command should
35504 normally yield a zero return code. Transport filters are not supposed to fail.
35505 A non-zero code is taken to mean that the transport filter encountered some
35506 serious problem. Delivery of the message is deferred; the message remains on
35507 the queue and is tried again later. It is not possible to cause a message to be
35508 bounced from a transport filter.
35509 </para>
35510 <para>
35511 If a transport filter is set on an autoreply transport, the original message is
35512 passed through the filter as it is being copied into the newly generated
35513 message, which happens if the <option>return_message</option> option is set.
35514 </para>
35515 <para>
35516 <indexterm role="option">
35517 <primary><option>transport_filter_timeout</option></primary>
35518 </indexterm>
35519 </para>
35520 <informaltable frame="all">
35521 <tgroup cols="4" colsep="0" rowsep="0">
35522 <colspec colwidth="8*" align="left"/>
35523 <colspec colwidth="5*" align="center"/>
35524 <colspec colwidth="5*" align="center"/>
35525 <colspec colwidth="6*" align="right"/>
35526 <tbody>
35527 <row>
35528 <entry><option>transport_filter_timeout</option></entry>
35529 <entry>Use: <emphasis>transports</emphasis></entry>
35530 <entry>Type: <emphasis>time</emphasis></entry>
35531 <entry>Default: <emphasis>5m</emphasis></entry>
35532 </row>
35533 </tbody>
35534 </tgroup>
35535 </informaltable>
35536 <para>
35537 <indexterm role="concept">
35538 <primary>transport filter</primary>
35539 <secondary>timeout</secondary>
35540 </indexterm>
35541 When Exim is reading the output of a transport filter, it a applies a timeout
35542 that can be set by this option. Exceeding the timeout is normally treated as a
35543 temporary delivery failure. However, if a transport filter is used with a
35544 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
35545 way as a timeout in the pipe command itself. By default, a timeout is a hard
35546 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
35547 becomes a temporary error.
35548 </para>
35549 <para>
35550 <indexterm role="option">
35551 <primary><option>user</option></primary>
35552 </indexterm>
35553 </para>
35554 <informaltable frame="all">
35555 <tgroup cols="4" colsep="0" rowsep="0">
35556 <colspec colwidth="8*" align="left"/>
35557 <colspec colwidth="5*" align="center"/>
35558 <colspec colwidth="5*" align="center"/>
35559 <colspec colwidth="6*" align="right"/>
35560 <tbody>
35561 <row>
35562 <entry><option>user</option></entry>
35563 <entry>Use: <emphasis>transports</emphasis></entry>
35564 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35565 <entry>Default: <emphasis>Exim user</emphasis></entry>
35566 </row>
35567 </tbody>
35568 </tgroup>
35569 </informaltable>
35570 <para>
35571 <indexterm role="concept">
35572 <primary>uid (user id)</primary>
35573 <secondary>local delivery</secondary>
35574 </indexterm>
35575 <indexterm role="concept">
35576 <primary>transport user</primary>
35577 <secondary>specifying</secondary>
35578 </indexterm>
35579 This option specifies the user under whose uid the delivery process is to be
35580 run, overriding any uid that may have been set by the router. If the user is
35581 given as a name, the uid is looked up from the password data, and the
35582 associated group is taken as the value of the gid to be used if the <option>group</option>
35583 option is not set.
35584 </para>
35585 <para>
35586 For deliveries that use local transports, a user and group are normally
35587 specified explicitly or implicitly (for example, as a result of
35588 <option>check_local_user</option>) by the router or transport.
35589 </para>
35590 <para>
35591 <indexterm role="concept">
35592 <primary>hints database</primary>
35593 <secondary>access by remote transport</secondary>
35594 </indexterm>
35595 For remote transports, you should leave this option unset unless you really are
35596 sure you know what you are doing. When a remote transport is running, it needs
35597 to be able to access Exim&#x2019;s hints databases, because each host may have its own
35598 retry data.
35599 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
35600 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
35601 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
35602 </para>
35603 </chapter>
35604
35605 <chapter id="CHAPbatching">
35606 <title>Address batching in local transports</title>
35607 <titleabbrev>Address batching</titleabbrev>
35608 <para>
35609 <indexterm role="concept">
35610 <primary>transport</primary>
35611 <secondary>local; address batching in</secondary>
35612 </indexterm>
35613 The only remote transport (<command>smtp</command>) is normally configured to handle more than
35614 one address at a time, so that when several addresses are routed to the same
35615 remote host, just one copy of the message is sent. Local transports, however,
35616 normally handle one address at a time. That is, a separate instance of the
35617 transport is run for each address that is routed to the transport. A separate
35618 copy of the message is delivered each time.
35619 </para>
35620 <para>
35621 <indexterm role="concept">
35622 <primary>batched local delivery</primary>
35623 </indexterm>
35624 <indexterm role="concept">
35625 <primary><option>batch_max</option></primary>
35626 </indexterm>
35627 <indexterm role="concept">
35628 <primary><option>batch_id</option></primary>
35629 </indexterm>
35630 In special cases, it may be desirable to handle several addresses at once in a
35631 local transport, for example:
35632 </para>
35633 <itemizedlist>
35634 <listitem>
35635 <para>
35636 In an <command>appendfile</command> transport, when storing messages in files for later
35637 delivery by some other means, a single copy of the message with multiple
35638 recipients saves space.
35639 </para>
35640 </listitem>
35641 <listitem>
35642 <para>
35643 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
35644 a single copy saves time, and is the normal way LMTP is expected to work.
35645 </para>
35646 </listitem>
35647 <listitem>
35648 <para>
35649 In a <command>pipe</command> transport, when passing the message
35650 to a scanner program or
35651 to some other delivery mechanism such as UUCP, multiple recipients may be
35652 acceptable.
35653 </para>
35654 </listitem>
35655 </itemizedlist>
35656 <para>
35657 These three local transports all have the same options for controlling multiple
35658 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
35659 repeating the information for each transport, these options are described here.
35660 </para>
35661 <para>
35662 The <option>batch_max</option> option specifies the maximum number of addresses that can be
35663 delivered together in a single run of the transport. Its default value is one
35664 (no batching). When more than one address is routed to a transport that has a
35665 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
35666 (that is, in a single run of the transport with multiple recipients), subject
35667 to certain conditions:
35668 </para>
35669 <itemizedlist>
35670 <listitem>
35671 <para>
35672 <indexterm role="concept">
35673 <primary><varname>$local_part</varname></primary>
35674 </indexterm>
35675 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
35676 batching is possible.
35677 </para>
35678 </listitem>
35679 <listitem>
35680 <para>
35681 <indexterm role="concept">
35682 <primary><varname>$domain</varname></primary>
35683 </indexterm>
35684 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
35685 addresses with the same domain are batched.
35686 </para>
35687 </listitem>
35688 <listitem>
35689 <para>
35690 <indexterm role="concept">
35691 <primary>customizing</primary>
35692 <secondary>batching condition</secondary>
35693 </indexterm>
35694 If <option>batch_id</option> is set, it is expanded for each address, and only those
35695 addresses with the same expanded value are batched. This allows you to specify
35696 customized batching conditions. Failure of the expansion for any reason,
35697 including forced failure, disables batching, but it does not stop the delivery
35698 from taking place.
35699 </para>
35700 </listitem>
35701 <listitem>
35702 <para>
35703 Batched addresses must also have the same errors address (where to send
35704 delivery errors), the same header additions and removals, the same user and
35705 group for the transport, and if a host list is present, the first host must
35706 be the same.
35707 </para>
35708 </listitem>
35709 </itemizedlist>
35710 <para>
35711 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
35712 both when the file or pipe command is specified in the transport, and when it
35713 is specified by a <command>redirect</command> router, but all the batched addresses must of
35714 course be routed to the same file or pipe command. These two transports have an
35715 option called <option>use_bsmtp</option>, which causes them to deliver the message in
35716 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
35717 <option>check_string</option> and <option>escape_string</option> options are forced to the values
35718 </para>
35719 <literallayout class="monospaced">
35720 check_string = "."
35721 escape_string = ".."
35722 </literallayout>
35723 <para>
35724 when batched SMTP is in use. A full description of the batch SMTP mechanism is
35725 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
35726 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
35727 </para>
35728 <para>
35729 <indexterm role="concept">
35730 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35731 </indexterm>
35732 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
35733 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
35734 that are being processed together. If you are using a batching <command>appendfile</command>
35735 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
35736 addresses is to set the <option>envelope_to_add</option> option.
35737 </para>
35738 <para>
35739 <indexterm role="concept">
35740 <primary><command>pipe</command> transport</primary>
35741 <secondary>with multiple addresses</secondary>
35742 </indexterm>
35743 <indexterm role="concept">
35744 <primary><varname>$pipe_addresses</varname></primary>
35745 </indexterm>
35746 If you are using a <command>pipe</command> transport without BSMTP, and setting the
35747 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
35748 the command. This is not a true variable; it is a bit of magic that causes each
35749 of the recipient addresses to be inserted into the command as a separate
35750 argument. This provides a way of accessing all the addresses that are being
35751 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
35752 are specififed by a <command>redirect</command> router.
35753 </para>
35754 </chapter>
35755
35756 <chapter id="CHAPappendfile">
35757 <title>The appendfile transport</title>
35758 <para>
35759 <indexterm role="concept" id="IIDapptra1" class="startofrange">
35760 <primary><command>appendfile</command> transport</primary>
35761 </indexterm>
35762 <indexterm role="concept" id="IIDapptra2" class="startofrange">
35763 <primary>transports</primary>
35764 <secondary><command>appendfile</command></secondary>
35765 </indexterm>
35766 <indexterm role="concept">
35767 <primary>directory creation</primary>
35768 </indexterm>
35769 <indexterm role="concept">
35770 <primary>creating directories</primary>
35771 </indexterm>
35772 The <command>appendfile</command> transport delivers a message by appending it to an existing
35773 file, or by creating an entirely new file in a specified directory. Single
35774 files to which messages are appended can be in the traditional Unix mailbox
35775 format, or optionally in the MBX format supported by the Pine MUA and
35776 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
35777 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
35778 to give added protection against failures that happen part-way through the
35779 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
35780 supported. For all file formats, Exim attempts to create as many levels of
35781 directory as necessary, provided that <option>create_directory</option> is set.
35782 </para>
35783 <para>
35784 The code for the optional formats is not included in the Exim binary by
35785 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
35786 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
35787 included.
35788 </para>
35789 <para>
35790 <indexterm role="concept">
35791 <primary>quota</primary>
35792 <secondary>system</secondary>
35793 </indexterm>
35794 Exim recognises system quota errors, and generates an appropriate message. Exim
35795 also supports its own quota control within the transport, for use when the
35796 system facility is unavailable or cannot be used for some reason.
35797 </para>
35798 <para>
35799 If there is an error while appending to a file (for example, quota exceeded or
35800 partition filled), Exim attempts to reset the file&#x2019;s length and last
35801 modification time back to what they were before. If there is an error while
35802 creating an entirely new file, the new file is removed.
35803 </para>
35804 <para>
35805 Before appending to a file, a number of security checks are made, and the
35806 file is locked. A detailed description is given below, after the list of
35807 private options.
35808 </para>
35809 <para>
35810 The <command>appendfile</command> transport is most commonly used for local deliveries to
35811 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
35812 putting messages into files for remote delivery by some means other than Exim.
35813 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
35814 option).
35815 </para>
35816 <section id="SECTfildiropt">
35817 <title>The file and directory options</title>
35818 <para>
35819 The <option>file</option> option specifies a single file, to which the message is appended;
35820 the <option>directory</option> option specifies a directory, in which a new file containing
35821 the message is created. Only one of these two options can be set, and for
35822 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
35823 </para>
35824 <para>
35825 <indexterm role="concept">
35826 <primary><varname>$address_file</varname></primary>
35827 </indexterm>
35828 <indexterm role="concept">
35829 <primary><varname>$local_part</varname></primary>
35830 </indexterm>
35831 However, <command>appendfile</command> is also used for delivering messages to files or
35832 directories whose names (or parts of names) are obtained from alias,
35833 forwarding, or filtering operations (for example, a <option>save</option> command in a
35834 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
35835 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
35836 name (or partial name) of the file or directory generated by the redirection
35837 operation. There are two cases:
35838 </para>
35839 <itemizedlist>
35840 <listitem>
35841 <para>
35842 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
35843 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
35844 common case when users with local accounts use filtering to sort mail into
35845 different folders. See for example, the <command>address_file</command> transport in the
35846 default configuration. If the path ends with a slash, it is assumed to be the
35847 name of a directory. A delivery to a directory can also be forced by setting
35848 <option>maildir_format</option> or <option>mailstore_format</option>.
35849 </para>
35850 </listitem>
35851 <listitem>
35852 <para>
35853 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
35854 used to determine the file or directory name for the delivery. Normally, the
35855 contents of <varname>$address_file</varname> are used in some way in the string expansion.
35856 </para>
35857 </listitem>
35858 </itemizedlist>
35859 <para>
35860 <indexterm role="concept">
35861 <primary>Sieve filter</primary>
35862 <secondary>configuring <command>appendfile</command></secondary>
35863 </indexterm>
35864 <indexterm role="concept">
35865 <primary>Sieve filter</primary>
35866 <secondary>relative mailbox path handling</secondary>
35867 </indexterm>
35868 As an example of the second case, consider an environment where users do not
35869 have home directories. They may be permitted to use Exim filter commands of the
35870 form:
35871 </para>
35872 <literallayout class="monospaced">
35873 save folder23
35874 </literallayout>
35875 <para>
35876 or Sieve filter commands of the form:
35877 </para>
35878 <literallayout class="monospaced">
35879 require "fileinto";
35880 fileinto "folder23";
35881 </literallayout>
35882 <para>
35883 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
35884 must transform the relative path into an appropriate absolute file name. In the
35885 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
35886 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
35887 way of handling this requirement:
35888 </para>
35889 <literallayout class="monospaced">
35890 file = ${if eq{$address_file}{inbox} \
35891             {/var/mail/$local_part} \
35892             {${if eq{${substr_0_1:$address_file}}{/} \
35893                   {$address_file} \
35894                   {$home/mail/$address_file} \
35895             }} \
35896        }
35897 </literallayout>
35898 <para>
35899 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
35900 location, absolute paths are used without change, and other folders are in the
35901 <filename>mail</filename> directory within the home directory.
35902 </para>
35903 <para>
35904 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
35905 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
35906 the router. In particular, this is the case if <option>check_local_user</option> is set. If
35907 you want to prevent this happening at routing time, you can set
35908 <option>router_home_directory</option> empty. This forces the router to pass the relative
35909 path to the transport.
35910 </para>
35911 <para>
35912 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
35913 the <option>file</option> or <option>directory</option> option is still used if it is set.
35914 </para>
35915 </section>
35916 <section>
35917 <title>Private options for appendfile</title>
35918 <para>
35919 <indexterm role="concept">
35920 <primary>options</primary>
35921 <secondary><command>appendfile</command> transport</secondary>
35922 </indexterm>
35923 </para>
35924 <para>
35925 <indexterm role="option">
35926 <primary><option>allow_fifo</option></primary>
35927 </indexterm>
35928 </para>
35929 <informaltable frame="all">
35930 <tgroup cols="4" colsep="0" rowsep="0">
35931 <colspec colwidth="8*" align="left"/>
35932 <colspec colwidth="5*" align="center"/>
35933 <colspec colwidth="5*" align="center"/>
35934 <colspec colwidth="6*" align="right"/>
35935 <tbody>
35936 <row>
35937 <entry><option>allow_fifo</option></entry>
35938 <entry>Use: <emphasis>appendfile</emphasis></entry>
35939 <entry>Type: <emphasis>boolean</emphasis></entry>
35940 <entry>Default: <emphasis>false</emphasis></entry>
35941 </row>
35942 </tbody>
35943 </tgroup>
35944 </informaltable>
35945 <para>
35946 <indexterm role="concept">
35947 <primary>fifo (named pipe)</primary>
35948 </indexterm>
35949 <indexterm role="concept">
35950 <primary>named pipe (fifo)</primary>
35951 </indexterm>
35952 <indexterm role="concept">
35953 <primary>pipe</primary>
35954 <secondary>named (fifo)</secondary>
35955 </indexterm>
35956 Setting this option permits delivery to named pipes (FIFOs) as well as to
35957 regular files. If no process is reading the named pipe at delivery time, the
35958 delivery is deferred.
35959 </para>
35960 <para>
35961 <indexterm role="option">
35962 <primary><option>allow_symlink</option></primary>
35963 </indexterm>
35964 </para>
35965 <informaltable frame="all">
35966 <tgroup cols="4" colsep="0" rowsep="0">
35967 <colspec colwidth="8*" align="left"/>
35968 <colspec colwidth="5*" align="center"/>
35969 <colspec colwidth="5*" align="center"/>
35970 <colspec colwidth="6*" align="right"/>
35971 <tbody>
35972 <row>
35973 <entry><option>allow_symlink</option></entry>
35974 <entry>Use: <emphasis>appendfile</emphasis></entry>
35975 <entry>Type: <emphasis>boolean</emphasis></entry>
35976 <entry>Default: <emphasis>false</emphasis></entry>
35977 </row>
35978 </tbody>
35979 </tgroup>
35980 </informaltable>
35981 <para>
35982 <indexterm role="concept">
35983 <primary>symbolic link</primary>
35984 <secondary>to mailbox</secondary>
35985 </indexterm>
35986 <indexterm role="concept">
35987 <primary>mailbox</primary>
35988 <secondary>symbolic link</secondary>
35989 </indexterm>
35990 By default, <command>appendfile</command> will not deliver if the path name for the file is
35991 that of a symbolic link. Setting this option relaxes that constraint, but there
35992 are security issues involved in the use of symbolic links. Be sure you know
35993 what you are doing if you set this. Details of exactly what this option affects
35994 are included in the discussion which follows this list of options.
35995 </para>
35996 <para>
35997 <indexterm role="option">
35998 <primary><option>batch_id</option></primary>
35999 </indexterm>
36000 </para>
36001 <informaltable frame="all">
36002 <tgroup cols="4" colsep="0" rowsep="0">
36003 <colspec colwidth="8*" align="left"/>
36004 <colspec colwidth="5*" align="center"/>
36005 <colspec colwidth="5*" align="center"/>
36006 <colspec colwidth="6*" align="right"/>
36007 <tbody>
36008 <row>
36009 <entry><option>batch_id</option></entry>
36010 <entry>Use: <emphasis>appendfile</emphasis></entry>
36011 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36012 <entry>Default: <emphasis>unset</emphasis></entry>
36013 </row>
36014 </tbody>
36015 </tgroup>
36016 </informaltable>
36017 <para>
36018 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36019 However, batching is automatically disabled for <command>appendfile</command> deliveries that
36020 happen as a result of forwarding or aliasing or other redirection directly to a
36021 file.
36022 </para>
36023 <para>
36024 <indexterm role="option">
36025 <primary><option>batch_max</option></primary>
36026 </indexterm>
36027 </para>
36028 <informaltable frame="all">
36029 <tgroup cols="4" colsep="0" rowsep="0">
36030 <colspec colwidth="8*" align="left"/>
36031 <colspec colwidth="5*" align="center"/>
36032 <colspec colwidth="5*" align="center"/>
36033 <colspec colwidth="6*" align="right"/>
36034 <tbody>
36035 <row>
36036 <entry><option>batch_max</option></entry>
36037 <entry>Use: <emphasis>appendfile</emphasis></entry>
36038 <entry>Type: <emphasis>integer</emphasis></entry>
36039 <entry>Default: <emphasis>1</emphasis></entry>
36040 </row>
36041 </tbody>
36042 </tgroup>
36043 </informaltable>
36044 <para>
36045 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
36046 </para>
36047 <para>
36048 <indexterm role="option">
36049 <primary><option>check_group</option></primary>
36050 </indexterm>
36051 </para>
36052 <informaltable frame="all">
36053 <tgroup cols="4" colsep="0" rowsep="0">
36054 <colspec colwidth="8*" align="left"/>
36055 <colspec colwidth="5*" align="center"/>
36056 <colspec colwidth="5*" align="center"/>
36057 <colspec colwidth="6*" align="right"/>
36058 <tbody>
36059 <row>
36060 <entry><option>check_group</option></entry>
36061 <entry>Use: <emphasis>appendfile</emphasis></entry>
36062 <entry>Type: <emphasis>boolean</emphasis></entry>
36063 <entry>Default: <emphasis>false</emphasis></entry>
36064 </row>
36065 </tbody>
36066 </tgroup>
36067 </informaltable>
36068 <para>
36069 When this option is set, the group owner of the file defined by the <option>file</option>
36070 option is checked to see that it is the same as the group under which the
36071 delivery process is running. The default setting is false because the default
36072 file mode is 0600, which means that the group is irrelevant.
36073 </para>
36074 <para>
36075 <indexterm role="option">
36076 <primary><option>check_owner</option></primary>
36077 </indexterm>
36078 </para>
36079 <informaltable frame="all">
36080 <tgroup cols="4" colsep="0" rowsep="0">
36081 <colspec colwidth="8*" align="left"/>
36082 <colspec colwidth="5*" align="center"/>
36083 <colspec colwidth="5*" align="center"/>
36084 <colspec colwidth="6*" align="right"/>
36085 <tbody>
36086 <row>
36087 <entry><option>check_owner</option></entry>
36088 <entry>Use: <emphasis>appendfile</emphasis></entry>
36089 <entry>Type: <emphasis>boolean</emphasis></entry>
36090 <entry>Default: <emphasis>true</emphasis></entry>
36091 </row>
36092 </tbody>
36093 </tgroup>
36094 </informaltable>
36095 <para>
36096 When this option is set, the owner of the file defined by the <option>file</option> option
36097 is checked to ensure that it is the same as the user under which the delivery
36098 process is running.
36099 </para>
36100 <para>
36101 <indexterm role="option">
36102 <primary><option>check_string</option></primary>
36103 </indexterm>
36104 </para>
36105 <informaltable frame="all">
36106 <tgroup cols="4" colsep="0" rowsep="0">
36107 <colspec colwidth="8*" align="left"/>
36108 <colspec colwidth="5*" align="center"/>
36109 <colspec colwidth="5*" align="center"/>
36110 <colspec colwidth="6*" align="right"/>
36111 <tbody>
36112 <row>
36113 <entry><option>check_string</option></entry>
36114 <entry>Use: <emphasis>appendfile</emphasis></entry>
36115 <entry>Type: <emphasis>string</emphasis></entry>
36116 <entry>Default: <emphasis>see below</emphasis></entry>
36117 </row>
36118 </tbody>
36119 </tgroup>
36120 </informaltable>
36121 <para>
36122 <indexterm role="concept">
36123 <primary><quote>From</quote> line</primary>
36124 </indexterm>
36125 As <command>appendfile</command> writes the message, the start of each line is tested for
36126 matching <option>check_string</option>, and if it does, the initial matching characters are
36127 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
36128 a literal string, not a regular expression, and the case of any letters it
36129 contains is significant.
36130 </para>
36131 <para>
36132 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
36133 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
36134 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
36135 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
36136 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
36137 </para>
36138 <para>
36139 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
36140 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
36141 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
36142 if another format is used. For example, to deliver to mailboxes in MMDF format:
36143 <indexterm role="concept">
36144 <primary>MMDF format mailbox</primary>
36145 </indexterm>
36146 <indexterm role="concept">
36147 <primary>mailbox</primary>
36148 <secondary>MMDF format</secondary>
36149 </indexterm>
36150 </para>
36151 <literallayout class="monospaced">
36152 check_string = "\1\1\1\1\n"
36153 escape_string = "\1\1\1\1 \n"
36154 message_prefix = "\1\1\1\1\n"
36155 message_suffix = "\1\1\1\1\n"
36156 </literallayout>
36157 <para>
36158 <indexterm role="option">
36159 <primary><option>create_directory</option></primary>
36160 </indexterm>
36161 </para>
36162 <informaltable frame="all">
36163 <tgroup cols="4" colsep="0" rowsep="0">
36164 <colspec colwidth="8*" align="left"/>
36165 <colspec colwidth="5*" align="center"/>
36166 <colspec colwidth="5*" align="center"/>
36167 <colspec colwidth="6*" align="right"/>
36168 <tbody>
36169 <row>
36170 <entry><option>create_directory</option></entry>
36171 <entry>Use: <emphasis>appendfile</emphasis></entry>
36172 <entry>Type: <emphasis>boolean</emphasis></entry>
36173 <entry>Default: <emphasis>true</emphasis></entry>
36174 </row>
36175 </tbody>
36176 </tgroup>
36177 </informaltable>
36178 <para>
36179 <indexterm role="concept">
36180 <primary>directory creation</primary>
36181 </indexterm>
36182 When this option is true, Exim attempts to create any missing superior
36183 directories for the file that it is about to write. A created directory&#x2019;s mode
36184 is given by the <option>directory_mode</option> option.
36185 </para>
36186 <para>
36187 The group ownership of a newly created directory is highly dependent on the
36188 operating system (and possibly the file system) that is being used. For
36189 example, in Solaris, if the parent directory has the setgid bit set, its group
36190 is propagated to the child; if not, the currently set group is used. However,
36191 in FreeBSD, the parent&#x2019;s group is always used.
36192 </para>
36193 <para>
36194 <indexterm role="option">
36195 <primary><option>create_file</option></primary>
36196 </indexterm>
36197 </para>
36198 <informaltable frame="all">
36199 <tgroup cols="4" colsep="0" rowsep="0">
36200 <colspec colwidth="8*" align="left"/>
36201 <colspec colwidth="5*" align="center"/>
36202 <colspec colwidth="5*" align="center"/>
36203 <colspec colwidth="6*" align="right"/>
36204 <tbody>
36205 <row>
36206 <entry><option>create_file</option></entry>
36207 <entry>Use: <emphasis>appendfile</emphasis></entry>
36208 <entry>Type: <emphasis>string</emphasis></entry>
36209 <entry>Default: <emphasis>anywhere</emphasis></entry>
36210 </row>
36211 </tbody>
36212 </tgroup>
36213 </informaltable>
36214 <para>
36215 This option constrains the location of files and directories that are created
36216 by this transport. It applies to files defined by the <option>file</option> option and
36217 directories defined by the <option>directory</option> option. In the case of maildir
36218 delivery, it applies to the top level directory, not the maildir directories
36219 beneath.
36220 </para>
36221 <para>
36222 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
36223 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
36224 set for the transport. This option is not useful when an explicit file name is
36225 given for normal mailbox deliveries. It is intended for the case when file
36226 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
36227 by an <command>appendfile</command> transport called <option>address_file</option>. See also
36228 <option>file_must_exist</option>.
36229 </para>
36230 <para>
36231 <indexterm role="option">
36232 <primary><option>directory</option></primary>
36233 </indexterm>
36234 </para>
36235 <informaltable frame="all">
36236 <tgroup cols="4" colsep="0" rowsep="0">
36237 <colspec colwidth="8*" align="left"/>
36238 <colspec colwidth="5*" align="center"/>
36239 <colspec colwidth="5*" align="center"/>
36240 <colspec colwidth="6*" align="right"/>
36241 <tbody>
36242 <row>
36243 <entry><option>directory</option></entry>
36244 <entry>Use: <emphasis>appendfile</emphasis></entry>
36245 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36246 <entry>Default: <emphasis>unset</emphasis></entry>
36247 </row>
36248 </tbody>
36249 </tgroup>
36250 </informaltable>
36251 <para>
36252 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
36253 or <option>directory</option> must be set, unless the delivery is the direct result of a
36254 redirection (see section <xref linkend="SECTfildiropt"/>).
36255 </para>
36256 <para>
36257 When <option>directory</option> is set, the string is expanded, and the message is delivered
36258 into a new file or files in or below the given directory, instead of being
36259 appended to a single mailbox file. A number of different formats are provided
36260 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
36261 <xref linkend="SECTopdir"/> for further details of this form of delivery.
36262 </para>
36263 <para>
36264 <indexterm role="option">
36265 <primary><option>directory_file</option></primary>
36266 </indexterm>
36267 </para>
36268 <informaltable frame="all">
36269 <tgroup cols="4" colsep="0" rowsep="0">
36270 <colspec colwidth="8*" align="left"/>
36271 <colspec colwidth="5*" align="center"/>
36272 <colspec colwidth="5*" align="center"/>
36273 <colspec colwidth="6*" align="right"/>
36274 <tbody>
36275 <row>
36276 <entry><option>directory_file</option></entry>
36277 <entry>Use: <emphasis>appendfile</emphasis></entry>
36278 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36279 <entry>Default: <emphasis><literal>q${base62:$tod_epoch}-$inode</literal></emphasis></entry>
36280 </row>
36281 </tbody>
36282 </tgroup>
36283 </informaltable>
36284 <para>
36285 <indexterm role="concept">
36286 <primary>base62</primary>
36287 </indexterm>
36288 <indexterm role="concept">
36289 <primary><varname>$inode</varname></primary>
36290 </indexterm>
36291 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
36292 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
36293 whose name is obtained by expanding this string. The default value generates a
36294 unique name from the current time, in base 62 form, and the inode of the file.
36295 The variable <varname>$inode</varname> is available only when expanding this option.
36296 </para>
36297 <para>
36298 <indexterm role="option">
36299 <primary><option>directory_mode</option></primary>
36300 </indexterm>
36301 </para>
36302 <informaltable frame="all">
36303 <tgroup cols="4" colsep="0" rowsep="0">
36304 <colspec colwidth="8*" align="left"/>
36305 <colspec colwidth="5*" align="center"/>
36306 <colspec colwidth="5*" align="center"/>
36307 <colspec colwidth="6*" align="right"/>
36308 <tbody>
36309 <row>
36310 <entry><option>directory_mode</option></entry>
36311 <entry>Use: <emphasis>appendfile</emphasis></entry>
36312 <entry>Type: <emphasis>octal integer</emphasis></entry>
36313 <entry>Default: <emphasis>0700</emphasis></entry>
36314 </row>
36315 </tbody>
36316 </tgroup>
36317 </informaltable>
36318 <para>
36319 If <command>appendfile</command> creates any directories as a result of the
36320 <option>create_directory</option> option, their mode is specified by this option.
36321 </para>
36322 <para>
36323 <indexterm role="option">
36324 <primary><option>escape_string</option></primary>
36325 </indexterm>
36326 </para>
36327 <informaltable frame="all">
36328 <tgroup cols="4" colsep="0" rowsep="0">
36329 <colspec colwidth="8*" align="left"/>
36330 <colspec colwidth="5*" align="center"/>
36331 <colspec colwidth="5*" align="center"/>
36332 <colspec colwidth="6*" align="right"/>
36333 <tbody>
36334 <row>
36335 <entry><option>escape_string</option></entry>
36336 <entry>Use: <emphasis>appendfile</emphasis></entry>
36337 <entry>Type: <emphasis>string</emphasis></entry>
36338 <entry>Default: <emphasis>see description</emphasis></entry>
36339 </row>
36340 </tbody>
36341 </tgroup>
36342 </informaltable>
36343 <para>
36344 See <option>check_string</option> above.
36345 </para>
36346 <para>
36347 <indexterm role="option">
36348 <primary><option>file</option></primary>
36349 </indexterm>
36350 </para>
36351 <informaltable frame="all">
36352 <tgroup cols="4" colsep="0" rowsep="0">
36353 <colspec colwidth="8*" align="left"/>
36354 <colspec colwidth="5*" align="center"/>
36355 <colspec colwidth="5*" align="center"/>
36356 <colspec colwidth="6*" align="right"/>
36357 <tbody>
36358 <row>
36359 <entry><option>file</option></entry>
36360 <entry>Use: <emphasis>appendfile</emphasis></entry>
36361 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36362 <entry>Default: <emphasis>unset</emphasis></entry>
36363 </row>
36364 </tbody>
36365 </tgroup>
36366 </informaltable>
36367 <para>
36368 This option is mutually exclusive with the <option>directory</option> option, but one of
36369 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
36370 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
36371 specifies a single file, to which the message is appended. One or more of
36372 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
36373 <option>file</option>.
36374 </para>
36375 <para>
36376 <indexterm role="concept">
36377 <primary>NFS</primary>
36378 <secondary>lock file</secondary>
36379 </indexterm>
36380 <indexterm role="concept">
36381 <primary>locking files</primary>
36382 </indexterm>
36383 <indexterm role="concept">
36384 <primary>lock files</primary>
36385 </indexterm>
36386 If you are using more than one host to deliver over NFS into the same
36387 mailboxes, you should always use lock files.
36388 </para>
36389 <para>
36390 The string value is expanded for each delivery, and must yield an absolute
36391 path. The most common settings of this option are variations on one of these
36392 examples:
36393 </para>
36394 <literallayout class="monospaced">
36395 file = /var/spool/mail/$local_part
36396 file = /home/$local_part/inbox
36397 file = $home/inbox
36398 </literallayout>
36399 <para>
36400 <indexterm role="concept">
36401 <primary><quote>sticky</quote> bit</primary>
36402 </indexterm>
36403 In the first example, all deliveries are done into the same directory. If Exim
36404 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
36405 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
36406 deliveries to be possible, or alternatively the <option>group</option> option can be used to
36407 run the delivery under a group id which has write access to the directory.
36408 </para>
36409 <para>
36410 <indexterm role="option">
36411 <primary><option>file_format</option></primary>
36412 </indexterm>
36413 </para>
36414 <informaltable frame="all">
36415 <tgroup cols="4" colsep="0" rowsep="0">
36416 <colspec colwidth="8*" align="left"/>
36417 <colspec colwidth="5*" align="center"/>
36418 <colspec colwidth="5*" align="center"/>
36419 <colspec colwidth="6*" align="right"/>
36420 <tbody>
36421 <row>
36422 <entry><option>file_format</option></entry>
36423 <entry>Use: <emphasis>appendfile</emphasis></entry>
36424 <entry>Type: <emphasis>string</emphasis></entry>
36425 <entry>Default: <emphasis>unset</emphasis></entry>
36426 </row>
36427 </tbody>
36428 </tgroup>
36429 </informaltable>
36430 <para>
36431 <indexterm role="concept">
36432 <primary>file</primary>
36433 <secondary>mailbox; checking existing format</secondary>
36434 </indexterm>
36435 This option requests the transport to check the format of an existing file
36436 before adding to it. The check consists of matching a specific string at the
36437 start of the file. The value of the option consists of an even number of
36438 colon-separated strings. The first of each pair is the test string, and the
36439 second is the name of a transport. If the transport associated with a matched
36440 string is not the current transport, control is passed over to the other
36441 transport. For example, suppose the standard <command>local_delivery</command> transport has
36442 this added to it:
36443 </para>
36444 <literallayout class="monospaced">
36445 file_format = "From       : local_delivery :\
36446                \1\1\1\1\n : local_mmdf_delivery"
36447 </literallayout>
36448 <para>
36449 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
36450 a mailbox begins with four binary ones followed by a newline, control is passed
36451 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
36452 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
36453 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
36454 match any string, or if the transport named for a given string is not defined,
36455 delivery is deferred.
36456 </para>
36457 <para>
36458 <indexterm role="option">
36459 <primary><option>file_must_exist</option></primary>
36460 </indexterm>
36461 </para>
36462 <informaltable frame="all">
36463 <tgroup cols="4" colsep="0" rowsep="0">
36464 <colspec colwidth="8*" align="left"/>
36465 <colspec colwidth="5*" align="center"/>
36466 <colspec colwidth="5*" align="center"/>
36467 <colspec colwidth="6*" align="right"/>
36468 <tbody>
36469 <row>
36470 <entry><option>file_must_exist</option></entry>
36471 <entry>Use: <emphasis>appendfile</emphasis></entry>
36472 <entry>Type: <emphasis>boolean</emphasis></entry>
36473 <entry>Default: <emphasis>false</emphasis></entry>
36474 </row>
36475 </tbody>
36476 </tgroup>
36477 </informaltable>
36478 <para>
36479 If this option is true, the file specified by the <option>file</option> option must exist.
36480 A temporary error occurs if it does not, causing delivery to be deferred.
36481 If this option is false, the file is created if it does not exist.
36482 </para>
36483 <para>
36484 <indexterm role="option">
36485 <primary><option>lock_fcntl_timeout</option></primary>
36486 </indexterm>
36487 </para>
36488 <informaltable frame="all">
36489 <tgroup cols="4" colsep="0" rowsep="0">
36490 <colspec colwidth="8*" align="left"/>
36491 <colspec colwidth="5*" align="center"/>
36492 <colspec colwidth="5*" align="center"/>
36493 <colspec colwidth="6*" align="right"/>
36494 <tbody>
36495 <row>
36496 <entry><option>lock_fcntl_timeout</option></entry>
36497 <entry>Use: <emphasis>appendfile</emphasis></entry>
36498 <entry>Type: <emphasis>time</emphasis></entry>
36499 <entry>Default: <emphasis>0s</emphasis></entry>
36500 </row>
36501 </tbody>
36502 </tgroup>
36503 </informaltable>
36504 <para>
36505 <indexterm role="concept">
36506 <primary>timeout</primary>
36507 <secondary>mailbox locking</secondary>
36508 </indexterm>
36509 <indexterm role="concept">
36510 <primary>mailbox locking</primary>
36511 <secondary>blocking and non-blocking</secondary>
36512 </indexterm>
36513 <indexterm role="concept">
36514 <primary>locking files</primary>
36515 </indexterm>
36516 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
36517 when locking an open mailbox file. If the call fails, the delivery process
36518 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
36519 Non-blocking calls are used so that the file is not kept open during the wait
36520 for the lock; the reason for this is to make it as safe as possible for
36521 deliveries over NFS in the case when processes might be accessing an NFS
36522 mailbox without using a lock file. This should not be done, but
36523 misunderstandings and hence misconfigurations are not unknown.
36524 </para>
36525 <para>
36526 On a busy system, however, the performance of a non-blocking lock approach is
36527 not as good as using a blocking lock with a timeout. In this case, the waiting
36528 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
36529 and can proceed as soon as the previous lock holder releases it.
36530 </para>
36531 <para>
36532 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
36533 timeout, are used. There may still be some retrying: the maximum number of
36534 retries is
36535 </para>
36536 <literallayout class="monospaced">
36537 (lock_retries * lock_interval) / lock_fcntl_timeout
36538 </literallayout>
36539 <para>
36540 rounded up to the next whole number. In other words, the total time during
36541 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
36542 <option>lock_fcntl_timeout</option> is set very large.
36543 </para>
36544 <para>
36545 You should consider setting this option if you are getting a lot of delayed
36546 local deliveries because of errors of the form
36547 </para>
36548 <literallayout class="monospaced">
36549 failed to lock mailbox /some/file (fcntl)
36550 </literallayout>
36551 <para>
36552 <indexterm role="option">
36553 <primary><option>lock_flock_timeout</option></primary>
36554 </indexterm>
36555 </para>
36556 <informaltable frame="all">
36557 <tgroup cols="4" colsep="0" rowsep="0">
36558 <colspec colwidth="8*" align="left"/>
36559 <colspec colwidth="5*" align="center"/>
36560 <colspec colwidth="5*" align="center"/>
36561 <colspec colwidth="6*" align="right"/>
36562 <tbody>
36563 <row>
36564 <entry><option>lock_flock_timeout</option></entry>
36565 <entry>Use: <emphasis>appendfile</emphasis></entry>
36566 <entry>Type: <emphasis>time</emphasis></entry>
36567 <entry>Default: <emphasis>0s</emphasis></entry>
36568 </row>
36569 </tbody>
36570 </tgroup>
36571 </informaltable>
36572 <para>
36573 This timeout applies to file locking when using <function>flock()</function> (see
36574 <option>use_flock</option>); the timeout operates in a similar manner to
36575 <option>lock_fcntl_timeout</option>.
36576 </para>
36577 <para>
36578 <indexterm role="option">
36579 <primary><option>lock_interval</option></primary>
36580 </indexterm>
36581 </para>
36582 <informaltable frame="all">
36583 <tgroup cols="4" colsep="0" rowsep="0">
36584 <colspec colwidth="8*" align="left"/>
36585 <colspec colwidth="5*" align="center"/>
36586 <colspec colwidth="5*" align="center"/>
36587 <colspec colwidth="6*" align="right"/>
36588 <tbody>
36589 <row>
36590 <entry><option>lock_interval</option></entry>
36591 <entry>Use: <emphasis>appendfile</emphasis></entry>
36592 <entry>Type: <emphasis>time</emphasis></entry>
36593 <entry>Default: <emphasis>3s</emphasis></entry>
36594 </row>
36595 </tbody>
36596 </tgroup>
36597 </informaltable>
36598 <para>
36599 This specifies the time to wait between attempts to lock the file. See below
36600 for details of locking.
36601 </para>
36602 <para>
36603 <indexterm role="option">
36604 <primary><option>lock_retries</option></primary>
36605 </indexterm>
36606 </para>
36607 <informaltable frame="all">
36608 <tgroup cols="4" colsep="0" rowsep="0">
36609 <colspec colwidth="8*" align="left"/>
36610 <colspec colwidth="5*" align="center"/>
36611 <colspec colwidth="5*" align="center"/>
36612 <colspec colwidth="6*" align="right"/>
36613 <tbody>
36614 <row>
36615 <entry><option>lock_retries</option></entry>
36616 <entry>Use: <emphasis>appendfile</emphasis></entry>
36617 <entry>Type: <emphasis>integer</emphasis></entry>
36618 <entry>Default: <emphasis>10</emphasis></entry>
36619 </row>
36620 </tbody>
36621 </tgroup>
36622 </informaltable>
36623 <para>
36624 This specifies the maximum number of attempts to lock the file. A value of zero
36625 is treated as 1. See below for details of locking.
36626 </para>
36627 <para>
36628 <indexterm role="option">
36629 <primary><option>lockfile_mode</option></primary>
36630 </indexterm>
36631 </para>
36632 <informaltable frame="all">
36633 <tgroup cols="4" colsep="0" rowsep="0">
36634 <colspec colwidth="8*" align="left"/>
36635 <colspec colwidth="5*" align="center"/>
36636 <colspec colwidth="5*" align="center"/>
36637 <colspec colwidth="6*" align="right"/>
36638 <tbody>
36639 <row>
36640 <entry><option>lockfile_mode</option></entry>
36641 <entry>Use: <emphasis>appendfile</emphasis></entry>
36642 <entry>Type: <emphasis>octal integer</emphasis></entry>
36643 <entry>Default: <emphasis>0600</emphasis></entry>
36644 </row>
36645 </tbody>
36646 </tgroup>
36647 </informaltable>
36648 <para>
36649 This specifies the mode of the created lock file, when a lock file is being
36650 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
36651 </para>
36652 <para>
36653 <indexterm role="option">
36654 <primary><option>lockfile_timeout</option></primary>
36655 </indexterm>
36656 </para>
36657 <informaltable frame="all">
36658 <tgroup cols="4" colsep="0" rowsep="0">
36659 <colspec colwidth="8*" align="left"/>
36660 <colspec colwidth="5*" align="center"/>
36661 <colspec colwidth="5*" align="center"/>
36662 <colspec colwidth="6*" align="right"/>
36663 <tbody>
36664 <row>
36665 <entry><option>lockfile_timeout</option></entry>
36666 <entry>Use: <emphasis>appendfile</emphasis></entry>
36667 <entry>Type: <emphasis>time</emphasis></entry>
36668 <entry>Default: <emphasis>30m</emphasis></entry>
36669 </row>
36670 </tbody>
36671 </tgroup>
36672 </informaltable>
36673 <para>
36674 <indexterm role="concept">
36675 <primary>timeout</primary>
36676 <secondary>mailbox locking</secondary>
36677 </indexterm>
36678 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
36679 exists and is older than this value, it is assumed to have been left behind by
36680 accident, and Exim attempts to remove it.
36681 </para>
36682 <para>
36683 <indexterm role="option">
36684 <primary><option>mailbox_filecount</option></primary>
36685 </indexterm>
36686 </para>
36687 <informaltable frame="all">
36688 <tgroup cols="4" colsep="0" rowsep="0">
36689 <colspec colwidth="8*" align="left"/>
36690 <colspec colwidth="5*" align="center"/>
36691 <colspec colwidth="5*" align="center"/>
36692 <colspec colwidth="6*" align="right"/>
36693 <tbody>
36694 <row>
36695 <entry><option>mailbox_filecount</option></entry>
36696 <entry>Use: <emphasis>appendfile</emphasis></entry>
36697 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36698 <entry>Default: <emphasis>unset</emphasis></entry>
36699 </row>
36700 </tbody>
36701 </tgroup>
36702 </informaltable>
36703 <para>
36704 <indexterm role="concept">
36705 <primary>mailbox</primary>
36706 <secondary>specifying size of</secondary>
36707 </indexterm>
36708 <indexterm role="concept">
36709 <primary>size</primary>
36710 <secondary>of mailbox</secondary>
36711 </indexterm>
36712 If this option is set, it is expanded, and the result is taken as the current
36713 number of files in the mailbox. It must be a decimal number, optionally
36714 followed by K or M. This provides a way of obtaining this information from an
36715 external source that maintains the data.
36716 </para>
36717 <para>
36718 <indexterm role="option">
36719 <primary><option>mailbox_size</option></primary>
36720 </indexterm>
36721 </para>
36722 <informaltable frame="all">
36723 <tgroup cols="4" colsep="0" rowsep="0">
36724 <colspec colwidth="8*" align="left"/>
36725 <colspec colwidth="5*" align="center"/>
36726 <colspec colwidth="5*" align="center"/>
36727 <colspec colwidth="6*" align="right"/>
36728 <tbody>
36729 <row>
36730 <entry><option>mailbox_size</option></entry>
36731 <entry>Use: <emphasis>appendfile</emphasis></entry>
36732 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36733 <entry>Default: <emphasis>unset</emphasis></entry>
36734 </row>
36735 </tbody>
36736 </tgroup>
36737 </informaltable>
36738 <para>
36739 <indexterm role="concept">
36740 <primary>mailbox</primary>
36741 <secondary>specifying size of</secondary>
36742 </indexterm>
36743 <indexterm role="concept">
36744 <primary>size</primary>
36745 <secondary>of mailbox</secondary>
36746 </indexterm>
36747 If this option is set, it is expanded, and the result is taken as the current
36748 size the mailbox. It must be a decimal number, optionally followed by K or M.
36749 This provides a way of obtaining this information from an external source that
36750 maintains the data. This is likely to be helpful for maildir deliveries where
36751 it is computationally expensive to compute the size of a mailbox.
36752 </para>
36753 <para>
36754 <indexterm role="option">
36755 <primary><option>maildir_format</option></primary>
36756 </indexterm>
36757 </para>
36758 <informaltable frame="all">
36759 <tgroup cols="4" colsep="0" rowsep="0">
36760 <colspec colwidth="8*" align="left"/>
36761 <colspec colwidth="5*" align="center"/>
36762 <colspec colwidth="5*" align="center"/>
36763 <colspec colwidth="6*" align="right"/>
36764 <tbody>
36765 <row>
36766 <entry><option>maildir_format</option></entry>
36767 <entry>Use: <emphasis>appendfile</emphasis></entry>
36768 <entry>Type: <emphasis>boolean</emphasis></entry>
36769 <entry>Default: <emphasis>false</emphasis></entry>
36770 </row>
36771 </tbody>
36772 </tgroup>
36773 </informaltable>
36774 <para>
36775 <indexterm role="concept">
36776 <primary>maildir format</primary>
36777 <secondary>specifying</secondary>
36778 </indexterm>
36779 If this option is set with the <option>directory</option> option, the delivery is into a new
36780 file, in the <quote>maildir</quote> format that is used by other mail software. When the
36781 transport is activated directly from a <command>redirect</command> router (for example, the
36782 <command>address_file</command> transport in the default configuration), setting
36783 <option>maildir_format</option> causes the path received from the router to be treated as a
36784 directory, whether or not it ends with <literal>/</literal>. This option is available only if
36785 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
36786 <xref linkend="SECTmaildirdelivery"/> below for further details.
36787 </para>
36788 <para>
36789 <indexterm role="option">
36790 <primary><option>maildir_quota_directory_regex</option></primary>
36791 </indexterm>
36792 </para>
36793 <informaltable frame="all">
36794 <tgroup cols="4" colsep="0" rowsep="0">
36795 <colspec colwidth="8*" align="left"/>
36796 <colspec colwidth="5*" align="center"/>
36797 <colspec colwidth="5*" align="center"/>
36798 <colspec colwidth="6*" align="right"/>
36799 <tbody>
36800 <row>
36801 <entry><option>maildir_quota_directory_regex</option></entry>
36802 <entry>Use: <emphasis>appendfile</emphasis></entry>
36803 <entry>Type: <emphasis>string</emphasis></entry>
36804 <entry>Default: <emphasis>See below</emphasis></entry>
36805 </row>
36806 </tbody>
36807 </tgroup>
36808 </informaltable>
36809 <para>
36810 <indexterm role="concept">
36811 <primary>maildir format</primary>
36812 <secondary>quota; directories included in</secondary>
36813 </indexterm>
36814 <indexterm role="concept">
36815 <primary>quota</primary>
36816 <secondary>maildir; directories included in</secondary>
36817 </indexterm>
36818 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
36819 a regular expression for specifying directories, relative to the quota
36820 directory (see <option>quota_directory</option>), that should be included in the quota
36821 calculation. The default value is:
36822 </para>
36823 <literallayout class="monospaced">
36824 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
36825 </literallayout>
36826 <para>
36827 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
36828 (directories whose names begin with a dot). If you want to exclude the
36829 <filename>Trash</filename>
36830 folder from the count (as some sites do), you need to change this setting to
36831 </para>
36832 <literallayout class="monospaced">
36833 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
36834 </literallayout>
36835 <para>
36836 This uses a negative lookahead in the regular expression to exclude the
36837 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
36838 calculations, quota processing is bypassed for any messages that are delivered
36839 directly into that directory.
36840 </para>
36841 <para>
36842 <indexterm role="option">
36843 <primary><option>maildir_retries</option></primary>
36844 </indexterm>
36845 </para>
36846 <informaltable frame="all">
36847 <tgroup cols="4" colsep="0" rowsep="0">
36848 <colspec colwidth="8*" align="left"/>
36849 <colspec colwidth="5*" align="center"/>
36850 <colspec colwidth="5*" align="center"/>
36851 <colspec colwidth="6*" align="right"/>
36852 <tbody>
36853 <row>
36854 <entry><option>maildir_retries</option></entry>
36855 <entry>Use: <emphasis>appendfile</emphasis></entry>
36856 <entry>Type: <emphasis>integer</emphasis></entry>
36857 <entry>Default: <emphasis>10</emphasis></entry>
36858 </row>
36859 </tbody>
36860 </tgroup>
36861 </informaltable>
36862 <para>
36863 This option specifies the number of times to retry when writing a file in
36864 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
36865 </para>
36866 <para>
36867 <indexterm role="option">
36868 <primary><option>maildir_tag</option></primary>
36869 </indexterm>
36870 </para>
36871 <informaltable frame="all">
36872 <tgroup cols="4" colsep="0" rowsep="0">
36873 <colspec colwidth="8*" align="left"/>
36874 <colspec colwidth="5*" align="center"/>
36875 <colspec colwidth="5*" align="center"/>
36876 <colspec colwidth="6*" align="right"/>
36877 <tbody>
36878 <row>
36879 <entry><option>maildir_tag</option></entry>
36880 <entry>Use: <emphasis>appendfile</emphasis></entry>
36881 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36882 <entry>Default: <emphasis>unset</emphasis></entry>
36883 </row>
36884 </tbody>
36885 </tgroup>
36886 </informaltable>
36887 <para>
36888 This option applies only to deliveries in maildir format, and is described in
36889 section <xref linkend="SECTmaildirdelivery"/> below.
36890 </para>
36891 <para>
36892 <indexterm role="option">
36893 <primary><option>maildir_use_size_file</option></primary>
36894 </indexterm>
36895 </para>
36896 <informaltable frame="all">
36897 <tgroup cols="4" colsep="0" rowsep="0">
36898 <colspec colwidth="8*" align="left"/>
36899 <colspec colwidth="5*" align="center"/>
36900 <colspec colwidth="5*" align="center"/>
36901 <colspec colwidth="6*" align="right"/>
36902 <tbody>
36903 <row>
36904 <entry><option>maildir_use_size_file</option></entry>
36905 <entry>Use: <emphasis>appendfile</emphasis></entry>
36906 <entry>Type: <emphasis>boolean</emphasis></entry>
36907 <entry>Default: <emphasis>false</emphasis></entry>
36908 </row>
36909 </tbody>
36910 </tgroup>
36911 </informaltable>
36912 <para>
36913 <indexterm role="concept">
36914 <primary>maildir format</primary>
36915 <secondary><filename>maildirsize</filename> file</secondary>
36916 </indexterm>
36917 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
36918 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
36919 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
36920 value is zero. See <option>maildir_quota_directory_regex</option> above and section
36921 <xref linkend="SECTmaildirdelivery"/> below for further details.
36922 </para>
36923 <para>
36924 <indexterm role="option">
36925 <primary><option>maildirfolder_create_regex</option></primary>
36926 </indexterm>
36927 </para>
36928 <informaltable frame="all">
36929 <tgroup cols="4" colsep="0" rowsep="0">
36930 <colspec colwidth="8*" align="left"/>
36931 <colspec colwidth="5*" align="center"/>
36932 <colspec colwidth="5*" align="center"/>
36933 <colspec colwidth="6*" align="right"/>
36934 <tbody>
36935 <row>
36936 <entry><option>maildirfolder_create_regex</option></entry>
36937 <entry>Use: <emphasis>appendfile</emphasis></entry>
36938 <entry>Type: <emphasis>string</emphasis></entry>
36939 <entry>Default: <emphasis>unset</emphasis></entry>
36940 </row>
36941 </tbody>
36942 </tgroup>
36943 </informaltable>
36944 <para>
36945 <indexterm role="concept">
36946 <primary>maildir format</primary>
36947 <secondary><filename>maildirfolder</filename> file</secondary>
36948 </indexterm>
36949 <indexterm role="concept">
36950 <primary><filename>maildirfolder</filename>, creating</primary>
36951 </indexterm>
36952 The value of this option is a regular expression. If it is unset, it has no
36953 effect. Otherwise, before a maildir delivery takes place, the pattern is
36954 matched against the name of the maildir directory, that is, the directory
36955 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
36956 delivery. If there is a match, Exim checks for the existence of a file called
36957 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
36958 See section <xref linkend="SECTmaildirdelivery"/> for more details.
36959 </para>
36960 <para>
36961 <indexterm role="option">
36962 <primary><option>mailstore_format</option></primary>
36963 </indexterm>
36964 </para>
36965 <informaltable frame="all">
36966 <tgroup cols="4" colsep="0" rowsep="0">
36967 <colspec colwidth="8*" align="left"/>
36968 <colspec colwidth="5*" align="center"/>
36969 <colspec colwidth="5*" align="center"/>
36970 <colspec colwidth="6*" align="right"/>
36971 <tbody>
36972 <row>
36973 <entry><option>mailstore_format</option></entry>
36974 <entry>Use: <emphasis>appendfile</emphasis></entry>
36975 <entry>Type: <emphasis>boolean</emphasis></entry>
36976 <entry>Default: <emphasis>false</emphasis></entry>
36977 </row>
36978 </tbody>
36979 </tgroup>
36980 </informaltable>
36981 <para>
36982 <indexterm role="concept">
36983 <primary>mailstore format</primary>
36984 <secondary>specifying</secondary>
36985 </indexterm>
36986 If this option is set with the <option>directory</option> option, the delivery is into two
36987 new files in  <quote>mailstore</quote> format. The option is available only if
36988 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
36989 below for further details.
36990 </para>
36991 <para>
36992 <indexterm role="option">
36993 <primary><option>mailstore_prefix</option></primary>
36994 </indexterm>
36995 </para>
36996 <informaltable frame="all">
36997 <tgroup cols="4" colsep="0" rowsep="0">
36998 <colspec colwidth="8*" align="left"/>
36999 <colspec colwidth="5*" align="center"/>
37000 <colspec colwidth="5*" align="center"/>
37001 <colspec colwidth="6*" align="right"/>
37002 <tbody>
37003 <row>
37004 <entry><option>mailstore_prefix</option></entry>
37005 <entry>Use: <emphasis>appendfile</emphasis></entry>
37006 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37007 <entry>Default: <emphasis>unset</emphasis></entry>
37008 </row>
37009 </tbody>
37010 </tgroup>
37011 </informaltable>
37012 <para>
37013 This option applies only to deliveries in mailstore format, and is described in
37014 section <xref linkend="SECTopdir"/> below.
37015 </para>
37016 <para>
37017 <indexterm role="option">
37018 <primary><option>mailstore_suffix</option></primary>
37019 </indexterm>
37020 </para>
37021 <informaltable frame="all">
37022 <tgroup cols="4" colsep="0" rowsep="0">
37023 <colspec colwidth="8*" align="left"/>
37024 <colspec colwidth="5*" align="center"/>
37025 <colspec colwidth="5*" align="center"/>
37026 <colspec colwidth="6*" align="right"/>
37027 <tbody>
37028 <row>
37029 <entry><option>mailstore_suffix</option></entry>
37030 <entry>Use: <emphasis>appendfile</emphasis></entry>
37031 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37032 <entry>Default: <emphasis>unset</emphasis></entry>
37033 </row>
37034 </tbody>
37035 </tgroup>
37036 </informaltable>
37037 <para>
37038 This option applies only to deliveries in mailstore format, and is described in
37039 section <xref linkend="SECTopdir"/> below.
37040 </para>
37041 <para>
37042 <indexterm role="option">
37043 <primary><option>mbx_format</option></primary>
37044 </indexterm>
37045 </para>
37046 <informaltable frame="all">
37047 <tgroup cols="4" colsep="0" rowsep="0">
37048 <colspec colwidth="8*" align="left"/>
37049 <colspec colwidth="5*" align="center"/>
37050 <colspec colwidth="5*" align="center"/>
37051 <colspec colwidth="6*" align="right"/>
37052 <tbody>
37053 <row>
37054 <entry><option>mbx_format</option></entry>
37055 <entry>Use: <emphasis>appendfile</emphasis></entry>
37056 <entry>Type: <emphasis>boolean</emphasis></entry>
37057 <entry>Default: <emphasis>false</emphasis></entry>
37058 </row>
37059 </tbody>
37060 </tgroup>
37061 </informaltable>
37062 <para>
37063 <indexterm role="concept">
37064 <primary>locking files</primary>
37065 </indexterm>
37066 <indexterm role="concept">
37067 <primary>file</primary>
37068 <secondary>locking</secondary>
37069 </indexterm>
37070 <indexterm role="concept">
37071 <primary>file</primary>
37072 <secondary>MBX format</secondary>
37073 </indexterm>
37074 <indexterm role="concept">
37075 <primary>MBX format</primary>
37076 <secondary>specifying</secondary>
37077 </indexterm>
37078 This option is available only if Exim has been compiled with SUPPORT_MBX
37079 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
37080 the message is appended to the mailbox file in MBX format instead of
37081 traditional Unix format. This format is supported by Pine4 and its associated
37082 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
37083 </para>
37084 <para>
37085 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
37086 automatically changed by the use of <option>mbx_format</option>. They should normally be set
37087 empty when using MBX format, so this option almost always appears in this
37088 combination:
37089 </para>
37090 <literallayout class="monospaced">
37091 mbx_format = true
37092 message_prefix =
37093 message_suffix =
37094 </literallayout>
37095 <para>
37096 If none of the locking options are mentioned in the configuration,
37097 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
37098 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
37099 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
37100 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
37101 should not be used if any program that does not use this form of locking is
37102 going to access the mailbox, nor should it be used if the mailbox file is NFS
37103 mounted, because it works only when the mailbox is accessed from a single host.
37104 </para>
37105 <para>
37106 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
37107 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
37108 (this means for the whole of a Pine or IMAP session), Exim will not be able to
37109 append messages to it.
37110 </para>
37111 <para>
37112 <indexterm role="option">
37113 <primary><option>message_prefix</option></primary>
37114 </indexterm>
37115 </para>
37116 <informaltable frame="all">
37117 <tgroup cols="4" colsep="0" rowsep="0">
37118 <colspec colwidth="8*" align="left"/>
37119 <colspec colwidth="5*" align="center"/>
37120 <colspec colwidth="5*" align="center"/>
37121 <colspec colwidth="6*" align="right"/>
37122 <tbody>
37123 <row>
37124 <entry><option>message_prefix</option></entry>
37125 <entry>Use: <emphasis>appendfile</emphasis></entry>
37126 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37127 <entry>Default: <emphasis>see below</emphasis></entry>
37128 </row>
37129 </tbody>
37130 </tgroup>
37131 </informaltable>
37132 <para>
37133 <indexterm role="concept">
37134 <primary><quote>From</quote> line</primary>
37135 </indexterm>
37136 The string specified here is expanded and output at the start of every message.
37137 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37138 in which case it is:
37139 </para>
37140 <literallayout class="monospaced">
37141 message_prefix = "From ${if def:return_path{$return_path}\
37142   {MAILER-DAEMON}} $tod_bsdinbox\n"
37143 </literallayout>
37144 <para>
37145 <indexterm role="option">
37146 <primary><option>message_suffix</option></primary>
37147 </indexterm>
37148 </para>
37149 <informaltable frame="all">
37150 <tgroup cols="4" colsep="0" rowsep="0">
37151 <colspec colwidth="8*" align="left"/>
37152 <colspec colwidth="5*" align="center"/>
37153 <colspec colwidth="5*" align="center"/>
37154 <colspec colwidth="6*" align="right"/>
37155 <tbody>
37156 <row>
37157 <entry><option>message_suffix</option></entry>
37158 <entry>Use: <emphasis>appendfile</emphasis></entry>
37159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37160 <entry>Default: <emphasis>see below</emphasis></entry>
37161 </row>
37162 </tbody>
37163 </tgroup>
37164 </informaltable>
37165 <para>
37166 The string specified here is expanded and output at the end of every message.
37167 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
37168 in which case it is a single newline character. The suffix can be suppressed by
37169 setting
37170 </para>
37171 <literallayout class="monospaced">
37172 message_suffix =
37173 </literallayout>
37174 <para>
37175 <indexterm role="option">
37176 <primary><option>mode</option></primary>
37177 </indexterm>
37178 </para>
37179 <informaltable frame="all">
37180 <tgroup cols="4" colsep="0" rowsep="0">
37181 <colspec colwidth="8*" align="left"/>
37182 <colspec colwidth="5*" align="center"/>
37183 <colspec colwidth="5*" align="center"/>
37184 <colspec colwidth="6*" align="right"/>
37185 <tbody>
37186 <row>
37187 <entry><option>mode</option></entry>
37188 <entry>Use: <emphasis>appendfile</emphasis></entry>
37189 <entry>Type: <emphasis>octal integer</emphasis></entry>
37190 <entry>Default: <emphasis>0600</emphasis></entry>
37191 </row>
37192 </tbody>
37193 </tgroup>
37194 </informaltable>
37195 <para>
37196 If the output file is created, it is given this mode. If it already exists and
37197 has wider permissions, they are reduced to this mode. If it has narrower
37198 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
37199 if the delivery is the result of a <option>save</option> command in a filter file specifing
37200 a particular mode, the mode of the output file is always forced to take that
37201 value, and this option is ignored.
37202 </para>
37203 <para>
37204 <indexterm role="option">
37205 <primary><option>mode_fail_narrower</option></primary>
37206 </indexterm>
37207 </para>
37208 <informaltable frame="all">
37209 <tgroup cols="4" colsep="0" rowsep="0">
37210 <colspec colwidth="8*" align="left"/>
37211 <colspec colwidth="5*" align="center"/>
37212 <colspec colwidth="5*" align="center"/>
37213 <colspec colwidth="6*" align="right"/>
37214 <tbody>
37215 <row>
37216 <entry><option>mode_fail_narrower</option></entry>
37217 <entry>Use: <emphasis>appendfile</emphasis></entry>
37218 <entry>Type: <emphasis>boolean</emphasis></entry>
37219 <entry>Default: <emphasis>true</emphasis></entry>
37220 </row>
37221 </tbody>
37222 </tgroup>
37223 </informaltable>
37224 <para>
37225 This option applies in the case when an existing mailbox file has a narrower
37226 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
37227 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
37228 continues with the delivery attempt, using the existing mode of the file.
37229 </para>
37230 <para>
37231 <indexterm role="option">
37232 <primary><option>notify_comsat</option></primary>
37233 </indexterm>
37234 </para>
37235 <informaltable frame="all">
37236 <tgroup cols="4" colsep="0" rowsep="0">
37237 <colspec colwidth="8*" align="left"/>
37238 <colspec colwidth="5*" align="center"/>
37239 <colspec colwidth="5*" align="center"/>
37240 <colspec colwidth="6*" align="right"/>
37241 <tbody>
37242 <row>
37243 <entry><option>notify_comsat</option></entry>
37244 <entry>Use: <emphasis>appendfile</emphasis></entry>
37245 <entry>Type: <emphasis>boolean</emphasis></entry>
37246 <entry>Default: <emphasis>false</emphasis></entry>
37247 </row>
37248 </tbody>
37249 </tgroup>
37250 </informaltable>
37251 <para>
37252 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
37253 successful delivery to a user mailbox. This is the daemon that notifies logged
37254 on users about incoming mail.
37255 </para>
37256 <para>
37257 <indexterm role="option">
37258 <primary><option>quota</option></primary>
37259 </indexterm>
37260 </para>
37261 <informaltable frame="all">
37262 <tgroup cols="4" colsep="0" rowsep="0">
37263 <colspec colwidth="8*" align="left"/>
37264 <colspec colwidth="5*" align="center"/>
37265 <colspec colwidth="5*" align="center"/>
37266 <colspec colwidth="6*" align="right"/>
37267 <tbody>
37268 <row>
37269 <entry><option>quota</option></entry>
37270 <entry>Use: <emphasis>appendfile</emphasis></entry>
37271 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37272 <entry>Default: <emphasis>unset</emphasis></entry>
37273 </row>
37274 </tbody>
37275 </tgroup>
37276 </informaltable>
37277 <para>
37278 <indexterm role="concept">
37279 <primary>quota</primary>
37280 <secondary>imposed by Exim</secondary>
37281 </indexterm>
37282 This option imposes a limit on the size of the file to which Exim is appending,
37283 or to the total space used in the directory tree when the <option>directory</option> option
37284 is set. In the latter case, computation of the space used is expensive, because
37285 all the files in the directory (and any sub-directories) have to be
37286 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
37287 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
37288 have no shell access to their mailboxes).
37289 </para>
37290 <para>
37291 As there is no interlock against two simultaneous deliveries into a
37292 multi-file mailbox, it is possible for the quota to be overrun in this case.
37293 For single-file mailboxes, of course, an interlock is a necessity.
37294 </para>
37295 <para>
37296 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
37297 may be a lot less than the actual amount of disk space allocated to the file.
37298 If the sizes of a number of files are being added up, the rounding effect can
37299 become quite noticeable, especially on systems that have large block sizes.
37300 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
37301 the obvious value which users understand most easily.
37302 </para>
37303 <para>
37304 The value of the option is expanded, and must then be a numerical value
37305 (decimal point allowed), optionally followed by one of the letters K, M, or G,
37306 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
37307 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
37308 be handled.
37309 </para>
37310 <para>
37311 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
37312 </para>
37313 <para>
37314 The expansion happens while Exim is running as root, before it changes uid for
37315 the delivery. This means that files that are inaccessible to the end user can
37316 be used to hold quota values that are looked up in the expansion. When delivery
37317 fails because this quota is exceeded, the handling of the error is as for
37318 system quota failures.
37319 </para>
37320 <para>
37321 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
37322 mailbox to the specified maximum size, though the value is not accurate to the
37323 last byte, owing to separator lines and additional headers that may get added
37324 during message delivery. When a mailbox is nearly full, large messages may get
37325 refused even though small ones are accepted, because the size of the current
37326 message is added to the quota when the check is made. This behaviour can be
37327 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
37328 for exceeding the quota does not include the current message. Thus, deliveries
37329 continue until the quota has been exceeded; thereafter, no further messages are
37330 delivered. See also <option>quota_warn_threshold</option>.
37331 </para>
37332 <para>
37333 <indexterm role="option">
37334 <primary><option>quota_directory</option></primary>
37335 </indexterm>
37336 </para>
37337 <informaltable frame="all">
37338 <tgroup cols="4" colsep="0" rowsep="0">
37339 <colspec colwidth="8*" align="left"/>
37340 <colspec colwidth="5*" align="center"/>
37341 <colspec colwidth="5*" align="center"/>
37342 <colspec colwidth="6*" align="right"/>
37343 <tbody>
37344 <row>
37345 <entry><option>quota_directory</option></entry>
37346 <entry>Use: <emphasis>appendfile</emphasis></entry>
37347 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37348 <entry>Default: <emphasis>unset</emphasis></entry>
37349 </row>
37350 </tbody>
37351 </tgroup>
37352 </informaltable>
37353 <para>
37354 This option defines the directory to check for quota purposes when delivering
37355 into individual files. The default is the delivery directory, or, if a file
37356 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
37357 delivery directory.
37358 </para>
37359 <para>
37360 <indexterm role="option">
37361 <primary><option>quota_filecount</option></primary>
37362 </indexterm>
37363 </para>
37364 <informaltable frame="all">
37365 <tgroup cols="4" colsep="0" rowsep="0">
37366 <colspec colwidth="8*" align="left"/>
37367 <colspec colwidth="5*" align="center"/>
37368 <colspec colwidth="5*" align="center"/>
37369 <colspec colwidth="6*" align="right"/>
37370 <tbody>
37371 <row>
37372 <entry><option>quota_filecount</option></entry>
37373 <entry>Use: <emphasis>appendfile</emphasis></entry>
37374 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37375 <entry>Default: <emphasis>0</emphasis></entry>
37376 </row>
37377 </tbody>
37378 </tgroup>
37379 </informaltable>
37380 <para>
37381 This option applies when the <option>directory</option> option is set. It limits the total
37382 number of files in the directory (compare the inode limit in system quotas). It
37383 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
37384 failure causes delivery to be deferred. A value of zero is interpreted as
37385 <quote>no quota</quote>.
37386 </para>
37387 <para>
37388 <indexterm role="option">
37389 <primary><option>quota_is_inclusive</option></primary>
37390 </indexterm>
37391 </para>
37392 <informaltable frame="all">
37393 <tgroup cols="4" colsep="0" rowsep="0">
37394 <colspec colwidth="8*" align="left"/>
37395 <colspec colwidth="5*" align="center"/>
37396 <colspec colwidth="5*" align="center"/>
37397 <colspec colwidth="6*" align="right"/>
37398 <tbody>
37399 <row>
37400 <entry><option>quota_is_inclusive</option></entry>
37401 <entry>Use: <emphasis>appendfile</emphasis></entry>
37402 <entry>Type: <emphasis>boolean</emphasis></entry>
37403 <entry>Default: <emphasis>true</emphasis></entry>
37404 </row>
37405 </tbody>
37406 </tgroup>
37407 </informaltable>
37408 <para>
37409 See <option>quota</option> above.
37410 </para>
37411 <para>
37412 <indexterm role="option">
37413 <primary><option>quota_size_regex</option></primary>
37414 </indexterm>
37415 </para>
37416 <informaltable frame="all">
37417 <tgroup cols="4" colsep="0" rowsep="0">
37418 <colspec colwidth="8*" align="left"/>
37419 <colspec colwidth="5*" align="center"/>
37420 <colspec colwidth="5*" align="center"/>
37421 <colspec colwidth="6*" align="right"/>
37422 <tbody>
37423 <row>
37424 <entry><option>quota_size_regex</option></entry>
37425 <entry>Use: <emphasis>appendfile</emphasis></entry>
37426 <entry>Type: <emphasis>string</emphasis></entry>
37427 <entry>Default: <emphasis>unset</emphasis></entry>
37428 </row>
37429 </tbody>
37430 </tgroup>
37431 </informaltable>
37432 <para>
37433 This option applies when one of the delivery modes that writes a separate file
37434 for each message is being used. When Exim wants to find the size of one of
37435 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
37436 If this is set to a regular expression that matches the file name, and it
37437 captures one string, that string is interpreted as a representation of the
37438 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
37439 </para>
37440 <para>
37441 This feature is useful only when users have no shell access to their mailboxes
37442 &ndash; otherwise they could defeat the quota simply by renaming the files. This
37443 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
37444 the file length to the file name. For example:
37445 </para>
37446 <literallayout class="monospaced">
37447 maildir_tag = ,S=$message_size
37448 quota_size_regex = ,S=(\d+)
37449 </literallayout>
37450 <para>
37451 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
37452 number of lines in the message.
37453 </para>
37454 <para>
37455 The regular expression should not assume that the length is at the end of the
37456 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
37457 sometimes add other information onto the ends of message file names.
37458 </para>
37459 <para>
37460 <indexterm role="option">
37461 <primary><option>quota_warn_message</option></primary>
37462 </indexterm>
37463 </para>
37464 <informaltable frame="all">
37465 <tgroup cols="4" colsep="0" rowsep="0">
37466 <colspec colwidth="8*" align="left"/>
37467 <colspec colwidth="5*" align="center"/>
37468 <colspec colwidth="5*" align="center"/>
37469 <colspec colwidth="6*" align="right"/>
37470 <tbody>
37471 <row>
37472 <entry><option>quota_warn_message</option></entry>
37473 <entry>Use: <emphasis>appendfile</emphasis></entry>
37474 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37475 <entry>Default: <emphasis>see below</emphasis></entry>
37476 </row>
37477 </tbody>
37478 </tgroup>
37479 </informaltable>
37480 <para>
37481 See below for the use of this option. If it is not set when
37482 <option>quota_warn_threshold</option> is set, it defaults to
37483 </para>
37484 <literallayout class="monospaced">
37485 quota_warn_message = "\
37486   To: $local_part@$domain\n\
37487   Subject: Your mailbox\n\n\
37488   This message is automatically created \
37489   by mail delivery software.\n\n\
37490   The size of your mailbox has exceeded \
37491   a warning threshold that is\n\
37492   set by the system administrator.\n"
37493 </literallayout>
37494 <para>
37495 <indexterm role="option">
37496 <primary><option>quota_warn_threshold</option></primary>
37497 </indexterm>
37498 </para>
37499 <informaltable frame="all">
37500 <tgroup cols="4" colsep="0" rowsep="0">
37501 <colspec colwidth="8*" align="left"/>
37502 <colspec colwidth="5*" align="center"/>
37503 <colspec colwidth="5*" align="center"/>
37504 <colspec colwidth="6*" align="right"/>
37505 <tbody>
37506 <row>
37507 <entry><option>quota_warn_threshold</option></entry>
37508 <entry>Use: <emphasis>appendfile</emphasis></entry>
37509 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37510 <entry>Default: <emphasis>0</emphasis></entry>
37511 </row>
37512 </tbody>
37513 </tgroup>
37514 </informaltable>
37515 <para>
37516 <indexterm role="concept">
37517 <primary>quota</primary>
37518 <secondary>warning threshold</secondary>
37519 </indexterm>
37520 <indexterm role="concept">
37521 <primary>mailbox</primary>
37522 <secondary>size warning</secondary>
37523 </indexterm>
37524 <indexterm role="concept">
37525 <primary>size</primary>
37526 <secondary>of mailbox</secondary>
37527 </indexterm>
37528 This option is expanded in the same way as <option>quota</option> (see above). If the
37529 resulting value is greater than zero, and delivery of the message causes the
37530 size of the file or total space in the directory tree to cross the given
37531 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
37532 may be specified as a percentage of it by following the value with a percent
37533 sign. For example:
37534 </para>
37535 <literallayout class="monospaced">
37536 quota = 10M
37537 quota_warn_threshold = 75%
37538 </literallayout>
37539 <para>
37540 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
37541 percent sign is ignored.
37542 </para>
37543 <para>
37544 The warning message itself is specified by the <option>quota_warn_message</option> option,
37545 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
37546 warning message. These do not necessarily have to include the recipient(s) of
37547 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
37548 can include any other header lines that you want. If you do not include a
37549 <emphasis>From:</emphasis> line, the default is:
37550 </para>
37551 <literallayout class="monospaced">
37552 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
37553 </literallayout>
37554 <para>
37555 <indexterm role="option">
37556 <primary><option>errors_reply_to</option></primary>
37557 </indexterm>
37558 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
37559 option.
37560 </para>
37561 <para>
37562 The <option>quota</option> option does not have to be set in order to use this option; they
37563 are independent of one another except when the threshold is specified as a
37564 percentage.
37565 </para>
37566 <para>
37567 <indexterm role="option">
37568 <primary><option>use_bsmtp</option></primary>
37569 </indexterm>
37570 </para>
37571 <informaltable frame="all">
37572 <tgroup cols="4" colsep="0" rowsep="0">
37573 <colspec colwidth="8*" align="left"/>
37574 <colspec colwidth="5*" align="center"/>
37575 <colspec colwidth="5*" align="center"/>
37576 <colspec colwidth="6*" align="right"/>
37577 <tbody>
37578 <row>
37579 <entry><option>use_bsmtp</option></entry>
37580 <entry>Use: <emphasis>appendfile</emphasis></entry>
37581 <entry>Type: <emphasis>boolean</emphasis></entry>
37582 <entry>Default: <emphasis>false</emphasis></entry>
37583 </row>
37584 </tbody>
37585 </tgroup>
37586 </informaltable>
37587 <para>
37588 <indexterm role="concept">
37589 <primary>envelope sender</primary>
37590 </indexterm>
37591 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
37592 format, with the envelope sender and recipient(s) included as SMTP commands. If
37593 you want to include a leading HELO command with such messages, you can do
37594 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
37595 for details of batch SMTP.
37596 </para>
37597 <para>
37598 <indexterm role="option">
37599 <primary><option>use_crlf</option></primary>
37600 </indexterm>
37601 </para>
37602 <informaltable frame="all">
37603 <tgroup cols="4" colsep="0" rowsep="0">
37604 <colspec colwidth="8*" align="left"/>
37605 <colspec colwidth="5*" align="center"/>
37606 <colspec colwidth="5*" align="center"/>
37607 <colspec colwidth="6*" align="right"/>
37608 <tbody>
37609 <row>
37610 <entry><option>use_crlf</option></entry>
37611 <entry>Use: <emphasis>appendfile</emphasis></entry>
37612 <entry>Type: <emphasis>boolean</emphasis></entry>
37613 <entry>Default: <emphasis>false</emphasis></entry>
37614 </row>
37615 </tbody>
37616 </tgroup>
37617 </informaltable>
37618 <para>
37619 <indexterm role="concept">
37620 <primary>carriage return</primary>
37621 </indexterm>
37622 <indexterm role="concept">
37623 <primary>linefeed</primary>
37624 </indexterm>
37625 This option causes lines to be terminated with the two-character CRLF sequence
37626 (carriage return, linefeed) instead of just a linefeed character. In the case
37627 of batched SMTP, the byte sequence written to the file is then an exact image
37628 of what would be sent down a real SMTP connection.
37629 </para>
37630 <para>
37631 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
37632 written verbatim, so must contain their own carriage return characters if these
37633 are needed. In cases where these options have non-empty defaults, the values
37634 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
37635 <option>use_crlf</option> is set.
37636 </para>
37637 <para>
37638 <indexterm role="option">
37639 <primary><option>use_fcntl_lock</option></primary>
37640 </indexterm>
37641 </para>
37642 <informaltable frame="all">
37643 <tgroup cols="4" colsep="0" rowsep="0">
37644 <colspec colwidth="8*" align="left"/>
37645 <colspec colwidth="5*" align="center"/>
37646 <colspec colwidth="5*" align="center"/>
37647 <colspec colwidth="6*" align="right"/>
37648 <tbody>
37649 <row>
37650 <entry><option>use_fcntl_lock</option></entry>
37651 <entry>Use: <emphasis>appendfile</emphasis></entry>
37652 <entry>Type: <emphasis>boolean</emphasis></entry>
37653 <entry>Default: <emphasis>see below</emphasis></entry>
37654 </row>
37655 </tbody>
37656 </tgroup>
37657 </informaltable>
37658 <para>
37659 This option controls the use of the <function>fcntl()</function> function to lock a file for
37660 exclusive use when a message is being appended. It is set by default unless
37661 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
37662 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
37663 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
37664 </para>
37665 <para>
37666 <indexterm role="option">
37667 <primary><option>use_flock_lock</option></primary>
37668 </indexterm>
37669 </para>
37670 <informaltable frame="all">
37671 <tgroup cols="4" colsep="0" rowsep="0">
37672 <colspec colwidth="8*" align="left"/>
37673 <colspec colwidth="5*" align="center"/>
37674 <colspec colwidth="5*" align="center"/>
37675 <colspec colwidth="6*" align="right"/>
37676 <tbody>
37677 <row>
37678 <entry><option>use_flock_lock</option></entry>
37679 <entry>Use: <emphasis>appendfile</emphasis></entry>
37680 <entry>Type: <emphasis>boolean</emphasis></entry>
37681 <entry>Default: <emphasis>false</emphasis></entry>
37682 </row>
37683 </tbody>
37684 </tgroup>
37685 </informaltable>
37686 <para>
37687 This option is provided to support the use of <function>flock()</function> for file locking, for
37688 the few situations where it is needed. Most modern operating systems support
37689 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
37690 each other. Exim uses <function>fcntl()</function> locking by default.
37691 </para>
37692 <para>
37693 This option is required only if you are using an operating system where
37694 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
37695 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
37696 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
37697 </para>
37698 <para>
37699 <indexterm role="concept">
37700 <primary>Solaris</primary>
37701 <secondary><function>flock()</function> support</secondary>
37702 </indexterm>
37703 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
37704 have it (and some, I think, provide a not quite right version built on top of
37705 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
37706 the ability to use it, and any attempt to do so will cause a configuration
37707 error.
37708 </para>
37709 <para>
37710 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
37711 is just being mapped onto <function>fcntl()</function> by the OS).
37712 </para>
37713 <para>
37714 <indexterm role="option">
37715 <primary><option>use_lockfile</option></primary>
37716 </indexterm>
37717 </para>
37718 <informaltable frame="all">
37719 <tgroup cols="4" colsep="0" rowsep="0">
37720 <colspec colwidth="8*" align="left"/>
37721 <colspec colwidth="5*" align="center"/>
37722 <colspec colwidth="5*" align="center"/>
37723 <colspec colwidth="6*" align="right"/>
37724 <tbody>
37725 <row>
37726 <entry><option>use_lockfile</option></entry>
37727 <entry>Use: <emphasis>appendfile</emphasis></entry>
37728 <entry>Type: <emphasis>boolean</emphasis></entry>
37729 <entry>Default: <emphasis>see below</emphasis></entry>
37730 </row>
37731 </tbody>
37732 </tgroup>
37733 </informaltable>
37734 <para>
37735 If this option is turned off, Exim does not attempt to create a lock file when
37736 appending to a mailbox file. In this situation, the only locking is by
37737 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
37738 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
37739 <function>fcntl()</function> rather than a lock file, and even then only when you are not
37740 delivering over NFS from more than one host.
37741 </para>
37742 <para>
37743 <indexterm role="concept">
37744 <primary>NFS</primary>
37745 <secondary>lock file</secondary>
37746 </indexterm>
37747 In order to append to an NFS file safely from more than one host, it is
37748 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
37749 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
37750 file corruption.
37751 </para>
37752 <para>
37753 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
37754 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
37755 except when <option>mbx_format</option> is set.
37756 </para>
37757 <para>
37758 <indexterm role="option">
37759 <primary><option>use_mbx_lock</option></primary>
37760 </indexterm>
37761 </para>
37762 <informaltable frame="all">
37763 <tgroup cols="4" colsep="0" rowsep="0">
37764 <colspec colwidth="8*" align="left"/>
37765 <colspec colwidth="5*" align="center"/>
37766 <colspec colwidth="5*" align="center"/>
37767 <colspec colwidth="6*" align="right"/>
37768 <tbody>
37769 <row>
37770 <entry><option>use_mbx_lock</option></entry>
37771 <entry>Use: <emphasis>appendfile</emphasis></entry>
37772 <entry>Type: <emphasis>boolean</emphasis></entry>
37773 <entry>Default: <emphasis>see below</emphasis></entry>
37774 </row>
37775 </tbody>
37776 </tgroup>
37777 </informaltable>
37778 <para>
37779 This option is available only if Exim has been compiled with SUPPORT_MBX
37780 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
37781 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
37782 of the locking options are mentioned in the configuration. The locking rules
37783 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
37784 the IMAP4 and POP daemons that come with it (see the discussion below). The
37785 rules allow for shared access to the mailbox. However, this kind of locking
37786 does not work when the mailbox is NFS mounted.
37787 </para>
37788 <para>
37789 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
37790 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
37791 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
37792 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
37793 </para>
37794 </section>
37795 <section id="SECTopappend">
37796 <title>Operational details for appending</title>
37797 <para>
37798 <indexterm role="concept">
37799 <primary>appending to a file</primary>
37800 </indexterm>
37801 <indexterm role="concept">
37802 <primary>file</primary>
37803 <secondary>appending</secondary>
37804 </indexterm>
37805 Before appending to a file, the following preparations are made:
37806 </para>
37807 <itemizedlist>
37808 <listitem>
37809 <para>
37810 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
37811 return is given.
37812 </para>
37813 </listitem>
37814 <listitem>
37815 <para>
37816 <indexterm role="concept">
37817 <primary>directory creation</primary>
37818 </indexterm>
37819 If any directories on the file&#x2019;s path are missing, Exim creates them if the
37820 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
37821 <option>directory_mode</option> option.
37822 </para>
37823 </listitem>
37824 <listitem>
37825 <para>
37826 If <option>file_format</option> is set, the format of an existing file is checked. If this
37827 indicates that a different transport should be used, control is passed to that
37828 transport.
37829 </para>
37830 </listitem>
37831 <listitem>
37832 <para>
37833 <indexterm role="concept">
37834 <primary>file</primary>
37835 <secondary>locking</secondary>
37836 </indexterm>
37837 <indexterm role="concept">
37838 <primary>locking files</primary>
37839 </indexterm>
37840 <indexterm role="concept">
37841 <primary>NFS</primary>
37842 <secondary>lock file</secondary>
37843 </indexterm>
37844 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
37845 reliably over NFS, as follows:
37846 </para>
37847 <orderedlist numeration="arabic">
37848 <listitem>
37849 <para>
37850 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
37851 current time, primary host name, and process id added, by opening for writing
37852 as a new file. If this fails with an access error, delivery is deferred.
37853 </para>
37854 </listitem>
37855 <listitem>
37856 <para>
37857 Close the hitching post file, and hard link it to the lock file name.
37858 </para>
37859 </listitem>
37860 <listitem>
37861 <para>
37862 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
37863 Unlink the hitching post name.
37864 </para>
37865 </listitem>
37866 <listitem>
37867 <para>
37868 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
37869 then unlink hitching post name. If the number of links is exactly two, creation
37870 of the lock file succeeded but something (for example, an NFS server crash and
37871 restart) caused this fact not to be communicated to the <function>link()</function> call.
37872 </para>
37873 </listitem>
37874 <listitem>
37875 <para>
37876 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
37877 up to <option>lock_retries</option> times. However, since any program that writes to a
37878 mailbox should complete its task very quickly, it is reasonable to time out old
37879 lock files that are normally the result of user agent and system crashes. If an
37880 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
37881 it before trying again.
37882 </para>
37883 </listitem>
37884 </orderedlist>
37885 </listitem>
37886 <listitem>
37887 <para>
37888 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
37889 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
37890 than non-existence, delivery is deferred.
37891 </para>
37892 </listitem>
37893 <listitem>
37894 <para>
37895 <indexterm role="concept">
37896 <primary>symbolic link</primary>
37897 <secondary>to mailbox</secondary>
37898 </indexterm>
37899 <indexterm role="concept">
37900 <primary>mailbox</primary>
37901 <secondary>symbolic link</secondary>
37902 </indexterm>
37903 If the file does exist and is a symbolic link, delivery is deferred, unless the
37904 <option>allow_symlink</option> option is set, in which case the ownership of the link is
37905 checked, and then <function>stat()</function> is called to find out about the real file, which
37906 is then subjected to the checks below. The check on the top-level link
37907 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
37908 directory, though allowing symbolic links in this case is definitely not a good
37909 idea. If there is a chain of symbolic links, the intermediate ones are not
37910 checked.
37911 </para>
37912 </listitem>
37913 <listitem>
37914 <para>
37915 If the file already exists but is not a regular file, or if the file&#x2019;s owner
37916 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
37917 different from the user and group under which the delivery is running,
37918 delivery is deferred.
37919 </para>
37920 </listitem>
37921 <listitem>
37922 <para>
37923 If the file&#x2019;s permissions are more generous than specified, they are reduced.
37924 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
37925 is set false, in which case the delivery is tried using the existing
37926 permissions.
37927 </para>
37928 </listitem>
37929 <listitem>
37930 <para>
37931 The file&#x2019;s inode number is saved, and the file is then opened for appending.
37932 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
37933 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
37934 </para>
37935 </listitem>
37936 <listitem>
37937 <para>
37938 If the file is opened successfully, check that the inode number hasn&#x2019;t
37939 changed, that it is still a regular file, and that the owner and permissions
37940 have not changed. If anything is wrong, defer delivery and freeze the message.
37941 </para>
37942 </listitem>
37943 <listitem>
37944 <para>
37945 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
37946 option is set. Otherwise, check that the file is being created in a permitted
37947 directory if the <option>create_file</option> option is set (deferring on failure), and then
37948 open for writing as a new file, with the O_EXCL and O_CREAT options,
37949 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
37950 set). In this case, which can happen if the link points to a non-existent file,
37951 the file is opened for writing using O_CREAT but not O_EXCL, because
37952 that prevents link following.
37953 </para>
37954 </listitem>
37955 <listitem>
37956 <para>
37957 <indexterm role="concept">
37958 <primary>loop</primary>
37959 <secondary>while file testing</secondary>
37960 </indexterm>
37961 If opening fails because the file exists, obey the tests given above for
37962 existing files. However, to avoid looping in a situation where the file is
37963 being continuously created and destroyed, the exists/not-exists loop is broken
37964 after 10 repetitions, and the message is then frozen.
37965 </para>
37966 </listitem>
37967 <listitem>
37968 <para>
37969 If opening fails with any other error, defer delivery.
37970 </para>
37971 </listitem>
37972 <listitem>
37973 <para>
37974 <indexterm role="concept">
37975 <primary>file</primary>
37976 <secondary>locking</secondary>
37977 </indexterm>
37978 <indexterm role="concept">
37979 <primary>locking files</primary>
37980 </indexterm>
37981 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
37982 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
37983 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
37984 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
37985 file, and an exclusive lock on the file whose name is
37986 </para>
37987 <literallayout class="monospaced">
37988 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
37989 </literallayout>
37990 <para>
37991 using the device and inode numbers of the open mailbox file, in accordance with
37992 the MBX locking rules. This file is created with a mode that is specified by
37993 the <option>lockfile_mode</option> option.
37994 </para>
37995 <para>
37996 If Exim fails to lock the file, there are two possible courses of action,
37997 depending on the value of the locking timeout. This is obtained from
37998 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
37999 </para>
38000 <para>
38001 If the timeout value is zero, the file is closed, Exim waits for
38002 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
38003 to lock it again. This happens up to <option>lock_retries</option> times, after which the
38004 delivery is deferred.
38005 </para>
38006 <para>
38007 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
38008 <function>flock()</function> are used (with the given timeout), so there has already been some
38009 waiting involved by the time locking fails. Nevertheless, Exim does not give up
38010 immediately. It retries up to
38011 </para>
38012 <literallayout class="monospaced">
38013 (lock_retries * lock_interval) / &lt;timeout&gt;
38014 </literallayout>
38015 <para>
38016 times (rounded up).
38017 </para>
38018 </listitem>
38019 </itemizedlist>
38020 <para>
38021 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
38022 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
38023 </para>
38024 </section>
38025 <section id="SECTopdir">
38026 <title>Operational details for delivery to a new file</title>
38027 <para>
38028 <indexterm role="concept">
38029 <primary>delivery</primary>
38030 <secondary>to single file</secondary>
38031 </indexterm>
38032 <indexterm role="concept">
38033 <primary><quote>From</quote> line</primary>
38034 </indexterm>
38035 When the <option>directory</option> option is set instead of <option>file</option>, each message is
38036 delivered into a newly-created file or set of files. When <command>appendfile</command> is
38037 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
38038 <option>directory</option> is normally set, because the path for delivery is supplied by the
38039 router. (See for example, the <command>address_file</command> transport in the default
38040 configuration.) In this case, delivery is to a new file if either the path name
38041 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
38042 </para>
38043 <para>
38044 No locking is required while writing the message to a new file, so the various
38045 locking options of the transport are ignored. The <quote>From</quote> line that by default
38046 separates messages in a single file is not normally needed, nor is the escaping
38047 of message lines that start with <quote>From</quote>, and there is no need to ensure a
38048 newline at the end of each message. Consequently, the default values for
38049 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
38050 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
38051 </para>
38052 <para>
38053 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
38054 the files in the delivery directory by default. However, you can specify a
38055 different directory by setting <option>quota_directory</option>. Also, for maildir
38056 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
38057 </para>
38058 <para>
38059 <indexterm role="concept">
38060 <primary>maildir format</primary>
38061 </indexterm>
38062 <indexterm role="concept">
38063 <primary>mailstore format</primary>
38064 </indexterm>
38065 There are three different ways in which delivery to individual files can be
38066 done, controlled by the settings of the <option>maildir_format</option> and
38067 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
38068 formats is not included in the binary unless SUPPORT_MAILDIR or
38069 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
38070 </para>
38071 <para>
38072 <indexterm role="concept">
38073 <primary>directory creation</primary>
38074 </indexterm>
38075 In all three cases an attempt is made to create the directory and any necessary
38076 sub-directories if they do not exist, provided that the <option>create_directory</option>
38077 option is set (the default). The location of a created directory can be
38078 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
38079 the <option>directory_mode</option> option. If creation fails, or if the
38080 <option>create_directory</option> option is not set when creation is required, delivery is
38081 deferred.
38082 </para>
38083 </section>
38084 <section id="SECTmaildirdelivery">
38085 <title>Maildir delivery</title>
38086 <para>
38087 <indexterm role="concept">
38088 <primary>maildir format</primary>
38089 <secondary>description of</secondary>
38090 </indexterm>
38091 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
38092 it to a file whose name is <filename>tmp/&lt;stime&gt;.H&lt;mtime&gt;P&lt;pid&gt;.&lt;host&gt;</filename> in the
38093 directory that is defined by the <option>directory</option> option (the <quote>delivery
38094 directory</quote>). If the delivery is successful, the file is renamed into the
38095 <filename>new</filename> subdirectory.
38096 </para>
38097 <para>
38098 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
38099 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
38100 Exim checks that the time-of-day clock has moved on by at least one microsecond
38101 before terminating the delivery process. This guarantees uniqueness for the
38102 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
38103 opening it. If any response other than ENOENT (does not exist) is given,
38104 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
38105 </para>
38106 <para>
38107 Before Exim carries out a maildir delivery, it ensures that subdirectories
38108 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
38109 do not exist, Exim tries to create them and any superior directories in their
38110 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
38111 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
38112 contains matches the delivery directory, Exim also ensures that a file called
38113 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
38114 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
38115 </para>
38116 <para>
38117 These features make it possible to use Exim to create all the necessary files
38118 and directories in a maildir mailbox, including subdirectories for maildir++
38119 folders. Consider this example:
38120 </para>
38121 <literallayout class="monospaced">
38122 maildir_format = true
38123 directory = /var/mail/$local_part\
38124            ${if eq{$local_part_suffix}{}{}\
38125            {/.${substr_1:$local_part_suffix}}}
38126 maildirfolder_create_regex = /\.[^/]+$
38127 </literallayout>
38128 <para>
38129 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
38130 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
38131 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
38132 not match this name, so Exim will not look for or create the file
38133 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
38134 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
38135 </para>
38136 <para>
38137 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
38138 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
38139 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
38140 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
38141 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
38142 </para>
38143 <para>
38144 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
38145 not inadvertently match the toplevel maildir directory, because a
38146 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
38147 </para>
38148 <para>
38149 <indexterm role="concept">
38150 <primary>quota</primary>
38151 <secondary>in maildir delivery</secondary>
38152 </indexterm>
38153 <indexterm role="concept">
38154 <primary>maildir++</primary>
38155 </indexterm>
38156 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
38157 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
38158 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
38159 Exim assumes the directory is a maildir++ folder directory, which is one level
38160 down from the user&#x2019;s top level mailbox directory. This causes it to start at
38161 the parent directory instead of the current directory when calculating the
38162 amount of space used.
38163 </para>
38164 <para>
38165 One problem with delivering into a multi-file mailbox is that it is
38166 computationally expensive to compute the size of the mailbox for quota
38167 checking. Various approaches have been taken to reduce the amount of work
38168 needed. The next two sections describe two of them. A third alternative is to
38169 use some external process for maintaining the size data, and use the expansion
38170 of the <option>mailbox_size</option> option as a way of importing it into Exim.
38171 </para>
38172 </section>
38173 <section>
38174 <title>Using tags to record message sizes</title>
38175 <para>
38176 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
38177 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
38178 tag is added to its name. However, if adding the tag takes the length of the
38179 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
38180 the tag is dropped and the maildir file is created with no tag.
38181 </para>
38182 <para>
38183 <indexterm role="concept">
38184 <primary><varname>$message_size</varname></primary>
38185 </indexterm>
38186 Tags can be used to encode the size of files in their names; see
38187 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
38188 happens after the message has been written. The value of the <varname>$message_size</varname>
38189 variable is set to the number of bytes actually written. If the expansion is
38190 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
38191 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
38192 Non-printing characters in the string are ignored; if the resulting string is
38193 empty, it is ignored. If it starts with an alphanumeric character, a leading
38194 colon is inserted.
38195 </para>
38196 </section>
38197 <section>
38198 <title>Using a maildirsize file</title>
38199 <para>
38200 <indexterm role="concept">
38201 <primary>quota</primary>
38202 <secondary>in maildir delivery</secondary>
38203 </indexterm>
38204 <indexterm role="concept">
38205 <primary>maildir format</primary>
38206 <secondary><filename>maildirsize</filename> file</secondary>
38207 </indexterm>
38208 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
38209 storing quota and message size information in a file called <filename>maildirsize</filename>
38210 within the toplevel maildir directory. If this file does not exist, Exim
38211 creates it, setting the quota from the <option>quota</option> option of the transport. If
38212 the maildir directory itself does not exist, it is created before any attempt
38213 to write a <filename>maildirsize</filename> file.
38214 </para>
38215 <para>
38216 The <filename>maildirsize</filename> file is used to hold information about the sizes of
38217 messages in the maildir, thus speeding up quota calculations. The quota value
38218 in the file is just a cache; if the quota is changed in the transport, the new
38219 value overrides the cached value when the next message is delivered. The cache
38220 is maintained for the benefit of other programs that access the maildir and
38221 need to know the quota.
38222 </para>
38223 <para>
38224 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
38225 file is maintained (with a zero quota setting), but no quota is imposed.
38226 </para>
38227 <para>
38228 A regular expression is available for controlling which directories in the
38229 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
38230 See the description of the <option>maildir_quota_directory_regex</option> option above for
38231 details.
38232 </para>
38233 </section>
38234 <section>
38235 <title>Mailstore delivery</title>
38236 <para>
38237 <indexterm role="concept">
38238 <primary>mailstore format</primary>
38239 <secondary>description of</secondary>
38240 </indexterm>
38241 If the <option>mailstore_format</option> option is true, each message is written as two
38242 files in the given directory. A unique base name is constructed from the
38243 message id and the current delivery process, and the files that are written use
38244 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
38245 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
38246 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
38247 </para>
38248 <para>
38249 During delivery, the envelope is first written to a file with the suffix
38250 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
38251 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
38252 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
38253 file before accessing either of them. An alternative approach is to wait for
38254 the absence of a <filename>.tmp</filename> file.
38255 </para>
38256 <para>
38257 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
38258 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
38259 the sender address on one line, then all the recipient addresses, one per line.
38260 There can be more than one recipient only if the <option>batch_max</option> option is set
38261 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
38262 appended to the file, followed by a newline if it does not end with one.
38263 </para>
38264 <para>
38265 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
38266 failure, it is ignored. Other expansion errors are treated as serious
38267 configuration errors, and delivery is deferred. The variable
38268 <varname>$mailstore_basename</varname> is available for use during these expansions.
38269 </para>
38270 </section>
38271 <section>
38272 <title>Non-special new file delivery</title>
38273 <para>
38274 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
38275 file is created directly in the named directory. For example, when delivering
38276 messages into files in batched SMTP format for later delivery to some host (see
38277 section <xref linkend="SECTbatchSMTP"/>), a setting such as
38278 </para>
38279 <literallayout class="monospaced">
38280 directory = /var/bsmtp/$host
38281 </literallayout>
38282 <para>
38283 might be used. A message is written to a file with a temporary name, which is
38284 then renamed when the delivery is complete. The final name is obtained by
38285 expanding the contents of the <option>directory_file</option> option.
38286 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
38287 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
38288 </para>
38289 </section>
38290 </chapter>
38291
38292 <chapter>
38293 <title>The autoreply transport</title>
38294 <para>
38295 <indexterm role="concept" id="IIDauttra1" class="startofrange">
38296 <primary>transports</primary>
38297 <secondary><command>autoreply</command></secondary>
38298 </indexterm>
38299 <indexterm role="concept" id="IIDauttra2" class="startofrange">
38300 <primary><command>autoreply</command> transport</primary>
38301 </indexterm>
38302 The <command>autoreply</command> transport is not a true transport in that it does not cause
38303 the message to be transmitted. Instead, it generates a new mail message as an
38304 automatic reply to the incoming message. <emphasis>References:</emphasis> and
38305 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
38306 to the rules in RFCs 2822 and 3834, respectively.
38307 </para>
38308 <para>
38309 If the router that passes the message to this transport does not have the
38310 <option>unseen</option> option set, the original message (for the current recipient) is not
38311 delivered anywhere. However, when the <option>unseen</option> option is set on the router
38312 that passes the message to this transport, routing of the address continues, so
38313 another router can set up a normal message delivery.
38314 </para>
38315 <para>
38316 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
38317 <quote>vacation</quote> message being the standard example. However, it can also be run
38318 directly from a router like any other transport. To reduce the possibility of
38319 message cascades, messages created by the <command>autoreply</command> transport always have
38320 empty envelope sender addresses, like bounce messages.
38321 </para>
38322 <para>
38323 The parameters of the message to be sent can be specified in the configuration
38324 by options described below. However, these are used only when the address
38325 passed to the transport does not contain its own reply information. When the
38326 transport is run as a consequence of a
38327 <option>mail</option>
38328 or <option>vacation</option> command in a filter file, the parameters of the message are
38329 supplied by the filter, and passed with the address. The transport&#x2019;s options
38330 that define the message are then ignored (so they are not usually set in this
38331 case). The message is specified entirely by the filter or by the transport; it
38332 is never built from a mixture of options. However, the <option>file_optional</option>,
38333 <option>mode</option>, and <option>return_message</option> options apply in all cases.
38334 </para>
38335 <para>
38336 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
38337 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
38338 gid of the user, and with appropriate current and home directories (see chapter
38339 <xref linkend="CHAPenvironment"/>).
38340 </para>
38341 <para>
38342 There is a subtle difference between routing a message to a <command>pipe</command> transport
38343 that generates some text to be returned to the sender, and routing it to an
38344 <command>autoreply</command> transport. This difference is noticeable only if more than one
38345 address from the same message is so handled. In the case of a pipe, the
38346 separate outputs from the different addresses are gathered up and returned to
38347 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
38348 message is generated for each address that is passed to it.
38349 </para>
38350 <para>
38351 Non-printing characters are not permitted in the header lines generated for the
38352 message that <command>autoreply</command> creates, with the exception of newlines that are
38353 immediately followed by white space. If any non-printing characters are found,
38354 the transport defers.
38355 Whether characters with the top bit set count as printing characters or not is
38356 controlled by the <option>print_topbitchars</option> global option.
38357 </para>
38358 <para>
38359 If any of the generic options for manipulating headers (for example,
38360 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
38361 of the original message that is included in the generated message when
38362 <option>return_message</option> is set. They do not apply to the generated message itself.
38363 </para>
38364 <para>
38365 <indexterm role="concept">
38366 <primary><varname>$sender_address</varname></primary>
38367 </indexterm>
38368 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
38369 the message, indicating that there were no recipients, it does not treat this
38370 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
38371 is empty (because the incoming message is a bounce message) do not cause
38372 problems. They are just discarded.
38373 </para>
38374 <section>
38375 <title>Private options for autoreply</title>
38376 <para>
38377 <indexterm role="concept">
38378 <primary>options</primary>
38379 <secondary><command>autoreply</command> transport</secondary>
38380 </indexterm>
38381 </para>
38382 <para>
38383 <indexterm role="option">
38384 <primary><option>bcc</option></primary>
38385 </indexterm>
38386 </para>
38387 <informaltable frame="all">
38388 <tgroup cols="4" colsep="0" rowsep="0">
38389 <colspec colwidth="8*" align="left"/>
38390 <colspec colwidth="5*" align="center"/>
38391 <colspec colwidth="5*" align="center"/>
38392 <colspec colwidth="6*" align="right"/>
38393 <tbody>
38394 <row>
38395 <entry><option>bcc</option></entry>
38396 <entry>Use: <emphasis>autoreply</emphasis></entry>
38397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38398 <entry>Default: <emphasis>unset</emphasis></entry>
38399 </row>
38400 </tbody>
38401 </tgroup>
38402 </informaltable>
38403 <para>
38404 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
38405 message when the message is specified by the transport.
38406 </para>
38407 <para>
38408 <indexterm role="option">
38409 <primary><option>cc</option></primary>
38410 </indexterm>
38411 </para>
38412 <informaltable frame="all">
38413 <tgroup cols="4" colsep="0" rowsep="0">
38414 <colspec colwidth="8*" align="left"/>
38415 <colspec colwidth="5*" align="center"/>
38416 <colspec colwidth="5*" align="center"/>
38417 <colspec colwidth="6*" align="right"/>
38418 <tbody>
38419 <row>
38420 <entry><option>cc</option></entry>
38421 <entry>Use: <emphasis>autoreply</emphasis></entry>
38422 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38423 <entry>Default: <emphasis>unset</emphasis></entry>
38424 </row>
38425 </tbody>
38426 </tgroup>
38427 </informaltable>
38428 <para>
38429 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
38430 when the message is specified by the transport.
38431 </para>
38432 <para>
38433 <indexterm role="option">
38434 <primary><option>file</option></primary>
38435 </indexterm>
38436 </para>
38437 <informaltable frame="all">
38438 <tgroup cols="4" colsep="0" rowsep="0">
38439 <colspec colwidth="8*" align="left"/>
38440 <colspec colwidth="5*" align="center"/>
38441 <colspec colwidth="5*" align="center"/>
38442 <colspec colwidth="6*" align="right"/>
38443 <tbody>
38444 <row>
38445 <entry><option>file</option></entry>
38446 <entry>Use: <emphasis>autoreply</emphasis></entry>
38447 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38448 <entry>Default: <emphasis>unset</emphasis></entry>
38449 </row>
38450 </tbody>
38451 </tgroup>
38452 </informaltable>
38453 <para>
38454 The contents of the file are sent as the body of the message when the message
38455 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
38456 string comes first.
38457 </para>
38458 <para>
38459 <indexterm role="option">
38460 <primary><option>file_expand</option></primary>
38461 </indexterm>
38462 </para>
38463 <informaltable frame="all">
38464 <tgroup cols="4" colsep="0" rowsep="0">
38465 <colspec colwidth="8*" align="left"/>
38466 <colspec colwidth="5*" align="center"/>
38467 <colspec colwidth="5*" align="center"/>
38468 <colspec colwidth="6*" align="right"/>
38469 <tbody>
38470 <row>
38471 <entry><option>file_expand</option></entry>
38472 <entry>Use: <emphasis>autoreply</emphasis></entry>
38473 <entry>Type: <emphasis>boolean</emphasis></entry>
38474 <entry>Default: <emphasis>false</emphasis></entry>
38475 </row>
38476 </tbody>
38477 </tgroup>
38478 </informaltable>
38479 <para>
38480 If this is set, the contents of the file named by the <option>file</option> option are
38481 subjected to string expansion as they are added to the message.
38482 </para>
38483 <para>
38484 <indexterm role="option">
38485 <primary><option>file_optional</option></primary>
38486 </indexterm>
38487 </para>
38488 <informaltable frame="all">
38489 <tgroup cols="4" colsep="0" rowsep="0">
38490 <colspec colwidth="8*" align="left"/>
38491 <colspec colwidth="5*" align="center"/>
38492 <colspec colwidth="5*" align="center"/>
38493 <colspec colwidth="6*" align="right"/>
38494 <tbody>
38495 <row>
38496 <entry><option>file_optional</option></entry>
38497 <entry>Use: <emphasis>autoreply</emphasis></entry>
38498 <entry>Type: <emphasis>boolean</emphasis></entry>
38499 <entry>Default: <emphasis>false</emphasis></entry>
38500 </row>
38501 </tbody>
38502 </tgroup>
38503 </informaltable>
38504 <para>
38505 If this option is true, no error is generated if the file named by the <option>file</option>
38506 option or passed with the address does not exist or cannot be read.
38507 </para>
38508 <para>
38509 <indexterm role="option">
38510 <primary><option>from</option></primary>
38511 </indexterm>
38512 </para>
38513 <informaltable frame="all">
38514 <tgroup cols="4" colsep="0" rowsep="0">
38515 <colspec colwidth="8*" align="left"/>
38516 <colspec colwidth="5*" align="center"/>
38517 <colspec colwidth="5*" align="center"/>
38518 <colspec colwidth="6*" align="right"/>
38519 <tbody>
38520 <row>
38521 <entry><option>from</option></entry>
38522 <entry>Use: <emphasis>autoreply</emphasis></entry>
38523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38524 <entry>Default: <emphasis>unset</emphasis></entry>
38525 </row>
38526 </tbody>
38527 </tgroup>
38528 </informaltable>
38529 <para>
38530 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
38531 specified by the transport.
38532 </para>
38533 <para>
38534 <indexterm role="option">
38535 <primary><option>headers</option></primary>
38536 </indexterm>
38537 </para>
38538 <informaltable frame="all">
38539 <tgroup cols="4" colsep="0" rowsep="0">
38540 <colspec colwidth="8*" align="left"/>
38541 <colspec colwidth="5*" align="center"/>
38542 <colspec colwidth="5*" align="center"/>
38543 <colspec colwidth="6*" align="right"/>
38544 <tbody>
38545 <row>
38546 <entry><option>headers</option></entry>
38547 <entry>Use: <emphasis>autoreply</emphasis></entry>
38548 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38549 <entry>Default: <emphasis>unset</emphasis></entry>
38550 </row>
38551 </tbody>
38552 </tgroup>
38553 </informaltable>
38554 <para>
38555 This specifies additional RFC 2822 headers that are to be added to the message
38556 when the message is specified by the transport. Several can be given by using
38557 <quote>\n</quote> to separate them. There is no check on the format.
38558 </para>
38559 <para>
38560 <indexterm role="option">
38561 <primary><option>log</option></primary>
38562 </indexterm>
38563 </para>
38564 <informaltable frame="all">
38565 <tgroup cols="4" colsep="0" rowsep="0">
38566 <colspec colwidth="8*" align="left"/>
38567 <colspec colwidth="5*" align="center"/>
38568 <colspec colwidth="5*" align="center"/>
38569 <colspec colwidth="6*" align="right"/>
38570 <tbody>
38571 <row>
38572 <entry><option>log</option></entry>
38573 <entry>Use: <emphasis>autoreply</emphasis></entry>
38574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38575 <entry>Default: <emphasis>unset</emphasis></entry>
38576 </row>
38577 </tbody>
38578 </tgroup>
38579 </informaltable>
38580 <para>
38581 This option names a file in which a record of every message sent is logged when
38582 the message is specified by the transport.
38583 </para>
38584 <para>
38585 <indexterm role="option">
38586 <primary><option>mode</option></primary>
38587 </indexterm>
38588 </para>
38589 <informaltable frame="all">
38590 <tgroup cols="4" colsep="0" rowsep="0">
38591 <colspec colwidth="8*" align="left"/>
38592 <colspec colwidth="5*" align="center"/>
38593 <colspec colwidth="5*" align="center"/>
38594 <colspec colwidth="6*" align="right"/>
38595 <tbody>
38596 <row>
38597 <entry><option>mode</option></entry>
38598 <entry>Use: <emphasis>autoreply</emphasis></entry>
38599 <entry>Type: <emphasis>octal integer</emphasis></entry>
38600 <entry>Default: <emphasis>0600</emphasis></entry>
38601 </row>
38602 </tbody>
38603 </tgroup>
38604 </informaltable>
38605 <para>
38606 If either the log file or the <quote>once</quote> file has to be created, this mode is
38607 used.
38608 </para>
38609 <para>
38610 <indexterm role="option">
38611 <primary><option>never_mail</option></primary>
38612 </indexterm>
38613 </para>
38614 <informaltable frame="all">
38615 <tgroup cols="4" colsep="0" rowsep="0">
38616 <colspec colwidth="8*" align="left"/>
38617 <colspec colwidth="5*" align="center"/>
38618 <colspec colwidth="5*" align="center"/>
38619 <colspec colwidth="6*" align="right"/>
38620 <tbody>
38621 <row>
38622 <entry><option>never_mail</option></entry>
38623 <entry>Use: <emphasis>autoreply</emphasis></entry>
38624 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
38625 <entry>Default: <emphasis>unset</emphasis></entry>
38626 </row>
38627 </tbody>
38628 </tgroup>
38629 </informaltable>
38630 <para>
38631 If any run of the transport creates a message with a recipient that matches any
38632 item in the list, that recipient is quietly discarded. If all recipients are
38633 discarded, no message is created. This applies both when the recipients are
38634 generated by a filter and when they are specified in the transport.
38635 </para>
38636 <para>
38637 <indexterm role="option">
38638 <primary><option>once</option></primary>
38639 </indexterm>
38640 </para>
38641 <informaltable frame="all">
38642 <tgroup cols="4" colsep="0" rowsep="0">
38643 <colspec colwidth="8*" align="left"/>
38644 <colspec colwidth="5*" align="center"/>
38645 <colspec colwidth="5*" align="center"/>
38646 <colspec colwidth="6*" align="right"/>
38647 <tbody>
38648 <row>
38649 <entry><option>once</option></entry>
38650 <entry>Use: <emphasis>autoreply</emphasis></entry>
38651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38652 <entry>Default: <emphasis>unset</emphasis></entry>
38653 </row>
38654 </tbody>
38655 </tgroup>
38656 </informaltable>
38657 <para>
38658 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
38659 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
38660 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
38661 </para>
38662 <para>
38663 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
38664 By default, if <option>once</option> is set to a non-empty file name, the message
38665 is not sent if a potential recipient is already listed in the database.
38666 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
38667 message is sent if that much time has elapsed since a message was last sent to
38668 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
38669 prevents a message from being sent a second time &ndash; in this case, zero means
38670 infinity.
38671 </para>
38672 <para>
38673 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
38674 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
38675 greater than zero, it changes the way Exim implements the <option>once</option> option.
38676 Instead of using a DBM file to record every recipient it sends to, it uses a
38677 regular file, whose size will never get larger than the given value.
38678 </para>
38679 <para>
38680 In the file, Exim keeps a linear list of recipient addresses and the times at
38681 which they were sent messages. If the file is full when a new address needs to
38682 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
38683 means that a given recipient may receive multiple messages, but at
38684 unpredictable intervals that depend on the rate of turnover of addresses in the
38685 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
38686 </para>
38687 <para>
38688 <indexterm role="option">
38689 <primary><option>once_file_size</option></primary>
38690 </indexterm>
38691 </para>
38692 <informaltable frame="all">
38693 <tgroup cols="4" colsep="0" rowsep="0">
38694 <colspec colwidth="8*" align="left"/>
38695 <colspec colwidth="5*" align="center"/>
38696 <colspec colwidth="5*" align="center"/>
38697 <colspec colwidth="6*" align="right"/>
38698 <tbody>
38699 <row>
38700 <entry><option>once_file_size</option></entry>
38701 <entry>Use: <emphasis>autoreply</emphasis></entry>
38702 <entry>Type: <emphasis>integer</emphasis></entry>
38703 <entry>Default: <emphasis>0</emphasis></entry>
38704 </row>
38705 </tbody>
38706 </tgroup>
38707 </informaltable>
38708 <para>
38709 See <option>once</option> above.
38710 </para>
38711 <para>
38712 <indexterm role="option">
38713 <primary><option>once_repeat</option></primary>
38714 </indexterm>
38715 </para>
38716 <informaltable frame="all">
38717 <tgroup cols="4" colsep="0" rowsep="0">
38718 <colspec colwidth="8*" align="left"/>
38719 <colspec colwidth="5*" align="center"/>
38720 <colspec colwidth="5*" align="center"/>
38721 <colspec colwidth="6*" align="right"/>
38722 <tbody>
38723 <row>
38724 <entry><option>once_repeat</option></entry>
38725 <entry>Use: <emphasis>autoreply</emphasis></entry>
38726 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
38727 <entry>Default: <emphasis>0s</emphasis></entry>
38728 </row>
38729 </tbody>
38730 </tgroup>
38731 </informaltable>
38732 <para>
38733 See <option>once</option> above.
38734 After expansion, the value of this option must be a valid time value.
38735 </para>
38736 <para>
38737 <indexterm role="option">
38738 <primary><option>reply_to</option></primary>
38739 </indexterm>
38740 </para>
38741 <informaltable frame="all">
38742 <tgroup cols="4" colsep="0" rowsep="0">
38743 <colspec colwidth="8*" align="left"/>
38744 <colspec colwidth="5*" align="center"/>
38745 <colspec colwidth="5*" align="center"/>
38746 <colspec colwidth="6*" align="right"/>
38747 <tbody>
38748 <row>
38749 <entry><option>reply_to</option></entry>
38750 <entry>Use: <emphasis>autoreply</emphasis></entry>
38751 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38752 <entry>Default: <emphasis>unset</emphasis></entry>
38753 </row>
38754 </tbody>
38755 </tgroup>
38756 </informaltable>
38757 <para>
38758 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
38759 specified by the transport.
38760 </para>
38761 <para>
38762 <indexterm role="option">
38763 <primary><option>return_message</option></primary>
38764 </indexterm>
38765 </para>
38766 <informaltable frame="all">
38767 <tgroup cols="4" colsep="0" rowsep="0">
38768 <colspec colwidth="8*" align="left"/>
38769 <colspec colwidth="5*" align="center"/>
38770 <colspec colwidth="5*" align="center"/>
38771 <colspec colwidth="6*" align="right"/>
38772 <tbody>
38773 <row>
38774 <entry><option>return_message</option></entry>
38775 <entry>Use: <emphasis>autoreply</emphasis></entry>
38776 <entry>Type: <emphasis>boolean</emphasis></entry>
38777 <entry>Default: <emphasis>false</emphasis></entry>
38778 </row>
38779 </tbody>
38780 </tgroup>
38781 </informaltable>
38782 <para>
38783 If this is set, a copy of the original message is returned with the new
38784 message, subject to the maximum size set in the <option>return_size_limit</option> global
38785 configuration option.
38786 </para>
38787 <para>
38788 <indexterm role="option">
38789 <primary><option>subject</option></primary>
38790 </indexterm>
38791 </para>
38792 <informaltable frame="all">
38793 <tgroup cols="4" colsep="0" rowsep="0">
38794 <colspec colwidth="8*" align="left"/>
38795 <colspec colwidth="5*" align="center"/>
38796 <colspec colwidth="5*" align="center"/>
38797 <colspec colwidth="6*" align="right"/>
38798 <tbody>
38799 <row>
38800 <entry><option>subject</option></entry>
38801 <entry>Use: <emphasis>autoreply</emphasis></entry>
38802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38803 <entry>Default: <emphasis>unset</emphasis></entry>
38804 </row>
38805 </tbody>
38806 </tgroup>
38807 </informaltable>
38808 <para>
38809 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
38810 specified by the transport. It is tempting to quote the original subject in
38811 automatic responses. For example:
38812 </para>
38813 <literallayout class="monospaced">
38814 subject = Re: $h_subject:
38815 </literallayout>
38816 <para>
38817 There is a danger in doing this, however. It may allow a third party to
38818 subscribe your users to an opt-in mailing list, provided that the list accepts
38819 bounce messages as subscription confirmations. Well-managed lists require a
38820 non-bounce message to confirm a subscription, so the danger is relatively
38821 small.
38822 </para>
38823 <para>
38824 <indexterm role="option">
38825 <primary><option>text</option></primary>
38826 </indexterm>
38827 </para>
38828 <informaltable frame="all">
38829 <tgroup cols="4" colsep="0" rowsep="0">
38830 <colspec colwidth="8*" align="left"/>
38831 <colspec colwidth="5*" align="center"/>
38832 <colspec colwidth="5*" align="center"/>
38833 <colspec colwidth="6*" align="right"/>
38834 <tbody>
38835 <row>
38836 <entry><option>text</option></entry>
38837 <entry>Use: <emphasis>autoreply</emphasis></entry>
38838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38839 <entry>Default: <emphasis>unset</emphasis></entry>
38840 </row>
38841 </tbody>
38842 </tgroup>
38843 </informaltable>
38844 <para>
38845 This specifies a single string to be used as the body of the message when the
38846 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
38847 the text comes first.
38848 </para>
38849 <para>
38850 <indexterm role="option">
38851 <primary><option>to</option></primary>
38852 </indexterm>
38853 </para>
38854 <informaltable frame="all">
38855 <tgroup cols="4" colsep="0" rowsep="0">
38856 <colspec colwidth="8*" align="left"/>
38857 <colspec colwidth="5*" align="center"/>
38858 <colspec colwidth="5*" align="center"/>
38859 <colspec colwidth="6*" align="right"/>
38860 <tbody>
38861 <row>
38862 <entry><option>to</option></entry>
38863 <entry>Use: <emphasis>autoreply</emphasis></entry>
38864 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38865 <entry>Default: <emphasis>unset</emphasis></entry>
38866 </row>
38867 </tbody>
38868 </tgroup>
38869 </informaltable>
38870 <para>
38871 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
38872 when the message is specified by the transport.
38873 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
38874 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
38875 </para>
38876 </section>
38877 </chapter>
38878
38879 <chapter id="CHAPLMTP">
38880 <title>The lmtp transport</title>
38881 <para>
38882 <indexterm role="concept">
38883 <primary>transports</primary>
38884 <secondary><command>lmtp</command></secondary>
38885 </indexterm>
38886 <indexterm role="concept">
38887 <primary><command>lmtp</command> transport</primary>
38888 </indexterm>
38889 <indexterm role="concept">
38890 <primary>LMTP</primary>
38891 <secondary>over a pipe</secondary>
38892 </indexterm>
38893 <indexterm role="concept">
38894 <primary>LMTP</primary>
38895 <secondary>over a socket</secondary>
38896 </indexterm>
38897 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
38898 specified command
38899 or by interacting with a Unix domain socket.
38900 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
38901 transports. Exim also has support for using LMTP over TCP/IP; this is
38902 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
38903 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
38904 has it commented out. You need to ensure that
38905 </para>
38906 <literallayout class="monospaced">
38907 TRANSPORT_LMTP=yes
38908 </literallayout>
38909 <para>
38910 <indexterm role="concept">
38911 <primary>options</primary>
38912 <secondary><command>lmtp</command> transport</secondary>
38913 </indexterm>
38914 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
38915 included in the Exim binary. The private options of the <command>lmtp</command> transport are
38916 as follows:
38917 </para>
38918 <para>
38919 <indexterm role="option">
38920 <primary><option>batch_id</option></primary>
38921 </indexterm>
38922 </para>
38923 <informaltable frame="all">
38924 <tgroup cols="4" colsep="0" rowsep="0">
38925 <colspec colwidth="8*" align="left"/>
38926 <colspec colwidth="5*" align="center"/>
38927 <colspec colwidth="5*" align="center"/>
38928 <colspec colwidth="6*" align="right"/>
38929 <tbody>
38930 <row>
38931 <entry><option>batch_id</option></entry>
38932 <entry>Use: <emphasis>lmtp</emphasis></entry>
38933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38934 <entry>Default: <emphasis>unset</emphasis></entry>
38935 </row>
38936 </tbody>
38937 </tgroup>
38938 </informaltable>
38939 <para>
38940 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38941 </para>
38942 <para>
38943 <indexterm role="option">
38944 <primary><option>batch_max</option></primary>
38945 </indexterm>
38946 </para>
38947 <informaltable frame="all">
38948 <tgroup cols="4" colsep="0" rowsep="0">
38949 <colspec colwidth="8*" align="left"/>
38950 <colspec colwidth="5*" align="center"/>
38951 <colspec colwidth="5*" align="center"/>
38952 <colspec colwidth="6*" align="right"/>
38953 <tbody>
38954 <row>
38955 <entry><option>batch_max</option></entry>
38956 <entry>Use: <emphasis>lmtp</emphasis></entry>
38957 <entry>Type: <emphasis>integer</emphasis></entry>
38958 <entry>Default: <emphasis>1</emphasis></entry>
38959 </row>
38960 </tbody>
38961 </tgroup>
38962 </informaltable>
38963 <para>
38964 This limits the number of addresses that can be handled in a single delivery.
38965 Most LMTP servers can handle several addresses at once, so it is normally a
38966 good idea to increase this value. See the description of local delivery
38967 batching in chapter <xref linkend="CHAPbatching"/>.
38968 </para>
38969 <para>
38970 <indexterm role="option">
38971 <primary><option>command</option></primary>
38972 </indexterm>
38973 </para>
38974 <informaltable frame="all">
38975 <tgroup cols="4" colsep="0" rowsep="0">
38976 <colspec colwidth="8*" align="left"/>
38977 <colspec colwidth="5*" align="center"/>
38978 <colspec colwidth="5*" align="center"/>
38979 <colspec colwidth="6*" align="right"/>
38980 <tbody>
38981 <row>
38982 <entry><option>command</option></entry>
38983 <entry>Use: <emphasis>lmtp</emphasis></entry>
38984 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38985 <entry>Default: <emphasis>unset</emphasis></entry>
38986 </row>
38987 </tbody>
38988 </tgroup>
38989 </informaltable>
38990 <para>
38991 This option must be set if <option>socket</option> is not set. The string is a command which
38992 is run in a separate process. It is split up into a command name and list of
38993 arguments, each of which is separately expanded (so expansion cannot change the
38994 number of arguments). The command is run directly, not via a shell. The message
38995 is passed to the new process using the standard input and output to operate the
38996 LMTP protocol.
38997 </para>
38998 <para>
38999 <indexterm role="option">
39000 <primary><option>ignore_quota</option></primary>
39001 </indexterm>
39002 </para>
39003 <informaltable frame="all">
39004 <tgroup cols="4" colsep="0" rowsep="0">
39005 <colspec colwidth="8*" align="left"/>
39006 <colspec colwidth="5*" align="center"/>
39007 <colspec colwidth="5*" align="center"/>
39008 <colspec colwidth="6*" align="right"/>
39009 <tbody>
39010 <row>
39011 <entry><option>ignore_quota</option></entry>
39012 <entry>Use: <emphasis>lmtp</emphasis></entry>
39013 <entry>Type: <emphasis>boolean</emphasis></entry>
39014 <entry>Default: <emphasis>false</emphasis></entry>
39015 </row>
39016 </tbody>
39017 </tgroup>
39018 </informaltable>
39019 <para>
39020 <indexterm role="concept">
39021 <primary>LMTP</primary>
39022 <secondary>ignoring quota errors</secondary>
39023 </indexterm>
39024 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
39025 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
39026 in its response to the LHLO command.
39027 </para>
39028 <para>
39029 <indexterm role="option">
39030 <primary><option>socket</option></primary>
39031 </indexterm>
39032 </para>
39033 <informaltable frame="all">
39034 <tgroup cols="4" colsep="0" rowsep="0">
39035 <colspec colwidth="8*" align="left"/>
39036 <colspec colwidth="5*" align="center"/>
39037 <colspec colwidth="5*" align="center"/>
39038 <colspec colwidth="6*" align="right"/>
39039 <tbody>
39040 <row>
39041 <entry><option>socket</option></entry>
39042 <entry>Use: <emphasis>lmtp</emphasis></entry>
39043 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39044 <entry>Default: <emphasis>unset</emphasis></entry>
39045 </row>
39046 </tbody>
39047 </tgroup>
39048 </informaltable>
39049 <para>
39050 This option must be set if <option>command</option> is not set. The result of expansion must
39051 be the name of a Unix domain socket. The transport connects to the socket and
39052 delivers the message to it using the LMTP protocol.
39053 </para>
39054 <para>
39055 <indexterm role="option">
39056 <primary><option>timeout</option></primary>
39057 </indexterm>
39058 </para>
39059 <informaltable frame="all">
39060 <tgroup cols="4" colsep="0" rowsep="0">
39061 <colspec colwidth="8*" align="left"/>
39062 <colspec colwidth="5*" align="center"/>
39063 <colspec colwidth="5*" align="center"/>
39064 <colspec colwidth="6*" align="right"/>
39065 <tbody>
39066 <row>
39067 <entry><option>timeout</option></entry>
39068 <entry>Use: <emphasis>lmtp</emphasis></entry>
39069 <entry>Type: <emphasis>time</emphasis></entry>
39070 <entry>Default: <emphasis>5m</emphasis></entry>
39071 </row>
39072 </tbody>
39073 </tgroup>
39074 </informaltable>
39075 <para>
39076 The transport is aborted if the created process
39077 or Unix domain socket
39078 does not respond to LMTP commands or message input within this timeout.
39079 </para>
39080 <para>
39081 Here is an example of a typical LMTP transport:
39082 </para>
39083 <literallayout class="monospaced">
39084 lmtp:
39085   driver = lmtp
39086   command = /some/local/lmtp/delivery/program
39087   batch_max = 20
39088   user = exim
39089 </literallayout>
39090 <para>
39091 This delivers up to 20 addresses at a time, in a mixture of domains if
39092 necessary, running as the user <emphasis>exim</emphasis>.
39093 </para>
39094 </chapter>
39095
39096 <chapter id="CHAPpipetransport">
39097 <title>The pipe transport</title>
39098 <para>
39099 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
39100 <primary>transports</primary>
39101 <secondary><command>pipe</command></secondary>
39102 </indexterm>
39103 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
39104 <primary><command>pipe</command> transport</primary>
39105 </indexterm>
39106 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
39107 running in another process. One example is the use of <command>pipe</command> as a
39108 pseudo-remote transport for passing messages to some other delivery mechanism
39109 (such as UUCP). Another is the use by individual users to automatically process
39110 their incoming messages. The <command>pipe</command> transport can be used in one of the
39111 following ways:
39112 </para>
39113 <itemizedlist>
39114 <listitem>
39115 <para>
39116 <indexterm role="concept">
39117 <primary><varname>$local_part</varname></primary>
39118 </indexterm>
39119 A router routes one address to a transport in the normal way, and the
39120 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
39121 contains the local part of the address (as usual), and the command that is run
39122 is specified by the <option>command</option> option on the transport.
39123 </para>
39124 </listitem>
39125 <listitem>
39126 <para>
39127 <indexterm role="concept">
39128 <primary><varname>$pipe_addresses</varname></primary>
39129 </indexterm>
39130 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
39131 transport can handle more than one address in a single run. In this case, when
39132 more than one address is routed to the transport, <varname>$local_part</varname> is not set
39133 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
39134 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
39135 that are routed to the transport.
39136 </para>
39137 </listitem>
39138 <listitem>
39139 <para>
39140 <indexterm role="concept">
39141 <primary><varname>$address_pipe</varname></primary>
39142 </indexterm>
39143 A router redirects an address directly to a pipe command (for example, from an
39144 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
39145 pipe command, and the <option>command</option> option on the transport is ignored. If only
39146 one address is being transported (<option>batch_max</option> is not greater than one, or
39147 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
39148 the local part that was redirected.
39149 </para>
39150 </listitem>
39151 </itemizedlist>
39152 <para>
39153 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
39154 deliver messages over pipes using the LMTP interactive protocol. This is
39155 implemented by the <command>lmtp</command> transport.
39156 </para>
39157 <para>
39158 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
39159 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
39160 other cases, the uid and gid have to be specified explicitly, either on the
39161 transport or on the router that handles the address. Current and <quote>home</quote>
39162 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
39163 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
39164 for a discussion of local delivery batching.
39165 </para>
39166 <section>
39167 <title>Concurrent delivery</title>
39168 <para>
39169 If two messages arrive at almost the same time, and both are routed to a pipe
39170 delivery, the two pipe transports may be run concurrently. You must ensure that
39171 any pipe commands you set up are robust against this happening. If the commands
39172 write to a file, the <option>exim_lock</option> utility might be of use.
39173 </para>
39174 </section>
39175 <section>
39176 <title>Returned status and data</title>
39177 <para>
39178 <indexterm role="concept">
39179 <primary><command>pipe</command> transport</primary>
39180 <secondary>returned data</secondary>
39181 </indexterm>
39182 If the command exits with a non-zero return code, the delivery is deemed to
39183 have failed, unless either the <option>ignore_status</option> option is set (in which case
39184 the return code is treated as zero), or the return code is one of those listed
39185 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
39186 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
39187 logged, but are not included in the bounce message, which merely contains
39188 <quote>local delivery failed</quote>.
39189 </para>
39190 <para>
39191 If the return code is greater than 128 and the command being run is a shell
39192 script, it normally means that the script was terminated by a signal whose
39193 value is the return code minus 128.
39194 </para>
39195 <para>
39196 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
39197 return code is set to 127. This is the value that a shell returns if it is
39198 asked to run a non-existent command. The wording for the log line suggests that
39199 a non-existent command may be the problem.
39200 </para>
39201 <para>
39202 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
39203 set and the command produces any output on its standard output or standard
39204 error streams, the command is considered to have failed, even if it gave a zero
39205 return code or if <option>ignore_status</option> is set. The output from the command is
39206 included as part of the bounce message. The <option>return_fail_output</option> option is
39207 similar, except that output is returned only when the command exits with a
39208 failure return code, that is, a value other than zero or a code that matches
39209 <option>temp_errors</option>.
39210 </para>
39211 </section>
39212 <section id="SECThowcommandrun">
39213 <title>How the command is run</title>
39214 <para>
39215 <indexterm role="concept">
39216 <primary><command>pipe</command> transport</primary>
39217 <secondary>path for command</secondary>
39218 </indexterm>
39219 The command line is (by default) broken down into a command name and arguments
39220 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
39221 <option>restrict_to_path</option> options can be used to restrict the commands that may be
39222 run.
39223 </para>
39224 <para>
39225 <indexterm role="concept">
39226 <primary>quoting</primary>
39227 <secondary>in pipe command</secondary>
39228 </indexterm>
39229 Unquoted arguments are delimited by white space. If an argument appears in
39230 double quotes, backslash is interpreted as an escape character in the usual
39231 way. If an argument appears in single quotes, no escaping is done.
39232 </para>
39233 <para>
39234 String expansion is applied to the command line except when it comes from a
39235 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
39236 expansion is applied to each argument in turn rather than to the whole line.
39237 For this reason, any string expansion item that contains white space must be
39238 quoted so as to be contained within a single argument. A setting such as
39239 </para>
39240 <literallayout class="monospaced">
39241 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
39242 </literallayout>
39243 <para>
39244 will not work, because the expansion item gets split between several
39245 arguments. You have to write
39246 </para>
39247 <literallayout class="monospaced">
39248 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
39249 </literallayout>
39250 <para>
39251 to ensure that it is all in one argument. The expansion is done in this way,
39252 argument by argument, so that the number of arguments cannot be changed as a
39253 result of expansion, and quotes or backslashes in inserted variables do not
39254 interact with external quoting. However, this leads to problems if you want to
39255 generate multiple arguments (or the command name plus arguments) from a single
39256 expansion. In this situation, the simplest solution is to use a shell. For
39257 example:
39258 </para>
39259 <literallayout class="monospaced">
39260 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
39261 </literallayout>
39262 <para>
39263 <indexterm role="concept">
39264 <primary>transport</primary>
39265 <secondary>filter</secondary>
39266 </indexterm>
39267 <indexterm role="concept">
39268 <primary>filter</primary>
39269 <secondary>transport filter</secondary>
39270 </indexterm>
39271 <indexterm role="concept">
39272 <primary><varname>$pipe_addresses</varname></primary>
39273 </indexterm>
39274 Special handling takes place when an argument consists of precisely the text
39275 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
39276 place this string is recognized is when it appears as an argument for a pipe or
39277 transport filter command. It causes each address that is being handled to be
39278 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
39279 avoids any problems with spaces or shell metacharacters, and is of use when a
39280 <command>pipe</command> transport is handling groups of addresses in a batch.
39281 </para>
39282 <para>
39283 After splitting up into arguments and expansion, the resulting command is run
39284 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
39285 message that is being delivered is supplied on the standard input, and the
39286 standard output and standard error are both connected to a single pipe that is
39287 read by Exim. The <option>max_output</option> option controls how much output the command
39288 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
39289 control what is done with it.
39290 </para>
39291 <para>
39292 Not running the command under a shell (by default) lessens the security risks
39293 in cases when a command from a user&#x2019;s filter file is built out of data that was
39294 taken from an incoming message. If a shell is required, it can of course be
39295 explicitly specified as the command to be run. However, there are circumstances
39296 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
39297 under a shell and cannot easily be modified. To allow for these cases, there is
39298 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
39299 works. Instead of breaking up the command line as just described, it expands it
39300 as a single string and passes the result to <filename>/bin/sh</filename>. The
39301 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
39302 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
39303 </para>
39304 </section>
39305 <section id="SECTpipeenv">
39306 <title>Environment variables</title>
39307 <para>
39308 <indexterm role="concept">
39309 <primary><command>pipe</command> transport</primary>
39310 <secondary>environment for command</secondary>
39311 </indexterm>
39312 <indexterm role="concept">
39313 <primary>environment for pipe transport</primary>
39314 </indexterm>
39315 The environment variables listed below are set up when the command is invoked.
39316 This list is a compromise for maximum compatibility with other MTAs. Note that
39317 the <option>environment</option> option can be used to add additional variables to this
39318 environment.
39319 </para>
39320 <literallayout>
39321 <literal>DOMAIN            </literal>   the domain of the address
39322 <literal>HOME              </literal>   the home directory, if set
39323 <literal>HOST              </literal>   the host name when called from a router (see below)
39324 <literal>LOCAL_PART        </literal>   see below
39325 <literal>LOCAL_PART_PREFIX </literal>   see below
39326 <literal>LOCAL_PART_SUFFIX </literal>   see below
39327 <literal>LOGNAME           </literal>   see below
39328 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
39329 <literal>PATH              </literal>   as specified by the <option>path</option> option below
39330 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
39331 <literal>RECIPIENT         </literal>   the complete recipient address
39332 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
39333 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
39334 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
39335 <literal>USER              </literal>   see below
39336 </literallayout>
39337 <para>
39338 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
39339 router, LOCAL_PART is set to the local part of the address. When it is
39340 called as a result of a forward or alias expansion, LOCAL_PART is set to
39341 the local part of the address that was expanded. In both cases, any affixes are
39342 removed from the local part, and made available in LOCAL_PART_PREFIX and
39343 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
39344 same value as LOCAL_PART for compatibility with other MTAs.
39345 </para>
39346 <para>
39347 <indexterm role="concept">
39348 <primary>HOST</primary>
39349 </indexterm>
39350 HOST is set only when a <command>pipe</command> transport is called from a router that
39351 associates hosts with an address, typically when using <command>pipe</command> as a
39352 pseudo-remote transport. HOST is set to the first host name specified by
39353 the router.
39354 </para>
39355 <para>
39356 <indexterm role="concept">
39357 <primary>HOME</primary>
39358 </indexterm>
39359 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
39360 for the HOME environment variable. Otherwise, a home directory may be set
39361 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
39362 user&#x2019;s home directory if <option>check_local_user</option> is set.
39363 </para>
39364 </section>
39365 <section>
39366 <title>Private options for pipe</title>
39367 <para>
39368 <indexterm role="concept">
39369 <primary>options</primary>
39370 <secondary><command>pipe</command> transport</secondary>
39371 </indexterm>
39372 </para>
39373 <para>
39374 <indexterm role="option">
39375 <primary><option>allow_commands</option></primary>
39376 </indexterm>
39377 </para>
39378 <informaltable frame="all">
39379 <tgroup cols="4" colsep="0" rowsep="0">
39380 <colspec colwidth="8*" align="left"/>
39381 <colspec colwidth="5*" align="center"/>
39382 <colspec colwidth="5*" align="center"/>
39383 <colspec colwidth="6*" align="right"/>
39384 <tbody>
39385 <row>
39386 <entry><option>allow_commands</option></entry>
39387 <entry>Use: <emphasis>pipe</emphasis></entry>
39388 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
39389 <entry>Default: <emphasis>unset</emphasis></entry>
39390 </row>
39391 </tbody>
39392 </tgroup>
39393 </informaltable>
39394 <para>
39395 <indexterm role="concept">
39396 <primary><command>pipe</command> transport</primary>
39397 <secondary>permitted commands</secondary>
39398 </indexterm>
39399 The string is expanded, and is then interpreted as a colon-separated list of
39400 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
39401 permitted are those in the <option>allow_commands</option> list. They need not be absolute
39402 paths; the <option>path</option> option is still used for relative paths. If
39403 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
39404 in the <option>allow_commands</option> list, or a name without any slashes that is found on
39405 the path. In other words, if neither <option>allow_commands</option> nor
39406 <option>restrict_to_path</option> is set, there is no restriction on the command, but
39407 otherwise only commands that are permitted by one or the other are allowed. For
39408 example, if
39409 </para>
39410 <literallayout class="monospaced">
39411 allow_commands = /usr/bin/vacation
39412 </literallayout>
39413 <para>
39414 and <option>restrict_to_path</option> is not set, the only permitted command is
39415 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
39416 <option>use_shell</option> is set.
39417 </para>
39418 <para>
39419 <indexterm role="option">
39420 <primary><option>batch_id</option></primary>
39421 </indexterm>
39422 </para>
39423 <informaltable frame="all">
39424 <tgroup cols="4" colsep="0" rowsep="0">
39425 <colspec colwidth="8*" align="left"/>
39426 <colspec colwidth="5*" align="center"/>
39427 <colspec colwidth="5*" align="center"/>
39428 <colspec colwidth="6*" align="right"/>
39429 <tbody>
39430 <row>
39431 <entry><option>batch_id</option></entry>
39432 <entry>Use: <emphasis>pipe</emphasis></entry>
39433 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39434 <entry>Default: <emphasis>unset</emphasis></entry>
39435 </row>
39436 </tbody>
39437 </tgroup>
39438 </informaltable>
39439 <para>
39440 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39441 </para>
39442 <para>
39443 <indexterm role="option">
39444 <primary><option>batch_max</option></primary>
39445 </indexterm>
39446 </para>
39447 <informaltable frame="all">
39448 <tgroup cols="4" colsep="0" rowsep="0">
39449 <colspec colwidth="8*" align="left"/>
39450 <colspec colwidth="5*" align="center"/>
39451 <colspec colwidth="5*" align="center"/>
39452 <colspec colwidth="6*" align="right"/>
39453 <tbody>
39454 <row>
39455 <entry><option>batch_max</option></entry>
39456 <entry>Use: <emphasis>pipe</emphasis></entry>
39457 <entry>Type: <emphasis>integer</emphasis></entry>
39458 <entry>Default: <emphasis>1</emphasis></entry>
39459 </row>
39460 </tbody>
39461 </tgroup>
39462 </informaltable>
39463 <para>
39464 This limits the number of addresses that can be handled in a single delivery.
39465 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39466 </para>
39467 <para>
39468 <indexterm role="option">
39469 <primary><option>check_string</option></primary>
39470 </indexterm>
39471 </para>
39472 <informaltable frame="all">
39473 <tgroup cols="4" colsep="0" rowsep="0">
39474 <colspec colwidth="8*" align="left"/>
39475 <colspec colwidth="5*" align="center"/>
39476 <colspec colwidth="5*" align="center"/>
39477 <colspec colwidth="6*" align="right"/>
39478 <tbody>
39479 <row>
39480 <entry><option>check_string</option></entry>
39481 <entry>Use: <emphasis>pipe</emphasis></entry>
39482 <entry>Type: <emphasis>string</emphasis></entry>
39483 <entry>Default: <emphasis>unset</emphasis></entry>
39484 </row>
39485 </tbody>
39486 </tgroup>
39487 </informaltable>
39488 <para>
39489 As <command>pipe</command> writes the message, the start of each line is tested for matching
39490 <option>check_string</option>, and if it does, the initial matching characters are replaced
39491 by the contents of <option>escape_string</option>, provided both are set. The value of
39492 <option>check_string</option> is a literal string, not a regular expression, and the case of
39493 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
39494 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
39495 the SMTP escaping protocol. Any settings made in the configuration file are
39496 ignored.
39497 </para>
39498 <para>
39499 <indexterm role="option">
39500 <primary><option>command</option></primary>
39501 </indexterm>
39502 </para>
39503 <informaltable frame="all">
39504 <tgroup cols="4" colsep="0" rowsep="0">
39505 <colspec colwidth="8*" align="left"/>
39506 <colspec colwidth="5*" align="center"/>
39507 <colspec colwidth="5*" align="center"/>
39508 <colspec colwidth="6*" align="right"/>
39509 <tbody>
39510 <row>
39511 <entry><option>command</option></entry>
39512 <entry>Use: <emphasis>pipe</emphasis></entry>
39513 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39514 <entry>Default: <emphasis>unset</emphasis></entry>
39515 </row>
39516 </tbody>
39517 </tgroup>
39518 </informaltable>
39519 <para>
39520 This option need not be set when <command>pipe</command> is being used to deliver to pipes
39521 obtained directly from address redirections. In other cases, the option must be
39522 set, to provide a command to be run. It need not yield an absolute path (see
39523 the <option>path</option> option below). The command is split up into separate arguments by
39524 Exim, and each argument is separately expanded, as described in section
39525 <xref linkend="SECThowcommandrun"/> above.
39526 </para>
39527 <para>
39528 <indexterm role="option">
39529 <primary><option>environment</option></primary>
39530 </indexterm>
39531 </para>
39532 <informaltable frame="all">
39533 <tgroup cols="4" colsep="0" rowsep="0">
39534 <colspec colwidth="8*" align="left"/>
39535 <colspec colwidth="5*" align="center"/>
39536 <colspec colwidth="5*" align="center"/>
39537 <colspec colwidth="6*" align="right"/>
39538 <tbody>
39539 <row>
39540 <entry><option>environment</option></entry>
39541 <entry>Use: <emphasis>pipe</emphasis></entry>
39542 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39543 <entry>Default: <emphasis>unset</emphasis></entry>
39544 </row>
39545 </tbody>
39546 </tgroup>
39547 </informaltable>
39548 <para>
39549 <indexterm role="concept">
39550 <primary><command>pipe</command> transport</primary>
39551 <secondary>environment for command</secondary>
39552 </indexterm>
39553 <indexterm role="concept">
39554 <primary>environment for <command>pipe</command> transport</primary>
39555 </indexterm>
39556 This option is used to add additional variables to the environment in which the
39557 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
39558 a string which is expanded, and then interpreted as a colon-separated list of
39559 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
39560 </para>
39561 <para>
39562 <indexterm role="option">
39563 <primary><option>escape_string</option></primary>
39564 </indexterm>
39565 </para>
39566 <informaltable frame="all">
39567 <tgroup cols="4" colsep="0" rowsep="0">
39568 <colspec colwidth="8*" align="left"/>
39569 <colspec colwidth="5*" align="center"/>
39570 <colspec colwidth="5*" align="center"/>
39571 <colspec colwidth="6*" align="right"/>
39572 <tbody>
39573 <row>
39574 <entry><option>escape_string</option></entry>
39575 <entry>Use: <emphasis>pipe</emphasis></entry>
39576 <entry>Type: <emphasis>string</emphasis></entry>
39577 <entry>Default: <emphasis>unset</emphasis></entry>
39578 </row>
39579 </tbody>
39580 </tgroup>
39581 </informaltable>
39582 <para>
39583 See <option>check_string</option> above.
39584 </para>
39585 <para>
39586 <indexterm role="option">
39587 <primary><option>freeze_exec_fail</option></primary>
39588 </indexterm>
39589 </para>
39590 <informaltable frame="all">
39591 <tgroup cols="4" colsep="0" rowsep="0">
39592 <colspec colwidth="8*" align="left"/>
39593 <colspec colwidth="5*" align="center"/>
39594 <colspec colwidth="5*" align="center"/>
39595 <colspec colwidth="6*" align="right"/>
39596 <tbody>
39597 <row>
39598 <entry><option>freeze_exec_fail</option></entry>
39599 <entry>Use: <emphasis>pipe</emphasis></entry>
39600 <entry>Type: <emphasis>boolean</emphasis></entry>
39601 <entry>Default: <emphasis>false</emphasis></entry>
39602 </row>
39603 </tbody>
39604 </tgroup>
39605 </informaltable>
39606 <para>
39607 <indexterm role="concept">
39608 <primary>exec failure</primary>
39609 </indexterm>
39610 <indexterm role="concept">
39611 <primary>failure of exec</primary>
39612 </indexterm>
39613 <indexterm role="concept">
39614 <primary><command>pipe</command> transport</primary>
39615 <secondary>failure of exec</secondary>
39616 </indexterm>
39617 Failure to exec the command in a pipe transport is by default treated like
39618 any other failure while running the command. However, if <option>freeze_exec_fail</option>
39619 is set, failure to exec is treated specially, and causes the message to be
39620 frozen, whatever the setting of <option>ignore_status</option>.
39621 </para>
39622 <para>
39623 <indexterm role="option">
39624 <primary><option>ignore_status</option></primary>
39625 </indexterm>
39626 </para>
39627 <informaltable frame="all">
39628 <tgroup cols="4" colsep="0" rowsep="0">
39629 <colspec colwidth="8*" align="left"/>
39630 <colspec colwidth="5*" align="center"/>
39631 <colspec colwidth="5*" align="center"/>
39632 <colspec colwidth="6*" align="right"/>
39633 <tbody>
39634 <row>
39635 <entry><option>ignore_status</option></entry>
39636 <entry>Use: <emphasis>pipe</emphasis></entry>
39637 <entry>Type: <emphasis>boolean</emphasis></entry>
39638 <entry>Default: <emphasis>false</emphasis></entry>
39639 </row>
39640 </tbody>
39641 </tgroup>
39642 </informaltable>
39643 <para>
39644 If this option is true, the status returned by the subprocess that is set up to
39645 run the command is ignored, and Exim behaves as if zero had been returned.
39646 Otherwise, a non-zero status or termination by signal causes an error return
39647 from the transport unless the status value is one of those listed in
39648 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
39649 </para>
39650 <para>
39651 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
39652 See the <option>timeout_defer</option> option for how timeouts are handled.
39653 </para>
39654 <para>
39655 <indexterm role="option">
39656 <primary><option>log_defer_output</option></primary>
39657 </indexterm>
39658 </para>
39659 <informaltable frame="all">
39660 <tgroup cols="4" colsep="0" rowsep="0">
39661 <colspec colwidth="8*" align="left"/>
39662 <colspec colwidth="5*" align="center"/>
39663 <colspec colwidth="5*" align="center"/>
39664 <colspec colwidth="6*" align="right"/>
39665 <tbody>
39666 <row>
39667 <entry><option>log_defer_output</option></entry>
39668 <entry>Use: <emphasis>pipe</emphasis></entry>
39669 <entry>Type: <emphasis>boolean</emphasis></entry>
39670 <entry>Default: <emphasis>false</emphasis></entry>
39671 </row>
39672 </tbody>
39673 </tgroup>
39674 </informaltable>
39675 <para>
39676 <indexterm role="concept">
39677 <primary><command>pipe</command> transport</primary>
39678 <secondary>logging output</secondary>
39679 </indexterm>
39680 If this option is set, and the status returned by the command is
39681 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
39682 and any output was produced, the first line of it is written to the main log.
39683 </para>
39684 <para>
39685 <indexterm role="option">
39686 <primary><option>log_fail_output</option></primary>
39687 </indexterm>
39688 </para>
39689 <informaltable frame="all">
39690 <tgroup cols="4" colsep="0" rowsep="0">
39691 <colspec colwidth="8*" align="left"/>
39692 <colspec colwidth="5*" align="center"/>
39693 <colspec colwidth="5*" align="center"/>
39694 <colspec colwidth="6*" align="right"/>
39695 <tbody>
39696 <row>
39697 <entry><option>log_fail_output</option></entry>
39698 <entry>Use: <emphasis>pipe</emphasis></entry>
39699 <entry>Type: <emphasis>boolean</emphasis></entry>
39700 <entry>Default: <emphasis>false</emphasis></entry>
39701 </row>
39702 </tbody>
39703 </tgroup>
39704 </informaltable>
39705 <para>
39706 If this option is set, and the command returns any output, and also ends with a
39707 return code that is neither zero nor one of the return codes listed in
39708 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
39709 written to the main log. This option and <option>log_output</option> are mutually exclusive.
39710 Only one of them may be set.
39711 </para>
39712 <para>
39713 <indexterm role="option">
39714 <primary><option>log_output</option></primary>
39715 </indexterm>
39716 </para>
39717 <informaltable frame="all">
39718 <tgroup cols="4" colsep="0" rowsep="0">
39719 <colspec colwidth="8*" align="left"/>
39720 <colspec colwidth="5*" align="center"/>
39721 <colspec colwidth="5*" align="center"/>
39722 <colspec colwidth="6*" align="right"/>
39723 <tbody>
39724 <row>
39725 <entry><option>log_output</option></entry>
39726 <entry>Use: <emphasis>pipe</emphasis></entry>
39727 <entry>Type: <emphasis>boolean</emphasis></entry>
39728 <entry>Default: <emphasis>false</emphasis></entry>
39729 </row>
39730 </tbody>
39731 </tgroup>
39732 </informaltable>
39733 <para>
39734 If this option is set and the command returns any output, the first line of
39735 output is written to the main log, whatever the return code. This option and
39736 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
39737 </para>
39738 <para>
39739 <indexterm role="option">
39740 <primary><option>max_output</option></primary>
39741 </indexterm>
39742 </para>
39743 <informaltable frame="all">
39744 <tgroup cols="4" colsep="0" rowsep="0">
39745 <colspec colwidth="8*" align="left"/>
39746 <colspec colwidth="5*" align="center"/>
39747 <colspec colwidth="5*" align="center"/>
39748 <colspec colwidth="6*" align="right"/>
39749 <tbody>
39750 <row>
39751 <entry><option>max_output</option></entry>
39752 <entry>Use: <emphasis>pipe</emphasis></entry>
39753 <entry>Type: <emphasis>integer</emphasis></entry>
39754 <entry>Default: <emphasis>20K</emphasis></entry>
39755 </row>
39756 </tbody>
39757 </tgroup>
39758 </informaltable>
39759 <para>
39760 This specifies the maximum amount of output that the command may produce on its
39761 standard output and standard error file combined. If the limit is exceeded, the
39762 process running the command is killed. This is intended as a safety measure to
39763 catch runaway processes. The limit is applied independently of the settings of
39764 the options that control what is done with such output (for example,
39765 <option>return_output</option>). Because of buffering effects, the amount of output may
39766 exceed the limit by a small amount before Exim notices.
39767 </para>
39768 <para>
39769 <indexterm role="option">
39770 <primary><option>message_prefix</option></primary>
39771 </indexterm>
39772 </para>
39773 <informaltable frame="all">
39774 <tgroup cols="4" colsep="0" rowsep="0">
39775 <colspec colwidth="8*" align="left"/>
39776 <colspec colwidth="5*" align="center"/>
39777 <colspec colwidth="5*" align="center"/>
39778 <colspec colwidth="6*" align="right"/>
39779 <tbody>
39780 <row>
39781 <entry><option>message_prefix</option></entry>
39782 <entry>Use: <emphasis>pipe</emphasis></entry>
39783 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39784 <entry>Default: <emphasis>see below</emphasis></entry>
39785 </row>
39786 </tbody>
39787 </tgroup>
39788 </informaltable>
39789 <para>
39790 The string specified here is expanded and output at the start of every message.
39791 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
39792 </para>
39793 <literallayout class="monospaced">
39794 message_prefix = \
39795   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
39796   ${tod_bsdinbox}\n
39797 </literallayout>
39798 <para>
39799 <indexterm role="concept">
39800 <primary>Cyrus</primary>
39801 </indexterm>
39802 <indexterm role="concept">
39803 <primary><option>tmail</option></primary>
39804 </indexterm>
39805 <indexterm role="concept">
39806 <primary><quote>From</quote> line</primary>
39807 </indexterm>
39808 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
39809 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
39810 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
39811 setting
39812 </para>
39813 <literallayout class="monospaced">
39814 message_prefix =
39815 </literallayout>
39816 <para>
39817 <indexterm role="option">
39818 <primary><option>message_suffix</option></primary>
39819 </indexterm>
39820 </para>
39821 <informaltable frame="all">
39822 <tgroup cols="4" colsep="0" rowsep="0">
39823 <colspec colwidth="8*" align="left"/>
39824 <colspec colwidth="5*" align="center"/>
39825 <colspec colwidth="5*" align="center"/>
39826 <colspec colwidth="6*" align="right"/>
39827 <tbody>
39828 <row>
39829 <entry><option>message_suffix</option></entry>
39830 <entry>Use: <emphasis>pipe</emphasis></entry>
39831 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39832 <entry>Default: <emphasis>see below</emphasis></entry>
39833 </row>
39834 </tbody>
39835 </tgroup>
39836 </informaltable>
39837 <para>
39838 The string specified here is expanded and output at the end of every message.
39839 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
39840 The suffix can be suppressed by setting
39841 </para>
39842 <literallayout class="monospaced">
39843 message_suffix =
39844 </literallayout>
39845 <para>
39846 <indexterm role="option">
39847 <primary><option>path</option></primary>
39848 </indexterm>
39849 </para>
39850 <informaltable frame="all">
39851 <tgroup cols="4" colsep="0" rowsep="0">
39852 <colspec colwidth="8*" align="left"/>
39853 <colspec colwidth="5*" align="center"/>
39854 <colspec colwidth="5*" align="center"/>
39855 <colspec colwidth="6*" align="right"/>
39856 <tbody>
39857 <row>
39858 <entry><option>path</option></entry>
39859 <entry>Use: <emphasis>pipe</emphasis></entry>
39860 <entry>Type: <emphasis>string</emphasis></entry>
39861 <entry>Default: <emphasis><literal>/bin:/usr/bin</literal></emphasis></entry>
39862 </row>
39863 </tbody>
39864 </tgroup>
39865 </informaltable>
39866 <para>
39867 This option specifies the string that is set up in the PATH environment
39868 variable of the subprocess. If the <option>command</option> option does not yield an
39869 absolute path name, the command is sought in the PATH directories, in the usual
39870 way. <emphasis role="bold">Warning</emphasis>: This does not apply to a command specified as a transport
39871 filter.
39872 </para>
39873 <para>
39874 <indexterm role="option">
39875 <primary><option>pipe_as_creator</option></primary>
39876 </indexterm>
39877 </para>
39878 <informaltable frame="all">
39879 <tgroup cols="4" colsep="0" rowsep="0">
39880 <colspec colwidth="8*" align="left"/>
39881 <colspec colwidth="5*" align="center"/>
39882 <colspec colwidth="5*" align="center"/>
39883 <colspec colwidth="6*" align="right"/>
39884 <tbody>
39885 <row>
39886 <entry><option>pipe_as_creator</option></entry>
39887 <entry>Use: <emphasis>pipe</emphasis></entry>
39888 <entry>Type: <emphasis>boolean</emphasis></entry>
39889 <entry>Default: <emphasis>false</emphasis></entry>
39890 </row>
39891 </tbody>
39892 </tgroup>
39893 </informaltable>
39894 <para>
39895 <indexterm role="concept">
39896 <primary>uid (user id)</primary>
39897 <secondary>local delivery</secondary>
39898 </indexterm>
39899 If the generic <option>user</option> option is not set and this option is true, the delivery
39900 process is run under the uid that was in force when Exim was originally called
39901 to accept the message. If the group id is not otherwise set (via the generic
39902 <option>group</option> option), the gid that was in force when Exim was originally called to
39903 accept the message is used.
39904 </para>
39905 <para>
39906 <indexterm role="option">
39907 <primary><option>restrict_to_path</option></primary>
39908 </indexterm>
39909 </para>
39910 <informaltable frame="all">
39911 <tgroup cols="4" colsep="0" rowsep="0">
39912 <colspec colwidth="8*" align="left"/>
39913 <colspec colwidth="5*" align="center"/>
39914 <colspec colwidth="5*" align="center"/>
39915 <colspec colwidth="6*" align="right"/>
39916 <tbody>
39917 <row>
39918 <entry><option>restrict_to_path</option></entry>
39919 <entry>Use: <emphasis>pipe</emphasis></entry>
39920 <entry>Type: <emphasis>boolean</emphasis></entry>
39921 <entry>Default: <emphasis>false</emphasis></entry>
39922 </row>
39923 </tbody>
39924 </tgroup>
39925 </informaltable>
39926 <para>
39927 When this option is set, any command name not listed in <option>allow_commands</option> must
39928 contain no slashes. The command is searched for only in the directories listed
39929 in the <option>path</option> option. This option is intended for use in the case when a pipe
39930 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
39931 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
39932 </para>
39933 <para>
39934 <indexterm role="option">
39935 <primary><option>return_fail_output</option></primary>
39936 </indexterm>
39937 </para>
39938 <informaltable frame="all">
39939 <tgroup cols="4" colsep="0" rowsep="0">
39940 <colspec colwidth="8*" align="left"/>
39941 <colspec colwidth="5*" align="center"/>
39942 <colspec colwidth="5*" align="center"/>
39943 <colspec colwidth="6*" align="right"/>
39944 <tbody>
39945 <row>
39946 <entry><option>return_fail_output</option></entry>
39947 <entry>Use: <emphasis>pipe</emphasis></entry>
39948 <entry>Type: <emphasis>boolean</emphasis></entry>
39949 <entry>Default: <emphasis>false</emphasis></entry>
39950 </row>
39951 </tbody>
39952 </tgroup>
39953 </informaltable>
39954 <para>
39955 If this option is true, and the command produced any output and ended with a
39956 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
39957 is, the delivery failed), the output is returned in the bounce message.
39958 However, if the message has a null sender (that is, it is itself a bounce
39959 message), output from the command is discarded. This option and
39960 <option>return_output</option> are mutually exclusive. Only one of them may be set.
39961 </para>
39962 <para>
39963 <indexterm role="option">
39964 <primary><option>return_output</option></primary>
39965 </indexterm>
39966 </para>
39967 <informaltable frame="all">
39968 <tgroup cols="4" colsep="0" rowsep="0">
39969 <colspec colwidth="8*" align="left"/>
39970 <colspec colwidth="5*" align="center"/>
39971 <colspec colwidth="5*" align="center"/>
39972 <colspec colwidth="6*" align="right"/>
39973 <tbody>
39974 <row>
39975 <entry><option>return_output</option></entry>
39976 <entry>Use: <emphasis>pipe</emphasis></entry>
39977 <entry>Type: <emphasis>boolean</emphasis></entry>
39978 <entry>Default: <emphasis>false</emphasis></entry>
39979 </row>
39980 </tbody>
39981 </tgroup>
39982 </informaltable>
39983 <para>
39984 If this option is true, and the command produced any output, the delivery is
39985 deemed to have failed whatever the return code from the command, and the output
39986 is returned in the bounce message. Otherwise, the output is just discarded.
39987 However, if the message has a null sender (that is, it is a bounce message),
39988 output from the command is always discarded, whatever the setting of this
39989 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
39990 of them may be set.
39991 </para>
39992 <para>
39993 <indexterm role="option">
39994 <primary><option>temp_errors</option></primary>
39995 </indexterm>
39996 </para>
39997 <informaltable frame="all">
39998 <tgroup cols="4" colsep="0" rowsep="0">
39999 <colspec colwidth="8*" align="left"/>
40000 <colspec colwidth="5*" align="center"/>
40001 <colspec colwidth="5*" align="center"/>
40002 <colspec colwidth="6*" align="right"/>
40003 <tbody>
40004 <row>
40005 <entry><option>temp_errors</option></entry>
40006 <entry>Use: <emphasis>pipe</emphasis></entry>
40007 <entry>Type: <emphasis>string list</emphasis></entry>
40008 <entry>Default: <emphasis>see below</emphasis></entry>
40009 </row>
40010 </tbody>
40011 </tgroup>
40012 </informaltable>
40013 <para>
40014 <indexterm role="concept">
40015 <primary><command>pipe</command> transport</primary>
40016 <secondary>temporary failure</secondary>
40017 </indexterm>
40018 This option contains either a colon-separated list of numbers, or a single
40019 asterisk. If <option>ignore_status</option> is false
40020 and <option>return_output</option> is not set,
40021 and the command exits with a non-zero return code, the failure is treated as
40022 temporary and the delivery is deferred if the return code matches one of the
40023 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
40024 codes are treated as permanent errors. The default setting contains the codes
40025 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
40026 compiled on a system that does not define these macros, it assumes values of 75
40027 and 73, respectively.
40028 </para>
40029 <para>
40030 <indexterm role="option">
40031 <primary><option>timeout</option></primary>
40032 </indexterm>
40033 </para>
40034 <informaltable frame="all">
40035 <tgroup cols="4" colsep="0" rowsep="0">
40036 <colspec colwidth="8*" align="left"/>
40037 <colspec colwidth="5*" align="center"/>
40038 <colspec colwidth="5*" align="center"/>
40039 <colspec colwidth="6*" align="right"/>
40040 <tbody>
40041 <row>
40042 <entry><option>timeout</option></entry>
40043 <entry>Use: <emphasis>pipe</emphasis></entry>
40044 <entry>Type: <emphasis>time</emphasis></entry>
40045 <entry>Default: <emphasis>1h</emphasis></entry>
40046 </row>
40047 </tbody>
40048 </tgroup>
40049 </informaltable>
40050 <para>
40051 If the command fails to complete within this time, it is killed. This normally
40052 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
40053 specifies no timeout. In order to ensure that any subprocesses created by the
40054 command are also killed, Exim makes the initial process a process group leader,
40055 and kills the whole process group on a timeout. However, this can be defeated
40056 if one of the processes starts a new process group.
40057 </para>
40058 <para>
40059 <indexterm role="option">
40060 <primary><option>timeout_defer</option></primary>
40061 </indexterm>
40062 </para>
40063 <informaltable frame="all">
40064 <tgroup cols="4" colsep="0" rowsep="0">
40065 <colspec colwidth="8*" align="left"/>
40066 <colspec colwidth="5*" align="center"/>
40067 <colspec colwidth="5*" align="center"/>
40068 <colspec colwidth="6*" align="right"/>
40069 <tbody>
40070 <row>
40071 <entry><option>timeout_defer</option></entry>
40072 <entry>Use: <emphasis>pipe</emphasis></entry>
40073 <entry>Type: <emphasis>boolean</emphasis></entry>
40074 <entry>Default: <emphasis>false</emphasis></entry>
40075 </row>
40076 </tbody>
40077 </tgroup>
40078 </informaltable>
40079 <para>
40080 A timeout in a <command>pipe</command> transport, either in the command that the transport
40081 runs, or in a transport filter that is associated with it, is by default
40082 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
40083 is set true, both kinds of timeout become temporary errors, causing the
40084 delivery to be deferred.
40085 </para>
40086 <para>
40087 <indexterm role="option">
40088 <primary><option>umask</option></primary>
40089 </indexterm>
40090 </para>
40091 <informaltable frame="all">
40092 <tgroup cols="4" colsep="0" rowsep="0">
40093 <colspec colwidth="8*" align="left"/>
40094 <colspec colwidth="5*" align="center"/>
40095 <colspec colwidth="5*" align="center"/>
40096 <colspec colwidth="6*" align="right"/>
40097 <tbody>
40098 <row>
40099 <entry><option>umask</option></entry>
40100 <entry>Use: <emphasis>pipe</emphasis></entry>
40101 <entry>Type: <emphasis>octal integer</emphasis></entry>
40102 <entry>Default: <emphasis>022</emphasis></entry>
40103 </row>
40104 </tbody>
40105 </tgroup>
40106 </informaltable>
40107 <para>
40108 This specifies the umask setting for the subprocess that runs the command.
40109 </para>
40110 <para>
40111 <indexterm role="option">
40112 <primary><option>use_bsmtp</option></primary>
40113 </indexterm>
40114 </para>
40115 <informaltable frame="all">
40116 <tgroup cols="4" colsep="0" rowsep="0">
40117 <colspec colwidth="8*" align="left"/>
40118 <colspec colwidth="5*" align="center"/>
40119 <colspec colwidth="5*" align="center"/>
40120 <colspec colwidth="6*" align="right"/>
40121 <tbody>
40122 <row>
40123 <entry><option>use_bsmtp</option></entry>
40124 <entry>Use: <emphasis>pipe</emphasis></entry>
40125 <entry>Type: <emphasis>boolean</emphasis></entry>
40126 <entry>Default: <emphasis>false</emphasis></entry>
40127 </row>
40128 </tbody>
40129 </tgroup>
40130 </informaltable>
40131 <para>
40132 <indexterm role="concept">
40133 <primary>envelope sender</primary>
40134 </indexterm>
40135 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
40136 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
40137 commands. If you want to include a leading HELO command with such messages,
40138 you can do so by setting the <option>message_prefix</option> option. See section
40139 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
40140 </para>
40141 <para>
40142 <indexterm role="option">
40143 <primary><option>use_classresources</option></primary>
40144 </indexterm>
40145 </para>
40146 <informaltable frame="all">
40147 <tgroup cols="4" colsep="0" rowsep="0">
40148 <colspec colwidth="8*" align="left"/>
40149 <colspec colwidth="5*" align="center"/>
40150 <colspec colwidth="5*" align="center"/>
40151 <colspec colwidth="6*" align="right"/>
40152 <tbody>
40153 <row>
40154 <entry><option>use_classresources</option></entry>
40155 <entry>Use: <emphasis>pipe</emphasis></entry>
40156 <entry>Type: <emphasis>boolean</emphasis></entry>
40157 <entry>Default: <emphasis>false</emphasis></entry>
40158 </row>
40159 </tbody>
40160 </tgroup>
40161 </informaltable>
40162 <para>
40163 <indexterm role="concept">
40164 <primary>class resources (BSD)</primary>
40165 </indexterm>
40166 This option is available only when Exim is running on FreeBSD, NetBSD, or
40167 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
40168 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
40169 limits for the uid under which the pipe is to run are obtained from the login
40170 class database.
40171 </para>
40172 <para>
40173 <indexterm role="option">
40174 <primary><option>use_crlf</option></primary>
40175 </indexterm>
40176 </para>
40177 <informaltable frame="all">
40178 <tgroup cols="4" colsep="0" rowsep="0">
40179 <colspec colwidth="8*" align="left"/>
40180 <colspec colwidth="5*" align="center"/>
40181 <colspec colwidth="5*" align="center"/>
40182 <colspec colwidth="6*" align="right"/>
40183 <tbody>
40184 <row>
40185 <entry><option>use_crlf</option></entry>
40186 <entry>Use: <emphasis>pipe</emphasis></entry>
40187 <entry>Type: <emphasis>boolean</emphasis></entry>
40188 <entry>Default: <emphasis>false</emphasis></entry>
40189 </row>
40190 </tbody>
40191 </tgroup>
40192 </informaltable>
40193 <para>
40194 <indexterm role="concept">
40195 <primary>carriage return</primary>
40196 </indexterm>
40197 <indexterm role="concept">
40198 <primary>linefeed</primary>
40199 </indexterm>
40200 This option causes lines to be terminated with the two-character CRLF sequence
40201 (carriage return, linefeed) instead of just a linefeed character. In the case
40202 of batched SMTP, the byte sequence written to the pipe is then an exact image
40203 of what would be sent down a real SMTP connection.
40204 </para>
40205 <para>
40206 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
40207 written verbatim, so must contain their own carriage return characters if these
40208 are needed. Since the default values for both <option>message_prefix</option> and
40209 <option>message_suffix</option> end with a single linefeed, their values must be changed to
40210 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
40211 </para>
40212 <para>
40213 <indexterm role="option">
40214 <primary><option>use_shell</option></primary>
40215 </indexterm>
40216 </para>
40217 <informaltable frame="all">
40218 <tgroup cols="4" colsep="0" rowsep="0">
40219 <colspec colwidth="8*" align="left"/>
40220 <colspec colwidth="5*" align="center"/>
40221 <colspec colwidth="5*" align="center"/>
40222 <colspec colwidth="6*" align="right"/>
40223 <tbody>
40224 <row>
40225 <entry><option>use_shell</option></entry>
40226 <entry>Use: <emphasis>pipe</emphasis></entry>
40227 <entry>Type: <emphasis>boolean</emphasis></entry>
40228 <entry>Default: <emphasis>false</emphasis></entry>
40229 </row>
40230 </tbody>
40231 </tgroup>
40232 </informaltable>
40233 <para>
40234 <indexterm role="concept">
40235 <primary><varname>$pipe_addresses</varname></primary>
40236 </indexterm>
40237 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
40238 instead of being run directly from the transport, as described in section
40239 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
40240 where the command is expected to be run under a shell and cannot easily be
40241 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
40242 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
40243 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
40244 its <option>-c</option> option.
40245 </para>
40246 </section>
40247 <section>
40248 <title>Using an external local delivery agent</title>
40249 <para>
40250 <indexterm role="concept">
40251 <primary>local delivery</primary>
40252 <secondary>using an external agent</secondary>
40253 </indexterm>
40254 <indexterm role="concept">
40255 <primary><emphasis>procmail</emphasis></primary>
40256 </indexterm>
40257 <indexterm role="concept">
40258 <primary>external local delivery</primary>
40259 </indexterm>
40260 <indexterm role="concept">
40261 <primary>delivery</primary>
40262 <secondary><emphasis>procmail</emphasis></secondary>
40263 </indexterm>
40264 <indexterm role="concept">
40265 <primary>delivery</primary>
40266 <secondary>by external agent</secondary>
40267 </indexterm>
40268 The <command>pipe</command> transport can be used to pass all messages that require local
40269 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
40270 this, care must be taken to ensure that the pipe is run under an appropriate
40271 uid and gid. In some configurations one wants this to be a uid that is trusted
40272 by the delivery agent to supply the correct sender of the message. It may be
40273 necessary to recompile or reconfigure the delivery agent so that it trusts an
40274 appropriate user. The following is an example transport and router
40275 configuration for <option>procmail</option>:
40276 </para>
40277 <literallayout class="monospaced">
40278 # transport
40279 procmail_pipe:
40280   driver = pipe
40281   command = /usr/local/bin/procmail -d $local_part
40282   return_path_add
40283   delivery_date_add
40284   envelope_to_add
40285   check_string = "From "
40286   escape_string = "&gt;From "
40287   user = $local_part
40288   group = mail
40289
40290 # router
40291 procmail:
40292   driver = accept
40293   check_local_user
40294   transport = procmail_pipe
40295 </literallayout>
40296 <para>
40297 In this example, the pipe is run as the local user, but with the group set to
40298 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
40299 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
40300 user to supply a correct sender address. If you do not specify either a
40301 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
40302 home directory is the user&#x2019;s home directory by default.
40303 </para>
40304 <para>
40305 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
40306 </para>
40307 <literallayout class="monospaced">
40308 IFS=" "
40309 </literallayout>
40310 <para>
40311 as shown in some <option>procmail</option> documentation, because Exim does not by default
40312 use a shell to run pipe commands.
40313 </para>
40314 <para>
40315 <indexterm role="concept">
40316 <primary>Cyrus</primary>
40317 </indexterm>
40318 The next example shows a transport and a router for a system where local
40319 deliveries are handled by the Cyrus IMAP server.
40320 </para>
40321 <literallayout class="monospaced">
40322 # transport
40323 local_delivery_cyrus:
40324   driver = pipe
40325   command = /usr/cyrus/bin/deliver \
40326             -m ${substr_1:$local_part_suffix} -- $local_part
40327   user = cyrus
40328   group = mail
40329   return_output
40330   log_output
40331   message_prefix =
40332   message_suffix =
40333
40334 # router
40335 local_user_cyrus:
40336   driver = accept
40337   check_local_user
40338   local_part_suffix = .*
40339   transport = local_delivery_cyrus
40340 </literallayout>
40341 <para>
40342 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
40343 <option>return_output</option> to cause any text written by Cyrus to be returned to the
40344 sender.
40345 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
40346 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
40347 </para>
40348 </section>
40349 </chapter>
40350
40351 <chapter id="CHAPsmtptrans">
40352 <title>The smtp transport</title>
40353 <para>
40354 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
40355 <primary>transports</primary>
40356 <secondary><command>smtp</command></secondary>
40357 </indexterm>
40358 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
40359 <primary><command>smtp</command> transport</primary>
40360 </indexterm>
40361 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
40362 or LMTP protocol. The list of hosts to try can either be taken from the address
40363 that is being processed (having been set up by the router), or specified
40364 explicitly for the transport. Timeout and retry processing (see chapter
40365 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
40366 </para>
40367 <section>
40368 <title>Multiple messages on a single connection</title>
40369 <para>
40370 The sending of multiple messages over a single TCP/IP connection can arise in
40371 two ways:
40372 </para>
40373 <itemizedlist>
40374 <listitem>
40375 <para>
40376 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
40377 routed to the same host, more than one copy of the message has to be sent to
40378 that host. In this situation, multiple copies may be sent in a single run of
40379 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
40380 does when it has too many addresses to send in one message also depends on the
40381 value of the global <option>remote_max_parallel</option> option. Details are given in
40382 section <xref linkend="SECToutSMTPTCP"/>.)
40383 </para>
40384 </listitem>
40385 <listitem>
40386 <para>
40387 <indexterm role="concept">
40388 <primary>hints database</primary>
40389 <secondary>remembering routing</secondary>
40390 </indexterm>
40391 When a message has been successfully delivered over a TCP/IP connection, Exim
40392 looks in its hints database to see if there are any other messages awaiting a
40393 connection to the same host. If there are, a new delivery process is started
40394 for one of them, and the current TCP/IP connection is passed on to it. The new
40395 process may in turn send multiple copies and possibly create yet another
40396 process.
40397 </para>
40398 </listitem>
40399 </itemizedlist>
40400 <para>
40401 For each copy sent over the same TCP/IP connection, a sequence counter is
40402 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
40403 no further messages are sent over that connection.
40404 </para>
40405 </section>
40406 <section>
40407 <title>Use of the $host variable</title>
40408 <para>
40409 <indexterm role="concept">
40410 <primary><varname>$host</varname></primary>
40411 </indexterm>
40412 <indexterm role="concept">
40413 <primary><varname>$host_address</varname></primary>
40414 </indexterm>
40415 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
40416 <varname>$host_address</varname> are the name and IP address of the first host on the host list
40417 passed by the router. However, when the transport is about to connect to a
40418 specific host, and while it is connected to that host, <varname>$host</varname> and
40419 <varname>$host_address</varname> are set to the values for that host. These are the values
40420 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
40421 <option>serialize_hosts</option>, and the various TLS options are expanded.
40422 </para>
40423 </section>
40424 <section>
40425 <title>Private options for smtp</title>
40426 <para>
40427 <indexterm role="concept">
40428 <primary>options</primary>
40429 <secondary><command>smtp</command> transport</secondary>
40430 </indexterm>
40431 The private options of the <command>smtp</command> transport are as follows:
40432 </para>
40433 <para revisionflag="changed">
40434 <indexterm role="option">
40435 <primary><option>address_retry_include_sender</option></primary>
40436 </indexterm>
40437 </para>
40438 <informaltable frame="all" revisionflag="changed">
40439 <tgroup cols="4" colsep="0" rowsep="0">
40440 <colspec colwidth="8*" align="left"/>
40441 <colspec colwidth="5*" align="center"/>
40442 <colspec colwidth="5*" align="center"/>
40443 <colspec colwidth="6*" align="right"/>
40444 <tbody>
40445 <row>
40446 <entry><option>address_retry_include_sender</option></entry>
40447 <entry>Use: <emphasis>smtp</emphasis></entry>
40448 <entry>Type: <emphasis>boolean</emphasis></entry>
40449 <entry>Default: <emphasis>true</emphasis></entry>
40450 </row>
40451 </tbody>
40452 </tgroup>
40453 </informaltable>
40454 <para revisionflag="changed">
40455 <indexterm role="concept">
40456 <primary>4<emphasis>xx</emphasis> responses</primary>
40457 <secondary>retrying after</secondary>
40458 </indexterm>
40459 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
40460 is the combination of sender and recipient that is delayed in subsequent queue
40461 runs until the retry time is reached. You can delay the recipient without
40462 reference to the sender (which is what earlier versions of Exim did), by
40463 setting <option>address_retry_include_sender</option> false. However, this can lead to
40464 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
40465 </para>
40466 <para>
40467 <indexterm role="option">
40468 <primary><option>allow_localhost</option></primary>
40469 </indexterm>
40470 </para>
40471 <informaltable frame="all">
40472 <tgroup cols="4" colsep="0" rowsep="0">
40473 <colspec colwidth="8*" align="left"/>
40474 <colspec colwidth="5*" align="center"/>
40475 <colspec colwidth="5*" align="center"/>
40476 <colspec colwidth="6*" align="right"/>
40477 <tbody>
40478 <row>
40479 <entry><option>allow_localhost</option></entry>
40480 <entry>Use: <emphasis>smtp</emphasis></entry>
40481 <entry>Type: <emphasis>boolean</emphasis></entry>
40482 <entry>Default: <emphasis>false</emphasis></entry>
40483 </row>
40484 </tbody>
40485 </tgroup>
40486 </informaltable>
40487 <para>
40488 <indexterm role="concept">
40489 <primary>local host</primary>
40490 <secondary>sending to</secondary>
40491 </indexterm>
40492 <indexterm role="concept">
40493 <primary>fallback</primary>
40494 <secondary>hosts specified on transport</secondary>
40495 </indexterm>
40496 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
40497 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
40498 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
40499 the delivery anyway. This should be used only in special cases when the
40500 configuration ensures that no looping will result (for example, a differently
40501 configured Exim is listening on the port to which the message is sent).
40502 </para>
40503 <para>
40504 <indexterm role="option">
40505 <primary><option>authenticated_sender</option></primary>
40506 </indexterm>
40507 </para>
40508 <informaltable frame="all">
40509 <tgroup cols="4" colsep="0" rowsep="0">
40510 <colspec colwidth="8*" align="left"/>
40511 <colspec colwidth="5*" align="center"/>
40512 <colspec colwidth="5*" align="center"/>
40513 <colspec colwidth="6*" align="right"/>
40514 <tbody>
40515 <row>
40516 <entry><option>authenticated_sender</option></entry>
40517 <entry>Use: <emphasis>smtp</emphasis></entry>
40518 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40519 <entry>Default: <emphasis>unset</emphasis></entry>
40520 </row>
40521 </tbody>
40522 </tgroup>
40523 </informaltable>
40524 <para>
40525 <indexterm role="concept">
40526 <primary>Cyrus</primary>
40527 </indexterm>
40528 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
40529 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
40530 overriding any existing authenticated sender value. If the string expansion is
40531 forced to fail, the option is ignored. Other expansion failures cause delivery
40532 to be deferred. If the result of expansion is an empty string, that is also
40533 ignored.
40534 </para>
40535 <para>
40536 If the SMTP session is not authenticated, the expansion of
40537 <option>authenticated_sender</option> still happens (and can cause the delivery to be
40538 deferred if it fails), but no AUTH= item is added to MAIL commands
40539 unless <option>authenticated_sender_force</option> is true.
40540 </para>
40541 <para>
40542 This option allows you to use the <command>smtp</command> transport in LMTP mode to
40543 deliver mail to Cyrus IMAP and provide the proper local part as the
40544 <quote>authenticated sender</quote>, via a setting such as:
40545 </para>
40546 <literallayout class="monospaced">
40547 authenticated_sender = $local_part
40548 </literallayout>
40549 <para>
40550 This removes the need for IMAP subfolders to be assigned special ACLs to
40551 allow direct delivery to those subfolders.
40552 </para>
40553 <para>
40554 Because of expected uses such as that just described for Cyrus (when no
40555 domain is involved), there is no checking on the syntax of the provided
40556 value.
40557 </para>
40558 <para>
40559 <indexterm role="option">
40560 <primary><option>authenticated_sender_force</option></primary>
40561 </indexterm>
40562 </para>
40563 <informaltable frame="all">
40564 <tgroup cols="4" colsep="0" rowsep="0">
40565 <colspec colwidth="8*" align="left"/>
40566 <colspec colwidth="5*" align="center"/>
40567 <colspec colwidth="5*" align="center"/>
40568 <colspec colwidth="6*" align="right"/>
40569 <tbody>
40570 <row>
40571 <entry><option>authenticated_sender_force</option></entry>
40572 <entry>Use: <emphasis>smtp</emphasis></entry>
40573 <entry>Type: <emphasis>boolean</emphasis></entry>
40574 <entry>Default: <emphasis>false</emphasis></entry>
40575 </row>
40576 </tbody>
40577 </tgroup>
40578 </informaltable>
40579 <para>
40580 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
40581 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
40582 authenticated as a client.
40583 </para>
40584 <para>
40585 <indexterm role="option">
40586 <primary><option>command_timeout</option></primary>
40587 </indexterm>
40588 </para>
40589 <informaltable frame="all">
40590 <tgroup cols="4" colsep="0" rowsep="0">
40591 <colspec colwidth="8*" align="left"/>
40592 <colspec colwidth="5*" align="center"/>
40593 <colspec colwidth="5*" align="center"/>
40594 <colspec colwidth="6*" align="right"/>
40595 <tbody>
40596 <row>
40597 <entry><option>command_timeout</option></entry>
40598 <entry>Use: <emphasis>smtp</emphasis></entry>
40599 <entry>Type: <emphasis>time</emphasis></entry>
40600 <entry>Default: <emphasis>5m</emphasis></entry>
40601 </row>
40602 </tbody>
40603 </tgroup>
40604 </informaltable>
40605 <para>
40606 This sets a timeout for receiving a response to an SMTP command that has been
40607 sent out. It is also used when waiting for the initial banner line from the
40608 remote host. Its value must not be zero.
40609 </para>
40610 <para>
40611 <indexterm role="option">
40612 <primary><option>connect_timeout</option></primary>
40613 </indexterm>
40614 </para>
40615 <informaltable frame="all">
40616 <tgroup cols="4" colsep="0" rowsep="0">
40617 <colspec colwidth="8*" align="left"/>
40618 <colspec colwidth="5*" align="center"/>
40619 <colspec colwidth="5*" align="center"/>
40620 <colspec colwidth="6*" align="right"/>
40621 <tbody>
40622 <row>
40623 <entry><option>connect_timeout</option></entry>
40624 <entry>Use: <emphasis>smtp</emphasis></entry>
40625 <entry>Type: <emphasis>time</emphasis></entry>
40626 <entry>Default: <emphasis>5m</emphasis></entry>
40627 </row>
40628 </tbody>
40629 </tgroup>
40630 </informaltable>
40631 <para>
40632 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
40633 to a remote host. A setting of zero allows the system timeout (typically
40634 several minutes) to act. To have any effect, the value of this option must be
40635 less than the system timeout. However, it has been observed that on some
40636 systems there is no system timeout, which is why the default value for this
40637 option is 5 minutes, a value recommended by RFC 1123.
40638 </para>
40639 <para>
40640 <indexterm role="option">
40641 <primary><option>connection_max_messages</option></primary>
40642 </indexterm>
40643 </para>
40644 <informaltable frame="all">
40645 <tgroup cols="4" colsep="0" rowsep="0">
40646 <colspec colwidth="8*" align="left"/>
40647 <colspec colwidth="5*" align="center"/>
40648 <colspec colwidth="5*" align="center"/>
40649 <colspec colwidth="6*" align="right"/>
40650 <tbody>
40651 <row>
40652 <entry><option>connection_max_messages</option></entry>
40653 <entry>Use: <emphasis>smtp</emphasis></entry>
40654 <entry>Type: <emphasis>integer</emphasis></entry>
40655 <entry>Default: <emphasis>500</emphasis></entry>
40656 </row>
40657 </tbody>
40658 </tgroup>
40659 </informaltable>
40660 <para>
40661 <indexterm role="concept">
40662 <primary>SMTP</primary>
40663 <secondary>passed connection</secondary>
40664 </indexterm>
40665 <indexterm role="concept">
40666 <primary>SMTP</primary>
40667 <secondary>multiple deliveries</secondary>
40668 </indexterm>
40669 <indexterm role="concept">
40670 <primary>multiple SMTP deliveries</primary>
40671 </indexterm>
40672 This controls the maximum number of separate message deliveries that are sent
40673 over a single TCP/IP connection. If the value is zero, there is no limit.
40674 For testing purposes, this value can be overridden by the <option>-oB</option> command line
40675 option.
40676 </para>
40677 <para>
40678 <indexterm role="option">
40679 <primary><option>data_timeout</option></primary>
40680 </indexterm>
40681 </para>
40682 <informaltable frame="all">
40683 <tgroup cols="4" colsep="0" rowsep="0">
40684 <colspec colwidth="8*" align="left"/>
40685 <colspec colwidth="5*" align="center"/>
40686 <colspec colwidth="5*" align="center"/>
40687 <colspec colwidth="6*" align="right"/>
40688 <tbody>
40689 <row>
40690 <entry><option>data_timeout</option></entry>
40691 <entry>Use: <emphasis>smtp</emphasis></entry>
40692 <entry>Type: <emphasis>time</emphasis></entry>
40693 <entry>Default: <emphasis>5m</emphasis></entry>
40694 </row>
40695 </tbody>
40696 </tgroup>
40697 </informaltable>
40698 <para>
40699 This sets a timeout for the transmission of each block in the data portion of
40700 the message. As a result, the overall timeout for a message depends on the size
40701 of the message. Its value must not be zero. See also <option>final_timeout</option>.
40702 </para>
40703 <para>
40704 <indexterm role="option">
40705 <primary><option>delay_after_cutoff</option></primary>
40706 </indexterm>
40707 </para>
40708 <informaltable frame="all">
40709 <tgroup cols="4" colsep="0" rowsep="0">
40710 <colspec colwidth="8*" align="left"/>
40711 <colspec colwidth="5*" align="center"/>
40712 <colspec colwidth="5*" align="center"/>
40713 <colspec colwidth="6*" align="right"/>
40714 <tbody>
40715 <row>
40716 <entry><option>delay_after_cutoff</option></entry>
40717 <entry>Use: <emphasis>smtp</emphasis></entry>
40718 <entry>Type: <emphasis>boolean</emphasis></entry>
40719 <entry>Default: <emphasis>true</emphasis></entry>
40720 </row>
40721 </tbody>
40722 </tgroup>
40723 </informaltable>
40724 <para>
40725 This option controls what happens when all remote IP addresses for a given
40726 domain have been inaccessible for so long that they have passed their retry
40727 cutoff times.
40728 </para>
40729 <para>
40730 In the default state, if the next retry time has not been reached for any of
40731 them, the address is bounced without trying any deliveries. In other words,
40732 Exim delays retrying an IP address after the final cutoff time until a new
40733 retry time is reached, and can therefore bounce an address without ever trying
40734 a delivery, when machines have been down for a long time. Some people are
40735 unhappy at this prospect, so...
40736 </para>
40737 <para>
40738 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
40739 addresses are past their final cutoff time, Exim tries to deliver to those
40740 IP addresses that have not been tried since the message arrived. If there are
40741 none, of if they all fail, the address is bounced. In other words, it does not
40742 delay when a new message arrives, but immediately tries those expired IP
40743 addresses that haven&#x2019;t been tried since the message arrived. If there is a
40744 continuous stream of messages for the dead hosts, unsetting
40745 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
40746 to them.
40747 </para>
40748 <para>
40749 <indexterm role="option">
40750 <primary><option>dns_qualify_single</option></primary>
40751 </indexterm>
40752 </para>
40753 <informaltable frame="all">
40754 <tgroup cols="4" colsep="0" rowsep="0">
40755 <colspec colwidth="8*" align="left"/>
40756 <colspec colwidth="5*" align="center"/>
40757 <colspec colwidth="5*" align="center"/>
40758 <colspec colwidth="6*" align="right"/>
40759 <tbody>
40760 <row>
40761 <entry><option>dns_qualify_single</option></entry>
40762 <entry>Use: <emphasis>smtp</emphasis></entry>
40763 <entry>Type: <emphasis>boolean</emphasis></entry>
40764 <entry>Default: <emphasis>true</emphasis></entry>
40765 </row>
40766 </tbody>
40767 </tgroup>
40768 </informaltable>
40769 <para>
40770 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
40771 and the <option>gethostbyname</option> option is false,
40772 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
40773 in chapter <xref linkend="CHAPdnslookup"/> for more details.
40774 </para>
40775 <para>
40776 <indexterm role="option">
40777 <primary><option>dns_search_parents</option></primary>
40778 </indexterm>
40779 </para>
40780 <informaltable frame="all">
40781 <tgroup cols="4" colsep="0" rowsep="0">
40782 <colspec colwidth="8*" align="left"/>
40783 <colspec colwidth="5*" align="center"/>
40784 <colspec colwidth="5*" align="center"/>
40785 <colspec colwidth="6*" align="right"/>
40786 <tbody>
40787 <row>
40788 <entry><option>dns_search_parents</option></entry>
40789 <entry>Use: <emphasis>smtp</emphasis></entry>
40790 <entry>Type: <emphasis>boolean</emphasis></entry>
40791 <entry>Default: <emphasis>false</emphasis></entry>
40792 </row>
40793 </tbody>
40794 </tgroup>
40795 </informaltable>
40796 <para>
40797 <indexterm role="concept">
40798 <primary><option>search_parents</option></primary>
40799 </indexterm>
40800 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
40801 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
40802 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
40803 details.
40804 </para>
40805 <para>
40806 <indexterm role="option">
40807 <primary><option>fallback_hosts</option></primary>
40808 </indexterm>
40809 </para>
40810 <informaltable frame="all">
40811 <tgroup cols="4" colsep="0" rowsep="0">
40812 <colspec colwidth="8*" align="left"/>
40813 <colspec colwidth="5*" align="center"/>
40814 <colspec colwidth="5*" align="center"/>
40815 <colspec colwidth="6*" align="right"/>
40816 <tbody>
40817 <row>
40818 <entry><option>fallback_hosts</option></entry>
40819 <entry>Use: <emphasis>smtp</emphasis></entry>
40820 <entry>Type: <emphasis>string list</emphasis></entry>
40821 <entry>Default: <emphasis>unset</emphasis></entry>
40822 </row>
40823 </tbody>
40824 </tgroup>
40825 </informaltable>
40826 <para>
40827 <indexterm role="concept">
40828 <primary>fallback</primary>
40829 <secondary>hosts specified on transport</secondary>
40830 </indexterm>
40831 String expansion is not applied to this option. The argument must be a
40832 colon-separated list of host names or IP addresses, optionally also including
40833 port numbers, though the separator can be changed, as described in section
40834 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40835 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40836 in section <xref linkend="SECTformatonehostitem"/>.
40837 </para>
40838 <para>
40839 Fallback hosts can also be specified on routers, which associate them with the
40840 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
40841 <option>fallback_hosts</option> specified on the transport is used only if the address does
40842 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
40843 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
40844 However, <option>hosts_randomize</option> does apply to fallback host lists.
40845 </para>
40846 <para>
40847 If Exim is unable to deliver to any of the hosts for a particular address, and
40848 the errors are not permanent rejections, the address is put on a separate
40849 transport queue with its host list replaced by the fallback hosts, unless the
40850 address was routed via MX records and the current host was in the original MX
40851 list. In that situation, the fallback host list is not used.
40852 </para>
40853 <para>
40854 Once normal deliveries are complete, the fallback queue is delivered by
40855 re-running the same transports with the new host lists. If several failing
40856 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
40857 copy of the message is sent.
40858 </para>
40859 <para>
40860 The resolution of the host names on the fallback list is controlled by the
40861 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
40862 both to cases when the host list comes with the address and when it is taken
40863 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
40864 fails</quote> facility.
40865 </para>
40866 <para>
40867 <indexterm role="option">
40868 <primary><option>final_timeout</option></primary>
40869 </indexterm>
40870 </para>
40871 <informaltable frame="all">
40872 <tgroup cols="4" colsep="0" rowsep="0">
40873 <colspec colwidth="8*" align="left"/>
40874 <colspec colwidth="5*" align="center"/>
40875 <colspec colwidth="5*" align="center"/>
40876 <colspec colwidth="6*" align="right"/>
40877 <tbody>
40878 <row>
40879 <entry><option>final_timeout</option></entry>
40880 <entry>Use: <emphasis>smtp</emphasis></entry>
40881 <entry>Type: <emphasis>time</emphasis></entry>
40882 <entry>Default: <emphasis>10m</emphasis></entry>
40883 </row>
40884 </tbody>
40885 </tgroup>
40886 </informaltable>
40887 <para>
40888 This is the timeout that applies while waiting for the response to the final
40889 line containing just <quote>.</quote> that terminates a message. Its value must not be
40890 zero.
40891 </para>
40892 <para>
40893 <indexterm role="option">
40894 <primary><option>gethostbyname</option></primary>
40895 </indexterm>
40896 </para>
40897 <informaltable frame="all">
40898 <tgroup cols="4" colsep="0" rowsep="0">
40899 <colspec colwidth="8*" align="left"/>
40900 <colspec colwidth="5*" align="center"/>
40901 <colspec colwidth="5*" align="center"/>
40902 <colspec colwidth="6*" align="right"/>
40903 <tbody>
40904 <row>
40905 <entry><option>gethostbyname</option></entry>
40906 <entry>Use: <emphasis>smtp</emphasis></entry>
40907 <entry>Type: <emphasis>boolean</emphasis></entry>
40908 <entry>Default: <emphasis>false</emphasis></entry>
40909 </row>
40910 </tbody>
40911 </tgroup>
40912 </informaltable>
40913 <para>
40914 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
40915 being used, names are looked up using <function>gethostbyname()</function>
40916 (or <function>getipnodebyname()</function> when available)
40917 instead of using the DNS. Of course, that function may in fact use the DNS, but
40918 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
40919 </para>
40920 <para>
40921 <indexterm role="option">
40922 <primary><option>helo_data</option></primary>
40923 </indexterm>
40924 </para>
40925 <informaltable frame="all">
40926 <tgroup cols="4" colsep="0" rowsep="0">
40927 <colspec colwidth="8*" align="left"/>
40928 <colspec colwidth="5*" align="center"/>
40929 <colspec colwidth="5*" align="center"/>
40930 <colspec colwidth="6*" align="right"/>
40931 <tbody>
40932 <row>
40933 <entry><option>helo_data</option></entry>
40934 <entry>Use: <emphasis>smtp</emphasis></entry>
40935 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40936 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
40937 </row>
40938 </tbody>
40939 </tgroup>
40940 </informaltable>
40941 <para>
40942 <indexterm role="concept">
40943 <primary>HELO argument</primary>
40944 <secondary>setting</secondary>
40945 </indexterm>
40946 <indexterm role="concept">
40947 <primary>EHLO argument</primary>
40948 <secondary>setting</secondary>
40949 </indexterm>
40950 <indexterm role="concept">
40951 <primary>LHLO argument</primary>
40952 <secondary>setting</secondary>
40953 </indexterm>
40954 The value of this option is expanded, and used as the argument for the EHLO,
40955 HELO, or LHLO command that starts the outgoing SMTP or LMTP session. The
40956 variables <varname>$host</varname> and <varname>$host_address</varname> are set to the identity of the remote
40957 host, and can be used to generate different values for different servers.
40958 </para>
40959 <para>
40960 <indexterm role="option">
40961 <primary><option>hosts</option></primary>
40962 </indexterm>
40963 </para>
40964 <informaltable frame="all">
40965 <tgroup cols="4" colsep="0" rowsep="0">
40966 <colspec colwidth="8*" align="left"/>
40967 <colspec colwidth="5*" align="center"/>
40968 <colspec colwidth="5*" align="center"/>
40969 <colspec colwidth="6*" align="right"/>
40970 <tbody>
40971 <row>
40972 <entry><option>hosts</option></entry>
40973 <entry>Use: <emphasis>smtp</emphasis></entry>
40974 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40975 <entry>Default: <emphasis>unset</emphasis></entry>
40976 </row>
40977 </tbody>
40978 </tgroup>
40979 </informaltable>
40980 <para>
40981 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
40982 finds the hosts by looking up the address domain in the DNS, or by
40983 <command>manualroute</command>, which has lists of hosts in its configuration. However,
40984 email addresses can be passed to the <command>smtp</command> transport by any router, and not
40985 all of them can provide an associated list of hosts.
40986 </para>
40987 <para>
40988 The <option>hosts</option> option specifies a list of hosts to be used if the address being
40989 processed does not have any hosts associated with it. The hosts specified by
40990 <option>hosts</option> are also used, whether or not the address has its own hosts, if
40991 <option>hosts_override</option> is set.
40992 </para>
40993 <para>
40994 The string is first expanded, before being interpreted as a colon-separated
40995 list of host names or IP addresses, possibly including port numbers. The
40996 separator may be changed to something other than colon, as described in section
40997 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40998 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40999 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
41000 of the <command>manualroute</command> router is not available here.
41001 </para>
41002 <para>
41003 If the expansion fails, delivery is deferred. Unless the failure was caused by
41004 the inability to complete a lookup, the error is logged to the panic log as
41005 well as the main log. Host names are looked up either by searching directly for
41006 address records in the DNS or by calling <function>gethostbyname()</function> (or
41007 <function>getipnodebyname()</function> when available), depending on the setting of the
41008 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
41009 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
41010 address are used.
41011 </para>
41012 <para>
41013 During delivery, the hosts are tried in order, subject to their retry status,
41014 unless <option>hosts_randomize</option> is set.
41015 </para>
41016 <para>
41017 <indexterm role="option">
41018 <primary><option>hosts_avoid_esmtp</option></primary>
41019 </indexterm>
41020 </para>
41021 <informaltable frame="all">
41022 <tgroup cols="4" colsep="0" rowsep="0">
41023 <colspec colwidth="8*" align="left"/>
41024 <colspec colwidth="5*" align="center"/>
41025 <colspec colwidth="5*" align="center"/>
41026 <colspec colwidth="6*" align="right"/>
41027 <tbody>
41028 <row>
41029 <entry><option>hosts_avoid_esmtp</option></entry>
41030 <entry>Use: <emphasis>smtp</emphasis></entry>
41031 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41032 <entry>Default: <emphasis>unset</emphasis></entry>
41033 </row>
41034 </tbody>
41035 </tgroup>
41036 </informaltable>
41037 <para>
41038 <indexterm role="concept">
41039 <primary>ESMTP</primary>
41040 <secondary>avoiding use of</secondary>
41041 </indexterm>
41042 <indexterm role="concept">
41043 <primary>HELO</primary>
41044 <secondary>forcing use of</secondary>
41045 </indexterm>
41046 <indexterm role="concept">
41047 <primary>EHLO</primary>
41048 <secondary>avoiding use of</secondary>
41049 </indexterm>
41050 <indexterm role="concept">
41051 <primary>PIPELINING</primary>
41052 <secondary>avoiding the use of</secondary>
41053 </indexterm>
41054 This option is for use with broken hosts that announce ESMTP facilities (for
41055 example, PIPELINING) and then fail to implement them properly. When a host
41056 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
41057 start of the SMTP session. This means that it cannot use any of the ESMTP
41058 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
41059 </para>
41060 <para>
41061 <indexterm role="option">
41062 <primary><option>hosts_avoid_tls</option></primary>
41063 </indexterm>
41064 </para>
41065 <informaltable frame="all">
41066 <tgroup cols="4" colsep="0" rowsep="0">
41067 <colspec colwidth="8*" align="left"/>
41068 <colspec colwidth="5*" align="center"/>
41069 <colspec colwidth="5*" align="center"/>
41070 <colspec colwidth="6*" align="right"/>
41071 <tbody>
41072 <row>
41073 <entry><option>hosts_avoid_tls</option></entry>
41074 <entry>Use: <emphasis>smtp</emphasis></entry>
41075 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41076 <entry>Default: <emphasis>unset</emphasis></entry>
41077 </row>
41078 </tbody>
41079 </tgroup>
41080 </informaltable>
41081 <para>
41082 <indexterm role="concept">
41083 <primary>TLS</primary>
41084 <secondary>avoiding for certain hosts</secondary>
41085 </indexterm>
41086 Exim will not try to start a TLS session when delivering to any host that
41087 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41088 </para>
41089 <para>
41090 <indexterm role="option">
41091 <primary><option>hosts_max_try</option></primary>
41092 </indexterm>
41093 </para>
41094 <informaltable frame="all">
41095 <tgroup cols="4" colsep="0" rowsep="0">
41096 <colspec colwidth="8*" align="left"/>
41097 <colspec colwidth="5*" align="center"/>
41098 <colspec colwidth="5*" align="center"/>
41099 <colspec colwidth="6*" align="right"/>
41100 <tbody>
41101 <row>
41102 <entry><option>hosts_max_try</option></entry>
41103 <entry>Use: <emphasis>smtp</emphasis></entry>
41104 <entry>Type: <emphasis>integer</emphasis></entry>
41105 <entry>Default: <emphasis>5</emphasis></entry>
41106 </row>
41107 </tbody>
41108 </tgroup>
41109 </informaltable>
41110 <para>
41111 <indexterm role="concept">
41112 <primary>host</primary>
41113 <secondary>maximum number to try</secondary>
41114 </indexterm>
41115 <indexterm role="concept">
41116 <primary>limit</primary>
41117 <secondary>number of hosts tried</secondary>
41118 </indexterm>
41119 <indexterm role="concept">
41120 <primary>limit</primary>
41121 <secondary>number of MX tried</secondary>
41122 </indexterm>
41123 <indexterm role="concept">
41124 <primary>MX record</primary>
41125 <secondary>maximum tried</secondary>
41126 </indexterm>
41127 This option limits the number of IP addresses that are tried for any one
41128 delivery in cases where there are temporary delivery errors. Section
41129 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
41130 </para>
41131 <para>
41132 <indexterm role="option">
41133 <primary><option>hosts_max_try_hardlimit</option></primary>
41134 </indexterm>
41135 </para>
41136 <informaltable frame="all">
41137 <tgroup cols="4" colsep="0" rowsep="0">
41138 <colspec colwidth="8*" align="left"/>
41139 <colspec colwidth="5*" align="center"/>
41140 <colspec colwidth="5*" align="center"/>
41141 <colspec colwidth="6*" align="right"/>
41142 <tbody>
41143 <row>
41144 <entry><option>hosts_max_try_hardlimit</option></entry>
41145 <entry>Use: <emphasis>smtp</emphasis></entry>
41146 <entry>Type: <emphasis>integer</emphasis></entry>
41147 <entry>Default: <emphasis>50</emphasis></entry>
41148 </row>
41149 </tbody>
41150 </tgroup>
41151 </informaltable>
41152 <para>
41153 This is an additional check on the maximum number of IP addresses that Exim
41154 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
41155 why it exists.
41156 </para>
41157 <para>
41158 <indexterm role="option">
41159 <primary><option>hosts_nopass_tls</option></primary>
41160 </indexterm>
41161 </para>
41162 <informaltable frame="all">
41163 <tgroup cols="4" colsep="0" rowsep="0">
41164 <colspec colwidth="8*" align="left"/>
41165 <colspec colwidth="5*" align="center"/>
41166 <colspec colwidth="5*" align="center"/>
41167 <colspec colwidth="6*" align="right"/>
41168 <tbody>
41169 <row>
41170 <entry><option>hosts_nopass_tls</option></entry>
41171 <entry>Use: <emphasis>smtp</emphasis></entry>
41172 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41173 <entry>Default: <emphasis>unset</emphasis></entry>
41174 </row>
41175 </tbody>
41176 </tgroup>
41177 </informaltable>
41178 <para>
41179 <indexterm role="concept">
41180 <primary>TLS</primary>
41181 <secondary>passing connection</secondary>
41182 </indexterm>
41183 <indexterm role="concept">
41184 <primary>multiple SMTP deliveries</primary>
41185 </indexterm>
41186 <indexterm role="concept">
41187 <primary>TLS</primary>
41188 <secondary>multiple message deliveries</secondary>
41189 </indexterm>
41190 For any host that matches this list, a connection on which a TLS session has
41191 been started will not be passed to a new delivery process for sending another
41192 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
41193 explanation of when this might be needed.
41194 </para>
41195 <para>
41196 <indexterm role="option">
41197 <primary><option>hosts_override</option></primary>
41198 </indexterm>
41199 </para>
41200 <informaltable frame="all">
41201 <tgroup cols="4" colsep="0" rowsep="0">
41202 <colspec colwidth="8*" align="left"/>
41203 <colspec colwidth="5*" align="center"/>
41204 <colspec colwidth="5*" align="center"/>
41205 <colspec colwidth="6*" align="right"/>
41206 <tbody>
41207 <row>
41208 <entry><option>hosts_override</option></entry>
41209 <entry>Use: <emphasis>smtp</emphasis></entry>
41210 <entry>Type: <emphasis>boolean</emphasis></entry>
41211 <entry>Default: <emphasis>false</emphasis></entry>
41212 </row>
41213 </tbody>
41214 </tgroup>
41215 </informaltable>
41216 <para>
41217 If this option is set and the <option>hosts</option> option is also set, any hosts that are
41218 attached to the address are ignored, and instead the hosts specified by the
41219 <option>hosts</option> option are always used. This option does not apply to
41220 <option>fallback_hosts</option>.
41221 </para>
41222 <para>
41223 <indexterm role="option">
41224 <primary><option>hosts_randomize</option></primary>
41225 </indexterm>
41226 </para>
41227 <informaltable frame="all">
41228 <tgroup cols="4" colsep="0" rowsep="0">
41229 <colspec colwidth="8*" align="left"/>
41230 <colspec colwidth="5*" align="center"/>
41231 <colspec colwidth="5*" align="center"/>
41232 <colspec colwidth="6*" align="right"/>
41233 <tbody>
41234 <row>
41235 <entry><option>hosts_randomize</option></entry>
41236 <entry>Use: <emphasis>smtp</emphasis></entry>
41237 <entry>Type: <emphasis>boolean</emphasis></entry>
41238 <entry>Default: <emphasis>false</emphasis></entry>
41239 </row>
41240 </tbody>
41241 </tgroup>
41242 </informaltable>
41243 <para>
41244 <indexterm role="concept">
41245 <primary>randomized host list</primary>
41246 </indexterm>
41247 <indexterm role="concept">
41248 <primary>host</primary>
41249 <secondary>list of; randomized</secondary>
41250 </indexterm>
41251 <indexterm role="concept">
41252 <primary>fallback</primary>
41253 <secondary>randomized hosts</secondary>
41254 </indexterm>
41255 If this option is set, and either the list of hosts is taken from the
41256 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
41257 were not obtained from MX records (this includes fallback hosts from the
41258 router), and were not randomizied by the router, the order of trying the hosts
41259 is randomized each time the transport runs. Randomizing the order of a host
41260 list can be used to do crude load sharing.
41261 </para>
41262 <para>
41263 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
41264 order is separately randomized. This makes it possible to set up MX-like
41265 behaviour. The boundaries between groups are indicated by an item that is just
41266 <literal>+</literal> in the host list. For example:
41267 </para>
41268 <literallayout class="monospaced">
41269 hosts = host1:host2:host3:+:host4:host5
41270 </literallayout>
41271 <para>
41272 The order of the first three hosts and the order of the last two hosts is
41273 randomized for each use, but the first three always end up before the last two.
41274 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
41275 </para>
41276 <para>
41277 <indexterm role="option">
41278 <primary><option>hosts_require_auth</option></primary>
41279 </indexterm>
41280 </para>
41281 <informaltable frame="all">
41282 <tgroup cols="4" colsep="0" rowsep="0">
41283 <colspec colwidth="8*" align="left"/>
41284 <colspec colwidth="5*" align="center"/>
41285 <colspec colwidth="5*" align="center"/>
41286 <colspec colwidth="6*" align="right"/>
41287 <tbody>
41288 <row>
41289 <entry><option>hosts_require_auth</option></entry>
41290 <entry>Use: <emphasis>smtp</emphasis></entry>
41291 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41292 <entry>Default: <emphasis>unset</emphasis></entry>
41293 </row>
41294 </tbody>
41295 </tgroup>
41296 </informaltable>
41297 <para>
41298 <indexterm role="concept">
41299 <primary>authentication</primary>
41300 <secondary>required by client</secondary>
41301 </indexterm>
41302 This option provides a list of servers for which authentication must succeed
41303 before Exim will try to transfer a message. If authentication fails for
41304 servers which are not in this list, Exim tries to send unauthenticated. If
41305 authentication fails for one of these servers, delivery is deferred. This
41306 temporary error is detectable in the retry rules, so it can be turned into a
41307 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
41308 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41309 </para>
41310 <para>
41311 <indexterm role="option">
41312 <primary><option>hosts_require_tls</option></primary>
41313 </indexterm>
41314 </para>
41315 <informaltable frame="all">
41316 <tgroup cols="4" colsep="0" rowsep="0">
41317 <colspec colwidth="8*" align="left"/>
41318 <colspec colwidth="5*" align="center"/>
41319 <colspec colwidth="5*" align="center"/>
41320 <colspec colwidth="6*" align="right"/>
41321 <tbody>
41322 <row>
41323 <entry><option>hosts_require_tls</option></entry>
41324 <entry>Use: <emphasis>smtp</emphasis></entry>
41325 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41326 <entry>Default: <emphasis>unset</emphasis></entry>
41327 </row>
41328 </tbody>
41329 </tgroup>
41330 </informaltable>
41331 <para>
41332 <indexterm role="concept">
41333 <primary>TLS</primary>
41334 <secondary>requiring for certain servers</secondary>
41335 </indexterm>
41336 Exim will insist on using a TLS session when delivering to any host that
41337 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41338 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
41339 incoming messages, use an appropriate ACL.
41340 </para>
41341 <para>
41342 <indexterm role="option">
41343 <primary><option>hosts_try_auth</option></primary>
41344 </indexterm>
41345 </para>
41346 <informaltable frame="all">
41347 <tgroup cols="4" colsep="0" rowsep="0">
41348 <colspec colwidth="8*" align="left"/>
41349 <colspec colwidth="5*" align="center"/>
41350 <colspec colwidth="5*" align="center"/>
41351 <colspec colwidth="6*" align="right"/>
41352 <tbody>
41353 <row>
41354 <entry><option>hosts_try_auth</option></entry>
41355 <entry>Use: <emphasis>smtp</emphasis></entry>
41356 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41357 <entry>Default: <emphasis>unset</emphasis></entry>
41358 </row>
41359 </tbody>
41360 </tgroup>
41361 </informaltable>
41362 <para>
41363 <indexterm role="concept">
41364 <primary>authentication</primary>
41365 <secondary>optional in client</secondary>
41366 </indexterm>
41367 This option provides a list of servers to which, provided they announce
41368 authentication support, Exim will attempt to authenticate as a client when it
41369 connects. If authentication fails, Exim will try to transfer the message
41370 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
41371 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41372 </para>
41373 <para>
41374 <indexterm role="option">
41375 <primary><option>interface</option></primary>
41376 </indexterm>
41377 </para>
41378 <informaltable frame="all">
41379 <tgroup cols="4" colsep="0" rowsep="0">
41380 <colspec colwidth="8*" align="left"/>
41381 <colspec colwidth="5*" align="center"/>
41382 <colspec colwidth="5*" align="center"/>
41383 <colspec colwidth="6*" align="right"/>
41384 <tbody>
41385 <row>
41386 <entry><option>interface</option></entry>
41387 <entry>Use: <emphasis>smtp</emphasis></entry>
41388 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41389 <entry>Default: <emphasis>unset</emphasis></entry>
41390 </row>
41391 </tbody>
41392 </tgroup>
41393 </informaltable>
41394 <para revisionflag="changed">
41395 <indexterm role="concept">
41396 <primary>bind IP address</primary>
41397 </indexterm>
41398 <indexterm role="concept">
41399 <primary>IP address</primary>
41400 <secondary>binding</secondary>
41401 </indexterm>
41402 <indexterm role="concept">
41403 <primary><varname>$host</varname></primary>
41404 </indexterm>
41405 <indexterm role="concept">
41406 <primary><varname>$host_address</varname></primary>
41407 </indexterm>
41408 This option specifies which interface to bind to when making an outgoing SMTP
41409 call. <emphasis role="bold">Note:</emphasis> Do not confuse this with the interface address that was used
41410 when a message was received, which is in <varname>$received_ip_address</varname>, formerly
41411 known as <varname>$interface_address</varname>. The name was changed to minimize confusion with
41412 the outgoing interface address. There is no variable that contains an outgoing
41413 interface address because, unless it is set by this option, its value is
41414 unknown.
41415 </para>
41416 <para>
41417 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
41418 <varname>$host_address</varname> refer to the host to which a connection is about to be made
41419 during the expansion of the string. Forced expansion failure, or an empty
41420 string result causes the option to be ignored. Otherwise, after expansion, the
41421 string must be a list of IP addresses, colon-separated by default, but the
41422 separator can be changed in the usual way. For example:
41423 </para>
41424 <literallayout class="monospaced">
41425 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
41426 </literallayout>
41427 <para>
41428 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
41429 connection. If none of them are the correct type, the option is ignored. If
41430 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
41431 interface to use if the host has more than one.
41432 </para>
41433 <para>
41434 <indexterm role="option">
41435 <primary><option>keepalive</option></primary>
41436 </indexterm>
41437 </para>
41438 <informaltable frame="all">
41439 <tgroup cols="4" colsep="0" rowsep="0">
41440 <colspec colwidth="8*" align="left"/>
41441 <colspec colwidth="5*" align="center"/>
41442 <colspec colwidth="5*" align="center"/>
41443 <colspec colwidth="6*" align="right"/>
41444 <tbody>
41445 <row>
41446 <entry><option>keepalive</option></entry>
41447 <entry>Use: <emphasis>smtp</emphasis></entry>
41448 <entry>Type: <emphasis>boolean</emphasis></entry>
41449 <entry>Default: <emphasis>true</emphasis></entry>
41450 </row>
41451 </tbody>
41452 </tgroup>
41453 </informaltable>
41454 <para>
41455 <indexterm role="concept">
41456 <primary>keepalive</primary>
41457 <secondary>on outgoing connection</secondary>
41458 </indexterm>
41459 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
41460 connections. When set, it causes the kernel to probe idle connections
41461 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
41462 of the connection should send a acknowledgement if the connection is still okay
41463 or a reset if the connection has been aborted. The reason for doing this is
41464 that it has the beneficial effect of freeing up certain types of connection
41465 that can get stuck when the remote host is disconnected without tidying up the
41466 TCP/IP call properly. The keepalive mechanism takes several hours to detect
41467 unreachable hosts.
41468 </para>
41469 <para>
41470 <indexterm role="option">
41471 <primary><option>lmtp_ignore_quota</option></primary>
41472 </indexterm>
41473 </para>
41474 <informaltable frame="all">
41475 <tgroup cols="4" colsep="0" rowsep="0">
41476 <colspec colwidth="8*" align="left"/>
41477 <colspec colwidth="5*" align="center"/>
41478 <colspec colwidth="5*" align="center"/>
41479 <colspec colwidth="6*" align="right"/>
41480 <tbody>
41481 <row>
41482 <entry><option>lmtp_ignore_quota</option></entry>
41483 <entry>Use: <emphasis>smtp</emphasis></entry>
41484 <entry>Type: <emphasis>boolean</emphasis></entry>
41485 <entry>Default: <emphasis>false</emphasis></entry>
41486 </row>
41487 </tbody>
41488 </tgroup>
41489 </informaltable>
41490 <para>
41491 <indexterm role="concept">
41492 <primary>LMTP</primary>
41493 <secondary>ignoring quota errors</secondary>
41494 </indexterm>
41495 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
41496 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
41497 has advertised support for IGNOREQUOTA in its response to the LHLO command.
41498 </para>
41499 <para>
41500 <indexterm role="option">
41501 <primary><option>max_rcpt</option></primary>
41502 </indexterm>
41503 </para>
41504 <informaltable frame="all">
41505 <tgroup cols="4" colsep="0" rowsep="0">
41506 <colspec colwidth="8*" align="left"/>
41507 <colspec colwidth="5*" align="center"/>
41508 <colspec colwidth="5*" align="center"/>
41509 <colspec colwidth="6*" align="right"/>
41510 <tbody>
41511 <row>
41512 <entry><option>max_rcpt</option></entry>
41513 <entry>Use: <emphasis>smtp</emphasis></entry>
41514 <entry>Type: <emphasis>integer</emphasis></entry>
41515 <entry>Default: <emphasis>100</emphasis></entry>
41516 </row>
41517 </tbody>
41518 </tgroup>
41519 </informaltable>
41520 <para>
41521 <indexterm role="concept">
41522 <primary>RCPT</primary>
41523 <secondary>maximum number of outgoing</secondary>
41524 </indexterm>
41525 This option limits the number of RCPT commands that are sent in a single
41526 SMTP message transaction. Each set of addresses is treated independently, and
41527 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
41528 permits this.
41529 </para>
41530 <para>
41531 <indexterm role="option">
41532 <primary><option>multi_domain</option></primary>
41533 </indexterm>
41534 </para>
41535 <informaltable frame="all">
41536 <tgroup cols="4" colsep="0" rowsep="0">
41537 <colspec colwidth="8*" align="left"/>
41538 <colspec colwidth="5*" align="center"/>
41539 <colspec colwidth="5*" align="center"/>
41540 <colspec colwidth="6*" align="right"/>
41541 <tbody>
41542 <row>
41543 <entry><option>multi_domain</option></entry>
41544 <entry>Use: <emphasis>smtp</emphasis></entry>
41545 <entry>Type: <emphasis>boolean</emphasis></entry>
41546 <entry>Default: <emphasis>true</emphasis></entry>
41547 </row>
41548 </tbody>
41549 </tgroup>
41550 </informaltable>
41551 <para>
41552 <indexterm role="concept">
41553 <primary><varname>$domain</varname></primary>
41554 </indexterm>
41555 When this option is set, the <command>smtp</command> transport can handle a number of
41556 addresses containing a mixture of different domains provided they all resolve
41557 to the same list of hosts. Turning the option off restricts the transport to
41558 handling only one domain at a time. This is useful if you want to use
41559 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
41560 is a single domain involved in a remote delivery.
41561 </para>
41562 <para>
41563 <indexterm role="option">
41564 <primary><option>port</option></primary>
41565 </indexterm>
41566 </para>
41567 <informaltable frame="all">
41568 <tgroup cols="4" colsep="0" rowsep="0">
41569 <colspec colwidth="8*" align="left"/>
41570 <colspec colwidth="5*" align="center"/>
41571 <colspec colwidth="5*" align="center"/>
41572 <colspec colwidth="6*" align="right"/>
41573 <tbody>
41574 <row>
41575 <entry><option>port</option></entry>
41576 <entry>Use: <emphasis>smtp</emphasis></entry>
41577 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41578 <entry>Default: <emphasis>see below</emphasis></entry>
41579 </row>
41580 </tbody>
41581 </tgroup>
41582 </informaltable>
41583 <para revisionflag="changed">
41584 <indexterm role="concept">
41585 <primary>port</primary>
41586 <secondary>sending TCP/IP</secondary>
41587 </indexterm>
41588 <indexterm role="concept">
41589 <primary>TCP/IP</primary>
41590 <secondary>setting outgoing port</secondary>
41591 </indexterm>
41592 This option specifies the TCP/IP port on the server to which Exim connects.
41593 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
41594 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
41595 The name was changed to minimize confusion with the outgoing port. There is no
41596 variable that contains an outgoing port.
41597 </para>
41598 <para>
41599 If the value of this option begins with a digit it is taken as a port number;
41600 otherwise it is looked up using <function>getservbyname()</function>. The default value is
41601 normally <quote>smtp</quote>, but if <option>protocol</option> is set to <quote>lmtp</quote>, the default is
41602 <quote>lmtp</quote>. If the expansion fails, or if a port number cannot be found, delivery
41603 is deferred.
41604 </para>
41605 <para>
41606 <indexterm role="option">
41607 <primary><option>protocol</option></primary>
41608 </indexterm>
41609 </para>
41610 <informaltable frame="all">
41611 <tgroup cols="4" colsep="0" rowsep="0">
41612 <colspec colwidth="8*" align="left"/>
41613 <colspec colwidth="5*" align="center"/>
41614 <colspec colwidth="5*" align="center"/>
41615 <colspec colwidth="6*" align="right"/>
41616 <tbody>
41617 <row>
41618 <entry><option>protocol</option></entry>
41619 <entry>Use: <emphasis>smtp</emphasis></entry>
41620 <entry>Type: <emphasis>string</emphasis></entry>
41621 <entry>Default: <emphasis>smtp</emphasis></entry>
41622 </row>
41623 </tbody>
41624 </tgroup>
41625 </informaltable>
41626 <para>
41627 <indexterm role="concept">
41628 <primary>LMTP</primary>
41629 <secondary>over TCP/IP</secondary>
41630 </indexterm>
41631 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
41632 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
41633 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
41634 deliveries into closed message stores. Exim also has support for running LMTP
41635 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
41636 </para>
41637 <para>
41638 <indexterm role="option">
41639 <primary><option>retry_include_ip_address</option></primary>
41640 </indexterm>
41641 </para>
41642 <informaltable frame="all">
41643 <tgroup cols="4" colsep="0" rowsep="0">
41644 <colspec colwidth="8*" align="left"/>
41645 <colspec colwidth="5*" align="center"/>
41646 <colspec colwidth="5*" align="center"/>
41647 <colspec colwidth="6*" align="right"/>
41648 <tbody>
41649 <row>
41650 <entry><option>retry_include_ip_address</option></entry>
41651 <entry>Use: <emphasis>smtp</emphasis></entry>
41652 <entry>Type: <emphasis>boolean</emphasis></entry>
41653 <entry>Default: <emphasis>true</emphasis></entry>
41654 </row>
41655 </tbody>
41656 </tgroup>
41657 </informaltable>
41658 <para>
41659 Exim normally includes both the host name and the IP address in the key it
41660 constructs for indexing retry data after a temporary delivery failure. This
41661 means that when one of several IP addresses for a host is failing, it gets
41662 tried periodically (controlled by the retry rules), but use of the other IP
41663 addresses is not affected.
41664 </para>
41665 <para>
41666 However, in some dialup environments hosts are assigned a different IP address
41667 each time they connect. In this situation the use of the IP address as part of
41668 the retry key leads to undesirable behaviour. Setting this option false causes
41669 Exim to use only the host name. This should normally be done on a separate
41670 instance of the <command>smtp</command> transport, set up specially to handle the dialup
41671 hosts.
41672 </para>
41673 <para>
41674 <indexterm role="option">
41675 <primary><option>serialize_hosts</option></primary>
41676 </indexterm>
41677 </para>
41678 <informaltable frame="all">
41679 <tgroup cols="4" colsep="0" rowsep="0">
41680 <colspec colwidth="8*" align="left"/>
41681 <colspec colwidth="5*" align="center"/>
41682 <colspec colwidth="5*" align="center"/>
41683 <colspec colwidth="6*" align="right"/>
41684 <tbody>
41685 <row>
41686 <entry><option>serialize_hosts</option></entry>
41687 <entry>Use: <emphasis>smtp</emphasis></entry>
41688 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41689 <entry>Default: <emphasis>unset</emphasis></entry>
41690 </row>
41691 </tbody>
41692 </tgroup>
41693 </informaltable>
41694 <para>
41695 <indexterm role="concept">
41696 <primary>serializing connections</primary>
41697 </indexterm>
41698 <indexterm role="concept">
41699 <primary>host</primary>
41700 <secondary>serializing connections</secondary>
41701 </indexterm>
41702 Because Exim operates in a distributed manner, if several messages for the same
41703 host arrive at around the same time, more than one simultaneous connection to
41704 the remote host can occur. This is not usually a problem except when there is a
41705 slow link between the hosts. In that situation it may be helpful to restrict
41706 Exim to one connection at a time. This can be done by setting
41707 <option>serialize_hosts</option> to match the relevant hosts.
41708 </para>
41709 <para>
41710 <indexterm role="concept">
41711 <primary>hints database</primary>
41712 <secondary>serializing deliveries to a host</secondary>
41713 </indexterm>
41714 Exim implements serialization by means of a hints database in which a record is
41715 written whenever a process connects to one of the restricted hosts. The record
41716 is deleted when the connection is completed. Obviously there is scope for
41717 records to get left lying around if there is a system or program crash. To
41718 guard against this, Exim ignores any records that are more than six hours old.
41719 </para>
41720 <para>
41721 If you set up this kind of serialization, you should also arrange to delete the
41722 relevant hints database whenever your system reboots. The names of the files
41723 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
41724 may be one or two files, depending on the type of DBM in use. The same files
41725 are used for ETRN serialization.
41726 </para>
41727 <para>
41728 <indexterm role="option">
41729 <primary><option>size_addition</option></primary>
41730 </indexterm>
41731 </para>
41732 <informaltable frame="all">
41733 <tgroup cols="4" colsep="0" rowsep="0">
41734 <colspec colwidth="8*" align="left"/>
41735 <colspec colwidth="5*" align="center"/>
41736 <colspec colwidth="5*" align="center"/>
41737 <colspec colwidth="6*" align="right"/>
41738 <tbody>
41739 <row>
41740 <entry><option>size_addition</option></entry>
41741 <entry>Use: <emphasis>smtp</emphasis></entry>
41742 <entry>Type: <emphasis>integer</emphasis></entry>
41743 <entry>Default: <emphasis>1024</emphasis></entry>
41744 </row>
41745 </tbody>
41746 </tgroup>
41747 </informaltable>
41748 <para>
41749 <indexterm role="concept">
41750 <primary>SMTP</primary>
41751 <secondary>SIZE</secondary>
41752 </indexterm>
41753 <indexterm role="concept">
41754 <primary>message</primary>
41755 <secondary>size issue for transport filter</secondary>
41756 </indexterm>
41757 <indexterm role="concept">
41758 <primary>size</primary>
41759 <secondary>of message</secondary>
41760 </indexterm>
41761 <indexterm role="concept">
41762 <primary>transport</primary>
41763 <secondary>filter</secondary>
41764 </indexterm>
41765 <indexterm role="concept">
41766 <primary>filter</primary>
41767 <secondary>transport filter</secondary>
41768 </indexterm>
41769 If a remote SMTP server indicates that it supports the SIZE option of the
41770 MAIL command, Exim uses this to pass over the message size at the start of
41771 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
41772 sends, to allow for headers and other text that may be added during delivery by
41773 configuration options or in a transport filter. It may be necessary to increase
41774 this if a lot of text is added to messages.
41775 </para>
41776 <para>
41777 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
41778 the use of the SIZE option altogether.
41779 </para>
41780 <para>
41781 <indexterm role="option">
41782 <primary><option>tls_certificate</option></primary>
41783 </indexterm>
41784 </para>
41785 <informaltable frame="all">
41786 <tgroup cols="4" colsep="0" rowsep="0">
41787 <colspec colwidth="8*" align="left"/>
41788 <colspec colwidth="5*" align="center"/>
41789 <colspec colwidth="5*" align="center"/>
41790 <colspec colwidth="6*" align="right"/>
41791 <tbody>
41792 <row>
41793 <entry><option>tls_certificate</option></entry>
41794 <entry>Use: <emphasis>smtp</emphasis></entry>
41795 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41796 <entry>Default: <emphasis>unset</emphasis></entry>
41797 </row>
41798 </tbody>
41799 </tgroup>
41800 </informaltable>
41801 <para>
41802 <indexterm role="concept">
41803 <primary>TLS client certificate</primary>
41804 <secondary>location of</secondary>
41805 </indexterm>
41806 <indexterm role="concept">
41807 <primary>certificate for client</primary>
41808 <secondary>location of</secondary>
41809 </indexterm>
41810 <indexterm role="concept">
41811 <primary><varname>$host</varname></primary>
41812 </indexterm>
41813 <indexterm role="concept">
41814 <primary><varname>$host_address</varname></primary>
41815 </indexterm>
41816 The value of this option must be the absolute path to a file which contains the
41817 client&#x2019;s certificate, for possible use when sending a message over an encrypted
41818 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
41819 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
41820 details of TLS.
41821 </para>
41822 <para>
41823 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
41824 certificate when sending messages as a client. The global option of the same
41825 name specifies the certificate for Exim as a server; it is not automatically
41826 assumed that the same certificate should be used when Exim is operating as a
41827 client.
41828 </para>
41829 <para>
41830 <indexterm role="option">
41831 <primary><option>tls_crl</option></primary>
41832 </indexterm>
41833 </para>
41834 <informaltable frame="all">
41835 <tgroup cols="4" colsep="0" rowsep="0">
41836 <colspec colwidth="8*" align="left"/>
41837 <colspec colwidth="5*" align="center"/>
41838 <colspec colwidth="5*" align="center"/>
41839 <colspec colwidth="6*" align="right"/>
41840 <tbody>
41841 <row>
41842 <entry><option>tls_crl</option></entry>
41843 <entry>Use: <emphasis>smtp</emphasis></entry>
41844 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41845 <entry>Default: <emphasis>unset</emphasis></entry>
41846 </row>
41847 </tbody>
41848 </tgroup>
41849 </informaltable>
41850 <para>
41851 <indexterm role="concept">
41852 <primary>TLS</primary>
41853 <secondary>client certificate revocation list</secondary>
41854 </indexterm>
41855 <indexterm role="concept">
41856 <primary>certificate</primary>
41857 <secondary>revocation list for client</secondary>
41858 </indexterm>
41859 This option specifies a certificate revocation list. The expanded value must
41860 be the name of a file that contains a CRL in PEM format.
41861 </para>
41862 <para>
41863 <indexterm role="option">
41864 <primary><option>tls_privatekey</option></primary>
41865 </indexterm>
41866 </para>
41867 <informaltable frame="all">
41868 <tgroup cols="4" colsep="0" rowsep="0">
41869 <colspec colwidth="8*" align="left"/>
41870 <colspec colwidth="5*" align="center"/>
41871 <colspec colwidth="5*" align="center"/>
41872 <colspec colwidth="6*" align="right"/>
41873 <tbody>
41874 <row>
41875 <entry><option>tls_privatekey</option></entry>
41876 <entry>Use: <emphasis>smtp</emphasis></entry>
41877 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41878 <entry>Default: <emphasis>unset</emphasis></entry>
41879 </row>
41880 </tbody>
41881 </tgroup>
41882 </informaltable>
41883 <para>
41884 <indexterm role="concept">
41885 <primary>TLS client private key</primary>
41886 <secondary>location of</secondary>
41887 </indexterm>
41888 <indexterm role="concept">
41889 <primary><varname>$host</varname></primary>
41890 </indexterm>
41891 <indexterm role="concept">
41892 <primary><varname>$host_address</varname></primary>
41893 </indexterm>
41894 The value of this option must be the absolute path to a file which contains the
41895 client&#x2019;s private key. This is used when sending a message over an encrypted
41896 connection using a client certificate. The values of <varname>$host</varname> and
41897 <varname>$host_address</varname> are set to the name and address of the server during the
41898 expansion. If this option is unset, or the expansion is forced to fail, or the
41899 result is an empty string, the private key is assumed to be in the same file as
41900 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41901 </para>
41902 <para>
41903 <indexterm role="option">
41904 <primary><option>tls_require_ciphers</option></primary>
41905 </indexterm>
41906 </para>
41907 <informaltable frame="all">
41908 <tgroup cols="4" colsep="0" rowsep="0">
41909 <colspec colwidth="8*" align="left"/>
41910 <colspec colwidth="5*" align="center"/>
41911 <colspec colwidth="5*" align="center"/>
41912 <colspec colwidth="6*" align="right"/>
41913 <tbody>
41914 <row>
41915 <entry><option>tls_require_ciphers</option></entry>
41916 <entry>Use: <emphasis>smtp</emphasis></entry>
41917 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41918 <entry>Default: <emphasis>unset</emphasis></entry>
41919 </row>
41920 </tbody>
41921 </tgroup>
41922 </informaltable>
41923 <para>
41924 <indexterm role="concept">
41925 <primary>TLS</primary>
41926 <secondary>requiring specific ciphers</secondary>
41927 </indexterm>
41928 <indexterm role="concept">
41929 <primary>cipher</primary>
41930 <secondary>requiring specific</secondary>
41931 </indexterm>
41932 <indexterm role="concept">
41933 <primary><varname>$host</varname></primary>
41934 </indexterm>
41935 <indexterm role="concept">
41936 <primary><varname>$host_address</varname></primary>
41937 </indexterm>
41938 The value of this option must be a list of permitted cipher suites, for use
41939 when setting up an outgoing encrypted connection. (There is a global option of
41940 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
41941 <varname>$host_address</varname> are set to the name and address of the server during the
41942 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
41943 is used in different ways by OpenSSL and GnuTLS (see sections
41944 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
41945 ciphers is a preference order.
41946 </para>
41947 <para>
41948 <indexterm role="option">
41949 <primary><option>tls_tempfail_tryclear</option></primary>
41950 </indexterm>
41951 </para>
41952 <informaltable frame="all">
41953 <tgroup cols="4" colsep="0" rowsep="0">
41954 <colspec colwidth="8*" align="left"/>
41955 <colspec colwidth="5*" align="center"/>
41956 <colspec colwidth="5*" align="center"/>
41957 <colspec colwidth="6*" align="right"/>
41958 <tbody>
41959 <row>
41960 <entry><option>tls_tempfail_tryclear</option></entry>
41961 <entry>Use: <emphasis>smtp</emphasis></entry>
41962 <entry>Type: <emphasis>boolean</emphasis></entry>
41963 <entry>Default: <emphasis>true</emphasis></entry>
41964 </row>
41965 </tbody>
41966 </tgroup>
41967 </informaltable>
41968 <para>
41969 <indexterm role="concept">
41970 <primary>4<emphasis>xx</emphasis> responses</primary>
41971 <secondary>to STARTTLS</secondary>
41972 </indexterm>
41973 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
41974 setting up a TLS session, this option determines whether or not Exim should try
41975 to deliver the message unencrypted. If it is set false, delivery to the
41976 current host is deferred; if there are other hosts, they are tried. If this
41977 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
41978 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
41979 TLS negotiation fails, Exim closes the current connection (because it is in an
41980 unknown state), opens a new one to the same host, and then tries the delivery
41981 in clear.
41982 </para>
41983 <para>
41984 <indexterm role="option">
41985 <primary><option>tls_verify_certificates</option></primary>
41986 </indexterm>
41987 </para>
41988 <informaltable frame="all">
41989 <tgroup cols="4" colsep="0" rowsep="0">
41990 <colspec colwidth="8*" align="left"/>
41991 <colspec colwidth="5*" align="center"/>
41992 <colspec colwidth="5*" align="center"/>
41993 <colspec colwidth="6*" align="right"/>
41994 <tbody>
41995 <row>
41996 <entry><option>tls_verify_certificates</option></entry>
41997 <entry>Use: <emphasis>smtp</emphasis></entry>
41998 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41999 <entry>Default: <emphasis>unset</emphasis></entry>
42000 </row>
42001 </tbody>
42002 </tgroup>
42003 </informaltable>
42004 <para>
42005 <indexterm role="concept">
42006 <primary>TLS</primary>
42007 <secondary>server certificate verification</secondary>
42008 </indexterm>
42009 <indexterm role="concept">
42010 <primary>certificate</primary>
42011 <secondary>verification of server</secondary>
42012 </indexterm>
42013 <indexterm role="concept">
42014 <primary><varname>$host</varname></primary>
42015 </indexterm>
42016 <indexterm role="concept">
42017 <primary><varname>$host_address</varname></primary>
42018 </indexterm>
42019 The value of this option must be the absolute path to a file containing
42020 permitted server certificates, for use when setting up an encrypted connection.
42021 Alternatively, if you are using OpenSSL, you can set
42022 <option>tls_verify_certificates</option> to the name of a directory containing certificate
42023 files. This does not work with GnuTLS; the option must be set to the name of a
42024 single file if you are using GnuTLS. The values of <varname>$host</varname> and
42025 <varname>$host_address</varname> are set to the name and address of the server during the
42026 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
42027 </para>
42028 </section>
42029 <section id="SECTvalhosmax">
42030 <title>How the limits for the number of hosts to try are used</title>
42031 <para>
42032 <indexterm role="concept">
42033 <primary>host</primary>
42034 <secondary>maximum number to try</secondary>
42035 </indexterm>
42036 <indexterm role="concept">
42037 <primary>limit</primary>
42038 <secondary>hosts; maximum number tried</secondary>
42039 </indexterm>
42040 There are two options that are concerned with the number of hosts that are
42041 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
42042 <option>hosts_max_try_hardlimit</option>.
42043 </para>
42044 <para>
42045 The <option>hosts_max_try</option> option limits the number of hosts that are tried
42046 for a single delivery. However, despite the term <quote>host</quote> in its name, the
42047 option actually applies to each IP address independently. In other words, a
42048 multihomed host is treated as several independent hosts, just as it is for
42049 retrying.
42050 </para>
42051 <para>
42052 Many of the larger ISPs have multiple MX records which often point to
42053 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
42054 created as a result of routing one of these domains.
42055 </para>
42056 <para>
42057 Trying every single IP address on such a long list does not seem sensible; if
42058 several at the top of the list fail, it is reasonable to assume there is some
42059 problem that is likely to affect all of them. Roughly speaking, the value of
42060 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
42061 delivery. However, the logic cannot be quite that simple.
42062 </para>
42063 <para>
42064 Firstly, IP addresses that are skipped because their retry times have not
42065 arrived do not count, and in addition, addresses that are past their retry
42066 limits are also not counted, even when they are tried. This means that when
42067 some IP addresses are past their retry limits, more than the value of
42068 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
42069 that all IP addresses are considered before timing out an email address (but
42070 see below for an exception).
42071 </para>
42072 <para>
42073 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
42074 list to see if there is a subsequent host with a different (higher valued) MX.
42075 If there is, that host is considered next, and the current IP address is used
42076 but not counted. This behaviour helps in the case of a domain with a retry rule
42077 that hardly ever delays any hosts, as is now explained:
42078 </para>
42079 <para>
42080 Consider the case of a long list of hosts with one MX value, and a few with a
42081 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
42082 hosts at the top of the list are tried at first. With the default retry rule,
42083 which specifies increasing retry times, the higher MX hosts are eventually
42084 tried when those at the top of the list are skipped because they have not
42085 reached their retry times.
42086 </para>
42087 <para>
42088 However, it is common practice to put a fixed short retry time on domains for
42089 large ISPs, on the grounds that their servers are rarely down for very long.
42090 Unfortunately, these are exactly the domains that tend to resolve to long lists
42091 of hosts. The short retry time means that the lowest MX hosts are tried every
42092 time. The attempts may be in a different order because of random sorting, but
42093 without the special MX check, the higher MX hosts would never be tried until
42094 all the lower MX hosts had timed out (which might be several days), because
42095 there are always some lower MX hosts that have reached their retry times. With
42096 the special check, Exim considers at least one IP address from each MX value at
42097 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
42098 reached.
42099 </para>
42100 <para>
42101 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
42102 particular, Exim normally eventually tries all the IP addresses before timing
42103 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
42104 reasonable thing to do. Recently, however, some lunatic DNS configurations have
42105 been set up with hundreds of IP addresses for some domains. It can
42106 take a very long time indeed for an address to time out in these cases.
42107 </para>
42108 <para>
42109 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
42110 Exim never tries more than this number of IP addresses; if it hits this limit
42111 and they are all timed out, the email address is bounced, even though not all
42112 possible IP addresses have been tried.
42113 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
42114 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
42115 </para>
42116 </section>
42117 </chapter>
42118
42119 <chapter id="CHAPrewrite">
42120 <title>Address rewriting</title>
42121 <para>
42122 <indexterm role="concept" id="IIDaddrew" class="startofrange">
42123 <primary>rewriting</primary>
42124 <secondary>addresses</secondary>
42125 </indexterm>
42126 There are some circumstances in which Exim automatically rewrites domains in
42127 addresses. The two most common are when an address is given without a domain
42128 (referred to as an <quote>unqualified address</quote>) or when an address contains an
42129 abbreviated domain that is expanded by DNS lookup.
42130 </para>
42131 <para>
42132 Unqualified envelope addresses are accepted only for locally submitted
42133 messages, or for messages that are received from hosts matching
42134 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
42135 appropriate. Unqualified addresses in header lines are qualified if they are in
42136 locally submitted messages, or messages from hosts that are permitted to send
42137 unqualified envelope addresses. Otherwise, unqualified addresses in header
42138 lines are neither qualified nor rewritten.
42139 </para>
42140 <para>
42141 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
42142 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
42143 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
42144 do this. The new RFCs do not contain this suggestion.
42145 </para>
42146 <section>
42147 <title>Explicitly configured address rewriting</title>
42148 <para>
42149 This chapter describes the rewriting rules that can be used in the
42150 main rewrite section of the configuration file, and also in the generic
42151 <option>headers_rewrite</option> option that can be set on any transport.
42152 </para>
42153 <para>
42154 Some people believe that configured address rewriting is a Mortal Sin.
42155 Others believe that life is not possible without it. Exim provides the
42156 facility; you do not have to use it.
42157 </para>
42158 <para>
42159 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
42160 configuration file are applied to addresses in incoming messages, both envelope
42161 addresses and addresses in header lines. Each rule specifies the types of
42162 address to which it applies.
42163 </para>
42164 <para>
42165 Whether or not addresses in header lines are rewritten depends on the origin of
42166 the headers and the type of rewriting. Global rewriting, that is, rewriting
42167 rules from the rewrite section of the configuration file, is applied only to
42168 those headers that were received with the message. Header lines that are added
42169 by ACLs or by a system filter or by individual routers or transports (which
42170 are specific to individual recipient addresses) are not rewritten by the global
42171 rules.
42172 </para>
42173 <para>
42174 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
42175 applies all headers except those added by routers and transports. That is, as
42176 well as the headers that were received with the message, it also applies to
42177 headers that were added by an ACL or a system filter.
42178 </para>
42179 <para>
42180 In general, rewriting addresses from your own system or domain has some
42181 legitimacy. Rewriting other addresses should be done only with great care and
42182 in special circumstances. The author of Exim believes that rewriting should be
42183 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
42184 Although it can sometimes be used as a routing tool, this is very strongly
42185 discouraged.
42186 </para>
42187 <para>
42188 There are two commonly encountered circumstances where rewriting is used, as
42189 illustrated by these examples:
42190 </para>
42191 <itemizedlist>
42192 <listitem>
42193 <para>
42194 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
42195 exchange mail with each other behind a firewall, but there is only a single
42196 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
42197 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
42198 </para>
42199 </listitem>
42200 <listitem>
42201 <para>
42202 A host rewrites the local parts of its own users so that, for example,
42203 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
42204 </para>
42205 </listitem>
42206 </itemizedlist>
42207 </section>
42208 <section>
42209 <title>When does rewriting happen?</title>
42210 <para>
42211 <indexterm role="concept">
42212 <primary>rewriting</primary>
42213 <secondary>timing of</secondary>
42214 </indexterm>
42215 <indexterm role="concept">
42216 <primary>access control lists (ACLs)</primary>
42217 <secondary>rewriting addresses in</secondary>
42218 </indexterm>
42219 Configured address rewriting can take place at several different stages of a
42220 message&#x2019;s processing.
42221 </para>
42222 <para>
42223 <indexterm role="concept">
42224 <primary><varname>$sender_address</varname></primary>
42225 </indexterm>
42226 At the start of an ACL for MAIL, the sender address may have been rewritten
42227 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
42228 ordinary rewrite rules have yet been applied. If, however, the sender address
42229 is verified in the ACL, it is rewritten before verification, and remains
42230 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
42231 rewritten address. This also applies if sender verification happens in a
42232 RCPT ACL. Otherwise, when the sender address is not verified, it is
42233 rewritten as soon as a message&#x2019;s header lines have been received.
42234 </para>
42235 <para>
42236 <indexterm role="concept">
42237 <primary><varname>$domain</varname></primary>
42238 </indexterm>
42239 <indexterm role="concept">
42240 <primary><varname>$local_part</varname></primary>
42241 </indexterm>
42242 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
42243 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
42244 rewrite rules have yet been applied to it. However, the behaviour is different
42245 from the sender address when a recipient is verified. The address is rewritten
42246 for the verification, but the rewriting is not remembered at this stage. The
42247 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
42248 as they were before (that is, they contain the unrewritten &ndash; except for
42249 SMTP-time rewriting &ndash; address).
42250 </para>
42251 <para>
42252 As soon as a message&#x2019;s header lines have been received, all the envelope
42253 recipient addresses are permanently rewritten, and rewriting is also applied to
42254 the addresses in the header lines (if configured). This happens before adding
42255 any header lines that were specified in MAIL or RCPT ACLs, and
42256 <indexterm role="concept">
42257 <primary><function>local_scan()</function> function</primary>
42258 <secondary>address rewriting; timing of</secondary>
42259 </indexterm>
42260 before the DATA ACL and <function>local_scan()</function> functions are run.
42261 </para>
42262 <para>
42263 When an address is being routed, either for delivery or for verification,
42264 rewriting is applied immediately to child addresses that are generated by
42265 redirection, unless <option>no_rewrite</option> is set on the router.
42266 </para>
42267 <para>
42268 <indexterm role="concept">
42269 <primary>envelope sender</primary>
42270 <secondary>rewriting at transport time</secondary>
42271 </indexterm>
42272 <indexterm role="concept">
42273 <primary>rewriting</primary>
42274 <secondary>at transport time</secondary>
42275 </indexterm>
42276 <indexterm role="concept">
42277 <primary>header lines</primary>
42278 <secondary>rewriting at transport time</secondary>
42279 </indexterm>
42280 At transport time, additional rewriting of addresses in header lines can be
42281 specified by setting the generic <option>headers_rewrite</option> option on a transport.
42282 This option contains rules that are identical in form to those in the rewrite
42283 section of the configuration file. They are applied to the original message
42284 header lines and any that were added by ACLs or a system filter. They are not
42285 applied to header lines that are added by routers or the transport.
42286 </para>
42287 <para>
42288 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
42289 transport option. However, it is not possible to rewrite envelope recipients at
42290 transport time.
42291 </para>
42292 </section>
42293 <section>
42294 <title>Testing the rewriting rules that apply on input</title>
42295 <para>
42296 <indexterm role="concept">
42297 <primary>rewriting</primary>
42298 <secondary>testing</secondary>
42299 </indexterm>
42300 <indexterm role="concept">
42301 <primary>testing</primary>
42302 <secondary>rewriting</secondary>
42303 </indexterm>
42304 Exim&#x2019;s input rewriting configuration appears in a part of the run time
42305 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
42306 <option>-brw</option> command line option. This takes an address (which can be a full RFC
42307 2822 address) as its argument. The output is a list of how the address would be
42308 transformed by the rewriting rules for each of the different places it might
42309 appear in an incoming message, that is, for each different header and for the
42310 envelope sender and recipient fields. For example,
42311 </para>
42312 <literallayout class="monospaced">
42313 exim -brw ph10@exim.workshop.example
42314 </literallayout>
42315 <para>
42316 might produce the output
42317 </para>
42318 <literallayout class="monospaced">
42319 sender: Philip.Hazel@exim.workshop.example
42320 from: Philip.Hazel@exim.workshop.example
42321 to: ph10@exim.workshop.example
42322 cc: ph10@exim.workshop.example
42323 bcc: ph10@exim.workshop.example
42324 reply-to: Philip.Hazel@exim.workshop.example
42325 env-from: Philip.Hazel@exim.workshop.example
42326 env-to: ph10@exim.workshop.example
42327 </literallayout>
42328 <para>
42329 which shows that rewriting has been set up for that address when used in any of
42330 the source fields, but not when it appears as a recipient address. At the
42331 present time, there is no equivalent way of testing rewriting rules that are
42332 set for a particular transport.
42333 </para>
42334 </section>
42335 <section>
42336 <title>Rewriting rules</title>
42337 <para>
42338 <indexterm role="concept">
42339 <primary>rewriting</primary>
42340 <secondary>rules</secondary>
42341 </indexterm>
42342 The rewrite section of the configuration file consists of lines of rewriting
42343 rules in the form
42344 </para>
42345 <literallayout>
42346 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
42347 </literallayout>
42348 <para>
42349 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
42350 transport option are given as a colon-separated list. Each item in the list
42351 takes the same form as a line in the main rewriting configuration (except that
42352 any colons must be doubled, of course).
42353 </para>
42354 <para>
42355 The formats of source patterns and replacement strings are described below.
42356 Each is terminated by white space, unless enclosed in double quotes, in which
42357 case normal quoting conventions apply inside the quotes. The flags are single
42358 characters which may appear in any order. Spaces and tabs between them are
42359 ignored.
42360 </para>
42361 <para>
42362 For each address that could potentially be rewritten, the rules are scanned in
42363 order, and replacements for the address from earlier rules can themselves be
42364 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
42365 </para>
42366 <para>
42367 The order in which addresses are rewritten is undefined, may change between
42368 releases, and must not be relied on, with one exception: when a message is
42369 received, the envelope sender is always rewritten first, before any header
42370 lines are rewritten. For example, the replacement string for a rewrite of an
42371 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
42372 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
42373 that the envelope sender has already been rewritten.
42374 </para>
42375 <para>
42376 <indexterm role="concept">
42377 <primary><varname>$domain</varname></primary>
42378 </indexterm>
42379 <indexterm role="concept">
42380 <primary><varname>$local_part</varname></primary>
42381 </indexterm>
42382 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
42383 string to refer to the address that is being rewritten. Note that lookup-driven
42384 rewriting can be done by a rule of the form
42385 </para>
42386 <literallayout class="monospaced">
42387 *@*   ${lookup ...
42388 </literallayout>
42389 <para>
42390 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
42391 refer to the address that is being rewritten.
42392 </para>
42393 </section>
42394 <section>
42395 <title>Rewriting patterns</title>
42396 <para>
42397 <indexterm role="concept">
42398 <primary>rewriting</primary>
42399 <secondary>patterns</secondary>
42400 </indexterm>
42401 <indexterm role="concept">
42402 <primary>address list</primary>
42403 <secondary>in a rewriting pattern</secondary>
42404 </indexterm>
42405 The source pattern in a rewriting rule is any item which may appear in an
42406 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
42407 single-item address list, which means that it is expanded before being tested
42408 against the address. As always, if you use a regular expression as a pattern,
42409 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
42410 facility to suppress string expansion within the regular expression.
42411 </para>
42412 <para>
42413 Domains in patterns should be given in lower case. Local parts in patterns are
42414 case-sensitive. If you want to do case-insensitive matching of local parts, you
42415 can use a regular expression that starts with <literal>^(?i)</literal>.
42416 </para>
42417 <para>
42418 <indexterm role="concept">
42419 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
42420 <secondary>in rewriting rules</secondary>
42421 </indexterm>
42422 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
42423 depending on the type of match which occurred. These can be used in the
42424 replacement string to insert portions of the incoming address. <varname>$0</varname> always
42425 refers to the complete incoming address. When a regular expression is used, the
42426 numerical variables are set from its capturing subexpressions. For other types
42427 of pattern they are set as follows:
42428 </para>
42429 <itemizedlist>
42430 <listitem>
42431 <para>
42432 If a local part or domain starts with an asterisk, the numerical variables
42433 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
42434 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
42435 pattern
42436 </para>
42437 <literallayout class="monospaced">
42438 *queen@*.fict.example
42439 </literallayout>
42440 <para>
42441 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
42442 </para>
42443 <literallayout class="monospaced">
42444 $0 = hearts-queen@wonderland.fict.example
42445 $1 = hearts-
42446 $2 = wonderland
42447 </literallayout>
42448 <para>
42449 Note that if the local part does not start with an asterisk, but the domain
42450 does, it is <varname>$1</varname> that contains the wild part of the domain.
42451 </para>
42452 </listitem>
42453 <listitem>
42454 <para>
42455 If the domain part of the pattern is a partial lookup, the wild and fixed parts
42456 of the domain are placed in the next available numerical variables. Suppose,
42457 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
42458 rewriting rule of the form
42459 </para>
42460 <literallayout>
42461 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
42462 </literallayout>
42463 <para>
42464 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
42465 </para>
42466 <literallayout class="monospaced">
42467 $1 = foo
42468 $2 = bar
42469 $3 = baz.example
42470 </literallayout>
42471 <para>
42472 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
42473 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
42474 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
42475 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
42476 whole domain. For non-partial domain lookups, no numerical variables are set.
42477 </para>
42478 </listitem>
42479 </itemizedlist>
42480 </section>
42481 <section>
42482 <title>Rewriting replacements</title>
42483 <para>
42484 <indexterm role="concept">
42485 <primary>rewriting</primary>
42486 <secondary>replacements</secondary>
42487 </indexterm>
42488 If the replacement string for a rule is a single asterisk, addresses that
42489 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
42490 rewriting rules are scanned. For example,
42491 </para>
42492 <literallayout class="monospaced">
42493 hatta@lookingglass.fict.example  *  f
42494 </literallayout>
42495 <para>
42496 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
42497 <emphasis>From:</emphasis> headers.
42498 </para>
42499 <para>
42500 <indexterm role="concept">
42501 <primary><varname>$domain</varname></primary>
42502 </indexterm>
42503 <indexterm role="concept">
42504 <primary><varname>$local_part</varname></primary>
42505 </indexterm>
42506 If the replacement string is not a single asterisk, it is expanded, and must
42507 yield a fully qualified address. Within the expansion, the variables
42508 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
42509 Any letters they contain retain their original case &ndash; they are not lower
42510 cased. The numerical variables are set up according to the type of pattern that
42511 matched the address, as described above. If the expansion is forced to fail by
42512 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
42513 current rule is abandoned, but subsequent rules may take effect. Any other
42514 expansion failure causes the entire rewriting operation to be abandoned, and an
42515 entry written to the panic log.
42516 </para>
42517 </section>
42518 <section>
42519 <title>Rewriting flags</title>
42520 <para>
42521 There are three different kinds of flag that may appear on rewriting rules:
42522 </para>
42523 <itemizedlist>
42524 <listitem>
42525 <para>
42526 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
42527 c, f, h, r, s, t.
42528 </para>
42529 </listitem>
42530 <listitem>
42531 <para>
42532 A flag that specifies rewriting at SMTP time: S.
42533 </para>
42534 </listitem>
42535 <listitem>
42536 <para>
42537 Flags that control the rewriting process: Q, q, R, w.
42538 </para>
42539 </listitem>
42540 </itemizedlist>
42541 <para>
42542 For rules that are part of the <option>headers_rewrite</option> generic transport option,
42543 E, F, T, and S are not permitted.
42544 </para>
42545 </section>
42546 <section>
42547 <title>Flags specifying which headers and envelope addresses to rewrite</title>
42548 <para>
42549 <indexterm role="concept">
42550 <primary>rewriting</primary>
42551 <secondary>flags</secondary>
42552 </indexterm>
42553 If none of the following flag letters, nor the <quote>S</quote> flag (see section
42554 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
42555 and to both the sender and recipient fields of the envelope, whereas a
42556 transport-time rewriting rule just applies to all headers. Otherwise, the
42557 rewriting rule is skipped unless the relevant addresses are being processed.
42558 </para>
42559 <literallayout>
42560 <literal>E</literal>       rewrite all envelope fields
42561 <literal>F</literal>       rewrite the envelope From field
42562 <literal>T</literal>       rewrite the envelope To field
42563 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
42564 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
42565 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
42566 <literal>h</literal>       rewrite all headers
42567 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
42568 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
42569 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
42570 </literallayout>
42571 <para>
42572 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
42573 restrict this to special known cases in your own domains.
42574 </para>
42575 </section>
42576 <section id="SECTrewriteS">
42577 <title>The SMTP-time rewriting flag</title>
42578 <para>
42579 <indexterm role="concept">
42580 <primary>SMTP</primary>
42581 <secondary>rewriting malformed addresses</secondary>
42582 </indexterm>
42583 <indexterm role="concept">
42584 <primary>RCPT</primary>
42585 <secondary>rewriting argument of</secondary>
42586 </indexterm>
42587 <indexterm role="concept">
42588 <primary>MAIL</primary>
42589 <secondary>rewriting argument of</secondary>
42590 </indexterm>
42591 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
42592 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
42593 before any other processing; even before syntax checking. The pattern is
42594 required to be a regular expression, and it is matched against the whole of the
42595 data for the command, including any surrounding angle brackets.
42596 </para>
42597 <para>
42598 <indexterm role="concept">
42599 <primary><varname>$domain</varname></primary>
42600 </indexterm>
42601 <indexterm role="concept">
42602 <primary><varname>$local_part</varname></primary>
42603 </indexterm>
42604 This form of rewrite rule allows for the handling of addresses that are not
42605 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
42606 input). Because the input is not required to be a syntactically valid address,
42607 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
42608 expansion of the replacement string. The result of rewriting replaces the
42609 original address in the MAIL or RCPT command.
42610 </para>
42611 </section>
42612 <section>
42613 <title>Flags controlling the rewriting process</title>
42614 <para>
42615 There are four flags which control the way the rewriting process works. These
42616 take effect only when a rule is invoked, that is, when the address is of the
42617 correct type (matches the flags) and matches the pattern:
42618 </para>
42619 <itemizedlist>
42620 <listitem>
42621 <para>
42622 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
42623 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
42624 absence of <quote>Q</quote> the rewritten address must always include a domain.
42625 </para>
42626 </listitem>
42627 <listitem>
42628 <para>
42629 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
42630 even if no rewriting actually takes place because of a <quote>fail</quote> in the
42631 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
42632 (does not match the flags) or does not match the pattern.
42633 </para>
42634 </listitem>
42635 <listitem>
42636 <para>
42637 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
42638 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
42639 rewriting once it fails to match (after at least one successful rewrite).
42640 </para>
42641 </listitem>
42642 <listitem>
42643 <para>
42644 <indexterm role="concept">
42645 <primary>rewriting</primary>
42646 <secondary>whole addresses</secondary>
42647 </indexterm>
42648 When an address in a header is rewritten, the rewriting normally applies only
42649 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
42650 left unchanged. For example, rewriting might change
42651 </para>
42652 <literallayout class="monospaced">
42653 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
42654 </literallayout>
42655 <para>
42656 into
42657 </para>
42658 <literallayout class="monospaced">
42659 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
42660 </literallayout>
42661 <para>
42662 <indexterm role="concept">
42663 <primary>RFC 2047</primary>
42664 </indexterm>
42665 Sometimes there is a need to replace the whole address item, and this can be
42666 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
42667 causes an address in a header line to be rewritten, the entire address is
42668 replaced, not just the working part. The replacement must be a complete RFC
42669 2822 address, including the angle brackets if necessary. If text outside angle
42670 brackets contains a character whose value is greater than 126 or less than 32
42671 (except for tab), the text is encoded according to RFC 2047. The character set
42672 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
42673 </para>
42674 <para>
42675 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
42676 rewritten, all but the working part of the replacement address is discarded.
42677 </para>
42678 </listitem>
42679 </itemizedlist>
42680 </section>
42681 <section>
42682 <title>Rewriting examples</title>
42683 <para>
42684 Here is an example of the two common rewriting paradigms:
42685 </para>
42686 <literallayout class="monospaced">
42687 *@*.hitch.fict.example  $1@hitch.fict.example
42688 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
42689                      {$value}fail}@hitch.fict.example bctfrF
42690 </literallayout>
42691 <para>
42692 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
42693 the string expansion to fail if the lookup does not succeed. In this context it
42694 has the effect of leaving the original address unchanged, but Exim goes on to
42695 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
42696 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
42697 explicitly, which would cause the rewritten address to be the same as before,
42698 at the cost of a small bit of processing. Not supplying either of these is an
42699 error, since the rewritten address would then contain no local part.
42700 </para>
42701 <para>
42702 The first example above replaces the domain with a superior, more general
42703 domain. This may not be desirable for certain local parts. If the rule
42704 </para>
42705 <literallayout class="monospaced">
42706 root@*.hitch.fict.example  *
42707 </literallayout>
42708 <para>
42709 were inserted before the first rule, rewriting would be suppressed for the
42710 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
42711 </para>
42712 <para>
42713 Rewriting can be made conditional on a number of tests, by making use of
42714 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
42715 messages that originate outside the local host:
42716 </para>
42717 <literallayout class="monospaced">
42718 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
42719                          {$1@hitch.fict.example}fail}"
42720 </literallayout>
42721 <para>
42722 The replacement string is quoted in this example because it contains white
42723 space.
42724 </para>
42725 <para>
42726 <indexterm role="concept">
42727 <primary>rewriting</primary>
42728 <secondary>bang paths</secondary>
42729 </indexterm>
42730 <indexterm role="concept">
42731 <primary>bang paths</primary>
42732 <secondary>rewriting</secondary>
42733 </indexterm>
42734 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
42735 an address it treats it as an unqualified local part which it qualifies with
42736 the local qualification domain (if the source of the message is local or if the
42737 remote host is permitted to send unqualified addresses). Rewriting can
42738 sometimes be used to handle simple bang paths with a fixed number of
42739 components. For example, the rule
42740 </para>
42741 <literallayout class="monospaced">
42742 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
42743 </literallayout>
42744 <para>
42745 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
42746 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
42747 a global rewriting rule for envelope addresses. It can provide a backdoor
42748 method for using your system as a relay, because the incoming addresses appear
42749 to be local. If the bang path addresses are received via SMTP, it is safer to
42750 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
42751 can be done on the rewritten addresses.
42752 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
42753 </para>
42754 </section>
42755 </chapter>
42756
42757 <chapter id="CHAPretry">
42758 <title>Retry configuration</title>
42759 <para>
42760 <indexterm role="concept" id="IIDretconf1" class="startofrange">
42761 <primary>retry configuration</primary>
42762 <secondary>description of</secondary>
42763 </indexterm>
42764 <indexterm role="concept" id="IIDregconf2" class="startofrange">
42765 <primary>configuration file</primary>
42766 <secondary>retry section</secondary>
42767 </indexterm>
42768 The <quote>retry</quote> section of the run time configuration file contains a list of
42769 retry rules that control how often Exim tries to deliver messages that cannot
42770 be delivered at the first attempt. If there are no retry rules, temporary
42771 errors are treated as permanent. The <option>-brt</option> command line option can be used
42772 to test which retry rule will be used for a given address, domain and error.
42773 </para>
42774 <para>
42775 The most common cause of retries is temporary failure to deliver to a remote
42776 host because the host is down, or inaccessible because of a network problem.
42777 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
42778 address) basis, not on a per-message basis. Thus, if one message has recently
42779 been delayed, delivery of a new message to the same host is not immediately
42780 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
42781 log selector is set, the message
42782 <indexterm role="concept">
42783 <primary>retry</primary>
42784 <secondary>time not reached</secondary>
42785 </indexterm>
42786 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
42787 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
42788 the handling of errors during remote deliveries.
42789 </para>
42790 <para>
42791 Retry processing applies to routing as well as to delivering, except as covered
42792 in the next paragraph. The retry rules do not distinguish between these
42793 actions. It is not possible, for example, to specify different behaviour for
42794 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
42795 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
42796 added complication, so did not implement it. However, although they share the
42797 same retry rule, the actual retry times for routing and transporting a given
42798 domain are maintained independently.
42799 </para>
42800 <para>
42801 When a delivery is not part of a queue run (typically an immediate delivery on
42802 receipt of a message), the routers are always run, and local deliveries are
42803 always attempted, even if retry times are set for them. This makes for better
42804 behaviour if one particular message is causing problems (for example, causing
42805 quota overflow, or provoking an error in a filter file). If such a delivery
42806 suffers a temporary failure, the retry data is updated as normal, and
42807 subsequent delivery attempts from queue runs occur only when the retry time for
42808 the local address is reached.
42809 </para>
42810 <section>
42811 <title>Changing retry rules</title>
42812 <para>
42813 If you change the retry rules in your configuration, you should consider
42814 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
42815 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
42816 always safe; that is why they are called <quote>hints</quote>.
42817 </para>
42818 <para>
42819 The hints retry data contains suggested retry times based on the previous
42820 rules. In the case of a long-running problem with a remote host, it might
42821 record the fact that the host has timed out. If your new rules increase the
42822 timeout time for such a host, you should definitely remove the old retry data
42823 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
42824 messages that it should now be retaining.
42825 </para>
42826 </section>
42827 <section>
42828 <title>Format of retry rules</title>
42829 <para>
42830 <indexterm role="concept">
42831 <primary>retry</primary>
42832 <secondary>rules</secondary>
42833 </indexterm>
42834 Each retry rule occupies one line and consists of three or four parts,
42835 separated by white space: a pattern, an error name, an optional list of sender
42836 addresses, and a list of retry parameters. The pattern and sender lists must be
42837 enclosed in double quotes if they contain white space. The rules are searched
42838 in order until one is found where the pattern, error name, and sender list (if
42839 present) match the failing host or address, the error that occurred, and the
42840 message&#x2019;s sender, respectively.
42841 </para>
42842 <para>
42843 The pattern is any single item that may appear in an address list (see section
42844 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
42845 which means that it is expanded before being tested against the address that
42846 has been delayed. A negated address list item is permitted. Address
42847 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
42848 which makes it possible for many retry rules to start with just a domain. For
42849 example,
42850 </para>
42851 <literallayout class="monospaced">
42852 lookingglass.fict.example        *  F,24h,30m;
42853 </literallayout>
42854 <para>
42855 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
42856 whereas
42857 </para>
42858 <literallayout class="monospaced">
42859 alice@lookingglass.fict.example  *  F,24h,30m;
42860 </literallayout>
42861 <para>
42862 applies only to temporary failures involving the local part <option>alice</option>.
42863 In practice, almost all rules start with a domain name pattern without a local
42864 part.
42865 </para>
42866 <para>
42867 <indexterm role="concept">
42868 <primary>regular expressions</primary>
42869 <secondary>in retry rules</secondary>
42870 </indexterm>
42871 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
42872 must match a complete address, not just a domain, because that is how regular
42873 expressions work in address lists.
42874 </para>
42875 <literallayout>
42876 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
42877 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
42878 </literallayout>
42879 </section>
42880 <section>
42881 <title>Choosing which retry rule to use for address errors</title>
42882 <para>
42883 When Exim is looking for a retry rule after a routing attempt has failed (for
42884 example, after a DNS timeout), each line in the retry configuration is tested
42885 against the complete address only if <option>retry_use_local_part</option> is set for the
42886 router. Otherwise, only the domain is used, except when matching against a
42887 regular expression, when the local part of the address is replaced with <quote>*</quote>.
42888 A domain on its own can match a domain pattern, or a pattern that starts with
42889 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
42890 <option>check_local_user</option> is true, and false for other routers.
42891 </para>
42892 <para>
42893 Similarly, when Exim is looking for a retry rule after a local delivery has
42894 failed (for example, after a mailbox full error), each line in the retry
42895 configuration is tested against the complete address only if
42896 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
42897 local transports).
42898 </para>
42899 <para revisionflag="changed">
42900 <indexterm role="concept">
42901 <primary>4<emphasis>xx</emphasis> responses</primary>
42902 <secondary>retry rules for</secondary>
42903 </indexterm>
42904 However, when Exim is looking for a retry rule after a remote delivery attempt
42905 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
42906 whole address is always used as the key when searching the retry rules. The
42907 rule that is found is used to create a retry time for the combination of the
42908 failing address and the message&#x2019;s sender. It is the combination of sender and
42909 recipient that is delayed in subsequent queue runs until its retry time is
42910 reached. You can delay the recipient without regard to the sender by setting
42911 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
42912 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
42913 commands.
42914 </para>
42915 </section>
42916 <section>
42917 <title>Choosing which retry rule to use for host and message errors</title>
42918 <para>
42919 For a temporary error that is not related to an individual address (for
42920 example, a connection timeout), each line in the retry configuration is checked
42921 twice. First, the name of the remote host is used as a domain name (preceded by
42922 <quote>*@</quote> when matching a regular expression). If this does not match the line,
42923 the domain from the email address is tried in a similar fashion. For example,
42924 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
42925 </para>
42926 <literallayout class="monospaced">
42927 a.b.c.example  MX  5  x.y.z.example
42928                MX  6  p.q.r.example
42929                MX  7  m.n.o.example
42930 </literallayout>
42931 <para>
42932 and the retry rules are
42933 </para>
42934 <literallayout class="monospaced">
42935 p.q.r.example    *      F,24h,30m;
42936 a.b.c.example    *      F,4d,45m;
42937 </literallayout>
42938 <para>
42939 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
42940 first rule matches neither the host nor the domain, so Exim looks at the second
42941 rule. This does not match the host, but it does match the domain, so it is used
42942 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
42943 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
42944 first retry rule is used, because it matches the host.
42945 </para>
42946 <para>
42947 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
42948 first rule to determine retry times, but for all the other hosts for the domain
42949 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
42950 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
42951 </para>
42952 <para>
42953 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
42954 However, if a message is routed directly to an IP address without the use of a
42955 host name, for example, if a <command>manualroute</command> router contains a setting such as:
42956 </para>
42957 <literallayout class="monospaced">
42958 route_list = *.a.example  192.168.34.23
42959 </literallayout>
42960 <para>
42961 then the <quote>host name</quote> that is used when searching for a retry rule is the
42962 textual form of the IP address.
42963 </para>
42964 </section>
42965 <section>
42966 <title>Retry rules for specific errors</title>
42967 <para>
42968 <indexterm role="concept">
42969 <primary>retry</primary>
42970 <secondary>specific errors; specifying</secondary>
42971 </indexterm>
42972 The second field in a retry rule is the name of a particular error, or an
42973 asterisk, which matches any error. The errors that can be tested for are:
42974 </para>
42975 <variablelist>
42976 <varlistentry>
42977 <term><option>auth_failed</option></term>
42978 <listitem>
42979 <para>
42980 Authentication failed when trying to send to a host in the
42981 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
42982 </para>
42983 </listitem></varlistentry>
42984 <varlistentry>
42985 <term><option>data_4xx</option></term>
42986 <listitem>
42987 <para>
42988 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
42989 after the command, or after sending the message&#x2019;s data.
42990 </para>
42991 </listitem></varlistentry>
42992 <varlistentry>
42993 <term><option>mail_4xx</option></term>
42994 <listitem>
42995 <para>
42996 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
42997 </para>
42998 </listitem></varlistentry>
42999 <varlistentry>
43000 <term><option>rcpt_4xx</option></term>
43001 <listitem>
43002 <para>
43003 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
43004 </para>
43005 </listitem></varlistentry>
43006 </variablelist>
43007 <para>
43008 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
43009 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
43010 recognize 452 errors given to RCPT commands for addresses in a certain domain,
43011 and have retries every ten minutes with a one-hour timeout, you could set up a
43012 retry rule of this form:
43013 </para>
43014 <literallayout class="monospaced">
43015 the.domain.name  rcpt_452   F,1h,10m
43016 </literallayout>
43017 <para>
43018 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
43019 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
43020 </para>
43021 <variablelist>
43022 <varlistentry>
43023 <term><option>lost_connection</option></term>
43024 <listitem>
43025 <para>
43026 A server unexpectedly closed the SMTP connection. There may, of course,
43027 legitimate reasons for this (host died, network died), but if it repeats a lot
43028 for the same host, it indicates something odd.
43029 </para>
43030 </listitem></varlistentry>
43031 <varlistentry>
43032 <term><option>refused_MX</option></term>
43033 <listitem>
43034 <para>
43035 A connection to a host obtained from an MX record was refused.
43036 </para>
43037 </listitem></varlistentry>
43038 <varlistentry>
43039 <term><option>refused_A</option></term>
43040 <listitem>
43041 <para>
43042 A connection to a host not obtained from an MX record was refused.
43043 </para>
43044 </listitem></varlistentry>
43045 <varlistentry>
43046 <term><option>refused</option></term>
43047 <listitem>
43048 <para>
43049 A connection was refused.
43050 </para>
43051 </listitem></varlistentry>
43052 <varlistentry>
43053 <term><option>timeout_connect_MX</option></term>
43054 <listitem>
43055 <para>
43056 A connection attempt to a host obtained from an MX record timed out.
43057 </para>
43058 </listitem></varlistentry>
43059 <varlistentry>
43060 <term><option>timeout_connect_A</option></term>
43061 <listitem>
43062 <para>
43063 A connection attempt to a host not obtained from an MX record timed out.
43064 </para>
43065 </listitem></varlistentry>
43066 <varlistentry>
43067 <term><option>timeout_connect</option></term>
43068 <listitem>
43069 <para>
43070 A connection attempt timed out.
43071 </para>
43072 </listitem></varlistentry>
43073 <varlistentry>
43074 <term><option>timeout_MX</option></term>
43075 <listitem>
43076 <para>
43077 There was a timeout while connecting or during an SMTP session with a host
43078 obtained from an MX record.
43079 </para>
43080 </listitem></varlistentry>
43081 <varlistentry>
43082 <term><option>timeout_A</option></term>
43083 <listitem>
43084 <para>
43085 There was a timeout while connecting or during an SMTP session with a host not
43086 obtained from an MX record.
43087 </para>
43088 </listitem></varlistentry>
43089 <varlistentry>
43090 <term><option>timeout</option></term>
43091 <listitem>
43092 <para>
43093 There was a timeout while connecting or during an SMTP session.
43094 </para>
43095 </listitem></varlistentry>
43096 <varlistentry>
43097 <term><option>tls_required</option></term>
43098 <listitem>
43099 <para>
43100 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
43101 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
43102 to STARTTLS, or there was a problem setting up the TLS connection.
43103 </para>
43104 </listitem></varlistentry>
43105 <varlistentry>
43106 <term><option>quota</option></term>
43107 <listitem>
43108 <para>
43109 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43110 transport.
43111 </para>
43112 </listitem></varlistentry>
43113 <varlistentry>
43114 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
43115 <listitem>
43116 <para>
43117 <indexterm role="concept">
43118 <primary>quota</primary>
43119 <secondary>error testing in retry rule</secondary>
43120 </indexterm>
43121 <indexterm role="concept">
43122 <primary>retry</primary>
43123 <secondary>quota error testing</secondary>
43124 </indexterm>
43125 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
43126 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
43127 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
43128 for four days.
43129 </para>
43130 </listitem></varlistentry>
43131 </variablelist>
43132 <para>
43133 <indexterm role="concept">
43134 <primary>mailbox</primary>
43135 <secondary>time of last read</secondary>
43136 </indexterm>
43137 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
43138 timeouts when the mailbox is full and is not being read by its owner. Ideally,
43139 it should be based on the last time that the user accessed the mailbox.
43140 However, it is not always possible to determine this. Exim uses the following
43141 heuristic rules:
43142 </para>
43143 <itemizedlist>
43144 <listitem>
43145 <para>
43146 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
43147 used. As no new messages are being delivered (because the mailbox is over
43148 quota), Exim does not access the file, so this is the time of last user access.
43149 </para>
43150 </listitem>
43151 <listitem>
43152 <para>
43153 <indexterm role="concept">
43154 <primary>maildir format</primary>
43155 <secondary>time of last read</secondary>
43156 </indexterm>
43157 For a maildir delivery, the time of last modification of the <filename>new</filename>
43158 subdirectory is used. As the mailbox is over quota, no new files are created in
43159 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
43160 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
43161 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
43162 time that is used is therefore the last time that the user read a new message.
43163 </para>
43164 </listitem>
43165 <listitem>
43166 <para>
43167 For other kinds of multi-file mailbox, the time of last access cannot be
43168 obtained, so a retry rule that uses this type of error field is never matched.
43169 </para>
43170 </listitem>
43171 </itemizedlist>
43172 <para>
43173 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
43174 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
43175 when a local delivery is deferred because a partition is full (the ENOSPC
43176 error).
43177 </para>
43178 </section>
43179 <section>
43180 <title>Retry rules for specified senders</title>
43181 <para>
43182 <indexterm role="concept">
43183 <primary>retry</primary>
43184 <secondary>rules; sender-specific</secondary>
43185 </indexterm>
43186 You can specify retry rules that apply only when the failing message has a
43187 specific sender. In particular, this can be used to define retry rules that
43188 apply only to bounce messages. The third item in a retry rule can be of this
43189 form:
43190 </para>
43191 <literallayout>
43192 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
43193 </literallayout>
43194 <para>
43195 The retry timings themselves are then the fourth item. For example:
43196 </para>
43197 <literallayout class="monospaced">
43198 *   rcpt_4xx   senders=:   F,1h,30m
43199 </literallayout>
43200 <para>
43201 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
43202 host. If the address list contains white space, it must be enclosed in quotes.
43203 For example:
43204 </para>
43205 <literallayout class="monospaced">
43206 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
43207 </literallayout>
43208 <para>
43209 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
43210 (which do not depend on the recipient). The reason is that the sender is used
43211 only to match the retry rule. Once the rule has been found for a host error,
43212 its contents are used to set a retry time for the host, and this will apply to
43213 all messages, not just those with specific senders.
43214 </para>
43215 <para>
43216 When testing retry rules using <option>-brt</option>, you can supply a sender using the
43217 <option>-f</option> command line option, like this:
43218 </para>
43219 <literallayout class="monospaced">
43220 exim -f "" -brt user@dom.ain
43221 </literallayout>
43222 <para>
43223 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
43224 list is never matched.
43225 </para>
43226 </section>
43227 <section>
43228 <title>Retry parameters</title>
43229 <para>
43230 <indexterm role="concept">
43231 <primary>retry</primary>
43232 <secondary>parameters in rules</secondary>
43233 </indexterm>
43234 The third (or fourth, if a senders list is present) field in a retry rule is a
43235 sequence of retry parameter sets, separated by semicolons. Each set consists of
43236 </para>
43237 <literallayout>
43238 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
43239 </literallayout>
43240 <para>
43241 The letter identifies the algorithm for computing a new retry time; the cutoff
43242 time is the time beyond which this algorithm no longer applies, and the
43243 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
43244 time that the first failure for the domain (combined with the local part if
43245 relevant) was detected, not from the time the message was received.
43246 </para>
43247 <para>
43248 <indexterm role="concept">
43249 <primary>retry</primary>
43250 <secondary>algorithms</secondary>
43251 </indexterm>
43252 <indexterm role="concept">
43253 <primary>retry</primary>
43254 <secondary>fixed intervals</secondary>
43255 </indexterm>
43256 <indexterm role="concept">
43257 <primary>retry</primary>
43258 <secondary>increasing intervals</secondary>
43259 </indexterm>
43260 <indexterm role="concept">
43261 <primary>retry</primary>
43262 <secondary>random intervals</secondary>
43263 </indexterm>
43264 The available algorithms are:
43265 </para>
43266 <itemizedlist>
43267 <listitem>
43268 <para>
43269 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
43270 the interval.
43271 </para>
43272 </listitem>
43273 <listitem>
43274 <para>
43275 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
43276 specifies a starting value for the interval, and the second a multiplier, which
43277 is used to increase the size of the interval at each retry.
43278 </para>
43279 </listitem>
43280 <listitem>
43281 <para>
43282 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
43283 retry, the previous interval is multiplied by the factor in order to get a
43284 maximum for the next interval. The mininum interval is the first argument of
43285 the parameter, and an actual interval is chosen randomly between them. Such a
43286 rule has been found to be helpful in cluster configurations when all the
43287 members of the cluster restart at once, and may therefore synchronize their
43288 queue processing times.
43289 </para>
43290 </listitem>
43291 </itemizedlist>
43292 <para>
43293 When computing the next retry time, the algorithm definitions are scanned in
43294 order until one whose cutoff time has not yet passed is reached. This is then
43295 used to compute a new retry time that is later than the current time. In the
43296 case of fixed interval retries, this simply means adding the interval to the
43297 current time. For geometrically increasing intervals, retry intervals are
43298 computed from the rule&#x2019;s parameters until one that is greater than the previous
43299 interval is found. The main configuration variable
43300 <indexterm role="concept">
43301 <primary>limit</primary>
43302 <secondary>retry interval</secondary>
43303 </indexterm>
43304 <indexterm role="concept">
43305 <primary>retry interval</primary>
43306 <secondary>maximum</secondary>
43307 </indexterm>
43308 <indexterm role="concept">
43309 <primary><option>retry_interval_max</option></primary>
43310 </indexterm>
43311 <option>retry_interval_max</option> limits the maximum interval between retries. It
43312 cannot be set greater than <literal>24h</literal>, which is its default value.
43313 </para>
43314 <para>
43315 A single remote domain may have a number of hosts associated with it, and each
43316 host may have more than one IP address. Retry algorithms are selected on the
43317 basis of the domain name, but are applied to each IP address independently. If,
43318 for example, a host has two IP addresses and one is unusable, Exim will
43319 generate retry times for it and will not try to use it until its next retry
43320 time comes. Thus the good IP address is likely to be tried first most of the
43321 time.
43322 </para>
43323 <para>
43324 <indexterm role="concept">
43325 <primary>hints database</primary>
43326 <secondary>use for retrying</secondary>
43327 </indexterm>
43328 Retry times are hints rather than promises. Exim does not make any attempt to
43329 run deliveries exactly at the computed times. Instead, a queue runner process
43330 starts delivery processes for delayed messages periodically, and these attempt
43331 new deliveries only for those addresses that have passed their next retry time.
43332 If a new message arrives for a deferred address, an immediate delivery attempt
43333 occurs only if the address has passed its retry time. In the absence of new
43334 messages, the minimum time between retries is the interval between queue runner
43335 processes. There is not much point in setting retry times of five minutes if
43336 your queue runners happen only once an hour, unless there are a significant
43337 number of incoming messages (which might be the case on a system that is
43338 sending everything to a smart host, for example).
43339 </para>
43340 <para>
43341 The data in the retry hints database can be inspected by using the
43342 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
43343 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
43344 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
43345 are for the hosts associated with a particular mail domain, and also for local
43346 deliveries that have been deferred.
43347 </para>
43348 </section>
43349 <section>
43350 <title>Retry rule examples</title>
43351 <para>
43352 Here are some example retry rules:
43353 </para>
43354 <literallayout class="monospaced">
43355 alice@wonderland.fict.example quota_5d  F,7d,3h
43356 wonderland.fict.example       quota_5d
43357 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
43358 lookingglass.fict.example     *         F,24h,30m;
43359 *                 refused_A   F,2h,20m;
43360 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
43361 </literallayout>
43362 <para>
43363 The first rule sets up special handling for mail to
43364 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
43365 mailbox has not been read for at least 5 days. Retries continue every three
43366 hours for 7 days. The second rule handles over-quota errors for all other local
43367 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
43368 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
43369 fail are bounced immediately if the mailbox has not been read for at least 5
43370 days.
43371 </para>
43372 <para>
43373 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
43374 happen every 15 minutes for an hour, then with geometrically increasing
43375 intervals until two days have passed since a delivery first failed. After the
43376 first hour there is a delay of one hour, then two hours, then four hours, and
43377 so on (this is a rather extreme example).
43378 </para>
43379 <para>
43380 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
43381 They happen every 30 minutes for 24 hours only. The remaining two rules handle
43382 all other domains, with special action for connection refusal from hosts that
43383 were not obtained from an MX record.
43384 </para>
43385 <para>
43386 The final rule in a retry configuration should always have asterisks in the
43387 first two fields so as to provide a general catch-all for any addresses that do
43388 not have their own special handling. This example tries every 15 minutes for 2
43389 hours, then with intervals starting at one hour and increasing by a factor of
43390 1.5 up to 16 hours, then every 8 hours up to 5 days.
43391 </para>
43392 </section>
43393 <section>
43394 <title>Timeout of retry data</title>
43395 <para>
43396 <indexterm role="concept">
43397 <primary>timeout</primary>
43398 <secondary>of retry data</secondary>
43399 </indexterm>
43400 <indexterm role="concept">
43401 <primary><option>retry_data_expire</option></primary>
43402 </indexterm>
43403 <indexterm role="concept">
43404 <primary>hints database</primary>
43405 <secondary>data expiry</secondary>
43406 </indexterm>
43407 <indexterm role="concept">
43408 <primary>retry</primary>
43409 <secondary>timeout of data</secondary>
43410 </indexterm>
43411 Exim timestamps the data that it writes to its retry hints database. When it
43412 consults the data during a delivery it ignores any that is older than the value
43413 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
43414 been tried for 7 days, Exim will try to deliver to it immediately a message
43415 arrives, and if that fails, it will calculate a retry time as if it were
43416 failing for the first time.
43417 </para>
43418 <para>
43419 This improves the behaviour for messages routed to rarely-used hosts such as MX
43420 backups. If such a host was down at one time, and happens to be down again when
43421 Exim tries a month later, using the old retry data would imply that it had been
43422 down all the time, which is not a justified assumption.
43423 </para>
43424 <para>
43425 If a host really is permanently dead, this behaviour causes a burst of retries
43426 every now and again, but only if messages routed to it are rare. If there is a
43427 message at least once every 7 days the retry data never expires.
43428 </para>
43429 </section>
43430 <section>
43431 <title>Long-term failures</title>
43432 <para>
43433 <indexterm role="concept">
43434 <primary>delivery failure</primary>
43435 <secondary>long-term</secondary>
43436 </indexterm>
43437 <indexterm role="concept">
43438 <primary>retry</primary>
43439 <secondary>after long-term failure</secondary>
43440 </indexterm>
43441 Special processing happens when an email address has been failing for so long
43442 that the cutoff time for the last algorithm is reached. For example, using the
43443 default retry rule:
43444 </para>
43445 <literallayout class="monospaced">
43446 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
43447 </literallayout>
43448 <para>
43449 the cutoff time is four days. Reaching the retry cutoff is independent of how
43450 long any specific message has been failing; it is the length of continuous
43451 failure for the recipient address that counts.
43452 </para>
43453 <para>
43454 When the cutoff time is reached for a local delivery, or for all the IP
43455 addresses associated with a remote delivery, a subsequent delivery failure
43456 causes Exim to give up on the address, and a bounce message is generated.
43457 In order to cater for new messages that use the failing address, a next retry
43458 time is still computed from the final algorithm, and is used as follows:
43459 </para>
43460 <para>
43461 For local deliveries, one delivery attempt is always made for any subsequent
43462 messages. If this delivery fails, the address fails immediately. The
43463 post-cutoff retry time is not used.
43464 </para>
43465 <para>
43466 If the delivery is remote, there are two possibilities, controlled by the
43467 <indexterm role="concept">
43468 <primary><option>delay_after_cutoff</option></primary>
43469 </indexterm>
43470 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
43471 default. Until the post-cutoff retry time for one of the IP addresses is
43472 reached, the failing email address is bounced immediately, without a delivery
43473 attempt taking place. After that time, one new delivery attempt is made to
43474 those IP addresses that are past their retry times, and if that still fails,
43475 the address is bounced and new retry times are computed.
43476 </para>
43477 <para>
43478 In other words, when all the hosts for a given email address have been failing
43479 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
43480 times is reached. Then it tries once, and bounces if that attempt fails. This
43481 behaviour ensures that few resources are wasted in repeatedly trying to deliver
43482 to a broken destination, but if the host does recover, Exim will eventually
43483 notice.
43484 </para>
43485 <para>
43486 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
43487 addresses are past their final cutoff time, Exim tries to deliver to those IP
43488 addresses that have not been tried since the message arrived. If there are
43489 no suitable IP addresses, or if they all fail, the address is bounced. In other
43490 words, it does not delay when a new message arrives, but tries the expired
43491 addresses immediately, unless they have been tried since the message arrived.
43492 If there is a continuous stream of messages for the failing domains, setting
43493 <option>delay_after_cutoff</option> false means that there will be many more attempts to
43494 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
43495 true.
43496 </para>
43497 </section>
43498 <section>
43499 <title>Deliveries that work intermittently</title>
43500 <para>
43501 <indexterm role="concept">
43502 <primary>retry</primary>
43503 <secondary>intermittently working deliveries</secondary>
43504 </indexterm>
43505 Some additional logic is needed to cope with cases where a host is
43506 intermittently available, or when a message has some attribute that prevents
43507 its delivery when others to the same address get through. In this situation,
43508 because some messages are successfully delivered, the <quote>retry clock</quote> for the
43509 host or address keeps getting reset by the successful deliveries, and so
43510 failing messages remain on the queue for ever because the cutoff time is never
43511 reached.
43512 </para>
43513 <para>
43514 Two exceptional actions are applied to prevent this happening. The first
43515 applies to errors that are related to a message rather than a remote host.
43516 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
43517 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
43518 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
43519 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
43520 is used when scanning the retry rules to decide when to try next and when to
43521 time out the address.
43522 </para>
43523 <para>
43524 The exceptional second action applies in all cases. If a message has been on
43525 the queue for longer than the cutoff time of any applicable retry rule for a
43526 given address, a delivery is attempted for that address, even if it is not yet
43527 time, and if this delivery fails, the address is timed out. A new retry time is
43528 not computed in this case, so that other messages for the same address are
43529 considered immediately.
43530 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
43531 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
43532 </para>
43533 </section>
43534 </chapter>
43535
43536 <chapter id="CHAPSMTPAUTH">
43537 <title>SMTP authentication</title>
43538 <para>
43539 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
43540 <primary>SMTP</primary>
43541 <secondary>authentication configuration</secondary>
43542 </indexterm>
43543 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
43544 <primary>authentication</primary>
43545 </indexterm>
43546 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
43547 with SMTP authentication. This facility is an extension to the SMTP protocol,
43548 described in RFC 2554, which allows a client SMTP host to authenticate itself
43549 to a server. This is a common way for a server to recognize clients that are
43550 permitted to use it as a relay. SMTP authentication is not of relevance to the
43551 transfer of mail between servers that have no managerial connection with each
43552 other.
43553 </para>
43554 <para>
43555 <indexterm role="concept">
43556 <primary>AUTH</primary>
43557 <secondary>description of</secondary>
43558 </indexterm>
43559 Very briefly, the way SMTP authentication works is as follows:
43560 </para>
43561 <itemizedlist>
43562 <listitem>
43563 <para>
43564 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
43565 the client&#x2019;s EHLO command.
43566 </para>
43567 </listitem>
43568 <listitem>
43569 <para>
43570 The client issues an AUTH command, naming a specific mechanism. The command
43571 may, optionally, contain some authentication data.
43572 </para>
43573 </listitem>
43574 <listitem>
43575 <para>
43576 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
43577 appropriate responses. In simple authentication mechanisms, the challenges are
43578 just prompts for user names and passwords. The server does not have to issue
43579 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
43580 with the AUTH command.
43581 </para>
43582 </listitem>
43583 <listitem>
43584 <para>
43585 The server either accepts or denies authentication.
43586 </para>
43587 </listitem>
43588 <listitem>
43589 <para>
43590 If authentication succeeds, the client may optionally make use of the AUTH
43591 option on the MAIL command to pass an authenticated sender in subsequent
43592 mail transactions. Authentication lasts for the remainder of the SMTP
43593 connection.
43594 </para>
43595 </listitem>
43596 <listitem>
43597 <para>
43598 If authentication fails, the client may give up, or it may try a different
43599 authentication mechanism, or it may try transferring mail over the
43600 unauthenticated connection.
43601 </para>
43602 </listitem>
43603 </itemizedlist>
43604 <para>
43605 If you are setting up a client, and want to know which authentication
43606 mechanisms the server supports, you can use Telnet to connect to port 25 (the
43607 SMTP port) on the server, and issue an EHLO command. The response to this
43608 includes the list of supported mechanisms. For example:
43609 </para>
43610 <literallayout>
43611 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
43612 <literal>Trying 192.168.34.25...</literal>
43613 <literal>Connected to server.example.</literal>
43614 <literal>Escape character is '^]'.</literal>
43615 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
43616 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
43617 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
43618 <literal>250-SIZE 52428800</literal>
43619 <literal>250-PIPELINING</literal>
43620 <literal>250-AUTH PLAIN</literal>
43621 <literal>250 HELP</literal>
43622 </literallayout>
43623 <para>
43624 The second-last line of this example output shows that the server supports
43625 authentication using the PLAIN mechanism. In Exim, the different authentication
43626 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
43627 routers and transports, which authenticators are included in the binary is
43628 controlled by build-time definitions. The following are currently available,
43629 included by setting
43630 </para>
43631 <literallayout class="monospaced">
43632 AUTH_CRAM_MD5=yes
43633 AUTH_CYRUS_SASL=yes
43634 AUTH_PLAINTEXT=yes
43635 AUTH_SPA=yes
43636 </literallayout>
43637 <para>
43638 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
43639 authentication mechanism (RFC 2195), and the second provides an interface to
43640 the Cyrus SASL authentication library. The third can be configured to support
43641 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
43642 not formally documented, but used by several MUAs. The fourth authenticator
43643 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
43644 </para>
43645 <para>
43646 The authenticators are configured using the same syntax as other drivers (see
43647 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
43648 authentication section need be present in the configuration file. Each
43649 authenticator can in principle have both server and client functions. When Exim
43650 is receiving SMTP mail, it is acting as a server; when it is sending out
43651 messages over SMTP, it is acting as a client. Authenticator configuration
43652 options are provided for use in both these circumstances.
43653 </para>
43654 <para>
43655 To make it clear which options apply to which situation, the prefixes
43656 <option>server_</option> and <option>client_</option> are used on option names that are specific to
43657 either the server or the client function, respectively. Server and client
43658 functions are disabled if none of their options are set. If an authenticator is
43659 to be used for both server and client functions, a single definition, using
43660 both sets of options, is required. For example:
43661 </para>
43662 <literallayout class="monospaced">
43663 cram:
43664   driver = cram_md5
43665   public_name = CRAM-MD5
43666   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
43667   client_name = ph10
43668   client_secret = secret2
43669 </literallayout>
43670 <para>
43671 The <option>server_</option> option is used when Exim is acting as a server, and the
43672 <option>client_</option> options when it is acting as a client.
43673 </para>
43674 <para>
43675 Descriptions of the individual authenticators are given in subsequent chapters.
43676 The remainder of this chapter covers the generic options for the
43677 authenticators, followed by general discussion of the way authentication works
43678 in Exim.
43679 </para>
43680 <section>
43681 <title>Generic options for authenticators</title>
43682 <para>
43683 <indexterm role="concept">
43684 <primary>authentication</primary>
43685 <secondary>generic options</secondary>
43686 </indexterm>
43687 <indexterm role="concept">
43688 <primary>options</primary>
43689 <secondary>generic; for authenticators</secondary>
43690 </indexterm>
43691 </para>
43692 <para>
43693 <indexterm role="option">
43694 <primary><option>driver</option></primary>
43695 </indexterm>
43696 </para>
43697 <informaltable frame="all">
43698 <tgroup cols="4" colsep="0" rowsep="0">
43699 <colspec colwidth="8*" align="left"/>
43700 <colspec colwidth="5*" align="center"/>
43701 <colspec colwidth="5*" align="center"/>
43702 <colspec colwidth="6*" align="right"/>
43703 <tbody>
43704 <row>
43705 <entry><option>driver</option></entry>
43706 <entry>Use: <emphasis>authenticators</emphasis></entry>
43707 <entry>Type: <emphasis>string</emphasis></entry>
43708 <entry>Default: <emphasis>unset</emphasis></entry>
43709 </row>
43710 </tbody>
43711 </tgroup>
43712 </informaltable>
43713 <para>
43714 This option must always be set. It specifies which of the available
43715 authenticators is to be used.
43716 </para>
43717 <para>
43718 <indexterm role="option">
43719 <primary><option>public_name</option></primary>
43720 </indexterm>
43721 </para>
43722 <informaltable frame="all">
43723 <tgroup cols="4" colsep="0" rowsep="0">
43724 <colspec colwidth="8*" align="left"/>
43725 <colspec colwidth="5*" align="center"/>
43726 <colspec colwidth="5*" align="center"/>
43727 <colspec colwidth="6*" align="right"/>
43728 <tbody>
43729 <row>
43730 <entry><option>public_name</option></entry>
43731 <entry>Use: <emphasis>authenticators</emphasis></entry>
43732 <entry>Type: <emphasis>string</emphasis></entry>
43733 <entry>Default: <emphasis>unset</emphasis></entry>
43734 </row>
43735 </tbody>
43736 </tgroup>
43737 </informaltable>
43738 <para>
43739 This option specifies the name of the authentication mechanism that the driver
43740 implements, and by which it is known to the outside world. These names should
43741 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
43742 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
43743 defaults to the driver&#x2019;s instance name.
43744 </para>
43745 <para>
43746 <indexterm role="option">
43747 <primary><option>server_advertise_condition</option></primary>
43748 </indexterm>
43749 </para>
43750 <informaltable frame="all">
43751 <tgroup cols="4" colsep="0" rowsep="0">
43752 <colspec colwidth="8*" align="left"/>
43753 <colspec colwidth="5*" align="center"/>
43754 <colspec colwidth="5*" align="center"/>
43755 <colspec colwidth="6*" align="right"/>
43756 <tbody>
43757 <row>
43758 <entry><option>server_advertise_condition</option></entry>
43759 <entry>Use: <emphasis>authenticators</emphasis></entry>
43760 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43761 <entry>Default: <emphasis>unset</emphasis></entry>
43762 </row>
43763 </tbody>
43764 </tgroup>
43765 </informaltable>
43766 <para>
43767 When a server is about to advertise an authentication mechanism, the condition
43768 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
43769 mechanism is not advertised.
43770 If the expansion fails, the mechanism is not advertised. If the failure was not
43771 forced, and was not caused by a lookup defer, the incident is logged.
43772 See section <xref linkend="SECTauthexiser"/> below for further discussion.
43773 </para>
43774 <para revisionflag="changed">
43775 <indexterm role="option">
43776 <primary><option>server_condition</option></primary>
43777 </indexterm>
43778 </para>
43779 <informaltable frame="all" revisionflag="changed">
43780 <tgroup cols="4" colsep="0" rowsep="0">
43781 <colspec colwidth="8*" align="left"/>
43782 <colspec colwidth="5*" align="center"/>
43783 <colspec colwidth="5*" align="center"/>
43784 <colspec colwidth="6*" align="right"/>
43785 <tbody>
43786 <row>
43787 <entry><option>server_condition</option></entry>
43788 <entry>Use: <emphasis>authenticators</emphasis></entry>
43789 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43790 <entry>Default: <emphasis>unset</emphasis></entry>
43791 </row>
43792 </tbody>
43793 </tgroup>
43794 </informaltable>
43795 <para revisionflag="changed">
43796 This option must be set for a <option>plaintext</option> server authenticator, where it
43797 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
43798 for details.
43799 </para>
43800 <para revisionflag="changed">
43801 For the other authenticators, <option>server_condition</option> can be used as an additional
43802 authentication or authorization mechanism that is applied after the other
43803 authenticator conditions succeed. If it is set, it is expanded when the
43804 authenticator would otherwise return a success code. If the expansion is forced
43805 to fail, authentication fails. Any other expansion failure causes a temporary
43806 error code to be returned. If the result of a successful expansion is an empty
43807 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
43808 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
43809 other result, a temporary error code is returned, with the expanded string as
43810 the error text.
43811 </para>
43812 <para>
43813 <indexterm role="option">
43814 <primary><option>server_debug_print</option></primary>
43815 </indexterm>
43816 </para>
43817 <informaltable frame="all">
43818 <tgroup cols="4" colsep="0" rowsep="0">
43819 <colspec colwidth="8*" align="left"/>
43820 <colspec colwidth="5*" align="center"/>
43821 <colspec colwidth="5*" align="center"/>
43822 <colspec colwidth="6*" align="right"/>
43823 <tbody>
43824 <row>
43825 <entry><option>server_debug_print</option></entry>
43826 <entry>Use: <emphasis>authenticators</emphasis></entry>
43827 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43828 <entry>Default: <emphasis>unset</emphasis></entry>
43829 </row>
43830 </tbody>
43831 </tgroup>
43832 </informaltable>
43833 <para>
43834 If this option is set and authentication debugging is enabled (see the <option>-d</option>
43835 command line option), the string is expanded and included in the debugging
43836 output when the authenticator is run as a server. This can help with checking
43837 out the values of variables.
43838 If expansion of the string fails, the error message is written to the debugging
43839 output, and Exim carries on processing.
43840 </para>
43841 <para>
43842 <indexterm role="option">
43843 <primary><option>server_set_id</option></primary>
43844 </indexterm>
43845 </para>
43846 <informaltable frame="all">
43847 <tgroup cols="4" colsep="0" rowsep="0">
43848 <colspec colwidth="8*" align="left"/>
43849 <colspec colwidth="5*" align="center"/>
43850 <colspec colwidth="5*" align="center"/>
43851 <colspec colwidth="6*" align="right"/>
43852 <tbody>
43853 <row>
43854 <entry><option>server_set_id</option></entry>
43855 <entry>Use: <emphasis>authenticators</emphasis></entry>
43856 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43857 <entry>Default: <emphasis>unset</emphasis></entry>
43858 </row>
43859 </tbody>
43860 </tgroup>
43861 </informaltable>
43862 <para>
43863 <indexterm role="concept">
43864 <primary><varname>$authenticated_id</varname></primary>
43865 </indexterm>
43866 When an Exim server successfully authenticates a client, this string is
43867 expanded using data from the authentication, and preserved for any incoming
43868 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
43869 lines for incoming messages. For example, a user/password authenticator
43870 configuration might preserve the user name that was used to authenticate, and
43871 refer to it subsequently during delivery of the message.
43872 If expansion fails, the option is ignored.
43873 </para>
43874 <para>
43875 <indexterm role="option">
43876 <primary><option>server_mail_auth_condition</option></primary>
43877 </indexterm>
43878 </para>
43879 <informaltable frame="all">
43880 <tgroup cols="4" colsep="0" rowsep="0">
43881 <colspec colwidth="8*" align="left"/>
43882 <colspec colwidth="5*" align="center"/>
43883 <colspec colwidth="5*" align="center"/>
43884 <colspec colwidth="6*" align="right"/>
43885 <tbody>
43886 <row>
43887 <entry><option>server_mail_auth_condition</option></entry>
43888 <entry>Use: <emphasis>authenticators</emphasis></entry>
43889 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43890 <entry>Default: <emphasis>unset</emphasis></entry>
43891 </row>
43892 </tbody>
43893 </tgroup>
43894 </informaltable>
43895 <para>
43896 This option allows a server to discard authenticated sender addresses supplied
43897 as part of MAIL commands in SMTP connections that are authenticated by the
43898 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
43899 as part of the authentication process; instead its (unexpanded) value is
43900 remembered for later use.
43901 How it is used is described in the following section.
43902 </para>
43903 </section>
43904 <section id="SECTauthparamail">
43905 <title>The AUTH parameter on MAIL commands</title>
43906 <para>
43907 <indexterm role="concept">
43908 <primary>authentication</primary>
43909 <secondary>sender; authenticated</secondary>
43910 </indexterm>
43911 <indexterm role="concept">
43912 <primary>AUTH</primary>
43913 <secondary>on MAIL command</secondary>
43914 </indexterm>
43915 When a client supplied an AUTH= item on a MAIL command, Exim applies
43916 the following checks before accepting it as the authenticated sender of the
43917 message:
43918 </para>
43919 <itemizedlist>
43920 <listitem>
43921 <para>
43922 If the connection is not using extended SMTP (that is, HELO was used rather
43923 than EHLO), the use of AUTH= is a syntax error.
43924 </para>
43925 </listitem>
43926 <listitem>
43927 <para>
43928 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
43929 </para>
43930 </listitem>
43931 <listitem>
43932 <para>
43933 <indexterm role="concept">
43934 <primary><varname>$authenticated_sender</varname></primary>
43935 </indexterm>
43936 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
43937 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
43938 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
43939 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
43940 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
43941 given for the MAIL command.
43942 </para>
43943 </listitem>
43944 <listitem>
43945 <para>
43946 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
43947 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
43948 authenticated.
43949 </para>
43950 </listitem>
43951 <listitem>
43952 <para>
43953 If the AUTH= value was accepted by either of the two previous rules, and
43954 the client has authenticated, and the authenticator has a setting for the
43955 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
43956 valued that was saved from the authenticator is expanded. If the expansion
43957 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
43958 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
43959 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
43960 message.
43961 </para>
43962 </listitem>
43963 </itemizedlist>
43964 <para>
43965 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
43966 hosts to which Exim authenticates as a client. Do not confuse this value with
43967 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
43968 process, and which is not usually a complete email address.
43969 </para>
43970 <para>
43971 <indexterm role="concept">
43972 <primary><varname>$sender_address</varname></primary>
43973 </indexterm>
43974 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
43975 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
43976 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
43977 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
43978 ACL is run.
43979 </para>
43980 </section>
43981 <section id="SECTauthexiser">
43982 <title>Authentication on an Exim server</title>
43983 <para>
43984 <indexterm role="concept">
43985 <primary>authentication</primary>
43986 <secondary>on an Exim server</secondary>
43987 </indexterm>
43988 When Exim receives an EHLO command, it advertises the public names of those
43989 authenticators that are configured as servers, subject to the following
43990 conditions:
43991 </para>
43992 <itemizedlist>
43993 <listitem>
43994 <para>
43995 The client host must match <option>auth_advertise_hosts</option> (default *).
43996 </para>
43997 </listitem>
43998 <listitem>
43999 <para>
44000 It the <option>server_advertise_condition</option> option is set, its expansion must not
44001 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
44002 </para>
44003 </listitem>
44004 </itemizedlist>
44005 <para>
44006 The order in which the authenticators are defined controls the order in which
44007 the mechanisms are advertised.
44008 </para>
44009 <para>
44010 Some mail clients (for example, some versions of Netscape) require the user to
44011 provide a name and password for authentication whenever AUTH is advertised,
44012 even though authentication may not in fact be needed (for example, Exim may be
44013 set up to allow unconditional relaying from the client by an IP address check).
44014 You can make such clients more friendly by not advertising AUTH to them.
44015 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
44016 that runs for RCPT) to relay without authentication, you should set
44017 </para>
44018 <literallayout class="monospaced">
44019 auth_advertise_hosts = ! 10.9.8.0/24
44020 </literallayout>
44021 <para>
44022 so that no authentication mechanisms are advertised to them.
44023 </para>
44024 <para>
44025 The <option>server_advertise_condition</option> controls the advertisement of individual
44026 authentication mechanisms. For example, it can be used to restrict the
44027 advertisement of a patricular mechanism to encrypted connections, by a setting
44028 such as:
44029 </para>
44030 <literallayout class="monospaced">
44031 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
44032 </literallayout>
44033 <para>
44034 <indexterm role="concept">
44035 <primary><varname>$tls_cipher</varname></primary>
44036 </indexterm>
44037 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
44038 yields <quote>yes</quote>, which allows the advertisement to happen.
44039 </para>
44040 <para>
44041 When an Exim server receives an AUTH command from a client, it rejects it
44042 immediately if AUTH was not advertised in response to an earlier EHLO
44043 command. This is the case if
44044 </para>
44045 <itemizedlist>
44046 <listitem>
44047 <para>
44048 The client host does not match <option>auth_advertise_hosts</option>; or
44049 </para>
44050 </listitem>
44051 <listitem>
44052 <para>
44053 No authenticators are configured with server options; or
44054 </para>
44055 </listitem>
44056 <listitem>
44057 <para>
44058 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
44059 server authenticators.
44060 </para>
44061 </listitem>
44062 </itemizedlist>
44063 <para>
44064 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
44065 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
44066 AUTH is accepted from any client host.
44067 </para>
44068 <para>
44069 If AUTH is not rejected by the ACL, Exim searches its configuration for a
44070 server authentication mechanism that was advertised in response to EHLO and
44071 that matches the one named in the AUTH command. If it finds one, it runs
44072 the appropriate authentication protocol, and authentication either succeeds or
44073 fails. If there is no matching advertised mechanism, the AUTH command is
44074 rejected with a 504 error.
44075 </para>
44076 <para>
44077 <indexterm role="concept">
44078 <primary><varname>$received_protocol</varname></primary>
44079 </indexterm>
44080 <indexterm role="concept">
44081 <primary><varname>$sender_host_authenticated</varname></primary>
44082 </indexterm>
44083 When a message is received from an authenticated host, the value of
44084 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
44085 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
44086 public name) of the authenticator driver that successfully authenticated the
44087 client from which the message was received. This variable is empty if there was
44088 no successful authentication.
44089 </para>
44090 </section>
44091 <section>
44092 <title>Testing server authentication</title>
44093 <para>
44094 <indexterm role="concept">
44095 <primary>authentication</primary>
44096 <secondary>testing a server</secondary>
44097 </indexterm>
44098 <indexterm role="concept">
44099 <primary>AUTH</primary>
44100 <secondary>testing a server</secondary>
44101 </indexterm>
44102 <indexterm role="concept">
44103 <primary>base64 encoding</primary>
44104 <secondary>creating authentication test data</secondary>
44105 </indexterm>
44106 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
44107 configurations. The data for the AUTH command has to be sent using base64
44108 encoding. A quick way to produce such data for testing is the following Perl
44109 script:
44110 </para>
44111 <literallayout class="monospaced">
44112 use MIME::Base64;
44113 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
44114 </literallayout>
44115 <para>
44116 <indexterm role="concept">
44117 <primary>binary zero</primary>
44118 <secondary>in authentication data</secondary>
44119 </indexterm>
44120 This interprets its argument as a Perl string, and then encodes it. The
44121 interpretation as a Perl string allows binary zeros, which are required for
44122 some kinds of authentication, to be included in the data. For example, a
44123 command line to run this script on such data might be
44124 </para>
44125 <literallayout class="monospaced">
44126 encode '\0user\0password'
44127 </literallayout>
44128 <para>
44129 Note the use of single quotes to prevent the shell interpreting the
44130 backslashes, so that they can be interpreted by Perl to specify characters
44131 whose code value is zero.
44132 </para>
44133 <para>
44134 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
44135 digit, you must use three zeros instead of one after the leading backslash. If
44136 you do not, the octal digit that starts your string will be incorrectly
44137 interpreted as part of the code for the first character.
44138 </para>
44139 <para>
44140 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
44141 specially, you must use a Perl escape to prevent them being misinterpreted. For
44142 example, a command such as
44143 </para>
44144 <literallayout class="monospaced">
44145 encode '\0user@domain.com\0pas$$word'
44146 </literallayout>
44147 <para>
44148 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
44149 </para>
44150 <para>
44151 If you have the <option>mimencode</option> command installed, another way to do produce
44152 base64-encoded strings is to run the command
44153 </para>
44154 <literallayout class="monospaced">
44155 echo -e -n `\0user\0password' | mimencode
44156 </literallayout>
44157 <para>
44158 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
44159 in the argument, and the <option>-n</option> option specifies no newline at the end of its
44160 output. However, not all versions of <option>echo</option> recognize these options, so you
44161 should check your version before relying on this suggestion.
44162 </para>
44163 </section>
44164 <section>
44165 <title>Authentication by an Exim client</title>
44166 <para>
44167 <indexterm role="concept">
44168 <primary>authentication</primary>
44169 <secondary>on an Exim client</secondary>
44170 </indexterm>
44171 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
44172 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
44173 announces support for authentication, and the host matches an entry in either
44174 of these options, Exim (as a client) tries to authenticate as follows:
44175 </para>
44176 <itemizedlist>
44177 <listitem>
44178 <para>
44179 For each authenticator that is configured as a client, it searches the
44180 authentication mechanisms announced by the server for one whose name
44181 matches the public name of the authenticator.
44182 </para>
44183 </listitem>
44184 <listitem>
44185 <para>
44186 <indexterm role="concept">
44187 <primary><varname>$host</varname></primary>
44188 </indexterm>
44189 <indexterm role="concept">
44190 <primary><varname>$host_address</varname></primary>
44191 </indexterm>
44192 When it finds one that matches, it runs the authenticator&#x2019;s client code.
44193 The variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string
44194 expansions that the client might do. They are set to the server&#x2019;s name and
44195 IP address. If any expansion is forced to fail, the authentication attempt
44196 is abandoned,
44197 and Exim moves on to the next authenticator.
44198 Otherwise an expansion failure causes delivery to be
44199 deferred.
44200 </para>
44201 </listitem>
44202 <listitem>
44203 <para>
44204 If the result of the authentication attempt is a temporary error or a timeout,
44205 Exim abandons trying to send the message to the host for the moment. It will
44206 try again later. If there are any backup hosts available, they are tried in the
44207 usual way.
44208 </para>
44209 </listitem>
44210 <listitem>
44211 <para>
44212 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
44213 carries on searching the list of authenticators and tries another one if
44214 possible. If all authentication attempts give permanent errors, or if there are
44215 no attempts because no mechanisms match (or option expansions force failure),
44216 what happens depends on whether the host matches <option>hosts_require_auth</option> or
44217 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
44218 delivery is deferred. The error can be detected in the retry rules, and thereby
44219 turned into a permanent error if you wish. In the second case, Exim tries to
44220 deliver the message unauthenticated.
44221 </para>
44222 </listitem>
44223 </itemizedlist>
44224 <para>
44225 <indexterm role="concept">
44226 <primary>AUTH</primary>
44227 <secondary>on MAIL command</secondary>
44228 </indexterm>
44229 When Exim has authenticated itself to a remote server, it adds the AUTH
44230 parameter to the MAIL commands it sends, if it has an authenticated sender for
44231 the message. If the message came from a remote host, the authenticated sender
44232 is the one that was receiving on an incoming MAIL command, provided that the
44233 incoming connection was authenticated and the <option>server_mail_auth</option> condition
44234 allowed the authenticated sender to be retained. If a local process calls Exim
44235 to send a message, the sender address that is built from the login name and
44236 <option>qualify_domain</option> is treated as authenticated. However, if the
44237 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
44238 the authenticated sender that was received with the message.
44239 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
44240 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
44241 </para>
44242 </section>
44243 </chapter>
44244
44245 <chapter id="CHAPplaintext">
44246 <title>The plaintext authenticator</title>
44247 <para>
44248 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
44249 <primary><command>plaintext</command> authenticator</primary>
44250 </indexterm>
44251 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
44252 <primary>authenticators</primary>
44253 <secondary><command>plaintext</command></secondary>
44254 </indexterm>
44255 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
44256 LOGIN authentication mechanisms, both of which transfer authentication data as
44257 plain (unencrypted) text (though base64 encoded). The use of plain text is a
44258 security risk; you are strongly advised to insist on the use of SMTP encryption
44259 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
44260 use unencrypted plain text, you should not use the same passwords for SMTP
44261 connections as you do for login accounts.
44262 </para>
44263 <section revisionflag="changed">
44264 <title>Plaintext options</title>
44265 <para revisionflag="changed">
44266 <indexterm role="concept">
44267 <primary>options</primary>
44268 <secondary><command>plaintext</command> authenticator (server)</secondary>
44269 </indexterm>
44270 When configured as a server, <command>plaintext</command> uses the following options:
44271 </para>
44272 <para revisionflag="changed">
44273 <indexterm role="option">
44274 <primary><option>server_condition</option></primary>
44275 </indexterm>
44276 </para>
44277 <informaltable frame="all" revisionflag="changed">
44278 <tgroup cols="4" colsep="0" rowsep="0">
44279 <colspec colwidth="8*" align="left"/>
44280 <colspec colwidth="5*" align="center"/>
44281 <colspec colwidth="5*" align="center"/>
44282 <colspec colwidth="6*" align="right"/>
44283 <tbody>
44284 <row>
44285 <entry><option>server_condition</option></entry>
44286 <entry>Use: <emphasis>authenticators</emphasis></entry>
44287 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44288 <entry>Default: <emphasis>unset</emphasis></entry>
44289 </row>
44290 </tbody>
44291 </tgroup>
44292 </informaltable>
44293 <para revisionflag="changed">
44294 This is actually a global authentication option, but it must be set in order to
44295 configure the <command>plaintext</command> driver as a server. Its use is described below.
44296 </para>
44297 <para>
44298 <indexterm role="option">
44299 <primary><option>server_prompts</option></primary>
44300 </indexterm>
44301 </para>
44302 <informaltable frame="all">
44303 <tgroup cols="4" colsep="0" rowsep="0">
44304 <colspec colwidth="8*" align="left"/>
44305 <colspec colwidth="5*" align="center"/>
44306 <colspec colwidth="5*" align="center"/>
44307 <colspec colwidth="6*" align="right"/>
44308 <tbody>
44309 <row>
44310 <entry><option>server_prompts</option></entry>
44311 <entry>Use: <emphasis>plaintext</emphasis></entry>
44312 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44313 <entry>Default: <emphasis>unset</emphasis></entry>
44314 </row>
44315 </tbody>
44316 </tgroup>
44317 </informaltable>
44318 <para>
44319 The contents of this option, after expansion, must be a colon-separated list of
44320 prompt strings. If expansion fails, a temporary authentication rejection is
44321 given.
44322 </para>
44323 </section>
44324 <section id="SECTplainserver">
44325 <title>Using plaintext in a server</title>
44326 <para>
44327 <indexterm role="concept">
44328 <primary>AUTH</primary>
44329 <secondary>in <command>plaintext</command> authenticator</secondary>
44330 </indexterm>
44331 <indexterm role="concept">
44332 <primary>binary zero</primary>
44333 <secondary>in <command>plaintext</command> authenticator</secondary>
44334 </indexterm>
44335 <indexterm role="concept">
44336 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44337 <secondary>in <command>plaintext</command> authenticator</secondary>
44338 </indexterm>
44339 <indexterm role="concept">
44340 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
44341 </indexterm>
44342 <indexterm role="concept">
44343 <primary>base64 encoding</primary>
44344 <secondary>in <command>plaintext</command> authenticator</secondary>
44345 </indexterm>
44346 </para>
44347 <para>
44348 When running as a server, <command>plaintext</command> performs the authentication test by
44349 expanding a string. The data sent by the client with the AUTH command, or in
44350 response to subsequent prompts, is base64 encoded, and so may contain any byte
44351 values when decoded. If any data is supplied with the command, it is treated as
44352 a list of strings, separated by NULs (binary zeros), the first three of which
44353 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
44354 (neither LOGIN nor PLAIN uses more than three strings).
44355 </para>
44356 <para>
44357 For compatibility with previous releases of Exim, the values are also placed in
44358 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
44359 variables for this purpose is now deprecated, as it can lead to confusion in
44360 string expansions that also use them for other things.
44361 </para>
44362 <para>
44363 If there are more strings in <option>server_prompts</option> than the number of strings
44364 supplied with the AUTH command, the remaining prompts are used to obtain more
44365 data. Each response from the client may be a list of NUL-separated strings.
44366 </para>
44367 <para>
44368 <indexterm role="concept">
44369 <primary><varname>$authenticated_id</varname></primary>
44370 </indexterm>
44371 Once a sufficient number of data strings have been received,
44372 <option>server_condition</option> is expanded. If the expansion is forced to fail,
44373 authentication fails. Any other expansion failure causes a temporary error code
44374 to be returned. If the result of a successful expansion is an empty string,
44375 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
44376 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
44377 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
44378 For any other result, a temporary error code is returned, with the expanded
44379 string as the error text.
44380 </para>
44381 <para>
44382 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
44383 password, be sure to make the authentication fail if the user is unknown.
44384 There are good and bad examples at the end of the next section.
44385 </para>
44386 </section>
44387 <section>
44388 <title>The PLAIN authentication mechanism</title>
44389 <para>
44390 <indexterm role="concept">
44391 <primary>PLAIN authentication mechanism</primary>
44392 </indexterm>
44393 <indexterm role="concept">
44394 <primary>authentication</primary>
44395 <secondary>PLAIN mechanism</secondary>
44396 </indexterm>
44397 <indexterm role="concept">
44398 <primary>binary zero</primary>
44399 <secondary>in <command>plaintext</command> authenticator</secondary>
44400 </indexterm>
44401 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
44402 sent as one item of data (that is, one combined string containing two NUL
44403 separators). The data is sent either as part of the AUTH command, or
44404 subsequently in response to an empty prompt from the server.
44405 </para>
44406 <para>
44407 The second and third strings are a user name and a corresponding password.
44408 Using a single fixed user name and password as an example, this could be
44409 configured as follows:
44410 </para>
44411 <literallayout class="monospaced">
44412 fixed_plain:
44413   driver = plaintext
44414   public_name = PLAIN
44415   server_prompts = :
44416   server_condition = \
44417     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
44418   server_set_id = $auth2
44419 </literallayout>
44420 <para>
44421 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
44422 are exactly what we want here, so they need not be specified. Obviously, if the
44423 password contains expansion-significant characters such as dollar, backslash,
44424 or closing brace, they have to be escaped.
44425 </para>
44426 <para>
44427 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
44428 the end of a string list are ignored). If all the data comes as part of the
44429 AUTH command, as is commonly the case, the prompt is not used. This
44430 authenticator is advertised in the response to EHLO as
44431 </para>
44432 <literallayout class="monospaced">
44433 250-AUTH PLAIN
44434 </literallayout>
44435 <para>
44436 and a client host can authenticate itself by sending the command
44437 </para>
44438 <literallayout class="monospaced">
44439 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
44440 </literallayout>
44441 <para>
44442 As this contains three strings (more than the number of prompts), no further
44443 data is required from the client. Alternatively, the client may just send
44444 </para>
44445 <literallayout class="monospaced">
44446 AUTH PLAIN
44447 </literallayout>
44448 <para>
44449 to initiate authentication, in which case the server replies with an empty
44450 prompt. The client must respond with the combined data string.
44451 </para>
44452 <para>
44453 The data string is base64 encoded, as required by the RFC. This example,
44454 when decoded, is &lt;<emphasis>NUL</emphasis>&gt;<literal>username</literal>&lt;<emphasis>NUL</emphasis>&gt;<literal>mysecret</literal>, where &lt;<emphasis>NUL</emphasis>&gt;
44455 represents a zero byte. This is split up into three strings, the first of which
44456 is empty. The <option>server_condition</option> option in the authenticator checks that the
44457 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
44458 </para>
44459 <para>
44460 Having just one fixed user name and password, as in this example, is not very
44461 realistic, though for a small organization with only a handful of
44462 authenticating clients it could make sense.
44463 </para>
44464 <para>
44465 A more sophisticated instance of this authenticator could use the user name in
44466 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
44467 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
44468 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
44469 This is an incorrect example:
44470 </para>
44471 <literallayout class="monospaced">
44472 server_condition = \
44473   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
44474 </literallayout>
44475 <para>
44476 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
44477 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
44478 incorrect? It works fine for existing users, but consider what happens if a
44479 non-existent user name is given. The lookup fails, but as no success/failure
44480 strings are given for the lookup, it yields an empty string. Thus, to defeat
44481 the authentication, all a client has to do is to supply a non-existent user
44482 name and an empty password. The correct way of writing this test is:
44483 </para>
44484 <literallayout class="monospaced">
44485 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
44486   {${if eq{$value}{$auth3}}} {false}}
44487 </literallayout>
44488 <para>
44489 In this case, if the lookup succeeds, the result is checked; if the lookup
44490 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
44491 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
44492 always fails if its second argument is empty. However, the second way of
44493 writing the test makes the logic clearer.
44494 </para>
44495 </section>
44496 <section>
44497 <title>The LOGIN authentication mechanism</title>
44498 <para>
44499 <indexterm role="concept">
44500 <primary>LOGIN authentication mechanism</primary>
44501 </indexterm>
44502 <indexterm role="concept">
44503 <primary>authentication</primary>
44504 <secondary>LOGIN mechanism</secondary>
44505 </indexterm>
44506 The LOGIN authentication mechanism is not documented in any RFC, but is in use
44507 in a number of programs. No data is sent with the AUTH command. Instead, a
44508 user name and password are supplied separately, in response to prompts. The
44509 plaintext authenticator can be configured to support this as in this example:
44510 </para>
44511 <literallayout class="monospaced">
44512 fixed_login:
44513   driver = plaintext
44514   public_name = LOGIN
44515   server_prompts = User Name : Password
44516   server_condition = \
44517     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
44518   server_set_id = $auth1
44519 </literallayout>
44520 <para>
44521 Because of the way plaintext operates, this authenticator accepts data supplied
44522 with the AUTH command (in contravention of the specification of LOGIN), but
44523 if the client does not supply it (as is the case for LOGIN clients), the prompt
44524 strings are used to obtain two data items.
44525 </para>
44526 <para>
44527 Some clients are very particular about the precise text of the prompts. For
44528 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
44529 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
44530 strings. It uses the <option>ldapauth</option> expansion condition to check the user
44531 name and password by binding to an LDAP server:
44532 </para>
44533 <literallayout class="monospaced">
44534 login:
44535   driver = plaintext
44536   public_name = LOGIN
44537   server_prompts = Username:: : Password::
44538   server_condition = ${if ldapauth \
44539     {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
44540     pass=${quote:$auth2} \
44541     ldap://ldap.example.org/}}
44542   server_set_id = uid=$auth1,ou=people,o=example.org
44543 </literallayout>
44544 <para>
44545 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
44546 authentication. However, the basic <option>quote</option> operator, rather than any of the
44547 LDAP quoting operators, is the correct one to use for the password, because
44548 quoting is needed only to make the password conform to the Exim syntax. At the
44549 LDAP level, the password is an uninterpreted string.
44550 </para>
44551 </section>
44552 <section>
44553 <title>Support for different kinds of authentication</title>
44554 <para>
44555 A number of string expansion features are provided for the purpose of
44556 interfacing to different ways of user authentication. These include checking
44557 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
44558 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
44559 <xref linkend="SECTexpcond"/>.
44560 </para>
44561 </section>
44562 <section>
44563 <title>Using plaintext in a client</title>
44564 <para>
44565 <indexterm role="concept">
44566 <primary>options</primary>
44567 <secondary><command>plaintext</command> authenticator (client)</secondary>
44568 </indexterm>
44569 The <command>plaintext</command> authenticator has two client options:
44570 </para>
44571 <para>
44572 <indexterm role="option">
44573 <primary><option>client_ignore_invalid_base64</option></primary>
44574 </indexterm>
44575 </para>
44576 <informaltable frame="all">
44577 <tgroup cols="4" colsep="0" rowsep="0">
44578 <colspec colwidth="8*" align="left"/>
44579 <colspec colwidth="5*" align="center"/>
44580 <colspec colwidth="5*" align="center"/>
44581 <colspec colwidth="6*" align="right"/>
44582 <tbody>
44583 <row>
44584 <entry><option>client_ignore_invalid_base64</option></entry>
44585 <entry>Use: <emphasis>plaintext</emphasis></entry>
44586 <entry>Type: <emphasis>boolean</emphasis></entry>
44587 <entry>Default: <emphasis>false</emphasis></entry>
44588 </row>
44589 </tbody>
44590 </tgroup>
44591 </informaltable>
44592 <para>
44593 If the client receives a server prompt that is not a valid base64 string,
44594 authentication is abandoned by default. However, if this option is set true,
44595 the error in the challenge is ignored and the client sends the response as
44596 usual.
44597 </para>
44598 <para>
44599 <indexterm role="option">
44600 <primary><option>client_send</option></primary>
44601 </indexterm>
44602 </para>
44603 <informaltable frame="all">
44604 <tgroup cols="4" colsep="0" rowsep="0">
44605 <colspec colwidth="8*" align="left"/>
44606 <colspec colwidth="5*" align="center"/>
44607 <colspec colwidth="5*" align="center"/>
44608 <colspec colwidth="6*" align="right"/>
44609 <tbody>
44610 <row>
44611 <entry><option>client_send</option></entry>
44612 <entry>Use: <emphasis>plaintext</emphasis></entry>
44613 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44614 <entry>Default: <emphasis>unset</emphasis></entry>
44615 </row>
44616 </tbody>
44617 </tgroup>
44618 </informaltable>
44619 <para>
44620 The string is a colon-separated list of authentication data strings. Each
44621 string is independently expanded before being sent to the server. The first
44622 string is sent with the AUTH command; any more strings are sent in response
44623 to prompts from the server. Before each string is expanded, the value of the
44624 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
44625 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
44626 way. Thus, the prompt that is received in response to sending the first string
44627 (with the AUTH command) can be used in the expansion of the second string, and
44628 so on. If an invalid base64 string is received when
44629 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
44630 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
44631 </para>
44632 <para>
44633 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
44634 splitting takes priority and happens first.
44635 </para>
44636 <para>
44637 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
44638 the data, further processing is applied to each string before it is sent. If
44639 there are any single circumflex characters in the string, they are converted to
44640 NULs. Should an actual circumflex be required as data, it must be doubled in
44641 the string.
44642 </para>
44643 <para>
44644 This is an example of a client configuration that implements the PLAIN
44645 authentication mechanism with a fixed user name and password:
44646 </para>
44647 <literallayout class="monospaced">
44648 fixed_plain:
44649   driver = plaintext
44650   public_name = PLAIN
44651   client_send = ^username^mysecret
44652 </literallayout>
44653 <para>
44654 The lack of colons means that the entire text is sent with the AUTH
44655 command, with the circumflex characters converted to NULs. A similar example
44656 that uses the LOGIN mechanism is:
44657 </para>
44658 <literallayout class="monospaced">
44659 fixed_login:
44660   driver = plaintext
44661   public_name = LOGIN
44662   client_send = : username : mysecret
44663 </literallayout>
44664 <para>
44665 The initial colon means that the first string is empty, so no data is sent with
44666 the AUTH command itself. The remaining strings are sent in response to
44667 prompts.
44668 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
44669 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
44670 </para>
44671 </section>
44672 </chapter>
44673
44674 <chapter>
44675 <title>The cram_md5 authenticator</title>
44676 <para>
44677 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
44678 <primary><command>cram_md5</command> authenticator</primary>
44679 </indexterm>
44680 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
44681 <primary>authenticators</primary>
44682 <secondary><command>cram_md5</command></secondary>
44683 </indexterm>
44684 <indexterm role="concept">
44685 <primary>CRAM-MD5 authentication mechanism</primary>
44686 </indexterm>
44687 <indexterm role="concept">
44688 <primary>authentication</primary>
44689 <secondary>CRAM-MD5 mechanism</secondary>
44690 </indexterm>
44691 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
44692 sends a challenge string to the client, and the response consists of a user
44693 name and the CRAM-MD5 digest of the challenge string combined with a secret
44694 string (password) which is known to both server and client. Thus, the secret
44695 is not sent over the network as plain text, which makes this authenticator more
44696 secure than <command>plaintext</command>. However, the downside is that the secret has to be
44697 available in plain text at either end.
44698 </para>
44699 <section>
44700 <title>Using cram_md5 as a server</title>
44701 <para>
44702 <indexterm role="concept">
44703 <primary>options</primary>
44704 <secondary><command>cram_md5</command> authenticator (server)</secondary>
44705 </indexterm>
44706 This authenticator has one server option, which must be set to configure the
44707 authenticator as a server:
44708 </para>
44709 <para>
44710 <indexterm role="option">
44711 <primary><option>server_secret</option></primary>
44712 </indexterm>
44713 </para>
44714 <informaltable frame="all">
44715 <tgroup cols="4" colsep="0" rowsep="0">
44716 <colspec colwidth="8*" align="left"/>
44717 <colspec colwidth="5*" align="center"/>
44718 <colspec colwidth="5*" align="center"/>
44719 <colspec colwidth="6*" align="right"/>
44720 <tbody>
44721 <row>
44722 <entry><option>server_secret</option></entry>
44723 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44724 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44725 <entry>Default: <emphasis>unset</emphasis></entry>
44726 </row>
44727 </tbody>
44728 </tgroup>
44729 </informaltable>
44730 <para>
44731 <indexterm role="concept">
44732 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44733 <secondary>in <command>cram_md5</command> authenticator</secondary>
44734 </indexterm>
44735 When the server receives the client&#x2019;s response, the user name is placed in
44736 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
44737 obtain the password for that user. The server then computes the CRAM-MD5 digest
44738 that the client should have sent, and checks that it received the correct
44739 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
44740 fails. If the expansion fails for some other reason, a temporary error code is
44741 returned to the client.
44742 </para>
44743 <para>
44744 For compatibility with previous releases of Exim, the user name is also placed
44745 in <varname>$1</varname>. However, the use of this variables for this purpose is now
44746 deprecated, as it can lead to confusion in string expansions that also use
44747 numeric variables for other things.
44748 </para>
44749 <para>
44750 For example, the following authenticator checks that the user name given by the
44751 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
44752 user name, authentication fails.
44753 </para>
44754 <literallayout class="monospaced">
44755 fixed_cram:
44756   driver = cram_md5
44757   public_name = CRAM-MD5
44758   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
44759   server_set_id = $auth1
44760 </literallayout>
44761 <para>
44762 <indexterm role="concept">
44763 <primary><varname>$authenticated_id</varname></primary>
44764 </indexterm>
44765 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
44766 name in <varname>$authenticated_id</varname>. A more tyical configuration might look up the
44767 secret string in a file, using the user name as the key. For example:
44768 </para>
44769 <literallayout class="monospaced">
44770 lookup_cram:
44771   driver = cram_md5
44772   public_name = CRAM-MD5
44773   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail}
44774   server_set_id = $auth1
44775 </literallayout>
44776 <para>
44777 Note that this expansion explicitly forces failure if the lookup fails
44778 because <varname>$1</varname> contains an unknown user name.
44779 </para>
44780 </section>
44781 <section>
44782 <title>Using cram_md5 as a client</title>
44783 <para>
44784 <indexterm role="concept">
44785 <primary>options</primary>
44786 <secondary><command>cram_md5</command> authenticator (client)</secondary>
44787 </indexterm>
44788 When used as a client, the <command>cram_md5</command> authenticator has two options:
44789 </para>
44790 <para>
44791 <indexterm role="option">
44792 <primary><option>client_name</option></primary>
44793 </indexterm>
44794 </para>
44795 <informaltable frame="all">
44796 <tgroup cols="4" colsep="0" rowsep="0">
44797 <colspec colwidth="8*" align="left"/>
44798 <colspec colwidth="5*" align="center"/>
44799 <colspec colwidth="5*" align="center"/>
44800 <colspec colwidth="6*" align="right"/>
44801 <tbody>
44802 <row>
44803 <entry><option>client_name</option></entry>
44804 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44805 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44806 <entry>Default: <emphasis>the primary host name</emphasis></entry>
44807 </row>
44808 </tbody>
44809 </tgroup>
44810 </informaltable>
44811 <para>
44812 This string is expanded, and the result used as the user name data when
44813 computing the response to the server&#x2019;s challenge.
44814 </para>
44815 <para>
44816 <indexterm role="option">
44817 <primary><option>client_secret</option></primary>
44818 </indexterm>
44819 </para>
44820 <informaltable frame="all">
44821 <tgroup cols="4" colsep="0" rowsep="0">
44822 <colspec colwidth="8*" align="left"/>
44823 <colspec colwidth="5*" align="center"/>
44824 <colspec colwidth="5*" align="center"/>
44825 <colspec colwidth="6*" align="right"/>
44826 <tbody>
44827 <row>
44828 <entry><option>client_secret</option></entry>
44829 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44830 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44831 <entry>Default: <emphasis>unset</emphasis></entry>
44832 </row>
44833 </tbody>
44834 </tgroup>
44835 </informaltable>
44836 <para>
44837 This option must be set for the authenticator to work as a client. Its value is
44838 expanded and the result used as the secret string when computing the response.
44839 </para>
44840 <para>
44841 <indexterm role="concept">
44842 <primary><varname>$host</varname></primary>
44843 </indexterm>
44844 <indexterm role="concept">
44845 <primary><varname>$host_address</varname></primary>
44846 </indexterm>
44847 Different user names and secrets can be used for different servers by referring
44848 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
44849 expansion string is treated as an indication that this authenticator is not
44850 prepared to handle this case. Exim moves on to the next configured client
44851 authenticator. Any other expansion failure causes Exim to give up trying to
44852 send the message to the current server.
44853 </para>
44854 <para>
44855 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
44856 strings, is:
44857 </para>
44858 <literallayout class="monospaced">
44859 fixed_cram:
44860   driver = cram_md5
44861   public_name = CRAM-MD5
44862   client_name = ph10
44863   client_secret = secret
44864 </literallayout>
44865 <para>
44866 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
44867 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
44868 </para>
44869 </section>
44870 </chapter>
44871
44872 <chapter>
44873 <title>The cyrus_sasl authenticator</title>
44874 <para>
44875 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
44876 <primary><command>cyrus_sasl</command> authenticator</primary>
44877 </indexterm>
44878 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
44879 <primary>authenticators</primary>
44880 <secondary><command>cyrus_sasl</command></secondary>
44881 </indexterm>
44882 <indexterm role="concept">
44883 <primary>Cyrus</primary>
44884 <secondary>SASL library</secondary>
44885 </indexterm>
44886 <indexterm role="concept">
44887 <primary>Kerberos</primary>
44888 </indexterm>
44889 The code for this authenticator was provided by Matthew Byng-Maddick of A L
44890 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
44891 </para>
44892 <para>
44893 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
44894 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
44895 Layer</quote>). This library supports a number of authentication mechanisms,
44896 including PLAIN and LOGIN, but also several others that Exim does not support
44897 directly. In particular, there is support for Kerberos authentication.
44898 </para>
44899 <para>
44900 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
44901 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
44902 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
44903 name of the driver to determine which mechanism to support.
44904 </para>
44905 <para>
44906 Where access to some kind of secret file is required, for example in GSSAPI
44907 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
44908 user, and that the Cyrus SASL library has no way of escalating privileges
44909 by default. You may also find you need to set environment variables,
44910 depending on the driver you are using.
44911 </para>
44912 <para revisionflag="changed">
44913 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
44914 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
44915 Kerberos, note that because of limitations in the GSSAPI interface,
44916 changing the server keytab might need to be communicated down to the Kerberos
44917 layer independently. The mechanism for doing so is dependent upon the Kerberos
44918 implementation. For example, for Heimdal, the environment variable KRB5_KTNAME
44919 may be set to point to an alternative keytab file. Exim will pass this
44920 variable through from its own inherited environment when started as root or the
44921 Exim user. The keytab file needs to be readable by the Exim user.
44922 </para>
44923 <section>
44924 <title>Using cyrus_sasl as a server</title>
44925 <para>
44926 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
44927 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
44928 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
44929 use of this variable for this purpose is now deprecated, as it can lead to
44930 confusion in string expansions that also use numeric variables for other
44931 things.
44932 </para>
44933 <para>
44934 <indexterm role="option">
44935 <primary><option>server_hostname</option></primary>
44936 </indexterm>
44937 </para>
44938 <informaltable frame="all">
44939 <tgroup cols="4" colsep="0" rowsep="0">
44940 <colspec colwidth="8*" align="left"/>
44941 <colspec colwidth="5*" align="center"/>
44942 <colspec colwidth="5*" align="center"/>
44943 <colspec colwidth="6*" align="right"/>
44944 <tbody>
44945 <row>
44946 <entry><option>server_hostname</option></entry>
44947 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44948 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44949 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
44950 </row>
44951 </tbody>
44952 </tgroup>
44953 </informaltable>
44954 <para>
44955 This option selects the hostname that is used when communicating with
44956 the library. It is up to the underlying SASL plug-in what it does with
44957 this data.
44958 </para>
44959 <para>
44960 <indexterm role="option">
44961 <primary><option>server_mech</option></primary>
44962 </indexterm>
44963 </para>
44964 <informaltable frame="all">
44965 <tgroup cols="4" colsep="0" rowsep="0">
44966 <colspec colwidth="8*" align="left"/>
44967 <colspec colwidth="5*" align="center"/>
44968 <colspec colwidth="5*" align="center"/>
44969 <colspec colwidth="6*" align="right"/>
44970 <tbody>
44971 <row>
44972 <entry><option>server_mech</option></entry>
44973 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44974 <entry>Type: <emphasis>string</emphasis></entry>
44975 <entry>Default: <emphasis><literal>public_name</literal></emphasis></entry>
44976 </row>
44977 </tbody>
44978 </tgroup>
44979 </informaltable>
44980 <para>
44981 This option selects the authentication mechanism this driver should
44982 use. It allows you to use a different underlying mechanism from the
44983 advertised name. For example:
44984 </para>
44985 <literallayout class="monospaced">
44986 sasl:
44987   driver = cyrus_sasl
44988   public_name = X-ANYTHING
44989   server_mech = CRAM-MD5
44990   server_set_id = $auth1
44991 </literallayout>
44992 <para>
44993 <indexterm role="option">
44994 <primary><option>server_realm</option></primary>
44995 </indexterm>
44996 </para>
44997 <informaltable frame="all">
44998 <tgroup cols="4" colsep="0" rowsep="0">
44999 <colspec colwidth="8*" align="left"/>
45000 <colspec colwidth="5*" align="center"/>
45001 <colspec colwidth="5*" align="center"/>
45002 <colspec colwidth="6*" align="right"/>
45003 <tbody>
45004 <row>
45005 <entry><option>server_realm</option></entry>
45006 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45007 <entry>Type: <emphasis>string</emphasis></entry>
45008 <entry>Default: <emphasis>unset</emphasis></entry>
45009 </row>
45010 </tbody>
45011 </tgroup>
45012 </informaltable>
45013 <para>
45014 This specifies the SASL realm that the server claims to be in.
45015 </para>
45016 <para>
45017 <indexterm role="option">
45018 <primary><option>server_service</option></primary>
45019 </indexterm>
45020 </para>
45021 <informaltable frame="all">
45022 <tgroup cols="4" colsep="0" rowsep="0">
45023 <colspec colwidth="8*" align="left"/>
45024 <colspec colwidth="5*" align="center"/>
45025 <colspec colwidth="5*" align="center"/>
45026 <colspec colwidth="6*" align="right"/>
45027 <tbody>
45028 <row>
45029 <entry><option>server_service</option></entry>
45030 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
45031 <entry>Type: <emphasis>string</emphasis></entry>
45032 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
45033 </row>
45034 </tbody>
45035 </tgroup>
45036 </informaltable>
45037 <para>
45038 This is the SASL service that the server claims to implement.
45039 </para>
45040 <para>
45041 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
45042 private options. All you need to do is to specify an appropriate mechanism as
45043 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
45044 PLAIN, you could have two authenticators as follows:
45045 </para>
45046 <literallayout class="monospaced">
45047 sasl_cram_md5:
45048   driver = cyrus_sasl
45049   public_name = CRAM-MD5
45050   server_set_id = $auth1
45051
45052 sasl_plain:
45053   driver = cyrus_sasl
45054   public_name = PLAIN
45055   server_set_id = $auth1
45056 </literallayout>
45057 <para>
45058 Cyrus SASL does implement the LOGIN authentication method, even though it is
45059 not a standard method. It is disabled by default in the source distribution,
45060 but it is present in many binary distributions.
45061 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
45062 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
45063 </para>
45064 </section>
45065 </chapter>
45066
45067 <chapter id="CHAPdovecot" revisionflag="changed">
45068 <title>The dovecot authenticator</title>
45069 <para revisionflag="changed">
45070 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
45071 <primary><command>dovecot</command> authenticator</primary>
45072 </indexterm>
45073 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
45074 <primary>authenticators</primary>
45075 <secondary><command>dovecot</command></secondary>
45076 </indexterm>
45077 This authenticator is an interface to the authentication facility of the
45078 Dovecot POP/IMAP server, which can support a number of authentication methods.
45079 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
45080 to use the same mechanisms for SMTP authentication. This is a server
45081 authenticator only. There is only one option:
45082 </para>
45083 <para revisionflag="changed">
45084 <indexterm role="option">
45085 <primary><option>server_socket</option></primary>
45086 </indexterm>
45087 </para>
45088 <informaltable frame="all" revisionflag="changed">
45089 <tgroup cols="4" colsep="0" rowsep="0">
45090 <colspec colwidth="8*" align="left"/>
45091 <colspec colwidth="5*" align="center"/>
45092 <colspec colwidth="5*" align="center"/>
45093 <colspec colwidth="6*" align="right"/>
45094 <tbody>
45095 <row>
45096 <entry><option>server_socket</option></entry>
45097 <entry>Use: <emphasis>dovecot</emphasis></entry>
45098 <entry>Type: <emphasis>string</emphasis></entry>
45099 <entry>Default: <emphasis>unset</emphasis></entry>
45100 </row>
45101 </tbody>
45102 </tgroup>
45103 </informaltable>
45104 <para revisionflag="changed">
45105 This option must specify the socket that is the interface to Dovecot
45106 authentication. The <option>public_name</option> option must specify an authentication
45107 mechanism that Dovecot is configured to support. You can have several
45108 authenticators for different mechanisms. For example:
45109 </para>
45110 <literallayout class="monospaced" revisionflag="changed">
45111 dovecot_plain:
45112   driver = dovecot
45113   public_name = PLAIN
45114   server_socket = /var/run/dovecot/auth-client
45115   server_setid = $auth1
45116
45117 dovecot_ntlm:
45118   driver = dovecot
45119   public_name = NTLM
45120   server_socket = /var/run/dovecot/auth-client
45121   server_setid = $auth1
45122 </literallayout>
45123 <para revisionflag="changed">
45124 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
45125 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
45126 option is passed in the Dovecot authentication command. If, for a TLS
45127 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
45128 option is passed.
45129 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
45130 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
45131 </para>
45132 </chapter>
45133
45134 <chapter id="CHAPspa">
45135 <title>The spa authenticator</title>
45136 <para>
45137 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
45138 <primary><command>spa</command> authenticator</primary>
45139 </indexterm>
45140 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
45141 <primary>authenticators</primary>
45142 <secondary><command>spa</command></secondary>
45143 </indexterm>
45144 <indexterm role="concept">
45145 <primary>authentication</primary>
45146 <secondary>Microsoft Secure Password</secondary>
45147 </indexterm>
45148 <indexterm role="concept">
45149 <primary>authentication</primary>
45150 <secondary>NTLM</secondary>
45151 </indexterm>
45152 <indexterm role="concept">
45153 <primary>Microsoft Secure Password Authentication</primary>
45154 </indexterm>
45155 <indexterm role="concept">
45156 <primary>NTLM authentication</primary>
45157 </indexterm>
45158 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
45159 Password Authentication</emphasis> mechanism,
45160 which is also sometimes known as NTLM (NT LanMan). The code for client side of
45161 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
45162 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
45163 server side was subsequently contributed by Tom Kistner. The mechanism works as
45164 follows:
45165 </para>
45166 <itemizedlist>
45167 <listitem>
45168 <para>
45169 After the AUTH command has been accepted, the client sends an SPA
45170 authentication request based on the user name and optional domain.
45171 </para>
45172 </listitem>
45173 <listitem>
45174 <para>
45175 The server sends back a challenge.
45176 </para>
45177 </listitem>
45178 <listitem>
45179 <para>
45180 The client builds a challenge response which makes use of the user&#x2019;s password
45181 and sends it to the server, which then accepts or rejects it.
45182 </para>
45183 </listitem>
45184 </itemizedlist>
45185 <para>
45186 Encryption is used to protect the password in transit.
45187 </para>
45188 <section>
45189 <title>Using spa as a server</title>
45190 <para>
45191 <indexterm role="concept">
45192 <primary>options</primary>
45193 <secondary><command>spa</command> authenticator (server)</secondary>
45194 </indexterm>
45195 The <command>spa</command> authenticator has just one server option:
45196 </para>
45197 <para>
45198 <indexterm role="option">
45199 <primary><option>server_password</option></primary>
45200 </indexterm>
45201 </para>
45202 <informaltable frame="all">
45203 <tgroup cols="4" colsep="0" rowsep="0">
45204 <colspec colwidth="8*" align="left"/>
45205 <colspec colwidth="5*" align="center"/>
45206 <colspec colwidth="5*" align="center"/>
45207 <colspec colwidth="6*" align="right"/>
45208 <tbody>
45209 <row>
45210 <entry><option>server_password</option></entry>
45211 <entry>Use: <emphasis>spa</emphasis></entry>
45212 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45213 <entry>Default: <emphasis>unset</emphasis></entry>
45214 </row>
45215 </tbody>
45216 </tgroup>
45217 </informaltable>
45218 <para>
45219 <indexterm role="concept">
45220 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
45221 <secondary>in <command>spa</command> authenticator</secondary>
45222 </indexterm>
45223 This option is expanded, and the result must be the cleartext password for the
45224 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
45225 compatibility with previous releases of Exim, the user name is also placed in
45226 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
45227 it can lead to confusion in string expansions that also use numeric variables
45228 for other things. For example:
45229 </para>
45230 <literallayout class="monospaced">
45231 spa:
45232   driver = spa
45233   public_name = NTLM
45234   server_password = \
45235     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
45236 </literallayout>
45237 <para>
45238 If the expansion is forced to fail, authentication fails. Any other expansion
45239 failure causes a temporary error code to be returned.
45240 </para>
45241 </section>
45242 <section>
45243 <title>Using spa as a client</title>
45244 <para>
45245 <indexterm role="concept">
45246 <primary>options</primary>
45247 <secondary><command>spa</command> authenticator (client)</secondary>
45248 </indexterm>
45249 The <command>spa</command> authenticator has the following client options:
45250 </para>
45251 <para>
45252 <indexterm role="option">
45253 <primary><option>client_domain</option></primary>
45254 </indexterm>
45255 </para>
45256 <informaltable frame="all">
45257 <tgroup cols="4" colsep="0" rowsep="0">
45258 <colspec colwidth="8*" align="left"/>
45259 <colspec colwidth="5*" align="center"/>
45260 <colspec colwidth="5*" align="center"/>
45261 <colspec colwidth="6*" align="right"/>
45262 <tbody>
45263 <row>
45264 <entry><option>client_domain</option></entry>
45265 <entry>Use: <emphasis>spa</emphasis></entry>
45266 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45267 <entry>Default: <emphasis>unset</emphasis></entry>
45268 </row>
45269 </tbody>
45270 </tgroup>
45271 </informaltable>
45272 <para>
45273 This option specifies an optional domain for the authentication.
45274 </para>
45275 <para>
45276 <indexterm role="option">
45277 <primary><option>client_password</option></primary>
45278 </indexterm>
45279 </para>
45280 <informaltable frame="all">
45281 <tgroup cols="4" colsep="0" rowsep="0">
45282 <colspec colwidth="8*" align="left"/>
45283 <colspec colwidth="5*" align="center"/>
45284 <colspec colwidth="5*" align="center"/>
45285 <colspec colwidth="6*" align="right"/>
45286 <tbody>
45287 <row>
45288 <entry><option>client_password</option></entry>
45289 <entry>Use: <emphasis>spa</emphasis></entry>
45290 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45291 <entry>Default: <emphasis>unset</emphasis></entry>
45292 </row>
45293 </tbody>
45294 </tgroup>
45295 </informaltable>
45296 <para>
45297 This option specifies the user&#x2019;s password, and must be set.
45298 </para>
45299 <para>
45300 <indexterm role="option">
45301 <primary><option>client_username</option></primary>
45302 </indexterm>
45303 </para>
45304 <informaltable frame="all">
45305 <tgroup cols="4" colsep="0" rowsep="0">
45306 <colspec colwidth="8*" align="left"/>
45307 <colspec colwidth="5*" align="center"/>
45308 <colspec colwidth="5*" align="center"/>
45309 <colspec colwidth="6*" align="right"/>
45310 <tbody>
45311 <row>
45312 <entry><option>client_username</option></entry>
45313 <entry>Use: <emphasis>spa</emphasis></entry>
45314 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45315 <entry>Default: <emphasis>unset</emphasis></entry>
45316 </row>
45317 </tbody>
45318 </tgroup>
45319 </informaltable>
45320 <para>
45321 This option specifies the user name, and must be set. Here is an example of a
45322 configuration of this authenticator for use with the mail servers at
45323 <emphasis>msn.com</emphasis>:
45324 </para>
45325 <literallayout class="monospaced">
45326 msn:
45327   driver = spa
45328   public_name = MSN
45329   client_username = msn/msn_username
45330   client_password = msn_plaintext_password
45331   client_domain = DOMAIN_OR_UNSET
45332 </literallayout>
45333 <para>
45334 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
45335 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
45336 </para>
45337 </section>
45338 </chapter>
45339
45340 <chapter id="CHAPTLS">
45341 <title>Encrypted SMTP connections using TLS/SSL</title>
45342 <titleabbrev>Encrypted SMTP connections</titleabbrev>
45343 <para>
45344 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
45345 <primary>encryption</primary>
45346 <secondary>on SMTP connection</secondary>
45347 </indexterm>
45348 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
45349 <primary>SMTP</primary>
45350 <secondary>encryption</secondary>
45351 </indexterm>
45352 <indexterm role="concept">
45353 <primary>TLS</primary>
45354 <secondary>on SMTP connection</secondary>
45355 </indexterm>
45356 <indexterm role="concept">
45357 <primary>OpenSSL</primary>
45358 </indexterm>
45359 <indexterm role="concept">
45360 <primary>GnuTLS</primary>
45361 </indexterm>
45362 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
45363 Sockets Layer), is implemented by making use of the OpenSSL library or the
45364 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
45365 cryptographic code in the Exim distribution itself for implementing TLS. In
45366 order to use this feature you must install OpenSSL or GnuTLS, and then build a
45367 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
45368 You also need to understand the basic concepts of encryption at a managerial
45369 level, and in particular, the way that public keys, private keys, and
45370 certificates are used.
45371 </para>
45372 <para>
45373 RFC 3207 defines how SMTP connections can make use of encryption. Once a
45374 connection is established, the client issues a STARTTLS command. If the
45375 server accepts this, the client and the server negotiate an encryption
45376 mechanism. If the negotiation succeeds, the data that subsequently passes
45377 between them is encrypted.
45378 </para>
45379 <para>
45380 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
45381 and if so, what cipher suite is in use, whether the client supplied a
45382 certificate, and whether or not that certificate was verified. This makes it
45383 possible for an Exim server to deny or accept certain commands based on the
45384 encryption state.
45385 </para>
45386 <para>
45387 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
45388 disrupt TLS connections. You need to turn off SMTP scanning for these products
45389 in order to get TLS to work.
45390 </para>
45391 <section>
45392 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
45393 <para>
45394 <indexterm role="concept">
45395 <primary>ssmtp protocol</primary>
45396 </indexterm>
45397 <indexterm role="concept">
45398 <primary>smtps protocol</primary>
45399 </indexterm>
45400 <indexterm role="concept">
45401 <primary>SMTP</primary>
45402 <secondary>ssmtp protocol</secondary>
45403 </indexterm>
45404 <indexterm role="concept">
45405 <primary>SMTP</primary>
45406 <secondary>smtps protocol</secondary>
45407 </indexterm>
45408 Early implementations of encrypted SMTP used a different TCP port from normal
45409 SMTP, and expected an encryption negotiation to start immediately, instead of
45410 waiting for a STARTTLS command from the client using the standard SMTP
45411 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
45412 allocated for this purpose.
45413 </para>
45414 <para>
45415 This approach was abandoned when encrypted SMTP was standardised, but there are
45416 still some legacy clients that use it. Exim supports these clients by means of
45417 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
45418 numbers; the most common use is expected to be:
45419 </para>
45420 <literallayout class="monospaced">
45421 tls_on_connect_ports = 465
45422 </literallayout>
45423 <para>
45424 The port numbers specified by this option apply to all SMTP connections, both
45425 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
45426 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
45427 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
45428 an extra port &ndash; rather, it specifies different behaviour on a port that is
45429 defined elsewhere.
45430 </para>
45431 <para>
45432 There is also a <option>-tls-on-connect</option> command line option. This overrides
45433 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
45434 </para>
45435 </section>
45436 <section id="SECTopenvsgnu">
45437 <title>OpenSSL vs GnuTLS</title>
45438 <para>
45439 <indexterm role="concept">
45440 <primary>TLS</primary>
45441 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
45442 </indexterm>
45443 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
45444 followed later, when the first versions of GnuTLS were released. To build Exim
45445 to use GnuTLS, you need to set
45446 </para>
45447 <literallayout class="monospaced">
45448 USE_GNUTLS=yes
45449 </literallayout>
45450 <para>
45451 in Local/Makefile, in addition to
45452 </para>
45453 <literallayout class="monospaced">
45454 SUPPORT_TLS=yes
45455 </literallayout>
45456 <para>
45457 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
45458 include files and libraries for GnuTLS can be found.
45459 </para>
45460 <para>
45461 There are some differences in usage when using GnuTLS instead of OpenSSL:
45462 </para>
45463 <itemizedlist>
45464 <listitem>
45465 <para>
45466 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
45467 name of a directory (for OpenSSL it can be either).
45468 </para>
45469 </listitem>
45470 <listitem>
45471 <para>
45472 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
45473 facility for varying its Diffie-Hellman parameters. I understand that this has
45474 changed, but Exim has not been updated to provide this facility.
45475 </para>
45476 </listitem>
45477 <listitem>
45478 <para>
45479 <indexterm role="concept">
45480 <primary><varname>$tls_peerdn</varname></primary>
45481 </indexterm>
45482 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
45483 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
45484 affects the value of the <varname>$tls_peerdn</varname> variable.
45485 </para>
45486 </listitem>
45487 <listitem>
45488 <para>
45489 OpenSSL identifies cipher suites using hyphens as separators, for example:
45490 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
45491 more, OpenSSL complains if underscores are present in a cipher list. To make
45492 life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to
45493 underscores for GnuTLS when processing lists of cipher suites in the
45494 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
45495 option).
45496 </para>
45497 </listitem>
45498 <listitem>
45499 <para>
45500 The <option>tls_require_ciphers</option> options operate differently, as described in the
45501 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
45502 </para>
45503 </listitem>
45504 </itemizedlist>
45505 </section>
45506 <section>
45507 <title>GnuTLS parameter computation</title>
45508 <para>
45509 GnuTLS uses RSA and D-H parameters that may take a substantial amount of time
45510 to compute. It is unreasonable to re-compute them for every TLS session.
45511 Therefore, Exim keeps this data in a file in its spool directory, called
45512 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
45513 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
45514 parameters from this file. If the file does not exist, the first Exim process
45515 that needs it computes the data and writes it to a temporary file which is
45516 renamed once it is complete. It does not matter if several Exim processes do
45517 this simultaneously (apart from wasting a few resources). Once a file is in
45518 place, new Exim processes immediately start using it.
45519 </para>
45520 <para>
45521 For maximum security, the parameters that are stored in this file should be
45522 recalculated periodically, the frequency depending on your paranoia level.
45523 Arranging this is easy in principle; just delete the file when you want new
45524 values to be computed. However, there may be a problem. The calculation of new
45525 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
45526 If the system is not very active, <filename>/dev/random</filename> may delay returning data
45527 until enough randomness (entropy) is available. This may cause Exim to hang for
45528 a substantial amount of time, causing timeouts on incoming connections.
45529 </para>
45530 <para>
45531 The solution is to generate the parameters externally to Exim. They are stored
45532 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
45533 externally using the <command>certtool</command> command that is part of GnuTLS.
45534 </para>
45535 <para>
45536 To replace the parameters with new ones, instead of deleting the file
45537 and letting Exim re-create it, you can generate new parameters using
45538 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
45539 renaming. The relevant commands are something like this:
45540 </para>
45541 <literallayout class="monospaced">
45542 # rm -f new-params
45543 # touch new-params
45544 # chown exim:exim new-params
45545 # chmod 0400 new-params
45546 # certtool --generate-privkey --bits 512 &gt;new-params
45547 # echo "" &gt;&gt;new-params
45548 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
45549 # mv new-params gnutls-params
45550 </literallayout>
45551 <para>
45552 If Exim never has to generate the parameters itself, the possibility of
45553 stalling is removed.
45554 </para>
45555 </section>
45556 <section id="SECTreqciphssl">
45557 <title>Requiring specific ciphers in OpenSSL</title>
45558 <para>
45559 <indexterm role="concept">
45560 <primary>TLS</primary>
45561 <secondary>requiring specific ciphers (OpenSSL)</secondary>
45562 </indexterm>
45563 <indexterm role="concept">
45564 <primary><option>tls_require_ciphers</option></primary>
45565 <secondary>OpenSSL</secondary>
45566 </indexterm>
45567 There is a function in the OpenSSL library that can be passed a list of cipher
45568 suites before the cipher negotiation takes place. This specifies which ciphers
45569 are acceptable. The list is colon separated and may contain names like
45570 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
45571 directly to this function call. The following quotation from the OpenSSL
45572 documentation specifies what forms of item are allowed in the cipher string:
45573 </para>
45574 <itemizedlist>
45575 <listitem>
45576 <para>
45577 It can consist of a single cipher suite such as RC4-SHA.
45578 </para>
45579 </listitem>
45580 <listitem>
45581 <para>
45582 It can represent a list of cipher suites containing a certain algorithm,
45583 or cipher suites of a certain type. For example SHA1 represents all
45584 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
45585 SSL v3 algorithms.
45586 </para>
45587 </listitem>
45588 <listitem>
45589 <para>
45590 Lists of cipher suites can be combined in a single cipher string using
45591 the + character. This is used as a logical and operation. For example
45592 SHA1+DES represents all cipher suites containing the SHA1 and the DES
45593 algorithms.
45594 </para>
45595 </listitem>
45596 </itemizedlist>
45597 <para>
45598 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
45599 <literal>-</literal> or <literal>+</literal>.
45600 </para>
45601 <itemizedlist>
45602 <listitem>
45603 <para>
45604 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
45605 ciphers deleted can never reappear in the list even if they are explicitly
45606 stated.
45607 </para>
45608 </listitem>
45609 <listitem>
45610 <para>
45611 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
45612 of the ciphers can be added again by later options.
45613 </para>
45614 </listitem>
45615 <listitem>
45616 <para>
45617 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
45618 option does not add any new ciphers; it just moves matching existing ones.
45619 </para>
45620 </listitem>
45621 </itemizedlist>
45622 <para>
45623 If none of these characters is present, the string is interpreted as
45624 a list of ciphers to be appended to the current preference list. If the list
45625 includes any ciphers already present they will be ignored: that is, they will
45626 not be moved to the end of the list.
45627 </para>
45628 </section>
45629 <section id="SECTreqciphgnu">
45630 <title>Requiring specific ciphers in GnuTLS</title>
45631 <para>
45632 <indexterm role="concept">
45633 <primary>TLS</primary>
45634 <secondary>requiring specific ciphers (GnuTLS)</secondary>
45635 </indexterm>
45636 <indexterm role="concept">
45637 <primary><option>tls_require_ciphers</option></primary>
45638 <secondary>GnuTLS</secondary>
45639 </indexterm>
45640 The GnuTLS library does not have a combined function like OpenSSL. Instead,
45641 it allows the caller to specify separate lists of key-exchange methods,
45642 main cipher algorithms, and MAC algorithms. Unfortunately, these lists are
45643 numerical, and the library does not have a function for turning names into
45644 numbers. Consequently, the list of recognized names has to be built into
45645 the application.
45646 </para>
45647 <para>
45648 At present, Exim permits only the list of main cipher algorithms to be
45649 changed. The <option>tls_require_ciphers</option> option is in the same format as for
45650 OpenSSL. Exim searches each item for the name of available algorithm. For
45651 example, if the list contains RSA_AES_SHA then AES is recognized.
45652 </para>
45653 <para>
45654 The cipher algorithms list starts out with a default set of algorithms. If
45655 the first item in <option>tls_require_ciphers</option> does <emphasis>not</emphasis> start with an
45656 exclamation mark, all the default items are deleted. Thus, only those specified
45657 can be used. If the first item in <option>tls_require_ciphers</option> <emphasis>does</emphasis> start with
45658 an exclamation mark, the defaults are left on the list.
45659 </para>
45660 <para>
45661 Then, any item that starts with an exclamation mark causes the relevant
45662 algorithms to be removed from the list, and any item that does not start
45663 with an exclamation mark causes the relevant algorithms to be added to the
45664 list. Thus,
45665 </para>
45666 <literallayout class="monospaced">
45667 tls_require_ciphers = !RSA_ARCFOUR_SHA
45668 </literallayout>
45669 <para>
45670 allows all the defaults except those that use ARCFOUR, whereas
45671 </para>
45672 <literallayout class="monospaced">
45673 tls_require_ciphers = AES : 3DES
45674 </literallayout>
45675 <para>
45676 allows only cipher suites that use AES and 3DES. The currently recognized
45677 algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and
45678 ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the
45679 list is unimportant; the server will advertise the availability of all the
45680 relevant cipher suites. However, in a client, the order of the list specifies a
45681 preference order for the algorithms. The first one in the client&#x2019;s list that is
45682 also advertised by the server is tried first. The default order is as listed
45683 above.
45684 </para>
45685 </section>
45686 <section>
45687 <title>Configuring an Exim server to use TLS</title>
45688 <para>
45689 <indexterm role="concept">
45690 <primary>TLS</primary>
45691 <secondary>configuring an Exim server</secondary>
45692 </indexterm>
45693 When Exim has been built with TLS support, it advertises the availability of
45694 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
45695 but not to any others. The default value of this option is unset, which means
45696 that STARTTLS is not advertised at all. This default is chosen because you
45697 need to set some other options in order to make TLS avaliable, and also it is
45698 sensible for systems that want to use TLS only as a client.
45699 </para>
45700 <para>
45701 If a client issues a STARTTLS command and there is some configuration
45702 problem in the server, the command is rejected with a 454 error. If the client
45703 persists in trying to issue SMTP commands, all except QUIT are rejected
45704 with the error
45705 </para>
45706 <literallayout class="monospaced">
45707 554 Security failure
45708 </literallayout>
45709 <para>
45710 If a STARTTLS command is issued within an existing TLS session, it is
45711 rejected with a 554 error code.
45712 </para>
45713 <para>
45714 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
45715 match some hosts. You can, of course, set it to * to match all hosts.
45716 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
45717 without some further configuration at the server end.
45718 </para>
45719 <para>
45720 It is rumoured that all existing clients that support TLS/SSL use RSA
45721 encryption. To make this work you need to set, in the server,
45722 </para>
45723 <literallayout class="monospaced">
45724 tls_certificate = /some/file/name
45725 tls_privatekey = /some/file/name
45726 </literallayout>
45727 <para>
45728 These options are, in fact, expanded strings, so you can make them depend on
45729 the identity of the client that is connected if you wish. The first file
45730 contains the server&#x2019;s X509 certificate, and the second contains the private key
45731 that goes with it. These files need to be readable by the Exim user, and must
45732 always be given as full path names. They can be the same file if both the
45733 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
45734 set, or if its expansion is forced to fail or results in an empty string, this
45735 is assumed to be the case. The certificate file may also contain intermediate
45736 certificates that need to be sent to the client to enable it to authenticate
45737 the server&#x2019;s certificate.
45738 </para>
45739 <para>
45740 If you do not understand about certificates and keys, please try to find a
45741 source of this background information, which is not Exim-specific. (There are a
45742 few comments below in section <xref linkend="SECTcerandall"/>.)
45743 </para>
45744 <para>
45745 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
45746 they apply only in the case of a server. If you need to use a certificate in an
45747 Exim client, you must set the options of the same names in an <command>smtp</command>
45748 transport.
45749 </para>
45750 <para>
45751 With just these options, an Exim server will be able to use TLS. It does not
45752 require the client to have a certificate (but see below for how to insist on
45753 this). There is one other option that may be needed in other situations. If
45754 </para>
45755 <literallayout class="monospaced">
45756 tls_dhparam = /some/file/name
45757 </literallayout>
45758 <para>
45759 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
45760 with the parameters contained in the file. This increases the set of cipher
45761 suites that the server supports. See the command
45762 </para>
45763 <literallayout class="monospaced">
45764 openssl dhparam
45765 </literallayout>
45766 <para>
45767 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
45768 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
45769 </para>
45770 <para>
45771 The strings supplied for these three options are expanded every time a client
45772 host connects. It is therefore possible to use different certificates and keys
45773 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
45774 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
45775 forced to fail, Exim behaves as if the option is not set.
45776 </para>
45777 <para>
45778 <indexterm role="concept">
45779 <primary>cipher</primary>
45780 <secondary>logging</secondary>
45781 </indexterm>
45782 <indexterm role="concept">
45783 <primary>log</primary>
45784 <secondary>TLS cipher</secondary>
45785 </indexterm>
45786 <indexterm role="concept">
45787 <primary><varname>$tls_cipher</varname></primary>
45788 </indexterm>
45789 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
45790 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
45791 incoming message (by default &ndash; you can, of course, change this), and it is
45792 also included in the log line that records a message&#x2019;s arrival, keyed by
45793 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
45794 condition can be used to test for specific cipher suites in ACLs.
45795 </para>
45796 <para>
45797 The ACLs that run for subsequent SMTP commands can check the name of the cipher
45798 suite and vary their actions accordingly. The cipher suite names are those used
45799 by OpenSSL. These may differ from the names used elsewhere. For example,
45800 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
45801 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
45802 documentation for more details.
45803 </para>
45804 </section>
45805 <section>
45806 <title>Requesting and verifying client certificates</title>
45807 <para>
45808 <indexterm role="concept">
45809 <primary>certificate</primary>
45810 <secondary>verification of client</secondary>
45811 </indexterm>
45812 <indexterm role="concept">
45813 <primary>TLS</primary>
45814 <secondary>client certificate verification</secondary>
45815 </indexterm>
45816 If you want an Exim server to request a certificate when negotiating a TLS
45817 session with a client, you must set either <option>tls_verify_hosts</option> or
45818 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
45819 apply to all TLS connections. For any host that matches one of these options,
45820 Exim requests a certificate as part of the setup of the TLS session. The
45821 contents of the certificate are verified by comparing it with a list of
45822 expected certificates. These must be available in a file or,
45823 for OpenSSL only (not GnuTLS), a directory, identified by
45824 <option>tls_verify_certificates</option>.
45825 </para>
45826 <para>
45827 A file can contain multiple certificates, concatenated end to end. If a
45828 directory is used
45829 (OpenSSL only),
45830 each certificate must be in a separate file, with a name (or a symbolic link)
45831 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
45832 certificate. You can compute the relevant hash by running the command
45833 </para>
45834 <literallayout class="monospaced">
45835 openssl x509 -hash -noout -in /cert/file
45836 </literallayout>
45837 <para>
45838 where <filename>/cert/file</filename> contains a single certificate.
45839 </para>
45840 <para>
45841 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
45842 what happens if the client does not supply a certificate, or if the certificate
45843 does not match any of the certificates in the collection named by
45844 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
45845 attempt to set up a TLS session is aborted, and the incoming connection is
45846 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
45847 session continues. ACLs that run for subsequent SMTP commands can detect the
45848 fact that no certificate was verified, and vary their actions accordingly. For
45849 example, you can insist on a certificate before accepting a message for
45850 relaying, but not when the message is destined for local delivery.
45851 </para>
45852 <para>
45853 <indexterm role="concept">
45854 <primary><varname>$tls_peerdn</varname></primary>
45855 </indexterm>
45856 When a client supplies a certificate (whether it verifies or not), the value of
45857 the Distinguished Name of the certificate is made available in the variable
45858 <varname>$tls_peerdn</varname> during subsequent processing of the message.
45859 </para>
45860 <para>
45861 <indexterm role="concept">
45862 <primary>log</primary>
45863 <secondary>distinguished name</secondary>
45864 </indexterm>
45865 Because it is often a long text string, it is not included in the log line or
45866 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
45867 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
45868 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
45869 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
45870 </para>
45871 </section>
45872 <section>
45873 <title>Revoked certificates</title>
45874 <para>
45875 <indexterm role="concept">
45876 <primary>TLS</primary>
45877 <secondary>revoked certificates</secondary>
45878 </indexterm>
45879 <indexterm role="concept">
45880 <primary>revocation list</primary>
45881 </indexterm>
45882 <indexterm role="concept">
45883 <primary>certificate</primary>
45884 <secondary>revocation list</secondary>
45885 </indexterm>
45886 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
45887 certificates are revoked. If you have such a list, you can pass it to an Exim
45888 server using the global option called <option>tls_crl</option> and to an Exim client using
45889 an identically named option for the <command>smtp</command> transport. In each case, the value
45890 of the option is expanded and must then be the name of a file that contains a
45891 CRL in PEM format.
45892 </para>
45893 </section>
45894 <section>
45895 <title>Configuring an Exim client to use TLS</title>
45896 <para>
45897 <indexterm role="concept">
45898 <primary>cipher</primary>
45899 <secondary>logging</secondary>
45900 </indexterm>
45901 <indexterm role="concept">
45902 <primary>log</primary>
45903 <secondary>TLS cipher</secondary>
45904 </indexterm>
45905 <indexterm role="concept">
45906 <primary>log</primary>
45907 <secondary>distinguished name</secondary>
45908 </indexterm>
45909 <indexterm role="concept">
45910 <primary>TLS</primary>
45911 <secondary>configuring an Exim client</secondary>
45912 </indexterm>
45913 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
45914 deliveries as well as to incoming, the latter one causing logging of the
45915 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
45916 within the <command>smtp</command> transport.
45917 </para>
45918 <para>
45919 It is not necessary to set any options to have TLS work in the <command>smtp</command>
45920 transport. If Exim is built with TLS support, and TLS is advertised by a
45921 server, the <command>smtp</command> transport always tries to start a TLS session. However,
45922 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
45923 transport) to a list of server hosts for which TLS should not be used.
45924 </para>
45925 <para>
45926 If you do not want Exim to attempt to send messages unencrypted when an attempt
45927 to set up an encrypted connection fails in any way, you can set
45928 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
45929 those hosts, delivery is always deferred if an encrypted connection cannot be
45930 set up. If there are any other hosts for the address, they are tried in the
45931 usual way.
45932 </para>
45933 <para>
45934 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
45935 the message unencrypted. It always does this if the response to STARTTLS is
45936 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
45937 session after a success response code, what happens is controlled by the
45938 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
45939 delivery to this host is deferred, and other hosts (if available) are tried. If
45940 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
45941 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
45942 negotiation fails, Exim closes the current connection (because it is in an
45943 unknown state), opens a new one to the same host, and then tries the delivery
45944 unencrypted.
45945 </para>
45946 <para>
45947 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
45948 transport provide the client with a certificate, which is passed to the server
45949 if it requests it. If the server is Exim, it will request a certificate only if
45950 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
45951 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
45952 is operating as a client. Exim does not assume that a server certificate (set
45953 by the global options of the same name) should also be used when operating as a
45954 client.
45955 </para>
45956 <para>
45957 If <option>tls_verify_certificates</option> is set, it must name a file or,
45958 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
45959 expected server certificates. The client verifies the server&#x2019;s certificate
45960 against this collection, taking into account any revoked certificates that are
45961 in the list defined by <option>tls_crl</option>.
45962 </para>
45963 <para>
45964 If
45965 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
45966 list of permitted cipher suites. If either of these checks fails, delivery to
45967 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
45968 alternative hosts, if any.
45969 </para>
45970 <para>
45971 <indexterm role="concept">
45972 <primary><varname>$host</varname></primary>
45973 </indexterm>
45974 <indexterm role="concept">
45975 <primary><varname>$host_address</varname></primary>
45976 </indexterm>
45977 All the TLS options in the <command>smtp</command> transport are expanded before use, with
45978 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
45979 which the client is connected. Forced failure of an expansion causes Exim to
45980 behave as if the relevant option were unset.
45981 </para>
45982 </section>
45983 <section id="SECTmulmessam">
45984 <title>Multiple messages on the same encrypted TCP/IP connection</title>
45985 <para>
45986 <indexterm role="concept">
45987 <primary>multiple SMTP deliveries with TLS</primary>
45988 </indexterm>
45989 <indexterm role="concept">
45990 <primary>TLS</primary>
45991 <secondary>multiple message deliveries</secondary>
45992 </indexterm>
45993 Exim sends multiple messages down the same TCP/IP connection by starting up
45994 an entirely new delivery process for each message, passing the socket from
45995 one process to the next. This implementation does not fit well with the use
45996 of TLS, because there is quite a lot of state information associated with a TLS
45997 connection, not just a socket identification. Passing all the state information
45998 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
45999 session before passing the socket to a new process. The new process may then
46000 try to start a new TLS session, and if successful, may try to re-authenticate
46001 if AUTH is in use, before sending the next message.
46002 </para>
46003 <para>
46004 The RFC is not clear as to whether or not an SMTP session continues in clear
46005 after TLS has been shut down, or whether TLS may be restarted again later, as
46006 just described. However, if the server is Exim, this shutdown and
46007 reinitialization works. It is not known which (if any) other servers operate
46008 successfully if the client closes a TLS session and continues with unencrypted
46009 SMTP, but there are certainly some that do not work. For such servers, Exim
46010 should not pass the socket to another process, because the failure of the
46011 subsequent attempt to use it would cause Exim to record a temporary host error,
46012 and delay other deliveries to that host.
46013 </para>
46014 <para>
46015 To test for this case, Exim sends an EHLO command to the server after
46016 closing down the TLS session. If this fails in any way, the connection is
46017 closed instead of being passed to a new delivery process, but no retry
46018 information is recorded.
46019 </para>
46020 <para>
46021 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
46022 <command>smtp</command> transport to match those hosts for which Exim should not pass
46023 connections to new processes if TLS has been used.
46024 </para>
46025 </section>
46026 <section id="SECTcerandall">
46027 <title>Certificates and all that</title>
46028 <para>
46029 <indexterm role="concept">
46030 <primary>certificate</primary>
46031 <secondary>references to discussion</secondary>
46032 </indexterm>
46033 In order to understand fully how TLS works, you need to know about
46034 certificates, certificate signing, and certificate authorities. This is not the
46035 place to give a tutorial, especially as I do not know very much about it
46036 myself. Some helpful introduction can be found in the FAQ for the SSL addition
46037 to Apache, currently at
46038 </para>
46039 <literallayout>
46040 <emphasis role="bold"><ulink url="http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24">http://www.modssl.org/docs/2.7/ssl_faq.html#ToC24</ulink></emphasis>
46041 </literallayout>
46042 <para>
46043 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
46044 links to further files.
46045 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
46046 0-201-61598-3), contains both introductory and more in-depth descriptions.
46047 Some sample programs taken from the book are available from
46048 </para>
46049 <literallayout>
46050 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
46051 </literallayout>
46052 </section>
46053 <section>
46054 <title>Certificate chains</title>
46055 <para>
46056 The file named by <option>tls_certificate</option> may contain more than one
46057 certificate. This is useful in the case where the certificate that is being
46058 sent is validated by an intermediate certificate which the other end does
46059 not have. Multiple certificates must be in the correct order in the file.
46060 First the host&#x2019;s certificate itself, then the first intermediate
46061 certificate to validate the issuer of the host certificate, then the next
46062 intermediate certificate to validate the issuer of the first intermediate
46063 certificate, and so on, until finally (optionally) the root certificate.
46064 The root certificate must already be trusted by the recipient for
46065 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
46066 root certificate along with the rest makes it available for the user to
46067 install if the receiving end is a client MUA that can interact with a user.
46068 </para>
46069 </section>
46070 <section>
46071 <title>Self-signed certificates</title>
46072 <para>
46073 <indexterm role="concept">
46074 <primary>certificate</primary>
46075 <secondary>self-signed</secondary>
46076 </indexterm>
46077 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
46078 with OpenSSL, like this:
46079 </para>
46080 <literallayout class="monospaced">
46081 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
46082             -days 9999 -nodes
46083 </literallayout>
46084 <para>
46085 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
46086 delimited and so can be identified independently. The <option>-days</option> option
46087 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
46088 important: if you do not set it, the key is encrypted with a passphrase
46089 that you are prompted for, and any use that is made of the key causes more
46090 prompting for the passphrase. This is not helpful if you are going to use
46091 this certificate and key in an MTA, where prompting is not possible.
46092 </para>
46093 <para>
46094 A self-signed certificate made in this way is sufficient for testing, and
46095 may be adequate for all your requirements if you are mainly interested in
46096 encrypting transfers, and not in secure identification.
46097 </para>
46098 <para>
46099 However, many clients require that the certificate presented by the server be a
46100 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
46101 certificate. In this situation, the self-signed certificate described above
46102 must be installed on the client host as a trusted root <emphasis>certification
46103 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
46104 signed with that self-signed certificate.
46105 </para>
46106 <para>
46107 For information on creating self-signed CA certificates and using them to sign
46108 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
46109 Open-source PKI book, available online at
46110 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
46111 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
46112 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
46113 </para>
46114 </section>
46115 </chapter>
46116
46117 <chapter id="CHAPACL">
46118 <title>Access control lists</title>
46119 <para>
46120 <indexterm role="concept" id="IIDacl" class="startofrange">
46121 <primary>access control lists (ACLs)</primary>
46122 <secondary>description</secondary>
46123 </indexterm>
46124 <indexterm role="concept">
46125 <primary>control of incoming mail</primary>
46126 </indexterm>
46127 <indexterm role="concept">
46128 <primary>message</primary>
46129 <secondary>controlling incoming</secondary>
46130 </indexterm>
46131 <indexterm role="concept">
46132 <primary>policy control</primary>
46133 <secondary>access control lists</secondary>
46134 </indexterm>
46135 Access Control Lists (ACLs) are defined in a separate section of the run time
46136 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
46137 name, terminated by a colon. Here is a complete ACL section that contains just
46138 one very small ACL:
46139 </para>
46140 <literallayout class="monospaced">
46141 begin acl
46142
46143 small_acl:
46144   accept   hosts = one.host.only
46145 </literallayout>
46146 <para>
46147 You can have as many lists as you like in the ACL section, and the order in
46148 which they appear does not matter. The lists are self-terminating.
46149 </para>
46150 <para>
46151 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
46152 certain SMTP commands. This applies both to incoming TCP/IP connections, and
46153 when a local process submits a message using SMTP by specifying the <option>-bs</option>
46154 option. The most common use is for controlling which recipients are accepted
46155 in incoming messages. In addition, you can define an ACL that is used to check
46156 local non-SMTP messages. The default configuration file contains an example of
46157 a realistic ACL for checking RCPT commands. This is discussed in chapter
46158 <xref linkend="CHAPdefconfil"/>.
46159 </para>
46160 <section>
46161 <title>Testing ACLs</title>
46162 <para>
46163 The <option>-bh</option> command line option provides a way of testing your ACL
46164 configuration locally by running a fake SMTP session with which you interact.
46165 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
46166 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
46167 </para>
46168 </section>
46169 <section>
46170 <title>Specifying when ACLs are used</title>
46171 <para>
46172 <indexterm role="concept">
46173 <primary>access control lists (ACLs)</primary>
46174 <secondary>options for specifying</secondary>
46175 </indexterm>
46176 In order to cause an ACL to be used, you have to name it in one of the relevant
46177 options in the main part of the configuration. These options are:
46178 <indexterm role="concept">
46179 <primary>AUTH</primary>
46180 <secondary>ACL for</secondary>
46181 </indexterm>
46182 <indexterm role="concept">
46183 <primary>DATA</primary>
46184 <secondary>ACLs for</secondary>
46185 </indexterm>
46186 <indexterm role="concept">
46187 <primary>ETRN</primary>
46188 <secondary>ACL for</secondary>
46189 </indexterm>
46190 <indexterm role="concept">
46191 <primary>EXPN</primary>
46192 <secondary>ACL for</secondary>
46193 </indexterm>
46194 <indexterm role="concept">
46195 <primary>HELO</primary>
46196 <secondary>ACL for</secondary>
46197 </indexterm>
46198 <indexterm role="concept">
46199 <primary>EHLO</primary>
46200 <secondary>ACL for</secondary>
46201 </indexterm>
46202 <indexterm role="concept">
46203 <primary>MAIL</primary>
46204 <secondary>ACL for</secondary>
46205 </indexterm>
46206 <indexterm role="concept">
46207 <primary>QUIT</primary>
46208 <secondary>ACL for</secondary>
46209 </indexterm>
46210 <indexterm role="concept">
46211 <primary>RCPT</primary>
46212 <secondary>ACL for</secondary>
46213 </indexterm>
46214 <indexterm role="concept">
46215 <primary>STARTTLS</primary>
46216 <secondary>ACL for</secondary>
46217 </indexterm>
46218 <indexterm role="concept">
46219 <primary>VRFY</primary>
46220 <secondary>ACL for</secondary>
46221 </indexterm>
46222 <indexterm role="concept">
46223 <primary>SMTP connection</primary>
46224 <secondary>ACL for</secondary>
46225 </indexterm>
46226 <indexterm role="concept">
46227 <primary>non-smtp message</primary>
46228 <secondary>ACLs for</secondary>
46229 </indexterm>
46230 <indexterm role="concept">
46231 <primary>MIME parts</primary>
46232 <secondary>ACL for</secondary>
46233 </indexterm>
46234 </para>
46235 <informaltable frame="none">
46236 <tgroup cols="2" colsep="0" rowsep="0">
46237 <colspec colwidth="140pt" align="left"/>
46238 <colspec colwidth="254pt" align="left"/>
46239 <tbody>
46240 <row>
46241 <entry>&nbsp;<option>acl_not_smtp</option></entry>
46242 <entry>ACL for non-SMTP messages</entry>
46243 </row>
46244 <row>
46245 <entry>&nbsp;<option>acl_not_smtp_mime</option></entry>
46246 <entry>ACL for non-SMTP MIME parts</entry>
46247 </row>
46248 <row>
46249 <entry>&nbsp;<option>acl_not_smtp_start</option></entry>
46250 <entry>ACL at start of non-SMTP message</entry>
46251 </row>
46252 <row>
46253 <entry>&nbsp;<option>acl_smtp_auth</option></entry>
46254 <entry>ACL for AUTH</entry>
46255 </row>
46256 <row>
46257 <entry>&nbsp;<option>acl_smtp_connect</option></entry>
46258 <entry>ACL for start of SMTP connection</entry>
46259 </row>
46260 <row>
46261 <entry>&nbsp;<option>acl_smtp_data</option></entry>
46262 <entry>ACL after DATA is complete</entry>
46263 </row>
46264 <row>
46265 <entry>&nbsp;<option>acl_smtp_etrn</option></entry>
46266 <entry>ACL for ETRN</entry>
46267 </row>
46268 <row>
46269 <entry>&nbsp;<option>acl_smtp_expn</option></entry>
46270 <entry>ACL for EXPN</entry>
46271 </row>
46272 <row>
46273 <entry>&nbsp;<option>acl_smtp_helo</option></entry>
46274 <entry>ACL for HELO or EHLO</entry>
46275 </row>
46276 <row>
46277 <entry>&nbsp;<option>acl_smtp_mail</option></entry>
46278 <entry>ACL for MAIL</entry>
46279 </row>
46280 <row>
46281 <entry>&nbsp;<option>acl_smtp_mailauth</option></entry>
46282 <entry>ACL for the AUTH parameter of MAIL</entry>
46283 </row>
46284 <row>
46285 <entry>&nbsp;<option>acl_smtp_mime</option></entry>
46286 <entry>ACL for content-scanning MIME parts</entry>
46287 </row>
46288 <row>
46289 <entry>&nbsp;<option>acl_smtp_predata</option></entry>
46290 <entry>ACL at start of DATA command</entry>
46291 </row>
46292 <row>
46293 <entry>&nbsp;<option>acl_smtp_quit</option></entry>
46294 <entry>ACL for QUIT</entry>
46295 </row>
46296 <row>
46297 <entry>&nbsp;<option>acl_smtp_rcpt</option></entry>
46298 <entry>ACL for RCPT</entry>
46299 </row>
46300 <row>
46301 <entry>&nbsp;<option>acl_smtp_starttls</option></entry>
46302 <entry>ACL for STARTTLS</entry>
46303 </row>
46304 <row>
46305 <entry>&nbsp;<option>acl_smtp_vrfy</option></entry>
46306 <entry>ACL for VRFY</entry>
46307 </row>
46308 </tbody>
46309 </tgroup>
46310 </informaltable>
46311 <para>
46312 For example, if you set
46313 </para>
46314 <literallayout class="monospaced">
46315 acl_smtp_rcpt = small_acl
46316 </literallayout>
46317 <para>
46318 the little ACL defined above is used whenever Exim receives a RCPT command
46319 in an SMTP dialogue. The majority of policy tests on incoming messages can be
46320 done when RCPT commands arrive. A rejection of RCPT should cause the
46321 sending MTA to give up on the recipient address contained in the RCPT
46322 command, whereas rejection at other times may cause the client MTA to keep on
46323 trying to deliver the message. It is therefore recommended that you do as much
46324 testing as possible at RCPT time.
46325 </para>
46326 </section>
46327 <section>
46328 <title>The non-SMTP ACLs</title>
46329 <para>
46330 <indexterm role="concept">
46331 <primary>non-smtp message</primary>
46332 <secondary>ACLs for</secondary>
46333 </indexterm>
46334 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
46335 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
46336 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
46337 the state of the SMTP connection such as encryption and authentication) are not
46338 relevant and are forbidden in these ACLs. However, the sender and recipients
46339 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
46340 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
46341 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
46342 in any of these ACLs.
46343 </para>
46344 <para>
46345 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
46346 non-SMTP message, before any of the message has been read. (This is the
46347 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) The result of this
46348 ACL is ignored; it cannot be used to reject a message. If you really need to,
46349 you could set a value in an ACL variable here and reject based on that in the
46350 <option>acl_not_smtp</option> ACL. However, this ACL can be used to set controls, and in
46351 particular, it can be used to set
46352 </para>
46353 <literallayout class="monospaced">
46354 control = suppress_local_fixups
46355 </literallayout>
46356 <para>
46357 This cannot be used in the other non-SMTP ACLs because by the time they are
46358 run, it is too late.
46359 </para>
46360 <para>
46361 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
46362 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
46363 </para>
46364 <para>
46365 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
46366 kind of rejection is treated as permanent, because there is no way of sending a
46367 temporary error for these kinds of message.
46368 </para>
46369 </section>
46370 <section>
46371 <title>The SMTP connect ACL</title>
46372 <para revisionflag="changed">
46373 <indexterm role="concept">
46374 <primary>SMTP connection</primary>
46375 <secondary>ACL for</secondary>
46376 </indexterm>
46377 <indexterm role="concept">
46378 <primary><option>smtp_banner</option></primary>
46379 </indexterm>
46380 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
46381 session, after the test specified by <option>host_reject_connection</option> (which is now
46382 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
46383 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
46384 the message override the banner message that is otherwise specified by the
46385 <option>smtp_banner</option> option.
46386 </para>
46387 </section>
46388 <section revisionflag="changed">
46389 <title>The EHLO/HELO ACL</title>
46390 <para revisionflag="changed">
46391 <indexterm role="concept">
46392 <primary>EHLO</primary>
46393 <secondary>ACL for</secondary>
46394 </indexterm>
46395 <indexterm role="concept">
46396 <primary>HELO</primary>
46397 <secondary>ACL for</secondary>
46398 </indexterm>
46399 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
46400 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
46401 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
46402 Note that a client may issue more than one EHLO or HELO command in an SMTP
46403 session, and indeed is required to issue a new EHLO or HELO after successfully
46404 setting up encryption following a STARTTLS command.
46405 </para>
46406 <para revisionflag="changed">
46407 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
46408 modifier, the message may not contain more than one line (it will be truncated
46409 at the first newline and a panic logged if it does). Such a message cannot
46410 affect the EHLO options that are listed on the second and subsequent lines of
46411 an EHLO response.
46412 </para>
46413 </section>
46414 <section>
46415 <title>The DATA ACLs</title>
46416 <para>
46417 <indexterm role="concept">
46418 <primary>DATA</primary>
46419 <secondary>ACLs for</secondary>
46420 </indexterm>
46421 Two ACLs are associated with the DATA command, because it is two-stage
46422 command, with two responses being sent to the client.
46423 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
46424 is obeyed. This gives you control after all the RCPT commands, but before
46425 the message itself is received. It offers the opportunity to give a negative
46426 response to the DATA command before the data is transmitted. Header lines
46427 added by MAIL or RCPT ACLs are not visible at this time, but any that
46428 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
46429 </para>
46430 <para>
46431 You cannot test the contents of the message, for example, to verify addresses
46432 in the headers, at RCPT time or when the DATA command is received. Such
46433 tests have to appear in the ACL that is run after the message itself has been
46434 received, before the final response to the DATA command is sent. This is
46435 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
46436 associated with the DATA command.
46437 </para>
46438 <para>
46439 For both of these ACLs, it is not possible to reject individual recipients. An
46440 error response rejects the entire message. Unfortunately, it is known that some
46441 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
46442 before or after the data) correctly &ndash; they keep the message on their queues
46443 and try again later, but that is their problem, though it does waste some of
46444 your resources.
46445 </para>
46446 </section>
46447 <section>
46448 <title>The SMTP MIME ACL</title>
46449 <para>
46450 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
46451 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
46452 </para>
46453 </section>
46454 <section id="SECTQUITACL">
46455 <title>The QUIT ACL</title>
46456 <para>
46457 <indexterm role="concept">
46458 <primary>QUIT</primary>
46459 <secondary>ACL for</secondary>
46460 </indexterm>
46461 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
46462 does not affect the response code to QUIT, which is always 221. Thus, the ACL
46463 does not in fact control any access. For this reason, the only verbs that are
46464 permitted are <option>accept</option> and <option>warn</option>.
46465 </para>
46466 <para>
46467 This ACL can be used for tasks such as custom logging at the end of an SMTP
46468 session. For example, you can use ACL variables in other ACLs to count
46469 messages, recipients, etc., and log the totals at QUIT time using one or
46470 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
46471 </para>
46472 <para>
46473 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
46474 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
46475 </para>
46476 <para>
46477 You do not need to have a final <option>accept</option>, but if you do, you can use a
46478 <option>message</option> modifier to specify custom text that is sent as part of the 221
46479 response to QUIT.
46480 </para>
46481 <para>
46482 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
46483 failure (for example, failure to open a log file, or when Exim is bombing out
46484 because it has detected an unrecoverable error), all SMTP commands from the
46485 client are given temporary error responses until QUIT is received or the
46486 connection is closed. In these special cases, the QUIT ACL does not run.
46487 </para>
46488 </section>
46489 <section>
46490 <title>Finding an ACL to use</title>
46491 <para>
46492 <indexterm role="concept">
46493 <primary>access control lists (ACLs)</primary>
46494 <secondary>finding which to use</secondary>
46495 </indexterm>
46496 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
46497 you can use different ACLs in different circumstances. For example,
46498 </para>
46499 <literallayout class="monospaced">
46500 acl_smtp_rcpt = ${if ={25}{$interface_port} \
46501                      {acl_check_rcpt} {acl_check_rcpt_submit} }
46502 </literallayout>
46503 <para>
46504 In the default configuration file there are some example settings for
46505 providing an RFC 4409 message submission service on port 587 and a
46506 non-standard <quote>smtps</quote> service on port 465. You can use a string
46507 expansion like this to choose an ACL for MUAs on these ports which is
46508 more appropriate for this purpose than the default ACL on port 25.
46509 </para>
46510 <para>
46511 The expanded string does not have to be the name of an ACL in the
46512 configuration file; there are other possibilities. Having expanded the
46513 string, Exim searches for an ACL as follows:
46514 </para>
46515 <itemizedlist>
46516 <listitem>
46517 <para>
46518 If the string begins with a slash, Exim uses it as a file name, and reads its
46519 contents as an ACL. The lines are processed in the same way as lines in the
46520 Exim configuration file. In particular, continuation lines are supported, blank
46521 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
46522 If the file does not exist or cannot be read, an error occurs (typically
46523 causing a temporary failure of whatever caused the ACL to be run). For example:
46524 </para>
46525 <literallayout class="monospaced">
46526 acl_smtp_data = /etc/acls/\
46527   ${lookup{$sender_host_address}lsearch\
46528   {/etc/acllist}{$value}{default}}
46529 </literallayout>
46530 <para>
46531 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
46532 back to a default if the lookup fails. If an ACL is successfully read from a
46533 file, it is retained in memory for the duration of the Exim process, so that it
46534 can be re-used without having to re-read the file.
46535 </para>
46536 </listitem>
46537 <listitem>
46538 <para>
46539 If the string does not start with a slash, and does not contain any spaces,
46540 Exim searches the ACL section of the configuration for an ACL whose name
46541 matches the string.
46542 </para>
46543 </listitem>
46544 <listitem>
46545 <para>
46546 If no named ACL is found, or if the string contains spaces, Exim parses
46547 the string as an inline ACL. This can save typing in cases where you just
46548 want to have something like
46549 </para>
46550 <literallayout class="monospaced">
46551 acl_smtp_vrfy = accept
46552 </literallayout>
46553 <para>
46554 in order to allow free use of the VRFY command. Such a string may contain
46555 newlines; it is processed in the same way as an ACL that is read from a file.
46556 </para>
46557 </listitem>
46558 </itemizedlist>
46559 </section>
46560 <section>
46561 <title>ACL return codes</title>
46562 <para>
46563 <indexterm role="concept">
46564 <primary>access control lists (ACLs)</primary>
46565 <secondary>return codes</secondary>
46566 </indexterm>
46567 Except for the QUIT ACL, which does not affect the SMTP return code (see
46568 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
46569 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
46570 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
46571 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
46572 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
46573 This also causes a 4<emphasis>xx</emphasis> return code.
46574 </para>
46575 <para>
46576 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
46577 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
46578 submitters of non-SMTP messages.
46579 </para>
46580 <para>
46581 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
46582 has the effect of <quote>accept</quote>, but causes either the entire message or an
46583 individual recipient address to be discarded. In other words, it is a
46584 blackholing facility. Use it with care.
46585 </para>
46586 <para>
46587 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
46588 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
46589 RCPT ACL is to discard just the one recipient address. If there are no
46590 recipients left when the message&#x2019;s data is received, the DATA ACL is not
46591 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
46592 remaining recipients. The <quote>discard</quote> return is not permitted for the
46593 <option>acl_smtp_predata</option> ACL.
46594 </para>
46595 <para>
46596 <indexterm role="concept">
46597 <primary><function>local_scan()</function> function</primary>
46598 <secondary>when all recipients discarded</secondary>
46599 </indexterm>
46600 The <function>local_scan()</function> function is always run, even if there are no remaining
46601 recipients; it may create new recipients.
46602 </para>
46603 </section>
46604 <section>
46605 <title>Unset ACL options</title>
46606 <para>
46607 <indexterm role="concept">
46608 <primary>access control lists (ACLs)</primary>
46609 <secondary>unset options</secondary>
46610 </indexterm>
46611 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
46612 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
46613 not defined at all. For any defined ACL, the default action when control
46614 reaches the end of the ACL statements is <quote>deny</quote>.
46615 </para>
46616 <para>
46617 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
46618 these two are ACLs that are used only for their side effects. They cannot be
46619 used to accept or reject anything.
46620 </para>
46621 <para>
46622 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
46623 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
46624 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
46625 when the ACL is not defined is <quote>accept</quote>.
46626 </para>
46627 <para>
46628 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
46629 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
46630 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
46631 messages over an SMTP connection. For an example, see the ACL in the default
46632 configuration file.
46633 </para>
46634 </section>
46635 <section>
46636 <title>Data for message ACLs</title>
46637 <para>
46638 <indexterm role="concept">
46639 <primary>access control lists (ACLs)</primary>
46640 <secondary>data for message ACL</secondary>
46641 </indexterm>
46642 <indexterm role="concept">
46643 <primary><varname>$domain</varname></primary>
46644 </indexterm>
46645 <indexterm role="concept">
46646 <primary><varname>$local_part</varname></primary>
46647 </indexterm>
46648 <indexterm role="concept">
46649 <primary><varname>$sender_address</varname></primary>
46650 </indexterm>
46651 <indexterm role="concept">
46652 <primary><varname>$sender_host_address</varname></primary>
46653 </indexterm>
46654 <indexterm role="concept">
46655 <primary><varname>$smtp_command</varname></primary>
46656 </indexterm>
46657 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
46658 that contain information about the host and the message&#x2019;s sender (for example,
46659 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
46660 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
46661 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
46662 is available in <varname>$smtp_command</varname>.
46663 </para>
46664 <para>
46665 When an ACL for the AUTH parameter of MAIL is running, the variables that
46666 contain information about the host are set, but <varname>$sender_address</varname> is not yet
46667 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
46668 how it is used.
46669 </para>
46670 <para>
46671 <indexterm role="concept">
46672 <primary><varname>$message_size</varname></primary>
46673 </indexterm>
46674 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
46675 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
46676 that parameter is not given. The value is updated to the true message size by
46677 the time the final DATA ACL is run (after the message data has been
46678 received).
46679 </para>
46680 <para>
46681 <indexterm role="concept">
46682 <primary><varname>$rcpt_count</varname></primary>
46683 </indexterm>
46684 <indexterm role="concept">
46685 <primary><varname>$recipients_count</varname></primary>
46686 </indexterm>
46687 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
46688 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
46689 accepted, so while an ACL for RCPT is being processed, it contains the number
46690 of previously accepted recipients. At DATA time (for both the DATA ACLs),
46691 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
46692 <varname>$recipients_count</varname> contains the total number of accepted recipients.
46693 </para>
46694 </section>
46695 <section id="SECTdatfornon">
46696 <title>Data for non-message ACLs</title>
46697 <para>
46698 <indexterm role="concept">
46699 <primary>access control lists (ACLs)</primary>
46700 <secondary>data for non-message ACL</secondary>
46701 </indexterm>
46702 <indexterm role="concept">
46703 <primary><varname>$smtp_command_argument</varname></primary>
46704 </indexterm>
46705 <indexterm role="concept">
46706 <primary><varname>$smtp_command</varname></primary>
46707 </indexterm>
46708 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
46709 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
46710 and the entire SMTP command is available in <varname>$smtp_command</varname>.
46711 These variables can be tested using a <option>condition</option> condition. For example,
46712 here is an ACL for use with AUTH, which insists that either the session is
46713 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
46714 does not permit authentication methods that use cleartext passwords on
46715 unencrypted connections.
46716 </para>
46717 <literallayout class="monospaced">
46718 acl_check_auth:
46719   accept encrypted = *
46720   accept condition = ${if eq{${uc:$smtp_command_argument}}\
46721                      {CRAM-MD5}}
46722   deny   message   = TLS encryption or CRAM-MD5 required
46723 </literallayout>
46724 <para>
46725 (Another way of applying this restriction is to arrange for the authenticators
46726 that use cleartext passwords not to be advertised when the connection is not
46727 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
46728 option to do this.)
46729 </para>
46730 </section>
46731 <section>
46732 <title>Format of an ACL</title>
46733 <para>
46734 <indexterm role="concept">
46735 <primary>access control lists (ACLs)</primary>
46736 <secondary>format of</secondary>
46737 </indexterm>
46738 <indexterm role="concept">
46739 <primary>access control lists (ACLs)</primary>
46740 <secondary>verbs; definition of</secondary>
46741 </indexterm>
46742 An individual ACL consists of a number of statements. Each statement starts
46743 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
46744 Modifiers can change the way the verb operates, define error and log messages,
46745 set variables, insert delays, and vary the processing of accepted messages.
46746 </para>
46747 <para>
46748 If all the conditions are met, the verb is obeyed. The same condition may be
46749 used (with different arguments) more than once in the same statement. This
46750 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
46751 example:
46752 </para>
46753 <literallayout class="monospaced">
46754 deny  dnslists = list1.example
46755 dnslists = list2.example
46756 </literallayout>
46757 <para>
46758 If there are no conditions, the verb is always obeyed. Exim stops evaluating
46759 the conditions and modifiers when it reaches a condition that fails. What
46760 happens then depends on the verb (and in one case, on a special modifier). Not
46761 all the conditions make sense at every testing point. For example, you cannot
46762 test a sender address in the ACL that is run for a VRFY command.
46763 </para>
46764 </section>
46765 <section>
46766 <title>ACL verbs</title>
46767 <para>
46768 The ACL verbs are as follows:
46769 </para>
46770 <itemizedlist>
46771 <listitem>
46772 <para>
46773 <indexterm role="concept">
46774 <primary><option>accept</option></primary>
46775 <secondary>ACL verb</secondary>
46776 </indexterm>
46777 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
46778 of the conditions are not met, what happens depends on whether <option>endpass</option>
46779 appears among the conditions (for syntax see below). If the failing condition
46780 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
46781 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
46782 check a RCPT command:
46783 </para>
46784 <literallayout class="monospaced">
46785 accept domains = +local_domains
46786 endpass
46787 verify = recipient
46788 </literallayout>
46789 <para>
46790 If the recipient domain does not match the <option>domains</option> condition, control
46791 passes to the next statement. If it does match, the recipient is verified, and
46792 the command is accepted if verification succeeds. However, if verification
46793 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
46794 <option>endpass</option>.
46795 </para>
46796 <para revisionflag="changed">
46797 The <option>endpass</option> feature has turned out to be confusing to many people, so its
46798 use is not recommended nowadays. It is always possible to rewrite an ACL so
46799 that <option>endpass</option> is not needed, and it is no longer used in the default
46800 configuration.
46801 </para>
46802 <para revisionflag="changed">
46803 <indexterm role="concept">
46804 <primary><option>message</option></primary>
46805 <secondary>ACL modifier, with <option>accept</option></secondary>
46806 </indexterm>
46807 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
46808 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
46809 (when an <option>accept</option> verb either accepts or passes control to the next
46810 statement), <option>message</option> can be used to vary the message that is sent when an
46811 SMTP command is accepted. For example, in a RCPT ACL you could have:
46812 </para>
46813 <literallayout revisionflag="changed">
46814 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
46815 <literal>        message = OK, I'll allow you through today</literal>
46816 </literallayout>
46817 <para revisionflag="changed">
46818 You can specify an SMTP response code, optionally followed by an <quote>extended
46819 response code</quote> at the start of the message, but the first digit must be the
46820 same as would be sent by default, which is 2 for an <option>accept</option> verb.
46821 </para>
46822 <para revisionflag="changed">
46823 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
46824 an error message that is used when access is denied. This behaviour is retained
46825 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
46826 of <option>endpass</option>.
46827 </para>
46828 </listitem>
46829 <listitem>
46830 <para>
46831 <indexterm role="concept">
46832 <primary><option>defer</option></primary>
46833 <secondary>ACL verb</secondary>
46834 </indexterm>
46835 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
46836 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
46837 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
46838 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
46839 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
46840 be used in any ACL, and even for a recipient it might be a simpler approach.
46841 </para>
46842 </listitem>
46843 <listitem>
46844 <para>
46845 <indexterm role="concept">
46846 <primary><option>deny</option></primary>
46847 <secondary>ACL verb</secondary>
46848 </indexterm>
46849 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
46850 the conditions are not met, control is passed to the next ACL statement. For
46851 example,
46852 </para>
46853 <literallayout class="monospaced">
46854 deny dnslists = blackholes.mail-abuse.org
46855 </literallayout>
46856 <para>
46857 rejects commands from hosts that are on a DNS black list.
46858 </para>
46859 </listitem>
46860 <listitem>
46861 <para revisionflag="changed">
46862 <indexterm role="concept">
46863 <primary><option>discard</option></primary>
46864 <secondary>ACL verb</secondary>
46865 </indexterm>
46866 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
46867 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
46868 that are concerned with receiving messages. When all the conditions are true,
46869 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
46870 recipients to be discarded. If it is used in an ACL for RCPT, just the one
46871 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
46872 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
46873 do not appear in the log line when the <option>log_recipients</option> log selector is set.
46874 </para>
46875 <para revisionflag="changed">
46876 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
46877 its contents are added to the line that is automatically written to the log.
46878 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
46879 </para>
46880 </listitem>
46881 <listitem>
46882 <para>
46883 <indexterm role="concept">
46884 <primary><option>drop</option></primary>
46885 <secondary>ACL verb</secondary>
46886 </indexterm>
46887 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
46888 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
46889 </para>
46890 <literallayout class="monospaced">
46891 drop   message   = I don't take more than 20 RCPTs
46892        condition = ${if &gt; {$rcpt_count}{20}}
46893 </literallayout>
46894 <para>
46895 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
46896 The connection is always dropped after sending a 550 response.
46897 </para>
46898 </listitem>
46899 <listitem>
46900 <para>
46901 <indexterm role="concept">
46902 <primary><option>require</option></primary>
46903 <secondary>ACL verb</secondary>
46904 </indexterm>
46905 <option>require</option>: If all the conditions are met, control is passed to the next ACL
46906 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
46907 example, when checking a RCPT command,
46908 </para>
46909 <literallayout class="monospaced">
46910 require verify = sender
46911 </literallayout>
46912 <para>
46913 passes control to subsequent statements only if the message&#x2019;s sender can be
46914 verified. Otherwise, it rejects the command.
46915 </para>
46916 </listitem>
46917 <listitem>
46918 <para>
46919 <indexterm role="concept">
46920 <primary><option>warn</option></primary>
46921 <secondary>ACL verb</secondary>
46922 </indexterm>
46923 <option>warn</option>: If all the conditions are true, a line specified by the
46924 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
46925 to the next ACL statement. If any condition is false, the log line is not
46926 written. If an identical log line is requested several times in the same
46927 message, only one copy is actually written to the log. If you want to force
46928 duplicates to be written, use the <option>logwrite</option> modifier instead.
46929 </para>
46930 <para>
46931 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
46932 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
46933 <option>logwrite</option>, and <option>add_header</option>) that appear before the first failing
46934 condition. There is more about adding header lines in section
46935 <xref linkend="SECTaddheadacl"/>.
46936 </para>
46937 <para>
46938 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
46939 some sort of defer), the log line specified by <option>log_message</option> is not written.
46940 <phrase revisionflag="changed">This does not include the case of a forced failure from a lookup, which
46941 is considered to be a successful completion. After a defer,</phrase> no further
46942 conditions or modifiers in the <option>warn</option> statement are processed. The incident
46943 is logged, and the ACL continues to be processed, from the next statement
46944 onwards.
46945 </para>
46946 <para>
46947 <indexterm role="concept">
46948 <primary><varname>$acl_verify_message</varname></primary>
46949 </indexterm>
46950 When one of the <option>warn</option> conditions is an address verification that fails, the
46951 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
46952 want this logged, you must set it up explicitly. For example:
46953 </para>
46954 <literallayout class="monospaced">
46955 warn   !verify = sender
46956        log_message = sender verify failed: $acl_verify_message
46957 </literallayout>
46958 </listitem>
46959 </itemizedlist>
46960 <para>
46961 At the end of each ACL there is an implicit unconditional <option>deny</option>.
46962 </para>
46963 <para>
46964 As you can see from the examples above, the conditions and modifiers are
46965 written one to a line, with the first one on the same line as the verb, and
46966 subsequent ones on following lines. If you have a very long condition, you can
46967 continue it onto several physical lines by the usual backslash continuation
46968 mechanism. It is conventional to align the conditions vertically.
46969 </para>
46970 </section>
46971 <section id="SECTaclvariables">
46972 <title>ACL variables</title>
46973 <para revisionflag="changed">
46974 <indexterm role="concept">
46975 <primary>access control lists (ACLs)</primary>
46976 <secondary>variables</secondary>
46977 </indexterm>
46978 There are some special variables that can be set during ACL processing. They
46979 can be used to pass information between different ACLs, different invocations
46980 of the same ACL in the same SMTP connection, and between ACLs and the routers,
46981 transports, and filters that are used to deliver a message. The names of these
46982 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
46983 an underscore, but the remainder of the name can be any sequence of
46984 alphanumeric characters and underscores that you choose. There is no limit on
46985 the number of ACL variables. The two sets act as follows:
46986 </para>
46987 <itemizedlist revisionflag="changed">
46988 <listitem>
46989 <para revisionflag="changed">
46990 The values of those variables whose names begin with <varname>$acl_c</varname> persist
46991 throughout an SMTP connection. They are never reset. Thus, a value that is set
46992 while receiving one message is still available when receiving the next message
46993 on the same SMTP connection.
46994 </para>
46995 </listitem>
46996 <listitem>
46997 <para revisionflag="changed">
46998 The values of those variables whose names beging with <varname>$acl_m</varname> persist only
46999 while a message is being received. They are reset afterwards. They are also
47000 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
47001 </para>
47002 </listitem>
47003 </itemizedlist>
47004 <para revisionflag="changed">
47005 When a message is accepted, the current values of all the ACL variables are
47006 preserved with the message and are subsequently made available at delivery
47007 time. The ACL variables are set by a modifier called <option>set</option>. For example:
47008 </para>
47009 <literallayout class="monospaced" revisionflag="changed">
47010 accept hosts = whatever
47011        set acl_m4 = some value
47012 accept authenticated = *
47013        set acl_c_auth = yes
47014 </literallayout>
47015 <para revisionflag="changed">
47016 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
47017 be set. If you want to set a variable without taking any action, you can use a
47018 <option>warn</option> verb without any other modifiers or conditions.
47019 </para>
47020 <para revisionflag="changed">
47021 <indexterm role="option">
47022 <primary><option>strict_acl_vars</option></primary>
47023 </indexterm>
47024 What happens if a syntactically valid but undefined ACL variable is
47025 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
47026 false (the default), an empty string is substituted; if it is true, an
47027 error is generated.
47028 </para>
47029 <para revisionflag="changed">
47030 Versions of Exim before 4.64 have a limited set of numbered variables, but
47031 their names are compatible, so there is no problem with upgrading.
47032 </para>
47033 </section>
47034 <section>
47035 <title>Condition and modifier processing</title>
47036 <para>
47037 <indexterm role="concept">
47038 <primary>access control lists (ACLs)</primary>
47039 <secondary>conditions; processing</secondary>
47040 </indexterm>
47041 <indexterm role="concept">
47042 <primary>access control lists (ACLs)</primary>
47043 <secondary>modifiers; processing</secondary>
47044 </indexterm>
47045 An exclamation mark preceding a condition negates its result. For example:
47046 </para>
47047 <literallayout class="monospaced">
47048 deny   domains = *.dom.example
47049       !verify  = recipient
47050 </literallayout>
47051 <para>
47052 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
47053 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
47054 negation can be used on the right-hand side of a condition. For example, these
47055 two statements are equivalent:
47056 </para>
47057 <literallayout class="monospaced">
47058 deny  hosts = !192.168.3.4
47059 deny !hosts =  192.168.3.4
47060 </literallayout>
47061 <para>
47062 However, for many conditions (<option>verify</option> being a good example), only left-hand
47063 side negation of the whole condition is possible.
47064 </para>
47065 <para>
47066 The arguments of conditions and modifiers are expanded. A forced failure
47067 of an expansion causes a condition to be ignored, that is, it behaves as if the
47068 condition is true. Consider these two statements:
47069 </para>
47070 <literallayout class="monospaced">
47071 accept  senders = ${lookup{$host_name}lsearch\
47072                   {/some/file}{$value}fail}
47073 accept  senders = ${lookup{$host_name}lsearch\
47074                   {/some/file}{$value}{}}
47075 </literallayout>
47076 <para>
47077 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
47078 the returned list is searched, but if the lookup fails the behaviour is
47079 different in the two cases. The <option>fail</option> in the first statement causes the
47080 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
47081 therefore succeeds. The second statement, however, generates an empty list when
47082 the lookup fails. No sender can match an empty list, so the condition fails,
47083 and therefore the <option>accept</option> also fails.
47084 </para>
47085 <para>
47086 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
47087 specify actions that are taken as the conditions for a statement are checked;
47088 others specify text for messages that are used when access is denied or a
47089 warning is generated. The <option>control</option> modifier affects the way an incoming
47090 message is handled.
47091 </para>
47092 <para>
47093 The positioning of the modifiers in an ACL statement important, because the
47094 processing of a verb ceases as soon as its outcome is known. Only those
47095 modifiers that have already been encountered will take effect. For example,
47096 consider this use of the <option>message</option> modifier:
47097 </para>
47098 <literallayout class="monospaced">
47099 require message = Can't verify sender
47100         verify  = sender
47101         message = Can't verify recipient
47102         verify  = recipient
47103         message = This message cannot be used
47104 </literallayout>
47105 <para>
47106 If sender verification fails, Exim knows that the result of the statement is
47107 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
47108 so its text is used as the error message. If sender verification succeeds, but
47109 recipient verification fails, the second message is used. If recipient
47110 verification succeeds, the third message becomes <quote>current</quote>, but is never used
47111 because there are no more conditions to cause failure.
47112 </para>
47113 <para>
47114 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
47115 modifier that is used, because all the conditions must be true for rejection to
47116 happen. Specifying more than one <option>message</option> modifier does not make sense, and
47117 the message can even be specified after all the conditions. For example:
47118 </para>
47119 <literallayout class="monospaced">
47120 deny   hosts = ...
47121       !senders = *@my.domain.example
47122        message = Invalid sender from client host
47123 </literallayout>
47124 <para>
47125 The <quote>deny</quote> result does not happen until the end of the statement is reached,
47126 by which time Exim has set up the message.
47127 </para>
47128 </section>
47129 <section id="SECTACLmodi">
47130 <title>ACL modifiers</title>
47131 <para>
47132 <indexterm role="concept">
47133 <primary>access control lists (ACLs)</primary>
47134 <secondary>modifiers; list of</secondary>
47135 </indexterm>
47136 The ACL modifiers are as follows:
47137 </para>
47138 <variablelist>
47139 <varlistentry>
47140 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47141 <listitem>
47142 <para>
47143 This modifier specifies one or more header lines that are to be added to an
47144 incoming message, assuming, of course, that the message is ultimately
47145 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
47146 </para>
47147 </listitem></varlistentry>
47148 <varlistentry>
47149 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47150 <listitem>
47151 <para>
47152 <indexterm role="concept">
47153 <primary><option>control</option></primary>
47154 <secondary>ACL modifier</secondary>
47155 </indexterm>
47156 This modifier affects the subsequent processing of the SMTP connection or of an
47157 incoming message that is accepted. The effect of the first type of control
47158 lasts for the duration of the connection, whereas the effect of the second type
47159 lasts only until the current message has been received. The message-specific
47160 controls always apply to the whole message, not to individual recipients,
47161 even if the <option>control</option> modifier appears in a RCPT ACL.
47162 </para>
47163 <para>
47164 As there are now quite a few controls that can be applied, they are described
47165 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
47166 in several different ways. For example:
47167 </para>
47168 <itemizedlist>
47169 <listitem>
47170 <para>
47171 It can be at the end of an <option>accept</option> statement:
47172 </para>
47173 <literallayout class="monospaced">
47174     accept  ...some conditions
47175             control = queue_only
47176 </literallayout>
47177 <para>
47178 In this case, the control is applied when this statement yields <quote>accept</quote>, in
47179 other words, when the conditions are all true.
47180 </para>
47181 </listitem>
47182 <listitem>
47183 <para>
47184 It can be in the middle of an <option>accept</option> statement:
47185 </para>
47186 <literallayout class="monospaced">
47187     accept  ...some conditions...
47188             control = queue_only
47189             ...some more conditions...
47190 </literallayout>
47191 <para>
47192 If the first set of conditions are true, the control is applied, even if the
47193 statement does not accept because one of the second set of conditions is false.
47194 In this case, some subsequent statement must yield <quote>accept</quote> for the control
47195 to be relevant.
47196 </para>
47197 </listitem>
47198 <listitem>
47199 <para>
47200 It can be used with <option>warn</option> to apply the control, leaving the
47201 decision about accepting or denying to a subsequent verb. For
47202 example:
47203 </para>
47204 <literallayout class="monospaced">
47205     warn    ...some conditions...
47206             control = freeze
47207     accept  ...
47208 </literallayout>
47209 <para>
47210 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
47211 <option>logwrite</option>, so it does not add anything to the message and does not write a
47212 log entry.
47213 </para>
47214 </listitem>
47215 <listitem>
47216 <para>
47217 If you want to apply a control unconditionally, you can use it with a
47218 <option>require</option> verb. For example:
47219 </para>
47220 <literallayout class="monospaced">
47221     require  control = no_multiline_response
47222 </literallayout>
47223 </listitem>
47224 </itemizedlist>
47225 </listitem></varlistentry>
47226 <varlistentry>
47227 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
47228 <listitem>
47229 <para>
47230 <indexterm role="concept">
47231 <primary><option>delay</option></primary>
47232 <secondary>ACL modifier</secondary>
47233 </indexterm>
47234 <indexterm role="concept">
47235 <primary><option>-bh</option> option</primary>
47236 </indexterm>
47237 This modifier causes Exim to wait for the time interval before proceeding. The
47238 time is given in the usual Exim notation. This modifier may appear in any ACL.
47239 The delay happens as soon as the modifier is processed. However, when testing
47240 Exim using the <option>-bh</option> option, the delay is not actually imposed (an
47241 appropriate message is output instead).
47242 </para>
47243 <para>
47244 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
47245 example:
47246 </para>
47247 <literallayout class="monospaced">
47248 deny    ...some conditions...
47249         delay = 30s
47250 </literallayout>
47251 <para>
47252 The delay happens if all the conditions are true, before the statement returns
47253 <quote>deny</quote>. Compare this with:
47254 </para>
47255 <literallayout class="monospaced">
47256 deny    delay = 30s
47257         ...some conditions...
47258 </literallayout>
47259 <para>
47260 which waits for 30s before processing the conditions. The <option>delay</option> modifier
47261 can also be used with <option>warn</option> and together with <option>control</option>:
47262 </para>
47263 <literallayout class="monospaced">
47264 warn    ...some conditions...
47265         delay = 2m
47266         control = freeze
47267 accept  ...
47268 </literallayout>
47269 </listitem></varlistentry>
47270 <varlistentry revisionflag="changed">
47271 <term><emphasis role="bold">endpass</emphasis></term>
47272 <listitem>
47273 <para revisionflag="changed">
47274 <indexterm role="concept">
47275 <primary><option>endpass</option></primary>
47276 <secondary>ACL modifier</secondary>
47277 </indexterm>
47278 This modifier, which has no argument, is recognized only in <option>accept</option> and
47279 <option>discard</option> statements. It marks the boundary between the conditions whose
47280 failure causes control to pass to the next statement, and the conditions whose
47281 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
47282 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
47283 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
47284 </para>
47285 </listitem></varlistentry>
47286 <varlistentry>
47287 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47288 <listitem>
47289 <para>
47290 <indexterm role="concept">
47291 <primary><option>log_message</option></primary>
47292 <secondary>ACL modifier</secondary>
47293 </indexterm>
47294 This modifier sets up a message that is used as part of the log message if the
47295 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
47296 </para>
47297 <literallayout class="monospaced">
47298 require log_message = wrong cipher suite $tls_cipher
47299         encrypted   = DES-CBC3-SHA
47300 </literallayout>
47301 <para revisionflag="changed">
47302 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
47303 example:
47304 </para>
47305 <literallayout revisionflag="changed">
47306 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
47307 <literal>        log_message = Discarded $local_part@$domain because...</literal>
47308 </literallayout>
47309 <para revisionflag="changed">
47310 When access is denied, <option>log_message</option> adds to any underlying error message
47311 that may exist because of a condition failure. For example, while verifying a
47312 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
47313 message.
47314 </para>
47315 <para revisionflag="changed">
47316 The message may be defined before the conditions to which it applies, because
47317 the string expansion does not happen until Exim decides that access is to be
47318 denied. This means that any variables that are set by the condition are
47319 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
47320 variables are set after a DNS black list lookup succeeds. If the expansion of
47321 <option>log_message</option> fails, or if the result is an empty string, the modifier is
47322 ignored.
47323 </para>
47324 <para>
47325 <indexterm role="concept">
47326 <primary><varname>$acl_verify_message</varname></primary>
47327 </indexterm>
47328 If you want to use a <option>warn</option> statement to log the result of an address
47329 verification, you can use <varname>$acl_verify_message</varname> to include the verification
47330 error message.
47331 </para>
47332 <para>
47333 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
47334 the start of the logged message. If the same warning log message is requested
47335 more than once while receiving  a single email message, only one copy is
47336 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
47337 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
47338 is logged for a succesful <option>warn</option> statement.
47339 </para>
47340 <para>
47341 If <option>log_message</option> is not present and there is no underlying error message (for
47342 example, from the failure of address verification), but <option>message</option> is present,
47343 the <option>message</option> text is used for logging rejections. However, if any text for
47344 logging contains newlines, only the first line is logged. In the absence of
47345 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
47346 logging rejections.
47347 </para>
47348 </listitem></varlistentry>
47349 <varlistentry revisionflag="changed">
47350 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
47351 <listitem>
47352 <para revisionflag="changed">
47353 <indexterm role="concept">
47354 <primary><option>log_reject_target</option></primary>
47355 <secondary>ACL modifier</secondary>
47356 </indexterm>
47357 <indexterm role="concept">
47358 <primary>logging in ACL</primary>
47359 <secondary>specifying which log</secondary>
47360 </indexterm>
47361 This modifier makes it possible to specify which logs are used for messages
47362 about ACL rejections. Its argument is a colon-separated list of words that can
47363 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
47364 may be empty, in which case a rejection is not logged at all. For example, this
47365 ACL fragment writes no logging information when access is denied:
47366 </para>
47367 <literallayout revisionflag="changed">
47368 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
47369 <literal>     log_reject_target =</literal>
47370 </literallayout>
47371 <para revisionflag="changed">
47372 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
47373 permanent and temporary rejections.
47374 </para>
47375 </listitem></varlistentry>
47376 <varlistentry>
47377 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47378 <listitem>
47379 <para>
47380 <indexterm role="concept">
47381 <primary><option>logwrite</option></primary>
47382 <secondary>ACL modifier</secondary>
47383 </indexterm>
47384 <indexterm role="concept">
47385 <primary>logging in ACL</primary>
47386 <secondary>immediate</secondary>
47387 </indexterm>
47388 This modifier writes a message to a log file as soon as it is encountered when
47389 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
47390 <option>warn</option> <phrase revisionflag="changed">and <option>discard</option></phrase>, is used only if the ACL statement denies
47391 access.) The <option>logwrite</option> modifier can be used to log special incidents in
47392 ACLs. For example:
47393 </para>
47394 <literallayout>
47395 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
47396 <literal>       control  = freeze</literal>
47397 <literal>       logwrite = froze message because ...</literal>
47398 </literallayout>
47399 <para>
47400 By default, the message is written to the main log. However, it may begin
47401 with a colon, followed by a comma-separated list of log names, and then
47402 another colon, to specify exactly which logs are to be written. For
47403 example:
47404 </para>
47405 <literallayout class="monospaced">
47406 logwrite = :main,reject: text for main and reject logs
47407 logwrite = :panic: text for panic log only
47408 </literallayout>
47409 </listitem></varlistentry>
47410 <varlistentry>
47411 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
47412 <listitem>
47413 <para revisionflag="changed">
47414 <indexterm role="concept">
47415 <primary><option>message</option></primary>
47416 <secondary>ACL modifier</secondary>
47417 </indexterm>
47418 This modifier sets up a text string that is expanded and used as a response
47419 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
47420 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
47421 there is some complication if <option>endpass</option> is involved; see the description of
47422 <option>accept</option> for details.)
47423 </para>
47424 <para revisionflag="changed">
47425 The expansion of the message happens at the time Exim decides that the ACL is
47426 to end, not at the time it processes <option>message</option>. If the expansion fails, or
47427 generates an empty string, the modifier is ignored. Here is an example where
47428 <option>message</option> must be specified first, because the ACL ends with a rejection if
47429 the <option>hosts</option> condition fails:
47430 </para>
47431 <literallayout class="monospaced" revisionflag="changed">
47432 require  message = Host not recognized
47433          hosts = 10.0.0.0/8
47434 </literallayout>
47435 <para revisionflag="changed">
47436 (Once a condition has failed, no further conditions or modifiers are
47437 processed.)
47438 </para>
47439 <para revisionflag="changed">
47440 <indexterm role="concept">
47441 <primary>SMTP</primary>
47442 <secondary>error codes</secondary>
47443 </indexterm>
47444 <indexterm role="concept">
47445 <primary><option>smtp_banner</option></primary>
47446 </indexterm>
47447 For ACLs that are triggered by SMTP commands, the message is returned as part
47448 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
47449 is meaningful only for SMTP, as no message is returned when a non-SMTP message
47450 is accepted. In the case of the connect ACL, accepting with a message modifier
47451 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
47452 accept message may not contain more than one line (otherwise it will be
47453 truncated at the first newline and a panic logged), and it cannot affect the
47454 EHLO options.
47455 </para>
47456 <para revisionflag="changed">
47457 When SMTP is involved, the message may begin with an overriding response code,
47458 consisting of three digits optionally followed by an <quote>extended response code</quote>
47459 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
47460 </para>
47461 <literallayout class="monospaced" revisionflag="changed">
47462 deny  message = 599 1.2.3 Host not welcome
47463       hosts = 192.168.34.0/24
47464 </literallayout>
47465 <para revisionflag="changed">
47466 The first digit of the supplied response code must be the same as would be sent
47467 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
47468 access, but for the predata ACL, note that the default success code is 354, not
47469 2<emphasis>xx</emphasis>.
47470 </para>
47471 <para revisionflag="changed">
47472 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
47473 the message modifier cannot override the 221 response code.
47474 </para>
47475 <para revisionflag="changed">
47476 The text in a <option>message</option> modifier is literal; any quotes are taken as
47477 literals, but because the string is expanded, backslash escapes are processed
47478 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
47479 response.
47480 </para>
47481 <para>
47482 <indexterm role="concept">
47483 <primary><varname>$acl_verify_message</varname></primary>
47484 </indexterm>
47485 If <option>message</option> is used on a statement that verifies an address, the message
47486 specified overrides any message that is generated by the verification process.
47487 However, the original message is available in the variable
47488 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
47489 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
47490 routers to be passed back as part of the SMTP response, you should either not
47491 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
47492 </para>
47493 <para>
47494 For compatibility with previous releases of Exim, a <option>message</option> modifier that
47495 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
47496 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
47497 all the conditions are true, wherever it appears in an ACL command, whereas
47498 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
47499 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
47500 effect.
47501 </para>
47502 </listitem></varlistentry>
47503 <varlistentry>
47504 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
47505 <listitem>
47506 <para>
47507 <indexterm role="concept">
47508 <primary><option>set</option></primary>
47509 <secondary>ACL modifier</secondary>
47510 </indexterm>
47511 This modifier puts a value into one of the ACL variables (see section
47512 <xref linkend="SECTaclvariables"/>).
47513 </para>
47514 </listitem></varlistentry>
47515 </variablelist>
47516 </section>
47517 <section id="SECTcontrols">
47518 <title>Use of the control modifier</title>
47519 <para>
47520 <indexterm role="concept">
47521 <primary><option>control</option></primary>
47522 <secondary>ACL modifier</secondary>
47523 </indexterm>
47524 The <option>control</option> modifier supports the following settings:
47525 </para>
47526 <variablelist>
47527 <varlistentry>
47528 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
47529 <listitem>
47530 <para>
47531 This modifier allows a client host to use the SMTP AUTH command even when it
47532 has not been advertised in response to EHLO. Furthermore, because there are
47533 apparently some really broken clients that do this, Exim will accept AUTH after
47534 HELO (rather than EHLO) when this control is set. It should be used only if you
47535 really need it, and you should limit its use to those broken clients that do
47536 not work without it. For example:
47537 </para>
47538 <literallayout class="monospaced">
47539 warn hosts   = 192.168.34.25
47540      control = allow_auth_unadvertised
47541 </literallayout>
47542 <para>
47543 Normally, when an Exim server receives an AUTH command, it checks the name of
47544 the authentication mechanism that is given in the command to ensure that it
47545 matches an advertised mechanism. When this control is set, the check that a
47546 mechanism has been advertised is bypassed. Any configured mechanism can be used
47547 by the client. This control is permitted only in the connection and HELO ACLs.
47548 </para>
47549 </listitem></varlistentry>
47550 <varlistentry>
47551 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
47552 <listitem>
47553 <para>
47554 See below.
47555 </para>
47556 </listitem></varlistentry>
47557 <varlistentry>
47558 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
47559 <listitem>
47560 <para>
47561 <indexterm role="concept">
47562 <primary>access control lists (ACLs)</primary>
47563 <secondary>case of local part in</secondary>
47564 </indexterm>
47565 <indexterm role="concept">
47566 <primary>case of local parts</primary>
47567 </indexterm>
47568 <indexterm role="concept">
47569 <primary><varname>$local_part</varname></primary>
47570 </indexterm>
47571 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
47572 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
47573 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
47574 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
47575 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
47576 is encountered.
47577 </para>
47578 <para>
47579 These controls affect only the current recipient. Moreover, they apply only to
47580 local part handling that takes place directly in the ACL (for example, as a key
47581 in lookups). If a test to verify the recipient is obeyed, the case-related
47582 handling of the local part during the verification is controlled by the router
47583 configuration (see the <option>caseful_local_part</option> generic router option).
47584 </para>
47585 <para>
47586 This facility could be used, for example, to add a spam score to local parts
47587 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
47588 spam score:
47589 </para>
47590 <literallayout class="monospaced">
47591 warn  control = caseful_local_part
47592       set acl_m4 = ${eval:\
47593                      $acl_m4 + \
47594                      ${if match{$local_part}{[A-Z]}{1}{0}}\
47595                     }
47596       control = caselower_local_part
47597 </literallayout>
47598 <para>
47599 Notice that we put back the lower cased version afterwards, assuming that
47600 is what is wanted for subsequent tests.
47601 </para>
47602 </listitem></varlistentry>
47603 <varlistentry>
47604 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
47605 <listitem>
47606 <para>
47607 See below.
47608 </para>
47609 </listitem></varlistentry>
47610 <varlistentry>
47611 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
47612 <listitem>
47613 <para>
47614 <indexterm role="concept">
47615 <primary>SMTP</primary>
47616 <secondary>synchronization checking</secondary>
47617 </indexterm>
47618 <indexterm role="concept">
47619 <primary>synchronization checking in SMTP</primary>
47620 </indexterm>
47621 These controls make it possible to be selective about when SMTP synchronization
47622 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
47623 state of the switch (it is true by default). See the description of this option
47624 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
47625 </para>
47626 <para>
47627 The effect of these two controls lasts for the remainder of the SMTP
47628 connection. They can appear in any ACL except the one for the non-SMTP
47629 messages. The most straightforward place to put them is in the ACL defined by
47630 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
47631 before the first synchronization check. The expected use is to turn off the
47632 synchronization checks for badly-behaved hosts that you nevertheless need to
47633 work with.
47634 </para>
47635 </listitem></varlistentry>
47636 <varlistentry>
47637 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
47638 <listitem>
47639 <para>
47640 <indexterm role="concept">
47641 <primary>fake defer</primary>
47642 </indexterm>
47643 <indexterm role="concept">
47644 <primary>defer</primary>
47645 <secondary>fake</secondary>
47646 </indexterm>
47647 This control works in exactly the same way as <option>fakereject</option> (described below)
47648 except that it causes an SMTP 450 response after the message data instead of a
47649 550 response. You must take care when using <option>fakedefer</option> because it causes the
47650 messages to be duplicated when the sender retries. Therefore, you should not
47651 use <option>fakedefer</option> if the message is to be delivered normally.
47652 </para>
47653 </listitem></varlistentry>
47654 <varlistentry>
47655 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
47656 <listitem>
47657 <para>
47658 <indexterm role="concept">
47659 <primary>fake rejection</primary>
47660 </indexterm>
47661 <indexterm role="concept">
47662 <primary>rejection</primary>
47663 <secondary>fake</secondary>
47664 </indexterm>
47665 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
47666 words, only when an SMTP message is being received. If Exim accepts the
47667 message, instead the final 250 response, a 550 rejection message is sent.
47668 However, Exim proceeds to deliver the message as normal. The control applies
47669 only to the current message, not to any subsequent ones that may be received in
47670 the same SMTP connection.
47671 </para>
47672 <para>
47673 The text for the 550 response is taken from the <option>control</option> modifier. If no
47674 message is supplied, the following is used:
47675 </para>
47676 <literallayout class="monospaced">
47677 550-Your message has been rejected but is being
47678 550-kept for evaluation.
47679 550-If it was a legitimate message, it may still be
47680 550 delivered to the target recipient(s).
47681 </literallayout>
47682 <para>
47683 This facilty should be used with extreme caution.
47684 </para>
47685 </listitem></varlistentry>
47686 <varlistentry>
47687 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
47688 <listitem>
47689 <para>
47690 <indexterm role="concept">
47691 <primary>frozen messages</primary>
47692 <secondary>forcing in ACL</secondary>
47693 </indexterm>
47694 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47695 other words, only when a message is being received. If the message is accepted,
47696 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
47697 current message, not to any subsequent ones that may be received in the same
47698 SMTP connection.
47699 </para>
47700 <para>
47701 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
47702 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
47703 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
47704 are obeyed for the current message have the <literal>/no_tell</literal> option.
47705 </para>
47706 </listitem></varlistentry>
47707 <varlistentry>
47708 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
47709 <listitem>
47710 <para>
47711 This control is available when Exim is compiled with the content scanning
47712 extension. Content scanning may require a copy of the current message, or parts
47713 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
47714 or spam scanner. Normally, such copies are deleted when they are no longer
47715 needed. If this control is set, the copies are not deleted. The control applies
47716 only to the current message, not to any subsequent ones that may be received in
47717 the same SMTP connection. It is provided for debugging purposes and is unlikely
47718 to be useful in production.
47719 </para>
47720 </listitem></varlistentry>
47721 <varlistentry>
47722 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_response</emphasis></term>
47723 <listitem>
47724 <para>
47725 <indexterm role="concept">
47726 <primary>multiline responses</primary>
47727 <secondary>suppressing</secondary>
47728 </indexterm>
47729 This control is permitted for any ACL except the one for non-SMTP messages.
47730 It seems that there are broken clients in use that cannot handle multiline
47731 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
47732 </para>
47733 <para>
47734 If this control is set, multiline SMTP responses from ACL rejections are
47735 suppressed. One way of doing this would have been to put out these responses as
47736 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
47737 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
47738 responses might get close to that. So this facility, which is after all only a
47739 sop to broken clients, is implemented by doing two very easy things:
47740 </para>
47741 <itemizedlist>
47742 <listitem>
47743 <para>
47744 Extra information that is normally output as part of a rejection caused by
47745 sender verification failure is omitted. Only the final line (typically <quote>sender
47746 verification failed</quote>) is sent.
47747 </para>
47748 </listitem>
47749 <listitem>
47750 <para>
47751 If a <option>message</option> modifier supplies a multiline response, only the first
47752 line is output.
47753 </para>
47754 </listitem>
47755 </itemizedlist>
47756 <para>
47757 The setting of the switch can, of course, be made conditional on the
47758 calling host. Its effect lasts until the end of the SMTP connection.
47759 </para>
47760 </listitem></varlistentry>
47761 <varlistentry>
47762 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
47763 <listitem>
47764 <para>
47765 <indexterm role="concept">
47766 <primary><option>queue_only</option></primary>
47767 </indexterm>
47768 <indexterm role="concept">
47769 <primary>queueing incoming messages</primary>
47770 </indexterm>
47771 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47772 other words, only when a message is being received. If the message is accepted,
47773 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
47774 runner. No immediate delivery process is started. In other words, it has the
47775 effect as the <option>queue_only</option> global option. However, the control applies only
47776 to the current message, not to any subsequent ones that may be received in the
47777 same SMTP connection.
47778 </para>
47779 </listitem></varlistentry>
47780 <varlistentry>
47781 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
47782 <listitem>
47783 <para>
47784 <indexterm role="concept">
47785 <primary>message</primary>
47786 <secondary>submission</secondary>
47787 </indexterm>
47788 <indexterm role="concept">
47789 <primary>submission mode</primary>
47790 </indexterm>
47791 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
47792 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
47793 the current message is a submission from a local MUA. In this case, Exim
47794 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
47795 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
47796 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
47797 late (the message has already been created).
47798 </para>
47799 <para>
47800 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
47801 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
47802 submission mode; the available options for this control are described there.
47803 The control applies only to the current message, not to any subsequent ones
47804 that may be received in the same SMTP connection.
47805 </para>
47806 </listitem></varlistentry>
47807 <varlistentry>
47808 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
47809 <listitem>
47810 <para>
47811 <indexterm role="concept">
47812 <primary>submission fixups</primary>
47813 <secondary>suppressing</secondary>
47814 </indexterm>
47815 This control applies to locally submitted (non TCP/IP) messages, and is the
47816 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
47817 normally applied to locally-submitted messages. Specifically:
47818 </para>
47819 <itemizedlist>
47820 <listitem>
47821 <para>
47822 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
47823 dynamic version of <option>local_sender_retain</option>).
47824 </para>
47825 </listitem>
47826 <listitem>
47827 <para>
47828 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
47829 </para>
47830 </listitem>
47831 <listitem>
47832 <para>
47833 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
47834 </para>
47835 </listitem>
47836 </itemizedlist>
47837 <para>
47838 This control may be useful when a remotely-originated message is accepted,
47839 passed to some scanning program, and then re-submitted for delivery. It can be
47840 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
47841 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
47842 data is read.
47843 </para>
47844 </listitem></varlistentry>
47845 </variablelist>
47846 <para>
47847 All four possibilities for message fixups can be specified:
47848 </para>
47849 <itemizedlist>
47850 <listitem>
47851 <para>
47852 Locally submitted, fixups applied: the default.
47853 </para>
47854 </listitem>
47855 <listitem>
47856 <para>
47857 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
47858 <literal>suppress_local_fixups</literal>.
47859 </para>
47860 </listitem>
47861 <listitem>
47862 <para>
47863 Remotely submitted, no fixups applied: the default.
47864 </para>
47865 </listitem>
47866 <listitem>
47867 <para>
47868 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
47869 </para>
47870 </listitem>
47871 </itemizedlist>
47872 </section>
47873 <section id="SECTaddheadacl">
47874 <title>Adding header lines in ACLs</title>
47875 <para>
47876 <indexterm role="concept">
47877 <primary>header lines</primary>
47878 <secondary>adding in an ACL</secondary>
47879 </indexterm>
47880 <indexterm role="concept">
47881 <primary>header lines</primary>
47882 <secondary>position of added lines</secondary>
47883 </indexterm>
47884 <indexterm role="concept">
47885 <primary><option>message</option></primary>
47886 <secondary>ACL modifier</secondary>
47887 </indexterm>
47888 The <option>add_header</option> modifier can be used to add one or more extra header lines
47889 to an incoming message, as in this example:
47890 </para>
47891 <literallayout class="monospaced">
47892 warn dnslists = sbl.spamhaus.org : \
47893                 dialup.mail-abuse.org
47894      add_header = X-blacklisted-at: $dnslist_domain
47895 </literallayout>
47896 <para>
47897 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
47898 MIME, and non-SMTP ACLs (in other words, those that are concerned with
47899 receiving a message). The message must ultimately be accepted for
47900 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
47901 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
47902 RCPT ACL).
47903 </para>
47904 <para>
47905 If the data for the <option>add_header</option> modifier contains one or more newlines that
47906 are not followed by a space or a tab, it is assumed to contain multiple header
47907 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
47908 front of any line that is not a valid header line.
47909 </para>
47910 <para>
47911 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
47912 They are added to the message before processing the DATA and MIME ACLs.
47913 However, if an identical header line is requested more than once, only one copy
47914 is actually added to the message. Further header lines may be accumulated
47915 during the DATA and MIME ACLs, after which they are added to the message, again
47916 with duplicates suppressed. Thus, it is possible to add two identical header
47917 lines to an SMTP message, but only if one is added before DATA and one after.
47918 In the case of non-SMTP messages, new headers are accumulated during the
47919 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
47920 message is rejected after DATA or by the non-SMTP ACL, all added header lines
47921 are included in the entry that is written to the reject log.
47922 </para>
47923 <para>
47924 <indexterm role="concept">
47925 <primary>header lines</primary>
47926 <secondary>added; visibility of</secondary>
47927 </indexterm>
47928 Header lines are not visible in string expansions until they are added to the
47929 message. It follows that header lines defined in the MAIL, RCPT, and predata
47930 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
47931 header lines that are added by the DATA or MIME ACLs are not visible in those
47932 ACLs. Because of this restriction, you cannot use header lines as a way of
47933 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
47934 this, you can use ACL variables, as described in section
47935 <xref linkend="SECTaclvariables"/>.
47936 </para>
47937 <para>
47938 The <option>add_header</option> modifier acts immediately it is encountered during the
47939 processing of an ACL. Notice the difference between these two cases:
47940 </para>
47941 <literallayout>
47942 <literal>accept add_header = ADDED: some text</literal>
47943 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
47944
47945 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
47946 <literal>       add_header = ADDED: some text</literal>
47947 </literallayout>
47948 <para>
47949 In the first case, the header line is always added, whether or not the
47950 condition is true. In the second case, the header line is added only if the
47951 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
47952 ACL statement. All those that are encountered before a condition fails are
47953 honoured.
47954 </para>
47955 <para>
47956 <indexterm role="concept">
47957 <primary><option>warn</option></primary>
47958 <secondary>ACL verb</secondary>
47959 </indexterm>
47960 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
47961 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
47962 effect only if all the conditions are true, even if it appears before some of
47963 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
47964 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
47965 are present on a <option>warn</option> verb, both are processed according to their
47966 specifications.
47967 </para>
47968 <para>
47969 By default, new header lines are added to a message at the end of the existing
47970 header lines. However, you can specify that any particular header line should
47971 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
47972 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
47973 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
47974 </para>
47975 <para>
47976 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
47977 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
47978 header line, respectively. (Header text cannot start with a colon, as there has
47979 to be a header name first.) For example:
47980 </para>
47981 <literallayout class="monospaced">
47982 warn add_header = \
47983        :after_received:X-My-Header: something or other...
47984 </literallayout>
47985 <para>
47986 If more than one header line is supplied in a single <option>add_header</option> modifier,
47987 each one is treated independently and can therefore be placed differently. If
47988 you add more than one line at the start, or after the Received: block, they end
47989 up in reverse order.
47990 </para>
47991 <para>
47992 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
47993 added in an ACL. It does NOT work for header lines that are added in a
47994 system filter or in a router or transport.
47995 </para>
47996 </section>
47997 <section id="SECTaclconditions">
47998 <title>ACL conditions</title>
47999 <para>
48000 <indexterm role="concept">
48001 <primary>access control lists (ACLs)</primary>
48002 <secondary>conditions; list of</secondary>
48003 </indexterm>
48004 Some of conditions listed in this section are available only when Exim is
48005 compiled with the content-scanning extension. They are included here briefly
48006 for completeness. More detailed descriptions can be found in the discussion on
48007 content scanning in chapter <xref linkend="CHAPexiscan"/>.
48008 </para>
48009 <para>
48010 Not all conditions are relevant in all circumstances. For example, testing
48011 senders and recipients does not make sense in an ACL that is being run as the
48012 result of the arrival of an ETRN command, and checks on message headers can be
48013 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
48014 can use the same condition (with different parameters) more than once in the
48015 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
48016 The conditions are as follows:
48017 </para>
48018 <variablelist>
48019 <varlistentry>
48020 <term><emphasis role="bold">acl&nbsp;=&nbsp;</emphasis>&lt;<emphasis>name&nbsp;of&nbsp;acl&nbsp;or&nbsp;ACL&nbsp;string&nbsp;or&nbsp;file&nbsp;name&nbsp;</emphasis>&gt;</term>
48021 <listitem>
48022 <para>
48023 <indexterm role="concept">
48024 <primary>access control lists (ACLs)</primary>
48025 <secondary>nested</secondary>
48026 </indexterm>
48027 <indexterm role="concept">
48028 <primary>access control lists (ACLs)</primary>
48029 <secondary>indirect</secondary>
48030 </indexterm>
48031 <indexterm role="concept">
48032 <primary><option>acl</option></primary>
48033 <secondary>ACL condition</secondary>
48034 </indexterm>
48035 The possible values of the argument are the same as for the
48036 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
48037 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
48038 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
48039 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
48040 condition false. This means that further processing of the <option>warn</option> verb
48041 ceases, but processing of the ACL continues.
48042 </para>
48043 <para>
48044 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
48045 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
48046 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
48047 conditions are tested.
48048 </para>
48049 <para>
48050 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
48051 loops. This condition allows you to use different ACLs in different
48052 circumstances. For example, different ACLs can be used to handle RCPT commands
48053 for different local users or different local domains.
48054 </para>
48055 </listitem></varlistentry>
48056 <varlistentry>
48057 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
48058 <listitem>
48059 <para>
48060 <indexterm role="concept">
48061 <primary><option>authenticated</option></primary>
48062 <secondary>ACL condition</secondary>
48063 </indexterm>
48064 <indexterm role="concept">
48065 <primary>authentication</primary>
48066 <secondary>ACL checking</secondary>
48067 </indexterm>
48068 <indexterm role="concept">
48069 <primary>access control lists (ACLs)</primary>
48070 <secondary>testing for authentication</secondary>
48071 </indexterm>
48072 If the SMTP connection is not authenticated, the condition is false. Otherwise,
48073 the name of the authenticator is tested against the list. To test for
48074 authentication by any authenticator, you can set
48075 </para>
48076 <literallayout class="monospaced">
48077 authenticated = *
48078 </literallayout>
48079 </listitem></varlistentry>
48080 <varlistentry>
48081 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
48082 <listitem>
48083 <para>
48084 <indexterm role="concept">
48085 <primary><option>condition</option></primary>
48086 <secondary>ACL condition</secondary>
48087 </indexterm>
48088 <indexterm role="concept">
48089 <primary>customizing</primary>
48090 <secondary>ACL condition</secondary>
48091 </indexterm>
48092 <indexterm role="concept">
48093 <primary>access control lists (ACLs)</primary>
48094 <secondary>customized test</secondary>
48095 </indexterm>
48096 <indexterm role="concept">
48097 <primary>access control lists (ACLs)</primary>
48098 <secondary>testing; customized</secondary>
48099 </indexterm>
48100 This feature allows you to make up custom conditions. If the result of
48101 expanding the string is an empty string, the number zero, or one of the strings
48102 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
48103 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
48104 any other value, some error is assumed to have occurred, and the ACL returns
48105 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
48106 ignored. The effect is to treat it as true, whether it is positive or
48107 negative.
48108 </para>
48109 </listitem></varlistentry>
48110 <varlistentry>
48111 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
48112 <listitem>
48113 <para>
48114 <indexterm role="concept">
48115 <primary><option>decode</option></primary>
48116 <secondary>ACL condition</secondary>
48117 </indexterm>
48118 This condition is available only when Exim is compiled with the
48119 content-scanning extension, and it is allowed only in the ACL defined by
48120 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
48121 For details, see chapter <xref linkend="CHAPexiscan"/>.
48122 </para>
48123 </listitem></varlistentry>
48124 <varlistentry>
48125 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
48126 <listitem>
48127 <para>
48128 <indexterm role="concept">
48129 <primary><option>demime</option></primary>
48130 <secondary>ACL condition</secondary>
48131 </indexterm>
48132 This condition is available only when Exim is compiled with the
48133 content-scanning extension. Its use is described in section
48134 <xref linkend="SECTdemimecond"/>.
48135 </para>
48136 </listitem></varlistentry>
48137 <varlistentry>
48138 <term><emphasis role="bold">dnslists&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;domain&nbsp;names&nbsp;and&nbsp;other&nbsp;data</emphasis>&gt;</term>
48139 <listitem>
48140 <para>
48141 <indexterm role="concept">
48142 <primary><option>dnslists</option></primary>
48143 <secondary>ACL condition</secondary>
48144 </indexterm>
48145 <indexterm role="concept">
48146 <primary>DNS list</primary>
48147 <secondary>in ACL</secondary>
48148 </indexterm>
48149 <indexterm role="concept">
48150 <primary>black list (DNS)</primary>
48151 </indexterm>
48152 <indexterm role="concept">
48153 <primary>access control lists (ACLs)</primary>
48154 <secondary>testing a DNS list</secondary>
48155 </indexterm>
48156 This condition checks for entries in DNS black lists. These are also known as
48157 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
48158 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
48159 different variants of this condition to describe briefly here. See sections
48160 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
48161 </para>
48162 </listitem></varlistentry>
48163 <varlistentry>
48164 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
48165 <listitem>
48166 <para>
48167 <indexterm role="concept">
48168 <primary><option>domains</option></primary>
48169 <secondary>ACL condition</secondary>
48170 </indexterm>
48171 <indexterm role="concept">
48172 <primary>domain</primary>
48173 <secondary>ACL checking</secondary>
48174 </indexterm>
48175 <indexterm role="concept">
48176 <primary>access control lists (ACLs)</primary>
48177 <secondary>testing a recipient domain</secondary>
48178 </indexterm>
48179 <indexterm role="concept">
48180 <primary><varname>$domain_data</varname></primary>
48181 </indexterm>
48182 This condition is relevant only after a RCPT command. It checks that the domain
48183 of the recipient address is in the domain list. If percent-hack processing is
48184 enabled, it is done before this test is done. If the check succeeds with a
48185 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
48186 <option>domains</option> test.
48187 </para>
48188 <para revisionflag="changed">
48189 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
48190 use <option>domains</option> in a DATA ACL.
48191 </para>
48192 </listitem></varlistentry>
48193 <varlistentry>
48194 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
48195 <listitem>
48196 <para>
48197 <indexterm role="concept">
48198 <primary><option>encrypted</option></primary>
48199 <secondary>ACL condition</secondary>
48200 </indexterm>
48201 <indexterm role="concept">
48202 <primary>encryption</primary>
48203 <secondary>checking in an ACL</secondary>
48204 </indexterm>
48205 <indexterm role="concept">
48206 <primary>access control lists (ACLs)</primary>
48207 <secondary>testing for encryption</secondary>
48208 </indexterm>
48209 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
48210 name of the cipher suite in use is tested against the list. To test for
48211 encryption without testing for any specific cipher suite(s), set
48212 </para>
48213 <literallayout class="monospaced">
48214 encrypted = *
48215 </literallayout>
48216 </listitem></varlistentry>
48217 <varlistentry>
48218 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
48219 <listitem>
48220 <para>
48221 <indexterm role="concept">
48222 <primary><option>hosts</option></primary>
48223 <secondary>ACL condition</secondary>
48224 </indexterm>
48225 <indexterm role="concept">
48226 <primary>host</primary>
48227 <secondary>ACL checking</secondary>
48228 </indexterm>
48229 <indexterm role="concept">
48230 <primary>access control lists (ACLs)</primary>
48231 <secondary>testing the client host</secondary>
48232 </indexterm>
48233 This condition tests that the calling host matches the host list. If you have
48234 name lookups or wildcarded host names and IP addresses in the same host list,
48235 you should normally put the IP addresses first. For example, you could have:
48236 </para>
48237 <literallayout class="monospaced">
48238 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
48239 </literallayout>
48240 <para revisionflag="changed">
48241 The lookup in this example uses the host name for its key. This is implied by
48242 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
48243 and it wouldn&#x2019;t matter which way round you had these two items.)
48244 </para>
48245 <para>
48246 The reason for the problem with host names lies in the left-to-right way that
48247 Exim processes lists. It can test IP addresses without doing any DNS lookups,
48248 but when it reaches an item that requires a host name, it fails if it cannot
48249 find a host name to compare with the pattern. If the above list is given in the
48250 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
48251 found, even if its IP address is 10.9.8.7.
48252 </para>
48253 <para>
48254 If you really do want to do the name check first, and still recognize the IP
48255 address even if the name lookup fails, you can rewrite the ACL like this:
48256 </para>
48257 <literallayout class="monospaced">
48258 accept hosts = dbm;/etc/friendly/hosts
48259 accept hosts = 10.9.8.7
48260 </literallayout>
48261 <para>
48262 The default action on failing to find the host name is to assume that the host
48263 is not in the list, so the first <option>accept</option> statement fails. The second
48264 statement can then check the IP address.
48265 </para>
48266 <para>
48267 <indexterm role="concept">
48268 <primary><varname>$host_data</varname></primary>
48269 </indexterm>
48270 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
48271 of the lookup is made available in the <varname>$host_data</varname> variable. This
48272 allows you, for example, to set up a statement like this:
48273 </para>
48274 <literallayout class="monospaced">
48275 deny  hosts = net-lsearch;/some/file
48276 message = $host_data
48277 </literallayout>
48278 <para>
48279 which gives a custom error message for each denied host.
48280 </para>
48281 </listitem></varlistentry>
48282 <varlistentry>
48283 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
48284 <listitem>
48285 <para>
48286 <indexterm role="concept">
48287 <primary><option>local_parts</option></primary>
48288 <secondary>ACL condition</secondary>
48289 </indexterm>
48290 <indexterm role="concept">
48291 <primary>local part</primary>
48292 <secondary>ACL checking</secondary>
48293 </indexterm>
48294 <indexterm role="concept">
48295 <primary>access control lists (ACLs)</primary>
48296 <secondary>testing a local part</secondary>
48297 </indexterm>
48298 <indexterm role="concept">
48299 <primary><varname>$local_part_data</varname></primary>
48300 </indexterm>
48301 This condition is relevant only after a RCPT command. It checks that the local
48302 part of the recipient address is in the list. If percent-hack processing is
48303 enabled, it is done before this test. If the check succeeds with a lookup, the
48304 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
48305 the next <option>local_parts</option> test.
48306 </para>
48307 </listitem></varlistentry>
48308 <varlistentry>
48309 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
48310 <listitem>
48311 <para>
48312 <indexterm role="concept">
48313 <primary><option>malware</option></primary>
48314 <secondary>ACL condition</secondary>
48315 </indexterm>
48316 <indexterm role="concept">
48317 <primary>access control lists (ACLs)</primary>
48318 <secondary>virus scanning</secondary>
48319 </indexterm>
48320 <indexterm role="concept">
48321 <primary>access control lists (ACLs)</primary>
48322 <secondary>scanning for viruses</secondary>
48323 </indexterm>
48324 This condition is available only when Exim is compiled with the
48325 content-scanning extension. It causes the incoming message to be scanned for
48326 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
48327 </para>
48328 </listitem></varlistentry>
48329 <varlistentry>
48330 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
48331 <listitem>
48332 <para>
48333 <indexterm role="concept">
48334 <primary><option>mime_regex</option></primary>
48335 <secondary>ACL condition</secondary>
48336 </indexterm>
48337 <indexterm role="concept">
48338 <primary>access control lists (ACLs)</primary>
48339 <secondary>testing by regex matching</secondary>
48340 </indexterm>
48341 This condition is available only when Exim is compiled with the
48342 content-scanning extension, and it is allowed only in the ACL defined by
48343 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
48344 with any of the regular expressions. For details, see chapter
48345 <xref linkend="CHAPexiscan"/>.
48346 </para>
48347 </listitem></varlistentry>
48348 <varlistentry>
48349 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
48350 <listitem>
48351 <para>
48352 <indexterm role="concept">
48353 <primary>rate limiting</primary>
48354 </indexterm>
48355 This condition can be used to limit the rate at which a user or host submits
48356 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
48357 </para>
48358 </listitem></varlistentry>
48359 <varlistentry>
48360 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
48361 <listitem>
48362 <para>
48363 <indexterm role="concept">
48364 <primary><option>recipients</option></primary>
48365 <secondary>ACL condition</secondary>
48366 </indexterm>
48367 <indexterm role="concept">
48368 <primary>recipient</primary>
48369 <secondary>ACL checking</secondary>
48370 </indexterm>
48371 <indexterm role="concept">
48372 <primary>access control lists (ACLs)</primary>
48373 <secondary>testing a recipient</secondary>
48374 </indexterm>
48375 This condition is relevant only after a RCPT command. It checks the entire
48376 recipient address against a list of recipients.
48377 </para>
48378 </listitem></varlistentry>
48379 <varlistentry>
48380 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
48381 <listitem>
48382 <para>
48383 <indexterm role="concept">
48384 <primary><option>regex</option></primary>
48385 <secondary>ACL condition</secondary>
48386 </indexterm>
48387 <indexterm role="concept">
48388 <primary>access control lists (ACLs)</primary>
48389 <secondary>testing by regex matching</secondary>
48390 </indexterm>
48391 This condition is available only when Exim is compiled with the
48392 content-scanning extension, and is available only in the DATA, MIME, and
48393 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
48394 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
48395 </para>
48396 </listitem></varlistentry>
48397 <varlistentry>
48398 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
48399 <listitem>
48400 <para>
48401 <indexterm role="concept">
48402 <primary><option>sender_domains</option></primary>
48403 <secondary>ACL condition</secondary>
48404 </indexterm>
48405 <indexterm role="concept">
48406 <primary>sender</primary>
48407 <secondary>ACL checking</secondary>
48408 </indexterm>
48409 <indexterm role="concept">
48410 <primary>access control lists (ACLs)</primary>
48411 <secondary>testing a sender domain</secondary>
48412 </indexterm>
48413 <indexterm role="concept">
48414 <primary><varname>$domain</varname></primary>
48415 </indexterm>
48416 <indexterm role="concept">
48417 <primary><varname>$sender_address_domain</varname></primary>
48418 </indexterm>
48419 This condition tests the domain of the sender of the message against the given
48420 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
48421 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
48422 of this condition. This is an exception to the general rule for testing domain
48423 lists. It is done this way so that, if this condition is used in an ACL for a
48424 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
48425 influence the sender checking.
48426 </para>
48427 <para>
48428 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
48429 relaying, because sender addresses are easily, and commonly, forged.
48430 </para>
48431 </listitem></varlistentry>
48432 <varlistentry>
48433 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
48434 <listitem>
48435 <para>
48436 <indexterm role="concept">
48437 <primary><option>senders</option></primary>
48438 <secondary>ACL condition</secondary>
48439 </indexterm>
48440 <indexterm role="concept">
48441 <primary>sender</primary>
48442 <secondary>ACL checking</secondary>
48443 </indexterm>
48444 <indexterm role="concept">
48445 <primary>access control lists (ACLs)</primary>
48446 <secondary>testing a sender</secondary>
48447 </indexterm>
48448 This condition tests the sender of the message against the given list. To test
48449 for a bounce message, which has an empty sender, set
48450 </para>
48451 <literallayout class="monospaced">
48452 senders = :
48453 </literallayout>
48454 <para>
48455 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
48456 relaying, because sender addresses are easily, and commonly, forged.
48457 </para>
48458 </listitem></varlistentry>
48459 <varlistentry>
48460 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
48461 <listitem>
48462 <para>
48463 <indexterm role="concept">
48464 <primary><option>spam</option></primary>
48465 <secondary>ACL condition</secondary>
48466 </indexterm>
48467 <indexterm role="concept">
48468 <primary>access control lists (ACLs)</primary>
48469 <secondary>scanning for spam</secondary>
48470 </indexterm>
48471 This condition is available only when Exim is compiled with the
48472 content-scanning extension. It causes the incoming message to be scanned by
48473 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
48474 </para>
48475 </listitem></varlistentry>
48476 <varlistentry>
48477 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
48478 <listitem>
48479 <para>
48480 <indexterm role="concept">
48481 <primary><option>verify</option></primary>
48482 <secondary>ACL condition</secondary>
48483 </indexterm>
48484 <indexterm role="concept">
48485 <primary>TLS</primary>
48486 <secondary>client certificate verification</secondary>
48487 </indexterm>
48488 <indexterm role="concept">
48489 <primary>certificate</primary>
48490 <secondary>verification of client</secondary>
48491 </indexterm>
48492 <indexterm role="concept">
48493 <primary>access control lists (ACLs)</primary>
48494 <secondary>certificate verification</secondary>
48495 </indexterm>
48496 <indexterm role="concept">
48497 <primary>access control lists (ACLs)</primary>
48498 <secondary>testing a TLS certificate</secondary>
48499 </indexterm>
48500 This condition is true in an SMTP session if the session is encrypted, and a
48501 certificate was received from the client, and the certificate was verified. The
48502 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
48503 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
48504 </para>
48505 </listitem></varlistentry>
48506 <varlistentry>
48507 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
48508 <listitem>
48509 <para>
48510 <indexterm role="concept">
48511 <primary>CSA verification</primary>
48512 </indexterm>
48513 This condition checks whether the sending host (the client) is authorized to
48514 send email. Details of how this works are given in section
48515 <xref linkend="SECTverifyCSA"/>.
48516 </para>
48517 </listitem></varlistentry>
48518 <varlistentry>
48519 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48520 <listitem>
48521 <para>
48522 <indexterm role="concept">
48523 <primary><option>verify</option></primary>
48524 <secondary>ACL condition</secondary>
48525 </indexterm>
48526 <indexterm role="concept">
48527 <primary>access control lists (ACLs)</primary>
48528 <secondary>verifying sender in the header</secondary>
48529 </indexterm>
48530 <indexterm role="concept">
48531 <primary>header lines</primary>
48532 <secondary>verifying the sender in</secondary>
48533 </indexterm>
48534 <indexterm role="concept">
48535 <primary>sender</primary>
48536 <secondary>verifying in header</secondary>
48537 </indexterm>
48538 <indexterm role="concept">
48539 <primary>verifying</primary>
48540 <secondary>sender in header</secondary>
48541 </indexterm>
48542 This condition is relevant only in an ACL that is run after a message has been
48543 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
48544 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
48545 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
48546 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
48547 However, an address that appears in one of these headers need not be an address
48548 that accepts bounce messages; only sender addresses in envelopes are required
48549 to accept bounces. Therefore, if you use the callout option on this check, you
48550 might want to arrange for a non-empty address in the MAIL command.
48551 </para>
48552 <para>
48553 Details of address verification and the options are given later, starting at
48554 section <xref linkend="SECTaddressverification"/> (callouts are described in section
48555 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
48556 condition to restrict it to bounce messages only:
48557 </para>
48558 <literallayout class="monospaced">
48559 deny    senders = :
48560         message = A valid sender header is required for bounces
48561        !verify  = header_sender
48562 </literallayout>
48563 </listitem></varlistentry>
48564 <varlistentry>
48565 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
48566 <listitem>
48567 <para>
48568 <indexterm role="concept">
48569 <primary><option>verify</option></primary>
48570 <secondary>ACL condition</secondary>
48571 </indexterm>
48572 <indexterm role="concept">
48573 <primary>access control lists (ACLs)</primary>
48574 <secondary>verifying header syntax</secondary>
48575 </indexterm>
48576 <indexterm role="concept">
48577 <primary>header lines</primary>
48578 <secondary>verifying syntax</secondary>
48579 </indexterm>
48580 <indexterm role="concept">
48581 <primary>verifying</primary>
48582 <secondary>header syntax</secondary>
48583 </indexterm>
48584 This condition is relevant only in an ACL that is run after a message has been
48585 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
48586 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
48587 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
48588 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
48589 permitted only in locally generated messages and from hosts that match
48590 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
48591 appropriate.
48592 </para>
48593 <para>
48594 Note that this condition is a syntax check only. However, a common spamming
48595 ploy used to be to send syntactically invalid headers such as
48596 </para>
48597 <literallayout class="monospaced">
48598 To: @
48599 </literallayout>
48600 <para>
48601 and this condition can be used to reject such messages, though they are not as
48602 common as they used to be.
48603 </para>
48604 </listitem></varlistentry>
48605 <varlistentry>
48606 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
48607 <listitem>
48608 <para>
48609 <indexterm role="concept">
48610 <primary><option>verify</option></primary>
48611 <secondary>ACL condition</secondary>
48612 </indexterm>
48613 <indexterm role="concept">
48614 <primary>access control lists (ACLs)</primary>
48615 <secondary>verifying HELO/EHLO</secondary>
48616 </indexterm>
48617 <indexterm role="concept">
48618 <primary>HELO</primary>
48619 <secondary>verifying</secondary>
48620 </indexterm>
48621 <indexterm role="concept">
48622 <primary>EHLO</primary>
48623 <secondary>verifying</secondary>
48624 </indexterm>
48625 <indexterm role="concept">
48626 <primary>verifying</primary>
48627 <secondary>EHLO</secondary>
48628 </indexterm>
48629 <indexterm role="concept">
48630 <primary>verifying</primary>
48631 <secondary>HELO</secondary>
48632 </indexterm>
48633 This condition is true if a HELO or EHLO command has been received from the
48634 client host, and its contents have been verified. If there has been no previous
48635 attempt to verify the HELO/EHLO contents, it is carried out when this
48636 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
48637 <option>helo_try_verify_hosts</option> options for details of how to request verification
48638 independently of this condition.
48639 </para>
48640 <para revisionflag="changed">
48641 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
48642 option), this condition is always true.
48643 </para>
48644 </listitem></varlistentry>
48645 <varlistentry>
48646 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
48647 <listitem>
48648 <para>
48649 <indexterm role="concept">
48650 <primary>verifying</primary>
48651 <secondary>not blind</secondary>
48652 </indexterm>
48653 <indexterm role="concept">
48654 <primary>bcc recipients</primary>
48655 <secondary>verifying none</secondary>
48656 </indexterm>
48657 This condition checks that there are no blind (bcc) recipients in the message.
48658 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
48659 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
48660 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
48661 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
48662 used only in a DATA or non-SMTP ACL.
48663 </para>
48664 <para>
48665 There are, of course, many legitimate messages that make use of blind (bcc)
48666 recipients. This check should not be used on its own for blocking messages.
48667 </para>
48668 </listitem></varlistentry>
48669 <varlistentry>
48670 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48671 <listitem>
48672 <para>
48673 <indexterm role="concept">
48674 <primary><option>verify</option></primary>
48675 <secondary>ACL condition</secondary>
48676 </indexterm>
48677 <indexterm role="concept">
48678 <primary>access control lists (ACLs)</primary>
48679 <secondary>verifying recipient</secondary>
48680 </indexterm>
48681 <indexterm role="concept">
48682 <primary>recipient</primary>
48683 <secondary>verifying</secondary>
48684 </indexterm>
48685 <indexterm role="concept">
48686 <primary>verifying</primary>
48687 <secondary>recipient</secondary>
48688 </indexterm>
48689 <indexterm role="concept">
48690 <primary><varname>$address_data</varname></primary>
48691 </indexterm>
48692 This condition is relevant only after a RCPT command. It verifies the current
48693 recipient. Details of address verification are given later, starting at section
48694 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
48695 of <varname>$address_data</varname> is the last value that was set while routing the address.
48696 This applies even if the verification fails. When an address that is being
48697 verified is redirected to a single address, verification continues with the new
48698 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
48699 value for the child address.
48700 </para>
48701 </listitem></varlistentry>
48702 <varlistentry>
48703 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
48704 <listitem>
48705 <para>
48706 <indexterm role="concept">
48707 <primary><option>verify</option></primary>
48708 <secondary>ACL condition</secondary>
48709 </indexterm>
48710 <indexterm role="concept">
48711 <primary>access control lists (ACLs)</primary>
48712 <secondary>verifying host reverse lookup</secondary>
48713 </indexterm>
48714 <indexterm role="concept">
48715 <primary>host</primary>
48716 <secondary>verifying reverse lookup</secondary>
48717 </indexterm>
48718 This condition ensures that a verified host name has been looked up from the IP
48719 address of the client host. (This may have happened already if the host name
48720 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
48721 Verification ensures that the host name obtained from a reverse DNS lookup, or
48722 one of its aliases, does, when it is itself looked up in the DNS, yield the
48723 original IP address.
48724 </para>
48725 <para>
48726 If this condition is used for a locally generated message (that is, when there
48727 is no client host involved), it always succeeds.
48728 </para>
48729 </listitem></varlistentry>
48730 <varlistentry>
48731 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48732 <listitem>
48733 <para>
48734 <indexterm role="concept">
48735 <primary><option>verify</option></primary>
48736 <secondary>ACL condition</secondary>
48737 </indexterm>
48738 <indexterm role="concept">
48739 <primary>access control lists (ACLs)</primary>
48740 <secondary>verifying sender</secondary>
48741 </indexterm>
48742 <indexterm role="concept">
48743 <primary>sender</primary>
48744 <secondary>verifying</secondary>
48745 </indexterm>
48746 <indexterm role="concept">
48747 <primary>verifying</primary>
48748 <secondary>sender</secondary>
48749 </indexterm>
48750 This condition is relevant only after a MAIL or RCPT command, or after a
48751 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
48752 the message&#x2019;s sender is empty (that is, this is a bounce message), the
48753 condition is true. Otherwise, the sender address is verified.
48754 </para>
48755 <para>
48756 <indexterm role="concept">
48757 <primary><varname>$address_data</varname></primary>
48758 </indexterm>
48759 <indexterm role="concept">
48760 <primary><varname>$sender_address_data</varname></primary>
48761 </indexterm>
48762 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
48763 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
48764 value can be used in subsequent conditions and modifiers in the same ACL
48765 statement. It does not persist after the end of the current statement. If you
48766 want to preserve the value for longer, you can save it in an ACL variable.
48767 </para>
48768 <para>
48769 Details of verification are given later, starting at section
48770 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
48771 to avoid doing it more than once per message.
48772 </para>
48773 </listitem></varlistentry>
48774 <varlistentry>
48775 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48776 <listitem>
48777 <para>
48778 <indexterm role="concept">
48779 <primary><option>verify</option></primary>
48780 <secondary>ACL condition</secondary>
48781 </indexterm>
48782 This is a variation of the previous option, in which a modified address is
48783 verified as a sender.
48784 </para>
48785 </listitem></varlistentry>
48786 </variablelist>
48787 </section>
48788 <section id="SECTmorednslists">
48789 <title>Using DNS lists</title>
48790 <para>
48791 <indexterm role="concept">
48792 <primary>DNS list</primary>
48793 <secondary>in ACL</secondary>
48794 </indexterm>
48795 <indexterm role="concept">
48796 <primary>black list (DNS)</primary>
48797 </indexterm>
48798 <indexterm role="concept">
48799 <primary>access control lists (ACLs)</primary>
48800 <secondary>testing a DNS list</secondary>
48801 </indexterm>
48802 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
48803 is on at least one of a number of DNS lists by looking up the inverted IP
48804 address in one or more DNS domains. For example, if the calling host&#x2019;s IP
48805 address is 192.168.62.43, and the ACL statement is
48806 </para>
48807 <literallayout class="monospaced">
48808 deny dnslists = blackholes.mail-abuse.org : \
48809                 dialups.mail-abuse.org
48810 </literallayout>
48811 <para>
48812 the following records are looked up:
48813 </para>
48814 <literallayout class="monospaced">
48815 43.62.168.192.blackholes.mail-abuse.org
48816 43.62.168.192.dialups.mail-abuse.org
48817 </literallayout>
48818 <para>
48819 As soon as Exim finds an existing DNS record, processing of the list stops.
48820 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
48821 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
48822 use two separate conditions:
48823 </para>
48824 <literallayout class="monospaced">
48825 deny dnslists = blackholes.mail-abuse.org
48826      dnslists = dialups.mail-abuse.org
48827 </literallayout>
48828 <para>
48829 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
48830 behaves as if the host does not match the list item, that is, as if the DNS
48831 record does not exist. If there are further items in the DNS list, they are
48832 processed.
48833 </para>
48834 <para>
48835 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
48836 (which is the most common usage), because it prevents a DNS failure from
48837 blocking mail. However, you can change this behaviour by putting one of the
48838 following special items in the list:
48839 </para>
48840 <literallayout>
48841 <literal>+include_unknown </literal>   behave as if the item is on the list
48842 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
48843 <literal>+defer_unknown   </literal>   give a temporary error
48844 </literallayout>
48845 <para>
48846 <indexterm role="concept">
48847 <primary><literal>+include_unknown</literal></primary>
48848 </indexterm>
48849 <indexterm role="concept">
48850 <primary><literal>+exclude_unknown</literal></primary>
48851 </indexterm>
48852 <indexterm role="concept">
48853 <primary><literal>+defer_unknown</literal></primary>
48854 </indexterm>
48855 Each of these applies to any subsequent items on the list. For example:
48856 </para>
48857 <literallayout class="monospaced">
48858 deny dnslists = +defer_unknown : foo.bar.example
48859 </literallayout>
48860 <para>
48861 Testing the list of domains stops as soon as a match is found. If you want to
48862 warn for one list and block for another, you can use two different statements:
48863 </para>
48864 <literallayout class="monospaced">
48865 deny  dnslists = blackholes.mail-abuse.org
48866 warn  message  = X-Warn: sending host is on dialups list
48867       dnslists = dialups.mail-abuse.org
48868 </literallayout>
48869 <para>
48870 DNS list lookups are cached by Exim for the duration of the SMTP session,
48871 so a lookup based on the IP address is done at most once for any incoming
48872 connection. Exim does not share information between multiple incoming
48873 connections (but your local name server cache should be active).
48874 </para>
48875 </section>
48876 <section>
48877 <title>Specifying the IP address for a DNS list lookup</title>
48878 <para>
48879 <indexterm role="concept">
48880 <primary>DNS list</primary>
48881 <secondary>keyed by explicit IP address</secondary>
48882 </indexterm>
48883 By default, the IP address that is used in a DNS list lookup is the IP address
48884 of the calling host. However, you can specify another IP address by listing it
48885 after the domain name, introduced by a slash. For example:
48886 </para>
48887 <literallayout class="monospaced">
48888 deny dnslists = black.list.tld/192.168.1.2
48889 </literallayout>
48890 <para>
48891 This feature is not very helpful with explicit IP addresses; it is intended for
48892 use with IP addresses that are looked up, for example, the IP addresses of the
48893 MX hosts or nameservers of an email sender address. For an example, see section
48894 <xref linkend="SECTmulkeyfor"/> below.
48895 </para>
48896 </section>
48897 <section>
48898 <title>DNS lists keyed on domain names</title>
48899 <para>
48900 <indexterm role="concept">
48901 <primary>DNS list</primary>
48902 <secondary>keyed by domain name</secondary>
48903 </indexterm>
48904 There are some lists that are keyed on domain names rather than inverted IP
48905 addresses (see for example the <emphasis>domain based zones</emphasis> link at
48906 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
48907 with these lists. You can change the name that is looked up in a DNS list by
48908 listing it after the domain name, introduced by a slash. For example,
48909 </para>
48910 <literallayout class="monospaced">
48911 deny  message  = Sender's domain is listed at $dnslist_domain
48912       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
48913 </literallayout>
48914 <para>
48915 This particular example is useful only in ACLs that are obeyed after the
48916 RCPT or DATA commands, when a sender address is available. If (for
48917 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
48918 up by this example is
48919 </para>
48920 <literallayout class="monospaced">
48921 tld.example.dsn.rfc-ignorant.org
48922 </literallayout>
48923 <para>
48924 A single <option>dnslists</option> condition can contain entries for both names and IP
48925 addresses. For example:
48926 </para>
48927 <literallayout class="monospaced">
48928 deny dnslists = sbl.spamhaus.org : \
48929                 dsn.rfc-ignorant.org/$sender_address_domain
48930 </literallayout>
48931 <para>
48932 The first item checks the sending host&#x2019;s IP address; the second checks a domain
48933 name. The whole condition is true if either of the DNS lookups succeeds.
48934 </para>
48935 </section>
48936 <section id="SECTmulkeyfor">
48937 <title>Multiple explicit keys for a DNS list</title>
48938 <para>
48939 <indexterm role="concept">
48940 <primary>DNS list</primary>
48941 <secondary>multiple keys for</secondary>
48942 </indexterm>
48943 The syntax described above for looking up explicitly-defined values (either
48944 names or IP addresses) in a DNS blacklist is a simplification. After the domain
48945 name for the DNS list, what follows the slash can in fact be a list of items.
48946 As with all lists in Exim, the default separator is a colon. However, because
48947 this is a sublist within the list of DNS blacklist domains, it is necessary
48948 either to double the separators like this:
48949 </para>
48950 <literallayout class="monospaced">
48951 dnslists = black.list.tld/name.1::name.2
48952 </literallayout>
48953 <para>
48954 or to change the separator character, like this:
48955 </para>
48956 <literallayout class="monospaced">
48957 dnslists = black.list.tld/&lt;;name.1;name.2
48958 </literallayout>
48959 <para>
48960 If an item in the list is an IP address, it is inverted before the DNS
48961 blacklist domain is appended. If it is not an IP address, no inversion
48962 occurs. Consider this condition:
48963 </para>
48964 <literallayout class="monospaced">
48965 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
48966 </literallayout>
48967 <para>
48968 The DNS lookups that occur are:
48969 </para>
48970 <literallayout class="monospaced">
48971 2.1.168.192.black.list.tld
48972 a.domain.black.list.tld
48973 </literallayout>
48974 <para>
48975 Once a DNS record has been found (that matches a specific IP return
48976 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
48977 are done. If there is a temporary DNS error, the rest of the sublist of domains
48978 or IP addresses is tried. A temporary error for the whole dnslists item occurs
48979 only if no other DNS lookup in this sublist succeeds. In other words, a
48980 successful lookup for any of the items in the sublist overrides a temporary
48981 error for a previous item.
48982 </para>
48983 <para>
48984 The ability to supply a list of items after the slash is in some sense just a
48985 syntactic convenience. These two examples have the same effect:
48986 </para>
48987 <literallayout class="monospaced">
48988 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
48989 dnslists = black.list.tld/a.domain::b.domain
48990 </literallayout>
48991 <para>
48992 However, when the data for the list is obtained from a lookup, the second form
48993 is usually much more convenient. Consider this example:
48994 </para>
48995 <literallayout class="monospaced">
48996 deny message  = The mail servers for the domain \
48997                 $sender_address_domain \
48998                 are listed at $dnslist_domain ($dnslist_value); \
48999                 see $dnslist_text.
49000      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
49001                                    ${lookup dnsdb {&gt;|mxh=\
49002                                    $sender_address_domain} }} }
49003 </literallayout>
49004 <para>
49005 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
49006 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
49007 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
49008 of expanding the condition might be something like this:
49009 </para>
49010 <literallayout class="monospaced">
49011 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
49012 </literallayout>
49013 <para>
49014 Thus, this example checks whether or not the IP addresses of the sender
49015 domain&#x2019;s mail servers are on the Spamhaus black list.
49016 </para>
49017 </section>
49018 <section>
49019 <title>Data returned by DNS lists</title>
49020 <para>
49021 <indexterm role="concept">
49022 <primary>DNS list</primary>
49023 <secondary>data returned from</secondary>
49024 </indexterm>
49025 DNS lists are constructed using address records in the DNS. The original RBL
49026 just used the address 127.0.0.1 on the right hand side of each record, but the
49027 RBL+ list and some other lists use a number of values with different meanings.
49028 The values used on the RBL+ list are:
49029 </para>
49030 <literallayout>
49031 127.1.0.1  RBL
49032 127.1.0.2  DUL
49033 127.1.0.3  DUL and RBL
49034 127.1.0.4  RSS
49035 127.1.0.5  RSS and RBL
49036 127.1.0.6  RSS and DUL
49037 127.1.0.7  RSS and DUL and RBL
49038 </literallayout>
49039 <para revisionflag="changed">
49040 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
49041 different values. Some DNS lists may return more than one address record; they
49042 are all checked.
49043 </para>
49044 </section>
49045 <section>
49046 <title>Variables set from DNS lists</title>
49047 <para revisionflag="changed">
49048 <indexterm role="concept">
49049 <primary>DNS list</primary>
49050 <secondary>variables set from</secondary>
49051 </indexterm>
49052 <indexterm role="concept">
49053 <primary><varname>$dnslist_domain</varname></primary>
49054 </indexterm>
49055 <indexterm role="concept">
49056 <primary><varname>$dnslist_text</varname></primary>
49057 </indexterm>
49058 <indexterm role="concept">
49059 <primary><varname>$dnslist_value</varname></primary>
49060 </indexterm>
49061 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
49062 contains the name of the domain that matched, and <varname>$dnslist_value</varname> contains
49063 the data from the entry. If more than one address record is returned by the DNS
49064 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
49065 commas and spaces. The variable <varname>$dnslist_text</varname> contains the contents of any
49066 associated TXT record. For lists such as RBL+ the TXT record for a merged entry
49067 is often not very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of
49068 obtaining more information.
49069 </para>
49070 <para>
49071 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
49072 &ndash; although these appear before the condition in the ACL, they are not
49073 expanded until after it has failed. For example:
49074 </para>
49075 <literallayout class="monospaced">
49076 deny    hosts = !+local_networks
49077         message = $sender_host_address is listed \
49078                   at $dnslist_domain
49079         dnslists = rbl-plus.mail-abuse.example
49080 </literallayout>
49081 </section>
49082 <section id="SECTaddmatcon">
49083 <title>Additional matching conditions for DNS lists</title>
49084 <para>
49085 <indexterm role="concept">
49086 <primary>DNS list</primary>
49087 <secondary>matching specific returned data</secondary>
49088 </indexterm>
49089 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
49090 in order to restrict its action to DNS records with a matching right hand side.
49091 For example,
49092 </para>
49093 <literallayout class="monospaced">
49094 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
49095 </literallayout>
49096 <para>
49097 rejects only those hosts that yield 127.0.0.2. Without this additional data,
49098 any address record is considered to be a match. If more than one address record
49099 is found on the list, they are all checked for a matching right-hand side.
49100 </para>
49101 <para>
49102 More than one IP address may be given for checking, using a comma as a
49103 separator. These are alternatives &ndash; if any one of them matches, the
49104 <option>dnslists</option> condition is true. For example:
49105 </para>
49106 <literallayout class="monospaced">
49107 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
49108 </literallayout>
49109 <para>
49110 If you want to specify a constraining address list and also specify names or IP
49111 addresses to be looked up, the constraining address list must be specified
49112 first. For example:
49113 </para>
49114 <literallayout class="monospaced">
49115 deny dnslists = dsn.rfc-ignorant.org\
49116                 =127.0.0.2/$sender_address_domain
49117 </literallayout>
49118 <para>
49119 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
49120 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
49121 In other words, the listed addresses are used as bit masks. The comparison is
49122 true if all the bits in the mask are present in the address that is being
49123 tested. For example:
49124 </para>
49125 <literallayout class="monospaced">
49126 dnslists = a.b.c&amp;0.0.0.3
49127 </literallayout>
49128 <para>
49129 matches if the address is <emphasis>x.x.x.</emphasis>3, <emphasis>x.x.x.</emphasis>7, <emphasis>x.x.x.</emphasis>11, etc. If you
49130 want to test whether one bit or another bit is present (as opposed to both
49131 being present), you must use multiple values. For example:
49132 </para>
49133 <literallayout class="monospaced">
49134 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
49135 </literallayout>
49136 <para>
49137 matches if the final component of the address is an odd number or two times
49138 an odd number.
49139 </para>
49140 </section>
49141 <section>
49142 <title>Negated DNS matching conditions</title>
49143 <para>
49144 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
49145 condition. Whereas
49146 </para>
49147 <literallayout class="monospaced">
49148 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
49149 </literallayout>
49150 <para>
49151 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49152 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
49153 </para>
49154 <literallayout class="monospaced">
49155 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
49156 </literallayout>
49157 <para>
49158 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
49159 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
49160 words, the result of the test is inverted if an exclamation mark appears before
49161 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
49162 </para>
49163 <para>
49164 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
49165 host, or address list (which is why the syntax is different).
49166 </para>
49167 <para>
49168 If you are using just one list, the negation syntax does not gain you much. The
49169 previous example is precisely equivalent to
49170 </para>
49171 <literallayout class="monospaced">
49172 deny  dnslists = a.b.c
49173      !dnslists = a.b.c=127.0.0.2,127.0.0.3
49174 </literallayout>
49175 <para>
49176 However, if you are using multiple lists, the negation syntax is clearer.
49177 Consider this example:
49178 </para>
49179 <literallayout class="monospaced">
49180 deny  dnslists = sbl.spamhaus.org : \
49181                  list.dsbl.org : \
49182                  dnsbl.njabl.org!=127.0.0.3 : \
49183                  relays.ordb.org
49184 </literallayout>
49185 <para>
49186 Using only positive lists, this would have to be:
49187 </para>
49188 <literallayout class="monospaced">
49189 deny  dnslists = sbl.spamhaus.org : \
49190                  list.dsbl.org
49191 deny  dnslists = dnsbl.njabl.org
49192      !dnslists = dnsbl.njabl.org=127.0.0.3
49193 deny  dnslists = relays.ordb.org
49194 </literallayout>
49195 <para>
49196 which is less clear, and harder to maintain.
49197 </para>
49198 </section>
49199 <section id="SECTmordetinf" revisionflag="changed">
49200 <title>Detailed information from merged DNS lists</title>
49201 <para revisionflag="changed">
49202 <indexterm role="concept">
49203 <primary>DNS list</primary>
49204 <secondary>information from merged</secondary>
49205 </indexterm>
49206 When the facility for restricting the matching IP values in a DNS list is used,
49207 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
49208 the true reason for rejection. This happens when lists are merged and the IP
49209 address in the A record is used to distinguish them; unfortunately there is
49210 only one TXT record. One way round this is not to use merged lists, but that
49211 can be inefficient because it requires multiple DNS lookups where one would do
49212 in the vast majority of cases when the host of interest is not on any of the
49213 lists.
49214 </para>
49215 <para revisionflag="changed">
49216 A less inefficient way of solving this problem is available. If
49217 two domain names, comma-separated, are given, the second is used first to
49218 do an initial check, making use of any IP value restrictions that are set.
49219 If there is a match, the first domain is used, without any IP value
49220 restrictions, to get the TXT record. As a byproduct of this, there is also
49221 a check that the IP being tested is indeed on the first list. The first
49222 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
49223 </para>
49224 <literallayout class="monospaced" revisionflag="changed">
49225 reject message  = \
49226          rejected because $sender_ip_address is blacklisted \
49227          at $dnslist_domain\n$dnslist_text
49228        dnslists = \
49229          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
49230          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
49231 </literallayout>
49232 <para revisionflag="changed">
49233 For the first blacklist item, this starts by doing a lookup in
49234 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
49235 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
49236 value, and as long as something is found, it looks for the corresponding TXT
49237 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
49238 The second blacklist item is processed similarly.
49239 </para>
49240 <para revisionflag="changed">
49241 If you are interested in more than one merged list, the same list must be
49242 given several times, but because the results of the DNS lookups are cached,
49243 the DNS calls themselves are not repeated. For example:
49244 </para>
49245 <literallayout class="monospaced" revisionflag="changed">
49246 reject dnslists = \
49247          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
49248          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
49249          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
49250          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
49251 </literallayout>
49252 <para revisionflag="changed">
49253 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
49254 values matches (or if no record is found), this is the only lookup that is
49255 done. Only if there is a match is one of the more specific lists consulted.
49256 </para>
49257 </section>
49258 <section id="SECTmorednslistslast">
49259 <title>DNS lists and IPv6</title>
49260 <para>
49261 <indexterm role="concept">
49262 <primary>IPv6</primary>
49263 <secondary>DNS black lists</secondary>
49264 </indexterm>
49265 <indexterm role="concept">
49266 <primary>DNS list</primary>
49267 <secondary>IPv6 usage</secondary>
49268 </indexterm>
49269 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
49270 nibble by nibble. For example, if the calling host&#x2019;s IP address is
49271 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
49272 </para>
49273 <literallayout class="monospaced">
49274 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
49275   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
49276 </literallayout>
49277 <para>
49278 (split over two lines here to fit on the page). Unfortunately, some of the DNS
49279 lists contain wildcard records, intended for IPv4, that interact badly with
49280 IPv6. For example, the DNS entry
49281 </para>
49282 <literallayout class="monospaced">
49283 *.3.some.list.example.    A    127.0.0.1
49284 </literallayout>
49285 <para>
49286 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
49287 Unfortunately, it also matches the entire 3::/4 IPv6 network.
49288 </para>
49289 <para>
49290 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
49291 <option>condition</option> condition, as in this example:
49292 </para>
49293 <literallayout class="monospaced">
49294 deny   condition = ${if isip4{$sender_host_address}}
49295        dnslists  = some.list.example
49296 </literallayout>
49297 </section>
49298 <section id="SECTratelimiting">
49299 <title>Rate limiting senders</title>
49300 <para>
49301 <indexterm role="concept">
49302 <primary>rate limiting</primary>
49303 <secondary>client sending</secondary>
49304 </indexterm>
49305 <indexterm role="concept">
49306 <primary>limiting client sending rates</primary>
49307 </indexterm>
49308 <indexterm role="option">
49309 <primary><option>smtp_ratelimit_*</option></primary>
49310 </indexterm>
49311 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
49312 which clients can send email. This is more powerful than the
49313 <option>smtp_ratelimit_*</option> options, because those options control the rate of
49314 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
49315 works across all connections (concurrent and sequential) from the same client
49316 host. The syntax of the <option>ratelimit</option> condition is:
49317 </para>
49318 <literallayout>
49319 <literal>ratelimit =</literal> &lt;<emphasis>m</emphasis>&gt; <literal>/</literal> &lt;<emphasis>p</emphasis>&gt; <literal>/</literal> &lt;<emphasis>options</emphasis>&gt; <literal>/</literal> &lt;<emphasis>key</emphasis>&gt;
49320 </literallayout>
49321 <para>
49322 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
49323 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
49324 </para>
49325 <para>
49326 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
49327 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
49328 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
49329 of <emphasis>p</emphasis>.
49330 </para>
49331 <para>
49332 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
49333 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
49334 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
49335 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
49336 send in each time interval. It also specifies the number of messages permitted
49337 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
49338 constant, you can allow a client to send more messages in a burst without
49339 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
49340 both small, messages must be sent at an even rate.
49341 </para>
49342 <para>
49343 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
49344 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
49345 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
49346 instructions when it is run with no arguments.
49347 </para>
49348 <para>
49349 The key is used to look up the data for calculating the client&#x2019;s average
49350 sending rate. This data is stored in a database maintained by Exim in its spool
49351 directory, alongside the retry and other hints databases. The default key is
49352 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
49353 By changing the key you can change how Exim identifies clients for the purpose
49354 of ratelimiting. For example, to limit the sending rate of each authenticated
49355 user, independent of the computer they are sending from, set the key to
49356 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
49357 example, <varname>$authenticated_id</varname> is only meaningful if the client has
49358 authenticated, and you can check with the <option>authenticated</option> ACL condition.
49359 </para>
49360 <para>
49361 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
49362 lookup key because they alter the meaning of the stored data. This is not true
49363 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
49364 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
49365 parameters Exim forgets past behaviour.
49366 </para>
49367 <para>
49368 Each <option>ratelimit</option> condition can have up to two options. The first option
49369 specifies what Exim measures the rate of, and the second specifies how Exim
49370 handles excessively fast clients. The options are separated by a slash, like
49371 the other parameters.
49372 </para>
49373 <para>
49374 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
49375 </para>
49376 <para>
49377 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
49378 the default if none of the <option>per_*</option> options is specified.
49379 </para>
49380 <para>
49381 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
49382 best to use this option in the DATA ACL; if it is used in an earlier ACL it
49383 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
49384 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
49385 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
49386 </para>
49387 <para>
49388 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
49389 condition is processed. This can be used to limit the SMTP command rate. The
49390 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
49391 to make it clear that the effect is to limit the rate at which recipients are
49392 accepted. Note that in this case the rate limiting engine will see a message
49393 with many recipients as a large high-speed burst.
49394 </para>
49395 <para>
49396 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
49397 engine can react in two possible ways, depending on the presence of the
49398 <option>strict</option> or <option>leaky</option> options. This is independent of the other
49399 counter-measures (such as rejecting the message) that may be specified by the
49400 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
49401 over-aggressive retry rate preventing it from getting any email through.
49402 </para>
49403 <para>
49404 The <option>strict</option> option means that the client&#x2019;s recorded rate is always updated.
49405 The effect of this is that Exim measures the client&#x2019;s average rate of attempts
49406 to send email, which can be much higher than the maximum. If the client is over
49407 the limit it will be subjected to counter-measures until it slows down below
49408 the maximum rate. The smoothing period determines the time it takes for a high
49409 sending rate to decay exponentially to 37% of its peak value, which means that
49410 you can work out the time (the number of smoothing periods) that a client is
49411 subjected to counter-measures after an over-limit burst with this formula:
49412 </para>
49413 <literallayout class="monospaced">
49414 ln(peakrate/maxrate)
49415 </literallayout>
49416 <para>
49417 The <option>leaky</option> option means that the client&#x2019;s recorded rate is not updated if it
49418 is above the limit. The effect of this is that Exim measures the client&#x2019;s
49419 average rate of successfully sent email, which cannot be greater than the
49420 maximum. If the client is over the limit it <phrase revisionflag="changed">may suffer some
49421 counter-measures (as specified in the ACL)</phrase>, but it will still be able to send
49422 email at the configured maximum rate, whatever the rate of its attempts. This
49423 is generally the better choice if you have clients that retry automatically.
49424 </para>
49425 <para>
49426 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
49427 when the rate limit is exceeded. This might be anything from logging a warning
49428 (for example, while measuring existing sending rates in order to define
49429 policy), through time delays to slow down fast senders, up to rejecting the
49430 message. For example:
49431 </para>
49432 <literallayout class="monospaced">
49433 # Log all senders' rates
49434 warn ratelimit = 0 / 1h / strict
49435      log_message = Sender rate $sender_rate / $sender_rate_period
49436
49437 # Slow down fast senders; note the need to truncate $sender_rate
49438 # at the decimal point.
49439 warn ratelimit = 100 / 1h / per_rcpt / strict
49440      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
49441                    $sender_rate_limit }s
49442
49443 # Keep authenticated users under control
49444 deny authenticated = *
49445      ratelimit = 100 / 1d / strict / $authenticated_id
49446
49447 # System-wide rate limit
49448 defer message = Sorry, too busy. Try again later.
49449      ratelimit = 10 / 1s / $primary_hostname
49450
49451 # Restrict incoming rate from each host, with a default
49452 # set using a macro and special cases looked up in a table.
49453 defer message = Sender rate exceeds $sender_rate_limit \
49454                messages per $sender_rate_period
49455      ratelimit = ${lookup {$sender_host_address} \
49456                    cdb {DB/ratelimits.cdb} \
49457                    {$value} {RATELIMIT} }
49458 </literallayout>
49459 <para>
49460 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
49461 especially with the <option>per_rcpt</option> option, you may suffer from a performance
49462 bottleneck caused by locking on the ratelimit hints database. Apart from
49463 making your ACLs less complicated, you can reduce the problem by using a
49464 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
49465 this means that Exim will lose its hints data after a reboot (including retry
49466 hints, the callout cache, and ratelimit data).
49467 </para>
49468 </section>
49469 <section id="SECTaddressverification">
49470 <title>Address verification</title>
49471 <para>
49472 <indexterm role="concept">
49473 <primary>verifying address</primary>
49474 <secondary>options for</secondary>
49475 </indexterm>
49476 <indexterm role="concept">
49477 <primary>policy control</primary>
49478 <secondary>address verification</secondary>
49479 </indexterm>
49480 Several of the <option>verify</option> conditions described in section
49481 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
49482 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
49483 The verification conditions can be followed by options that modify the
49484 verification process. The options are separated from the keyword and from each
49485 other by slashes, and some of them contain parameters. For example:
49486 </para>
49487 <literallayout class="monospaced">
49488 verify = sender/callout
49489 verify = recipient/defer_ok/callout=10s,defer_ok
49490 </literallayout>
49491 <para>
49492 The first stage of address verification, which always happens, is to run the
49493 address through the routers, in <quote>verify mode</quote>. Routers can detect the
49494 difference between verification and routing for delivery, and their actions can
49495 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
49496 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
49497 The available options are as follows:
49498 </para>
49499 <itemizedlist>
49500 <listitem>
49501 <para>
49502 If the <option>callout</option> option is specified, successful routing to one or more
49503 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
49504 check. Callouts and their sub-options are discussed in the next section.
49505 </para>
49506 </listitem>
49507 <listitem>
49508 <para>
49509 If there is a defer error while doing verification routing, the ACL
49510 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
49511 options, the condition is forced to be true instead. Note that this is a main
49512 verification option as well as a suboption for callouts.
49513 </para>
49514 </listitem>
49515 <listitem>
49516 <para>
49517 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
49518 discusses the reporting of sender address verification failures.
49519 </para>
49520 </listitem>
49521 <listitem>
49522 <para>
49523 The <option>success_on_redirect</option> option causes verification always to succeed
49524 immediately after a successful redirection. By default, if a redirection
49525 generates just one address, that address is also verified. See further
49526 discussion in section <xref linkend="SECTredirwhilveri"/>.
49527 </para>
49528 </listitem>
49529 </itemizedlist>
49530 <para>
49531 <indexterm role="concept">
49532 <primary>verifying address</primary>
49533 <secondary>differentiating failures</secondary>
49534 </indexterm>
49535 <indexterm role="concept">
49536 <primary><varname>$recipient_verify_failure</varname></primary>
49537 </indexterm>
49538 <indexterm role="concept">
49539 <primary><varname>$sender_verify_failure</varname></primary>
49540 </indexterm>
49541 <indexterm role="concept">
49542 <primary><varname>$acl_verify_message</varname></primary>
49543 </indexterm>
49544 After an address verification failure, <varname>$acl_verify_message</varname> contains the
49545 error message that is associated with the failure. It can be preserved by
49546 coding like this:
49547 </para>
49548 <literallayout class="monospaced">
49549 warn  !verify = sender
49550        set acl_m0 = $acl_verify_message
49551 </literallayout>
49552 <para>
49553 If you are writing your own custom rejection message or log message when
49554 denying access, you can use this variable to include information about the
49555 verification failure.
49556 </para>
49557 <para>
49558 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
49559 appropriate) contains one of the following words:
49560 </para>
49561 <itemizedlist>
49562 <listitem>
49563 <para>
49564 <option>qualify</option>: The address was unqualified (no domain), and the message
49565 was neither local nor came from an exempted host.
49566 </para>
49567 </listitem>
49568 <listitem>
49569 <para>
49570 <option>route</option>: Routing failed.
49571 </para>
49572 </listitem>
49573 <listitem>
49574 <para>
49575 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
49576 occurred at or before the MAIL command (that is, on initial
49577 connection, HELO, or MAIL).
49578 </para>
49579 </listitem>
49580 <listitem>
49581 <para>
49582 <option>recipient</option>: The RCPT command in a callout was rejected.
49583 </para>
49584 </listitem>
49585 <listitem>
49586 <para>
49587 <option>postmaster</option>: The postmaster check in a callout was rejected.
49588 </para>
49589 </listitem>
49590 </itemizedlist>
49591 <para>
49592 The main use of these variables is expected to be to distinguish between
49593 rejections of MAIL and rejections of RCPT in callouts.
49594 </para>
49595 </section>
49596 <section id="SECTcallver">
49597 <title>Callout verification</title>
49598 <para>
49599 <indexterm role="concept">
49600 <primary>verifying address</primary>
49601 <secondary>by callout</secondary>
49602 </indexterm>
49603 <indexterm role="concept">
49604 <primary>callout</primary>
49605 <secondary>verification</secondary>
49606 </indexterm>
49607 <indexterm role="concept">
49608 <primary>SMTP</primary>
49609 <secondary>callout verification</secondary>
49610 </indexterm>
49611 For non-local addresses, routing verifies the domain, but is unable to do any
49612 checking of the local part. There are situations where some means of verifying
49613 the local part is desirable. One way this can be done is to make an SMTP
49614 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
49615 a subsequent host for a recipient address, to see if the host accepts the
49616 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
49617 sender address, the callback is not to the client host that is trying to
49618 deliver the message, but to one of the hosts that accepts incoming mail for the
49619 sender&#x2019;s domain.
49620 </para>
49621 <para>
49622 Exim does not do callouts by default. If you want them to happen, you must
49623 request them by setting appropriate options on the <option>verify</option> condition, as
49624 described below. This facility should be used with care, because it can add a
49625 lot of resource usage to the cost of verifying an address. However, Exim does
49626 cache the results of callouts, which helps to reduce the cost. Details of
49627 caching are in section <xref linkend="SECTcallvercache"/>.
49628 </para>
49629 <para>
49630 Recipient callouts are usually used only between hosts that are controlled by
49631 the same administration. For example, a corporate gateway host could use
49632 callouts to check for valid recipients on an internal mailserver. A successful
49633 callout does not guarantee that a real delivery to the address would succeed;
49634 on the other hand, a failing callout does guarantee that a delivery would fail.
49635 </para>
49636 <para>
49637 If the <option>callout</option> option is present on a condition that verifies an address, a
49638 second stage of verification occurs if the address is successfully routed to
49639 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
49640 <command>manualroute</command> router, where the router specifies the hosts. However, if a
49641 router that does not set up hosts routes to an <command>smtp</command> transport with a
49642 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
49643 <option>hosts_override</option> set, its hosts are always used, whether or not the router
49644 supplies a host list.
49645 </para>
49646 <para revisionflag="changed">
49647 The port that is used is taken from the transport, if it is specified and is a
49648 remote transport. (For routers that do verification only, no transport need be
49649 specified.) Otherwise, the default SMTP port is used. If a remote transport
49650 specifies an outgoing interface, this is used; otherwise the interface is not
49651 specified. Likewise, the text that is used for the HELO command is taken from
49652 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
49653 <varname>$smtp_active_hostname</varname> is used.
49654 </para>
49655 <para revisionflag="changed">
49656 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
49657 test whether a bounce message could be delivered to the sender address. The
49658 following SMTP commands are sent:
49659 </para>
49660 <literallayout revisionflag="changed">
49661 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
49662 <literal>MAIL FROM:&lt;&gt;</literal>
49663 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
49664 <literal>QUIT</literal>
49665 </literallayout>
49666 <para>
49667 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
49668 set to <quote>lmtp</quote>.
49669 </para>
49670 <para>
49671 A recipient callout check is similar. By default, it also uses an empty address
49672 for the sender. This default is chosen because most hosts do not make use of
49673 the sender address when verifying a recipient. Using the same address means
49674 that a single cache entry can be used for each recipient. Some sites, however,
49675 do make use of the sender address when verifying. These are catered for by the
49676 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
49677 </para>
49678 <para>
49679 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
49680 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
49681 Exim tries the next host, if any. If there is a problem with all the remote
49682 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
49683 <option>callout</option> option is given, in which case the condition is forced to succeed.
49684 </para>
49685 </section>
49686 <section id="CALLaddparcall">
49687 <title>Additional parameters for callouts</title>
49688 <para>
49689 <indexterm role="concept">
49690 <primary>callout</primary>
49691 <secondary>additional parameters for</secondary>
49692 </indexterm>
49693 The <option>callout</option> option can be followed by an equals sign and a number of
49694 optional parameters, separated by commas. For example:
49695 </para>
49696 <literallayout class="monospaced">
49697 verify = recipient/callout=10s,defer_ok
49698 </literallayout>
49699 <para>
49700 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
49701 separate verify options, is retained for backwards compatibility, but is now
49702 deprecated. The additional parameters for <option>callout</option> are as follows:
49703 </para>
49704 <variablelist>
49705 <varlistentry>
49706 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
49707 <listitem>
49708 <para>
49709 <indexterm role="concept">
49710 <primary>callout timeout</primary>
49711 <secondary>specifying</secondary>
49712 </indexterm>
49713 This specifies the timeout that applies for the callout attempt to each host.
49714 For example:
49715 </para>
49716 <literallayout class="monospaced">
49717 verify = sender/callout=5s
49718 </literallayout>
49719 <para>
49720 The default is 30 seconds. The timeout is used for each response from the
49721 remote host. It is also used for the intial connection, unless overridden by
49722 the <option>connect</option> parameter.
49723 </para>
49724 </listitem></varlistentry>
49725 <varlistentry>
49726 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
49727 <listitem>
49728 <para>
49729 <indexterm role="concept">
49730 <primary>callout connection timeout</primary>
49731 <secondary>specifying</secondary>
49732 </indexterm>
49733 This parameter makes it possible to set a different (usually smaller) timeout
49734 for making the SMTP connection. For example:
49735 </para>
49736 <literallayout class="monospaced">
49737 verify = sender/callout=5s,connect=1s
49738 </literallayout>
49739 <para>
49740 If not specified, this timeout defaults to the general timeout value.
49741 </para>
49742 </listitem></varlistentry>
49743 <varlistentry>
49744 <term><emphasis role="bold">defer_ok</emphasis></term>
49745 <listitem>
49746 <para>
49747 <indexterm role="concept">
49748 <primary>callout defer</primary>
49749 <secondary>action on</secondary>
49750 </indexterm>
49751 When this parameter is present, failure to contact any host, or any other kind
49752 of temporary error, is treated as success by the ACL. However, the cache is not
49753 updated in this circumstance.
49754 </para>
49755 </listitem></varlistentry>
49756 <varlistentry>
49757 <term><emphasis role="bold">fullpostmaster</emphasis></term>
49758 <listitem>
49759 <para>
49760 <indexterm role="concept">
49761 <primary>callout</primary>
49762 <secondary>full postmaster check</secondary>
49763 </indexterm>
49764 This operates like the <option>postmaster</option> option (see below), but if the check for
49765 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
49766 accordance with the specification in RFC 2821. The RFC states that the
49767 unqualified address <emphasis>postmaster</emphasis> should be accepted.
49768 </para>
49769 </listitem></varlistentry>
49770 <varlistentry>
49771 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
49772 <listitem>
49773 <para>
49774 <indexterm role="concept">
49775 <primary>callout</primary>
49776 <secondary>sender when verifying header</secondary>
49777 </indexterm>
49778 When verifying addresses in header lines using the <option>header_sender</option>
49779 verification option, Exim behaves by default as if the addresses are envelope
49780 sender addresses from a message. Callout verification therefore tests to see
49781 whether a bounce message could be delivered, by using an empty address in the
49782 MAIL command. However, it is arguable that these addresses might never be used
49783 as envelope senders, and could therefore justifiably reject bounce messages
49784 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
49785 address to use in the MAIL command. For example:
49786 </para>
49787 <literallayout class="monospaced">
49788 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
49789 </literallayout>
49790 <para>
49791 This parameter is available only for the <option>header_sender</option> verification option.
49792 </para>
49793 </listitem></varlistentry>
49794 <varlistentry>
49795 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
49796 <listitem>
49797 <para>
49798 <indexterm role="concept">
49799 <primary>callout overall timeout</primary>
49800 <secondary>specifying</secondary>
49801 </indexterm>
49802 This parameter sets an overall timeout for performing a callout verification.
49803 For example:
49804 </para>
49805 <literallayout class="monospaced">
49806 verify = sender/callout=5s,maxwait=30s
49807 </literallayout>
49808 <para>
49809 This timeout defaults to four times the callout timeout for individual SMTP
49810 commands. The overall timeout applies when there is more than one host that can
49811 be tried. The timeout is checked before trying the next host. This prevents
49812 very long delays if there are a large number of hosts and all are timing out
49813 (for example, when network connections are timing out).
49814 </para>
49815 </listitem></varlistentry>
49816 <varlistentry>
49817 <term><emphasis role="bold">no_cache</emphasis></term>
49818 <listitem>
49819 <para>
49820 <indexterm role="concept">
49821 <primary>callout cache</primary>
49822 <secondary>suppressing</secondary>
49823 </indexterm>
49824 <indexterm role="concept">
49825 <primary>caching callout</primary>
49826 <secondary>suppressing</secondary>
49827 </indexterm>
49828 When this parameter is given, the callout cache is neither read nor updated.
49829 </para>
49830 </listitem></varlistentry>
49831 <varlistentry>
49832 <term><emphasis role="bold">postmaster</emphasis></term>
49833 <listitem>
49834 <para>
49835 <indexterm role="concept">
49836 <primary>callout</primary>
49837 <secondary>postmaster; checking</secondary>
49838 </indexterm>
49839 When this parameter is set, a sucessful callout check is followed by a similar
49840 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
49841 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
49842 the postmaster check is recorded in a cache record; if it is a failure, this is
49843 used to fail subsequent callouts for the domain without a connection being
49844 made, until the cache record expires.
49845 </para>
49846 </listitem></varlistentry>
49847 <varlistentry>
49848 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
49849 <listitem>
49850 <para>
49851 The postmaster check uses an empty sender in the MAIL command by default.
49852 You can use this parameter to do a postmaster check using a different address.
49853 For example:
49854 </para>
49855 <literallayout class="monospaced">
49856 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
49857 </literallayout>
49858 <para>
49859 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
49860 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
49861 </para>
49862 <literallayout class="monospaced">
49863 require  verify = sender/callout=postmaster_mailfrom=
49864 </literallayout>
49865 <para>
49866 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
49867 account of the sender address. It is assumed that either the empty address or
49868 a fixed non-empty address will be used. All that Exim remembers is that the
49869 postmaster check for the domain succeeded or failed.
49870 </para>
49871 </listitem></varlistentry>
49872 <varlistentry>
49873 <term><emphasis role="bold">random</emphasis></term>
49874 <listitem>
49875 <para>
49876 <indexterm role="concept">
49877 <primary>callout</primary>
49878 <secondary><quote>random</quote> check</secondary>
49879 </indexterm>
49880 When this parameter is set, before doing the normal callout check, Exim does a
49881 check for a <quote>random</quote> local part at the same domain. The local part is not
49882 really random &ndash; it is defined by the expansion of the option
49883 <option>callout_random_local_part</option>, which defaults to
49884 </para>
49885 <literallayout class="monospaced">
49886 $primary_host_name-$tod_epoch-testing
49887 </literallayout>
49888 <para>
49889 The idea here is to try to determine whether the remote host accepts all local
49890 parts without checking. If it does, there is no point in doing callouts for
49891 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
49892 a cache record, and used to force the current and subsequent callout checks to
49893 succeed without a connection being made, until the cache record expires.
49894 </para>
49895 </listitem></varlistentry>
49896 <varlistentry>
49897 <term><emphasis role="bold">use_postmaster</emphasis></term>
49898 <listitem>
49899 <para>
49900 <indexterm role="concept">
49901 <primary>callout</primary>
49902 <secondary>sender for recipient check</secondary>
49903 </indexterm>
49904 This parameter applies to recipient callouts only. For example:
49905 </para>
49906 <literallayout class="monospaced">
49907 deny  !verify = recipient/callout=use_postmaster
49908 </literallayout>
49909 <para>
49910 <indexterm role="concept">
49911 <primary><varname>$qualify_domain</varname></primary>
49912 </indexterm>
49913 It causes a non-empty postmaster address to be used in the MAIL command when
49914 performing the callout for the recipient, and also for a <quote>random</quote> check if
49915 that is configured. The local part of the address is <literal>postmaster</literal> and the
49916 domain is the contents of <varname>$qualify_domain</varname>.
49917 </para>
49918 </listitem></varlistentry>
49919 <varlistentry>
49920 <term><emphasis role="bold">use_sender</emphasis></term>
49921 <listitem>
49922 <para>
49923 This option applies to recipient callouts only. For example:
49924 </para>
49925 <literallayout class="monospaced">
49926 require  verify = recipient/callout=use_sender
49927 </literallayout>
49928 <para>
49929 It causes the message&#x2019;s actual sender address to be used in the MAIL
49930 command when performing the callout, instead of an empty address. There is no
49931 need to use this option unless you know that the called hosts make use of the
49932 sender when checking recipients. If used indiscriminately, it reduces the
49933 usefulness of callout caching.
49934 </para>
49935 </listitem></varlistentry>
49936 </variablelist>
49937 <para>
49938 If you use any of the parameters that set a non-empty sender for the MAIL
49939 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
49940 <option>use_sender</option>), you should think about possible loops. Recipient checking is
49941 usually done between two hosts that are under the same management, and the host
49942 that receives the callouts is not normally configured to do callouts itself.
49943 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
49944 these circumstances.
49945 </para>
49946 <para>
49947 However, if you use a non-empty sender address for a callout to an arbitrary
49948 host, there is the likelihood that the remote host will itself initiate a
49949 callout check back to your host. As it is checking what appears to be a message
49950 sender, it is likely to use an empty address in MAIL, thus avoiding a
49951 callout loop. However, to be on the safe side it would be best to set up your
49952 own ACLs so that they do not do sender verification checks when the recipient
49953 is the address you use for header sender or postmaster callout checking.
49954 </para>
49955 <para>
49956 Another issue to think about when using non-empty senders for callouts is
49957 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
49958 by the sender/recipient combination; thus, for any given recipient, many more
49959 actual callouts are performed than when an empty sender or postmaster is used.
49960 </para>
49961 </section>
49962 <section id="SECTcallvercache">
49963 <title>Callout caching</title>
49964 <para>
49965 <indexterm role="concept">
49966 <primary>hints database</primary>
49967 <secondary>callout cache</secondary>
49968 </indexterm>
49969 <indexterm role="concept">
49970 <primary>callout</primary>
49971 <secondary>caching</secondary>
49972 </indexterm>
49973 <indexterm role="concept">
49974 <primary>caching</primary>
49975 <secondary>callout</secondary>
49976 </indexterm>
49977 Exim caches the results of callouts in order to reduce the amount of resources
49978 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
49979 option. A hints database called <quote>callout</quote> is used for the cache. Two
49980 different record types are used: one records the result of a callout check for
49981 a specific address, and the other records information that applies to the
49982 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
49983 </para>
49984 <para>
49985 When an original callout fails, a detailed SMTP error message is given about
49986 the failure. However, for subsequent failures use the cache data, this message
49987 is not available.
49988 </para>
49989 <para>
49990 The expiry times for negative and positive address cache records are
49991 independent, and can be set by the global options <option>callout_negative_expire</option>
49992 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
49993 </para>
49994 <para>
49995 If a host gives a negative response to an SMTP connection, or rejects any
49996 commands up to and including
49997 </para>
49998 <literallayout class="monospaced">
49999 MAIL FROM:&lt;&gt;
50000 </literallayout>
50001 <para>
50002 (but not including the MAIL command with a non-empty address),
50003 any callout attempt is bound to fail. Exim remembers such failures in a
50004 domain cache record, which it uses to fail callouts for the domain without
50005 making new connections, until the domain record times out. There are two
50006 separate expiry times for domain cache records:
50007 <option>callout_domain_negative_expire</option> (default 3h) and
50008 <option>callout_domain_positive_expire</option> (default 7d).
50009 </para>
50010 <para>
50011 Domain records expire when the negative expiry time is reached if callouts
50012 cannot be made for the domain, or if the postmaster check failed.
50013 Otherwise, they expire when the positive expiry time is reached. This
50014 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
50015 will eventually be noticed.
50016 </para>
50017 <para>
50018 The callout caching mechanism is based on the domain of the address that is
50019 being tested. If the domain routes to several hosts, it is assumed that their
50020 behaviour will be the same.
50021 </para>
50022 </section>
50023 <section id="SECTsenaddver">
50024 <title>Sender address verification reporting</title>
50025 <para>
50026 <indexterm role="concept">
50027 <primary>verifying</primary>
50028 <secondary>suppressing error details</secondary>
50029 </indexterm>
50030 See section <xref linkend="SECTaddressverification"/> for a general discussion of
50031 verification. When sender verification fails in an ACL, the details of the
50032 failure are given as additional output lines before the 550 response to the
50033 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
50034 you might see:
50035 </para>
50036 <literallayout class="monospaced">
50037 MAIL FROM:&lt;xyz@abc.example&gt;
50038 250 OK
50039 RCPT TO:&lt;pqr@def.example&gt;
50040 550-Verification failed for &lt;xyz@abc.example&gt;
50041 550-Called:   192.168.34.43
50042 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
50043 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
50044 550 Sender verification failed
50045 </literallayout>
50046 <para>
50047 If more than one RCPT command fails in the same way, the details are given
50048 only for the first of them. However, some administrators do not want to send
50049 out this much information. You can suppress the details by adding
50050 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
50051 example:
50052 </para>
50053 <literallayout class="monospaced">
50054 verify = sender/no_details
50055 </literallayout>
50056 </section>
50057 <section id="SECTredirwhilveri">
50058 <title>Redirection while verifying</title>
50059 <para>
50060 <indexterm role="concept">
50061 <primary>verifying</primary>
50062 <secondary>redirection while</secondary>
50063 </indexterm>
50064 <indexterm role="concept">
50065 <primary>address redirection</primary>
50066 <secondary>while verifying</secondary>
50067 </indexterm>
50068 A dilemma arises when a local address is redirected by aliasing or forwarding
50069 during verification: should the generated addresses themselves be verified,
50070 or should the successful expansion of the original address be enough to verify
50071 it? By default, Exim takes the following pragmatic approach:
50072 </para>
50073 <itemizedlist>
50074 <listitem>
50075 <para>
50076 When an incoming address is redirected to just one child address, verification
50077 continues with the child address, and if that fails to verify, the original
50078 verification also fails.
50079 </para>
50080 </listitem>
50081 <listitem>
50082 <para>
50083 When an incoming address is redirected to more than one child address,
50084 verification does not continue. A success result is returned.
50085 </para>
50086 </listitem>
50087 </itemizedlist>
50088 <para>
50089 This seems the most reasonable behaviour for the common use of aliasing as a
50090 way of redirecting different local parts to the same mailbox. It means, for
50091 example, that a pair of alias entries of the form
50092 </para>
50093 <literallayout class="monospaced">
50094 A.Wol:   aw123
50095 aw123:   :fail: Gone away, no forwarding address
50096 </literallayout>
50097 <para>
50098 work as expected, with both local parts causing verification failure. When a
50099 redirection generates more than one address, the behaviour is more like a
50100 mailing list, where the existence of the alias itself is sufficient for
50101 verification to succeed.
50102 </para>
50103 <para>
50104 It is possible, however, to change the default behaviour so that all successful
50105 redirections count as successful verifications, however many new addresses are
50106 generated. This is specified by the <option>success_on_redirect</option> verification
50107 option. For example:
50108 </para>
50109 <literallayout class="monospaced">
50110 require verify = recipient/success_on_redirect/callout=10s
50111 </literallayout>
50112 <para>
50113 In this example, verification succeeds if a router generates a new address, and
50114 the callout does not occur, because no address was routed to a remote host.
50115 </para>
50116 <para revisionflag="changed">
50117 When verification is being tested via the <option>-bv</option> option, the treatment of
50118 redirections is as just described, unless the <option>-v</option> or any debugging option is
50119 also specified. In that case, full verification is done for every generated
50120 address and a report is output for each of them.
50121 </para>
50122 </section>
50123 <section id="SECTverifyCSA">
50124 <title>Client SMTP authorization (CSA)</title>
50125 <para>
50126 <indexterm role="concept">
50127 <primary>CSA</primary>
50128 <secondary>verifying</secondary>
50129 </indexterm>
50130 Client SMTP Authorization is a system that allows a site to advertise
50131 which machines are and are not permitted to send email. This is done by placing
50132 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
50133 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
50134 Authorization checks in Exim are performed by the ACL condition:
50135 </para>
50136 <literallayout class="monospaced">
50137 verify = csa
50138 </literallayout>
50139 <para>
50140 This fails if the client is not authorized. If there is a DNS problem, or if no
50141 valid CSA SRV record is found, or if the client is authorized, the condition
50142 succeeds. These three cases can be distinguished using the expansion variable
50143 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
50144 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
50145 be likely to cause problems for legitimate email.
50146 </para>
50147 <para>
50148 The error messages produced by the CSA code include slightly more
50149 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
50150 looking up the CSA SRV record, or problems looking up the CSA target
50151 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
50152 </para>
50153 <itemizedlist>
50154 <listitem>
50155 <para>
50156 The client&#x2019;s host name is explicitly not authorized.
50157 </para>
50158 </listitem>
50159 <listitem>
50160 <para>
50161 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
50162 </para>
50163 </listitem>
50164 <listitem>
50165 <para>
50166 The client&#x2019;s host name is authorized but it has no valid target IP addresses
50167 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
50168 </para>
50169 </listitem>
50170 <listitem>
50171 <para>
50172 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
50173 that all subdomains must be explicitly authorized.
50174 </para>
50175 </listitem>
50176 </itemizedlist>
50177 <para>
50178 The <option>csa</option> verification condition can take an argument which is the domain to
50179 use for the DNS query. The default is:
50180 </para>
50181 <literallayout class="monospaced">
50182 verify = csa/$sender_helo_name
50183 </literallayout>
50184 <para>
50185 This implementation includes an extension to CSA. If the query domain
50186 is an address literal such as [192.0.2.95], or if it is a bare IP
50187 address, Exim searches for CSA SRV records in the reverse DNS as if
50188 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
50189 meaningful to say:
50190 </para>
50191 <literallayout class="monospaced">
50192 verify = csa/$sender_host_address
50193 </literallayout>
50194 <para>
50195 In fact, this is the check that Exim performs if the client does not say HELO.
50196 This extension can be turned off by setting the main configuration option
50197 <option>dns_csa_use_reverse</option> to be false.
50198 </para>
50199 <para>
50200 If a CSA SRV record is not found for the domain itself, a search
50201 is performed through its parent domains for a record which might be
50202 making assertions about subdomains. The maximum depth of this search is limited
50203 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
50204 default. Exim does not look for CSA SRV records in a top level domain, so the
50205 default settings handle HELO domains as long as seven
50206 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
50207 of legitimate HELO domains.
50208 </para>
50209 <para>
50210 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
50211 direct SRV lookups, this is not sufficient because of the extra parent domain
50212 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
50213 addresses into lookups in the reverse DNS space. The result of a successful
50214 lookup such as:
50215 </para>
50216 <literallayout class="monospaced">
50217 ${lookup dnsdb {csa=$sender_helo_name}}
50218 </literallayout>
50219 <para>
50220 has two space-separated fields: an authorization code and a target host name.
50221 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
50222 authorization required but absent, or <quote>?</quote> for unknown.
50223 </para>
50224 </section>
50225 <section id="SECTverifyPRVS">
50226 <title>Bounce address tag validation</title>
50227 <para>
50228 <indexterm role="concept">
50229 <primary>BATV</primary>
50230 <secondary>verifying</secondary>
50231 </indexterm>
50232 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
50233 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
50234 Genuine incoming bounce messages should therefore always be addressed to
50235 recipients that have a valid tag. This scheme is a way of detecting unwanted
50236 bounce messages caused by sender address forgeries (often called <quote>collateral
50237 spam</quote>), because the recipients of such messages do not include valid tags.
50238 </para>
50239 <para>
50240 There are two expansion items to help with the implementation of the BATV
50241 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
50242 the original envelope sender address by using a simple key to add a hash of the
50243 address and some time-based randomizing information. The <option>prvs</option> expansion
50244 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
50245 The syntax of these expansion items is described in section
50246 <xref linkend="SECTexpansionitems"/>.
50247 </para>
50248 <para>
50249 As an example, suppose the secret per-address keys are stored in an MySQL
50250 database. A query to look up the key for an address could be defined as a macro
50251 like this:
50252 </para>
50253 <literallayout class="monospaced">
50254 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
50255                 WHERE sender='${quote_mysql:$prvscheck_address}'\
50256                 }{$value}}
50257 </literallayout>
50258 <para>
50259 Suppose also that the senders who make use of BATV are defined by an address
50260 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
50261 use this:
50262 </para>
50263 <literallayout class="monospaced">
50264 # Bounces: drop unsigned addresses for BATV senders
50265 deny message = This address does not send an unsigned reverse path.
50266      senders = :
50267      recipients = +batv_senders
50268
50269 # Bounces: In case of prvs-signed address, check signature.
50270 deny message = Invalid reverse path signature.
50271      senders = :
50272      condition  = ${prvscheck {$local_part@$domain}\
50273                   {PRVSCHECK_SQL}{1}}
50274      !condition = $prvscheck_result
50275 </literallayout>
50276 <para>
50277 The first statement rejects recipients for bounce messages that are addressed
50278 to plain BATV sender addresses, because it is known that BATV senders do not
50279 send out messages with plain sender addresses. The second statement rejects
50280 recipients that are prvs-signed, but with invalid signatures (either because
50281 the key is wrong, or the signature has timed out).
50282 </para>
50283 <para>
50284 A non-prvs-signed address is not rejected by the second statement, because the
50285 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
50286 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
50287 the first argument is a syntactically valid prvs-signed address, the yield is
50288 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
50289 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
50290 of the checks (empty for failure, <quote>1</quote> for success).
50291 </para>
50292 <para>
50293 There are two more issues you must consider when implementing prvs-signing.
50294 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
50295 ACLs. A prvs-signed address contains a slash character, but the default Exim
50296 configuration contains this statement in the RCPT ACL:
50297 </para>
50298 <literallayout class="monospaced">
50299 deny    message       = Restricted characters in address
50300         domains       = +local_domains
50301         local_parts   = ^[.] : ^.*[@%!/|]
50302 </literallayout>
50303 <para>
50304 This is a conservative rule that blocks local parts that contain slashes. You
50305 should remove the slash in the last line.
50306 </para>
50307 <para>
50308 Secondly, you have to ensure that the routers accept prvs-signed addresses and
50309 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
50310 router to remove the signature with a configuration along these lines:
50311 </para>
50312 <literallayout class="monospaced">
50313 batv_redirect:
50314   driver = redirect
50315   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
50316 </literallayout>
50317 <para>
50318 This works because, if the third argument of <option>prvscheck</option> is empty, the result
50319 of the expansion of a prvs-signed address is the decoded value of the original
50320 address. This router should probably be the first of your routers that handles
50321 local addresses.
50322 </para>
50323 <para>
50324 To create BATV-signed addresses in the first place, a transport of this form
50325 can be used:
50326 </para>
50327 <literallayout class="monospaced">
50328 external_smtp_batv:
50329   driver = smtp
50330   return_path = ${prvs {$return_path} \
50331                        {${lookup mysql{SELECT \
50332                        secret FROM batv_prvs WHERE \
50333                        sender='${quote_mysql:$sender_address}'} \
50334                        {$value}fail}}}
50335 </literallayout>
50336 <para>
50337 If no key can be found for the existing return path, no signing takes place.
50338 </para>
50339 </section>
50340 <section id="SECTrelaycontrol">
50341 <title>Using an ACL to control relaying</title>
50342 <para>
50343 <indexterm role="concept">
50344 <primary>access control lists (ACLs)</primary>
50345 <secondary>relay control</secondary>
50346 </indexterm>
50347 <indexterm role="concept">
50348 <primary>relaying</primary>
50349 <secondary>control by ACL</secondary>
50350 </indexterm>
50351 <indexterm role="concept">
50352 <primary>policy control</primary>
50353 <secondary>relay control</secondary>
50354 </indexterm>
50355 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
50356 delivers it directly to another host as a result of a remote address contained
50357 within it. Redirecting a local address via an alias or forward file and then
50358 passing the message on to another host is not relaying,
50359 <indexterm role="concept">
50360 <primary><quote>percent hack</quote></primary>
50361 </indexterm>
50362 but a redirection as a result of the <quote>percent hack</quote> is.
50363 </para>
50364 <para>
50365 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
50366 A host which is acting as a gateway or an MX backup is concerned with incoming
50367 relaying from arbitrary hosts to a specific set of domains. On the other hand,
50368 a host which is acting as a smart host for a number of clients is concerned
50369 with outgoing relaying from those clients to the Internet at large. Often the
50370 same host is fulfilling both functions,
50371 but in principle these two kinds of relaying are entirely independent. What is
50372 not wanted is the transmission of mail from arbitrary remote hosts through your
50373 system to arbitrary domains.
50374 </para>
50375 <para>
50376 You can implement relay control by means of suitable statements in the ACL that
50377 runs for each RCPT command. For convenience, it is often easiest to use
50378 Exim&#x2019;s named list facility to define the domains and hosts involved. For
50379 example, suppose you want to do the following:
50380 </para>
50381 <itemizedlist>
50382 <listitem>
50383 <para>
50384 Deliver a number of domains to mailboxes on the local host (or process them
50385 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
50386 <emphasis>my.dom2.example</emphasis>.
50387 </para>
50388 </listitem>
50389 <listitem>
50390 <para>
50391 Relay mail for a number of other domains for which you are the secondary MX.
50392 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
50393 </para>
50394 </listitem>
50395 <listitem>
50396 <para>
50397 Relay mail from the hosts on your local LAN, to whatever domains are involved.
50398 Suppose your LAN is 192.168.45.0/24.
50399 </para>
50400 </listitem>
50401 </itemizedlist>
50402 <para>
50403 In the main part of the configuration, you put the following definitions:
50404 </para>
50405 <literallayout class="monospaced">
50406 domainlist local_domains = my.dom1.example : my.dom2.example
50407 domainlist relay_domains = friend1.example : friend2.example
50408 hostlist   relay_hosts   = 192.168.45.0/24
50409 </literallayout>
50410 <para>
50411 Now you can use these definitions in the ACL that is run for every RCPT
50412 command:
50413 </para>
50414 <literallayout class="monospaced">
50415 acl_check_rcpt:
50416   accept domains = +local_domains : +relay_domains
50417   accept hosts   = +relay_hosts
50418 </literallayout>
50419 <para>
50420 The first statement accepts any RCPT command that contains an address in
50421 the local or relay domains. For any other domain, control passes to the second
50422 statement, which accepts the command only if it comes from one of the relay
50423 hosts. In practice, you will probably want to make your ACL more sophisticated
50424 than this, for example, by including sender and recipient verification. The
50425 default configuration includes a more comprehensive example, which is described
50426 in chapter <xref linkend="CHAPdefconfil"/>.
50427 </para>
50428 </section>
50429 <section id="SECTcheralcon">
50430 <title>Checking a relay configuration</title>
50431 <para>
50432 <indexterm role="concept">
50433 <primary>relaying</primary>
50434 <secondary>checking control of</secondary>
50435 </indexterm>
50436 You can check the relay characteristics of your configuration in the same way
50437 that you can test any ACL behaviour for an incoming SMTP connection, by using
50438 the <option>-bh</option> option to run a fake SMTP session with which you interact.
50439 </para>
50440 <para>
50441 For specifically testing for unwanted relaying, the host
50442 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
50443 host from the host on which Exim is running, using the normal telnet port, you
50444 will see a normal telnet connection message and then quite a long delay. Be
50445 patient. The remote host is making an SMTP connection back to your host, and
50446 trying a number of common probes to test for open relay vulnerability. The
50447 results of the tests will eventually appear on your terminal.
50448 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
50449 </para>
50450 </section>
50451 </chapter>
50452
50453 <chapter id="CHAPexiscan">
50454 <title>Content scanning at ACL time</title>
50455 <para>
50456 <indexterm role="concept" id="IIDcosca" class="startofrange">
50457 <primary>content scanning</primary>
50458 <secondary>at ACL time</secondary>
50459 </indexterm>
50460 The extension of Exim to include content scanning at ACL time, formerly known
50461 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
50462 was integrated into the main source for Exim release 4.50, and Tom continues to
50463 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
50464 specification.
50465 </para>
50466 <para>
50467 It is also possible to scan the content of messages at other times. The
50468 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
50469 scanning after all the ACLs have run. A transport filter can be used to scan
50470 messages at delivery time (see the <option>transport_filter</option> option, described in
50471 chapter <xref linkend="CHAPtransportgeneric"/>).
50472 </para>
50473 <para>
50474 If you want to include the ACL-time content-scanning features when you compile
50475 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
50476 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
50477 </para>
50478 <itemizedlist>
50479 <listitem>
50480 <para>
50481 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
50482 for all MIME parts for SMTP and non-SMTP messages, respectively.
50483 </para>
50484 </listitem>
50485 <listitem>
50486 <para>
50487 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
50488 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
50489 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
50490 </para>
50491 </listitem>
50492 <listitem>
50493 <para>
50494 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
50495 of messages, or parts of messages, for debugging purposes.
50496 </para>
50497 </listitem>
50498 <listitem>
50499 <para>
50500 Additional expansion variables that are set in the new ACL and by the new
50501 conditions.
50502 </para>
50503 </listitem>
50504 <listitem>
50505 <para>
50506 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
50507 </para>
50508 </listitem>
50509 </itemizedlist>
50510 <para>
50511 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
50512 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
50513 condition is compiled, in addition to all the other content-scanning features.
50514 </para>
50515 <para>
50516 Content-scanning is continually evolving, and new features are still being
50517 added. While such features are still unstable and liable to incompatible
50518 changes, they are made available in Exim by setting options whose names begin
50519 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
50520 this manual. You can find out about them by reading the file called
50521 <filename>doc/experimental.txt</filename>.
50522 </para>
50523 <para>
50524 All the content-scanning facilites work on a MBOX copy of the message that is
50525 temporarily created in a file called:
50526 </para>
50527 <literallayout>
50528 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
50529 </literallayout>
50530 <para>
50531 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
50532 expect an MBOX-like structure inside that file. The file is created when the
50533 first content scanning facility is called. Subsequent calls to content
50534 scanning conditions open the same file again. The directory is recursively
50535 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
50536 </para>
50537 <literallayout class="monospaced">
50538 control = no_mbox_unspool
50539 </literallayout>
50540 <para>
50541 has been encountered. When the MIME ACL decodes files, they are put into the
50542 same directory by default.
50543 </para>
50544 <section id="SECTscanvirus">
50545 <title>Scanning for viruses</title>
50546 <para>
50547 <indexterm role="concept">
50548 <primary>virus scanning</primary>
50549 </indexterm>
50550 <indexterm role="concept">
50551 <primary>content scanning</primary>
50552 <secondary>for viruses</secondary>
50553 </indexterm>
50554 <indexterm role="concept">
50555 <primary>content scanning</primary>
50556 <secondary>the <option>malware</option> condition</secondary>
50557 </indexterm>
50558 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
50559 It supports a <quote>generic</quote> interface to scanners called via the shell, and
50560 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
50561 in memory and thus are much faster.
50562 </para>
50563 <para>
50564 <indexterm role="concept">
50565 <primary><option>av_scanner</option></primary>
50566 </indexterm>
50567 You can set the <option>av_scanner</option> option in first part of the Exim configuration
50568 file to specify which scanner to use, together with any additional options that
50569 are needed. The basic syntax is as follows:
50570 </para>
50571 <literallayout>
50572 <literal>av_scanner = &lt;</literal><emphasis>scanner-type</emphasis><literal>&gt;:&lt;</literal><emphasis>option1</emphasis><literal>&gt;:&lt;</literal><emphasis>option2</emphasis><literal>&gt;:[...]</literal>
50573 </literallayout>
50574 <para>
50575 If you do not set <option>av_scanner</option>, it defaults to
50576 </para>
50577 <literallayout class="monospaced">
50578 av_scanner = sophie:/var/run/sophie
50579 </literallayout>
50580 <para>
50581 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
50582 before use. The following scanner types are supported in this release:
50583 </para>
50584 <variablelist>
50585 <varlistentry>
50586 <term><option>aveserver</option></term>
50587 <listitem>
50588 <para>
50589 <indexterm role="concept">
50590 <primary>virus scanners</primary>
50591 <secondary>Kaspersky</secondary>
50592 </indexterm>
50593 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
50594 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
50595 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
50596 example:
50597 </para>
50598 <literallayout class="monospaced">
50599 av_scanner = aveserver:/var/run/aveserver
50600 </literallayout>
50601 </listitem></varlistentry>
50602 <varlistentry>
50603 <term><option>clamd</option></term>
50604 <listitem>
50605 <para>
50606 <indexterm role="concept">
50607 <primary>virus scanners</primary>
50608 <secondary>clamd</secondary>
50609 </indexterm>
50610 This daemon-type scanner is GPL and free. You can get it at
50611 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
50612 unpack MIME containers, so it used to be recommended to unpack MIME attachments
50613 in the MIME ACL. This no longer believed to be necessary. One option is
50614 required: either the path and name of a UNIX socket file, or a hostname or IP
50615 number, and a port, separated by space, as in the second of these examples:
50616 </para>
50617 <literallayout class="monospaced">
50618 av_scanner = clamd:/opt/clamd/socket
50619 av_scanner = clamd:192.168.2.100 1234
50620 </literallayout>
50621 <para>
50622 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
50623 contributing the code for this scanner.
50624 </para>
50625 </listitem></varlistentry>
50626 <varlistentry>
50627 <term><option>cmdline</option></term>
50628 <listitem>
50629 <para>
50630 <indexterm role="concept">
50631 <primary>virus scanners</primary>
50632 <secondary>command line interface</secondary>
50633 </indexterm>
50634 This is the keyword for the generic command line scanner interface. It can be
50635 used to attach virus scanners that are invoked from the shell. This scanner
50636 type takes 3 mandatory options:
50637 </para>
50638 <orderedlist numeration="arabic">
50639 <listitem>
50640 <para>
50641 The full path and name of the scanner binary, with all command line options,
50642 and a placeholder (<literal>%s</literal>) for the directory to scan.
50643 </para>
50644 </listitem>
50645 <listitem>
50646 <para>
50647 A regular expression to match against the STDOUT and STDERR output of the
50648 virus scanner. If the expression matches, a virus was found. You must make
50649 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
50650 the <quote>trigger</quote> expression.
50651 </para>
50652 </listitem>
50653 <listitem>
50654 <para>
50655 Another regular expression, containing exactly one pair of parentheses, to
50656 match the name of the virus found in the scanners output. This is called the
50657 <quote>name</quote> expression.
50658 </para>
50659 </listitem>
50660 </orderedlist>
50661 <para>
50662 For example, Sophos Sweep reports a virus on a line like this:
50663 </para>
50664 <literallayout class="monospaced">
50665 Virus 'W32/Magistr-B' found in file ./those.bat
50666 </literallayout>
50667 <para revisionflag="changed">
50668 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
50669 name expression, we want to extract the W32/Magistr-B string, so we can match
50670 for the single quotes left and right of it. Altogether, this makes the
50671 configuration setting:
50672 </para>
50673 <literallayout class="monospaced" revisionflag="changed">
50674 av_scanner = cmdline:\
50675              /path/to/sweep -ss -all -rec -archive %s:\
50676              found in file:'(.+)'
50677 </literallayout>
50678 </listitem></varlistentry>
50679 <varlistentry revisionflag="changed">
50680 <term><option>drweb</option></term>
50681 <listitem>
50682 <para revisionflag="changed">
50683 <indexterm role="concept">
50684 <primary>virus scanners</primary>
50685 <secondary>DrWeb</secondary>
50686 </indexterm>
50687 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
50688 argument, either a full path to a UNIX socket, or an IP address and port
50689 separated by white space, as in these examples:
50690 </para>
50691 <literallayout class="monospaced" revisionflag="changed">
50692 av_scanner = drweb:/var/run/drwebd.sock
50693 av_scanner = drweb:192.168.2.20 31337
50694 </literallayout>
50695 <para revisionflag="changed">
50696 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
50697 is used. Thanks to Alex Miller for contributing the code for this scanner.
50698 </para>
50699 </listitem></varlistentry>
50700 <varlistentry revisionflag="changed">
50701 <term><option>fsecure</option></term>
50702 <listitem>
50703 <para revisionflag="changed">
50704 <indexterm role="concept">
50705 <primary>virus scanners</primary>
50706 <secondary>F-Secure</secondary>
50707 </indexterm>
50708 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
50709 argument which is the path to a UNIX socket. For example:
50710 </para>
50711 <literallayout class="monospaced" revisionflag="changed">
50712 av_scanner = fsecure:/path/to/.fsav
50713 </literallayout>
50714 <para revisionflag="changed">
50715 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
50716 Thelmen for contributing the code for this scanner.
50717 </para>
50718 </listitem></varlistentry>
50719 <varlistentry revisionflag="changed">
50720 <term><option>kavdaemon</option></term>
50721 <listitem>
50722 <para revisionflag="changed">
50723 <indexterm role="concept">
50724 <primary>virus scanners</primary>
50725 <secondary>Kaspersky</secondary>
50726 </indexterm>
50727 This is the scanner daemon of Kaspersky Version 4. This version of the
50728 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
50729 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
50730 For example:
50731 </para>
50732 <literallayout class="monospaced" revisionflag="changed">
50733 av_scanner = kavdaemon:/opt/AVP/AvpCtl
50734 </literallayout>
50735 <para revisionflag="changed">
50736 The default path is <filename>/var/run/AvpCtl</filename>.
50737 </para>
50738 </listitem></varlistentry>
50739 <varlistentry revisionflag="changed">
50740 <term><option>mksd</option></term>
50741 <listitem>
50742 <para revisionflag="changed">
50743 <indexterm role="concept">
50744 <primary>virus scanners</primary>
50745 <secondary>mksd</secondary>
50746 </indexterm>
50747 This is a daemon type scanner that is aimed mainly at Polish users, though some
50748 parts of documentation are now available in English. You can get it at
50749 <emphasis role="bold"><ulink url="http://linux.mks.com.pl/">http://linux.mks.com.pl/</ulink></emphasis>. The only option for this scanner type is
50750 the maximum number of processes used simultaneously to scan the attachments,
50751 provided that the demime facility is employed and also provided that mksd has
50752 been run with at least the same number of child processes. For example:
50753 </para>
50754 <literallayout class="monospaced" revisionflag="changed">
50755 av_scanner = mksd:2
50756 </literallayout>
50757 <para revisionflag="changed">
50758 You can safely omit this option (the default value is 1).
50759 </para>
50760 </listitem></varlistentry>
50761 <varlistentry revisionflag="changed">
50762 <term><option>sophie</option></term>
50763 <listitem>
50764 <para revisionflag="changed">
50765 <indexterm role="concept">
50766 <primary>virus scanners</primary>
50767 <secondary>Sophos and Sophie</secondary>
50768 </indexterm>
50769 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
50770 You can get Sophie at <emphasis role="bold"><ulink url="http://www.clanfield.info/sophie/">http://www.clanfield.info/sophie/</ulink></emphasis>. The only option
50771 for this scanner type is the path to the UNIX socket that Sophie uses for
50772 client communication. For example:
50773 </para>
50774 <literallayout class="monospaced" revisionflag="changed">
50775 av_scanner = sophie:/tmp/sophie
50776 </literallayout>
50777 <para revisionflag="changed">
50778 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
50779 the option.
50780 </para>
50781 </listitem></varlistentry>
50782 </variablelist>
50783 <para revisionflag="changed">
50784 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
50785 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
50786 ACL.
50787 </para>
50788 <para revisionflag="changed">
50789 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
50790 makes it possible to use different scanners. See further below for an example.
50791 The <option>malware</option> condition caches its results, so when you use it multiple times
50792 for the same message, the actual scanning process is only carried out once.
50793 However, using expandable items in <option>av_scanner</option> disables this caching, in
50794 which case each use of the <option>malware</option> condition causes a new scan of the
50795 message.
50796 </para>
50797 <para revisionflag="changed">
50798 The <option>malware</option> condition takes a right-hand argument that is expanded before
50799 use. It can then be one of
50800 </para>
50801 <itemizedlist revisionflag="changed">
50802 <listitem>
50803 <para revisionflag="changed">
50804 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
50805 The condition succeeds if a virus was found, and fail otherwise. This is the
50806 recommended usage.
50807 </para>
50808 </listitem>
50809 <listitem>
50810 <para revisionflag="changed">
50811 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
50812 the condition fails immediately.
50813 </para>
50814 </listitem>
50815 <listitem>
50816 <para revisionflag="changed">
50817 A regular expression, in which case the message is scanned for viruses. The
50818 condition succeeds if a virus is found and its name matches the regular
50819 expression. This allows you to take special actions on certain types of virus.
50820 </para>
50821 </listitem>
50822 </itemizedlist>
50823 <para revisionflag="changed">
50824 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
50825 even if there is a problem with the virus scanner. Otherwise, such a problem
50826 causes the ACL to defer.
50827 </para>
50828 <para revisionflag="changed">
50829 <indexterm role="concept">
50830 <primary><varname>$malware_name</varname></primary>
50831 </indexterm>
50832 When a virus is found, the condition sets up an expansion variable called
50833 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
50834 <option>message</option> modifier that specifies the error returned to the sender, and/or in
50835 logging data.
50836 </para>
50837 <para revisionflag="changed">
50838 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
50839 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
50840 <option>malware</option> condition.
50841 </para>
50842 <para revisionflag="changed">
50843 Here is a very simple scanning example:
50844 </para>
50845 <literallayout class="monospaced" revisionflag="changed">
50846 deny message = This message contains malware ($malware_name)
50847      demime = *
50848      malware = *
50849 </literallayout>
50850 <para revisionflag="changed">
50851 The next example accepts messages when there is a problem with the scanner:
50852 </para>
50853 <literallayout class="monospaced" revisionflag="changed">
50854 deny message = This message contains malware ($malware_name)
50855      demime = *
50856      malware = */defer_ok
50857 </literallayout>
50858 <para revisionflag="changed">
50859 The next example shows how to use an ACL variable to scan with both sophie and
50860 aveserver. It assumes you have set:
50861 </para>
50862 <literallayout class="monospaced" revisionflag="changed">
50863 av_scanner = $acl_m0
50864 </literallayout>
50865 <para revisionflag="changed">
50866 in the main Exim configuration.
50867 </para>
50868 <literallayout class="monospaced" revisionflag="changed">
50869 deny message = This message contains malware ($malware_name)
50870      set acl_m0 = sophie
50871      malware = *
50872
50873 deny message = This message contains malware ($malware_name)
50874      set acl_m0 = aveserver
50875      malware = *
50876 </literallayout>
50877 </section>
50878 <section id="SECTscanspamass" revisionflag="changed">
50879 <title>Scanning with SpamAssassin</title>
50880 <para revisionflag="changed">
50881 <indexterm role="concept">
50882 <primary>content scanning</primary>
50883 <secondary>for spam</secondary>
50884 </indexterm>
50885 <indexterm role="concept">
50886 <primary>spam scanning</primary>
50887 </indexterm>
50888 <indexterm role="concept">
50889 <primary>SpamAssassin</primary>
50890 <secondary>scanning with</secondary>
50891 </indexterm>
50892 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
50893 score and a report for the message. You can get SpamAssassin at
50894 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
50895 installation, you can use CPAN by running:
50896 </para>
50897 <literallayout class="monospaced" revisionflag="changed">
50898 perl -MCPAN -e 'install Mail::SpamAssassin'
50899 </literallayout>
50900 <para revisionflag="changed">
50901 SpamAssassin has its own set of configuration files. Please review its
50902 documentation to see how you can tweak it. The default installation should work
50903 nicely, however.
50904 </para>
50905 <para revisionflag="changed">
50906 <indexterm role="concept">
50907 <primary><option>spamd_address</option></primary>
50908 </indexterm>
50909 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
50910 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
50911 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
50912 part of the Exim configuration as follows (example):
50913 </para>
50914 <literallayout class="monospaced" revisionflag="changed">
50915 spamd_address = 192.168.99.45 387
50916 </literallayout>
50917 <para revisionflag="changed">
50918 You do not need to set this option if you use the default. As of version 2.60,
50919 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
50920 these, supply <option>spamd_address</option> with an absolute file name instead of a
50921 address/port pair:
50922 </para>
50923 <literallayout class="monospaced" revisionflag="changed">
50924 spamd_address = /var/run/spamd_socket
50925 </literallayout>
50926 <para revisionflag="changed">
50927 You can have multiple <option>spamd</option> servers to improve scalability. These can
50928 reside on other hardware reachable over the network. To specify multiple
50929 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
50930 option, separated with colons:
50931 </para>
50932 <literallayout class="monospaced" revisionflag="changed">
50933 spamd_address = 192.168.2.10 783 : \
50934                 192.168.2.11 783 : \
50935                 192.168.2.12 783
50936 </literallayout>
50937 <para revisionflag="changed">
50938 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
50939 fashion. When a server fails to respond to the connection attempt, all other
50940 servers are tried until one succeeds. If no server responds, the <option>spam</option>
50941 condition defers.
50942 </para>
50943 <para revisionflag="changed">
50944 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
50945 multiple <option>spamd</option> servers.
50946 </para>
50947 </section>
50948 <section revisionflag="changed">
50949 <title>Calling SpamAssassin from an Exim ACL</title>
50950 <para revisionflag="changed">
50951 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
50952 </para>
50953 <literallayout class="monospaced" revisionflag="changed">
50954 deny message = This message was classified as SPAM
50955      spam = joe
50956 </literallayout>
50957 <para revisionflag="changed">
50958 The right-hand side of the <option>spam</option> condition specifies a name. This is
50959 relevant if you have set up multiple SpamAssassin profiles. If you do not want
50960 to scan using a specific profile, but rather use the SpamAssassin system-wide
50961 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
50962 However, you must put something on the right-hand side.
50963 </para>
50964 <para revisionflag="changed">
50965 The name allows you to use per-domain or per-user antispam profiles in
50966 principle, but this is not straightforward in practice, because a message may
50967 have multiple recipients, not necessarily all in the same domain. Because the
50968 <option>spam</option> condition has to be called from a DATA ACL in order to be able to
50969 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
50970 are not set.
50971 </para>
50972 <para revisionflag="changed">
50973 The right-hand side of the <option>spam</option> condition is expanded before being used, so
50974 you can put lookups or conditions there. When the right-hand side evaluates to
50975 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
50976 </para>
50977 <para>
50978 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
50979 large ones may cause significant performance degredation. As most spam messages
50980 are quite small, it is recommended that you do not scan the big ones. For
50981 example:
50982 </para>
50983 <literallayout class="monospaced">
50984 deny message = This message was classified as SPAM
50985      condition = ${if &lt; {$message_size}{10K}}
50986      spam = nobody
50987 </literallayout>
50988 <para>
50989 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
50990 SpamAssassin profile has been matched or exceeded. If you want to use the
50991 <option>spam</option> condition for its side effects (see the variables below), you can make
50992 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
50993 </para>
50994 <para>
50995 <indexterm role="concept">
50996 <primary>spam scanning</primary>
50997 <secondary>returned variables</secondary>
50998 </indexterm>
50999 When the <option>spam</option> condition is run, it sets up a number of expansion
51000 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
51001 within ACLs; their values are not retained with the message and so cannot be
51002 used at delivery time.
51003 </para>
51004 <variablelist>
51005 <varlistentry>
51006 <term><varname>$spam_score</varname></term>
51007 <listitem>
51008 <para>
51009 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
51010 for inclusion in log or reject messages.
51011 </para>
51012 </listitem></varlistentry>
51013 <varlistentry>
51014 <term><varname>$spam_score_int</varname></term>
51015 <listitem>
51016 <para>
51017 The spam score of the message, multiplied by ten, as an integer value. For
51018 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
51019 conditions. This variable is special; its value is saved with the message, and
51020 written to Exim&#x2019;s spool file. This means that it can be used during the whole
51021 life of the message on your Exim system, in particular, in routers or
51022 transports during the later delivery phase.
51023 </para>
51024 </listitem></varlistentry>
51025 <varlistentry>
51026 <term><varname>$spam_bar</varname></term>
51027 <listitem>
51028 <para>
51029 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
51030 integer part of the spam score value. A spam score of 4.4 would have a
51031 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
51032 headers, since MUAs can match on such strings.
51033 </para>
51034 </listitem></varlistentry>
51035 <varlistentry>
51036 <term><varname>$spam_report</varname></term>
51037 <listitem>
51038 <para>
51039 A multiline text table, containing the full SpamAssassin report for the
51040 message. Useful for inclusion in headers or reject messages.
51041 </para>
51042 </listitem></varlistentry>
51043 </variablelist>
51044 <para>
51045 The <option>spam</option> condition caches its results. If you call it again with the same
51046 user name, it does not scan again, but rather returns the same values as
51047 before.
51048 </para>
51049 <para>
51050 The <option>spam</option> condition returns DEFER if there is any error while running the
51051 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
51052 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
51053 the spam condition, like this:
51054 </para>
51055 <literallayout class="monospaced">
51056 deny message = This message was classified as SPAM
51057      spam    = joe/defer_ok
51058 </literallayout>
51059 <para>
51060 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
51061 </para>
51062 <para>
51063 Here is a longer, commented example of the use of the <option>spam</option>
51064 condition:
51065 </para>
51066 <literallayout class="monospaced">
51067 # put headers in all messages (no matter if spam or not)
51068 warn  spam = nobody:true
51069       add_header = X-Spam-Score: $spam_score ($spam_bar)
51070       add_header = X-Spam-Report: $spam_report
51071
51072 # add second subject line with *SPAM* marker when message
51073 # is over threshold
51074 warn  spam = nobody
51075       add_header = Subject: *SPAM* $h_Subject:
51076
51077 # reject spam at high scores (&gt; 12)
51078 deny  message = This message scored $spam_score spam points.
51079       spam = nobody:true
51080       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
51081 </literallayout>
51082 </section>
51083 <section id="SECTscanmimepart">
51084 <title>Scanning MIME parts</title>
51085 <para>
51086 <indexterm role="concept">
51087 <primary>content scanning</primary>
51088 <secondary>MIME parts</secondary>
51089 </indexterm>
51090 <indexterm role="concept">
51091 <primary>MIME content scanning</primary>
51092 </indexterm>
51093 <indexterm role="concept">
51094 <primary><option>acl_smtp_mime</option></primary>
51095 </indexterm>
51096 <indexterm role="concept">
51097 <primary><option>acl_not_smtp_mime</option></primary>
51098 </indexterm>
51099 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
51100 each MIME part of an SMTP message, including multipart types, in the sequence
51101 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
51102 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
51103 options may both refer to the same ACL if you want the same processing in both
51104 cases.
51105 </para>
51106 <para>
51107 These ACLs are called (possibly many times) just before the
51108 <option>acl_smtp_data</option> ACL in the case of an SMTP message, or just before the
51109 <option>acl_not_smtp</option> ACL in the case of a non-SMTP message. However, a MIME ACL
51110 is called only if the message contains a <emphasis>MIME-Version:</emphasis> header line. When a
51111 call to a MIME ACL does not yield <quote>accept</quote>, ACL processing is aborted and the
51112 appropriate result code is sent to the client. In the case of an SMTP message,
51113 the <option>acl_smtp_data</option> ACL is not called when this happens.
51114 </para>
51115 <para>
51116 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
51117 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
51118 condition to match against the raw MIME part. You can also use the
51119 <option>mime_regex</option> condition to match against the decoded MIME part (see section
51120 <xref linkend="SECTscanregex"/>).
51121 </para>
51122 <para>
51123 At the start of a MIME ACL, a number of variables are set from the header
51124 information for the relevant MIME part. These are described below. The contents
51125 of the MIME part are not by default decoded into a disk file except for MIME
51126 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
51127 part into a disk file, you can use the <option>decode</option> modifier. The general syntax
51128 is:
51129 </para>
51130 <literallayout>
51131 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
51132 </literallayout>
51133 <para>
51134 The right hand side is expanded before use. After expansion,
51135 the value can be:
51136 </para>
51137 <orderedlist numeration="arabic">
51138 <listitem>
51139 <para>
51140 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
51141 </para>
51142 </listitem>
51143 <listitem>
51144 <para>
51145 The string <quote>default</quote>. In that case, the file is put in the temporary
51146 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
51147 a sequential file name consisting of the message id and a sequence number. The
51148 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
51149 </para>
51150 </listitem>
51151 <listitem>
51152 <para>
51153 A full path name starting with a slash. If the full name is an existing
51154 directory, it is used as a replacement for the default directory. The filename
51155 is then sequentially assigned. If the path does not exist, it is used as
51156 the full path and file name.
51157 </para>
51158 </listitem>
51159 <listitem>
51160 <para>
51161 If the string does not start with a slash, it is used as the
51162 filename, and the default path is then used.
51163 </para>
51164 </listitem>
51165 </orderedlist>
51166 <para>
51167 You can easily decode a file with its original, proposed filename using
51168 </para>
51169 <literallayout class="monospaced">
51170 decode = $mime_filename
51171 </literallayout>
51172 <para>
51173 However, you should keep in mind that <varname>$mime_filename</varname> might contain
51174 anything. If you place files outside of the default path, they are not
51175 automatically unlinked.
51176 </para>
51177 <para>
51178 For RFC822 attachments (these are messages attached to messages, with a
51179 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
51180 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
51181 variable is set (see below). Attached messages are always decoded to disk
51182 before being checked, and the files are unlinked once the check is done.
51183 </para>
51184 <para>
51185 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
51186 used to match regular expressions against raw and decoded MIME parts,
51187 respectively. They are described in section <xref linkend="SECTscanregex"/>.
51188 </para>
51189 <para>
51190 <indexterm role="concept">
51191 <primary>MIME content scanning</primary>
51192 <secondary>returned variables</secondary>
51193 </indexterm>
51194 The following list describes all expansion variables that are
51195 available in the MIME ACL:
51196 </para>
51197 <variablelist>
51198 <varlistentry>
51199 <term><varname>$mime_boundary</varname></term>
51200 <listitem>
51201 <para>
51202 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
51203 have a boundary string, which is stored in this variable. If the current part
51204 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
51205 contains the empty string.
51206 </para>
51207 </listitem></varlistentry>
51208 <varlistentry>
51209 <term><varname>$mime_charset</varname></term>
51210 <listitem>
51211 <para>
51212 This variable contains the character set identifier, if one was found in the
51213 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
51214 </para>
51215 <literallayout class="monospaced">
51216 us-ascii
51217 gb2312 (Chinese)
51218 iso-8859-1
51219 </literallayout>
51220 <para>
51221 Please note that this value is not normalized, so you should do matches
51222 case-insensitively.
51223 </para>
51224 </listitem></varlistentry>
51225 <varlistentry>
51226 <term><varname>$mime_content_description</varname></term>
51227 <listitem>
51228 <para>
51229 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
51230 header. It can contain a human-readable description of the parts content. Some
51231 implementations repeat the filename for attachments here, but they are usually
51232 only used for display purposes.
51233 </para>
51234 </listitem></varlistentry>
51235 <varlistentry>
51236 <term><varname>$mime_content_disposition</varname></term>
51237 <listitem>
51238 <para>
51239 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
51240 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
51241 </para>
51242 </listitem></varlistentry>
51243 <varlistentry>
51244 <term><varname>$mime_content_id</varname></term>
51245 <listitem>
51246 <para>
51247 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
51248 This is a unique ID that can be used to reference a part from another part.
51249 </para>
51250 </listitem></varlistentry>
51251 <varlistentry>
51252 <term><varname>$mime_content_size</varname></term>
51253 <listitem>
51254 <para>
51255 This variable is set only after the <option>decode</option> modifier (see above) has been
51256 successfully run. It contains the size of the decoded part in kilobytes. The
51257 size is always rounded up to full kilobytes, so only a completely empty part
51258 has a <varname>$mime_content_size</varname> of zero.
51259 </para>
51260 </listitem></varlistentry>
51261 <varlistentry>
51262 <term><varname>$mime_content_transfer_encoding</varname></term>
51263 <listitem>
51264 <para>
51265 This variable contains the normalized content of the
51266 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
51267 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
51268 </para>
51269 </listitem></varlistentry>
51270 <varlistentry>
51271 <term><varname>$mime_content_type</varname></term>
51272 <listitem>
51273 <para>
51274 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
51275 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
51276 are some examples of popular MIME types, as they may appear in this variable:
51277 </para>
51278 <literallayout class="monospaced">
51279 text/plain
51280 text/html
51281 application/octet-stream
51282 image/jpeg
51283 audio/midi
51284 </literallayout>
51285 <para>
51286 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
51287 empty string.
51288 </para>
51289 </listitem></varlistentry>
51290 <varlistentry>
51291 <term><varname>$mime_decoded_filename</varname></term>
51292 <listitem>
51293 <para>
51294 This variable is set only after the <option>decode</option> modifier (see above) has been
51295 successfully run. It contains the full path and file name of the file
51296 containing the decoded data.
51297 </para>
51298 </listitem></varlistentry>
51299 </variablelist>
51300 <para>
51301 <indexterm role="concept">
51302 <primary>RFC 2047</primary>
51303 </indexterm>
51304 </para>
51305 <variablelist>
51306 <varlistentry>
51307 <term><varname>$mime_filename</varname></term>
51308 <listitem>
51309 <para>
51310 This is perhaps the most important of the MIME variables. It contains a
51311 proposed filename for an attachment, if one was found in either the
51312 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
51313 RFC2047 decoded, but no additional sanity checks are done. If no filename was
51314 found, this variable contains the empty string.
51315 </para>
51316 </listitem></varlistentry>
51317 <varlistentry>
51318 <term><varname>$mime_is_coverletter</varname></term>
51319 <listitem>
51320 <para>
51321 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
51322 attached data. It can be used to clamp down on flashy or unneccessarily encoded
51323 content in the cover letter, while not restricting attachments at all.
51324 </para>
51325 <para>
51326 The variable contains 1 (true) for a MIME part believed to be part of the
51327 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
51328 follows:
51329 </para>
51330 <orderedlist numeration="arabic">
51331 <listitem>
51332 <para>
51333 The outermost MIME part of a message is always a cover letter.
51334 </para>
51335 </listitem>
51336 <listitem>
51337 <para>
51338 If a multipart/alternative or multipart/related MIME part is a cover letter,
51339 so are all MIME subparts within that multipart.
51340 </para>
51341 </listitem>
51342 <listitem>
51343 <para>
51344 If any other multipart is a cover letter, the first subpart is a cover letter,
51345 and the rest are attachments.
51346 </para>
51347 </listitem>
51348 <listitem>
51349 <para>
51350 All parts contained within an attachment multipart are attachments.
51351 </para>
51352 </listitem>
51353 </orderedlist>
51354 <para>
51355 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
51356 alternative plain text), while allowing HTML files to be attached. HTML
51357 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
51358 </para>
51359 <literallayout class="monospaced">
51360 deny message = HTML mail is not accepted here
51361 !condition = $mime_is_rfc822
51362 condition = $mime_is_coverletter
51363 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
51364 </literallayout>
51365 </listitem></varlistentry>
51366 <varlistentry>
51367 <term><varname>$mime_is_multipart</varname></term>
51368 <listitem>
51369 <para>
51370 This variable has the value 1 (true) when the current part has the main type
51371 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
51372 Since multipart entities only serve as containers for other parts, you may not
51373 want to carry out specific actions on them.
51374 </para>
51375 </listitem></varlistentry>
51376 <varlistentry>
51377 <term><varname>$mime_is_rfc822</varname></term>
51378 <listitem>
51379 <para>
51380 This variable has the value 1 (true) if the current part is not a part of the
51381 checked message itself, but part of an attached message. Attached message
51382 decoding is fully recursive.
51383 </para>
51384 </listitem></varlistentry>
51385 <varlistentry>
51386 <term><varname>$mime_part_count</varname></term>
51387 <listitem>
51388 <para>
51389 This variable is a counter that is raised for each processed MIME part. It
51390 starts at zero for the very first part (which is usually a multipart). The
51391 counter is per-message, so it is reset when processing RFC822 attachments (see
51392 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
51393 complete, so you can use it in the DATA ACL to determine the number of MIME
51394 parts of a message. For non-MIME messages, this variable contains the value -1.
51395 </para>
51396 </listitem></varlistentry>
51397 </variablelist>
51398 </section>
51399 <section id="SECTscanregex">
51400 <title>Scanning with regular expressions</title>
51401 <para>
51402 <indexterm role="concept">
51403 <primary>content scanning</primary>
51404 <secondary>with regular expressions</secondary>
51405 </indexterm>
51406 <indexterm role="concept">
51407 <primary>regular expressions</primary>
51408 <secondary>content scanning with</secondary>
51409 </indexterm>
51410 You can specify your own custom regular expression matches on the full body of
51411 the message, or on individual MIME parts.
51412 </para>
51413 <para>
51414 The <option>regex</option> condition takes one or more regular expressions as arguments and
51415 matches them against the full message (when called in the DATA ACL) or a raw
51416 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
51417 linewise, with a maximum line length of 32K characters. That means you cannot
51418 have multiline matches with the <option>regex</option> condition.
51419 </para>
51420 <para>
51421 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
51422 to 32K of decoded content (the whole content at once, not linewise). If the
51423 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
51424 is decoded automatically when <option>mime_regex</option> is executed (using default path
51425 and filename values). If the decoded data is larger than  32K, only the first
51426 32K characters are checked.
51427 </para>
51428 <para>
51429 The regular expressions are passed as a colon-separated list. To include a
51430 literal colon, you must double it. Since the whole right-hand side string is
51431 expanded before being used, you must also escape dollar signs and backslashes
51432 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
51433 Here is a simple example that contains two regular expressions:
51434 </para>
51435 <literallayout class="monospaced">
51436 deny message = contains blacklisted regex ($regex_match_string)
51437      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
51438 </literallayout>
51439 <para>
51440 The conditions returns true if any one of the regular expressions matches. The
51441 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
51442 matching regular expression.
51443 </para>
51444 <para>
51445 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
51446 CPU-intensive.
51447 </para>
51448 </section>
51449 <section id="SECTdemimecond">
51450 <title>The demime condition</title>
51451 <para>
51452 <indexterm role="concept">
51453 <primary>content scanning</primary>
51454 <secondary>MIME checking</secondary>
51455 </indexterm>
51456 <indexterm role="concept">
51457 <primary>MIME content scanning</primary>
51458 </indexterm>
51459 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
51460 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
51461 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
51462 ACL functionality, but provides no additional facilities. Please note that this
51463 condition is deprecated and kept only for backward compatibility. You must set
51464 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
51465 use the <option>demime</option> condition.
51466 </para>
51467 <para>
51468 The <option>demime</option> condition unpacks MIME containers in the message. It detects
51469 errors in MIME containers and can match file extensions found in the message
51470 against a list. Using this facility produces files containing the unpacked MIME
51471 parts of the message in the temporary scan directory. If you do antivirus
51472 scanning, it is recommened that you use the <option>demime</option> condition before the
51473 antivirus (<option>malware</option>) condition.
51474 </para>
51475 <para>
51476 On the right-hand side of the <option>demime</option> condition you can pass a
51477 colon-separated list of file extensions that it should match against. For
51478 example:
51479 </para>
51480 <literallayout class="monospaced">
51481 deny message = Found blacklisted file attachment
51482      demime  = vbs:com:bat:pif:prf:lnk
51483 </literallayout>
51484 <para>
51485 If one of the file extensions is found, the condition is true, otherwise it is
51486 false. If there is a temporary error while demimeing (for example, <quote>disk
51487 full</quote>), the condition defers, and the message is temporarily rejected (unless
51488 the condition is on a <option>warn</option> verb).
51489 </para>
51490 <para>
51491 The right-hand side is expanded before being treated as a list, so you can have
51492 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
51493 zero (<quote>0</quote>), no demimeing is done and the condition is false.
51494 </para>
51495 <para>
51496 The <option>demime</option> condition set the following variables:
51497 </para>
51498 <variablelist>
51499 <varlistentry>
51500 <term><varname>$demime_errorlevel</varname></term>
51501 <listitem>
51502 <para>
51503 <indexterm role="concept">
51504 <primary><varname>$demime_errorlevel</varname></primary>
51505 </indexterm>
51506 When an error is detected in a MIME container, this variable contains the
51507 severity of the error, as an integer number. The higher the value, the more
51508 severe the error (the current maximum value is 3). If this variable is unset or
51509 zero, no error occurred.
51510 </para>
51511 </listitem></varlistentry>
51512 <varlistentry>
51513 <term><varname>$demime_reason</varname></term>
51514 <listitem>
51515 <para>
51516 <indexterm role="concept">
51517 <primary><varname>$demime_reason</varname></primary>
51518 </indexterm>
51519 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
51520 human-readable text string describing the MIME error that occurred.
51521 </para>
51522 </listitem></varlistentry>
51523 </variablelist>
51524 <variablelist>
51525 <varlistentry>
51526 <term><varname>$found_extension</varname></term>
51527 <listitem>
51528 <para>
51529 <indexterm role="concept">
51530 <primary><varname>$found_extension</varname></primary>
51531 </indexterm>
51532 When the <option>demime</option> condition is true, this variable contains the file
51533 extension it found.
51534 </para>
51535 </listitem></varlistentry>
51536 </variablelist>
51537 <para>
51538 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
51539 the <option>demime</option> condition, and are not changed on subsequent calls.
51540 </para>
51541 <para>
51542 If you do not want to check for file extensions, but rather use the <option>demime</option>
51543 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
51544 right-hand side value. Here is a more elaborate example of how to use this
51545 facility:
51546 </para>
51547 <literallayout class="monospaced">
51548 # Reject messages with serious MIME container errors
51549 deny  message = Found MIME error ($demime_reason).
51550       demime = *
51551       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
51552
51553 # Reject known virus spreading file extensions.
51554 # Accepting these is pretty much braindead.
51555 deny  message = contains $found_extension file (blacklisted).
51556       demime  = com:vbs:bat:pif:scr
51557
51558 # Freeze .exe and .doc files. Postmaster can
51559 # examine them and eventually thaw them.
51560 deny  log_message = Another $found_extension file.
51561       demime = exe:doc
51562       control = freeze
51563 </literallayout>
51564 <para>
51565 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
51566 </para>
51567 </section>
51568 </chapter>
51569
51570 <chapter id="CHAPlocalscan">
51571 <title>Adding a local scan function to Exim</title>
51572 <titleabbrev>Local scan function</titleabbrev>
51573 <para>
51574 <indexterm role="concept" id="IIDlosca" class="startofrange">
51575 <primary><function>local_scan()</function> function</primary>
51576 <secondary>description of</secondary>
51577 </indexterm>
51578 <indexterm role="concept">
51579 <primary>customizing</primary>
51580 <secondary>input scan using C function</secondary>
51581 </indexterm>
51582 <indexterm role="concept">
51583 <primary>policy control</primary>
51584 <secondary>by local scan function</secondary>
51585 </indexterm>
51586 In these days of email worms, viruses, and ever-increasing spam, some sites
51587 want to apply a lot of checking to messages before accepting them.
51588 </para>
51589 <para>
51590 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
51591 passing messages to external virus and spam scanning software. You can also do
51592 a certain amount in Exim itself through string expansions and the <option>condition</option>
51593 condition in the ACL that runs after the SMTP DATA command or the ACL for
51594 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
51595 </para>
51596 <para>
51597 To allow for further customization to a site&#x2019;s own requirements, there is the
51598 possibility of linking Exim with a private message scanning function, written
51599 in C. If you want to run code that is written in something other than C, you
51600 can of course use a little C stub to call it.
51601 </para>
51602 <para>
51603 The local scan function is run once for every incoming message, at the point
51604 when Exim is just about to accept the message.
51605 It can therefore be used to control non-SMTP messages from local processes as
51606 well as messages arriving via SMTP.
51607 </para>
51608 <para>
51609 Exim applies a timeout to calls of the local scan function, and there is an
51610 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
51611 Zero means <quote>no timeout</quote>.
51612 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
51613 before calling the local scan function, so that the most common types of crash
51614 are caught. If the timeout is exceeded or one of those signals is caught, the
51615 incoming message is rejected with a temporary error if it is an SMTP message.
51616 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
51617 code. The incident is logged on the main and reject logs.
51618 </para>
51619 <section>
51620 <title>Building Exim to use a local scan function</title>
51621 <para>
51622 <indexterm role="concept">
51623 <primary><function>local_scan()</function> function</primary>
51624 <secondary>building Exim to use</secondary>
51625 </indexterm>
51626 To make use of the local scan function feature, you must tell Exim where your
51627 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
51628 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
51629 directory, so you might set
51630 </para>
51631 <literallayout class="monospaced">
51632 LOCAL_SCAN_SOURCE=Local/local_scan.c
51633 </literallayout>
51634 <para>
51635 for example. The function must be called <function>local_scan()</function>. It is called by
51636 Exim after it has received a message, when the success return code is about to
51637 be sent. This is after all the ACLs have been run. The return code from your
51638 function controls whether the message is actually accepted or not. There is a
51639 commented template function (that just accepts the message) in the file
51640 _src/local_scan.c_.
51641 </para>
51642 <para>
51643 If you want to make use of Exim&#x2019;s run time configuration file to set options
51644 for your <function>local_scan()</function> function, you must also set
51645 </para>
51646 <literallayout class="monospaced">
51647 LOCAL_SCAN_HAS_OPTIONS=yes
51648 </literallayout>
51649 <para>
51650 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
51651 </para>
51652 </section>
51653 <section id="SECTapiforloc">
51654 <title>API for local_scan()</title>
51655 <para>
51656 <indexterm role="concept">
51657 <primary><function>local_scan()</function> function</primary>
51658 <secondary>API description</secondary>
51659 </indexterm>
51660 You must include this line near the start of your code:
51661 </para>
51662 <literallayout class="monospaced">
51663 #include "local_scan.h"
51664 </literallayout>
51665 <para>
51666 This header file defines a number of variables and other values, and the
51667 prototype for the function itself. Exim is coded to use unsigned char values
51668 almost exclusively, and one of the things this header defines is a shorthand
51669 for <literal>unsigned char</literal> called <literal>uschar</literal>.
51670 It also contains the following macro definitions, to simplify casting character
51671 strings and pointers to character strings:
51672 </para>
51673 <literallayout class="monospaced">
51674 #define CS   (char *)
51675 #define CCS  (const char *)
51676 #define CSS  (char **)
51677 #define US   (unsigned char *)
51678 #define CUS  (const unsigned char *)
51679 #define USS  (unsigned char **)
51680 </literallayout>
51681 <para>
51682 The function prototype for <function>local_scan()</function> is:
51683 </para>
51684 <literallayout class="monospaced">
51685 extern int local_scan(int fd, uschar **return_text);
51686 </literallayout>
51687 <para>
51688 The arguments are as follows:
51689 </para>
51690 <itemizedlist>
51691 <listitem>
51692 <para>
51693 <option>fd</option> is a file descriptor for the file that contains the body of the message
51694 (the -D file). The file is open for reading and writing, but updating it is not
51695 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
51696 </para>
51697 <para>
51698 The descriptor is positioned at character 19 of the file, which is the first
51699 character of the body itself, because the first 19 characters are the message
51700 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
51701 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
51702 case this changes in some future version.
51703 </para>
51704 </listitem>
51705 <listitem>
51706 <para>
51707 <option>return_text</option> is an address which you can use to return a pointer to a text
51708 string at the end of the function. The value it points to on entry is NULL.
51709 </para>
51710 </listitem>
51711 </itemizedlist>
51712 <para>
51713 The function must return an <option>int</option> value which is one of the following macros:
51714 </para>
51715 <variablelist>
51716 <varlistentry>
51717 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
51718 <listitem>
51719 <para>
51720 <indexterm role="concept">
51721 <primary><varname>$local_scan_data</varname></primary>
51722 </indexterm>
51723 The message is accepted. If you pass back a string of text, it is saved with
51724 the message, and made available in the variable <varname>$local_scan_data</varname>. No
51725 newlines are permitted (if there are any, they are turned into spaces) and the
51726 maximum length of text is 1000 characters.
51727 </para>
51728 </listitem></varlistentry>
51729 <varlistentry>
51730 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
51731 <listitem>
51732 <para>
51733 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51734 queued without immediate delivery, and is frozen.
51735 </para>
51736 </listitem></varlistentry>
51737 <varlistentry>
51738 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
51739 <listitem>
51740 <para>
51741 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51742 queued without immediate delivery.
51743 </para>
51744 </listitem></varlistentry>
51745 <varlistentry>
51746 <term><literal>LOCAL_SCAN_REJECT</literal></term>
51747 <listitem>
51748 <para>
51749 The message is rejected; the returned text is used as an error message which is
51750 passed back to the sender and which is also logged. Newlines are permitted &ndash;
51751 they cause a multiline response for SMTP rejections, but are converted to
51752 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
51753 used.
51754 </para>
51755 </listitem></varlistentry>
51756 <varlistentry>
51757 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
51758 <listitem>
51759 <para>
51760 The message is temporarily rejected; the returned text is used as an error
51761 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
51762 problem</quote> is used.
51763 </para>
51764 </listitem></varlistentry>
51765 <varlistentry>
51766 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
51767 <listitem>
51768 <para>
51769 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
51770 message is not written to the reject log. It has the effect of unsetting the
51771 <option>rejected_header</option> log selector for just this rejection. If
51772 <option>rejected_header</option> is already unset (see the discussion of the
51773 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
51774 same as LOCAL_SCAN_REJECT.
51775 </para>
51776 </listitem></varlistentry>
51777 <varlistentry>
51778 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
51779 <listitem>
51780 <para>
51781 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
51782 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
51783 </para>
51784 </listitem></varlistentry>
51785 </variablelist>
51786 <para>
51787 If the message is not being received by interactive SMTP, rejections are
51788 reported by writing to <option>stderr</option> or by sending an email, as configured by the
51789 <option>-oe</option> command line options.
51790 </para>
51791 </section>
51792 <section id="SECTconoptloc">
51793 <title>Configuration options for local_scan()</title>
51794 <para>
51795 <indexterm role="concept">
51796 <primary><function>local_scan()</function> function</primary>
51797 <secondary>configuration options</secondary>
51798 </indexterm>
51799 It is possible to have option settings in the main configuration file
51800 that set values in static variables in the <function>local_scan()</function> module. If you
51801 want to do this, you must have the line
51802 </para>
51803 <literallayout class="monospaced">
51804 LOCAL_SCAN_HAS_OPTIONS=yes
51805 </literallayout>
51806 <para>
51807 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
51808 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
51809 file, you must define static variables to hold the option values, and a table
51810 to define them.
51811 </para>
51812 <para>
51813 The table must be a vector called <option>local_scan_options</option>, of type
51814 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
51815 and a pointer to the variable that holds the value. The entries must appear in
51816 alphabetical order. Following <option>local_scan_options</option> you must also define a
51817 variable called <option>local_scan_options_count</option> that contains the number of
51818 entries in the table. Here is a short example, showing two kinds of option:
51819 </para>
51820 <literallayout class="monospaced">
51821 static int my_integer_option = 42;
51822 static uschar *my_string_option = US"a default string";
51823
51824 optionlist local_scan_options[] = {
51825   { "my_integer", opt_int,       &amp;my_integer_option },
51826   { "my_string",  opt_stringptr, &amp;my_string_option }
51827 };
51828
51829 int local_scan_options_count =
51830   sizeof(local_scan_options)/sizeof(optionlist);
51831 </literallayout>
51832 <para>
51833 The values of the variables can now be changed from Exim&#x2019;s runtime
51834 configuration file by including a local scan section as in this example:
51835 </para>
51836 <literallayout class="monospaced">
51837 begin local_scan
51838 my_integer = 99
51839 my_string = some string of text...
51840 </literallayout>
51841 <para>
51842 The available types of option data are as follows:
51843 </para>
51844 <variablelist>
51845 <varlistentry>
51846 <term><emphasis role="bold">opt_bool</emphasis></term>
51847 <listitem>
51848 <para>
51849 This specifies a boolean (true/false) option. The address should point to a
51850 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
51851 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
51852 whether such a variable has been set at all, you can initialize it to
51853 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
51854 values.)
51855 </para>
51856 </listitem></varlistentry>
51857 <varlistentry>
51858 <term><emphasis role="bold">opt_fixed</emphasis></term>
51859 <listitem>
51860 <para>
51861 This specifies a fixed point number, such as is used for load averages.
51862 The address should point to a variable of type <literal>int</literal>. The value is stored
51863 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
51864 </para>
51865 </listitem></varlistentry>
51866 <varlistentry>
51867 <term><emphasis role="bold">opt_int</emphasis></term>
51868 <listitem>
51869 <para>
51870 This specifies an integer; the address should point to a variable of type
51871 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
51872 Exim.
51873 </para>
51874 </listitem></varlistentry>
51875 <varlistentry>
51876 <term><emphasis role="bold">opt_mkint</emphasis></term>
51877 <listitem>
51878 <para>
51879 This is the same as <option>opt_int</option>, except that when such a value is output in a
51880 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
51881 printed with the suffix K or M.
51882 </para>
51883 </listitem></varlistentry>
51884 <varlistentry>
51885 <term><emphasis role="bold">opt_octint</emphasis></term>
51886 <listitem>
51887 <para>
51888 This also specifies an integer, but the value is always interpeted as an
51889 octal integer, whether or not it starts with the digit zero, and it is
51890 always output in octal.
51891 </para>
51892 </listitem></varlistentry>
51893 <varlistentry>
51894 <term><emphasis role="bold">opt_stringptr</emphasis></term>
51895 <listitem>
51896 <para>
51897 This specifies a string value; the address must be a pointer to a
51898 variable that points to a string (for example, of type <literal>uschar *</literal>).
51899 </para>
51900 </listitem></varlistentry>
51901 <varlistentry>
51902 <term><emphasis role="bold">opt_time</emphasis></term>
51903 <listitem>
51904 <para>
51905 This specifies a time interval value. The address must point to a variable of
51906 type <literal>int</literal>. The value that is placed there is a number of seconds.
51907 </para>
51908 </listitem></varlistentry>
51909 </variablelist>
51910 <para>
51911 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
51912 out the values of all the <function>local_scan()</function> options.
51913 </para>
51914 </section>
51915 <section>
51916 <title>Available Exim variables</title>
51917 <para>
51918 <indexterm role="concept">
51919 <primary><function>local_scan()</function> function</primary>
51920 <secondary>available Exim variables</secondary>
51921 </indexterm>
51922 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
51923 are the only ones that are guaranteed to be maintained from release to release.
51924 Note, however, that you can obtain the value of any Exim variable by calling
51925 <emphasis>expand_string()</emphasis>. The exported variables are as follows:
51926 </para>
51927 <variablelist>
51928 <varlistentry>
51929 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
51930 <listitem>
51931 <para>
51932 This variable is set to zero when no debugging is taking place. Otherwise, it
51933 is a bitmap of debugging selectors. Two bits are identified for use in
51934 <function>local_scan()</function>; they are defined as macros:
51935 </para>
51936 <itemizedlist>
51937 <listitem>
51938 <para>
51939 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
51940 testing option that is not privileged &ndash; any caller may set it. All the
51941 other selector bits can be set only by admin users.
51942 </para>
51943 </listitem>
51944 <listitem>
51945 <para>
51946 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
51947 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
51948 of debugging bits.
51949 </para>
51950 </listitem>
51951 </itemizedlist>
51952 <para>
51953 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
51954 selected, you should use code like this:
51955 </para>
51956 <literallayout class="monospaced">
51957 if ((debug_selector &amp; D_local_scan) != 0)
51958   debug_printf("xxx", ...);
51959 </literallayout>
51960 </listitem></varlistentry>
51961 <varlistentry>
51962 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
51963 <listitem>
51964 <para>
51965 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
51966 variable <option>expand_string_message</option> contains the error message, zero-terminated.
51967 </para>
51968 </listitem></varlistentry>
51969 <varlistentry>
51970 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
51971 <listitem>
51972 <para>
51973 A pointer to a chain of header lines. The <option>header_line</option> structure is
51974 discussed below.
51975 </para>
51976 </listitem></varlistentry>
51977 <varlistentry>
51978 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
51979 <listitem>
51980 <para>
51981 A pointer to the last of the header lines.
51982 </para>
51983 </listitem></varlistentry>
51984 <varlistentry>
51985 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
51986 <listitem>
51987 <para>
51988 The value of the <option>headers_charset</option> configuration option.
51989 </para>
51990 </listitem></varlistentry>
51991 <varlistentry>
51992 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
51993 <listitem>
51994 <para>
51995 This variable is TRUE during a host checking session that is initiated by the
51996 <option>-bh</option> command line option.
51997 </para>
51998 </listitem></varlistentry>
51999 <varlistentry>
52000 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
52001 <listitem>
52002 <para>
52003 The IP address of the interface that received the message, as a string. This
52004 is NULL for locally submitted messages.
52005 </para>
52006 </listitem></varlistentry>
52007 <varlistentry>
52008 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
52009 <listitem>
52010 <para revisionflag="changed">
52011 The port on which this message was received. When testing with the <option>-bh</option>
52012 command line option, the value of this variable is -1 unless a port has been
52013 specified via the <option>-oMi</option> option.
52014 </para>
52015 </listitem></varlistentry>
52016 <varlistentry>
52017 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
52018 <listitem>
52019 <para>
52020 This variable contains Exim&#x2019;s message id for the incoming message (the value of
52021 <varname>$message_exim_id</varname>) as a zero-terminated string.
52022 </para>
52023 </listitem></varlistentry>
52024 <varlistentry>
52025 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
52026 <listitem>
52027 <para>
52028 The name of the protocol by which the message was received.
52029 </para>
52030 </listitem></varlistentry>
52031 <varlistentry>
52032 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
52033 <listitem>
52034 <para>
52035 The number of accepted recipients.
52036 </para>
52037 </listitem></varlistentry>
52038 <varlistentry>
52039 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
52040 <listitem>
52041 <para>
52042 <indexterm role="concept">
52043 <primary>recipient</primary>
52044 <secondary>adding in local scan</secondary>
52045 </indexterm>
52046 <indexterm role="concept">
52047 <primary>recipient</primary>
52048 <secondary>removing in local scan</secondary>
52049 </indexterm>
52050 The list of accepted recipients, held in a vector of length
52051 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
52052 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
52053 below). You can delete recipients by removing them from the vector and adusting
52054 the value in <option>recipients_count</option>. In particular, by setting
52055 <option>recipients_count</option> to zero you remove all recipients. If you then return the
52056 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
52057 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
52058 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
52059 </para>
52060 </listitem></varlistentry>
52061 <varlistentry>
52062 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
52063 <listitem>
52064 <para>
52065 The envelope sender address. For bounce messages this is the empty string.
52066 </para>
52067 </listitem></varlistentry>
52068 <varlistentry>
52069 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
52070 <listitem>
52071 <para>
52072 The IP address of the sending host, as a string. This is NULL for
52073 locally-submitted messages.
52074 </para>
52075 </listitem></varlistentry>
52076 <varlistentry>
52077 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
52078 <listitem>
52079 <para>
52080 The name of the authentication mechanism that was used, or NULL if the message
52081 was not received over an authenticated SMTP connection.
52082 </para>
52083 </listitem></varlistentry>
52084 <varlistentry>
52085 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
52086 <listitem>
52087 <para>
52088 The name of the sending host, if known.
52089 </para>
52090 </listitem></varlistentry>
52091 <varlistentry>
52092 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
52093 <listitem>
52094 <para>
52095 The port on the sending host.
52096 </para>
52097 </listitem></varlistentry>
52098 <varlistentry>
52099 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
52100 <listitem>
52101 <para>
52102 This variable is TRUE for all SMTP input, including BSMTP.
52103 </para>
52104 </listitem></varlistentry>
52105 <varlistentry>
52106 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
52107 <listitem>
52108 <para>
52109 This variable is TRUE for BSMTP input.
52110 </para>
52111 </listitem></varlistentry>
52112 <varlistentry>
52113 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
52114 <listitem>
52115 <para>
52116 The contents of this variable control which pool of memory is used for new
52117 requests. See section <xref linkend="SECTmemhanloc"/> for details.
52118 </para>
52119 </listitem></varlistentry>
52120 </variablelist>
52121 </section>
52122 <section>
52123 <title>Structure of header lines</title>
52124 <para>
52125 The <option>header_line</option> structure contains the members listed below.
52126 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
52127 (see below). You can cause header lines to be ignored (deleted) by setting
52128 their type to *.
52129 </para>
52130 <variablelist>
52131 <varlistentry>
52132 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
52133 <listitem>
52134 <para>
52135 A pointer to the next header line, or NULL for the last line.
52136 </para>
52137 </listitem></varlistentry>
52138 <varlistentry>
52139 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
52140 <listitem>
52141 <para>
52142 A code identifying certain headers that Exim recognizes. The codes are printing
52143 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
52144 Notice in particular that any header line whose type is * is not transmitted
52145 with the message. This flagging is used for header lines that have been
52146 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
52147 lines.) Effectively, * means <quote>deleted</quote>.
52148 </para>
52149 </listitem></varlistentry>
52150 <varlistentry>
52151 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
52152 <listitem>
52153 <para>
52154 The number of characters in the header line, including the terminating and any
52155 internal newlines.
52156 </para>
52157 </listitem></varlistentry>
52158 <varlistentry>
52159 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
52160 <listitem>
52161 <para>
52162 A pointer to the text of the header. It always ends with a newline, followed by
52163 a zero byte. Internal newlines are preserved.
52164 </para>
52165 </listitem></varlistentry>
52166 </variablelist>
52167 </section>
52168 <section>
52169 <title>Structure of recipient items</title>
52170 <para>
52171 The <option>recipient_item</option> structure contains these members:
52172 </para>
52173 <variablelist>
52174 <varlistentry>
52175 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
52176 <listitem>
52177 <para>
52178 This is a pointer to the recipient address as it was received.
52179 </para>
52180 </listitem></varlistentry>
52181 <varlistentry>
52182 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
52183 <listitem>
52184 <para>
52185 This is used in later Exim processing when top level addresses are created by
52186 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
52187 and must always contain -1 at this stage.
52188 </para>
52189 </listitem></varlistentry>
52190 <varlistentry>
52191 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
52192 <listitem>
52193 <para>
52194 If this value is not NULL, bounce messages caused by failing to deliver to the
52195 recipient are sent to the address it contains. In other words, it overrides the
52196 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
52197 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
52198 an unqualified address, Exim qualifies it using the domain from
52199 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
52200 is NULL for all recipients.
52201 </para>
52202 </listitem></varlistentry>
52203 </variablelist>
52204 </section>
52205 <section>
52206 <title>Available Exim functions</title>
52207 <para>
52208 <indexterm role="concept">
52209 <primary><function>local_scan()</function> function</primary>
52210 <secondary>available Exim functions</secondary>
52211 </indexterm>
52212 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
52213 These are the only ones that are guaranteed to be maintained from release to
52214 release:
52215 </para>
52216 <variablelist>
52217 <varlistentry>
52218 <term><emphasis role="bold">pid_t&nbsp;child_open(uschar&nbsp;**argv,&nbsp;uschar&nbsp;**envp,&nbsp;int&nbsp;newumask,&nbsp;int&nbsp;*infdptr,&nbsp;int&nbsp;*outfdptr, &nbsp;&nbsp;BOOL&nbsp;make_leader)</emphasis></term>
52219 <listitem>
52220 <para>
52221 This function creates a child process that runs the command specified by
52222 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
52223 be NULL if no environment variables are to be passed. A new umask is supplied
52224 for the process in <option>newumask</option>.
52225 </para>
52226 <para>
52227 Pipes to the standard input and output of the new process are set up
52228 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
52229 standard error is cloned to the standard output. If there are any file
52230 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
52231 argument is TRUE, the new process is made into a process group leader.
52232 </para>
52233 <para>
52234 The function returns the pid of the new process, or -1 if things go wrong.
52235 </para>
52236 </listitem></varlistentry>
52237 <varlistentry>
52238 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
52239 <listitem>
52240 <para>
52241 This function waits for a child process to terminate, or for a timeout (in
52242 seconds) to expire. A timeout value of zero means wait as long as it takes. The
52243 return value is as follows:
52244 </para>
52245 <itemizedlist>
52246 <listitem>
52247 <para>
52248 &gt;= 0
52249 </para>
52250 <para>
52251 The process terminated by a normal exit and the value is the process
52252 ending status.
52253 </para>
52254 </listitem>
52255 <listitem>
52256 <para>
52257 &lt; 0 and &gt; &ndash;256
52258 </para>
52259 <para>
52260 The process was terminated by a signal and the value is the negation of the
52261 signal number.
52262 </para>
52263 </listitem>
52264 <listitem>
52265 <para>
52266 &ndash;256
52267 </para>
52268 <para>
52269 The process timed out.
52270 </para>
52271 </listitem>
52272 <listitem>
52273 <para>
52274 &ndash;257
52275 </para>
52276 <para>
52277 The was some other error in wait(); <option>errno</option> is still set.
52278 </para>
52279 </listitem>
52280 </itemizedlist>
52281 </listitem></varlistentry>
52282 <varlistentry>
52283 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
52284 <listitem>
52285 <para>
52286 This function provide you with a means of submitting a new message to
52287 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
52288 want, but this packages it all up for you.) The function creates a pipe,
52289 forks a subprocess that is running
52290 </para>
52291 <literallayout class="monospaced">
52292 exim -t -oem -oi -f &lt;&gt;
52293 </literallayout>
52294 <para>
52295 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
52296 that is connected to the standard input. The yield of the function is the PID
52297 of the subprocess. You can then write a message to the file descriptor, with
52298 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
52299 </para>
52300 <para>
52301 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
52302 finish and to collect its ending status. A timeout value of zero is usually
52303 fine in this circumstance. Unless you have made a mistake with the recipient
52304 addresses, you should get a return code of zero.
52305 </para>
52306 </listitem></varlistentry>
52307 <varlistentry>
52308 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
52309 <listitem>
52310 <para>
52311 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
52312 that it runs is:
52313 </para>
52314 <literallayout>
52315 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
52316 </literallayout>
52317 <para>
52318 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
52319 </para>
52320 </listitem></varlistentry>
52321 <varlistentry>
52322 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
52323 <listitem>
52324 <para>
52325 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
52326 output is written to the standard error stream. If no debugging is selected,
52327 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
52328 conditional on the <literal>local_scan</literal> debug selector by coding like this:
52329 </para>
52330 <literallayout class="monospaced">
52331 if ((debug_selector &amp; D_local_scan) != 0)
52332   debug_printf("xxx", ...);
52333 </literallayout>
52334 </listitem></varlistentry>
52335 <varlistentry>
52336 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
52337 <listitem>
52338 <para>
52339 This is an interface to Exim&#x2019;s string expansion code. The return value is the
52340 expanded string, or NULL if there was an expansion failure.
52341 The C variable <option>expand_string_message</option> contains an error message after an
52342 expansion failure. If expansion does not change the string, the return value is
52343 the pointer to the input string. Otherwise, the return value points to a new
52344 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
52345 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
52346 </para>
52347 </listitem></varlistentry>
52348 <varlistentry>
52349 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
52350 <listitem>
52351 <para>
52352 This function allows you to an add additional header line at the end of the
52353 existing ones. The first argument is the type, and should normally be a space
52354 character. The second argument is a format string and any number of
52355 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
52356 if you want, and you must ensure that the string ends with a newline.
52357 </para>
52358 </listitem></varlistentry>
52359 <varlistentry>
52360 <term><emphasis role="bold">void&nbsp;header_add_at_position(BOOL&nbsp;after,&nbsp;uschar&nbsp;*name,&nbsp;BOOL&nbsp;topnot,&nbsp;int&nbsp;type,&nbsp;char&nbsp;*format, &nbsp;&nbsp;...)</emphasis></term>
52361 <listitem>
52362 <para>
52363 This function adds a new header line at a specified point in the header
52364 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
52365 </para>
52366 <para>
52367 If <option>name</option> is NULL, the new header is added at the end of the chain if
52368 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
52369 NULL, the header lines are searched for the first non-deleted header that
52370 matches the name. If one is found, the new header is added before it if
52371 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
52372 found header and any adjacent subsequent ones with the same name (even if
52373 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
52374 option controls where the header is added. If it is true, addition is at the
52375 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
52376 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
52377 </para>
52378 <literallayout class="monospaced">
52379 header_add_at_position(TRUE, US"Received", TRUE,
52380   ' ', "X-xxx: ...");
52381 </literallayout>
52382 <para>
52383 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
52384 there may not be if <option>received_header_text</option> expands to an empty string.
52385 </para>
52386 </listitem></varlistentry>
52387 <varlistentry>
52388 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
52389 <listitem>
52390 <para>
52391 This function removes header lines. If <option>occurrence</option> is zero or negative, all
52392 occurrences of the header are removed. If occurrence is greater than zero, that
52393 particular instance of the header is removed. If no header(s) can be found that
52394 match the specification, the function does nothing.
52395 </para>
52396 </listitem></varlistentry>
52397 <varlistentry>
52398 <term><emphasis role="bold">BOOL&nbsp;header_testname(header_line&nbsp;*hdr,&nbsp;uschar&nbsp;*name,&nbsp;int&nbsp;length,&nbsp;BOOL&nbsp;notdel)</emphasis></term>
52399 <listitem>
52400 <para>
52401 This function tests whether the given header has the given name. It is not just
52402 a string comparison, because white space is permitted between the name and the
52403 colon. If the <option>notdel</option> argument is true, a false return is forced for all
52404 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
52405 </para>
52406 <literallayout class="monospaced">
52407 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
52408 </literallayout>
52409 </listitem></varlistentry>
52410 <varlistentry>
52411 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
52412 <listitem>
52413 <para>
52414 <indexterm role="concept">
52415 <primary>base64 encoding</primary>
52416 <secondary>functions for <function>local_scan()</function> use</secondary>
52417 </indexterm>
52418 This function base64-encodes a string, which is passed by address and length.
52419 The text may contain bytes of any value, including zero. The result is passed
52420 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
52421 zero-terminated.
52422 </para>
52423 </listitem></varlistentry>
52424 <varlistentry>
52425 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
52426 <listitem>
52427 <para>
52428 This function decodes a base64-encoded string. Its arguments are a
52429 zero-terminated base64-encoded string and the address of a variable that is set
52430 to point to the result, which is in dynamic memory. The length of the decoded
52431 string is the yield of the function. If the input is invalid base64 data, the
52432 yield is -1. A zero byte is added to the end of the output string to make it
52433 easy to interpret as a C string (assuming it contains no zeros of its own). The
52434 added zero byte is not included in the returned count.
52435 </para>
52436 </listitem></varlistentry>
52437 <varlistentry>
52438 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
52439 <listitem>
52440 <para>
52441 This function checks for a match in a domain list. Domains are always
52442 matched caselessly. The return value is one of the following:
52443 </para>
52444 <literallayout>
52445 <literal>OK     </literal> match succeeded
52446 <literal>FAIL   </literal> match failed
52447 <literal>DEFER  </literal> match deferred
52448 </literallayout>
52449 <para>
52450 DEFER is usually caused by some kind of lookup defer, such as the
52451 inability to contact a database.
52452 </para>
52453 </listitem></varlistentry>
52454 <varlistentry>
52455 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
52456 <listitem>
52457 <para>
52458 This function checks for a match in a local part list. The third argument
52459 controls case-sensitivity. The return values are as for
52460 <emphasis>lss_match_domain()</emphasis>.
52461 </para>
52462 </listitem></varlistentry>
52463 <varlistentry>
52464 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
52465 <listitem>
52466 <para>
52467 This function checks for a match in an address list. The third argument
52468 controls the case-sensitivity of the local part match. The domain is always
52469 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
52470 </para>
52471 </listitem></varlistentry>
52472 <varlistentry>
52473 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
52474 <listitem>
52475 <para>
52476 This function checks for a match in a host list. The most common usage is
52477 expected to be
52478 </para>
52479 <literallayout class="monospaced">
52480 lss_match_host(sender_host_name, sender_host_address, ...)
52481 </literallayout>
52482 <para>
52483 <indexterm role="concept">
52484 <primary><varname>$sender_host_address</varname></primary>
52485 </indexterm>
52486 An empty address field matches an empty item in the host list. If the host name
52487 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
52488 looked up if a host name is required to match an item in the list. The return
52489 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
52490 returns ERROR in the case when it had to look up a host name, but the lookup
52491 failed.
52492 </para>
52493 </listitem></varlistentry>
52494 <varlistentry>
52495 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
52496 <listitem>
52497 <para>
52498 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
52499 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
52500 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
52501 them. It specifies to which log or logs the message is written. The remaining
52502 arguments are a format and relevant insertion arguments. The string should not
52503 contain any newlines, not even at the end.
52504 </para>
52505 </listitem></varlistentry>
52506 <varlistentry>
52507 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
52508 <listitem>
52509 <para>
52510 This function adds an additional recipient to the message. The first argument
52511 is the recipient address. If it is unqualified (has no domain), it is qualified
52512 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
52513 </para>
52514 <para>
52515 This function does not allow you to specify a private <option>errors_to</option> address (as
52516 described with the structure of <option>recipient_item</option> above), because it pre-dates
52517 the addition of that field to the structure. However, it is easy to add such a
52518 value afterwards. For example:
52519 </para>
52520 <literallayout class="monospaced">
52521  receive_add_recipient(US"monitor@mydom.example", -1);
52522  recipients_list[recipients_count-1].errors_to =
52523    US"postmaster@mydom.example";
52524 </literallayout>
52525 </listitem></varlistentry>
52526 <varlistentry>
52527 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
52528 <listitem>
52529 <para>
52530 This is a convenience function to remove a named recipient from the list of
52531 recipients. It returns true if a recipient was removed, and false if no
52532 matching recipient could be found. The argument must be a complete email
52533 address.
52534 </para>
52535 </listitem></varlistentry>
52536 </variablelist>
52537 <para>
52538 <indexterm role="concept">
52539 <primary>RFC 2047</primary>
52540 </indexterm>
52541 </para>
52542 <variablelist>
52543 <varlistentry>
52544 <term><emphasis role="bold">uschar&nbsp;rfc2047_decode(uschar&nbsp;*string,&nbsp;BOOL&nbsp;lencheck,&nbsp;uschar&nbsp;*target,&nbsp;int&nbsp;zeroval,&nbsp;int&nbsp;*lenptr, &nbsp;&nbsp;uschar&nbsp;**error)</emphasis></term>
52545 <listitem>
52546 <para>
52547 This function decodes strings that are encoded according to RFC 2047. Typically
52548 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
52549 from the Q or B encoding into a byte-string. Then, if provided with the name of
52550 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
52551 made  to translate the result to the named character set. If this fails, the
52552 binary string is returned with an error message.
52553 </para>
52554 <para>
52555 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
52556 maximum MIME word length is enforced. The third argument is the target
52557 encoding, or NULL if no translation is wanted.
52558 </para>
52559 <para>
52560 <indexterm role="concept">
52561 <primary>binary zero</primary>
52562 <secondary>in RFC 2047 decoding</secondary>
52563 </indexterm>
52564 <indexterm role="concept">
52565 <primary>RFC 2047</primary>
52566 <secondary>binary zero in</secondary>
52567 </indexterm>
52568 If a binary zero is encountered in the decoded string, it is replaced by the
52569 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
52570 not be 0 because header lines are handled as zero-terminated strings.
52571 </para>
52572 <para>
52573 The function returns the result of processing the string, zero-terminated; if
52574 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
52575 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
52576 </para>
52577 <para>
52578 If an error is encountered, the function returns NULL and uses the <option>error</option>
52579 argument to return an error message. The variable pointed to by <option>error</option> is
52580 set to NULL if there is no error; it may be set non-NULL even when the function
52581 returns a non-NULL value if decoding was successful, but there was a problem
52582 with translation.
52583 </para>
52584 </listitem></varlistentry>
52585 <varlistentry>
52586 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
52587 <listitem>
52588 <para>
52589 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
52590 below.
52591 </para>
52592 </listitem></varlistentry>
52593 <varlistentry>
52594 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
52595 <listitem>
52596 <para>
52597 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
52598 output stream. You should use this function only when there is an SMTP output
52599 stream, that is, when the incoming message is being received via interactive
52600 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
52601 is FALSE. If you want to test for an incoming message from another host (as
52602 opposed to a local process that used the <option>-bs</option> command line option), you can
52603 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
52604 is involved.
52605 </para>
52606 <para>
52607 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
52608 output function, so it can be used for all forms of SMTP connection.
52609 </para>
52610 <para>
52611 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
52612 must start with an appropriate response code: 550 if you are going to return
52613 LOCAL_SCAN_REJECT, 451 if you are going to return
52614 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
52615 initial lines of a multi-line response, the code must be followed by a hyphen
52616 to indicate that the line is not the final response line. You must also ensure
52617 that the lines you write terminate with CRLF. For example:
52618 </para>
52619 <literallayout class="monospaced">
52620 smtp_printf("550-this is some extra info\r\n");
52621 return LOCAL_SCAN_REJECT;
52622 </literallayout>
52623 <para>
52624 Note that you can also create multi-line responses by including newlines in
52625 the data returned via the <option>return_text</option> argument. The added value of using
52626 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
52627 multiple output lines.
52628 </para>
52629 <para>
52630 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
52631 does not automatically flush pending output, and therefore does not test
52632 the state of the stream. (In the main code of Exim, flushing and error
52633 detection is done when Exim is ready for the next SMTP input command.) If
52634 you want to flush the output and check for an error (for example, the
52635 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
52636 arguments. It flushes the output stream, and returns a non-zero value if there
52637 is an error.
52638 </para>
52639 </listitem></varlistentry>
52640 <varlistentry>
52641 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
52642 <listitem>
52643 <para>
52644 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
52645 chunk of memory whose size is given by the argument. Exim bombs out if it ever
52646 runs out of memory. See the next section for a discussion of memory handling.
52647 </para>
52648 </listitem></varlistentry>
52649 <varlistentry>
52650 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
52651 <listitem>
52652 <para>
52653 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
52654 permanent pool. See the next section for a discussion of memory handling.
52655 </para>
52656 </listitem></varlistentry>
52657 <varlistentry>
52658 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
52659 <listitem>
52660 <para>
52661 See below.
52662 </para>
52663 </listitem></varlistentry>
52664 <varlistentry>
52665 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
52666 <listitem>
52667 <para>
52668 See below.
52669 </para>
52670 </listitem></varlistentry>
52671 <varlistentry>
52672 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
52673 <listitem>
52674 <para>
52675 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
52676 The first makes a copy of an entire string. The second copies up to a maximum
52677 number of characters, indicated by the second argument. The third uses a format
52678 and insertion arguments to create a new string. In each case, the result is a
52679 pointer to a new string in the current memory pool. See the next section for
52680 more discussion.
52681 </para>
52682 </listitem></varlistentry>
52683 </variablelist>
52684 </section>
52685 <section id="SECTmemhanloc">
52686 <title>More about Exim&#x2019;s memory handling</title>
52687 <para>
52688 <indexterm role="concept">
52689 <primary><function>local_scan()</function> function</primary>
52690 <secondary>memory handling</secondary>
52691 </indexterm>
52692 No function is provided for freeing memory, because that is never needed.
52693 The dynamic memory that Exim uses when receiving a message is automatically
52694 recycled if another message is received by the same process (this applies only
52695 to incoming SMTP connections &ndash; other input methods can supply only one
52696 message at a time). After receiving the last message, a reception process
52697 terminates.
52698 </para>
52699 <para>
52700 Because it is recycled, the normal dynamic memory cannot be used for holding
52701 data that must be preserved over a number of incoming messages on the same SMTP
52702 connection. However, Exim in fact uses two pools of dynamic memory; the second
52703 one is not recycled, and can be used for this purpose.
52704 </para>
52705 <para>
52706 If you want to allocate memory that remains available for subsequent messages
52707 in the same SMTP connection, you should set
52708 </para>
52709 <literallayout class="monospaced">
52710 store_pool = POOL_PERM
52711 </literallayout>
52712 <para>
52713 before calling the function that does the allocation. There is no need to
52714 restore the value if you do not need to; however, if you do want to revert to
52715 the normal pool, you can either restore the previous value of <option>store_pool</option> or
52716 set it explicitly to POOL_MAIN.
52717 </para>
52718 <para>
52719 The pool setting applies to all functions that get dynamic memory, including
52720 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
52721 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
52722 block of memory from the permanent pool while preserving the value of
52723 <option>store_pool</option>.
52724 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
52725 </para>
52726 </section>
52727 </chapter>
52728
52729 <chapter id="CHAPsystemfilter">
52730 <title>System-wide message filtering</title>
52731 <para>
52732 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
52733 <primary>filter</primary>
52734 <secondary>system filter</secondary>
52735 </indexterm>
52736 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
52737 <primary>filtering all mail</primary>
52738 </indexterm>
52739 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
52740 <primary>system filter</primary>
52741 </indexterm>
52742 The previous chapters (on ACLs and the local scan function) describe checks
52743 that can be applied to messages before they are accepted by a host. There is
52744 also a mechanism for checking messages once they have been received, but before
52745 they are delivered. This is called the <emphasis>system filter</emphasis>.
52746 </para>
52747 <para>
52748 The system filter operates in a similar manner to users&#x2019; filter files, but it
52749 is run just once per message (however many recipients the message has).
52750 It should not normally be used as a substitute for routing, because <option>deliver</option>
52751 commands in a system router provide new envelope recipient addresses.
52752 The system filter must be an Exim filter. It cannot be a Sieve filter.
52753 </para>
52754 <para>
52755 The system filter is run at the start of a delivery attempt, before any routing
52756 is done. If a message fails to be completely delivered at the first attempt,
52757 the system filter is run again at the start of every retry.
52758 If you want your filter to do something only once per message, you can make use
52759 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
52760 prevent it happening on retries.
52761 </para>
52762 <para>
52763 <indexterm role="concept">
52764 <primary><varname>$domain</varname></primary>
52765 </indexterm>
52766 <indexterm role="concept">
52767 <primary><varname>$local_part</varname></primary>
52768 </indexterm>
52769 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
52770 specific to individual recipient addresses, such as <varname>$local_part</varname> and
52771 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
52772 you want to run a centrally-specified filter for each recipient address
52773 independently, you can do so by setting up a suitable <command>redirect</command> router, as
52774 described in section <xref linkend="SECTperaddfil"/> below.
52775 </para>
52776 <section>
52777 <title>Specifying a system filter</title>
52778 <para>
52779 <indexterm role="concept">
52780 <primary>uid (user id)</primary>
52781 <secondary>system filter</secondary>
52782 </indexterm>
52783 <indexterm role="concept">
52784 <primary>gid (group id)</primary>
52785 <secondary>system filter</secondary>
52786 </indexterm>
52787 The name of the file that contains the system filter must be specified by
52788 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
52789 other than root, you must also set <option>system_filter_user</option> and
52790 <option>system_filter_group</option> as appropriate. For example:
52791 </para>
52792 <literallayout class="monospaced">
52793 system_filter = /etc/mail/exim.filter
52794 system_filter_user = exim
52795 </literallayout>
52796 <para>
52797 If a system filter generates any deliveries directly to files or pipes (via the
52798 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
52799 specified by setting <option>system_filter_file_transport</option> and
52800 <option>system_filter_pipe_transport</option>, respectively. Similarly,
52801 <option>system_filter_reply_transport</option> must be set to handle any messages generated
52802 by the <option>reply</option> command.
52803 </para>
52804 </section>
52805 <section>
52806 <title>Testing a system filter</title>
52807 <para>
52808 You can run simple tests of a system filter in the same way as for a user
52809 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
52810 are permitted only in system filters are recognized.
52811 </para>
52812 <para>
52813 If you want to test the combined effect of a system filter and a user filter,
52814 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
52815 </para>
52816 </section>
52817 <section>
52818 <title>Contents of a system filter</title>
52819 <para>
52820 The language used to specify system filters is the same as for users&#x2019; filter
52821 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
52822 mail filtering</emphasis>. However, there are some additional features that are
52823 available only in system filters; these are described in subsequent sections.
52824 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
52825 they cause errors.
52826 </para>
52827 <para>
52828 <indexterm role="concept">
52829 <primary>frozen messages</primary>
52830 <secondary>manual thaw; testing in filter</secondary>
52831 </indexterm>
52832 There are two special conditions which, though available in users&#x2019; filter
52833 files, are designed for use in system filters. The condition <option>first_delivery</option>
52834 is true only for the first attempt at delivering a message, and
52835 <option>manually_thawed</option> is true only if the message has been frozen, and
52836 subsequently thawed by an admin user. An explicit forced delivery counts as a
52837 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
52838 </para>
52839 <para>
52840 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
52841 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
52842 succeed, it will not be tried again.
52843 If you want Exim to retry an unseen delivery until it succeeds, you should
52844 arrange to set it up every time the filter runs.
52845 </para>
52846 <para>
52847 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
52848 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
52849 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
52850 to which users&#x2019; filter files can refer.
52851 </para>
52852 </section>
52853 <section>
52854 <title>Additional variable for system filters</title>
52855 <para>
52856 <indexterm role="concept">
52857 <primary><varname>$recipients</varname></primary>
52858 </indexterm>
52859 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
52860 of the message (separated by commas and white space), is available in system
52861 filters. It is not available in users&#x2019; filters for privacy reasons.
52862 </para>
52863 </section>
52864 <section>
52865 <title>Defer, freeze, and fail commands for system filters</title>
52866 <para>
52867 <indexterm role="concept">
52868 <primary>freezing messages</primary>
52869 </indexterm>
52870 <indexterm role="concept">
52871 <primary>message</primary>
52872 <secondary>freezing</secondary>
52873 </indexterm>
52874 <indexterm role="concept">
52875 <primary>message</primary>
52876 <secondary>forced failure</secondary>
52877 </indexterm>
52878 <indexterm role="concept">
52879 <primary><option>fail</option></primary>
52880 <secondary>in system filter</secondary>
52881 </indexterm>
52882 <indexterm role="concept">
52883 <primary><option>freeze</option> in system filter</primary>
52884 </indexterm>
52885 <indexterm role="concept">
52886 <primary><option>defer</option> in system filter</primary>
52887 </indexterm>
52888 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
52889 always available in system filters, but are not normally enabled in users&#x2019;
52890 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
52891 for the <command>redirect</command> router.) These commands can optionally be followed by the
52892 word <option>text</option> and a string containing an error message, for example:
52893 </para>
52894 <literallayout class="monospaced">
52895 fail text "this message looks like spam to me"
52896 </literallayout>
52897 <para>
52898 The keyword <option>text</option> is optional if the next character is a double quote.
52899 </para>
52900 <para>
52901 The <option>defer</option> command defers delivery of the original recipients of the
52902 message. The <option>fail</option> command causes all the original recipients to be failed,
52903 and a bounce message to be created. The <option>freeze</option> command suspends all
52904 delivery attempts for the original recipients. In all cases, any new deliveries
52905 that are specified by the filter are attempted as normal after the filter has
52906 run.
52907 </para>
52908 <para>
52909 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
52910 not manually frozen since. This means that automatic freezing by a system
52911 filter can be used as a way of checking out suspicious messages. If a message
52912 is found to be all right, manually unfreezing it allows it to be delivered.
52913 </para>
52914 <para>
52915 <indexterm role="concept">
52916 <primary>log</primary>
52917 <secondary><option>fail</option> command log line</secondary>
52918 </indexterm>
52919 <indexterm role="concept">
52920 <primary><option>fail</option></primary>
52921 <secondary>log line; reducing</secondary>
52922 </indexterm>
52923 The text given with a fail command is used as part of the bounce message as
52924 well as being written to the log. If the message is quite long, this can fill
52925 up a lot of log space when such failures are common. To reduce the size of the
52926 log message, Exim interprets the text in a special way if it starts with the
52927 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
52928 strings is written to the log, and the rest of the text is used in the bounce
52929 message. For example:
52930 </para>
52931 <literallayout class="monospaced">
52932 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
52933      because it contains attachments that we are \
52934      not prepared to receive."
52935 </literallayout>
52936 <para>
52937 <indexterm role="concept">
52938 <primary>loop</primary>
52939 <secondary>caused by <option>fail</option></secondary>
52940 </indexterm>
52941 Take great care with the <option>fail</option> command when basing the decision to fail on
52942 the contents of the message, because the bounce message will of course include
52943 the contents of the original message and will therefore trigger the <option>fail</option>
52944 command again (causing a mail loop) unless steps are taken to prevent this.
52945 Testing the <option>error_message</option> condition is one way to prevent this. You could
52946 use, for example
52947 </para>
52948 <literallayout class="monospaced">
52949 if $message_body contains "this is spam" and not error_message
52950 then fail text "spam is not wanted here" endif
52951 </literallayout>
52952 <para>
52953 though of course that might let through unwanted bounce messages. The
52954 alternative is clever checking of the body and/or headers to detect bounces
52955 generated by the filter.
52956 </para>
52957 <para>
52958 The interpretation of a system filter file ceases after a
52959 <option>defer</option>,
52960 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
52961 set up earlier in the filter file are honoured, so you can use a sequence such
52962 as
52963 </para>
52964 <literallayout class="monospaced">
52965 mail ...
52966 freeze
52967 </literallayout>
52968 <para>
52969 to send a specified message when the system filter is freezing (or deferring or
52970 failing) a message. The normal deliveries for the message do not, of course,
52971 take place.
52972 </para>
52973 </section>
52974 <section id="SECTaddremheasys">
52975 <title>Adding and removing headers in a system filter</title>
52976 <para>
52977 <indexterm role="concept">
52978 <primary>header lines</primary>
52979 <secondary>adding; in system filter</secondary>
52980 </indexterm>
52981 <indexterm role="concept">
52982 <primary>header lines</primary>
52983 <secondary>removing; in system filter</secondary>
52984 </indexterm>
52985 <indexterm role="concept">
52986 <primary>filter</primary>
52987 <secondary>header lines; adding/removing</secondary>
52988 </indexterm>
52989 Two filter commands that are available only in system filters are:
52990 </para>
52991 <literallayout class="monospaced">
52992 headers add &lt;string&gt;
52993 headers remove &lt;string&gt;
52994 </literallayout>
52995 <para>
52996 The argument for the <option>headers add</option> is a string that is expanded and then
52997 added to the end of the message&#x2019;s headers. It is the responsibility of the
52998 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
52999 space is ignored, and if the string is otherwise empty, or if the expansion is
53000 forced to fail, the command has no effect.
53001 </para>
53002 <para>
53003 You can use <quote>\n</quote> within the string, followed by white space, to specify
53004 continued header lines. More than one header may be added in one command by
53005 including <quote>\n</quote> within the string without any following white space. For
53006 example:
53007 </para>
53008 <literallayout class="monospaced">
53009 headers add "X-header-1: ....\n  \
53010              continuation of X-header-1 ...\n\
53011              X-header-2: ...."
53012 </literallayout>
53013 <para>
53014 Note that the header line continuation white space after the first newline must
53015 be placed before the backslash that continues the input string, because white
53016 space after input continuations is ignored.
53017 </para>
53018 <para>
53019 The argument for <option>headers remove</option> is a colon-separated list of header names.
53020 This command applies only to those headers that are stored with the message;
53021 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
53022 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
53023 header with the same name, they are all removed.
53024 </para>
53025 <para>
53026 The <option>headers</option> command in a system filter makes an immediate change to the set
53027 of header lines that was received with the message (with possible additions
53028 from ACL processing). Subsequent commands in the system filter operate on the
53029 modified set, which also forms the basis for subsequent message delivery.
53030 Unless further modified during routing or transporting, this set of headers is
53031 used for all recipients of the message.
53032 </para>
53033 <para>
53034 During routing and transporting, the variables that refer to the contents of
53035 header lines refer only to those lines that are in this set. Thus, header lines
53036 that are added by a system filter are visible to users&#x2019; filter files and to all
53037 routers and transports. This contrasts with the manipulation of header lines by
53038 routers and transports, which is not immediate, but which instead is saved up
53039 until the message is actually being written (see section
53040 <xref linkend="SECTheadersaddrem"/>).
53041 </para>
53042 <para>
53043 If the message is not delivered at the first attempt, header lines that were
53044 added by the system filter are stored with the message, and so are still
53045 present at the next delivery attempt. Header lines that were removed are still
53046 present, but marked <quote>deleted</quote> so that they are not transported with the
53047 message. For this reason, it is usual to make the <option>headers</option> command
53048 conditional on <option>first_delivery</option> so that the set of header lines is not
53049 modified more than once.
53050 </para>
53051 <para>
53052 Because header modification in a system filter acts immediately, you have to
53053 use an indirect approach if you want to modify the contents of a header line.
53054 For example:
53055 </para>
53056 <literallayout class="monospaced">
53057 headers add "Old-Subject: $h_subject:"
53058 headers remove "Subject"
53059 headers add "Subject: new subject (was: $h_old-subject:)"
53060 headers remove "Old-Subject"
53061 </literallayout>
53062 </section>
53063 <section>
53064 <title>Setting an errors address in a system filter</title>
53065 <para>
53066 <indexterm role="concept">
53067 <primary>envelope sender</primary>
53068 </indexterm>
53069 In a system filter, if a <option>deliver</option> command is followed by
53070 </para>
53071 <literallayout class="monospaced">
53072 errors_to &lt;some address&gt;
53073 </literallayout>
53074 <para>
53075 in order to change the envelope sender (and hence the error reporting) for that
53076 delivery, any address may be specified. (In a user filter, only the current
53077 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
53078 might use
53079 </para>
53080 <literallayout class="monospaced">
53081 unseen deliver monitor@spying.example errors_to root@local.example
53082 </literallayout>
53083 <para>
53084 to take a copy which would not be sent back to the normal error reporting
53085 address if its delivery failed.
53086 </para>
53087 </section>
53088 <section id="SECTperaddfil">
53089 <title>Per-address filtering</title>
53090 <para>
53091 <indexterm role="concept">
53092 <primary><varname>$domain</varname></primary>
53093 </indexterm>
53094 <indexterm role="concept">
53095 <primary><varname>$local_part</varname></primary>
53096 </indexterm>
53097 In contrast to the system filter, which is run just once per message for each
53098 delivery attempt, it is also possible to set up a system-wide filtering
53099 operation that runs once for each recipient address. In this case, variables
53100 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
53101 filter file could be made dependent on them. This is an example of a router
53102 which implements such a filter:
53103 </para>
53104 <literallayout class="monospaced">
53105 central_filter:
53106   check_local_user
53107   driver = redirect
53108   domains = +local_domains
53109   file = /central/filters/$local_part
53110   no_verify
53111   allow_filter
53112   allow_freeze
53113 </literallayout>
53114 <para>
53115 The filter is run in a separate process under its own uid. Therefore, either
53116 <option>check_local_user</option> must be set (as above), in which case the filter is run as
53117 the local user, or the <option>user</option> option must be used to specify which user to
53118 use. If both are set, <option>user</option> overrides.
53119 </para>
53120 <para>
53121 Care should be taken to ensure that none of the commands in the filter file
53122 specify a significant delivery if the message is to go on to be delivered to
53123 its intended recipient. The router will not then claim to have dealt with the
53124 address, so it will be passed on to subsequent routers to be delivered in the
53125 normal way.
53126 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
53127 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
53128 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
53129 </para>
53130 </section>
53131 </chapter>
53132
53133 <chapter id="CHAPmsgproc">
53134 <title>Message processing</title>
53135 <para>
53136 <indexterm role="concept" id="IIDmesproc" class="startofrange">
53137 <primary>message</primary>
53138 <secondary>general processing</secondary>
53139 </indexterm>
53140 Exim performs various transformations on the sender and recipient addresses of
53141 all messages that it handles, and also on the messages&#x2019; header lines. Some of
53142 these are optional and configurable, while others always take place. All of
53143 this processing, except rewriting as a result of routing, and the addition or
53144 removal of header lines while delivering, happens when a message is received,
53145 before it is placed on Exim&#x2019;s queue.
53146 </para>
53147 <para>
53148 Some of the automatic processing takes place by default only for
53149 <quote>locally-originated</quote> messages. This adjective is used to describe messages
53150 that are not received over TCP/IP, but instead are passed to an Exim process on
53151 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
53152 set up by the <option>-bs</option> command line option.
53153 </para>
53154 <para>
53155 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
53156 or ::1) are not considered to be locally-originated. Exim does not treat the
53157 loopback interface specially in any way.
53158 </para>
53159 <para>
53160 If you want the loopback interface to be treated specially, you must ensure
53161 that there are appropriate entries in your ACLs.
53162 </para>
53163 <section id="SECTsubmodnon">
53164 <title>Submission mode for non-local messages</title>
53165 <para>
53166 <indexterm role="concept">
53167 <primary>message</primary>
53168 <secondary>submission</secondary>
53169 </indexterm>
53170 <indexterm role="concept">
53171 <primary>submission mode</primary>
53172 </indexterm>
53173 Processing that happens automatically for locally-originated messages (unless
53174 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
53175 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
53176 state. Submisssion mode is set by the modifier
53177 </para>
53178 <literallayout class="monospaced">
53179 control = submission
53180 </literallayout>
53181 <para>
53182 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
53183 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
53184 a local submission, and is normally used when the source of the message is
53185 known to be an MUA running on a client host (as opposed to an MTA). For
53186 example, to set submission mode for messages originating on the IPv4 loopback
53187 interface, you could include the following in the MAIL ACL:
53188 </para>
53189 <literallayout class="monospaced">
53190 warn  hosts = 127.0.0.1
53191       control = submission
53192 </literallayout>
53193 <para>
53194 <indexterm role="concept">
53195 <primary><option>sender_retain</option></primary>
53196 </indexterm>
53197 There are some options that can be used when setting submission mode. A slash
53198 is used to separate options. For example:
53199 </para>
53200 <literallayout class="monospaced">
53201 control = submission/sender_retain
53202 </literallayout>
53203 <para>
53204 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
53205 true and <option>local_from_check</option> false for the current incoming message. The first
53206 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
53207 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
53208 authenticated sender. With this setting, Exim still fixes up messages by adding
53209 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
53210 attempt to check sender authenticity in header lines.
53211 </para>
53212 <para>
53213 When <option>sender_retain</option> is not set, a submission mode setting may specify a
53214 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
53215 example:
53216 </para>
53217 <literallayout class="monospaced">
53218 control = submission/domain=some.domain
53219 </literallayout>
53220 <para>
53221 The domain may be empty. How this value is used is described in sections
53222 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
53223 that allows you to specify the user&#x2019;s full name for inclusion in a created
53224 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
53225 </para>
53226 <literallayout class="monospaced">
53227 accept authenticated = *
53228        control = submission/domain=wonderland.example/\
53229                             name=${lookup {$authenticated_id} \
53230                                    lsearch {/etc/exim/namelist}}
53231 </literallayout>
53232 <para>
53233 Because the name may contain any characters, including slashes, the <option>name</option>
53234 option must be given last. The remainder of the string is used as the name. For
53235 the example above, if <filename>/etc/exim/namelist</filename> contains:
53236 </para>
53237 <literallayout class="monospaced">
53238 bigegg:  Humpty Dumpty
53239 </literallayout>
53240 <para>
53241 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
53242 line would be:
53243 </para>
53244 <literallayout class="monospaced">
53245 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
53246 </literallayout>
53247 <para>
53248 <indexterm role="concept">
53249 <primary>return path</primary>
53250 <secondary>in submission mode</secondary>
53251 </indexterm>
53252 By default, submission mode forces the return path to the same address as is
53253 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
53254 specified, the return path is also left unchanged.
53255 </para>
53256 <para>
53257 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
53258 ACL. This means that any sender checks performed before the fix-ups use the
53259 untrusted sender address specified by the user, not the trusted sender address
53260 specified by submission mode. Although this might be slightly unexpected, it
53261 does mean that you can configure ACL checks to spot that a user is trying to
53262 spoof another&#x2019;s address.
53263 </para>
53264 </section>
53265 <section id="SECTlineendings">
53266 <title>Line endings</title>
53267 <para>
53268 <indexterm role="concept">
53269 <primary>line endings</primary>
53270 </indexterm>
53271 <indexterm role="concept">
53272 <primary>carriage return</primary>
53273 </indexterm>
53274 <indexterm role="concept">
53275 <primary>linefeed</primary>
53276 </indexterm>
53277 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
53278 linefeed) is the line ending for messages transmitted over the Internet using
53279 SMTP over TCP/IP. However, within individual operating systems, different
53280 conventions are used. For example, Unix-like systems use just LF, but others
53281 use CRLF or just CR.
53282 </para>
53283 <para>
53284 Exim was designed for Unix-like systems, and internally, it stores messages
53285 using the system&#x2019;s convention of a single LF as a line terminator. When
53286 receiving a message, all line endings are translated to this standard format.
53287 Originally, it was thought that programs that passed messages directly to an
53288 MTA within an operating system would use that system&#x2019;s convention. Experience
53289 has shown that this is not the case; for example, there are Unix applications
53290 that use CRLF in this circumstance. For this reason, and for compatibility with
53291 other MTAs, the way Exim handles line endings for all messages is now as
53292 follows:
53293 </para>
53294 <itemizedlist>
53295 <listitem>
53296 <para>
53297 LF not preceded by CR is treated as a line ending.
53298 </para>
53299 </listitem>
53300 <listitem>
53301 <para>
53302 CR is treated as a line ending; if it is immediately followed by LF, the LF
53303 is ignored.
53304 </para>
53305 </listitem>
53306 <listitem>
53307 <para>
53308 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
53309 nor a local message in the state where a line containing only a dot is a
53310 terminator.
53311 </para>
53312 </listitem>
53313 <listitem>
53314 <para>
53315 If a bare CR is encountered within a header line, an extra space is added after
53316 the line terminator so as not to end the header line. The reasoning behind this
53317 is that bare CRs in header lines are most likely either to be mistakes, or
53318 people trying to play silly games.
53319 </para>
53320 </listitem>
53321 <listitem>
53322 <para>
53323 If the first header line received in a message ends with CRLF, a subsequent
53324 bare LF in a header line is treated in the same way as a bare CR in a header
53325 line.
53326 </para>
53327 </listitem>
53328 </itemizedlist>
53329 </section>
53330 <section>
53331 <title>Unqualified addresses</title>
53332 <para>
53333 <indexterm role="concept">
53334 <primary>unqualified addresses</primary>
53335 </indexterm>
53336 <indexterm role="concept">
53337 <primary>address</primary>
53338 <secondary>qualification</secondary>
53339 </indexterm>
53340 By default, Exim expects every envelope address it receives from an external
53341 host to be fully qualified. Unqualified addresses cause negative responses to
53342 SMTP commands. However, because SMTP is used as a means of transporting
53343 messages from MUAs running on personal workstations, there is sometimes a
53344 requirement to accept unqualified addresses from specific hosts or IP networks.
53345 </para>
53346 <para>
53347 Exim has two options that separately control which hosts may send unqualified
53348 sender or receipient addresses in SMTP commands, namely
53349 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
53350 cases, if an unqualified address is accepted, it is qualified by adding the
53351 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
53352 </para>
53353 <para>
53354 <indexterm role="concept">
53355 <primary><option>qualify_domain</option></primary>
53356 </indexterm>
53357 <indexterm role="concept">
53358 <primary><option>qualify_recipient</option></primary>
53359 </indexterm>
53360 Unqualified addresses in header lines are automatically qualified for messages
53361 that are locally originated, unless the <option>-bnq</option> option is given on the command
53362 line. For messages received over SMTP, unqualified addresses in header lines
53363 are qualified only if unqualified addresses are permitted in SMTP commands. In
53364 other words, such qualification is also controlled by
53365 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
53366 </para>
53367 </section>
53368 <section>
53369 <title>The UUCP From line</title>
53370 <para>
53371 <indexterm role="concept">
53372 <primary><quote>From</quote> line</primary>
53373 </indexterm>
53374 <indexterm role="concept">
53375 <primary>UUCP</primary>
53376 <secondary><quote>From</quote> line</secondary>
53377 </indexterm>
53378 <indexterm role="concept">
53379 <primary>sender</primary>
53380 <secondary>address</secondary>
53381 </indexterm>
53382 <indexterm role="concept">
53383 <primary><option>uucp_from_pattern</option></primary>
53384 </indexterm>
53385 <indexterm role="concept">
53386 <primary><option>uucp_from_sender</option></primary>
53387 </indexterm>
53388 <indexterm role="concept">
53389 <primary>envelope sender</primary>
53390 </indexterm>
53391 <indexterm role="concept">
53392 <primary>Sendmail compatibility</primary>
53393 <secondary><quote>From</quote> line</secondary>
53394 </indexterm>
53395 Messages that have come from UUCP (and some other applications) often begin
53396 with a line containing the envelope sender and a timestamp, following the word
53397 <quote>From</quote>. Examples of two common formats are:
53398 </para>
53399 <literallayout class="monospaced">
53400 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
53401 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
53402 </literallayout>
53403 <para>
53404 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
53405 Exim recognizes such lines at the start of messages that are submitted to it
53406 via the command line (that is, on the standard input). It does not recognize
53407 such lines in incoming SMTP messages, unless the sending host matches
53408 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
53409 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
53410 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
53411 default value matches the two common cases shown above and puts the address
53412 that follows <quote>From</quote> into <varname>$1</varname>.
53413 </para>
53414 <para>
53415 <indexterm role="concept">
53416 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
53417 <secondary>in <quote>From </quote> line handling</secondary>
53418 </indexterm>
53419 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
53420 a trusted user, the message&#x2019;s sender address is constructed by expanding the
53421 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
53422 then parsed as an RFC 2822 address. If there is no domain, the local part is
53423 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
53424 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
53425 </para>
53426 <para>
53427 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
53428 sender address is not changed. This is also the case for incoming SMTP messages
53429 that are permitted to contain <quote>From</quote> lines.
53430 </para>
53431 <para>
53432 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
53433 treated as a data line that starts the body of the message, as it is not valid
53434 as a header line. This also happens if a <quote>From</quote> line is present in an
53435 incoming SMTP message from a source that is not permitted to send them.
53436 </para>
53437 </section>
53438 <section>
53439 <title>Resent- header lines</title>
53440 <para>
53441 <indexterm role="concept">
53442 <primary><option>Resent-</option> header lines</primary>
53443 </indexterm>
53444 RFC 2822 makes provision for sets of header lines starting with the string
53445 <literal>Resent-</literal> to be added to a message when it is resent by the original
53446 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
53447 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
53448 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
53449 </para>
53450 <blockquote>
53451 <para>
53452 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
53453 processing of replies or other such automatic actions on messages.</emphasis>
53454 </para>
53455 </blockquote>
53456 <para>
53457 This leaves things a bit vague as far as other processing actions such as
53458 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
53459 follows:
53460 </para>
53461 <itemizedlist>
53462 <listitem>
53463 <para>
53464 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
53465 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
53466 </para>
53467 </listitem>
53468 <listitem>
53469 <para>
53470 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
53471 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
53472 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
53473 </para>
53474 </listitem>
53475 <listitem>
53476 <para>
53477 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
53478 also removed.
53479 </para>
53480 </listitem>
53481 <listitem>
53482 <para>
53483 For a locally-submitted message,
53484 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
53485 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
53486 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
53487 included in log lines in this case.
53488 </para>
53489 </listitem>
53490 <listitem>
53491 <para>
53492 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
53493 <option>Resent-</option> header lines are present.
53494 </para>
53495 </listitem>
53496 </itemizedlist>
53497 </section>
53498 <section>
53499 <title>The Auto-Submitted: header line</title>
53500 <para>
53501 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
53502 includes the header line:
53503 </para>
53504 <literallayout class="monospaced">
53505 Auto-Submitted: auto-replied
53506 </literallayout>
53507 </section>
53508 <section>
53509 <title>The Bcc: header line</title>
53510 <para>
53511 <indexterm role="concept">
53512 <primary><emphasis>Bcc:</emphasis> header line</primary>
53513 </indexterm>
53514 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
53515 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
53516 extracting its addresses). If <option>-t</option> is not present on the command line, any
53517 existing <emphasis>Bcc:</emphasis> is not removed.
53518 </para>
53519 </section>
53520 <section>
53521 <title>The Date: header line</title>
53522 <para>
53523 <indexterm role="concept">
53524 <primary><emphasis>Date:</emphasis> header line</primary>
53525 </indexterm>
53526 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
53527 Exim adds one, using the current date and time, unless the
53528 <option>suppress_local_fixups</option> control has been specified.
53529 </para>
53530 </section>
53531 <section>
53532 <title>The Delivery-date: header line</title>
53533 <para>
53534 <indexterm role="concept">
53535 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
53536 </indexterm>
53537 <indexterm role="concept">
53538 <primary><option>delivery_date_remove</option></primary>
53539 </indexterm>
53540 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
53541 set. Exim can be configured to add them to the final delivery of messages. (See
53542 the generic <option>delivery_date_add</option> transport option.) They should not be present
53543 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
53544 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
53545 messages.
53546 </para>
53547 </section>
53548 <section>
53549 <title>The Envelope-to: header line</title>
53550 <para>
53551 <indexterm role="concept">
53552 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
53553 </indexterm>
53554 <indexterm role="concept">
53555 <primary><option>envelope_to_remove</option></primary>
53556 </indexterm>
53557 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
53558 Exim can be configured to add them to the final delivery of messages. (See the
53559 generic <option>envelope_to_add</option> transport option.) They should not be present in
53560 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
53561 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
53562 messages.
53563 </para>
53564 </section>
53565 <section id="SECTthefrohea">
53566 <title>The From: header line</title>
53567 <para>
53568 <indexterm role="concept">
53569 <primary><emphasis>From:</emphasis> header line</primary>
53570 </indexterm>
53571 <indexterm role="concept">
53572 <primary>Sendmail compatibility</primary>
53573 <secondary><quote>From</quote> line</secondary>
53574 </indexterm>
53575 <indexterm role="concept">
53576 <primary>message</primary>
53577 <secondary>submission</secondary>
53578 </indexterm>
53579 <indexterm role="concept">
53580 <primary>submission mode</primary>
53581 </indexterm>
53582 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
53583 adds one if either of the following conditions is true:
53584 </para>
53585 <itemizedlist>
53586 <listitem>
53587 <para>
53588 The envelope sender address is not empty (that is, this is not a bounce
53589 message). The added header line copies the envelope sender address.
53590 </para>
53591 </listitem>
53592 <listitem>
53593 <para>
53594 <indexterm role="concept">
53595 <primary><varname>$authenticated_id</varname></primary>
53596 </indexterm>
53597 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
53598 </para>
53599 <orderedlist numeration="arabic">
53600 <listitem>
53601 <para>
53602 <indexterm role="concept">
53603 <primary><varname>$qualify_domain</varname></primary>
53604 </indexterm>
53605 If no domain is specified by the submission control, the local part is
53606 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53607 </para>
53608 </listitem>
53609 <listitem>
53610 <para>
53611 If a non-empty domain is specified by the submission control, the local
53612 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
53613 </para>
53614 </listitem>
53615 <listitem>
53616 <para>
53617 If an empty domain is specified by the submission control,
53618 <varname>$authenticated_id</varname> is assumed to be the complete address.
53619 </para>
53620 </listitem>
53621 </orderedlist>
53622 </listitem>
53623 </itemizedlist>
53624 <para>
53625 A non-empty envelope sender takes precedence.
53626 </para>
53627 <para>
53628 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
53629 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
53630 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
53631 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
53632 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
53633 <option>unknown_login</option> configuration option). The address is qualified with
53634 <option>qualify_domain</option>.
53635 </para>
53636 <para>
53637 For compatibility with Sendmail, if an incoming, non-SMTP message has a
53638 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
53639 user, this is replaced by an address containing the user&#x2019;s login name and full
53640 name as described in section <xref linkend="SECTconstr"/>.
53641 </para>
53642 </section>
53643 <section>
53644 <title>The Message-ID: header line</title>
53645 <para>
53646 <indexterm role="concept">
53647 <primary><emphasis>Message-ID:</emphasis> header line</primary>
53648 </indexterm>
53649 <indexterm role="concept">
53650 <primary>message</primary>
53651 <secondary>submission</secondary>
53652 </indexterm>
53653 <indexterm role="concept">
53654 <primary><option>message_id_header_text</option></primary>
53655 </indexterm>
53656 If a locally-generated or submission-mode incoming message does not contain a
53657 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
53658 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
53659 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
53660 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
53661 message id, preceded by the letter E to ensure it starts with a letter, and
53662 followed by @ and the primary host name. Additional information can be included
53663 in this header line by setting the <option>message_id_header_text</option> and/or
53664 <option>message_id_header_domain</option> options.
53665 </para>
53666 </section>
53667 <section>
53668 <title>The Received: header line</title>
53669 <para>
53670 <indexterm role="concept">
53671 <primary><emphasis>Received:</emphasis> header line</primary>
53672 </indexterm>
53673 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
53674 contents are defined by the <option>received_header_text</option> configuration option, and
53675 Exim automatically adds a semicolon and a timestamp to the configured string.
53676 </para>
53677 <para>
53678 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
53679 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
53680 line is the time that the message started to be received. This is the value
53681 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
53682 </para>
53683 <para>
53684 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
53685 changed to the time of acceptance, which is (apart from a small delay while the
53686 -H spool file is written) the earliest time at which delivery could start.
53687 </para>
53688 </section>
53689 <section>
53690 <title>The References: header line</title>
53691 <para>
53692 <indexterm role="concept">
53693 <primary><emphasis>References:</emphasis> header line</primary>
53694 </indexterm>
53695 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
53696 header line. This is constructed according to the rules that are described in
53697 section 3.64 of RFC 2822 (which states that replies should contain such a
53698 header line), and section 3.14 of RFC 3834 (which states that automatic
53699 responses are not different in this respect). However, because some mail
53700 processing software does not cope well with very long header lines, no more
53701 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
53702 incoming message. If there are more than 12, the first one and then the final
53703 11 are copied, before adding the message ID of the incoming message.
53704 </para>
53705 </section>
53706 <section>
53707 <title>The Return-path: header line</title>
53708 <para>
53709 <indexterm role="concept">
53710 <primary><emphasis>Return-path:</emphasis> header line</primary>
53711 </indexterm>
53712 <indexterm role="concept">
53713 <primary><option>return_path_remove</option></primary>
53714 </indexterm>
53715 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
53716 it does the final delivery of messages. (See the generic <option>return_path_add</option>
53717 transport option.) Therefore, they should not be present in messages in
53718 transit. If the <option>return_path_remove</option> configuration option is set (the
53719 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
53720 </para>
53721 </section>
53722 <section id="SECTthesenhea">
53723 <title>The Sender: header line</title>
53724 <para>
53725 <indexterm role="concept">
53726 <primary><emphasis>Sender:</emphasis> header line</primary>
53727 </indexterm>
53728 <indexterm role="concept">
53729 <primary>message</primary>
53730 <secondary>submission</secondary>
53731 </indexterm>
53732 For a locally-originated message from an untrusted user, Exim may remove an
53733 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
53734 these actions by setting the <option>local_sender_retain</option> option true, the
53735 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
53736 control setting.
53737 </para>
53738 <para>
53739 When a local message is received from an untrusted user and
53740 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
53741 control has not been set, a check is made to see if the address given in the
53742 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
53743 that is expected has the login name as the local part and the value of
53744 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
53745 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
53746 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
53747 line is added to the message.
53748 </para>
53749 <para>
53750 If you set <option>local_from_check</option> false, this checking does not occur. However,
53751 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
53752 <option>local_sender_retain</option> to be true. It is not possible to set both of these
53753 options true at the same time.
53754 </para>
53755 <para>
53756 <indexterm role="concept">
53757 <primary>submission mode</primary>
53758 </indexterm>
53759 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
53760 received over TCP/IP or for messages submitted by trusted users. However, when
53761 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
53762 not specified on the submission control, the following processing takes place:
53763 </para>
53764 <para>
53765 <indexterm role="concept">
53766 <primary><varname>$authenticated_id</varname></primary>
53767 </indexterm>
53768 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
53769 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
53770 created as follows:
53771 </para>
53772 <itemizedlist>
53773 <listitem>
53774 <para>
53775 <indexterm role="concept">
53776 <primary><varname>$qualify_domain</varname></primary>
53777 </indexterm>
53778 If no domain is specified by the submission control, the local part is
53779 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53780 </para>
53781 </listitem>
53782 <listitem>
53783 <para>
53784 If a non-empty domain is specified by the submission control, the local part
53785 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
53786 </para>
53787 </listitem>
53788 <listitem>
53789 <para>
53790 If an empty domain is specified by the submission control,
53791 <varname>$authenticated_id</varname> is assumed to be the complete address.
53792 </para>
53793 </listitem>
53794 </itemizedlist>
53795 <para>
53796 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
53797 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
53798 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
53799 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
53800 </para>
53801 <para>
53802 <indexterm role="concept">
53803 <primary>return path</primary>
53804 <secondary>created from <emphasis>Sender:</emphasis></secondary>
53805 </indexterm>
53806 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
53807 the message (the envelope sender address) is changed to be the same address,
53808 except in the case of submission mode when <option>sender_retain</option> is specified.
53809 </para>
53810 </section>
53811 <section id="SECTheadersaddrem">
53812 <title>Adding and removing header lines in routers and transports</title>
53813 <para>
53814 <indexterm role="concept">
53815 <primary>header lines</primary>
53816 <secondary>adding; in router or transport</secondary>
53817 </indexterm>
53818 <indexterm role="concept">
53819 <primary>header lines</primary>
53820 <secondary>removing; in router or transport</secondary>
53821 </indexterm>
53822 When a message is delivered, the addition and removal of header lines can be
53823 specified in a system filter, or on any of the routers and transports that
53824 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
53825 modifying headers in a system filter. Header lines can also be added in an ACL
53826 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
53827 </para>
53828 <para>
53829 In contrast to what happens in a system filter, header modifications that are
53830 specified on routers and transports apply only to the particular recipient
53831 addresses that are being processed by those routers and transports. These
53832 changes do not actually take place until a copy of the message is being
53833 transported. Therefore, they do not affect the basic set of header lines, and
53834 they do not affect the values of the variables that refer to header lines.
53835 </para>
53836 <para>
53837 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
53838 the transport cannot refer to the modified header lines, because such
53839 expansions all occur before the message is actually transported.
53840 </para>
53841 <para>
53842 For both routers and transports, the result of expanding a <option>headers_add</option>
53843 option must be in the form of one or more RFC 2822 header lines, separated by
53844 newlines (coded as <quote>\n</quote>). For example:
53845 </para>
53846 <literallayout class="monospaced">
53847 headers_add = X-added-header: added by $primary_hostname\n\
53848               X-added-second: another added header line
53849 </literallayout>
53850 <para>
53851 Exim does not check the syntax of these added header lines.
53852 </para>
53853 <para>
53854 The result of expanding <option>headers_remove</option> must consist of a colon-separated
53855 list of header names. This is confusing, because header names themselves are
53856 often terminated by colons. In this case, the colons are the list separators,
53857 not part of the names. For example:
53858 </para>
53859 <literallayout class="monospaced">
53860 headers_remove = return-receipt-to:acknowledge-to
53861 </literallayout>
53862 <para>
53863 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
53864 is expanded at routing time, and then associated with all addresses that are
53865 accepted by that router, and also with any new addresses that it generates. If
53866 an address passes through several routers as a result of aliasing or
53867 forwarding, the changes are cumulative.
53868 </para>
53869 <para>
53870 <indexterm role="concept">
53871 <primary><option>unseen</option> option</primary>
53872 </indexterm>
53873 However, this does not apply to multiple routers that result from the use of
53874 the <option>unseen</option> option. Any header modifications that were specified by the
53875 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
53876 </para>
53877 <para>
53878 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
53879 settings cannot be delivered together in a batch, so a transport is always
53880 dealing with a set of addresses that have the same header-processing
53881 requirements.
53882 </para>
53883 <para>
53884 The transport starts by writing the original set of header lines that arrived
53885 with the message, possibly modified by the system filter. As it writes out
53886 these lines, it consults the list of header names that were attached to the
53887 recipient address(es) by <option>headers_remove</option> options in routers, and it also
53888 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
53889 names are on either of these lists are not written out. If there are multiple
53890 instances of any listed header, they are all skipped.
53891 </para>
53892 <para>
53893 After the remaining original header lines have been written, new header
53894 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
53895 the order in which they were attached to the address. These are followed by any
53896 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
53897 </para>
53898 <para>
53899 This way of handling header line modifications in routers and transports has
53900 the following consequences:
53901 </para>
53902 <itemizedlist>
53903 <listitem>
53904 <para>
53905 The original set of header lines, possibly modified by the system filter,
53906 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
53907 to it, at all times.
53908 </para>
53909 </listitem>
53910 <listitem>
53911 <para>
53912 Header lines that are added by a router&#x2019;s
53913 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
53914 expansion syntax in subsequent routers or the transport.
53915 </para>
53916 </listitem>
53917 <listitem>
53918 <para>
53919 Conversely, header lines that are specified for removal by <option>headers_remove</option>
53920 in a router remain visible to subsequent routers and the transport.
53921 </para>
53922 </listitem>
53923 <listitem>
53924 <para>
53925 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
53926 a later router or by a transport.
53927 </para>
53928 </listitem>
53929 <listitem>
53930 <para>
53931 An added header can refer to the contents of an original header that is to be
53932 removed, even it has the same name as the added header. For example:
53933 </para>
53934 <literallayout class="monospaced">
53935 headers_remove = subject
53936 headers_add = Subject: new subject (was: $h_subject:)
53937 </literallayout>
53938 </listitem>
53939 </itemizedlist>
53940 <para>
53941 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
53942 for a <command>redirect</command> router that has the <option>one_time</option> option set.
53943 </para>
53944 </section>
53945 <section id="SECTconstr">
53946 <title>Constructed addresses</title>
53947 <para>
53948 <indexterm role="concept">
53949 <primary>address</primary>
53950 <secondary>constructed</secondary>
53951 </indexterm>
53952 <indexterm role="concept">
53953 <primary>constructed address</primary>
53954 </indexterm>
53955 When Exim constructs a sender address for a locally-generated message, it uses
53956 the form
53957 </para>
53958 <literallayout>
53959 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
53960 </literallayout>
53961 <para>
53962 For example:
53963 </para>
53964 <literallayout class="monospaced">
53965 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
53966 </literallayout>
53967 <para>
53968 The user name is obtained from the <option>-F</option> command line option if set, or
53969 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
53970 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
53971 ampersand character, this is replaced by the login name with the first letter
53972 upper cased, as is conventional in a number of operating systems. See the
53973 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
53974 The <option>unknown_username</option> option can be used to specify user names in cases when
53975 there is no password file entry.
53976 </para>
53977 <para>
53978 <indexterm role="concept">
53979 <primary>RFC 2047</primary>
53980 </indexterm>
53981 In all cases, the user name is made to conform to RFC 2822 by quoting all or
53982 parts of it if necessary. In addition, if it contains any non-printing
53983 characters, it is encoded as described in RFC 2047, which defines a way of
53984 including non-ASCII characters in header lines. The value of the
53985 <option>headers_charset</option> option specifies the name of the encoding that is used (the
53986 characters are assumed to be in this encoding). The setting of
53987 <option>print_topbitchars</option> controls whether characters with the top bit set (that
53988 is, with codes greater than 127) count as printing characters or not.
53989 </para>
53990 </section>
53991 <section>
53992 <title>Case of local parts</title>
53993 <para>
53994 <indexterm role="concept">
53995 <primary>case of local parts</primary>
53996 </indexterm>
53997 <indexterm role="concept">
53998 <primary>local part</primary>
53999 <secondary>case of</secondary>
54000 </indexterm>
54001 RFC 2822 states that the case of letters in the local parts of addresses cannot
54002 be assumed to be non-significant. Exim preserves the case of local parts of
54003 addresses, but by default it uses a lower-cased form when it is routing,
54004 because on most Unix systems, usernames are in lower case and case-insensitive
54005 routing is required. However, any particular router can be made to use the
54006 original case for local parts by setting the <option>caseful_local_part</option> generic
54007 router option.
54008 </para>
54009 <para>
54010 <indexterm role="concept">
54011 <primary>mixed-case login names</primary>
54012 </indexterm>
54013 If you must have mixed-case user names on your system, the best way to proceed,
54014 assuming you want case-independent handling of incoming email, is to set up
54015 your first router to convert incoming local parts in your domains to the
54016 correct case by means of a file lookup. For example:
54017 </para>
54018 <literallayout class="monospaced">
54019 correct_case:
54020   driver = redirect
54021   domains = +local_domains
54022   data = ${lookup{$local_part}cdb\
54023               {/etc/usercased.cdb}{$value}fail}\
54024               @$domain
54025 </literallayout>
54026 <para>
54027 For this router, the local part is forced to lower case by the default action
54028 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
54029 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
54030 on any subsequent routers which process your domains, they will operate on
54031 local parts with the correct case in a case-sensitive manner.
54032 </para>
54033 </section>
54034 <section>
54035 <title>Dots in local parts</title>
54036 <para>
54037 <indexterm role="concept">
54038 <primary>dot</primary>
54039 <secondary>in local part</secondary>
54040 </indexterm>
54041 <indexterm role="concept">
54042 <primary>local part</primary>
54043 <secondary>dots in</secondary>
54044 </indexterm>
54045 RFC 2822 forbids empty components in local parts. That is, an unquoted local
54046 part may not begin or end with a dot, nor have two consecutive dots in the
54047 middle. However, it seems that many MTAs do not enforce this, so Exim permits
54048 empty components for compatibility.
54049 </para>
54050 </section>
54051 <section>
54052 <title>Rewriting addresses</title>
54053 <para>
54054 <indexterm role="concept">
54055 <primary>rewriting</primary>
54056 <secondary>addresses</secondary>
54057 </indexterm>
54058 Rewriting of sender and recipient addresses, and addresses in headers, can
54059 happen automatically, or as the result of configuration options, as described
54060 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
54061 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
54062 </para>
54063 <para>
54064 Automatic rewriting includes qualification, as mentioned above. The other case
54065 in which it can happen is when an incomplete non-local domain is given. The
54066 routing process may cause this to be expanded into the full domain name. For
54067 example, a header such as
54068 </para>
54069 <literallayout class="monospaced">
54070 To: hare@teaparty
54071 </literallayout>
54072 <para>
54073 might get rewritten as
54074 </para>
54075 <literallayout class="monospaced">
54076 To: hare@teaparty.wonderland.fict.example
54077 </literallayout>
54078 <para>
54079 Rewriting as a result of routing is the one kind of message processing that
54080 does not happen at input time, as it cannot be done until the address has
54081 been routed.
54082 </para>
54083 <para>
54084 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
54085 addresses have been routed, in case any of the headers get changed as a
54086 result of routing. However, doing this in practice would hold up many
54087 deliveries for unreasonable amounts of time, just because one address could not
54088 immediately be routed. Exim therefore does not delay other deliveries when
54089 routing of one or more addresses is deferred.
54090 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
54091 </para>
54092 </section>
54093 </chapter>
54094
54095 <chapter id="CHAPSMTP">
54096 <title>SMTP processing</title>
54097 <para>
54098 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
54099 <primary>SMTP</primary>
54100 <secondary>processing details</secondary>
54101 </indexterm>
54102 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
54103 <primary>LMTP</primary>
54104 <secondary>processing details</secondary>
54105 </indexterm>
54106 Exim supports a number of different ways of using the SMTP protocol, and its
54107 LMTP variant, which is an interactive protocol for transferring messages into a
54108 closed mail store application. This chapter contains details of how SMTP is
54109 processed. For incoming mail, the following are available:
54110 </para>
54111 <itemizedlist>
54112 <listitem>
54113 <para>
54114 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
54115 </para>
54116 </listitem>
54117 <listitem>
54118 <para>
54119 SMTP over the standard input and output (the <option>-bs</option> option);
54120 </para>
54121 </listitem>
54122 <listitem>
54123 <para>
54124 Batched SMTP on the standard input (the <option>-bS</option> option).
54125 </para>
54126 </listitem>
54127 </itemizedlist>
54128 <para>
54129 For mail delivery, the following are available:
54130 </para>
54131 <itemizedlist>
54132 <listitem>
54133 <para>
54134 SMTP over TCP/IP (the <command>smtp</command> transport);
54135 </para>
54136 </listitem>
54137 <listitem>
54138 <para>
54139 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
54140 <quote>lmtp</quote>);
54141 </para>
54142 </listitem>
54143 <listitem>
54144 <para>
54145 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
54146 transport);
54147 </para>
54148 </listitem>
54149 <listitem>
54150 <para>
54151 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
54152 the <option>use_bsmtp</option> option set).
54153 </para>
54154 </listitem>
54155 </itemizedlist>
54156 <para>
54157 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
54158 stored in or read from files (or pipes), in a format in which SMTP commands are
54159 used to contain the envelope information.
54160 </para>
54161 <section id="SECToutSMTPTCP">
54162 <title>Outgoing SMTP and LMTP over TCP/IP</title>
54163 <para>
54164 <indexterm role="concept">
54165 <primary>SMTP</primary>
54166 <secondary>outgoing over TCP/IP</secondary>
54167 </indexterm>
54168 <indexterm role="concept">
54169 <primary>outgoing SMTP over TCP/IP</primary>
54170 </indexterm>
54171 <indexterm role="concept">
54172 <primary>LMTP</primary>
54173 <secondary>over TCP/IP</secondary>
54174 </indexterm>
54175 <indexterm role="concept">
54176 <primary>outgoing LMTP over TCP/IP</primary>
54177 </indexterm>
54178 <indexterm role="concept">
54179 <primary>EHLO</primary>
54180 </indexterm>
54181 <indexterm role="concept">
54182 <primary>HELO</primary>
54183 </indexterm>
54184 <indexterm role="concept">
54185 <primary>SIZE option on MAIL command</primary>
54186 </indexterm>
54187 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
54188 The <option>protocol</option> option selects which protocol is to be used, but the actual
54189 processing is the same in both cases.
54190 </para>
54191 <para>
54192 If, in response to its EHLO command, Exim is told that the SIZE
54193 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
54194 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
54195 <option>size_addition</option> option (default 1024) to allow for additions to the message
54196 such as per-transport header lines, or changes made in a
54197 <indexterm role="concept">
54198 <primary>transport</primary>
54199 <secondary>filter</secondary>
54200 </indexterm>
54201 <indexterm role="concept">
54202 <primary>filter</primary>
54203 <secondary>transport filter</secondary>
54204 </indexterm>
54205 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
54206 suppressed.
54207 </para>
54208 <para>
54209 If the remote server advertises support for PIPELINING, Exim uses the
54210 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
54211 required for the transaction.
54212 </para>
54213 <para>
54214 If the remote server advertises support for the STARTTLS command, and Exim
54215 was built to support TLS encryption, it tries to start a TLS session unless the
54216 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
54217 </para>
54218 <para>
54219 If the remote server advertises support for the AUTH command, Exim scans
54220 the authenticators configuration for any suitable client settings, as described
54221 in chapter <xref linkend="CHAPSMTPAUTH"/>.
54222 </para>
54223 <para>
54224 <indexterm role="concept">
54225 <primary>carriage return</primary>
54226 </indexterm>
54227 <indexterm role="concept">
54228 <primary>linefeed</primary>
54229 </indexterm>
54230 Responses from the remote host are supposed to be terminated by CR followed by
54231 LF. However, there are known to be hosts that do not send CR characters, so in
54232 order to be able to interwork with such hosts, Exim treats LF on its own as a
54233 line terminator.
54234 </para>
54235 <para>
54236 If a message contains a number of different addresses, all those with the same
54237 characteristics (for example, the same envelope sender) that resolve to the
54238 same set of hosts, in the same order, are sent in a single SMTP transaction,
54239 even if they are for different domains, unless there are more than the setting
54240 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
54241 they are split into groups containing no more than <option>max_rcpts</option> addresses
54242 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
54243 in parallel sessions. The order of hosts with identical MX values is not
54244 significant when checking whether addresses can be batched in this way.
54245 </para>
54246 <para>
54247 When the <command>smtp</command> transport suffers a temporary failure that is not
54248 message-related, Exim updates its transport-specific database, which contains
54249 records indexed by host name that remember which messages are waiting for each
54250 particular host. It also updates the retry database with new retry times.
54251 </para>
54252 <para>
54253 <indexterm role="concept">
54254 <primary>hints database</primary>
54255 <secondary>retry keys</secondary>
54256 </indexterm>
54257 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
54258 a multi-homed host is broken, it will soon be skipped most of the time.
54259 See the next section for more detail about error handling.
54260 </para>
54261 <para>
54262 <indexterm role="concept">
54263 <primary>SMTP</primary>
54264 <secondary>passed connection</secondary>
54265 </indexterm>
54266 <indexterm role="concept">
54267 <primary>SMTP</primary>
54268 <secondary>batching over TCP/IP</secondary>
54269 </indexterm>
54270 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
54271 looks in the hints database for the transport to see if there are any queued
54272 messages waiting for the host to which it is connected. If it finds one, it
54273 creates a new Exim process using the <option>-MC</option> option (which can only be used by
54274 a process running as root or the Exim user) and passes the TCP/IP socket to it
54275 so that it can deliver another message using the same socket. The new process
54276 does only those deliveries that are routed to the connected host, and may in
54277 turn pass the socket on to a third process, and so on.
54278 </para>
54279 <para>
54280 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
54281 limit the number of messages sent down a single TCP/IP connection.
54282 </para>
54283 <para>
54284 <indexterm role="concept">
54285 <primary>asterisk</primary>
54286 <secondary>after IP address</secondary>
54287 </indexterm>
54288 The second and subsequent messages delivered down an existing connection are
54289 identified in the main log by the addition of an asterisk after the closing
54290 square bracket of the IP address.
54291 </para>
54292 </section>
54293 <section id="SECToutSMTPerr">
54294 <title>Errors in outgoing SMTP</title>
54295 <para>
54296 <indexterm role="concept">
54297 <primary>error</primary>
54298 <secondary>in outgoing SMTP</secondary>
54299 </indexterm>
54300 <indexterm role="concept">
54301 <primary>SMTP</primary>
54302 <secondary>errors in outgoing</secondary>
54303 </indexterm>
54304 <indexterm role="concept">
54305 <primary>host</primary>
54306 <secondary>error</secondary>
54307 </indexterm>
54308 Three different kinds of error are recognized for outgoing SMTP: host errors,
54309 message errors, and recipient errors.
54310 </para>
54311 <variablelist>
54312 <varlistentry>
54313 <term><emphasis role="bold">Host errors</emphasis></term>
54314 <listitem>
54315 <para>
54316 A host error is not associated with a particular message or with a
54317 particular recipient of a message. The host errors are:
54318 </para>
54319 <itemizedlist>
54320 <listitem>
54321 <para>
54322 Connection refused or timed out,
54323 </para>
54324 </listitem>
54325 <listitem>
54326 <para>
54327 Any error response code on connection,
54328 </para>
54329 </listitem>
54330 <listitem>
54331 <para>
54332 Any error response code to EHLO or HELO,
54333 </para>
54334 </listitem>
54335 <listitem>
54336 <para>
54337 Loss of connection at any time, except after <quote>.</quote>,
54338 </para>
54339 </listitem>
54340 <listitem>
54341 <para>
54342 I/O errors at any time,
54343 </para>
54344 </listitem>
54345 <listitem>
54346 <para>
54347 Timeouts during the session, other than in response to MAIL, RCPT or
54348 the <quote>.</quote> at the end of the data.
54349 </para>
54350 </listitem>
54351 </itemizedlist>
54352 <para>
54353 For a host error, a permanent error response on connection, or in response to
54354 EHLO, causes all addresses routed to the host to be failed. Any other host
54355 error causes all addresses to be deferred, and retry data to be created for the
54356 host. It is not tried again, for any message, until its retry time arrives. If
54357 the current set of addresses are not all delivered in this run (to some
54358 alternative host), the message is added to the list of those waiting for this
54359 host, so if it is still undelivered when a subsequent successful delivery is
54360 made to the host, it will be sent down the same SMTP connection.
54361 </para>
54362 </listitem></varlistentry>
54363 <varlistentry>
54364 <term><emphasis role="bold">Message errors</emphasis></term>
54365 <listitem>
54366 <para>
54367 <indexterm role="concept">
54368 <primary>message</primary>
54369 <secondary>error</secondary>
54370 </indexterm>
54371 A message error is associated with a particular message when sent to a
54372 particular host, but not with a particular recipient of the message. The
54373 message errors are:
54374 </para>
54375 <itemizedlist>
54376 <listitem>
54377 <para>
54378 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
54379 the data,
54380 </para>
54381 </listitem>
54382 <listitem>
54383 <para>
54384 Timeout after MAIL,
54385 </para>
54386 </listitem>
54387 <listitem>
54388 <para>
54389 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
54390 timeout after the DATA command itself is treated as a host error, as is loss of
54391 connection at any other time.
54392 </para>
54393 </listitem>
54394 </itemizedlist>
54395 <para>
54396 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
54397 to be failed, and a delivery error report to be returned to the sender. A
54398 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
54399 addresses to be deferred. Retry data is not created for the host, but instead,
54400 a retry record for the combination of host plus message id is created. The
54401 message is not added to the list of those waiting for this host. This ensures
54402 that the failing message will not be sent to this host again until the retry
54403 time arrives. However, other messages that are routed to the host are not
54404 affected, so if it is some property of the message that is causing the error,
54405 it will not stop the delivery of other mail.
54406 </para>
54407 <para>
54408 If the remote host specified support for the SIZE parameter in its response
54409 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
54410 over-large message will cause a message error because the error arrives as a
54411 response to MAIL.
54412 </para>
54413 </listitem></varlistentry>
54414 <varlistentry>
54415 <term><emphasis role="bold">Recipient errors</emphasis></term>
54416 <listitem>
54417 <para>
54418 <indexterm role="concept">
54419 <primary>recipient</primary>
54420 <secondary>error</secondary>
54421 </indexterm>
54422 A recipient error is associated with a particular recipient of a message. The
54423 recipient errors are:
54424 </para>
54425 <itemizedlist>
54426 <listitem>
54427 <para>
54428 Any error response to RCPT,
54429 </para>
54430 </listitem>
54431 <listitem>
54432 <para>
54433 Timeout after RCPT.
54434 </para>
54435 </listitem>
54436 </itemizedlist>
54437 <para>
54438 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
54439 recipient address to be failed, and a bounce message to be returned to the
54440 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
54441 address to be deferred, and routing retry data to be created for it. This is
54442 used to delay processing of the address in subsequent queue runs, until its
54443 routing retry time arrives. This applies to all messages, but because it
54444 operates only in queue runs, one attempt will be made to deliver a new message
54445 to the failing address before the delay starts to operate. This ensures that,
54446 if the failure is really related to the message rather than the recipient
54447 (<quote>message too big for this recipient</quote> is a possible example), other messages
54448 have a chance of getting delivered. If a delivery to the address does succeed,
54449 the retry information gets cleared, so all stuck messages get tried again, and
54450 the retry clock is reset.
54451 </para>
54452 <para>
54453 The message is not added to the list of those waiting for this host. Use of the
54454 host for other messages is unaffected, and except in the case of a timeout,
54455 other recipients are processed independently, and may be successfully delivered
54456 in the current SMTP session. After a timeout it is of course impossible to
54457 proceed with the session, so all addresses get deferred. However, those other
54458 than the one that failed do not suffer any subsequent retry delays. Therefore,
54459 if one recipient is causing trouble, the others have a chance of getting
54460 through when a subsequent delivery attempt occurs before the failing
54461 recipient&#x2019;s retry time.
54462 </para>
54463 </listitem></varlistentry>
54464 </variablelist>
54465 <para>
54466 In all cases, if there are other hosts (or IP addresses) available for the
54467 current set of addresses (for example, from multiple MX records), they are
54468 tried in this run for any undelivered addresses, subject of course to their
54469 own retry data. In other words, recipient error retry data does not take effect
54470 until the next delivery attempt.
54471 </para>
54472 <para>
54473 Some hosts have been observed to give temporary error responses to every
54474 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
54475 would be nice if such circumstances could be recognized, and defer data for the
54476 host itself created, but this is not possible within the current Exim design.
54477 What actually happens is that retry data for every (host, message) combination
54478 is created.
54479 </para>
54480 <para>
54481 The reason that timeouts after MAIL and RCPT are treated specially is that
54482 these can sometimes arise as a result of the remote host&#x2019;s verification
54483 procedures. Exim makes this assumption, and treats them as if a temporary error
54484 response had been received. A timeout after <quote>.</quote> is treated specially because
54485 it is known that some broken implementations fail to recognize the end of the
54486 message if the last character of the last line is a binary zero. Thus, it is
54487 helpful to treat this case as a message error.
54488 </para>
54489 <para>
54490 Timeouts at other times are treated as host errors, assuming a problem with the
54491 host, or the connection to it. If a timeout after MAIL, RCPT,
54492 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
54493 the timeout is likely to occur at some other point in the dialogue, causing it
54494 then to be treated as a host error.
54495 </para>
54496 <para>
54497 There is experimental evidence that some MTAs drop the connection after the
54498 terminating <quote>.</quote> if they do not like the contents of the message for some
54499 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
54500 should be given. That is why Exim treats this case as a message rather than a
54501 host error, in order not to delay other messages to the same host.
54502 </para>
54503 </section>
54504 <section>
54505 <title>Incoming SMTP messages over TCP/IP</title>
54506 <para>
54507 <indexterm role="concept">
54508 <primary>SMTP</primary>
54509 <secondary>incoming over TCP/IP</secondary>
54510 </indexterm>
54511 <indexterm role="concept">
54512 <primary>incoming SMTP over TCP/IP</primary>
54513 </indexterm>
54514 <indexterm role="concept">
54515 <primary>inetd</primary>
54516 </indexterm>
54517 <indexterm role="concept">
54518 <primary>daemon</primary>
54519 </indexterm>
54520 Incoming SMTP messages can be accepted in one of two ways: by running a
54521 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
54522 <filename>/etc/inetd.conf</filename> should be like this:
54523 </para>
54524 <literallayout class="monospaced">
54525 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
54526 </literallayout>
54527 <para>
54528 Exim distinguishes between this case and the case of a locally running user
54529 agent using the <option>-bs</option> option by checking whether or not the standard input is
54530 a socket. When it is, either the port must be privileged (less than 1024), or
54531 the caller must be root or the Exim user. If any other user passes a socket
54532 with an unprivileged port number, Exim prints a message on the standard error
54533 stream and exits with an error code.
54534 </para>
54535 <para>
54536 By default, Exim does not make a log entry when a remote host connects or
54537 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
54538 unexpected. It can be made to write such log entries by setting the
54539 <option>smtp_connection</option> log selector.
54540 </para>
54541 <para>
54542 <indexterm role="concept">
54543 <primary>carriage return</primary>
54544 </indexterm>
54545 <indexterm role="concept">
54546 <primary>linefeed</primary>
54547 </indexterm>
54548 Commands from the remote host are supposed to be terminated by CR followed by
54549 LF. However, there are known to be hosts that do not send CR characters. In
54550 order to be able to interwork with such hosts, Exim treats LF on its own as a
54551 line terminator.
54552 Furthermore, because common code is used for receiving messages from all
54553 sources, a CR on its own is also interpreted as a line terminator. However, the
54554 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
54555 </para>
54556 <para>
54557 <indexterm role="concept">
54558 <primary>EHLO</primary>
54559 <secondary>invalid data</secondary>
54560 </indexterm>
54561 <indexterm role="concept">
54562 <primary>HELO</primary>
54563 <secondary>invalid data</secondary>
54564 </indexterm>
54565 One area that sometimes gives rise to problems concerns the EHLO or
54566 HELO commands. Some clients send syntactically invalid versions of these
54567 commands, which Exim rejects by default. (This is nothing to do with verifying
54568 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
54569 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
54570 match the broken hosts that send invalid commands.
54571 </para>
54572 <para>
54573 <indexterm role="concept">
54574 <primary>SIZE option on MAIL command</primary>
54575 </indexterm>
54576 <indexterm role="concept">
54577 <primary>MAIL</primary>
54578 <secondary>SIZE option</secondary>
54579 </indexterm>
54580 The amount of disk space available is checked whenever SIZE is received on
54581 a MAIL command, independently of whether <option>message_size_limit</option> or
54582 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
54583 false. A temporary error is given if there is not enough space. If
54584 <option>check_spool_space</option> is set, the check is for that amount of space plus the
54585 value given with SIZE, that is, it checks that the addition of the incoming
54586 message will not reduce the space below the threshold.
54587 </para>
54588 <para>
54589 When a message is successfully received, Exim includes the local message id in
54590 its response to the final <quote>.</quote> that terminates the data. If the remote host
54591 logs this text it can help with tracing what has happened to a message.
54592 </para>
54593 <para>
54594 The Exim daemon can limit the number of simultaneous incoming connections it is
54595 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
54596 number of simultaneous incoming connections from a single remote host (see the
54597 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
54598 rejected using the SMTP temporary error code 421.
54599 </para>
54600 <para>
54601 The Exim daemon does not rely on the SIGCHLD signal to detect when a
54602 subprocess has finished, as this can get lost at busy times. Instead, it looks
54603 for completed subprocesses every time it wakes up. Provided there are other
54604 things happening (new incoming calls, starts of queue runs), completed
54605 processes will be noticed and tidied away. On very quiet systems you may
54606 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
54607 it will be noticed when the daemon next wakes up.
54608 </para>
54609 <para>
54610 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
54611 and can also be set up to reject SMTP calls from non-reserved hosts at times of
54612 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
54613 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
54614 applies in both the daemon and <emphasis>inetd</emphasis> cases.
54615 </para>
54616 <para>
54617 Exim normally starts a delivery process for each message received, though this
54618 can be varied by means of the <option>-odq</option> command line option and the
54619 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
54620 number of simultaneously running delivery processes started in this way from
54621 SMTP input can be limited by the <option>smtp_accept_queue</option> and
54622 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
54623 subsequently received messages are just put on the input queue without starting
54624 a delivery process.
54625 </para>
54626 <para>
54627 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
54628 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
54629 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
54630 handled by an entirely independent Exim process. Control by load average is,
54631 however, available with <emphasis>inetd</emphasis>.
54632 </para>
54633 <para>
54634 Exim can be configured to verify addresses in incoming SMTP commands as they
54635 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
54636 to rewrite addresses at this time &ndash; before any syntax checking is done. See
54637 section <xref linkend="SECTrewriteS"/>.
54638 </para>
54639 <para>
54640 Exim can also be configured to limit the rate at which a client host submits
54641 MAIL and RCPT commands in a single SMTP session. See the
54642 <option>smtp_ratelimit_hosts</option> option.
54643 </para>
54644 </section>
54645 <section>
54646 <title>Unrecognized SMTP commands</title>
54647 <para>
54648 <indexterm role="concept">
54649 <primary>SMTP</primary>
54650 <secondary>unrecognized commands</secondary>
54651 </indexterm>
54652 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
54653 commands during a single SMTP connection, it drops the connection after sending
54654 the error response to the last command. The default value for
54655 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
54656 abuse that subvert web servers into making connections to SMTP ports; in these
54657 circumstances, a number of non-SMTP lines are sent first.
54658 </para>
54659 </section>
54660 <section>
54661 <title>Syntax and protocol errors in SMTP commands</title>
54662 <para>
54663 <indexterm role="concept">
54664 <primary>SMTP</primary>
54665 <secondary>syntax errors</secondary>
54666 </indexterm>
54667 <indexterm role="concept">
54668 <primary>SMTP</primary>
54669 <secondary>protocol errors</secondary>
54670 </indexterm>
54671 A syntax error is detected if an SMTP command is recognized, but there is
54672 something syntactically wrong with its data, for example, a malformed email
54673 address in a RCPT command. Protocol errors include invalid command
54674 sequencing such as RCPT before MAIL. If Exim receives more than
54675 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
54676 drops the connection after sending the error response to the last command. The
54677 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
54678 broken clients that loop sending bad commands (yes, it has been seen).
54679 </para>
54680 </section>
54681 <section>
54682 <title>Use of non-mail SMTP commands</title>
54683 <para>
54684 <indexterm role="concept">
54685 <primary>SMTP</primary>
54686 <secondary>non-mail commands</secondary>
54687 </indexterm>
54688 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
54689 DATA. Exim counts such commands, and drops the connection if there are too
54690 many of them in a single SMTP session. This action catches some
54691 denial-of-service attempts and things like repeated failing AUTHs, or a mad
54692 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
54693 defines what <quote>too many</quote> means. Its default value is 10.
54694 </para>
54695 <para>
54696 When a new message is expected, one occurrence of RSET is not counted. This
54697 allows a client to send one RSET between messages (this is not necessary,
54698 but some clients do it). Exim also allows one uncounted occurence of HELO
54699 or EHLO, and one occurrence of STARTTLS between messages. After
54700 starting up a TLS session, another EHLO is expected, and so it too is not
54701 counted.
54702 </para>
54703 <para>
54704 The first occurrence of AUTH in a connection, or immediately following
54705 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
54706 RCPT, DATA, and QUIT are counted.
54707 </para>
54708 <para>
54709 You can control which hosts are subject to the limit set by
54710 <option>smtp_accept_max_nonmail</option> by setting
54711 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
54712 the limit apply to all hosts. This option means that you can exclude any
54713 specific badly-behaved hosts that you have to live with.
54714 </para>
54715 </section>
54716 <section>
54717 <title>The VRFY and EXPN commands</title>
54718 <para>
54719 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
54720 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
54721 appropriate) in order to decide whether the command should be accepted or not.
54722 If no ACL is defined, the command is rejected.
54723 </para>
54724 <para>
54725 <indexterm role="concept">
54726 <primary>VRFY</primary>
54727 <secondary>processing</secondary>
54728 </indexterm>
54729 When VRFY is accepted, it runs exactly the same code as when Exim is
54730 called with the <option>-bv</option> option.
54731 </para>
54732 <para>
54733 <indexterm role="concept">
54734 <primary>EXPN</primary>
54735 <secondary>processing</secondary>
54736 </indexterm>
54737 When EXPN is accepted, a single-level expansion of the address is done.
54738 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
54739 than a verification (the <option>-bv</option> option). If an unqualified local part is given
54740 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
54741 of VRFY and EXPN commands are logged on the main and reject logs, and
54742 VRFY verification failures are logged on the main log for consistency with
54743 RCPT failures.
54744 </para>
54745 </section>
54746 <section id="SECTETRN">
54747 <title>The ETRN command</title>
54748 <para>
54749 <indexterm role="concept">
54750 <primary>ETRN</primary>
54751 <secondary>processing</secondary>
54752 </indexterm>
54753 RFC 1985 describes an SMTP command called ETRN that is designed to
54754 overcome the security problems of the TURN command (which has fallen into
54755 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
54756 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
54757 should be accepted or not. If no ACL is defined, the command is rejected.
54758 </para>
54759 <para>
54760 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
54761 delivery to certain hosts. As Exim does not organize its message queue by host,
54762 the only form of ETRN that is supported by default is the one where the
54763 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
54764 specific to the SMTP server. A valid ETRN command causes a run of Exim with
54765 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
54766 argument. For example,
54767 </para>
54768 <literallayout class="monospaced">
54769 ETRN #brigadoon
54770 </literallayout>
54771 <para>
54772 runs the command
54773 </para>
54774 <literallayout class="monospaced">
54775 exim -R brigadoon
54776 </literallayout>
54777 <para>
54778 which causes a delivery attempt on all messages with undelivered addresses
54779 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
54780 default), Exim prevents the simultaneous execution of more than one queue run
54781 for the same argument string as a result of an ETRN command. This stops
54782 a misbehaving client from starting more than one queue runner at once.
54783 </para>
54784 <para>
54785 <indexterm role="concept">
54786 <primary>hints database</primary>
54787 <secondary>ETRN serialization</secondary>
54788 </indexterm>
54789 Exim implements the serialization by means of a hints database in which a
54790 record is written whenever a process is started by ETRN, and deleted when
54791 the process completes. However, Exim does not keep the SMTP session waiting for
54792 the ETRN process to complete. Once ETRN is accepted, the client is sent
54793 a <quote>success</quote> return code. Obviously there is scope for hints records to get
54794 left lying around if there is a system or program crash. To guard against this,
54795 Exim ignores any records that are more than six hours old.
54796 </para>
54797 <para>
54798 <indexterm role="concept">
54799 <primary><option>smtp_etrn_command</option></primary>
54800 </indexterm>
54801 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
54802 used. This specifies a command that is run whenever ETRN is received,
54803 whatever the form of its argument. For
54804 example:
54805 </para>
54806 <literallayout class="monospaced">
54807 smtp_etrn_command = /etc/etrn_command $domain \
54808                     $sender_host_address
54809 </literallayout>
54810 <para>
54811 <indexterm role="concept">
54812 <primary><varname>$domain</varname></primary>
54813 </indexterm>
54814 The string is split up into arguments which are independently expanded. The
54815 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
54816 and no syntax checking is done on the contents of this argument. Exim does not
54817 wait for the command to complete, so its status code is not checked. Exim runs
54818 under its own uid and gid when receiving incoming SMTP, so it is not possible
54819 for it to change them before running the command.
54820 </para>
54821 </section>
54822 <section>
54823 <title>Incoming local SMTP</title>
54824 <para>
54825 <indexterm role="concept">
54826 <primary>SMTP</primary>
54827 <secondary>local incoming</secondary>
54828 </indexterm>
54829 Some user agents use SMTP to pass messages to their local MTA using the
54830 standard input and output, as opposed to passing the envelope on the command
54831 line and writing the message to the standard input. This is supported by the
54832 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
54833 messages over TCP/IP (including the use of ACLs), except that the envelope
54834 sender given in a MAIL command is ignored unless the caller is trusted. In
54835 an ACL you can detect this form of SMTP input by testing for an empty host
54836 identification. It is common to have this as the first line in the ACL that
54837 runs for RCPT commands:
54838 </para>
54839 <literallayout class="monospaced">
54840 accept hosts = :
54841 </literallayout>
54842 <para>
54843 This accepts SMTP messages from local processes without doing any other tests.
54844 </para>
54845 </section>
54846 <section id="SECTbatchSMTP">
54847 <title>Outgoing batched SMTP</title>
54848 <para>
54849 <indexterm role="concept">
54850 <primary>SMTP</primary>
54851 <secondary>batched outgoing</secondary>
54852 </indexterm>
54853 <indexterm role="concept">
54854 <primary>batched SMTP output</primary>
54855 </indexterm>
54856 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
54857 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
54858 be output in BSMTP format. No SMTP responses are possible for this form of
54859 delivery. All it is doing is using SMTP commands as a way of transmitting the
54860 envelope along with the message.
54861 </para>
54862 <para>
54863 The message is written to the file or pipe preceded by the SMTP commands
54864 MAIL and RCPT, and followed by a line containing a single dot. Lines in
54865 the message that start with a dot have an extra dot added. The SMTP command
54866 HELO is not normally used. If it is required, the <option>message_prefix</option> option
54867 can be used to specify it.
54868 </para>
54869 <para>
54870 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
54871 one recipient address at a time by default. However, you can arrange for them
54872 to handle several addresses at once by setting the <option>batch_max</option> option. When
54873 this is done for BSMTP, messages may contain multiple RCPT commands. See
54874 chapter <xref linkend="CHAPbatching"/> for more details.
54875 </para>
54876 <para>
54877 <indexterm role="concept">
54878 <primary><varname>$host</varname></primary>
54879 </indexterm>
54880 When one or more addresses are routed to a BSMTP transport by a router that
54881 sets up a host list, the name of the first host on the list is available to the
54882 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
54883 router:
54884 </para>
54885 <literallayout class="monospaced">
54886 begin routers
54887 route_append:
54888   driver = manualroute
54889   transport = smtp_appendfile
54890   route_list = domain.example  batch.host.example
54891
54892 begin transports
54893 smtp_appendfile:
54894   driver = appendfile
54895   directory = /var/bsmtp/$host
54896   batch_max = 1000
54897   use_bsmtp
54898   user = exim
54899 </literallayout>
54900 <para>
54901 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
54902 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
54903 message (unless there are more than 1000 recipients).
54904 </para>
54905 </section>
54906 <section id="SECTincomingbatchedSMTP">
54907 <title>Incoming batched SMTP</title>
54908 <para>
54909 <indexterm role="concept">
54910 <primary>SMTP</primary>
54911 <secondary>batched incoming</secondary>
54912 </indexterm>
54913 <indexterm role="concept">
54914 <primary>batched SMTP input</primary>
54915 </indexterm>
54916 The <option>-bS</option> command line option causes Exim to accept one or more messages by
54917 reading SMTP on the standard input, but to generate no responses. If the caller
54918 is trusted, the senders in the MAIL commands are believed; otherwise the
54919 sender is always the caller of Exim. Unqualified senders and receivers are not
54920 rejected (there seems little point) but instead just get qualified. HELO
54921 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
54922 as NOOP; QUIT quits.
54923 </para>
54924 <para>
54925 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
54926 In this respect it is like non-SMTP local input.
54927 </para>
54928 <para>
54929 If an error is detected while reading a message, including a missing <quote>.</quote> at
54930 the end, Exim gives up immediately. It writes details of the error to the
54931 standard output in a stylized way that the calling program should be able to
54932 make some use of automatically, for example:
54933 </para>
54934 <literallayout class="monospaced">
54935 554 Unexpected end of file
54936 Transaction started in line 10
54937 Error detected in line 14
54938 </literallayout>
54939 <para>
54940 It writes a more verbose version, for human consumption, to the standard error
54941 file, for example:
54942 </para>
54943 <literallayout class="monospaced">
54944 An error was detected while processing a file of BSMTP input.
54945 The error message was:
54946
54947 501 '&gt;' missing at end of address
54948
54949 The SMTP transaction started in line 10.
54950 The error was detected in line 12.
54951 The SMTP command at fault was:
54952
54953 rcpt to:&lt;malformed@in.com.plete
54954
54955 1 previous message was successfully processed.
54956 The rest of the batch was abandoned.
54957 </literallayout>
54958 <para>
54959 The return code from Exim is zero only if there were no errors. It is 1 if some
54960 messages were accepted before an error was detected, and 2 if no messages were
54961 accepted.
54962 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
54963 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
54964 </para>
54965 </section>
54966 </chapter>
54967
54968 <chapter id="CHAPemsgcust">
54969 <title>Customizing bounce and warning messages</title>
54970 <titleabbrev>Customizing messages</titleabbrev>
54971 <para>
54972 When a message fails to be delivered, or remains on the queue for more than a
54973 configured amount of time, Exim sends a message to the original sender, or
54974 to an alternative configured address. The text of these messages is built into
54975 the code of Exim, but it is possible to change it, either by adding a single
54976 string, or by replacing each of the paragraphs by text supplied in a file.
54977 </para>
54978 <para>
54979 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
54980 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
54981 option. Exim also adds the line
54982 </para>
54983 <literallayout class="monospaced">
54984 Auto-Submitted: auto-generated
54985 </literallayout>
54986 <para>
54987 to all warning and bounce messages,
54988 </para>
54989 <section>
54990 <title>Customizing bounce messages</title>
54991 <para>
54992 <indexterm role="concept">
54993 <primary>customizing</primary>
54994 <secondary>bounce message</secondary>
54995 </indexterm>
54996 <indexterm role="concept">
54997 <primary>bounce message</primary>
54998 <secondary>customizing</secondary>
54999 </indexterm>
55000 If <option>bounce_message_text</option> is set, its contents are included in the default
55001 message immediately after <quote>This message was created automatically by mail
55002 delivery software.</quote> The string is not expanded. It is not used if
55003 <option>bounce_message_file</option> is set.
55004 </para>
55005 <para>
55006 When <option>bounce_message_file</option> is set, it must point to a template file for
55007 constructing error messages. The file consists of a series of text items,
55008 separated by lines consisting of exactly four asterisks. If the file cannot be
55009 opened, default text is used and a message is written to the main and panic
55010 logs. If any text item in the file is empty, default text is used for that
55011 item.
55012 </para>
55013 <para>
55014 <indexterm role="concept">
55015 <primary><varname>$bounce_recipient</varname></primary>
55016 </indexterm>
55017 <indexterm role="concept">
55018 <primary><varname>$bounce_return_size_limit</varname></primary>
55019 </indexterm>
55020 Each item of text that is read from the file is expanded, and there are two
55021 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
55022 the recipient of an error message while it is being created, and
55023 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
55024 option, rounded to a whole number.
55025 </para>
55026 <para>
55027 The items must appear in the file in the following order:
55028 </para>
55029 <itemizedlist>
55030 <listitem>
55031 <para>
55032 The first item is included in the headers, and should include at least a
55033 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55034 </para>
55035 </listitem>
55036 <listitem>
55037 <para>
55038 The second item forms the start of the error message. After it, Exim lists the
55039 failing addresses with their error messages.
55040 </para>
55041 </listitem>
55042 <listitem>
55043 <para>
55044 The third item is used to introduce any text from pipe transports that is to be
55045 returned to the sender. It is omitted if there is no such text.
55046 </para>
55047 </listitem>
55048 <listitem>
55049 <para>
55050 The fourth item is used to introduce the copy of the message that is returned
55051 as part of the error report.
55052 </para>
55053 </listitem>
55054 <listitem>
55055 <para>
55056 The fifth item is added after the fourth one if the returned message is
55057 truncated because it is bigger than <option>return_size_limit</option>.
55058 </para>
55059 </listitem>
55060 <listitem>
55061 <para>
55062 The sixth item is added after the copy of the original message.
55063 </para>
55064 </listitem>
55065 </itemizedlist>
55066 <para>
55067 The default state (<option>bounce_message_file</option> unset) is equivalent to the
55068 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
55069 other lines have been split in order to fit them on the page:
55070 </para>
55071 <literallayout class="monospaced">
55072 Subject: Mail delivery failed
55073   ${if eq{$sender_address}{$bounce_recipient}
55074   {: returning message to sender}}
55075 ****
55076 This message was created automatically by mail delivery software.
55077
55078 A message ${if eq{$sender_address}{$bounce_recipient}
55079   {that you sent }{sent by
55080
55081 &lt;$sender_address&gt;
55082
55083 }}could not be delivered to all of its recipients.
55084 This is a permanent error. The following address(es) failed:
55085 ****
55086 The following text was generated during the delivery attempt(s):
55087 ****
55088 ------ This is a copy of the message, including all the headers.
55089   ------
55090 ****
55091 ------ The body of the message is $message_size characters long;
55092   only the first
55093 ------ $bounce_return_size_limit or so are included here.
55094 ****
55095 </literallayout>
55096 </section>
55097 <section id="SECTcustwarn">
55098 <title>Customizing warning messages</title>
55099 <para>
55100 <indexterm role="concept">
55101 <primary>customizing</primary>
55102 <secondary>warning message</secondary>
55103 </indexterm>
55104 <indexterm role="concept">
55105 <primary>warning of delay</primary>
55106 <secondary>customizing the message</secondary>
55107 </indexterm>
55108 The option <option>warn_message_file</option> can be pointed at a template file for use when
55109 warnings about message delays are created. In this case there are only three
55110 text sections:
55111 </para>
55112 <itemizedlist>
55113 <listitem>
55114 <para>
55115 The first item is included in the headers, and should include at least a
55116 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
55117 </para>
55118 </listitem>
55119 <listitem>
55120 <para>
55121 The second item forms the start of the warning message. After it, Exim lists
55122 the delayed addresses.
55123 </para>
55124 </listitem>
55125 <listitem>
55126 <para>
55127 The third item then ends the message.
55128 </para>
55129 </listitem>
55130 </itemizedlist>
55131 <para>
55132 The default state is equivalent to the following file, except that some lines
55133 have been split here, in order to fit them on the page:
55134 </para>
55135 <literallayout class="monospaced">
55136 Subject: Warning: message $message_exim_id delayed
55137   $warn_message_delay
55138 ****
55139 This message was created automatically by mail delivery software.
55140
55141 A message ${if eq{$sender_address}{$warn_message_recipients}
55142 {that you sent }{sent by
55143
55144 &lt;$sender_address&gt;
55145
55146 }}has not been delivered to all of its recipients after
55147 more than $warn_message_delay on the queue on $primary_hostname.
55148
55149 The message identifier is:     $message_exim_id
55150 The subject of the message is: $h_subject
55151 The date of the message is:    $h_date
55152
55153 The following address(es) have not yet been delivered:
55154 ****
55155 No action is required on your part. Delivery attempts will
55156 continue for some time, and this warning may be repeated at
55157 intervals if the message remains undelivered. Eventually the
55158 mail delivery software will give up, and when that happens,
55159 the message will be returned to you.
55160 </literallayout>
55161 <para>
55162 <indexterm role="concept">
55163 <primary><varname>$warn_message_delay</varname></primary>
55164 </indexterm>
55165 <indexterm role="concept">
55166 <primary><varname>$warn_message_recipients</varname></primary>
55167 </indexterm>
55168 However, in the default state the subject and date lines are omitted if no
55169 appropriate headers exist. During the expansion of this file,
55170 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
55171 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
55172 of recipients for the warning message. There may be more than one if there are
55173 multiple addresses with different <option>errors_to</option> settings on the routers that
55174 handled them.
55175 </para>
55176 </section>
55177 </chapter>
55178
55179 <chapter id="CHAPcomconreq">
55180 <title>Some common configuration settings</title>
55181 <para>
55182 This chapter discusses some configuration settings that seem to be fairly
55183 common. More examples and discussion can be found in the Exim book.
55184 </para>
55185 <section>
55186 <title>Sending mail to a smart host</title>
55187 <para>
55188 <indexterm role="concept">
55189 <primary>smart host</primary>
55190 <secondary>example router</secondary>
55191 </indexterm>
55192 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
55193 should replace the default <command>dnslookup</command> router with a router which does the
55194 routing explicitly:
55195 </para>
55196 <literallayout class="monospaced">
55197 send_to_smart_host:
55198   driver = manualroute
55199   route_list = !+local_domains smart.host.name
55200   transport = remote_smtp
55201 </literallayout>
55202 <para>
55203 You can use the smart host&#x2019;s IP address instead of the name if you wish.
55204 If you are using Exim only to submit messages to a smart host, and not for
55205 receiving incoming messages, you can arrange for it to do the submission
55206 synchronously by setting the <option>mua_wrapper</option> option (see chapter
55207 <xref linkend="CHAPnonqueueing"/>).
55208 </para>
55209 </section>
55210 <section id="SECTmailinglists">
55211 <title>Using Exim to handle mailing lists</title>
55212 <para>
55213 <indexterm role="concept">
55214 <primary>mailing lists</primary>
55215 </indexterm>
55216 Exim can be used to run simple mailing lists, but for large and/or complicated
55217 requirements, the use of additional specialized mailing list software such as
55218 Majordomo or Mailman is recommended.
55219 </para>
55220 <para>
55221 The <command>redirect</command> router can be used to handle mailing lists where each list
55222 is maintained in a separate file, which can therefore be managed by an
55223 independent manager. The <option>domains</option> router option can be used to run these
55224 lists in a separate domain from normal mail. For example:
55225 </para>
55226 <literallayout class="monospaced">
55227 lists:
55228   driver = redirect
55229   domains = lists.example
55230   file = /usr/lists/$local_part
55231   forbid_pipe
55232   forbid_file
55233   errors_to = $local_part-request@lists.example
55234   no_more
55235 </literallayout>
55236 <para>
55237 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
55238 in that domain, it looks for a file that matches the local part. If there is no
55239 such file, the router declines, but because <option>no_more</option> is set, no subsequent
55240 routers are tried, and so the whole delivery fails.
55241 </para>
55242 <para>
55243 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
55244 expanded into a file name or a pipe delivery, which is usually inappropriate in
55245 a mailing list.
55246 </para>
55247 <para>
55248 <indexterm role="concept">
55249 <primary><option>errors_to</option></primary>
55250 </indexterm>
55251 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
55252 taken from a mailing list are to be sent to the given address rather than the
55253 original sender of the message. However, before acting on this, Exim verifies
55254 the error address, and ignores it if verification fails.
55255 </para>
55256 <para>
55257 For example, using the configuration above, mail sent to
55258 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
55259 <filename>/usr/lists/dicts</filename>, with error reports directed to
55260 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
55261 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
55262 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
55263 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
55264 or <option>local_part_suffix</option> options) to handle addresses of the form
55265 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
55266 </para>
55267 </section>
55268 <section>
55269 <title>Syntax errors in mailing lists</title>
55270 <para>
55271 <indexterm role="concept">
55272 <primary>mailing lists</primary>
55273 <secondary>syntax errors in</secondary>
55274 </indexterm>
55275 If an entry in redirection data contains a syntax error, Exim normally defers
55276 delivery of the original address. That means that a syntax error in a mailing
55277 list holds up all deliveries to the list. This may not be appropriate when a
55278 list is being maintained automatically from data supplied by users, and the
55279 addresses are not rigorously checked.
55280 </para>
55281 <para>
55282 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
55283 entries that fail to parse, noting the incident in the log. If in addition
55284 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
55285 whenever a broken address is skipped. It is usually appropriate to set
55286 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
55287 </para>
55288 </section>
55289 <section>
55290 <title>Re-expansion of mailing lists</title>
55291 <para>
55292 <indexterm role="concept">
55293 <primary>mailing lists</primary>
55294 <secondary>re-expansion of</secondary>
55295 </indexterm>
55296 Exim remembers every individual address to which a message has been delivered,
55297 in order to avoid duplication, but it normally stores only the original
55298 recipient addresses with a message. If all the deliveries to a mailing list
55299 cannot be done at the first attempt, the mailing list is re-expanded when the
55300 delivery is next tried. This means that alterations to the list are taken into
55301 account at each delivery attempt, so addresses that have been added to
55302 the list since the message arrived will therefore receive a copy of the
55303 message, even though it pre-dates their subscription.
55304 </para>
55305 <para>
55306 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
55307 on the <command>redirect</command> router. If this is done, any addresses generated by the
55308 router that fail to deliver at the first attempt are added to the message as
55309 <quote>top level</quote> addresses, and the parent address that generated them is marked
55310 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
55311 subsequent delivery attempts. The disadvantage of this is that if any of the
55312 failing addresses are incorrect, correcting them in the file has no effect on
55313 pre-existing messages.
55314 </para>
55315 <para>
55316 The original top-level address is remembered with each of the generated
55317 addresses, and is output in any log messages. However, any intermediate parent
55318 addresses are not recorded. This makes a difference to the log only if the
55319 <option>all_parents</option> selector is set, but for mailing lists there is normally only
55320 one level of expansion anyway.
55321 </para>
55322 </section>
55323 <section>
55324 <title>Closed mailing lists</title>
55325 <para>
55326 <indexterm role="concept">
55327 <primary>mailing lists</primary>
55328 <secondary>closed</secondary>
55329 </indexterm>
55330 The examples so far have assumed open mailing lists, to which anybody may
55331 send mail. It is also possible to set up closed lists, where mail is accepted
55332 from specified senders only. This is done by making use of the generic
55333 <option>senders</option> option to restrict the router that handles the list.
55334 </para>
55335 <para>
55336 The following example uses the same file as a list of recipients and as a list
55337 of permitted senders. It requires three routers:
55338 </para>
55339 <literallayout class="monospaced">
55340 lists_request:
55341   driver = redirect
55342   domains = lists.example
55343   local_part_suffix = -request
55344   file = /usr/lists/$local_part$local_part_suffix
55345   no_more
55346
55347 lists_post:
55348   driver = redirect
55349   domains = lists.example
55350   senders = ${if exists {/usr/lists/$local_part}\
55351              {lsearch;/usr/lists/$local_part}{*}}
55352   file = /usr/lists/$local_part
55353   forbid_pipe
55354   forbid_file
55355   errors_to = $local_part-request@lists.example
55356   no_more
55357
55358 lists_closed:
55359   driver = redirect
55360   domains = lists.example
55361   allow_fail
55362   data = :fail: $local_part@lists.example is a closed mailing list
55363 </literallayout>
55364 <para>
55365 All three routers have the same <option>domains</option> setting, so for any other domains,
55366 they are all skipped. The first router runs only if the local part ends in
55367 <option>-request</option>. It handles messages to the list manager(s) by means of an open
55368 mailing list.
55369 </para>
55370 <para>
55371 The second router runs only if the <option>senders</option> precondition is satisfied. It
55372 checks for the existence of a list that corresponds to the local part, and then
55373 checks that the sender is on the list by means of a linear search. It is
55374 necessary to check for the existence of the file before trying to search it,
55375 because otherwise Exim thinks there is a configuration error. If the file does
55376 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
55377 means that the router runs, but because there is no list, declines, and
55378 <option>no_more</option> ensures that no further routers are run. The address fails with an
55379 <quote>unrouteable address</quote> error.
55380 </para>
55381 <para>
55382 The third router runs only if the second router is skipped, which happens when
55383 a mailing list exists, but the sender is not on it. This router forcibly fails
55384 the address, giving a suitable error message.
55385 </para>
55386 </section>
55387 <section id="SECTverp">
55388 <title>Variable Envelope Return Paths (VERP)</title>
55389 <para>
55390 <indexterm role="concept">
55391 <primary>VERP</primary>
55392 </indexterm>
55393 <indexterm role="concept">
55394 <primary>Variable Envelope Return Paths</primary>
55395 </indexterm>
55396 <indexterm role="concept">
55397 <primary>envelope sender</primary>
55398 </indexterm>
55399 Variable Envelope Return Paths &ndash; see <emphasis role="bold"><ulink url="http://cr.yp.to/proto/verp.txt">http://cr.yp.to/proto/verp.txt</ulink></emphasis> &ndash;
55400 are a way of helping mailing list administrators discover which subscription
55401 address is the cause of a particular delivery failure. The idea is to encode
55402 the original recipient address in the outgoing envelope sender address, so that
55403 if the message is forwarded by another host and then subsequently bounces, the
55404 original recipient can be extracted from the recipient address of the bounce.
55405 </para>
55406 <para>
55407 <indexterm role="option">
55408 <primary><option>errors_to</option></primary>
55409 </indexterm>
55410 <indexterm role="option">
55411 <primary><option>return_path</option></primary>
55412 </indexterm>
55413 Envelope sender addresses can be modified by Exim using two different
55414 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
55415 list examples), or the <option>return_path</option> option on a transport. The second of
55416 these is effective only if the message is successfully delivered to another
55417 host; it is not used for errors detected on the local host (see the description
55418 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
55419 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
55420 </para>
55421 <literallayout class="monospaced">
55422 verp_smtp:
55423   driver = smtp
55424   max_rcpt = 1
55425   return_path = \
55426     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
55427       {$1-request+$local_part=$domain@your.dom.example}fail}
55428 </literallayout>
55429 <para>
55430 This has the effect of rewriting the return path (envelope sender) on outgoing
55431 SMTP messages, if the local part of the original return path ends in
55432 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
55433 local part and domain of the recipient into the return path. Suppose, for
55434 example, that a message whose return path has been set to
55435 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
55436 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
55437 rewritten as
55438 </para>
55439 <literallayout class="monospaced">
55440 somelist-request+subscriber=other.dom.example@your.dom.example
55441 </literallayout>
55442 <para>
55443 <indexterm role="concept">
55444 <primary><varname>$local_part</varname></primary>
55445 </indexterm>
55446 For this to work, you must tell Exim to send multiple copies of messages that
55447 have more than one recipient, so that each copy has just one recipient. This is
55448 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
55449 might be sent to several different recipients in the same domain, in which case
55450 <varname>$local_part</varname> is not available in the transport, because it is not unique.
55451 </para>
55452 <para>
55453 Unless your host is doing nothing but mailing list deliveries, you should
55454 probably use a separate transport for the VERP deliveries, so as not to use
55455 extra resources in making one-per-recipient copies for other deliveries. This
55456 can easily be done by expanding the <option>transport</option> option in the router:
55457 </para>
55458 <literallayout class="monospaced">
55459 dnslookup:
55460   driver = dnslookup
55461   domains = ! +local_domains
55462   transport = \
55463     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
55464       {verp_smtp}{remote_smtp}}
55465   no_more
55466 </literallayout>
55467 <para>
55468 If you want to change the return path using <option>errors_to</option> in a router instead
55469 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
55470 routers that handle mailing list addresses. This will ensure that all delivery
55471 errors, including those detected on the local host, are sent to the VERP
55472 address.
55473 </para>
55474 <para>
55475 On a host that does no local deliveries and has no manual routing, only the
55476 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
55477 SMTP deliveries. Every mailing list recipient has its own return path value,
55478 and so Exim must hand them to the transport one at a time. Here is an example
55479 of a <command>dnslookup</command> router that implements VERP:
55480 </para>
55481 <literallayout class="monospaced">
55482 verp_dnslookup:
55483   driver = dnslookup
55484   domains = ! +local_domains
55485   transport = remote_smtp
55486   errors_to = \
55487     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
55488      {$1-request+$local_part=$domain@your.dom.example}fail}
55489   no_more
55490 </literallayout>
55491 <para>
55492 Before you start sending out messages with VERPed return paths, you must also
55493 configure Exim to accept the bounce messages that come back to those paths.
55494 Typically this is done by setting a <option>local_part_suffix</option> option for a
55495 router, and using this to route the messages to wherever you want to handle
55496 them.
55497 </para>
55498 <para>
55499 The overhead incurred in using VERP depends very much on the size of the
55500 message, the number of recipient addresses that resolve to the same remote
55501 host, and the speed of the connection over which the message is being sent. If
55502 a lot of addresses resolve to the same host and the connection is slow, sending
55503 a separate copy of the message for each address may take substantially longer
55504 than sending a single copy with many recipients (for which VERP cannot be
55505 used).
55506 </para>
55507 </section>
55508 <section id="SECTvirtualdomains">
55509 <title>Virtual domains</title>
55510 <para>
55511 <indexterm role="concept">
55512 <primary>virtual domains</primary>
55513 </indexterm>
55514 <indexterm role="concept">
55515 <primary>domain</primary>
55516 <secondary>virtual</secondary>
55517 </indexterm>
55518 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
55519 meanings:
55520 </para>
55521 <itemizedlist>
55522 <listitem>
55523 <para>
55524 A domain for which there are no real mailboxes; all valid local parts are
55525 aliases for other email addresses. Common examples are organizational
55526 top-level domains and <quote>vanity</quote> domains.
55527 </para>
55528 </listitem>
55529 <listitem>
55530 <para>
55531 One of a number of independent domains that are all handled by the same host,
55532 with mailboxes on that host, but where the mailbox owners do not necessarily
55533 have login accounts on that host.
55534 </para>
55535 </listitem>
55536 </itemizedlist>
55537 <para>
55538 The first usage is probably more common, and does seem more <quote>virtual</quote> than
55539 the second. This kind of domain can be handled in Exim with a straightforward
55540 aliasing router. One approach is to create a separate alias file for each
55541 virtual domain. Exim can test for the existence of the alias file to determine
55542 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
55543 to a router of this form:
55544 </para>
55545 <literallayout class="monospaced">
55546 virtual:
55547   driver = redirect
55548   domains = dsearch;/etc/mail/virtual
55549   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
55550   no_more
55551 </literallayout>
55552 <para>
55553 The <option>domains</option> option specifies that the router is to be skipped, unless there
55554 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
55555 domain that is being processed. When the router runs, it looks up the local
55556 part in the file to find a new address (or list of addresses). The <option>no_more</option>
55557 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
55558 string), Exim gives up on the address without trying any subsequent routers.
55559 </para>
55560 <para>
55561 This one router can handle all the virtual domains because the alias file names
55562 follow a fixed pattern. Permissions can be arranged so that appropriate people
55563 can edit the different alias files. A successful aliasing operation results in
55564 a new envelope recipient address, which is then routed from scratch.
55565 </para>
55566 <para>
55567 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
55568 way. One approach is to create a file for each domain containing a list of
55569 valid local parts, and use it in a router like this:
55570 </para>
55571 <literallayout class="monospaced">
55572 my_domains:
55573   driver = accept
55574   domains = dsearch;/etc/mail/domains
55575   local_parts = lsearch;/etc/mail/domains/$domain
55576   transport = my_mailboxes
55577 </literallayout>
55578 <para>
55579 The address is accepted if there is a file for the domain, and the local part
55580 can be found in the file. The <option>domains</option> option is used to check for the
55581 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
55582 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
55583 because that option is tested after <option>local_parts</option>. The transport is as
55584 follows:
55585 </para>
55586 <literallayout class="monospaced">
55587 my_mailboxes:
55588   driver = appendfile
55589   file = /var/mail/$domain/$local_part
55590   user = mail
55591 </literallayout>
55592 <para>
55593 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
55594 required, to specify which uid is to be used for writing to the mailboxes.
55595 </para>
55596 <para>
55597 The configuration shown here is just one example of how you might support this
55598 requirement. There are many other ways this kind of configuration can be set
55599 up, for example, by using a database instead of separate files to hold all the
55600 information about the domains.
55601 </para>
55602 </section>
55603 <section id="SECTmulbox">
55604 <title>Multiple user mailboxes</title>
55605 <para>
55606 <indexterm role="concept">
55607 <primary>multiple mailboxes</primary>
55608 </indexterm>
55609 <indexterm role="concept">
55610 <primary>mailbox</primary>
55611 <secondary>multiple</secondary>
55612 </indexterm>
55613 <indexterm role="concept">
55614 <primary>local part</primary>
55615 <secondary>prefix</secondary>
55616 </indexterm>
55617 <indexterm role="concept">
55618 <primary>local part</primary>
55619 <secondary>suffix</secondary>
55620 </indexterm>
55621 Heavy email users often want to operate with multiple mailboxes, into which
55622 incoming mail is automatically sorted. A popular way of handling this is to
55623 allow users to use multiple sender addresses, so that replies can easily be
55624 identified. Users are permitted to add prefixes or suffixes to their local
55625 parts for this purpose. The wildcard facility of the generic router options
55626 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
55627 example, consider this router:
55628 </para>
55629 <literallayout class="monospaced">
55630 userforward:
55631   driver = redirect
55632   check_local_user
55633   file = $home/.forward
55634   local_part_suffix = -*
55635   local_part_suffix_optional
55636   allow_filter
55637 </literallayout>
55638 <para>
55639 <indexterm role="concept">
55640 <primary><varname>$local_part_suffix</varname></primary>
55641 </indexterm>
55642 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
55643 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
55644 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
55645 </para>
55646 <literallayout class="monospaced">
55647 if $local_part_suffix contains -special then
55648 save /home/$local_part/Mail/special
55649 endif
55650 </literallayout>
55651 <para>
55652 If the filter file does not exist, or does not deal with such addresses, they
55653 fall through to subsequent routers, and, assuming no subsequent use of the
55654 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
55655 control over which suffixes are valid.
55656 </para>
55657 <para>
55658 Alternatively, a suffix can be used to trigger the use of a different
55659 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
55660 another MTA:
55661 </para>
55662 <literallayout class="monospaced">
55663 userforward:
55664   driver = redirect
55665   check_local_user
55666   file = $home/.forward$local_part_suffix
55667   local_part_suffix = -*
55668   local_part_suffix_optional
55669   allow_filter
55670 </literallayout>
55671 <para>
55672 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
55673 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
55674 does not exist, or does not deal with the address, it is passed on to
55675 subsequent routers, which could, if required, look for an unqualified
55676 <filename>.forward</filename> file to use as a default.
55677 </para>
55678 </section>
55679 <section>
55680 <title>Simplified vacation processing</title>
55681 <para>
55682 <indexterm role="concept">
55683 <primary>vacation processing</primary>
55684 </indexterm>
55685 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
55686 a pipe command in a <filename>.forward</filename> file
55687 (see section <xref linkend="SECTspecitredli"/> for syntax details).
55688 This is prone to error by inexperienced users. There are two features of Exim
55689 that can be used to make this process simpler for users:
55690 </para>
55691 <itemizedlist>
55692 <listitem>
55693 <para>
55694 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
55695 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
55696 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
55697 <filename>.forward</filename> file are then much simpler. For example:
55698 </para>
55699 <literallayout class="monospaced">
55700 spqr, vacation-spqr
55701 </literallayout>
55702 </listitem>
55703 <listitem>
55704 <para>
55705 The <option>require_files</option> generic router option can be used to trigger a
55706 vacation delivery by checking for the existence of a certain file in the
55707 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
55708 ensure that the original delivery also proceeds. In this case, all the user has
55709 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
55710 message.
55711 </para>
55712 </listitem>
55713 </itemizedlist>
55714 <para>
55715 Another advantage of both these methods is that they both work even when the
55716 use of arbitrary pipes by users is locked out.
55717 </para>
55718 </section>
55719 <section>
55720 <title>Taking copies of mail</title>
55721 <para>
55722 <indexterm role="concept">
55723 <primary>message</primary>
55724 <secondary>copying every</secondary>
55725 </indexterm>
55726 Some installations have policies that require archive copies of all messages to
55727 be made. A single copy of each message can easily be taken by an appropriate
55728 command in a system filter, which could, for example, use a different file for
55729 each day&#x2019;s messages.
55730 </para>
55731 <para>
55732 There is also a shadow transport mechanism that can be used to take copies of
55733 messages that are successfully delivered by local transports, one copy per
55734 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
55735 notification of delivery by sites that insist on doing such things.
55736 </para>
55737 </section>
55738 <section>
55739 <title>Intermittently connected hosts</title>
55740 <para>
55741 <indexterm role="concept">
55742 <primary>intermittently connected hosts</primary>
55743 </indexterm>
55744 It has become quite common (because it is cheaper) for hosts to connect to the
55745 Internet periodically rather than remain connected all the time. The normal
55746 arrangement is that mail for such hosts accumulates on a system that is
55747 permanently connected.
55748 </para>
55749 <para>
55750 Exim was designed for use on permanently connected hosts, and so it is not
55751 particularly well-suited to use in an intermittently connected environment.
55752 Nevertheless there are some features that can be used.
55753 </para>
55754 </section>
55755 <section>
55756 <title>Exim on the upstream server host</title>
55757 <para>
55758 It is tempting to arrange for incoming mail for the intermittently connected
55759 host to remain on Exim&#x2019;s queue until the client connects. However, this
55760 approach does not scale very well. Two different kinds of waiting message are
55761 being mixed up in the same queue &ndash; those that cannot be delivered because of
55762 some temporary problem, and those that are waiting for their destination host
55763 to connect. This makes it hard to manage the queue, as well as wasting
55764 resources, because each queue runner scans the entire queue.
55765 </para>
55766 <para>
55767 A better approach is to separate off those messages that are waiting for an
55768 intermittently connected host. This can be done by delivering these messages
55769 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
55770 format, from where they are transmitted by other software when their
55771 destination connects. This makes it easy to collect all the mail for one host
55772 in a single directory, and to apply local timeout rules on a per-message basis
55773 if required.
55774 </para>
55775 <para>
55776 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
55777 you are doing this, you should configure Exim with a long retry period for the
55778 intermittent host. For example:
55779 </para>
55780 <literallayout class="monospaced">
55781 cheshire.wonderland.fict.example    *   F,5d,24h
55782 </literallayout>
55783 <para>
55784 This stops a lot of failed delivery attempts from occurring, but Exim remembers
55785 which messages it has queued up for that host. Once the intermittent host comes
55786 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
55787 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
55788 causes all the queued up messages to be delivered, often down a single SMTP
55789 connection. While the host remains connected, any new messages get delivered
55790 immediately.
55791 </para>
55792 <para>
55793 If the connecting hosts do not have fixed IP addresses, that is, if a host is
55794 issued with a different IP address each time it connects, Exim&#x2019;s retry
55795 mechanisms on the holding host get confused, because the IP address is normally
55796 used as part of the key string for holding retry information. This can be
55797 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
55798 Since this has disadvantages for permanently connected hosts, it is best to
55799 arrange a separate transport for the intermittently connected ones.
55800 </para>
55801 </section>
55802 <section>
55803 <title>Exim on the intermittently connected client host</title>
55804 <para>
55805 The value of <option>smtp_accept_queue_per_connection</option> should probably be
55806 increased, or even set to zero (that is, disabled) on the intermittently
55807 connected host, so that all incoming messages down a single connection get
55808 delivered immediately.
55809 </para>
55810 <para>
55811 <indexterm role="concept">
55812 <primary>SMTP</primary>
55813 <secondary>passed connection</secondary>
55814 </indexterm>
55815 <indexterm role="concept">
55816 <primary>SMTP</primary>
55817 <secondary>multiple deliveries</secondary>
55818 </indexterm>
55819 <indexterm role="concept">
55820 <primary>multiple SMTP deliveries</primary>
55821 </indexterm>
55822 Mail waiting to be sent from an intermittently connected host will probably
55823 not have been routed, because without a connection DNS lookups are not
55824 possible. This means that if a normal queue run is done at connection time,
55825 each message is likely to be sent in a separate SMTP session. This can be
55826 avoided by starting the queue run with a command line option beginning with
55827 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
55828 first pass, routing is done but no deliveries take place. The second pass is a
55829 normal queue run; since all the messages have been previously routed, those
55830 destined for the same host are likely to get sent as multiple deliveries in a
55831 single SMTP connection.
55832 </para>
55833 </section>
55834 </chapter>
55835
55836 <chapter id="CHAPnonqueueing">
55837 <title>Using Exim as a non-queueing client</title>
55838 <titleabbrev>Exim as a non-queueing client</titleabbrev>
55839 <para>
55840 <indexterm role="concept">
55841 <primary>client</primary>
55842 <secondary>non-queueing</secondary>
55843 </indexterm>
55844 <indexterm role="concept">
55845 <primary>smart host</primary>
55846 <secondary>queueing; suppressing</secondary>
55847 </indexterm>
55848 On a personal computer, it is a common requirement for all
55849 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
55850 configured to operate that way, for all the popular operating systems.
55851 However, there are some MUAs for Unix-like systems that cannot be so
55852 configured: they submit messages using the command line interface of
55853 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
55854 messages this way.
55855 </para>
55856 <para>
55857 If the personal computer runs continuously, there is no problem, because it can
55858 run a conventional MTA that handles delivery to the smart host, and deal with
55859 any delays via its queueing mechanism. However, if the computer does not run
55860 continuously or runs different operating systems at different times, queueing
55861 email is not desirable.
55862 </para>
55863 <para>
55864 There is therefore a requirement for something that can provide the
55865 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
55866 any queueing or retrying facilities. Furthermore, the delivery to the smart
55867 host should be synchronous, so that if it fails, the sending MUA is immediately
55868 informed. In other words, we want something that extends an MUA that submits
55869 to a local MTA via the command line so that it behaves like one that submits
55870 to a remote smart host using TCP/SMTP.
55871 </para>
55872 <para>
55873 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
55874 that do this job. However, people have found them to be lacking in various
55875 ways. For instance, you might want to allow aliasing and forwarding to be done
55876 before sending a message to the smart host.
55877 </para>
55878 <para>
55879 Exim already had the necessary infrastructure for doing this job. Just a few
55880 tweaks were needed to make it behave as required, though it is somewhat of an
55881 overkill to use a fully-featured MTA for this purpose.
55882 </para>
55883 <para>
55884 <indexterm role="concept">
55885 <primary><option>mua_wrapper</option></primary>
55886 </indexterm>
55887 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
55888 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
55889 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
55890 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
55891 compatible router and transport configuration. Typically there will be just one
55892 router and one transport, sending everything to a smart host.
55893 </para>
55894 <para>
55895 When run in MUA wrapping mode, the behaviour of Exim changes in the
55896 following ways:
55897 </para>
55898 <itemizedlist>
55899 <listitem>
55900 <para>
55901 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
55902 In other words, the only way to submit messages is via the command line.
55903 </para>
55904 </listitem>
55905 <listitem>
55906 <para>
55907 Each message is synchonously delivered as soon as it is received (<option>-odi</option> is
55908 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
55909 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
55910 does not finish until the delivery attempt is complete. If the delivery is
55911 successful, a zero return code is given.
55912 </para>
55913 </listitem>
55914 <listitem>
55915 <para>
55916 Address redirection is permitted, but the final routing for all addresses must
55917 be to the same remote transport, and to the same list of hosts. Furthermore,
55918 the return address (envelope sender) must be the same for all recipients, as
55919 must any added or deleted header lines. In other words, it must be possible to
55920 deliver the message in a single SMTP transaction, however many recipients there
55921 are.
55922 </para>
55923 </listitem>
55924 <listitem>
55925 <para>
55926 If these conditions are not met, or if routing any address results in a
55927 failure or defer status, or if Exim is unable to deliver all the recipients
55928 successfully to one of the smart hosts, delivery of the entire message fails.
55929 </para>
55930 </listitem>
55931 <listitem>
55932 <para>
55933 Because no queueing is allowed, all failures are treated as permanent; there
55934 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
55935 smart host. Furthermore, because only a single yes/no response can be given to
55936 the caller, it is not possible to deliver to some recipients and not others. If
55937 there is an error (temporary or permanent) for any recipient, all are failed.
55938 </para>
55939 </listitem>
55940 <listitem>
55941 <para>
55942 If more than one smart host is listed, Exim will try another host after a
55943 connection failure or a timeout, in the normal way. However, if this kind of
55944 failure happens for all the hosts, the delivery fails.
55945 </para>
55946 </listitem>
55947 <listitem>
55948 <para>
55949 When delivery fails, an error message is written to the standard error stream
55950 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
55951 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
55952 are ever generated.
55953 </para>
55954 </listitem>
55955 <listitem>
55956 <para>
55957 No retry data is maintained, and any retry rules are ignored.
55958 </para>
55959 </listitem>
55960 <listitem>
55961 <para>
55962 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
55963 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
55964 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
55965 </para>
55966 </listitem>
55967 </itemizedlist>
55968 <para>
55969 The overall effect is that Exim makes a single synchronous attempt to deliver
55970 the message, failing if there is any kind of problem. Because no local
55971 deliveries are done and no daemon can be run, Exim does not need root
55972 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
55973 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
55974 the advantages and disadvantages of running without root privilege.
55975 </para>
55976 </chapter>
55977
55978 <chapter id="CHAPlog">
55979 <title>Log files</title>
55980 <para>
55981 <indexterm role="concept" id="IIDloggen" class="startofrange">
55982 <primary>log</primary>
55983 <secondary>general description</secondary>
55984 </indexterm>
55985 <indexterm role="concept">
55986 <primary>log</primary>
55987 <secondary>types of</secondary>
55988 </indexterm>
55989 Exim writes three different logs, referred to as the main log, the reject log,
55990 and the panic log:
55991 </para>
55992 <itemizedlist>
55993 <listitem>
55994 <para>
55995 <indexterm role="concept">
55996 <primary>main log</primary>
55997 </indexterm>
55998 The main log records the arrival of each message and each delivery in a single
55999 line in each case. The format is as compact as possible, in an attempt to keep
56000 down the size of log files. Two-character flag sequences make it easy to pick
56001 out these lines. A number of other events are recorded in the main log. Some of
56002 them are optional, in which case the <option>log_selector</option> option controls whether
56003 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
56004 analysis of main log files, is provided in the Exim distribution (see section
56005 <xref linkend="SECTmailstat"/>).
56006 </para>
56007 </listitem>
56008 <listitem>
56009 <para>
56010 <indexterm role="concept">
56011 <primary>reject log</primary>
56012 </indexterm>
56013 The reject log records information from messages that are rejected as a result
56014 of a configuration option (that is, for policy reasons).
56015 The first line of each rejection is a copy of the line that is also written to
56016 the main log. Then, if the message&#x2019;s header has been read at the time the log
56017 is written, its contents are written to this log. Only the original header
56018 lines are available; header lines added by ACLs are not logged. You can use the
56019 reject log to check that your policy controls are working correctly; on a busy
56020 host this may be easier than scanning the main log for rejection messages. You
56021 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
56022 false.
56023 </para>
56024 </listitem>
56025 <listitem>
56026 <para>
56027 <indexterm role="concept">
56028 <primary>panic log</primary>
56029 </indexterm>
56030 <indexterm role="concept">
56031 <primary>system log</primary>
56032 </indexterm>
56033 When certain serious errors occur, Exim writes entries to its panic log. If the
56034 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
56035 are usually written to the main log as well, but can get lost amid the mass of
56036 other entries. The panic log should be empty under normal circumstances. It is
56037 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
56038 regularly, in order to become aware of any problems. When Exim cannot open its
56039 panic log, it tries as a last resort to write to the system log (syslog). This
56040 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
56041 message itself is written at priority LOG_CRIT.
56042 </para>
56043 </listitem>
56044 </itemizedlist>
56045 <para>
56046 Every log line starts with a timestamp, in the format shown in the following
56047 example. Note that many of the examples shown in this chapter are line-wrapped.
56048 In the log file, this would be all on one line:
56049 </para>
56050 <literallayout class="monospaced">
56051 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
56052   by QUIT
56053 </literallayout>
56054 <para>
56055 By default, the timestamps are in the local timezone. There are two
56056 ways of changing this:
56057 </para>
56058 <itemizedlist>
56059 <listitem>
56060 <para>
56061 You can set the <option>timezone</option> option to a different time zone; in particular, if
56062 you set
56063 </para>
56064 <literallayout class="monospaced">
56065 timezone = UTC
56066 </literallayout>
56067 <para>
56068 the timestamps will be in UTC (aka GMT).
56069 </para>
56070 </listitem>
56071 <listitem>
56072 <para>
56073 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
56074 example:
56075 </para>
56076 <literallayout class="monospaced">
56077 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
56078 </literallayout>
56079 </listitem>
56080 </itemizedlist>
56081 <section id="SECTwhelogwri">
56082 <title>Where the logs are written</title>
56083 <para>
56084 <indexterm role="concept">
56085 <primary>log</primary>
56086 <secondary>destination</secondary>
56087 </indexterm>
56088 <indexterm role="concept">
56089 <primary>log</primary>
56090 <secondary>to file</secondary>
56091 </indexterm>
56092 <indexterm role="concept">
56093 <primary>log</primary>
56094 <secondary>to syslog</secondary>
56095 </indexterm>
56096 <indexterm role="concept">
56097 <primary>syslog</primary>
56098 </indexterm>
56099 The logs may be written to local files, or to syslog, or both. However, it
56100 should be noted that many syslog implementations use UDP as a transport, and
56101 are therefore unreliable in the sense that messages are not guaranteed to
56102 arrive at the loghost, nor is the ordering of messages necessarily maintained.
56103 It has also been reported that on large log files (tens of megabytes) you may
56104 need to tweak syslog to prevent it syncing the file with each write &ndash; on
56105 Linux this has been seen to make syslog take 90% plus of CPU time.
56106 </para>
56107 <para>
56108 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
56109 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
56110 configuration. This latter string is expanded, so it can contain, for example,
56111 references to the host name:
56112 </para>
56113 <literallayout class="monospaced">
56114 log_file_path = /var/log/$primary_hostname/exim_%slog
56115 </literallayout>
56116 <para>
56117 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
56118 rather than at run time, because then the setting is available right from the
56119 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
56120 before it has read the configuration file (for example, an error in the
56121 configuration file) it will not use the path you want, and may not be able to
56122 log at all.
56123 </para>
56124 <para>
56125 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
56126 list, currently limited to at most two items. This is one option where the
56127 facility for changing a list separator may not be used. The list must always be
56128 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
56129 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
56130 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
56131 implying the use of a default path.
56132 </para>
56133 <para>
56134 When Exim encounters an empty item in the list, it searches the list defined by
56135 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
56136 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
56137 mean <quote>use the path specified at build time</quote>. It no such item exists, log
56138 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
56139 equivalent to the setting:
56140 </para>
56141 <literallayout class="monospaced">
56142 log_file_path = $spool_directory/log/%slog
56143 </literallayout>
56144 <para>
56145 If you do not specify anything at build time or run time, that is where the
56146 logs are written.
56147 </para>
56148 <para>
56149 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
56150 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
56151 </para>
56152 <para>
56153 Here are some examples of possible settings:
56154 </para>
56155 <literallayout>
56156 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
56157 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
56158 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
56159 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
56160 </literallayout>
56161 <para>
56162 If there are more than two paths in the list, the first is used and a panic
56163 error is logged.
56164 </para>
56165 </section>
56166 <section>
56167 <title>Logging to local files that are periodically <quote>cycled</quote></title>
56168 <para>
56169 <indexterm role="concept">
56170 <primary>log</primary>
56171 <secondary>cycling local files</secondary>
56172 </indexterm>
56173 <indexterm role="concept">
56174 <primary>cycling logs</primary>
56175 </indexterm>
56176 <indexterm role="concept">
56177 <primary><emphasis>exicyclog</emphasis></primary>
56178 </indexterm>
56179 <indexterm role="concept">
56180 <primary>log</primary>
56181 <secondary>local files; writing to</secondary>
56182 </indexterm>
56183 Some operating systems provide centralized and standardised methods for cycling
56184 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
56185 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
56186 main and reject logs each time it is called. The maximum number of old logs to
56187 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
56188 </para>
56189 <para>
56190 An Exim delivery process opens the main log when it first needs to write to it,
56191 and it keeps the file open in case subsequent entries are required &ndash; for
56192 example, if a number of different deliveries are being done for the same
56193 message. However, remote SMTP deliveries can take a long time, and this means
56194 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
56195 something similar is being used to rename log files on a regular basis. To
56196 ensure that a switch of log files is noticed as soon as possible, Exim calls
56197 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
56198 does not exist, or its inode has changed, the old file is closed and Exim
56199 tries to open the main log from scratch. Thus, an old log file may remain open
56200 for quite some time, but no Exim processes should write to it once it has been
56201 renamed.
56202 </para>
56203 </section>
56204 <section id="SECTdatlogfil">
56205 <title>Datestamped log files</title>
56206 <para>
56207 <indexterm role="concept">
56208 <primary>log</primary>
56209 <secondary>datestamped files</secondary>
56210 </indexterm>
56211 Instead of cycling the main and reject log files by renaming them
56212 periodically, some sites like to use files whose names contain a datestamp,
56213 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
56214 Exim has support for this way of working. It is enabled by setting the
56215 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
56216 datestamp is required. For example:
56217 </para>
56218 <literallayout class="monospaced">
56219 log_file_path = /var/spool/exim/log/%slog-%D
56220 log_file_path = /var/log/exim-%s-%D.log
56221 log_file_path = /var/spool/exim/log/%D-%slog
56222 </literallayout>
56223 <para>
56224 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
56225 examples of names generated by the above examples:
56226 </para>
56227 <literallayout class="monospaced">
56228 /var/spool/exim/log/mainlog-20021225
56229 /var/log/exim-reject-20021225.log
56230 /var/spool/exim/log/20021225-mainlog
56231 </literallayout>
56232 <para>
56233 When this form of log file is specified, Exim automatically switches to new
56234 files at midnight. It does not make any attempt to compress old logs; you
56235 will need to write your own script if you require this. You should not
56236 run <emphasis>exicyclog</emphasis> with this form of logging.
56237 </para>
56238 <para>
56239 The location of the panic log is also determined by <option>log_file_path</option>, but it
56240 is not datestamped, because rotation of the panic log does not make sense.
56241 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
56242 In addition, if it immediately follows a slash, a following non-alphanumeric
56243 character is removed; otherwise a preceding non-alphanumeric character is
56244 removed. Thus, the three examples above would give these panic log names:
56245 </para>
56246 <literallayout class="monospaced">
56247 /var/spool/exim/log/paniclog
56248 /var/log/exim-panic.log
56249 /var/spool/exim/log/paniclog
56250 </literallayout>
56251 </section>
56252 <section>
56253 <title>Logging to syslog</title>
56254 <para>
56255 <indexterm role="concept">
56256 <primary>log</primary>
56257 <secondary>syslog; writing to</secondary>
56258 </indexterm>
56259 The use of syslog does not change what Exim logs or the format of its messages,
56260 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
56261 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
56262 that, the same strings are written to syslog as to log files. The syslog
56263 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
56264 by default, but you can change these by setting the <option>syslog_facility</option> and
56265 <option>syslog_processname</option> options, respectively. If Exim was compiled with
56266 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
56267 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
56268 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
56269 the time and host name to each line.
56270 The three log streams are mapped onto syslog priorities as follows:
56271 </para>
56272 <itemizedlist>
56273 <listitem>
56274 <para>
56275 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
56276 </para>
56277 </listitem>
56278 <listitem>
56279 <para>
56280 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
56281 </para>
56282 </listitem>
56283 <listitem>
56284 <para>
56285 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
56286 </para>
56287 </listitem>
56288 </itemizedlist>
56289 <para>
56290 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
56291 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
56292 these are routed by syslog to the same place. You can suppress this duplication
56293 by setting <option>syslog_duplication</option> false.
56294 </para>
56295 <para>
56296 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
56297 entries contain multiple lines when headers are included. To cope with both
56298 these cases, entries written to syslog are split into separate <function>syslog()</function>
56299 calls at each internal newline, and also after a maximum of
56300 870 data characters. (This allows for a total syslog line length of 1024, when
56301 additions such as timestamps are added.) If you are running a syslog
56302 replacement that can handle lines longer than the 1024 characters allowed by
56303 RFC 3164, you should set
56304 </para>
56305 <literallayout class="monospaced">
56306 SYSLOG_LONG_LINES=yes
56307 </literallayout>
56308 <para>
56309 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
56310 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
56311 </para>
56312 <para>
56313 To make it easy to re-assemble split lines later, each component of a split
56314 entry starts with a string of the form [&lt;<emphasis>n</emphasis>&gt;/&lt;<emphasis>m</emphasis>&gt;] or [&lt;<emphasis>n</emphasis>&gt;\&lt;<emphasis>m</emphasis>&gt;]
56315 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
56316 components in the entry. The / delimiter is used when the line was split
56317 because it was too long; if it was split because of an internal newline, the \
56318 delimiter is used. For example, supposing the length limit to be 50 instead of
56319 870, the following would be the result of a typical rejection message to
56320 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
56321 name, and pid as added by syslog:
56322 </para>
56323 <literallayout class="monospaced">
56324 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
56325 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
56326 [3/5]  when scanning for sender: missing or malformed lo
56327 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
56328 [5/5] mple&gt;)
56329 </literallayout>
56330 <para>
56331 The same error might cause the following lines to be written to <quote>rejectlog</quote>
56332 (LOG_NOTICE):
56333 </para>
56334 <literallayout class="monospaced">
56335 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
56336 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
56337 [3/18] er when scanning for sender: missing or malformed
56338 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
56339 [5\18] .example&gt;)
56340 [6\18] Recipients: ph10@some.domain.cam.example
56341 [7\18] P Received: from [127.0.0.1] (ident=ph10)
56342 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
56343 [9\18]        id 16RdAL-0006pc-00
56344 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
56345 [11\18] 09:43 +0100
56346 [12\18] F From: &lt;&gt;
56347 [13\18]   Subject: this is a test header
56348 [18\18]   X-something: this is another header
56349 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
56350 [16\18] le&gt;
56351 [17\18] B Bcc:
56352 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
56353 </literallayout>
56354 <para>
56355 Log lines that are neither too long nor contain newlines are written to syslog
56356 without modification.
56357 </para>
56358 <para>
56359 If only syslog is being used, the Exim monitor is unable to provide a log tail
56360 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
56361 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
56362 where it is.
56363 </para>
56364 </section>
56365 <section>
56366 <title>Log line flags</title>
56367 <para>
56368 One line is written to the main log for each message received, and for each
56369 successful, unsuccessful, and delayed delivery. These lines can readily be
56370 picked out by the distinctive two-character flags that immediately follow the
56371 timestamp. The flags are:
56372 </para>
56373 <literallayout>
56374 <literal>&lt;=</literal>     message arrival
56375 <literal>=&gt;</literal>     normal message delivery
56376 <literal>-&gt;</literal>     additional address in same delivery
56377 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
56378 <literal>**</literal>     delivery failed; address bounced
56379 <literal>==</literal>     delivery deferred; temporary problem
56380 </literallayout>
56381 </section>
56382 <section>
56383 <title>Logging message reception</title>
56384 <para>
56385 <indexterm role="concept">
56386 <primary>log</primary>
56387 <secondary>reception line</secondary>
56388 </indexterm>
56389 The format of the single-line entry in the main log that is written for every
56390 message received is shown in the basic example below, which is split over
56391 several lines in order to fit it on the page:
56392 </para>
56393 <literallayout class="monospaced">
56394 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
56395   H=mailer.fict.example [192.168.123.123] U=exim
56396   P=smtp S=5678 id=&lt;incoming message id&gt;
56397 </literallayout>
56398 <para>
56399 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
56400 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
56401 generated, this is followed by an item of the form
56402 </para>
56403 <literallayout class="monospaced">
56404 R=&lt;message id&gt;
56405 </literallayout>
56406 <para>
56407 which is a reference to the message that caused the bounce to be sent.
56408 </para>
56409 <para>
56410 <indexterm role="concept">
56411 <primary>HELO</primary>
56412 </indexterm>
56413 <indexterm role="concept">
56414 <primary>EHLO</primary>
56415 </indexterm>
56416 For messages from other hosts, the H and U fields identify the remote host and
56417 record the RFC 1413 identity of the user that sent the message, if one was
56418 received. The number given in square brackets is the IP address of the sending
56419 host. If there is a single, unparenthesized  host name in the H field, as
56420 above, it has been verified to correspond to the IP address (see the
56421 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
56422 by the remote host in the SMTP HELO or EHLO command, and has not been
56423 verified. If verification yields a different name to that given for HELO or
56424 EHLO, the verified name appears first, followed by the HELO or EHLO
56425 name in parentheses.
56426 </para>
56427 <para>
56428 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
56429 without brackets, in the HELO or EHLO command, leading to entries in
56430 the log containing text like these examples:
56431 </para>
56432 <literallayout class="monospaced">
56433 H=(10.21.32.43) [192.168.8.34]
56434 H=([10.21.32.43]) [192.168.8.34]
56435 </literallayout>
56436 <para>
56437 This can be confusing. Only the final address in square brackets can be relied
56438 on.
56439 </para>
56440 <para>
56441 For locally generated messages (that is, messages not received over TCP/IP),
56442 the H field is omitted, and the U field contains the login name of the caller
56443 of Exim.
56444 </para>
56445 <para>
56446 <indexterm role="concept">
56447 <primary>authentication</primary>
56448 <secondary>logging</secondary>
56449 </indexterm>
56450 <indexterm role="concept">
56451 <primary>AUTH</primary>
56452 <secondary>logging</secondary>
56453 </indexterm>
56454 For all messages, the P field specifies the protocol used to receive the
56455 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
56456 of incoming SMTP messages, the value indicates whether or not any SMTP
56457 extensions (ESMTP), encryption, or authentication were used. If the SMTP
56458 session was encrypted, there is an additional X field that records the cipher
56459 suite that was used.
56460 </para>
56461 <para>
56462 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
56463 hosts that have authenticated themselves using the SMTP AUTH command. The first
56464 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
56465 there is an additional item A= followed by the name of the authenticator that
56466 was used. If an authenticated identification was set up by the authenticator&#x2019;s
56467 <option>server_set_id</option> option, this is logged too, separated by a colon from the
56468 authenticator name.
56469 </para>
56470 <para>
56471 <indexterm role="concept">
56472 <primary>size</primary>
56473 <secondary>of message</secondary>
56474 </indexterm>
56475 The id field records the existing message id, if present. The size of the
56476 received message is given by the S field. When the message is delivered,
56477 headers may be removed or added, so that the size of delivered copies of the
56478 message may not correspond with this value (and indeed may be different to each
56479 other).
56480 </para>
56481 <para>
56482 The <option>log_selector</option> option can be used to request the logging of additional
56483 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
56484 </para>
56485 </section>
56486 <section>
56487 <title>Logging deliveries</title>
56488 <para>
56489 <indexterm role="concept">
56490 <primary>log</primary>
56491 <secondary>delivery line</secondary>
56492 </indexterm>
56493 The format of the single-line entry in the main log that is written for every
56494 delivery is shown in one of the examples below, for local and remote
56495 deliveries, respectively. Each example has been split into two lines in order
56496 to fit it on the page:
56497 </para>
56498 <literallayout class="monospaced">
56499 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
56500   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
56501 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
56502   monk@holistic.fict.example R=dnslookup T=remote_smtp
56503   H=holistic.fict.example [192.168.234.234]
56504 </literallayout>
56505 <para>
56506 For ordinary local deliveries, the original address is given in angle brackets
56507 after the final delivery address, which might be a pipe or a file. If
56508 intermediate address(es) exist between the original and the final address, the
56509 last of these is given in parentheses after the final address. The R and T
56510 fields record the router and transport that were used to process the address.
56511 </para>
56512 <para>
56513 If a shadow transport was run after a successful local delivery, the log line
56514 for the successful delivery has an item added on the end, of the form
56515 </para>
56516 <literallayout>
56517 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
56518 </literallayout>
56519 <para>
56520 If the shadow transport did not succeed, the error message is put in
56521 parentheses afterwards.
56522 </para>
56523 <para>
56524 <indexterm role="concept">
56525 <primary>asterisk</primary>
56526 <secondary>after IP address</secondary>
56527 </indexterm>
56528 When more than one address is included in a single delivery (for example, two
56529 SMTP RCPT commands in one transaction) the second and subsequent addresses are
56530 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
56531 down a single SMTP connection, an asterisk follows the IP address in the log
56532 lines for the second and subsequent messages.
56533 </para>
56534 <para>
56535 The generation of a reply message by a filter file gets logged as a
56536 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
56537 </para>
56538 <para>
56539 The <option>log_selector</option> option can be used to request the logging of additional
56540 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
56541 </para>
56542 </section>
56543 <section>
56544 <title>Discarded deliveries</title>
56545 <para>
56546 <indexterm role="concept">
56547 <primary>discarded messages</primary>
56548 </indexterm>
56549 <indexterm role="concept">
56550 <primary>message</primary>
56551 <secondary>discarded</secondary>
56552 </indexterm>
56553 <indexterm role="concept">
56554 <primary>delivery</primary>
56555 <secondary>discarded; logging</secondary>
56556 </indexterm>
56557 When a message is discarded as a result of the command <quote>seen finish</quote> being
56558 obeyed in a filter file which generates no deliveries, a log entry of the form
56559 </para>
56560 <literallayout class="monospaced">
56561 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
56562   &lt;low.club@bridge.example&gt; R=userforward
56563 </literallayout>
56564 <para>
56565 is written, to record why no deliveries are logged. When a message is discarded
56566 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
56567 </para>
56568 <literallayout class="monospaced">
56569 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
56570   &lt;hole@nowhere.example&gt; R=blackhole_router
56571 </literallayout>
56572 </section>
56573 <section>
56574 <title>Deferred deliveries</title>
56575 <para>
56576 When a delivery is deferred, a line of the following form is logged:
56577 </para>
56578 <literallayout class="monospaced">
56579 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
56580   R=dnslookup T=smtp defer (146): Connection refused
56581 </literallayout>
56582 <para>
56583 In the case of remote deliveries, the error is the one that was given for the
56584 last IP address that was tried. Details of individual SMTP failures are also
56585 written to the log, so the above line would be preceded by something like
56586 </para>
56587 <literallayout class="monospaced">
56588 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
56589   mail1.endrest.example [192.168.239.239]: Connection refused
56590 </literallayout>
56591 <para>
56592 When a deferred address is skipped because its retry time has not been reached,
56593 a message is written to the log, but this can be suppressed by setting an
56594 appropriate value in <option>log_selector</option>.
56595 </para>
56596 </section>
56597 <section>
56598 <title>Delivery failures</title>
56599 <para>
56600 <indexterm role="concept">
56601 <primary>delivery</primary>
56602 <secondary>failure; logging</secondary>
56603 </indexterm>
56604 If a delivery fails because an address cannot be routed, a line of the
56605 following form is logged:
56606 </para>
56607 <literallayout class="monospaced">
56608 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
56609   &lt;jim@trek99.example&gt;: unknown mail domain
56610 </literallayout>
56611 <para>
56612 If a delivery fails at transport time, the router and transport are shown, and
56613 the response from the remote host is included, as in this example:
56614 </para>
56615 <literallayout class="monospaced">
56616 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
56617   R=dnslookup T=remote_smtp: SMTP error from remote mailer
56618   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
56619   pbmail3.py.example [192.168.63.111]: 553 5.3.0
56620   &lt;ace400@pb.example&gt;...Addressee unknown
56621 </literallayout>
56622 <para>
56623 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
56624 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
56625 disabling PIPELINING. The log lines for all forms of delivery failure are
56626 flagged with <literal>**</literal>.
56627 </para>
56628 </section>
56629 <section>
56630 <title>Fake deliveries</title>
56631 <para>
56632 <indexterm role="concept">
56633 <primary>delivery</primary>
56634 <secondary>fake; logging</secondary>
56635 </indexterm>
56636 If a delivery does not actually take place because the <option>-N</option> option has been
56637 used to suppress it, a normal delivery line is written to the log, except that
56638 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
56639 </para>
56640 </section>
56641 <section>
56642 <title>Completion</title>
56643 <para>
56644 A line of the form
56645 </para>
56646 <literallayout class="monospaced">
56647 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
56648 </literallayout>
56649 <para>
56650 is written to the main log when a message is about to be removed from the spool
56651 at the end of its processing.
56652 </para>
56653 </section>
56654 <section>
56655 <title>Summary of Fields in Log Lines</title>
56656 <para>
56657 <indexterm role="concept">
56658 <primary>log</primary>
56659 <secondary>summary of fields</secondary>
56660 </indexterm>
56661 A summary of the field identifiers that are used in log lines is shown in
56662 the following table:
56663 </para>
56664 <literallayout>
56665 <literal>A   </literal>        authenticator name (and optional id)
56666 <literal>C   </literal>        SMTP confirmation on delivery
56667 <literal>CV  </literal>        certificate verification status
56668 <literal>DN  </literal>        distinguished name from peer certificate
56669 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
56670 <literal>F   </literal>        sender address (on delivery lines)
56671 <literal>H   </literal>        host name and IP address
56672 <literal>I   </literal>        local interface used
56673 <literal>id  </literal>        message id for incoming message
56674 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
56675 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
56676 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
56677 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
56678 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
56679 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
56680 <literal>S   </literal>        size of message
56681 <literal>ST  </literal>        shadow transport name
56682 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
56683 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
56684 <literal>U   </literal>        local user or RFC 1413 identity
56685 <literal>X   </literal>        TLS cipher suite
56686 </literallayout>
56687 </section>
56688 <section>
56689 <title>Other log entries</title>
56690 <para>
56691 Various other types of log entry are written from time to time. Most should be
56692 self-explanatory. Among the more common are:
56693 </para>
56694 <itemizedlist>
56695 <listitem>
56696 <para>
56697 <indexterm role="concept">
56698 <primary>retry</primary>
56699 <secondary>time not reached</secondary>
56700 </indexterm>
56701 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
56702 during routing or local delivery, and the time to retry has not yet arrived.
56703 This message is not written to an individual message log file unless it happens
56704 during the first delivery attempt.
56705 </para>
56706 </listitem>
56707 <listitem>
56708 <para>
56709 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
56710 temporary errors during remote delivery, and the retry time has not yet arrived
56711 for any of the hosts to which it is routed.
56712 </para>
56713 </listitem>
56714 <listitem>
56715 <para>
56716 <indexterm role="concept">
56717 <primary>spool directory</primary>
56718 <secondary>file locked</secondary>
56719 </indexterm>
56720 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
56721 some other Exim process is already working on the message. This can be quite
56722 common if queue running processes are started at frequent intervals. The
56723 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
56724 doing.
56725 </para>
56726 </listitem>
56727 <listitem>
56728 <para>
56729 <indexterm role="concept">
56730 <primary>error</primary>
56731 <secondary>ignored</secondary>
56732 </indexterm>
56733 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
56734 message:
56735 </para>
56736 <orderedlist numeration="arabic">
56737 <listitem>
56738 <para>
56739 Exim failed to deliver a bounce message whose age was greater than
56740 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
56741 </para>
56742 </listitem>
56743 <listitem>
56744 <para>
56745 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
56746 failed. The delivery was discarded.
56747 </para>
56748 </listitem>
56749 <listitem>
56750 <para>
56751 A delivery set up by a router configured with
56752 </para>
56753 <literallayout class="monospaced">
56754     errors_to = &lt;&gt;
56755 </literallayout>
56756 <para>
56757 failed. The delivery was discarded.
56758 </para>
56759 </listitem>
56760 </orderedlist>
56761 </listitem>
56762 </itemizedlist>
56763 </section>
56764 <section id="SECTlogselector">
56765 <title>Reducing or increasing what is logged</title>
56766 <para>
56767 <indexterm role="concept">
56768 <primary>log</primary>
56769 <secondary>selectors</secondary>
56770 </indexterm>
56771 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
56772 default logging, or you can request additional logging. The value of
56773 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
56774 example:
56775 </para>
56776 <literallayout class="monospaced">
56777 log_selector = +arguments -retry_defer
56778 </literallayout>
56779 <para>
56780 The list of optional log items is in the following table, with the default
56781 selection marked by asterisks:
56782 </para>
56783 <literallayout>
56784 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
56785 <literal> address_rewrite            </literal>  address rewriting
56786 <literal> all_parents                </literal>  all parents in =&gt; lines
56787 <literal> arguments                  </literal>  command line arguments
56788 <literal>*connection_reject          </literal>  connection rejections
56789 <literal>*delay_delivery             </literal>  immediate delivery delayed
56790 <literal> deliver_time               </literal>  time taken to perform delivery
56791 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
56792 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
56793 <literal>*etrn                       </literal>  ETRN commands
56794 <literal>*host_lookup_failed         </literal>  as it says
56795 <literal> ident_timeout              </literal>  timeout for ident connection
56796 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
56797 <literal> incoming_port              </literal>  incoming port on &lt;= lines
56798 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
56799 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
56800 <literal>*queue_run                  </literal>  start and end queue runs
56801 <literal> queue_time                 </literal>  time on queue for one recipient
56802 <literal> queue_time_overall         </literal>  time on queue for whole message
56803 <literal> received_recipients        </literal>  recipients on &lt;= lines
56804 <literal> received_sender            </literal>  sender on &lt;= lines
56805 <literal>*rejected_header            </literal>  header contents on reject log
56806 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
56807 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
56808 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
56809 <literal>*sender_verify_fail         </literal>  sender verification failures
56810 <literal>*size_reject                </literal>  rejection because too big
56811 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
56812 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
56813 <literal> smtp_connection            </literal>  SMTP connections
56814 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
56815 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
56816 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
56817 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
56818 <literal> tls_certificate_verified   </literal>  certificate verification status
56819 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
56820 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
56821 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
56822
56823 <literal> all                        </literal>  all of the above
56824 </literallayout>
56825 <para>
56826 More details on each of these items follows:
56827 </para>
56828 <itemizedlist>
56829 <listitem>
56830 <para>
56831 <indexterm role="concept">
56832 <primary><option>warn</option> statement</primary>
56833 <secondary>log when skipping</secondary>
56834 </indexterm>
56835 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
56836 its conditions cannot be evaluated, a log line to this effect is written if
56837 this log selector is set.
56838 </para>
56839 </listitem>
56840 <listitem>
56841 <para>
56842 <indexterm role="concept">
56843 <primary>log</primary>
56844 <secondary>rewriting</secondary>
56845 </indexterm>
56846 <indexterm role="concept">
56847 <primary>rewriting</primary>
56848 <secondary>logging</secondary>
56849 </indexterm>
56850 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
56851 rewrites, but not to rewrites in filters run as an unprivileged user (because
56852 such users cannot access the log).
56853 </para>
56854 </listitem>
56855 <listitem>
56856 <para>
56857 <indexterm role="concept">
56858 <primary>log</primary>
56859 <secondary>full parentage</secondary>
56860 </indexterm>
56861 <option>all_parents</option>: Normally only the original and final addresses are logged on
56862 delivery lines; with this selector, intermediate parents are given in
56863 parentheses between them.
56864 </para>
56865 </listitem>
56866 <listitem>
56867 <para>
56868 <indexterm role="concept">
56869 <primary>log</primary>
56870 <secondary>Exim arguments</secondary>
56871 </indexterm>
56872 <indexterm role="concept">
56873 <primary>Exim arguments</primary>
56874 <secondary>logging</secondary>
56875 </indexterm>
56876 <option>arguments</option>: This causes Exim to write the arguments with which it was called
56877 to the main log, preceded by the current working directory. This is a debugging
56878 feature, added to make it easier to find out how certain MUAs call
56879 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
56880 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
56881 that are empty or that contain white space are quoted. Non-printing characters
56882 are shown as escape sequences. This facility cannot log unrecognized arguments,
56883 because the arguments are checked before the configuration file is read. The
56884 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
56885 between the caller and Exim.
56886 </para>
56887 </listitem>
56888 <listitem>
56889 <para>
56890 <indexterm role="concept">
56891 <primary>log</primary>
56892 <secondary>connection rejections</secondary>
56893 </indexterm>
56894 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
56895 connection is rejected, for whatever reason.
56896 </para>
56897 </listitem>
56898 <listitem>
56899 <para>
56900 <indexterm role="concept">
56901 <primary>log</primary>
56902 <secondary>delayed delivery</secondary>
56903 </indexterm>
56904 <indexterm role="concept">
56905 <primary>delayed delivery</primary>
56906 <secondary>logging</secondary>
56907 </indexterm>
56908 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
56909 started for an incoming message because the load is too high or too many
56910 messages were received on one connection. Logging does not occur if no delivery
56911 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
56912 </para>
56913 </listitem>
56914 <listitem>
56915 <para>
56916 <indexterm role="concept">
56917 <primary>log</primary>
56918 <secondary>delivery duration</secondary>
56919 </indexterm>
56920 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
56921 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
56922 </para>
56923 </listitem>
56924 <listitem>
56925 <para>
56926 <indexterm role="concept">
56927 <primary>log</primary>
56928 <secondary>message size on delivery</secondary>
56929 </indexterm>
56930 <indexterm role="concept">
56931 <primary>size</primary>
56932 <secondary>of message</secondary>
56933 </indexterm>
56934 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
56935 the <quote>=&gt;</quote> line, tagged with S=.
56936 </para>
56937 </listitem>
56938 <listitem>
56939 <para>
56940 <indexterm role="concept">
56941 <primary>log</primary>
56942 <secondary>dnslist defer</secondary>
56943 </indexterm>
56944 <indexterm role="concept">
56945 <primary>DNS list</primary>
56946 <secondary>logging defer</secondary>
56947 </indexterm>
56948 <indexterm role="concept">
56949 <primary>black list (DNS)</primary>
56950 </indexterm>
56951 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
56952 DNS black list suffers a temporary error.
56953 </para>
56954 </listitem>
56955 <listitem>
56956 <para>
56957 <indexterm role="concept">
56958 <primary>log</primary>
56959 <secondary>ETRN commands</secondary>
56960 </indexterm>
56961 <indexterm role="concept">
56962 <primary>ETRN</primary>
56963 <secondary>logging</secondary>
56964 </indexterm>
56965 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
56966 is run to determine whether or not it is actually accepted. An invalid ETRN
56967 command, or one received within a message transaction is not logged by this
56968 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
56969 </para>
56970 </listitem>
56971 <listitem>
56972 <para>
56973 <indexterm role="concept">
56974 <primary>log</primary>
56975 <secondary>host lookup failure</secondary>
56976 </indexterm>
56977 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
56978 any addresses, or when a lookup of an IP address fails to find a host name, a
56979 log line is written. This logging does not apply to direct DNS lookups when
56980 routing email addresses, but it does apply to <quote>byname</quote> lookups.
56981 </para>
56982 </listitem>
56983 <listitem>
56984 <para>
56985 <indexterm role="concept">
56986 <primary>log</primary>
56987 <secondary>ident timeout</secondary>
56988 </indexterm>
56989 <indexterm role="concept">
56990 <primary>RFC 1413</primary>
56991 <secondary>logging timeout</secondary>
56992 </indexterm>
56993 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
56994 client&#x2019;s ident port times out.
56995 </para>
56996 </listitem>
56997 <listitem>
56998 <para>
56999 <indexterm role="concept">
57000 <primary>log</primary>
57001 <secondary>incoming interface</secondary>
57002 </indexterm>
57003 <indexterm role="concept">
57004 <primary>interface</primary>
57005 <secondary>logging</secondary>
57006 </indexterm>
57007 <option>incoming_interface</option>: The interface on which a message was received is added
57008 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
57009 followed by a colon and the port number. The local interface and port are also
57010 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
57011 rejection lines.
57012 </para>
57013 </listitem>
57014 <listitem>
57015 <para>
57016 <indexterm role="concept">
57017 <primary>log</primary>
57018 <secondary>incoming remote port</secondary>
57019 </indexterm>
57020 <indexterm role="concept">
57021 <primary>port</primary>
57022 <secondary>logging remote</secondary>
57023 </indexterm>
57024 <indexterm role="concept">
57025 <primary>TCP/IP</primary>
57026 <secondary>logging incoming remote port</secondary>
57027 </indexterm>
57028 <indexterm role="concept">
57029 <primary><varname>$sender_fullhost</varname></primary>
57030 </indexterm>
57031 <indexterm role="concept">
57032 <primary><varname>$sender_rcvhost</varname></primary>
57033 </indexterm>
57034 <option>incoming_port</option>: The remote port number from which a message was received is
57035 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
57036 in square brackets, and separated from it by a colon. This is implemented by
57037 changing the value that is put in the <varname>$sender_fullhost</varname> and
57038 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
57039 important with the widening use of NAT (see RFC 2505).
57040 </para>
57041 </listitem>
57042 <listitem>
57043 <para>
57044 <indexterm role="concept">
57045 <primary>log</primary>
57046 <secondary>dropped connection</secondary>
57047 </indexterm>
57048 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
57049 connection is unexpectedly dropped.
57050 </para>
57051 </listitem>
57052 <listitem>
57053 <para>
57054 <indexterm role="concept">
57055 <primary>log</primary>
57056 <secondary>outgoing remote port</secondary>
57057 </indexterm>
57058 <indexterm role="concept">
57059 <primary>port</primary>
57060 <secondary>logging outgoint remote</secondary>
57061 </indexterm>
57062 <indexterm role="concept">
57063 <primary>TCP/IP</primary>
57064 <secondary>logging ougtoing remote port</secondary>
57065 </indexterm>
57066 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
57067 containing =&gt; tags) following the IP address. This option is not included in
57068 the default setting, because for most ordinary configurations, the remote port
57069 number is always 25 (the SMTP port).
57070 </para>
57071 </listitem>
57072 <listitem>
57073 <para>
57074 <indexterm role="concept">
57075 <primary>log</primary>
57076 <secondary>queue run</secondary>
57077 </indexterm>
57078 <indexterm role="concept">
57079 <primary>queue runner</primary>
57080 <secondary>logging</secondary>
57081 </indexterm>
57082 <option>queue_run</option>: The start and end of every queue run are logged.
57083 </para>
57084 </listitem>
57085 <listitem>
57086 <para>
57087 <indexterm role="concept">
57088 <primary>log</primary>
57089 <secondary>queue time</secondary>
57090 </indexterm>
57091 <option>queue_time</option>: The amount of time the message has been in the queue on the
57092 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
57093 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
57094 includes reception time as well as the delivery time for the current address.
57095 This means that it may be longer than the difference between the arrival and
57096 delivery log line times, because the arrival log line is not written until the
57097 message has been successfully received.
57098 </para>
57099 </listitem>
57100 <listitem>
57101 <para>
57102 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
57103 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
57104 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
57105 message, so it includes reception time as well as the total delivery time.
57106 </para>
57107 </listitem>
57108 <listitem>
57109 <para>
57110 <indexterm role="concept">
57111 <primary>log</primary>
57112 <secondary>recipients</secondary>
57113 </indexterm>
57114 <option>received_recipients</option>: The recipients of a message are listed in the main log
57115 as soon as the message is received. The list appears at the end of the log line
57116 that is written when a message is received, preceded by the word <quote>for</quote>. The
57117 addresses are listed after they have been qualified, but before any rewriting
57118 has taken place.
57119 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
57120 in the list.
57121 </para>
57122 </listitem>
57123 <listitem>
57124 <para>
57125 <indexterm role="concept">
57126 <primary>log</primary>
57127 <secondary>sender reception</secondary>
57128 </indexterm>
57129 <option>received_sender</option>: The unrewritten original sender of a message is added to
57130 the end of the log line that records the message&#x2019;s arrival, after the word
57131 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
57132 </para>
57133 </listitem>
57134 <listitem>
57135 <para>
57136 <indexterm role="concept">
57137 <primary>log</primary>
57138 <secondary>header lines for rejection</secondary>
57139 </indexterm>
57140 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
57141 rejection is written to the reject log, the complete header is added to the
57142 log. Header logging can be turned off individually for messages that are
57143 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
57144 </para>
57145 </listitem>
57146 <listitem>
57147 <para>
57148 <indexterm role="concept">
57149 <primary>log</primary>
57150 <secondary>retry defer</secondary>
57151 </indexterm>
57152 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
57153 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
57154 message is always omitted from individual message logs after the first delivery
57155 attempt.
57156 </para>
57157 </listitem>
57158 <listitem>
57159 <para>
57160 <indexterm role="concept">
57161 <primary>log</primary>
57162 <secondary>return path</secondary>
57163 </indexterm>
57164 <option>return_path_on_delivery</option>: The return path that is being transmitted with
57165 the message is included in delivery and bounce lines, using the tag P=.
57166 This is omitted if no delivery actually happens, for example, if routing fails,
57167 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
57168 </para>
57169 </listitem>
57170 <listitem>
57171 <para>
57172 <indexterm role="concept">
57173 <primary>log</primary>
57174 <secondary>sender on delivery</secondary>
57175 </indexterm>
57176 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
57177 and bounce line, tagged by F= (for <quote>from</quote>).
57178 This is the original sender that was received with the message; it is not
57179 necessarily the same as the outgoing return path.
57180 </para>
57181 </listitem>
57182 <listitem>
57183 <para>
57184 <indexterm role="concept">
57185 <primary>log</primary>
57186 <secondary>sender verify failure</secondary>
57187 </indexterm>
57188 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
57189 gives details of a sender verification failure is not written. Log lines for
57190 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
57191 detail is lost.
57192 </para>
57193 </listitem>
57194 <listitem>
57195 <para>
57196 <indexterm role="concept">
57197 <primary>log</primary>
57198 <secondary>size rejection</secondary>
57199 </indexterm>
57200 <option>size_reject</option>: A log line is written whenever a message is rejected because
57201 it is too big.
57202 </para>
57203 </listitem>
57204 <listitem>
57205 <para>
57206 <indexterm role="concept">
57207 <primary>log</primary>
57208 <secondary>frozen messages; skipped</secondary>
57209 </indexterm>
57210 <indexterm role="concept">
57211 <primary>frozen messages</primary>
57212 <secondary>logging skipping</secondary>
57213 </indexterm>
57214 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
57215 queue run because it is frozen or because another process is already delivering
57216 it.
57217 <indexterm role="concept">
57218 <primary><quote>spool file is locked</quote></primary>
57219 </indexterm>
57220 The message that is written is <quote>spool file is locked</quote>.
57221 </para>
57222 </listitem>
57223 <listitem>
57224 <para>
57225 <indexterm role="concept">
57226 <primary>log</primary>
57227 <secondary>smtp confirmation</secondary>
57228 </indexterm>
57229 <indexterm role="concept">
57230 <primary>SMTP</primary>
57231 <secondary>logging confirmation</secondary>
57232 </indexterm>
57233 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
57234 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
57235 A number of MTAs (including Exim) return an identifying string in this
57236 response.
57237 </para>
57238 </listitem>
57239 <listitem>
57240 <para>
57241 <indexterm role="concept">
57242 <primary>log</primary>
57243 <secondary>SMTP connections</secondary>
57244 </indexterm>
57245 <indexterm role="concept">
57246 <primary>SMTP</primary>
57247 <secondary>logging connections</secondary>
57248 </indexterm>
57249 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
57250 established or closed, unless the connection is from a host that matches
57251 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
57252 only when the closure is unexpected.) This applies to connections from local
57253 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
57254 dropped in the middle of a message, a log line is always written, whether or
57255 not this selector is set, but otherwise nothing is written at the start and end
57256 of connections unless this selector is enabled.
57257 </para>
57258 <para>
57259 For TCP/IP connections to an Exim daemon, the current number of connections is
57260 included in the log message for each new connection, but note that the count is
57261 reset if the daemon is restarted.
57262 Also, because connections are closed (and the closure is logged) in
57263 subprocesses, the count may not include connections that have been closed but
57264 whose termination the daemon has not yet noticed. Thus, while it is possible to
57265 match up the opening and closing of connections in the log, the value of the
57266 logged counts may not be entirely accurate.
57267 </para>
57268 </listitem>
57269 <listitem>
57270 <para>
57271 <indexterm role="concept">
57272 <primary>log</primary>
57273 <secondary>SMTP transaction; incomplete</secondary>
57274 </indexterm>
57275 <indexterm role="concept">
57276 <primary>SMTP</primary>
57277 <secondary>logging incomplete transactions</secondary>
57278 </indexterm>
57279 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
57280 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
57281 and the message sender plus any accepted recipients are included in the log
57282 line. This can provide evidence of dictionary attacks.
57283 </para>
57284 </listitem>
57285 <listitem>
57286 <para>
57287 <indexterm role="concept">
57288 <primary>log</primary>
57289 <secondary>SMTP protocol error</secondary>
57290 </indexterm>
57291 <indexterm role="concept">
57292 <primary>SMTP</primary>
57293 <secondary>logging protocol error</secondary>
57294 </indexterm>
57295 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
57296 encountered. Exim does not have perfect detection of all protocol errors
57297 because of transmission delays and the use of pipelining. If PIPELINING has
57298 been advertised to a client, an Exim server assumes that the client will use
57299 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
57300 received after rejecting MAIL) as protocol errors.
57301 </para>
57302 </listitem>
57303 <listitem>
57304 <para>
57305 <indexterm role="concept">
57306 <primary>SMTP</primary>
57307 <secondary>logging syntax errors</secondary>
57308 </indexterm>
57309 <indexterm role="concept">
57310 <primary>SMTP</primary>
57311 <secondary>syntax errors; logging</secondary>
57312 </indexterm>
57313 <indexterm role="concept">
57314 <primary>SMTP</primary>
57315 <secondary>unknown command; logging</secondary>
57316 </indexterm>
57317 <indexterm role="concept">
57318 <primary>log</primary>
57319 <secondary>unknown SMTP command</secondary>
57320 </indexterm>
57321 <indexterm role="concept">
57322 <primary>log</primary>
57323 <secondary>SMTP syntax error</secondary>
57324 </indexterm>
57325 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
57326 encountered. An unrecognized command is treated as a syntax error. For an
57327 external connection, the host identity is given; for an internal connection
57328 using <option>-bs</option> the sender identification (normally the calling user) is given.
57329 </para>
57330 </listitem>
57331 <listitem>
57332 <para>
57333 <indexterm role="concept">
57334 <primary>log</primary>
57335 <secondary>subject</secondary>
57336 </indexterm>
57337 <indexterm role="concept">
57338 <primary>subject</primary>
57339 <secondary>logging</secondary>
57340 </indexterm>
57341 <option>subject</option>: The subject of the message is added to the arrival log line,
57342 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
57343 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
57344 specifies whether characters with values greater than 127 should be logged
57345 unchanged, or whether they should be rendered as escape sequences.
57346 </para>
57347 </listitem>
57348 <listitem>
57349 <para>
57350 <indexterm role="concept">
57351 <primary>log</primary>
57352 <secondary>certificate verification</secondary>
57353 </indexterm>
57354 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
57355 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
57356 verified, and <literal>CV=no</literal> if not.
57357 </para>
57358 </listitem>
57359 <listitem>
57360 <para>
57361 <indexterm role="concept">
57362 <primary>log</primary>
57363 <secondary>TLS cipher</secondary>
57364 </indexterm>
57365 <indexterm role="concept">
57366 <primary>TLS</primary>
57367 <secondary>logging cipher</secondary>
57368 </indexterm>
57369 <option>tls_cipher</option>: When a message is sent or received over an encrypted
57370 connection, the cipher suite used is added to the log line, preceded by X=.
57371 </para>
57372 </listitem>
57373 <listitem>
57374 <para>
57375 <indexterm role="concept">
57376 <primary>log</primary>
57377 <secondary>TLS peer DN</secondary>
57378 </indexterm>
57379 <indexterm role="concept">
57380 <primary>TLS</primary>
57381 <secondary>logging peer DN</secondary>
57382 </indexterm>
57383 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
57384 connection, and a certificate is supplied by the remote host, the peer DN is
57385 added to the log line, preceded by DN=.
57386 </para>
57387 </listitem>
57388 <listitem>
57389 <para>
57390 <indexterm role="concept">
57391 <primary>log</primary>
57392 <secondary>DNS failure in list</secondary>
57393 </indexterm>
57394 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
57395 result of a list match is failure because a DNS lookup failed.
57396 </para>
57397 </listitem>
57398 </itemizedlist>
57399 </section>
57400 <section>
57401 <title>Message log</title>
57402 <para>
57403 <indexterm role="concept">
57404 <primary>message</primary>
57405 <secondary>log file for</secondary>
57406 </indexterm>
57407 <indexterm role="concept">
57408 <primary>log</primary>
57409 <secondary>message log; description of</secondary>
57410 </indexterm>
57411 <indexterm role="concept">
57412 <primary><filename>msglog</filename> directory</primary>
57413 </indexterm>
57414 <indexterm role="concept">
57415 <primary><option>preserve_message_logs</option></primary>
57416 </indexterm>
57417 In addition to the general log files, Exim writes a log file for each message
57418 that it handles. The names of these per-message logs are the message ids, and
57419 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
57420 message log contains copies of the log lines that apply to the message. This
57421 makes it easier to inspect the status of an individual message without having
57422 to search the main log. A message log is deleted when processing of the message
57423 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
57424 only with great care because they can fill up your disk very quickly.
57425 </para>
57426 <para>
57427 On a heavily loaded system, it may be desirable to disable the use of
57428 per-message logs, in order to reduce disk I/O. This can be done by setting the
57429 <option>message_logs</option> option false.
57430 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
57431 </para>
57432 </section>
57433 </chapter>
57434
57435 <chapter id="CHAPutils">
57436 <title>Exim utilities</title>
57437 <para>
57438 <indexterm role="concept" id="IIDutils" class="startofrange">
57439 <primary>utilities</primary>
57440 </indexterm>
57441 A number of utility scripts and programs are supplied with Exim and are
57442 described in this chapter. There is also the Exim Monitor, which is covered in
57443 the next chapter. The utilities described here are:
57444 </para>
57445 <informaltable frame="none">
57446 <tgroup cols="4" colsep="0" rowsep="0">
57447 <colspec colwidth="2*" align="left"/>
57448 <colspec colwidth="8*" align="left"/>
57449 <colspec colwidth="30*" align="left"/>
57450 <colspec colwidth="40*" align="left"/>
57451 <tbody>
57452 <row>
57453 <entry></entry>
57454 <entry><xref linkend="SECTfinoutwha"/></entry>
57455 <entry><emphasis>exiwhat</emphasis></entry>
57456 <entry>list what Exim processes are doing</entry>
57457 </row>
57458 <row>
57459 <entry></entry>
57460 <entry><xref linkend="SECTgreptheque"/></entry>
57461 <entry><emphasis>exiqgrep</emphasis></entry>
57462 <entry>grep the queue</entry>
57463 </row>
57464 <row>
57465 <entry></entry>
57466 <entry><xref linkend="SECTsumtheque"/></entry>
57467 <entry><emphasis>exiqsumm</emphasis></entry>
57468 <entry>summarize the queue</entry>
57469 </row>
57470 <row>
57471 <entry></entry>
57472 <entry><xref linkend="SECTextspeinf"/></entry>
57473 <entry><emphasis>exigrep</emphasis></entry>
57474 <entry>search the main log</entry>
57475 </row>
57476 <row>
57477 <entry></entry>
57478 <entry><xref linkend="SECTexipick"/></entry>
57479 <entry><emphasis>exipick</emphasis></entry>
57480 <entry>select messages on various criteria</entry>
57481 </row>
57482 <row>
57483 <entry></entry>
57484 <entry><xref linkend="SECTcyclogfil"/></entry>
57485 <entry><emphasis>exicyclog</emphasis></entry>
57486 <entry>cycle (rotate) log files</entry>
57487 </row>
57488 <row>
57489 <entry></entry>
57490 <entry><xref linkend="SECTmailstat"/></entry>
57491 <entry><emphasis>eximstats</emphasis></entry>
57492 <entry>extract statistics from the log</entry>
57493 </row>
57494 <row>
57495 <entry></entry>
57496 <entry><xref linkend="SECTcheckaccess"/></entry>
57497 <entry><emphasis>exim_checkaccess</emphasis></entry>
57498 <entry>check address acceptance from given IP</entry>
57499 </row>
57500 <row>
57501 <entry></entry>
57502 <entry><xref linkend="SECTdbmbuild"/></entry>
57503 <entry><emphasis>exim_dbmbuild</emphasis></entry>
57504 <entry>build a DBM file</entry>
57505 </row>
57506 <row>
57507 <entry></entry>
57508 <entry><xref linkend="SECTfinindret"/></entry>
57509 <entry><emphasis>exinext</emphasis></entry>
57510 <entry>extract retry information</entry>
57511 </row>
57512 <row>
57513 <entry></entry>
57514 <entry><xref linkend="SECThindatmai"/></entry>
57515 <entry><emphasis>exim_dumpdb</emphasis></entry>
57516 <entry>dump a hints database</entry>
57517 </row>
57518 <row>
57519 <entry></entry>
57520 <entry><xref linkend="SECThindatmai"/></entry>
57521 <entry><emphasis>exim_tidydb</emphasis></entry>
57522 <entry>clean up a hints database</entry>
57523 </row>
57524 <row>
57525 <entry></entry>
57526 <entry><xref linkend="SECThindatmai"/></entry>
57527 <entry><emphasis>exim_fixdb</emphasis></entry>
57528 <entry>patch a hints database</entry>
57529 </row>
57530 <row>
57531 <entry></entry>
57532 <entry><xref linkend="SECTmailboxmaint"/></entry>
57533 <entry><emphasis>exim_lock</emphasis></entry>
57534 <entry>lock a mailbox file</entry>
57535 </row>
57536 </tbody>
57537 </tgroup>
57538 </informaltable>
57539 <para>
57540 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
57541 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
57542 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
57543 </para>
57544 <section id="SECTfinoutwha">
57545 <title>Finding out what Exim processes are doing (exiwhat)</title>
57546 <para>
57547 <indexterm role="concept">
57548 <primary><emphasis>exiwhat</emphasis></primary>
57549 </indexterm>
57550 <indexterm role="concept">
57551 <primary>process</primary>
57552 <secondary>querying</secondary>
57553 </indexterm>
57554 <indexterm role="concept">
57555 <primary>SIGUSR1</primary>
57556 </indexterm>
57557 On operating systems that can restart a system call after receiving a signal
57558 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
57559 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
57560 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
57561 processes it can find, having first emptied the file. It then waits for one
57562 second to allow the Exim processes to react before displaying the results. In
57563 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
57564 send the signal to the Exim processes, so it is normally run as root.
57565 </para>
57566 <para>
57567 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
57568 use by system administrators. It is not sensible, for example, to set up a
57569 script that sends SIGUSR1 signals to Exim processes at short intervals.
57570 </para>
57571 <para>
57572 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
57573 varies in different operating systems. Not only are different options used,
57574 but the format of the output is different. For this reason, there are some
57575 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
57576 it doesn&#x2019;t seem to be working for you, check the following compile-time
57577 options:
57578 </para>
57579 <literallayout>
57580 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
57581 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
57582 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
57583 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
57584 </literallayout>
57585 <para>
57586 An example of typical output from <emphasis>exiwhat</emphasis> is
57587 </para>
57588 <literallayout class="monospaced">
57589 164 daemon: -q1h, listening on port 25
57590 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
57591 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
57592   [10.19.42.42] (editor@ref.example)
57593 10592 handling incoming call from [192.168.243.242]
57594 10628 accepting a local non-SMTP message
57595 </literallayout>
57596 <para>
57597 The first number in the output line is the process number. The third line has
57598 been split here, in order to fit it on the page.
57599 </para>
57600 </section>
57601 <section id="SECTgreptheque">
57602 <title>Selective queue listing (exiqgrep)</title>
57603 <para>
57604 <indexterm role="concept">
57605 <primary><emphasis>exiqgrep</emphasis></primary>
57606 </indexterm>
57607 <indexterm role="concept">
57608 <primary>queue</primary>
57609 <secondary>grepping</secondary>
57610 </indexterm>
57611 This utility is a Perl script contributed by Matt Hubbard. It runs
57612 </para>
57613 <literallayout class="monospaced">
57614 exim -bpu
57615 </literallayout>
57616 <para>
57617 to obtain a queue listing with undelivered recipients only, and then greps the
57618 output to select messages that match given criteria. The following selection
57619 options are available:
57620 </para>
57621 <variablelist>
57622 <varlistentry>
57623 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
57624 <listitem>
57625 <para>
57626 Match the sender address. The field that is tested is enclosed in angle
57627 brackets, so you can test for bounce messages with
57628 </para>
57629 <literallayout class="monospaced">
57630 exiqgrep -f '^&lt;&gt;$'
57631 </literallayout>
57632 </listitem></varlistentry>
57633 <varlistentry>
57634 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
57635 <listitem>
57636 <para>
57637 Match a recipient address. The field that is tested is not enclosed in angle
57638 brackets.
57639 </para>
57640 </listitem></varlistentry>
57641 <varlistentry>
57642 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
57643 <listitem>
57644 <para>
57645 Match against the size field.
57646 </para>
57647 </listitem></varlistentry>
57648 <varlistentry>
57649 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
57650 <listitem>
57651 <para>
57652 Match messages that are younger than the given time.
57653 </para>
57654 </listitem></varlistentry>
57655 <varlistentry>
57656 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
57657 <listitem>
57658 <para>
57659 Match messages that are older than the given time.
57660 </para>
57661 </listitem></varlistentry>
57662 <varlistentry>
57663 <term><emphasis role="bold">-z</emphasis></term>
57664 <listitem>
57665 <para>
57666 Match only frozen messages.
57667 </para>
57668 </listitem></varlistentry>
57669 <varlistentry>
57670 <term><emphasis role="bold">-x</emphasis></term>
57671 <listitem>
57672 <para>
57673 Match only non-frozen messages.
57674 </para>
57675 </listitem></varlistentry>
57676 </variablelist>
57677 <para>
57678 The following options control the format of the output:
57679 </para>
57680 <variablelist>
57681 <varlistentry>
57682 <term><emphasis role="bold">-c</emphasis></term>
57683 <listitem>
57684 <para>
57685 Display only the count of matching messages.
57686 </para>
57687 </listitem></varlistentry>
57688 <varlistentry>
57689 <term><emphasis role="bold">-l</emphasis></term>
57690 <listitem>
57691 <para>
57692 Long format &ndash; display the full message information as output by Exim. This is
57693 the default.
57694 </para>
57695 </listitem></varlistentry>
57696 <varlistentry>
57697 <term><emphasis role="bold">-i</emphasis></term>
57698 <listitem>
57699 <para>
57700 Display message ids only.
57701 </para>
57702 </listitem></varlistentry>
57703 <varlistentry>
57704 <term><emphasis role="bold">-b</emphasis></term>
57705 <listitem>
57706 <para>
57707 Brief format &ndash; one line per message.
57708 </para>
57709 </listitem></varlistentry>
57710 <varlistentry>
57711 <term><emphasis role="bold">-R</emphasis></term>
57712 <listitem>
57713 <para>
57714 Display messages in reverse order.
57715 </para>
57716 </listitem></varlistentry>
57717 </variablelist>
57718 <para>
57719 There is one more option, <option>-h</option>, which outputs a list of options.
57720 </para>
57721 </section>
57722 <section id="SECTsumtheque">
57723 <title>Summarising the queue (exiqsumm)</title>
57724 <para>
57725 <indexterm role="concept">
57726 <primary><emphasis>exiqsumm</emphasis></primary>
57727 </indexterm>
57728 <indexterm role="concept">
57729 <primary>queue</primary>
57730 <secondary>summary</secondary>
57731 </indexterm>
57732 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
57733 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
57734 running a command such as
57735 </para>
57736 <literallayout class="monospaced">
57737 exim -bp | exiqsumm
57738 </literallayout>
57739 <para>
57740 The output consists of one line for each domain that has messages waiting for
57741 it, as in the following example:
57742 </para>
57743 <literallayout class="monospaced">
57744 3   2322   74m   66m  msn.com.example
57745 </literallayout>
57746 <para>
57747 Each line lists the number of pending deliveries for a domain, their total
57748 volume, and the length of time that the oldest and the newest messages have
57749 been waiting. Note that the number of pending deliveries is greater than the
57750 number of messages when messages have more than one recipient.
57751 </para>
57752 <para revisionflag="changed">
57753 A summary line is output at the end. By default the output is sorted on the
57754 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
57755 the output to be sorted by oldest message and by count of messages,
57756 respectively. There are also three options that split the messages for each
57757 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
57758 separates frozen messages, and <option>-s</option> separates messages according to their
57759 sender.
57760 </para>
57761 <para>
57762 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
57763 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
57764 generated by aliasing or forwarding are included (unless the <option>one_time</option>
57765 option of the <command>redirect</command> router has been used to convert them into <quote>top
57766 level</quote> addresses).
57767 </para>
57768 </section>
57769 <section id="SECTextspeinf">
57770 <title>Extracting specific information from the log (exigrep)</title>
57771 <para>
57772 <indexterm role="concept">
57773 <primary><emphasis>exigrep</emphasis></primary>
57774 </indexterm>
57775 <indexterm role="concept">
57776 <primary>log</primary>
57777 <secondary>extracts; grepping for</secondary>
57778 </indexterm>
57779 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
57780 files for entries that match a given pattern. When it finds a match, it
57781 extracts all the log entries for the relevant message, not just those that
57782 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
57783 given message, or all mail for a given user, or for a given host, for example.
57784 The input files can be in Exim log format or syslog format.
57785 </para>
57786 <para>
57787 If a matching log line is not associated with a specific message, it is always
57788 included in <emphasis>exigrep</emphasis>&#x2019;s output. The usage is:
57789 </para>
57790 <literallayout>
57791 <literal>exigrep [-l] [-t&lt;</literal><emphasis>n</emphasis><literal>&gt;] &lt;</literal><emphasis>pattern</emphasis><literal>&gt; [&lt;</literal><emphasis>log file</emphasis><literal>&gt;] ...</literal>
57792 </literallayout>
57793 <para>
57794 The <option>-t</option> argument specifies a number of seconds. It adds an additional
57795 condition for message selection. Messages that are complete are shown only if
57796 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
57797 </para>
57798 <para>
57799 The <option>-l</option> flag means <quote>literal</quote>, that is, treat all characters in the
57800 pattern as standing for themselves. Otherwise the pattern must be a Perl
57801 regular expression. The pattern match is case-insensitive. If no file names are
57802 given on the command line, the standard input is read.
57803 </para>
57804 <para>
57805 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
57806 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
57807 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
57808 </para>
57809 </section>
57810 <section id="SECTexipick">
57811 <title>Selecting messages by various criteria (exipick)</title>
57812 <para>
57813 <indexterm role="concept">
57814 <primary><emphasis>exipick</emphasis></primary>
57815 </indexterm>
57816 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
57817 lists messages from the queue according to a variety of criteria. For details,
57818 visit <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run:
57819 </para>
57820 <literallayout class="monospaced">
57821 exipick --help
57822 </literallayout>
57823 </section>
57824 <section id="SECTcyclogfil">
57825 <title>Cycling log files (exicyclog)</title>
57826 <para>
57827 <indexterm role="concept">
57828 <primary>log</primary>
57829 <secondary>cycling local files</secondary>
57830 </indexterm>
57831 <indexterm role="concept">
57832 <primary>cycling logs</primary>
57833 </indexterm>
57834 <indexterm role="concept">
57835 <primary><emphasis>exicyclog</emphasis></primary>
57836 </indexterm>
57837 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
57838 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
57839 you are using log files with datestamps in their names (see section
57840 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
57841 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
57842 There are two command line options for <emphasis>exicyclog</emphasis>:
57843 </para>
57844 <itemizedlist>
57845 <listitem>
57846 <para>
57847 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
57848 default that is set when Exim is built. The default default is 10.
57849 </para>
57850 </listitem>
57851 <listitem>
57852 <para>
57853 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
57854 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
57855 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
57856 configuration.
57857 </para>
57858 </listitem>
57859 </itemizedlist>
57860 <para>
57861 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
57862 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
57863 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
57864 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
57865 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
57866 logs are handled similarly.
57867 </para>
57868 <para>
57869 If the limit is greater than 99, the script uses 3-digit numbers such as
57870 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
57871 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
57872 any existing log files.
57873 </para>
57874 <para>
57875 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
57876 the end are deleted. All files with numbers greater than 01 are compressed,
57877 using a compression command which is configured by the COMPRESS_COMMAND
57878 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
57879 root <option>crontab</option> entry of the form
57880 </para>
57881 <literallayout class="monospaced">
57882 1 0 * * * su exim -c /usr/exim/bin/exicyclog
57883 </literallayout>
57884 <para>
57885 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
57886 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
57887 </para>
57888 </section>
57889 <section id="SECTmailstat">
57890 <title>Mail statistics (eximstats)</title>
57891 <para>
57892 <indexterm role="concept">
57893 <primary>statistics</primary>
57894 </indexterm>
57895 <indexterm role="concept">
57896 <primary><emphasis>eximstats</emphasis></primary>
57897 </indexterm>
57898 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
57899 information from log files. The output is either plain text, or HTML.
57900 Exim log files are also suported by the <emphasis>Lire</emphasis> system produced by the
57901 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
57902 </para>
57903 <para>
57904 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
57905 latest version is the result of some extensive revision by Steve Campbell. A
57906 lot of information is given by default, but there are options for suppressing
57907 various parts of it. Following any options, the arguments to the script are a
57908 list of files, which should be main log files. For example:
57909 </para>
57910 <literallayout class="monospaced">
57911 eximstats -nr /var/spool/exim/log/mainlog.01
57912 </literallayout>
57913 <para>
57914 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
57915 messages received from or delivered to various hosts. The information is sorted
57916 both by message count and by volume, and the top fifty hosts in each category
57917 are listed on the standard output. Similar information, based on email
57918 addresses or domains instead of hosts can be requested by means of various
57919 options. For messages delivered and received locally, similar statistics are
57920 also produced per user.
57921 </para>
57922 <para>
57923 The output also includes total counts and statistics about delivery errors, and
57924 histograms showing the number of messages received and deliveries made in each
57925 hour of the day. A delivery with more than one address in its envelope (for
57926 example, an SMTP transaction with more than one RCPT command) is counted
57927 as a single delivery by <emphasis>eximstats</emphasis>.
57928 </para>
57929 <para>
57930 Though normally more deliveries than receipts are reported (as messages may
57931 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
57932 messages received than delivered, even though the queue is empty at the start
57933 and end of the period in question. If an incoming message contains no valid
57934 recipients, no deliveries are recorded for it. A bounce message is handled as
57935 an entirely separate message.
57936 </para>
57937 <para>
57938 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
57939 of messages received and deliveries made, and the number of hosts involved in
57940 each case. It also outputs the number of messages that were delayed (that is,
57941 not completely delivered at the first attempt), and the number that had at
57942 least one address that failed.
57943 </para>
57944 <para>
57945 The remainder of the output is in sections that can be independently disabled
57946 or modified by various options. It consists of a summary of deliveries by
57947 transport, histograms of messages received and delivered per time interval
57948 (default per hour), information about the time messages spent on the queue,
57949 a list of relayed messages, lists of the top fifty sending hosts, local
57950 senders, destination hosts, and destination local users by count and by volume,
57951 and a list of delivery errors that occurred.
57952 </para>
57953 <para>
57954 The relay information lists messages that were actually relayed, that is, they
57955 came from a remote host and were directly delivered to some other remote host,
57956 without being processed (for example, for aliasing or forwarding) locally.
57957 </para>
57958 <para>
57959 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
57960 outputs. These are documented in the Perl script itself, and can be extracted
57961 by running the command <command>perldoc</command> on the script. For example:
57962 </para>
57963 <literallayout class="monospaced">
57964 perldoc /usr/exim/bin/eximstats
57965 </literallayout>
57966 </section>
57967 <section id="SECTcheckaccess">
57968 <title>Checking access policy (exim_checkaccess)</title>
57969 <para>
57970 <indexterm role="concept">
57971 <primary><emphasis>exim_checkaccess</emphasis></primary>
57972 </indexterm>
57973 <indexterm role="concept">
57974 <primary>policy control</primary>
57975 <secondary>checking access</secondary>
57976 </indexterm>
57977 <indexterm role="concept">
57978 <primary>checking access</primary>
57979 </indexterm>
57980 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
57981 debugging output, in order to check what Exim is doing when it is applying
57982 policy controls to incoming SMTP mail. However, not everybody is sufficiently
57983 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
57984 sometimes you just want to answer the question <quote>Does this address have
57985 access?</quote> without bothering with any further details.
57986 </para>
57987 <para>
57988 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
57989 two arguments, an IP address and an email address:
57990 </para>
57991 <literallayout class="monospaced">
57992 exim_checkaccess 10.9.8.7 A.User@a.domain.example
57993 </literallayout>
57994 <para>
57995 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
57996 given email address would be accepted in a RCPT command in a TCP/IP
57997 connection from the host with the given IP address. The output of the utility
57998 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
57999 </para>
58000 <literallayout class="monospaced">
58001 Rejected:
58002 550 Relay not permitted
58003 </literallayout>
58004 <para>
58005 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
58006 for the MAIL command, but you can change this by providing additional
58007 options. These are passed directly to the Exim command. For example, to specify
58008 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
58009 you can use:
58010 </para>
58011 <literallayout class="monospaced">
58012 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
58013                  -f himself@there.example
58014 </literallayout>
58015 <para>
58016 Note that these additional Exim command line items must be given after the two
58017 mandatory arguments.
58018 </para>
58019 <para>
58020 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
58021 while running its checks. You can run checks that include callouts by using
58022 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
58023 </para>
58024 </section>
58025 <section id="SECTdbmbuild">
58026 <title>Making DBM files (exim_dbmbuild)</title>
58027 <para>
58028 <indexterm role="concept">
58029 <primary>DBM</primary>
58030 <secondary>building dbm files</secondary>
58031 </indexterm>
58032 <indexterm role="concept">
58033 <primary>building DBM files</primary>
58034 </indexterm>
58035 <indexterm role="concept">
58036 <primary><emphasis>exim_dbmbuild</emphasis></primary>
58037 </indexterm>
58038 <indexterm role="concept">
58039 <primary>lower casing</primary>
58040 </indexterm>
58041 <indexterm role="concept">
58042 <primary>binary zero</primary>
58043 <secondary>in lookup key</secondary>
58044 </indexterm>
58045 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
58046 the format used by the <command>lsearch</command> lookup (see section
58047 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
58048 names as keys and the remainder of the information as data. The lower-casing
58049 can be prevented by calling the program with the <option>-nolc</option> option.
58050 </para>
58051 <para>
58052 A terminating zero is included as part of the key string. This is expected by
58053 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
58054 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
58055 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
58056 files.
58057 </para>
58058 <para>
58059 The program requires two arguments: the name of the input file (which can be a
58060 single hyphen to indicate the standard input), and the name of the output file.
58061 It creates the output under a temporary name, and then renames it if all went
58062 well.
58063 </para>
58064 <para>
58065 <indexterm role="concept">
58066 <primary>USE_DB</primary>
58067 </indexterm>
58068 If the native DB interface is in use (USE_DB is set in a compile-time
58069 configuration file &ndash; this is common in free versions of Unix) the two file
58070 names must be different, because in this mode the Berkeley DB functions create
58071 a single output file using exactly the name given. For example,
58072 </para>
58073 <literallayout class="monospaced">
58074 exim_dbmbuild /etc/aliases /etc/aliases.db
58075 </literallayout>
58076 <para>
58077 reads the system alias file and creates a DBM version of it in
58078 <filename>/etc/aliases.db</filename>.
58079 </para>
58080 <para>
58081 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
58082 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
58083 environment, the suffixes are added to the second argument of
58084 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
58085 when the Berkeley functions are used in compatibility mode (though this is not
58086 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
58087 </para>
58088 <para>
58089 If a duplicate key is encountered, the program outputs a warning, and when it
58090 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
58091 option is used. By default, only the first of a set of duplicates is used &ndash;
58092 this makes it compatible with <command>lsearch</command> lookups. There is an option
58093 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
58094 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
58095 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
58096 return code is 2.
58097 </para>
58098 </section>
58099 <section id="SECTfinindret">
58100 <title>Finding individual retry times (exinext)</title>
58101 <para>
58102 <indexterm role="concept">
58103 <primary>retry</primary>
58104 <secondary>times</secondary>
58105 </indexterm>
58106 <indexterm role="concept">
58107 <primary><emphasis>exinext</emphasis></primary>
58108 </indexterm>
58109 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
58110 fish specific information out of the retry database. Given a mail domain (or a
58111 complete address), it looks up the hosts for that domain, and outputs any retry
58112 information for the hosts or for the domain. At present, the retry information
58113 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
58114 output. For example:
58115 </para>
58116 <literallayout class="monospaced">
58117 $ exinext piglet@milne.fict.example
58118 kanga.milne.example:192.168.8.1 error 146: Connection refused
58119   first failed: 21-Feb-1996 14:57:34
58120   last tried:   21-Feb-1996 14:57:34
58121   next try at:  21-Feb-1996 15:02:34
58122 roo.milne.example:192.168.8.3 error 146: Connection refused
58123   first failed: 20-Jan-1996 13:12:08
58124   last tried:   21-Feb-1996 11:42:03
58125   next try at:  21-Feb-1996 19:42:03
58126   past final cutoff time
58127 </literallayout>
58128 <para>
58129 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
58130 will give any retry information for that local part in your default domain.
58131 A message id can be used to obtain retry information pertaining to a specific
58132 message. This exists only when an attempt to deliver a message to a remote host
58133 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
58134 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
58135 run very often.
58136 </para>
58137 <para>
58138 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
58139 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
58140 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
58141 configuration file, and the second sets macros for use within the configuration
58142 file. These features are mainly to help in testing, but might also be useful in
58143 environments where more than one configuration file is in use.
58144 </para>
58145 </section>
58146 <section id="SECThindatmai">
58147 <title>Hints database maintenance</title>
58148 <para>
58149 <indexterm role="concept">
58150 <primary>hints database</primary>
58151 <secondary>maintenance</secondary>
58152 </indexterm>
58153 <indexterm role="concept">
58154 <primary>maintaining Exim&#x2019;s hints database</primary>
58155 </indexterm>
58156 Three utility programs are provided for maintaining the DBM files that Exim
58157 uses to contain its delivery hint information. Each program requires two
58158 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
58159 second is the name of the database it is to operate on. These are as follows:
58160 </para>
58161 <itemizedlist>
58162 <listitem>
58163 <para>
58164 <emphasis>retry</emphasis>: the database of retry information
58165 </para>
58166 </listitem>
58167 <listitem>
58168 <para>
58169 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
58170 for remote hosts
58171 </para>
58172 </listitem>
58173 <listitem>
58174 <para>
58175 <emphasis>callout</emphasis>: the callout cache
58176 </para>
58177 </listitem>
58178 <listitem>
58179 <para>
58180 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
58181 </para>
58182 </listitem>
58183 <listitem>
58184 <para>
58185 <emphasis>misc</emphasis>: other hints data
58186 </para>
58187 </listitem>
58188 </itemizedlist>
58189 <para>
58190 The <emphasis>misc</emphasis> database is used for
58191 </para>
58192 <itemizedlist>
58193 <listitem>
58194 <para>
58195 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
58196 </para>
58197 </listitem>
58198 <listitem>
58199 <para>
58200 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
58201 <command>smtp</command> transport)
58202 </para>
58203 </listitem>
58204 </itemizedlist>
58205 </section>
58206 <section>
58207 <title>exim_dumpdb</title>
58208 <para>
58209 <indexterm role="concept">
58210 <primary><emphasis>exim_dumpdb</emphasis></primary>
58211 </indexterm>
58212 The entire contents of a database are written to the standard output by the
58213 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
58214 spool and database names. For example, to dump the retry database:
58215 </para>
58216 <literallayout class="monospaced">
58217 exim_dumpdb /var/spool/exim retry
58218 </literallayout>
58219 <para>
58220 Two lines of output are produced for each entry:
58221 </para>
58222 <literallayout class="monospaced">
58223 T:mail.ref.example:192.168.242.242 146 77 Connection refused
58224 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
58225 </literallayout>
58226 <para>
58227 The first item on the first line is the key of the record. It starts with one
58228 of the letters R, or T, depending on whether it refers to a routing or
58229 transport retry. For a local delivery, the next part is the local address; for
58230 a remote delivery it is the name of the remote host, followed by its failing IP
58231 address (unless <option>no_retry_include_ip_address</option> is set on the <command>smtp</command>
58232 transport). If the remote port is not the standard one (port 25), it is added
58233 to the IP address. Then there follows an error code, an additional error code,
58234 and a textual description of the error.
58235 </para>
58236 <para>
58237 The three times on the second line are the time of first failure, the time of
58238 the last delivery attempt, and the computed time for the next attempt. The line
58239 ends with an asterisk if the cutoff time for the last retry rule has been
58240 exceeded.
58241 </para>
58242 <para>
58243 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
58244 consists of a host name followed by a list of ids for messages that are or were
58245 waiting to be delivered to that host. If there are a very large number for any
58246 one host, continuation records, with a sequence number added to the host name,
58247 may be seen. The data in these records is often out of date, because a message
58248 may be routed to several alternative hosts, and Exim makes no effort to keep
58249 cross-references.
58250 </para>
58251 </section>
58252 <section>
58253 <title>exim_tidydb</title>
58254 <para>
58255 <indexterm role="concept">
58256 <primary><emphasis>exim_tidydb</emphasis></primary>
58257 </indexterm>
58258 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
58259 database. If run with no options, it removes all records that are more than 30
58260 days old. The age is calculated from the date and time that the record was last
58261 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
58262 since the first delivery failure. Information about a host that has been down
58263 for more than 30 days will remain in the database, provided that the record is
58264 updated sufficiently often.
58265 </para>
58266 <para>
58267 The cutoff date can be altered by means of the <option>-t</option> option, which must be
58268 followed by a time. For example, to remove all records older than a week from
58269 the retry database:
58270 </para>
58271 <literallayout class="monospaced">
58272 exim_tidydb -t 7d /var/spool/exim retry
58273 </literallayout>
58274 <para>
58275 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
58276 message ids. In the former these appear as data in records keyed by host &ndash;
58277 they were messages that were waiting for that host &ndash; and in the latter they
58278 are the keys for retry information for messages that have suffered certain
58279 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
58280 message ids in database records are those of messages that are still on the
58281 queue. Message ids for messages that no longer exist are removed from
58282 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
58283 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
58284 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
58285 whenever it removes information from the database.
58286 </para>
58287 <para>
58288 Certain records are automatically removed by Exim when they are no longer
58289 needed, but others are not. For example, if all the MX hosts for a domain are
58290 down, a retry record is created for each one. If the primary MX host comes back
58291 first, its record is removed when Exim successfully delivers to it, but the
58292 records for the others remain because Exim has not tried to use those hosts.
58293 </para>
58294 <para>
58295 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
58296 hints databases. You should do this at a quiet time of day, because it requires
58297 a database to be locked (and therefore inaccessible to Exim) while it does its
58298 work. Removing records from a DBM file does not normally make the file smaller,
58299 but all the common DBM libraries are able to re-use the space that is released.
58300 After an initial phase of increasing in size, the databases normally reach a
58301 point at which they no longer get any bigger, as long as they are regularly
58302 tidied.
58303 </para>
58304 <para>
58305 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
58306 databases is likely to keep on increasing.
58307 </para>
58308 </section>
58309 <section>
58310 <title>exim_fixdb</title>
58311 <para>
58312 <indexterm role="concept">
58313 <primary><emphasis>exim_fixdb</emphasis></primary>
58314 </indexterm>
58315 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
58316 Its main use is for testing Exim, but it might also be occasionally useful for
58317 getting round problems in a live system. It has no options, and its interface
58318 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
58319 key of a database record can then be entered, and the data for that record is
58320 displayed.
58321 </para>
58322 <para>
58323 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
58324 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
58325 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
58326 data for individual fields can be changed by typing the field number followed
58327 by new data, for example:
58328 </para>
58329 <literallayout class="monospaced">
58330 &gt; 4 951102:1000
58331 </literallayout>
58332 <para>
58333 resets the time of the next delivery attempt. Time values are given as a
58334 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
58335 used as optional separators.
58336 </para>
58337 </section>
58338 <section id="SECTmailboxmaint">
58339 <title>Mailbox maintenance (exim_lock)</title>
58340 <para>
58341 <indexterm role="concept">
58342 <primary>mailbox</primary>
58343 <secondary>maintenance</secondary>
58344 </indexterm>
58345 <indexterm role="concept">
58346 <primary><emphasis>exim_lock</emphasis></primary>
58347 </indexterm>
58348 <indexterm role="concept">
58349 <primary>locking mailboxes</primary>
58350 </indexterm>
58351 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
58352 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
58353 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
58354 a user agent while investigating a problem. The utility requires the name of
58355 the file as its first argument. If the locking is successful, the second
58356 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
58357 second argument, the value of the SHELL environment variable is used; if this
58358 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
58359 is unlocked and the utility ends. The following options are available:
58360 </para>
58361 <variablelist>
58362 <varlistentry>
58363 <term><option>-fcntl</option></term>
58364 <listitem>
58365 <para>
58366 Use <function>fcntl()</function> locking on the open mailbox.
58367 </para>
58368 </listitem></varlistentry>
58369 <varlistentry>
58370 <term><option>-flock</option></term>
58371 <listitem>
58372 <para>
58373 Use <function>flock()</function> locking on the open mailbox, provided the operating system
58374 supports it.
58375 </para>
58376 </listitem></varlistentry>
58377 <varlistentry>
58378 <term><option>-interval</option></term>
58379 <listitem>
58380 <para>
58381 This must be followed by a number, which is a number of seconds; it sets the
58382 interval to sleep between retries (default 3).
58383 </para>
58384 </listitem></varlistentry>
58385 <varlistentry>
58386 <term><option>-lockfile</option></term>
58387 <listitem>
58388 <para>
58389 Create a lock file before opening the mailbox.
58390 </para>
58391 </listitem></varlistentry>
58392 <varlistentry>
58393 <term><option>-mbx</option></term>
58394 <listitem>
58395 <para>
58396 Lock the mailbox using MBX rules.
58397 </para>
58398 </listitem></varlistentry>
58399 <varlistentry>
58400 <term><option>-q</option></term>
58401 <listitem>
58402 <para>
58403 Suppress verification output.
58404 </para>
58405 </listitem></varlistentry>
58406 <varlistentry>
58407 <term><option>-retries</option></term>
58408 <listitem>
58409 <para>
58410 This must be followed by a number; it sets the number of times to try to get
58411 the lock (default 10).
58412 </para>
58413 </listitem></varlistentry>
58414 <varlistentry>
58415 <term><option>-restore_time</option></term>
58416 <listitem>
58417 <para>
58418 This option causes <option>exim_lock</option> to restore the modified and read times to the
58419 locked file before exiting. This allows you to access a locked mailbox (for
58420 example, to take a backup copy) without disturbing the times that the user
58421 subsequently sees.
58422 </para>
58423 </listitem></varlistentry>
58424 <varlistentry>
58425 <term><option>-timeout</option></term>
58426 <listitem>
58427 <para>
58428 This must be followed by a number, which is a number of seconds; it sets a
58429 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
58430 default), a non-blocking call is used.
58431 </para>
58432 </listitem></varlistentry>
58433 <varlistentry>
58434 <term><option>-v</option></term>
58435 <listitem>
58436 <para>
58437 Generate verbose output.
58438 </para>
58439 </listitem></varlistentry>
58440 </variablelist>
58441 <para>
58442 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
58443 default is to create a lock file and also to use <function>fcntl()</function> locking on the
58444 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
58445 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
58446 requires that the directory containing the file be writeable. Locking by lock
58447 file does not last for ever; Exim assumes that a lock file is expired if it is
58448 more than 30 minutes old.
58449 </para>
58450 <para>
58451 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
58452 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
58453 to be taken out on the open mailbox, and an exclusive lock on the file
58454 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
58455 number of the mailbox file. When the locking is released, if an exclusive lock
58456 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
58457 </para>
58458 <para>
58459 The default output contains verification of the locking that takes place. The
58460 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
58461 suppresses all output except error messages.
58462 </para>
58463 <para>
58464 A command such as
58465 </para>
58466 <literallayout class="monospaced">
58467 exim_lock /var/spool/mail/spqr
58468 </literallayout>
58469 <para>
58470 runs an interactive shell while the file is locked, whereas
58471 </para>
58472 <literallayout>
58473 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
58474 &lt;<emphasis>some commands</emphasis>&gt;
58475 <literal>End</literal>
58476 </literallayout>
58477 <para>
58478 runs a specific non-interactive sequence of commands while the file is locked,
58479 suppressing all verification output. A single command can be run by a command
58480 such as
58481 </para>
58482 <literallayout class="monospaced">
58483 exim_lock -q /var/spool/mail/spqr \
58484   "cp /var/spool/mail/spqr /some/where"
58485 </literallayout>
58486 <para>
58487 Note that if a command is supplied, it must be entirely contained within the
58488 second argument &ndash; hence the quotes.
58489 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
58490 </para>
58491 </section>
58492 </chapter>
58493
58494 <chapter id="CHAPeximon">
58495 <title>The Exim monitor</title>
58496 <para>
58497 <indexterm role="concept" id="IIDeximon" class="startofrange">
58498 <primary>Exim monitor</primary>
58499 <secondary>description</secondary>
58500 </indexterm>
58501 <indexterm role="concept">
58502 <primary>X-windows</primary>
58503 </indexterm>
58504 <indexterm role="concept">
58505 <primary><emphasis>eximon</emphasis></primary>
58506 </indexterm>
58507 <indexterm role="concept">
58508 <primary>Local/eximon.conf</primary>
58509 </indexterm>
58510 <indexterm role="concept">
58511 <primary><filename>exim_monitor/EDITME</filename></primary>
58512 </indexterm>
58513 The Exim monitor is an application which displays in an X window information
58514 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
58515 perform certain operations on messages from this GUI interface; however all
58516 such facilities are also available from the command line, and indeed, the
58517 monitor itself makes use of the command line to perform any actions requested.
58518 </para>
58519 <section>
58520 <title>Running the monitor</title>
58521 <para>
58522 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
58523 script that sets up a number of environment variables, and then runs the
58524 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
58525 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
58526 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
58527 parameters are for.
58528 </para>
58529 <para>
58530 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
58531 a particular invocation by setting up environment variables of the same names,
58532 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
58533 </para>
58534 <literallayout class="monospaced">
58535 EXIMON_LOG_DEPTH=400 eximon
58536 </literallayout>
58537 <para>
58538 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
58539 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
58540 overrides the Exim log file configuration. This makes it possible to have
58541 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
58542 syslog messages are routed to a file on the local host.
58543 </para>
58544 <para>
58545 X resources can be used to change the appearance of the window in the normal
58546 way. For example, a resource setting of the form
58547 </para>
58548 <literallayout class="monospaced">
58549 Eximon*background: gray94
58550 </literallayout>
58551 <para>
58552 changes the colour of the background to light grey rather than white. The
58553 stripcharts are drawn with both the data lines and the reference lines in
58554 black. This means that the reference lines are not visible when on top of the
58555 data. However, their colour can be changed by setting a resource called
58556 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
58557 For example, if your X server is running Unix, you could set up lighter
58558 reference lines in the stripcharts by obeying
58559 </para>
58560 <literallayout class="monospaced">
58561 xrdb -merge &lt;&lt;End
58562 Eximon*highlight: gray
58563 End
58564 </literallayout>
58565 <para>
58566 <indexterm role="concept">
58567 <primary>admin user</primary>
58568 </indexterm>
58569 In order to see the contents of messages on the queue, and to operate on them,
58570 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
58571 </para>
58572 <para>
58573 The monitor&#x2019;s window is divided into three parts. The first contains one or
58574 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
58575 main log file, and the third is a display of the queue of messages awaiting
58576 delivery, with two more action buttons. The following sections describe these
58577 different parts of the display.
58578 </para>
58579 </section>
58580 <section>
58581 <title>The stripcharts</title>
58582 <para>
58583 <indexterm role="concept">
58584 <primary>stripchart</primary>
58585 </indexterm>
58586 The first stripchart is always a count of messages on the queue. Its name can
58587 be configured by setting QUEUE_STRIPCHART_NAME in the
58588 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
58589 configuration script by regular expression matches on log file entries, making
58590 it possible to display, for example, counts of messages delivered to certain
58591 hosts or using certain transports. The supplied defaults display counts of
58592 received and delivered messages, and of local and SMTP deliveries. The default
58593 period between stripchart updates is one minute; this can be adjusted by a
58594 parameter in the <filename>Local/eximon.conf</filename> file.
58595 </para>
58596 <para>
58597 The stripchart displays rescale themselves automatically as the value they are
58598 displaying changes. There are always 10 horizontal lines in each chart; the
58599 title string indicates the value of each division when it is greater than one.
58600 For example, <quote>x2</quote> means that each division represents a value of 2.
58601 </para>
58602 <para>
58603 It is also possible to have a stripchart which shows the percentage fullness of
58604 a particular disk partition, which is useful when local deliveries are confined
58605 to a single partition.
58606 </para>
58607 <para>
58608 <indexterm role="concept">
58609 <primary><option>statvfs</option> function</primary>
58610 </indexterm>
58611 This relies on the availability of the <function>statvfs()</function> function or equivalent in
58612 the operating system. Most, but not all versions of Unix that support Exim have
58613 this. For this particular stripchart, the top of the chart always represents
58614 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
58615 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
58616 <filename>Local/eximon.conf</filename> file.
58617 </para>
58618 </section>
58619 <section>
58620 <title>Main action buttons</title>
58621 <para>
58622 <indexterm role="concept">
58623 <primary>size</primary>
58624 <secondary>of monitor window</secondary>
58625 </indexterm>
58626 <indexterm role="concept">
58627 <primary>Exim monitor</primary>
58628 <secondary>window size</secondary>
58629 </indexterm>
58630 <indexterm role="concept">
58631 <primary>window size</primary>
58632 </indexterm>
58633 Below the stripcharts there is an action button for quitting the monitor. Next
58634 to this is another button marked <quote>Size</quote>. They are placed here so that
58635 shrinking the window to its default minimum size leaves just the queue count
58636 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
58637 the window to expand to its maximum size, unless it is already at the maximum,
58638 in which case it is reduced to its minimum.
58639 </para>
58640 <para>
58641 When expanding to the maximum, if the window cannot be fully seen where it
58642 currently is, it is moved back to where it was the last time it was at full
58643 size. When it is expanding from its minimum size, the old position is
58644 remembered, and next time it is reduced to the minimum it is moved back there.
58645 </para>
58646 <para>
58647 The idea is that you can keep a reduced window just showing one or two
58648 stripcharts at a convenient place on your screen, easily expand it to show
58649 the full window when required, and just as easily put it back to what it was.
58650 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
58651 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
58652 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
58653 </para>
58654 <para>
58655 Normally, the monitor starts up with the window at its full size, but it can be
58656 built so that it starts up with the window at its smallest size, by setting
58657 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
58658 </para>
58659 </section>
58660 <section>
58661 <title>The log display</title>
58662 <para>
58663 <indexterm role="concept">
58664 <primary>log</primary>
58665 <secondary>tail of; in monitor</secondary>
58666 </indexterm>
58667 The second section of the window is an area in which a display of the tail of
58668 the main log is maintained.
58669 To save space on the screen, the timestamp on each log line is shortened by
58670 removing the date and, if <option>log_timezone</option> is set, the timezone.
58671 The log tail is not available when the only destination for logging data is
58672 syslog, unless the syslog lines are routed to a local file whose name is passed
58673 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
58674 </para>
58675 <para>
58676 The log sub-window has a scroll bar at its lefthand side which can be used to
58677 move back to look at earlier text, and the up and down arrow keys also have a
58678 scrolling effect. The amount of log that is kept depends on the setting of
58679 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
58680 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
58681 much more efficient than throwing it away line by line. The sub-window also has
58682 a horizontal scroll bar for accessing the ends of long log lines. This is the
58683 only means of horizontal scrolling; the right and left arrow keys are not
58684 available. Text can be cut from this part of the window using the mouse in the
58685 normal way. The size of this subwindow is controlled by parameters in the
58686 configuration file <filename>Local/eximon.conf</filename>.
58687 </para>
58688 <para>
58689 Searches of the text in the log window can be carried out by means of the ^R
58690 and ^S keystrokes, which default to a reverse and a forward search,
58691 respectively. The search covers only the text that is displayed in the window.
58692 It cannot go further back up the log.
58693 </para>
58694 <para>
58695 The point from which the search starts is indicated by a caret marker. This is
58696 normally at the end of the text in the window, but can be positioned explicitly
58697 by pointing and clicking with the left mouse button, and is moved automatically
58698 by a successful search. If new text arrives in the window when it is scrolled
58699 back, the caret remains where it is, but if the window is not scrolled back,
58700 the caret is moved to the end of the new text.
58701 </para>
58702 <para>
58703 Pressing ^R or ^S pops up a window into which the search text can be typed.
58704 There are buttons for selecting forward or reverse searching, for carrying out
58705 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
58706 happens and the window remains so that further searches can be done. If the
58707 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
58708 ^C is typed the search is cancelled.
58709 </para>
58710 <para>
58711 The searching facility is implemented using the facilities of the Athena text
58712 widget. By default this pops up a window containing both <quote>search</quote> and
58713 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
58714 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
58715 However, the linkers in BSDI and HP-UX seem unable to handle an externally
58716 provided version of <option>TextPop</option> when the remaining parts of the text widget
58717 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
58718 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
58719 on these systems, at the expense of having unwanted items in the search popup
58720 window.
58721 </para>
58722 </section>
58723 <section>
58724 <title>The queue display</title>
58725 <para>
58726 <indexterm role="concept">
58727 <primary>queue</primary>
58728 <secondary>display in monitor</secondary>
58729 </indexterm>
58730 The bottom section of the monitor window contains a list of all messages that
58731 are on the queue, which includes those currently being received or delivered,
58732 as well as those awaiting delivery. The size of this subwindow is controlled by
58733 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
58734 at which it is updated is controlled by another parameter in the same file &ndash;
58735 the default is 5 minutes, since queue scans can be quite expensive. However,
58736 there is an <quote>Update</quote> action button just above the display which can be used
58737 to force an update of the queue display at any time.
58738 </para>
58739 <para>
58740 When a host is down for some time, a lot of pending mail can build up for it,
58741 and this can make it hard to deal with other messages on the queue. To help
58742 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
58743 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
58744 type anything in here and press <quote>Return</quote>, the text is added to a chain of
58745 such texts, and if every undelivered address in a message matches at least one
58746 of the texts, the message is not displayed.
58747 </para>
58748 <para>
58749 If there is an address that does not match any of the texts, all the addresses
58750 are displayed as normal. The matching happens on the ends of addresses so, for
58751 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
58752 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
58753 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
58754 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
58755 a hide request is automatically cancelled after one hour.
58756 </para>
58757 <para>
58758 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
58759 else to the monitor window. For this reason, if you want to cut text from the
58760 queue display to use in the dialogue box, you have to do the cutting before
58761 pressing the <quote>Hide</quote> button.
58762 </para>
58763 <para>
58764 The queue display contains, for each unhidden queued message, the length of
58765 time it has been on the queue, the size of the message, the message id, the
58766 message sender, and the first undelivered recipient, all on one line. If it is
58767 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
58768 recipient to which the message has not yet been delivered, subsequent ones are
58769 listed on additional lines, up to a maximum configured number, following which
58770 an ellipsis is displayed. Recipients that have already received the message are
58771 not shown.
58772 </para>
58773 <para>
58774 <indexterm role="concept">
58775 <primary>frozen messages</primary>
58776 <secondary>display</secondary>
58777 </indexterm>
58778 If a message is frozen, an asterisk is displayed at the left-hand side.
58779 </para>
58780 <para>
58781 The queue display has a vertical scroll bar, and can also be scrolled by means
58782 of the arrow keys. Text can be cut from it using the mouse in the normal way.
58783 The text searching facilities, as described above for the log window, are also
58784 available, but the caret is always moved to the end of the text when the queue
58785 display is updated.
58786 </para>
58787 </section>
58788 <section>
58789 <title>The queue menu</title>
58790 <para>
58791 <indexterm role="concept">
58792 <primary>queue</primary>
58793 <secondary>menu in monitor</secondary>
58794 </indexterm>
58795 If the <option>shift</option> key is held down and the left button is clicked when the mouse
58796 pointer is over the text for any message, an action menu pops up, and the first
58797 line of the queue display for the message is highlighted. This does not affect
58798 any selected text.
58799 </para>
58800 <para>
58801 If you want to use some other event for popping up the menu, you can set the
58802 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
58803 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
58804 value set in this parameter is a standard X event description. For example, to
58805 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
58806 </para>
58807 <literallayout class="monospaced">
58808 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
58809 </literallayout>
58810 <para>
58811 The title of the menu is the message id, and it contains entries which act as
58812 follows:
58813 </para>
58814 <itemizedlist>
58815 <listitem>
58816 <para>
58817 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
58818 in a new text window.
58819 </para>
58820 </listitem>
58821 <listitem>
58822 <para>
58823 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
58824 information and headers is displayed in a new text window. See chapter
58825 <xref linkend="CHAPspool"/> for a description of the format of spool files.
58826 </para>
58827 </listitem>
58828 <listitem>
58829 <para>
58830 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
58831 displayed in a new text window. There is a default limit of 20,000 bytes to the
58832 amount of data displayed. This can be changed by setting the BODY_MAX
58833 option at compile time, or the EXIMON_BODY_MAX option at run time.
58834 </para>
58835 </listitem>
58836 <listitem>
58837 <para>
58838 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
58839 delivery of the message. This causes an automatic thaw if the message is
58840 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
58841 a new text window. The delivery is run in a separate process, to avoid holding
58842 up the monitor while the delivery proceeds.
58843 </para>
58844 </listitem>
58845 <listitem>
58846 <para>
58847 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
58848 that the message be frozen.
58849 </para>
58850 </listitem>
58851 <listitem>
58852 <para>
58853 <indexterm role="concept">
58854 <primary>thawing messages</primary>
58855 </indexterm>
58856 <indexterm role="concept">
58857 <primary>unfreezing messages</primary>
58858 </indexterm>
58859 <indexterm role="concept">
58860 <primary>frozen messages</primary>
58861 <secondary>thawing</secondary>
58862 </indexterm>
58863 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
58864 that the message be thawed.
58865 </para>
58866 </listitem>
58867 <listitem>
58868 <para>
58869 <indexterm role="concept">
58870 <primary>delivery</primary>
58871 <secondary>forcing failure</secondary>
58872 </indexterm>
58873 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
58874 that Exim gives up trying to deliver the message. A bounce message is generated
58875 for any remaining undelivered addresses.
58876 </para>
58877 </listitem>
58878 <listitem>
58879 <para>
58880 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
58881 that the message be deleted from the system without generating a bounce
58882 message.
58883 </para>
58884 </listitem>
58885 <listitem>
58886 <para>
58887 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
58888 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58889 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58890 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58891 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
58892 additional recipient be added to the message, unless the entry box is empty, in
58893 which case no action is taken.
58894 </para>
58895 </listitem>
58896 <listitem>
58897 <para>
58898 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
58899 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58900 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58901 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58902 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
58903 recipient address as already delivered, unless the entry box is empty, in which
58904 case no action is taken.
58905 </para>
58906 </listitem>
58907 <listitem>
58908 <para>
58909 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
58910 mark all recipient addresses as already delivered.
58911 </para>
58912 </listitem>
58913 <listitem>
58914 <para>
58915 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
58916 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
58917 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
58918 in which case no action is taken. If you want to set an empty sender (as in
58919 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
58920 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
58921 the address is qualified with that domain.
58922 </para>
58923 </listitem>
58924 </itemizedlist>
58925 <para>
58926 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
58927 other cases when a call to Exim is made, if there is any output from Exim (in
58928 particular, if the command fails) a window containing the command and the
58929 output is displayed. Otherwise, the results of the action are normally apparent
58930 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
58931 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
58932 if no output is generated.
58933 </para>
58934 <para>
58935 The queue display is automatically updated for actions such as freezing and
58936 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
58937 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
58938 force an update of the display after one of these actions.
58939 </para>
58940 <para>
58941 In any text window that is displayed as result of a menu action, the normal
58942 cut-and-paste facility is available, and searching can be carried out using ^R
58943 and ^S, as described above for the log tail window.
58944 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
58945 </para>
58946 </section>
58947 </chapter>
58948
58949 <chapter id="CHAPsecurity">
58950 <title>Security considerations</title>
58951 <para>
58952 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
58953 <primary>security</primary>
58954 <secondary>discussion of</secondary>
58955 </indexterm>
58956 This chapter discusses a number of issues concerned with security, some of
58957 which are also covered in other parts of this manual.
58958 </para>
58959 <para>
58960 For reasons that this author does not understand, some people have promoted
58961 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
58962 existence of this chapter in the documentation. However, the intent of the
58963 chapter is simply to describe the way Exim works in relation to certain
58964 security concerns, not to make any specific claims about the effectiveness of
58965 its security as compared with other MTAs.
58966 </para>
58967 <para>
58968 What follows is a description of the way Exim is supposed to be. Best efforts
58969 have been made to try to ensure that the code agrees with the theory, but an
58970 absence of bugs can never be guaranteed. Any that are reported will get fixed
58971 as soon as possible.
58972 </para>
58973 <section>
58974 <title>Building a more <quote>hardened</quote> Exim</title>
58975 <para>
58976 <indexterm role="concept">
58977 <primary>security</primary>
58978 <secondary>build-time features</secondary>
58979 </indexterm>
58980 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
58981 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
58982 Exim administrator who does not have the root password, or by someone who has
58983 penetrated the Exim (but not the root) account. These options are as follows:
58984 </para>
58985 <itemizedlist>
58986 <listitem>
58987 <para>
58988 ALT_CONFIG_PREFIX can be set to a string that is required to match the
58989 start of any file names used with the <option>-C</option> option. When it is set, these file
58990 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
58991 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
58992 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
58993 default setting for <option>ALT_CONFIG_PREFIX</option>.
58994 </para>
58995 <para>
58996 If the permitted configuration files are confined to a directory to
58997 which only root has access, this guards against someone who has broken
58998 into the Exim account from running a privileged Exim with an arbitrary
58999 configuration file, and using it to break into other accounts.
59000 </para>
59001 </listitem>
59002 <listitem>
59003 <para>
59004 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
59005 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
59006 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
59007 the possibility of testing a configuration using <option>-C</option> right through message
59008 reception and delivery, even if the caller is root. The reception works, but by
59009 that time, Exim is running as the Exim user, so when it re-execs to regain
59010 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
59011 However, root can test reception and delivery using two separate commands.
59012 ALT_CONFIG_ROOT_ONLY is not set by default.
59013 </para>
59014 </listitem>
59015 <listitem>
59016 <para>
59017 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
59018 is disabled.
59019 </para>
59020 </listitem>
59021 <listitem>
59022 <para>
59023 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
59024 never to be used for any deliveries. This is like the <option>never_users</option> runtime
59025 option, but it cannot be overridden; the runtime option adds additional users
59026 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
59027 is permitted to modify the runtime file from using Exim as a way to get root.
59028 </para>
59029 </listitem>
59030 </itemizedlist>
59031 </section>
59032 <section>
59033 <title>Root privilege</title>
59034 <para>
59035 <indexterm role="concept">
59036 <primary>setuid</primary>
59037 </indexterm>
59038 <indexterm role="concept">
59039 <primary>root privilege</primary>
59040 </indexterm>
59041 The Exim binary is normally setuid to root, which means that it gains root
59042 privilege (runs as root) when it starts execution. In some special cases (for
59043 example, when the daemon is not in use and there are no local deliveries), it
59044 may be possible to run Exim setuid to some user other than root. This is
59045 discussed in the next section. However, in most installations, root privilege
59046 is required for two things:
59047 </para>
59048 <itemizedlist>
59049 <listitem>
59050 <para>
59051 To set up a socket connected to the standard SMTP port (25) when initialising
59052 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
59053 not required.
59054 </para>
59055 </listitem>
59056 <listitem>
59057 <para>
59058 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
59059 perform local deliveries as the receiving user or as specified in the
59060 configuration.
59061 </para>
59062 </listitem>
59063 </itemizedlist>
59064 <para>
59065 It is not necessary to be root to do any of the other things Exim does, such as
59066 receiving messages and delivering them externally over SMTP, and it is
59067 obviously more secure if Exim does not run as root except when necessary.
59068 For this reason, a user and group for Exim to use must be defined in
59069 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
59070 group</quote>. Their values can be changed by the run time configuration, though this
59071 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
59072 <emphasis>mail</emphasis> or another user name altogether.
59073 </para>
59074 <para>
59075 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
59076 abdication; the process cannot regain root afterwards. Prior to release 4.00,
59077 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
59078 </para>
59079 <para>
59080 After a new Exim process has interpreted its command line options, it changes
59081 uid and gid in the following cases:
59082 </para>
59083 <itemizedlist>
59084 <listitem>
59085 <para>
59086 <indexterm role="concept">
59087 <primary><option>-C</option> option</primary>
59088 </indexterm>
59089 <indexterm role="concept">
59090 <primary><option>-D</option> option</primary>
59091 </indexterm>
59092 If the <option>-C</option> option is used to specify an alternate configuration file, or if
59093 the <option>-D</option> option is used to define macro values for the configuration, and the
59094 calling process is not running as root or the Exim user, the uid and gid are
59095 changed to those of the calling process.
59096 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
59097 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
59098 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
59099 </para>
59100 </listitem>
59101 <listitem>
59102 <para>
59103 <indexterm role="concept">
59104 <primary><option>-be</option> option</primary>
59105 </indexterm>
59106 <indexterm role="concept">
59107 <primary><option>-bf</option> option</primary>
59108 </indexterm>
59109 <indexterm role="concept">
59110 <primary><option>-bF</option> option</primary>
59111 </indexterm>
59112 If the expansion test option (<option>-be</option>) or one of the filter testing options
59113 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
59114 calling process.
59115 </para>
59116 </listitem>
59117 <listitem>
59118 <para>
59119 If the process is not a daemon process or a queue runner process or a delivery
59120 process or a process for testing address routing (started with <option>-bt</option>), the
59121 uid and gid are changed to the Exim user and group. This means that Exim always
59122 runs under its own uid and gid when receiving messages. This also applies when
59123 testing address verification
59124 <indexterm role="concept">
59125 <primary><option>-bv</option> option</primary>
59126 </indexterm>
59127 <indexterm role="concept">
59128 <primary><option>-bh</option> option</primary>
59129 </indexterm>
59130 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
59131 option).
59132 </para>
59133 </listitem>
59134 <listitem>
59135 <para>
59136 For a daemon, queue runner, delivery, or address testing process, the uid
59137 remains as root at this stage, but the gid is changed to the Exim group.
59138 </para>
59139 </listitem>
59140 </itemizedlist>
59141 <para>
59142 The processes that initially retain root privilege behave as follows:
59143 </para>
59144 <itemizedlist>
59145 <listitem>
59146 <para>
59147 A daemon process changes the gid to the Exim group and the uid to the Exim
59148 user after setting up one or more listening sockets. The <function>initgroups()</function>
59149 function is called, so that if the Exim user is in any additional groups, they
59150 will be used during message reception.
59151 </para>
59152 </listitem>
59153 <listitem>
59154 <para>
59155 A queue runner process retains root privilege throughout its execution. Its
59156 job is to fork a controlled sequence of delivery processes.
59157 </para>
59158 </listitem>
59159 <listitem>
59160 <para>
59161 A delivery process retains root privilege throughout most of its execution,
59162 but any actual deliveries (that is, the transports themselves) are run in
59163 subprocesses which always change to a non-root uid and gid. For local
59164 deliveries this is typically the uid and gid of the owner of the mailbox; for
59165 remote deliveries, the Exim uid and gid are used. Once all the delivery
59166 subprocesses have been run, a delivery process changes to the Exim uid and gid
59167 while doing post-delivery tidying up such as updating the retry database and
59168 generating bounce and warning messages.
59169 </para>
59170 <para>
59171 While the recipient addresses in a message are being routed, the delivery
59172 process runs as root. However, if a user&#x2019;s filter file has to be processed,
59173 this is done in a subprocess that runs under the individual user&#x2019;s uid and
59174 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
59175 </para>
59176 </listitem>
59177 <listitem>
59178 <para>
59179 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
59180 the routing is done in the same environment as a message delivery.
59181 </para>
59182 </listitem>
59183 </itemizedlist>
59184 </section>
59185 <section id="SECTrunexiwitpri">
59186 <title>Running Exim without privilege</title>
59187 <para>
59188 <indexterm role="concept">
59189 <primary>privilege</primary>
59190 <secondary>running without</secondary>
59191 </indexterm>
59192 <indexterm role="concept">
59193 <primary>unprivileged running</primary>
59194 </indexterm>
59195 <indexterm role="concept">
59196 <primary>root privilege</primary>
59197 <secondary>running without</secondary>
59198 </indexterm>
59199 Some installations like to run Exim in an unprivileged state for more of its
59200 operation, for added security. Support for this mode of operation is provided
59201 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
59202 gid are changed to the Exim user and group at the start of a delivery process
59203 (and also queue runner and address testing processes). This means that address
59204 routing is no longer run as root, and the deliveries themselves cannot change
59205 to any other uid.
59206 </para>
59207 <para>
59208 <indexterm role="concept">
59209 <primary>SIGHUP</primary>
59210 </indexterm>
59211 <indexterm role="concept">
59212 <primary>daemon</primary>
59213 <secondary>restarting</secondary>
59214 </indexterm>
59215 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
59216 that the daemon can still be started in the usual way, and it can respond
59217 correctly to SIGHUP because the re-invocation regains root privilege.
59218 </para>
59219 <para>
59220 An alternative approach is to make Exim setuid to the Exim user and also setgid
59221 to the Exim group. If you do this, the daemon must be started from a root
59222 process. (Calling Exim from a root process makes it behave in the way it does
59223 when it is setuid root.) However, the daemon cannot restart itself after a
59224 SIGHUP signal because it cannot regain privilege.
59225 </para>
59226 <para>
59227 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
59228 stops Exim from trying to re-invoke itself to do a delivery after a message has
59229 been received. Such a re-invocation is a waste of resources because it has no
59230 effect.
59231 </para>
59232 <para>
59233 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
59234 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
59235 to the Exim user seems a clean approach, but there is one complication:
59236 </para>
59237 <para>
59238 In this style of operation, Exim is running with the real uid and gid set to
59239 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
59240 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
59241 that is, the real uid/gid should be reset to the effective values so as to
59242 discard any privileges that the caller may have. While some operating systems
59243 have a function that permits this action for a non-root effective uid, quite a
59244 number of them do not. Because of this lack of standardization, Exim does not
59245 address this problem at this time.
59246 </para>
59247 <para>
59248 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
59249 is to keep the Exim binary setuid to root, and to set
59250 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
59251 be used in the most straightforward way.
59252 </para>
59253 <para>
59254 If you configure Exim not to run delivery processes as root, there are a
59255 number of restrictions on what you can do:
59256 </para>
59257 <itemizedlist>
59258 <listitem>
59259 <para>
59260 You can deliver only as the Exim user/group. You should  explicitly use the
59261 <option>user</option> and <option>group</option> options to override routers or local transports that
59262 normally deliver as the recipient. This makes sure that configurations that
59263 work in this mode function the same way in normal mode. Any implicit or
59264 explicit specification of another user causes an error.
59265 </para>
59266 </listitem>
59267 <listitem>
59268 <para>
59269 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
59270 not worthwhile to include them in the configuration.
59271 </para>
59272 </listitem>
59273 <listitem>
59274 <para>
59275 Users who wish to use <filename>.forward</filename> would have to make their home directory and
59276 the file itself accessible to the Exim user. Pipe and append-to-file entries,
59277 and their equivalents in Exim filters, cannot be used. While they could be
59278 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
59279 </para>
59280 </listitem>
59281 <listitem>
59282 <para>
59283 Unless the local user mailboxes are all owned by the Exim user (possible in
59284 some POP3 or IMAP-only environments):
59285 </para>
59286 <orderedlist numeration="arabic">
59287 <listitem>
59288 <para>
59289 They must be owned by the Exim group and be writable by that group. This
59290 implies you must set <option>mode</option> in the appendfile configuration, as well as the
59291 mode of the mailbox files themselves.
59292 </para>
59293 </listitem>
59294 <listitem>
59295 <para>
59296 You must set <option>no_check_owner</option>, since most or all of the files will not be
59297 owned by the Exim user.
59298 </para>
59299 </listitem>
59300 <listitem>
59301 <para>
59302 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
59303 on a newly created mailbox when unprivileged. This also implies that new
59304 mailboxes need to be created manually.
59305 </para>
59306 </listitem>
59307 </orderedlist>
59308 </listitem>
59309 </itemizedlist>
59310 <para>
59311 These restrictions severely restrict what can be done in local deliveries.
59312 However, there are no restrictions on remote deliveries. If you are running a
59313 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
59314 gives more security at essentially no cost.
59315 </para>
59316 <para>
59317 If you are using the <option>mua_wrapper</option> facility (see chapter
59318 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
59319 </para>
59320 </section>
59321 <section>
59322 <title>Delivering to local files</title>
59323 <para>
59324 Full details of the checks applied by <command>appendfile</command> before it writes to a file
59325 are given in chapter <xref linkend="CHAPappendfile"/>.
59326 </para>
59327 </section>
59328 <section>
59329 <title>IPv4 source routing</title>
59330 <para>
59331 <indexterm role="concept">
59332 <primary>source routing</primary>
59333 <secondary>in IP packets</secondary>
59334 </indexterm>
59335 <indexterm role="concept">
59336 <primary>IP source routing</primary>
59337 </indexterm>
59338 Many operating systems suppress IP source-routed packets in the kernel, but
59339 some cannot be made to do this, so Exim does its own check. It logs incoming
59340 IPv4 source-routed TCP calls, and then drops them. Things are all different in
59341 IPv6. No special checking is currently done.
59342 </para>
59343 </section>
59344 <section>
59345 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
59346 <para>
59347 Support for these SMTP commands is disabled by default. If required, they can
59348 be enabled by defining suitable ACLs.
59349 </para>
59350 </section>
59351 <section>
59352 <title>Privileged users</title>
59353 <para>
59354 <indexterm role="concept">
59355 <primary>trusted user</primary>
59356 </indexterm>
59357 <indexterm role="concept">
59358 <primary>admin user</primary>
59359 </indexterm>
59360 <indexterm role="concept">
59361 <primary>privileged user</primary>
59362 </indexterm>
59363 <indexterm role="concept">
59364 <primary>user</primary>
59365 <secondary>trusted</secondary>
59366 </indexterm>
59367 <indexterm role="concept">
59368 <primary>user</primary>
59369 <secondary>admin</secondary>
59370 </indexterm>
59371 Exim recognises two sets of users with special privileges. Trusted users are
59372 able to submit new messages to Exim locally, but supply their own sender
59373 addresses and information about a sending host. For other users submitting
59374 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
59375 permit a remote host to be specified.
59376 </para>
59377 <para>
59378 <indexterm role="concept">
59379 <primary><option>-f</option> option</primary>
59380 </indexterm>
59381 However, an untrusted user is permitted to use the <option>-f</option> command line option
59382 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
59383 message should not cause an error report. This affects the message&#x2019;s envelope,
59384 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
59385 permitted to use specific forms of address with the <option>-f</option> option by setting
59386 the <option>untrusted_set_sender</option> option.
59387 </para>
59388 <para>
59389 Trusted users are used to run processes that receive mail messages from some
59390 other mail domain and pass them on to Exim for delivery either locally, or over
59391 the Internet. Exim trusts a caller that is running as root, as the Exim user,
59392 as any user listed in the <option>trusted_users</option> configuration option, or under any
59393 group listed in the <option>trusted_groups</option> option.
59394 </para>
59395 <para>
59396 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
59397 can freeze or thaw messages, cause them to be returned to their senders, remove
59398 them entirely, or modify them in various ways. In addition, admin users can run
59399 the Exim monitor and see all the information it is capable of providing, which
59400 includes the contents of files on the spool.
59401 </para>
59402 <para>
59403 <indexterm role="concept">
59404 <primary><option>-M</option> option</primary>
59405 </indexterm>
59406 <indexterm role="concept">
59407 <primary><option>-q</option> option</primary>
59408 </indexterm>
59409 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
59410 delivery of messages on its queue is restricted to admin users. This
59411 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
59412 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
59413 queue is also restricted to admin users. This restriction can be relaxed by
59414 setting <option>no_queue_list_requires_admin</option>.
59415 </para>
59416 <para>
59417 Exim recognises an admin user if the calling process is running as root or as
59418 the Exim user or if any of the groups associated with the calling process is
59419 the Exim group. It is not necessary actually to be running under the Exim
59420 group. However, if admin users who are not root or the Exim user are to access
59421 the contents of files on the spool via the Exim monitor (which runs
59422 unprivileged), Exim must be built to allow group read access to its spool
59423 files.
59424 </para>
59425 </section>
59426 <section>
59427 <title>Spool files</title>
59428 <para>
59429 <indexterm role="concept">
59430 <primary>spool directory</primary>
59431 <secondary>files</secondary>
59432 </indexterm>
59433 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
59434 set to the Exim group. The mode for spool files is defined in the
59435 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
59436 any user who is a member of the Exim group can access these files.
59437 </para>
59438 </section>
59439 <section>
59440 <title>Use of argv[0]</title>
59441 <para>
59442 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
59443 of specific strings, Exim assumes certain options. For example, calling Exim
59444 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
59445 to calling it with the option <option>-bS</option>. There are no security implications in
59446 this.
59447 </para>
59448 </section>
59449 <section>
59450 <title>Use of %f formatting</title>
59451 <para>
59452 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
59453 are actually stored in integer variables as 1000 times the load average.
59454 Consequently, their range is limited and so therefore is the length of the
59455 converted output.
59456 </para>
59457 </section>
59458 <section>
59459 <title>Embedded Exim path</title>
59460 <para>
59461 Exim uses its own path name, which is embedded in the code, only when it needs
59462 to re-exec in order to regain root privilege. Therefore, it is not root when it
59463 does so. If some bug allowed the path to get overwritten, it would lead to an
59464 arbitrary program&#x2019;s being run as exim, not as root.
59465 </para>
59466 </section>
59467 <section>
59468 <title>Use of sprintf()</title>
59469 <para>
59470 <indexterm role="concept">
59471 <primary><function>sprintf()</function></primary>
59472 </indexterm>
59473 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
59474 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
59475 The intermediate formatting is done into a large fixed buffer by a function
59476 that runs through the format string itself, and checks the length of each
59477 conversion before performing it, thus preventing buffer overruns.
59478 </para>
59479 <para>
59480 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
59481 the output buffer is known to be sufficiently long to contain the converted
59482 string.
59483 </para>
59484 </section>
59485 <section>
59486 <title>Use of debug_printf() and log_write()</title>
59487 <para>
59488 Arbitrary strings are passed to both these functions, but they do their
59489 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
59490 the format string itself, and checks the length of each conversion.
59491 </para>
59492 </section>
59493 <section>
59494 <title>Use of strcat() and strcpy()</title>
59495 <para>
59496 These are used only in cases where the output buffer is known to be large
59497 enough to hold the result.
59498 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
59499 </para>
59500 </section>
59501 </chapter>
59502
59503 <chapter id="CHAPspool">
59504 <title>Format of spool files</title>
59505 <para>
59506 <indexterm role="concept" id="IIDforspo1" class="startofrange">
59507 <primary>format</primary>
59508 <secondary>spool files</secondary>
59509 </indexterm>
59510 <indexterm role="concept" id="IIDforspo2" class="startofrange">
59511 <primary>spool directory</primary>
59512 <secondary>format of files</secondary>
59513 </indexterm>
59514 <indexterm role="concept" id="IIDforspo3" class="startofrange">
59515 <primary>spool files</primary>
59516 <secondary>format of</secondary>
59517 </indexterm>
59518 <indexterm role="concept">
59519 <primary>spool files</primary>
59520 <secondary>editing</secondary>
59521 </indexterm>
59522 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
59523 followed by -D and -H, respectively. The data portion of the message is kept in
59524 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
59525 kept in the -H file, whose format is described in this chapter. Each of these
59526 two files contains the final component of its own name as its first line. This
59527 is insurance against disk crashes where the directory is lost but the files
59528 themselves are recoverable.
59529 </para>
59530 <para>
59531 Some people are tempted into editing -D files in order to modify messages. You
59532 need to be extremely careful if you do this; it is not recommended and you are
59533 on your own if you do it. Here are some of the pitfalls:
59534 </para>
59535 <itemizedlist>
59536 <listitem>
59537 <para>
59538 You must ensure that Exim does not try to deliver the message while you are
59539 fiddling with it. The safest way is to take out a write lock on the -D file,
59540 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
59541 place, the lock will be retained. If you write a new file and rename it, the
59542 lock will be lost at the instant of rename.
59543 </para>
59544 </listitem>
59545 <listitem>
59546 <para>
59547 <indexterm role="concept">
59548 <primary><varname>$body_linecount</varname></primary>
59549 </indexterm>
59550 If you change the number of lines in the file, the value of
59551 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
59552 present, this value is not used by Exim, but there is no guarantee that this
59553 will always be the case.
59554 </para>
59555 </listitem>
59556 <listitem>
59557 <para>
59558 If the message is in MIME format, you must take care not to break it.
59559 </para>
59560 </listitem>
59561 <listitem>
59562 <para>
59563 If the message is cryptographically signed, any change will invalidate the
59564 signature.
59565 </para>
59566 </listitem>
59567 </itemizedlist>
59568 <para>
59569 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
59570 its subdirectories when <option>split_spool_directory</option> is set). These are journal
59571 files, used to record addresses to which the message has been delivered during
59572 the course of a delivery run. At the end of the run, the -H file is updated,
59573 and the -J file is deleted.
59574 </para>
59575 <section>
59576 <title>Format of the -H file</title>
59577 <para>
59578 <indexterm role="concept">
59579 <primary>uid (user id)</primary>
59580 <secondary>in spool file</secondary>
59581 </indexterm>
59582 <indexterm role="concept">
59583 <primary>gid (group id)</primary>
59584 <secondary>in spool file</secondary>
59585 </indexterm>
59586 The second line of the -H file contains the login name for the uid of the
59587 process that called Exim to read the message, followed by the numerical uid and
59588 gid. For a locally generated message, this is normally the user who sent the
59589 message. For a message received over TCP/IP, it is normally the Exim user.
59590 </para>
59591 <para>
59592 The third line of the file contains the address of the message&#x2019;s sender as
59593 transmitted in the envelope, contained in angle brackets. The sender address is
59594 empty for bounce messages. For incoming SMTP mail, the sender address is given
59595 in the MAIL command. For locally generated mail, the sender address is
59596 created by Exim from the login name of the current user and the configured
59597 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
59598 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
59599 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
59600 </para>
59601 <para>
59602 The fourth line contains two numbers. The first is the time that the message
59603 was received, in the conventional Unix form &ndash; the number of seconds since the
59604 start of the epoch. The second number is a count of the number of messages
59605 warning of delayed delivery that have been sent to the sender.
59606 </para>
59607 <para>
59608 There follow a number of lines starting with a hyphen. These can appear in any
59609 order, and are omitted when not relevant:
59610 </para>
59611 <variablelist>
59612 <varlistentry>
59613 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
59614 <listitem>
59615 <para>
59616 This item is obsolete, and is not generated from Exim release 4.61 onwards;
59617 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
59618 recognized, to provide backward compatibility. In the old format, a line of
59619 this form is present for every ACL variable that is not empty. The number
59620 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
59621 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
59622 the data string for the variable. The string itself starts at the beginning of
59623 the next line, and is followed by a newline character. It may contain internal
59624 newlines.
59625 </para>
59626 </listitem></varlistentry>
59627 <varlistentry revisionflag="changed">
59628 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
59629 <listitem>
59630 <para revisionflag="changed">
59631 A line of this form is present for every ACL connection variable that is
59632 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
59633 The length is the length of the data string for the variable. The string itself
59634 starts at the beginning of the next line, and is followed by a newline
59635 character. It may contain internal newlines.
59636 </para>
59637 </listitem></varlistentry>
59638 <varlistentry revisionflag="changed">
59639 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
59640 <listitem>
59641 <para revisionflag="changed">
59642 A line of this form is present for every ACL message variable that is defined.
59643 Note that there is a space between <option>-aclm</option> and the rest of the name. The
59644 length is the length of the data string for the variable. The string itself
59645 starts at the beginning of the next line, and is followed by a newline
59646 character. It may contain internal newlines.
59647 </para>
59648 </listitem></varlistentry>
59649 <varlistentry>
59650 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
59651 <listitem>
59652 <para>
59653 This is present if, when the message was received over SMTP, the value of
59654 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
59655 </para>
59656 </listitem></varlistentry>
59657 <varlistentry>
59658 <term><option>-allow_unqualified_recipient</option></term>
59659 <listitem>
59660 <para>
59661 This is present if unqualified recipient addresses are permitted in header
59662 lines (to stop such addresses from being qualified if rewriting occurs at
59663 transport time). Local messages that were input using <option>-bnq</option> and remote
59664 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
59665 </para>
59666 </listitem></varlistentry>
59667 <varlistentry>
59668 <term><option>-allow_unqualified_sender</option></term>
59669 <listitem>
59670 <para>
59671 This is present if unqualified sender addresses are permitted in header lines
59672 (to stop such addresses from being qualified if rewriting occurs at transport
59673 time). Local messages that were input using <option>-bnq</option> and remote messages from
59674 hosts that match <option>sender_unqualified_hosts</option> set this flag.
59675 </para>
59676 </listitem></varlistentry>
59677 <varlistentry>
59678 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
59679 <listitem>
59680 <para>
59681 The id information for a message received on an authenticated SMTP connection
59682 &ndash; the value of the <varname>$authenticated_id</varname> variable.
59683 </para>
59684 </listitem></varlistentry>
59685 <varlistentry>
59686 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
59687 <listitem>
59688 <para>
59689 The address of an authenticated sender &ndash; the value of the
59690 <varname>$authenticated_sender</varname> variable.
59691 </para>
59692 </listitem></varlistentry>
59693 <varlistentry>
59694 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
59695 <listitem>
59696 <para>
59697 This records the number of lines in the body of the message, and is always
59698 present.
59699 </para>
59700 </listitem></varlistentry>
59701 <varlistentry>
59702 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
59703 <listitem>
59704 <para>
59705 This records the number of binary zero bytes in the body of the message, and is
59706 present if the number is greater than zero.
59707 </para>
59708 </listitem></varlistentry>
59709 <varlistentry>
59710 <term><option>-deliver_firsttime</option></term>
59711 <listitem>
59712 <para>
59713 This is written when a new message is first added to the spool. When the spool
59714 file is updated after a deferral, it is omitted.
59715 </para>
59716 </listitem></varlistentry>
59717 <varlistentry>
59718 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
59719 <listitem>
59720 <para>
59721 <indexterm role="concept">
59722 <primary>frozen messages</primary>
59723 <secondary>spool data</secondary>
59724 </indexterm>
59725 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
59726 </para>
59727 </listitem></varlistentry>
59728 <varlistentry>
59729 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
59730 <listitem>
59731 <para>
59732 This records the host name as specified by a remote host in a HELO or EHLO
59733 command.
59734 </para>
59735 </listitem></varlistentry>
59736 <varlistentry>
59737 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
59738 <listitem>
59739 <para>
59740 This records the IP address of the host from which the message was received and
59741 the remote port number that was used. It is omitted for locally generated
59742 messages.
59743 </para>
59744 </listitem></varlistentry>
59745 <varlistentry>
59746 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
59747 <listitem>
59748 <para>
59749 If the message was received on an authenticated SMTP connection, this records
59750 the name of the authenticator &ndash; the value of the
59751 <varname>$sender_host_authenticated</varname> variable.
59752 </para>
59753 </listitem></varlistentry>
59754 <varlistentry>
59755 <term><option>-host_lookup_failed</option></term>
59756 <listitem>
59757 <para>
59758 This is present if an attempt to look up the sending host&#x2019;s name from its IP
59759 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
59760 </para>
59761 </listitem></varlistentry>
59762 <varlistentry>
59763 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
59764 <listitem>
59765 <para>
59766 <indexterm role="concept">
59767 <primary>reverse DNS lookup</primary>
59768 </indexterm>
59769 <indexterm role="concept">
59770 <primary>DNS</primary>
59771 <secondary>reverse lookup</secondary>
59772 </indexterm>
59773 This records the name of the remote host from which the message was received,
59774 if the host name was looked up from the IP address when the message was being
59775 received. It is not present if no reverse lookup was done.
59776 </para>
59777 </listitem></varlistentry>
59778 <varlistentry>
59779 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
59780 <listitem>
59781 <para>
59782 For locally submitted messages, this records the login of the originating user,
59783 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
59784 ident value. For messages received over TCP/IP, this records the ident string
59785 supplied by the remote host, if any.
59786 </para>
59787 </listitem></varlistentry>
59788 <varlistentry>
59789 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
59790 <listitem>
59791 <para>
59792 This records the IP address of the local interface and the port number through
59793 which a message was received from a remote host. It is omitted for locally
59794 generated messages.
59795 </para>
59796 </listitem></varlistentry>
59797 <varlistentry>
59798 <term><option>-local</option></term>
59799 <listitem>
59800 <para>
59801 The message is from a local sender.
59802 </para>
59803 </listitem></varlistentry>
59804 <varlistentry>
59805 <term><option>-localerror</option></term>
59806 <listitem>
59807 <para>
59808 The message is a locally-generated bounce message.
59809 </para>
59810 </listitem></varlistentry>
59811 <varlistentry>
59812 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
59813 <listitem>
59814 <para>
59815 This records the data string that was returned by the <function>local_scan()</function> function
59816 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
59817 variable. It is omitted if no data was returned.
59818 </para>
59819 </listitem></varlistentry>
59820 <varlistentry>
59821 <term><option>-manual_thaw</option></term>
59822 <listitem>
59823 <para>
59824 The message was frozen but has been thawed manually, that is, by an explicit
59825 Exim command rather than via the auto-thaw process.
59826 </para>
59827 </listitem></varlistentry>
59828 <varlistentry>
59829 <term><option>-N</option></term>
59830 <listitem>
59831 <para>
59832 A testing delivery process was started using the <option>-N</option> option to suppress any
59833 actual deliveries, but delivery was deferred. At any further delivery attempts,
59834 <option>-N</option> is assumed.
59835 </para>
59836 </listitem></varlistentry>
59837 <varlistentry>
59838 <term><option>-received_protocol</option></term>
59839 <listitem>
59840 <para>
59841 This records the value of the <varname>$received_protocol</varname> variable, which contains
59842 the name of the protocol by which the message was received.
59843 </para>
59844 </listitem></varlistentry>
59845 <varlistentry>
59846 <term><option>-sender_set_untrusted</option></term>
59847 <listitem>
59848 <para>
59849 The envelope sender of this message was set by an untrusted local caller (used
59850 to ensure that the caller is displayed in queue listings).
59851 </para>
59852 </listitem></varlistentry>
59853 <varlistentry>
59854 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
59855 <listitem>
59856 <para>
59857 If a message was scanned by SpamAssassin, this is present. It records the value
59858 of <varname>$spam_score_int</varname>.
59859 </para>
59860 </listitem></varlistentry>
59861 <varlistentry>
59862 <term><option>-tls_certificate_verified</option></term>
59863 <listitem>
59864 <para>
59865 A TLS certificate was received from the client that sent this message, and the
59866 certificate was verified by the server.
59867 </para>
59868 </listitem></varlistentry>
59869 <varlistentry>
59870 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
59871 <listitem>
59872 <para>
59873 When the message was received over an encrypted connection, this records the
59874 name of the cipher suite that was used.
59875 </para>
59876 </listitem></varlistentry>
59877 <varlistentry>
59878 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
59879 <listitem>
59880 <para>
59881 When the message was received over an encrypted connection, and a certificate
59882 was received from the client, this records the Distinguished Name from that
59883 certificate.
59884 </para>
59885 </listitem></varlistentry>
59886 </variablelist>
59887 <para>
59888 Following the options there is a list of those addresses to which the message
59889 is not to be delivered. This set of addresses is initialized from the command
59890 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
59891 is set; otherwise it starts out empty. Whenever a successful delivery is made,
59892 the address is added to this set. The addresses are kept internally as a
59893 balanced binary tree, and it is a representation of that tree which is written
59894 to the spool file. If an address is expanded via an alias or forward file, the
59895 original address is added to the tree when deliveries to all its child
59896 addresses are complete.
59897 </para>
59898 <para>
59899 If the tree is empty, there is a single line in the spool file containing just
59900 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
59901 Y or N, followed by an address. The address is the value for the node of the
59902 tree, and the letters indicate whether the node has a left branch and/or a
59903 right branch attached to it, respectively. If branches exist, they immediately
59904 follow. Here is an example of a three-node tree:
59905 </para>
59906 <literallayout class="monospaced">
59907 YY darcy@austen.fict.example
59908 NN alice@wonderland.fict.example
59909 NN editor@thesaurus.ref.example
59910 </literallayout>
59911 <para>
59912 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
59913 This is a simple list, preceded by a count. It includes all the original
59914 recipients of the message, including those to whom the message has already been
59915 delivered. In the simplest case, the list contains one address per line. For
59916 example:
59917 </para>
59918 <literallayout class="monospaced">
59919 4
59920 editor@thesaurus.ref.example
59921 darcy@austen.fict.example
59922 rdo@foundation
59923 alice@wonderland.fict.example
59924 </literallayout>
59925 <para>
59926 However, when a child address has been added to the top-level addresses as a
59927 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
59928 line is of the following form:
59929 </para>
59930 <literallayout>
59931 &lt;<emphasis>top-level address</emphasis>&gt; &lt;<emphasis>errors_to address</emphasis>&gt; &lt;<emphasis>length</emphasis>&gt;,&lt;<emphasis>parent number</emphasis>&gt;#&lt;<emphasis>flag bits</emphasis>&gt;
59932 </literallayout>
59933 <para>
59934 The 01 flag bit indicates the presence of the three other fields that follow
59935 the top-level address. Other bits may be used in future to support additional
59936 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
59937 original parent of the <quote>one time</quote> address. The first two fields are the
59938 envelope sender that is associated with this address and its length. If the
59939 length is zero, there is no special envelope sender (there are then two space
59940 characters in the line). A non-empty field can arise from a <command>redirect</command> router
59941 that has an <option>errors_to</option> setting.
59942 </para>
59943 <para>
59944 A blank line separates the envelope and status information from the headers
59945 which follow. A header may occupy several lines of the file, and to save effort
59946 when reading it in, each header is preceded by a number and an identifying
59947 character. The number is the number of characters in the header, including any
59948 embedded newlines and the terminating newline. The character is one of the
59949 following:
59950 </para>
59951 <informaltable frame="none">
59952 <tgroup cols="2" colsep="0" rowsep="0">
59953 <colspec colwidth="50pt" align="left"/>
59954 <colspec colwidth="254pt" align="left"/>
59955 <tbody>
59956 <row>
59957 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
59958 <entry>header in which Exim has no special interest</entry>
59959 </row>
59960 <row>
59961 <entry><literal>B</literal></entry>
59962 <entry><emphasis>Bcc:</emphasis> header</entry>
59963 </row>
59964 <row>
59965 <entry><literal>C</literal></entry>
59966 <entry><emphasis>Cc:</emphasis> header</entry>
59967 </row>
59968 <row>
59969 <entry><literal>F</literal></entry>
59970 <entry><emphasis>From:</emphasis> header</entry>
59971 </row>
59972 <row>
59973 <entry><literal>I</literal></entry>
59974 <entry><emphasis>Message-id:</emphasis> header</entry>
59975 </row>
59976 <row>
59977 <entry><literal>P</literal></entry>
59978 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
59979 </row>
59980 <row>
59981 <entry><literal>R</literal></entry>
59982 <entry><emphasis>Reply-To:</emphasis> header</entry>
59983 </row>
59984 <row>
59985 <entry><literal>S</literal></entry>
59986 <entry><emphasis>Sender:</emphasis> header</entry>
59987 </row>
59988 <row>
59989 <entry><literal>T</literal></entry>
59990 <entry><emphasis>To:</emphasis> header</entry>
59991 </row>
59992 <row>
59993 <entry><literal>*</literal></entry>
59994 <entry>replaced or deleted header</entry>
59995 </row>
59996 </tbody>
59997 </tgroup>
59998 </informaltable>
59999 <para>
60000 Deleted or replaced (rewritten) headers remain in the spool file for debugging
60001 purposes. They are not transmitted when the message is delivered. Here is a
60002 typical set of headers:
60003 </para>
60004 <literallayout class="monospaced">
60005 111P Received: by hobbit.fict.example with local (Exim 4.00)
60006 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
60007 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
60008 038* X-rewrote-sender: bb@hobbit.fict.example
60009 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
60010 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
60011 099* To: alice@wonderland.fict.example, rdo@foundation,
60012 darcy@austen.fict.example, editor@thesaurus.ref.example
60013 104T To: alice@wonderland.fict.example, rdo@foundation.example,
60014 darcy@austen.fict.example, editor@thesaurus.ref.example
60015 038  Date: Fri, 11 May 2001 10:28:59 +0100
60016 </literallayout>
60017 <para>
60018 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
60019 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
60020 unqualified domain <emphasis>foundation</emphasis>.
60021 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
60022 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
60023 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
60024 </para>
60025 </section>
60026 </chapter>
60027
60028 <chapter>
60029 <title>Adding new drivers or lookup types</title>
60030 <titleabbrev>Adding drivers or lookups</titleabbrev>
60031 <para>
60032 <indexterm role="concept">
60033 <primary>adding drivers</primary>
60034 </indexterm>
60035 <indexterm role="concept">
60036 <primary>new drivers</primary>
60037 <secondary>adding</secondary>
60038 </indexterm>
60039 <indexterm role="concept">
60040 <primary>drivers</primary>
60041 <secondary>adding new</secondary>
60042 </indexterm>
60043 The following actions have to be taken in order to add a new router, transport,
60044 authenticator, or lookup type to Exim:
60045 </para>
60046 <orderedlist numeration="arabic">
60047 <listitem>
60048 <para>
60049 Choose a name for the driver or lookup type that does not conflict with any
60050 existing name; I will use <quote>newdriver</quote> in what follows.
60051 </para>
60052 </listitem>
60053 <listitem>
60054 <para>
60055 Add to <filename>src/EDITME</filename> the line:
60056 </para>
60057 <literallayout>
60058 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
60059 </literallayout>
60060 <para>
60061 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
60062 code is not to be included in the binary by default, comment this line out. You
60063 should also add any relevant comments about the driver or lookup type.
60064 </para>
60065 </listitem>
60066 <listitem>
60067 <para>
60068 Add to <filename>src/config.h.defaults</filename> the line:
60069 </para>
60070 <literallayout class="monospaced">
60071 #define &lt;type&gt;_NEWDRIVER
60072 </literallayout>
60073 </listitem>
60074 <listitem>
60075 <para>
60076 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
60077 and create a table entry as is done for all the other drivers and lookup types.
60078 </para>
60079 </listitem>
60080 <listitem>
60081 <para>
60082 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
60083 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
60084 driver or lookup type and add it to the definition of OBJ.
60085 </para>
60086 </listitem>
60087 <listitem>
60088 <para>
60089 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
60090 <filename>src</filename>.
60091 </para>
60092 </listitem>
60093 <listitem>
60094 <para>
60095 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
60096 as for other drivers and lookups.
60097 </para>
60098 </listitem>
60099 </orderedlist>
60100 <para>
60101 Then all you need to do is write the code! A good way to start is to make a
60102 proforma by copying an existing module of the same type, globally changing all
60103 occurrences of the name, and cutting out most of the code. Note that any
60104 options you create must be listed in alphabetical order, because the tables are
60105 searched using a binary chop procedure.
60106 </para>
60107 <para>
60108 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
60109 the interface that is expected.
60110 </para>
60111 </chapter>
60112
60113 <index role="option">
60114 <title>Option index</title>
60115 </index>
60116
60117 <index role="concept">
60118 <title>Concept index</title>
60119 </index>
60120
60121 </book>