Made index have long references
[exim-website.git] / docbook / 4.63 / 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 <bookinfo>
5 <title>Specification of the Exim Mail Transfer Agent</title>
6 <titleabbrev>The Exim MTA</titleabbrev>
7 <date>27 July 2006</date>
8 <author><firstname>Philip</firstname><surname>Hazel</surname></author>
9 <authorinitials>PH</authorinitials>
10 <affiliation><orgname>University of Cambridge Computing Service</orgname></affiliation>
11 <address>New Museums Site, Pembroke Street, Cambridge CB2 3QH, England</address>
12 <revhistory><revision>
13   <revnumber>4.63</revnumber>
14   <date>27 July 2006</date>
15   <authorinitials>PH</authorinitials>
16 </revision></revhistory>
17 <copyright><year>2006</year><holder>University of Cambridge</holder></copyright>
18 </bookinfo>
19 <chapter>
20 <title>Introduction</title>
21
22 <indexterm role="concept">
23   <primary>$1, $2, etc.</primary>
24   <see><emphasis>numerical variables</emphasis></see>
25 </indexterm>
26 <indexterm role="concept">
27   <primary>address</primary>
28   <secondary>rewriting</secondary>
29   <see><emphasis>rewriting</emphasis></see>
30 </indexterm>
31 <indexterm role="concept">
32   <primary>Bounce Address Tag Validation</primary>
33   <see><emphasis>BATV</emphasis></see>
34 </indexterm>
35 <indexterm role="concept">
36   <primary>Client SMTP Authorization</primary>
37   <see><emphasis>CSA</emphasis></see>
38 </indexterm>
39 <indexterm role="concept">
40   <primary>CR character</primary>
41   <see><emphasis>carriage return</emphasis></see>
42 </indexterm>
43 <indexterm role="concept">
44   <primary>CRL</primary>
45   <see><emphasis>certificate revocation list</emphasis></see>
46 </indexterm>
47 <indexterm role="concept">
48   <primary>delivery</primary>
49   <secondary>failure report</secondary>
50   <see><emphasis>bounce message</emphasis></see>
51 </indexterm>
52 <indexterm role="concept">
53   <primary>dialup</primary>
54   <see><emphasis>intermittently connected hosts</emphasis></see>
55 </indexterm>
56 <indexterm role="concept">
57   <primary>exiscan</primary>
58   <see><emphasis>content scanning</emphasis></see>
59 </indexterm>
60 <indexterm role="concept">
61   <primary>failover</primary>
62   <see><emphasis>fallback</emphasis></see>
63 </indexterm>
64 <indexterm role="concept">
65   <primary>fallover</primary>
66   <see><emphasis>fallback</emphasis></see>
67 </indexterm>
68 <indexterm role="concept">
69   <primary>filter</primary>
70   <secondary>Sieve</secondary>
71   <see><emphasis>Sieve filter</emphasis></see>
72 </indexterm>
73 <indexterm role="concept">
74   <primary>ident</primary>
75   <see><emphasis>RFC 1413</emphasis></see>
76 </indexterm>
77 <indexterm role="concept">
78   <primary>LF character</primary>
79   <see><emphasis>linefeed</emphasis></see>
80 </indexterm>
81 <indexterm role="concept">
82   <primary>maximum</primary>
83   <see><emphasis>limit</emphasis></see>
84 </indexterm>
85 <indexterm role="concept">
86   <primary>monitor</primary>
87   <see><emphasis>Exim monitor</emphasis></see>
88 </indexterm>
89 <indexterm role="concept">
90   <primary>no_<emphasis>xxx</emphasis></primary>
91   <see>entry for xxx</see>
92 </indexterm>
93 <indexterm role="concept">
94   <primary>NUL</primary>
95   <see><emphasis>binary zero</emphasis></see>
96 </indexterm>
97 <indexterm role="concept">
98   <primary>passwd file</primary>
99   <see><emphasis>/etc/passwd</emphasis></see>
100 </indexterm>
101 <indexterm role="concept">
102   <primary>process id</primary>
103   <see><emphasis>pid</emphasis></see>
104 </indexterm>
105 <indexterm role="concept">
106   <primary>RBL</primary>
107   <see><emphasis>DNS list</emphasis></see>
108 </indexterm>
109 <indexterm role="concept">
110   <primary>redirection</primary>
111   <see><emphasis>address redirection</emphasis></see>
112 </indexterm>
113 <indexterm role="concept">
114   <primary>return path</primary>
115   <seealso><emphasis>envelope sender</emphasis></seealso>
116 </indexterm>
117 <indexterm role="concept">
118   <primary>scanning</primary>
119   <see><emphasis>content scanning</emphasis></see>
120 </indexterm>
121 <indexterm role="concept">
122   <primary>SSL</primary>
123   <see><emphasis>TLS</emphasis></see>
124 </indexterm>
125 <indexterm role="concept">
126   <primary>string</primary>
127   <secondary>expansion</secondary>
128   <see><emphasis>expansion</emphasis></see>
129 </indexterm>
130 <indexterm role="concept">
131   <primary>top bit</primary>
132   <see><emphasis>8-bit characters</emphasis></see>
133 </indexterm>
134 <indexterm role="concept">
135   <primary>variables</primary>
136   <see><emphasis>expansion, variables</emphasis></see>
137 </indexterm>
138 <indexterm role="concept">
139   <primary>zero, binary</primary>
140   <see><emphasis>binary zero</emphasis></see>
141 </indexterm>
142
143 <para>
144 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
145 Unix-like operating systems. It was designed on the assumption that it would be
146 run on hosts that are permanently connected to the Internet. However, it can be
147 used on intermittently connected hosts with suitable configuration adjustments.
148 </para>
149 <para>
150 Configuration files currently exist for the following operating systems: AIX,
151 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
152 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
153 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
154 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and Unixware.
155 Some of these operating systems are no longer current and cannot easily be
156 tested, so the configuration files may no longer work in practice.
157 </para>
158 <para>
159 There are also configuration files for compiling Exim in the Cygwin environment
160 that can be installed on systems running Windows. However, this document does
161 not contain any information about running Exim in the Cygwin environment.
162 </para>
163 <para>
164 The terms and conditions for the use and distribution of Exim are contained in
165 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
166 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
167 </para>
168 <para>
169 The use, supply or promotion of Exim for the purpose of sending bulk,
170 unsolicited electronic mail is incompatible with the basic aims of the program,
171 which revolve around the free provision of a service that enhances the quality
172 of personal communications. The author of Exim regards indiscriminate
173 mass-mailing as an antisocial, irresponsible abuse of the Internet.
174 </para>
175 <para>
176 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
177 experience of running and working on the Smail 3 code, I could never have
178 contemplated starting to write a new MTA. Many of the ideas and user interfaces
179 were originally taken from Smail 3, though the actual code of Exim is entirely
180 new, and has developed far beyond the initial concept.
181 </para>
182 <para>
183 Many people, both in Cambridge and around the world, have contributed to the
184 development and the testing of Exim, and to porting it to various operating
185 systems. I am grateful to them all. The distribution now contains a file called
186 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
187 contributors.
188 </para>
189 <section>
190 <title>Exim documentation</title>
191 <para revisionflag="changed">
192 <indexterm role="concept">
193 <primary>documentation</primary>
194 </indexterm>
195 This edition of the Exim specification applies to version 4.63 of Exim.
196 Substantive changes from the 4.62 edition are marked in some
197 renditions of the document; this paragraph is so marked if the rendition is
198 capable of showing a change indicator.
199 </para>
200 <para>
201 This document is very much a reference manual; it is not a tutorial. The reader
202 is expected to have some familiarity with the SMTP mail transfer protocol and
203 with general Unix system administration. Although there are some discussions
204 and examples in places, the information is mostly organized in a way that makes
205 it easy to look up, rather than in a natural order for sequential reading.
206 Furthermore, the manual aims to cover every aspect of Exim in detail, including
207 a number of rarely-used, special-purpose features that are unlikely to be of
208 very wide interest.
209 </para>
210 <para>
211 <indexterm role="concept">
212 <primary>books about Exim</primary>
213 </indexterm>
214 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
215 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
216 SMTP Mail Server</emphasis>, published by UIT Cambridge
217 (<emphasis role="bold"><ulink url="http://www.uit.co.uk/exim-book/">http://www.uit.co.uk/exim-book/</ulink></emphasis>).
218 </para>
219 <para>
220 This book also contains a chapter that gives a general introduction to SMTP and
221 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
222 with the latest release of Exim. (Note that the earlier book about Exim,
223 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
224 </para>
225 <para>
226 <indexterm role="concept">
227 <primary>Debian</primary>
228 <secondary>information sources</secondary>
229 </indexterm>
230 If you are using a Debian distribution of Exim, you will find information about
231 Debian-specific features in the file
232 </para>
233 <literallayout>
234 <filename>/usr/share/doc/exim4-base/README.Debian</filename>
235 </literallayout>
236 <para>
237 The command <command>man update-exim.conf</command> is another source of Debian-specific
238 information.
239 </para>
240 <para>
241 <indexterm role="concept">
242 <primary><filename>doc/NewStuff</filename></primary>
243 </indexterm>
244 <indexterm role="concept">
245 <primary><filename>doc/ChangeLog</filename></primary>
246 </indexterm>
247 <indexterm role="concept">
248 <primary>change log</primary>
249 </indexterm>
250 As the program develops, there may be features in newer versions that have not
251 yet made it into this document, which is updated only when the most significant
252 digit of the fractional part of the version number changes. Specifications of
253 new features that are not yet in this manual are placed in the file
254 <filename>doc/NewStuff</filename> in the Exim distribution.
255 </para>
256 <para>
257 Some features may be classified as <quote>experimental</quote>. These may change
258 incompatibly while they are developing, or even be withdrawn. For this reason,
259 they are not documented in this manual. Information about experimental features
260 can be found in the file <filename>doc/experimental.txt</filename>.
261 </para>
262 <para>
263 All changes to the program (whether new features, bug fixes, or other kinds of
264 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
265 </para>
266 <para>
267 <indexterm role="concept">
268 <primary><filename>doc/spec.txt</filename></primary>
269 </indexterm>
270 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
271 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
272 directory are:
273 </para>
274 <informaltable frame="none">
275 <tgroup cols="2" colsep="0" rowsep="0">
276 <colspec colwidth="100pt" align="left"/>
277 <colspec colwidth="254pt" align="left"/>
278 <tbody>
279 <row>
280 <entry><filename>OptionLists.txt</filename></entry>
281 <entry>list of all options in alphabetical order</entry>
282 </row>
283 <row>
284 <entry><filename>dbm.discuss.txt</filename></entry>
285 <entry>discussion about DBM libraries</entry>
286 </row>
287 <row>
288 <entry><filename>exim.8</filename></entry>
289 <entry>a man page of Exim&#x2019;s command line options</entry>
290 </row>
291 <row>
292 <entry><filename>experimental.txt</filename></entry>
293 <entry>documentation of experimental features</entry>
294 </row>
295 <row>
296 <entry><filename>filter.txt</filename></entry>
297 <entry>specification of the filter language</entry>
298 </row>
299 <row>
300 <entry><filename>pcrepattern.txt</filename></entry>
301 <entry>specification of PCRE regular expressions</entry>
302 </row>
303 <row>
304 <entry><filename>pcretest.txt</filename></entry>
305 <entry>specification of the PCRE testing program</entry>
306 </row>
307 <row>
308 <entry><filename>Exim3.upgrade</filename></entry>
309 <entry>upgrade notes from release 2 to release 3</entry>
310 </row>
311 <row>
312 <entry><filename>Exim4.upgrade</filename></entry>
313 <entry>upgrade notes from release 3 to release 4</entry>
314 </row>
315 </tbody>
316 </tgroup>
317 </informaltable>
318 <para>
319 The main specification and the specification of the filtering language are also
320 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
321 <xref linkend="SECTavail"/> below tells you how to get hold of these.
322 </para>
323 </section>
324 <section>
325 <title>FTP and web sites</title>
326 <para>
327 <indexterm role="concept">
328 <primary>web site</primary>
329 </indexterm>
330 <indexterm role="concept">
331 <primary>FTP site</primary>
332 </indexterm>
333 The primary site for Exim source distributions is currently the University of
334 Cambridge&#x2019;s FTP site, whose contents are described in <emphasis>Where to find the Exim
335 distribution</emphasis> below. In addition, there is a web site and an FTP site at
336 <option>exim.org</option>. These are now also hosted at the University of Cambridge. The
337 <option>exim.org</option> site was previously hosted for a number of years by Energis
338 Squared, formerly Planet Online Ltd, whose support I gratefully acknowledge.
339 </para>
340 <para>
341 <indexterm role="concept">
342 <primary>wiki</primary>
343 </indexterm>
344 <indexterm role="concept">
345 <primary>FAQ</primary>
346 </indexterm>
347 As well as Exim distribution tar files, the Exim web site contains a number of
348 differently formatted versions of the documentation, including the FAQ in both
349 text and HTML formats. The HTML version comes with a keyword-in-context index.
350 A recent addition to the online information is the Exim wiki
351 (<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
352 for Exim users to contribute examples, tips, and know-how for the benefit of
353 others.
354 </para>
355 </section>
356 <section>
357 <title>Mailing lists</title>
358 <para>
359 <indexterm role="concept">
360 <primary>mailing lists</primary>
361 <secondary>for Exim users</secondary>
362 </indexterm>
363 The following are the three main Exim mailing lists:
364 </para>
365 <informaltable frame="none">
366 <tgroup cols="2" colsep="0" rowsep="0">
367 <colspec colwidth="140pt" align="left"/>
368 <colspec colwidth="254pt" align="left"/>
369 <tbody>
370 <row>
371 <entry><emphasis>exim-users@exim.org</emphasis></entry>
372 <entry>general discussion list</entry>
373 </row>
374 <row>
375 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
376 <entry>discussion of bugs, enhancements, etc.</entry>
377 </row>
378 <row>
379 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
380 <entry>moderated, low volume announcements list</entry>
381 </row>
382 </tbody>
383 </tgroup>
384 </informaltable>
385 <para revisionflag="changed">
386 You can subscribe to these lists, change your existing subscriptions, and view
387 or search the archives via the mailing lists link on the Exim home page.
388 <indexterm role="concept">
389 <primary>Debian</primary>
390 <secondary>mailing list for</secondary>
391 </indexterm>
392 If you are using a Debian distribution of Exim, you may wish to subscribe to
393 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
394 via this web page:
395 </para>
396 <literallayout revisionflag="changed">
397 <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>
398 </literallayout>
399 <para revisionflag="changed">
400 Please ask Debian-specific questions on this list and not on the general Exim
401 lists.
402 </para>
403 </section>
404 <section>
405 <title>Exim training</title>
406 <para>
407 <indexterm role="concept">
408 <primary>training courses</primary>
409 </indexterm>
410 From time to time (approximately annually at the time of writing), training
411 courses are run by the author of Exim in Cambridge, UK. Details of any
412 forthcoming courses can be found on the web site
413 <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>.
414 </para>
415 </section>
416 <section>
417 <title>Bug reports</title>
418 <para>
419 <indexterm role="concept">
420 <primary>bug reports</primary>
421 </indexterm>
422 <indexterm role="concept">
423 <primary>reporting bugs</primary>
424 </indexterm>
425 Reports of obvious bugs should be emailed to <emphasis>bugs@exim.org</emphasis>. However, if you
426 are unsure whether some behaviour is a bug or not, the best thing to do is to
427 post a message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
428 </para>
429 </section>
430 <section id="SECTavail">
431 <title>Where to find the Exim distribution</title>
432 <para>
433 <indexterm role="concept">
434 <primary>FTP site</primary>
435 </indexterm>
436 <indexterm role="concept">
437 <primary>distribution</primary>
438 <secondary>ftp site</secondary>
439 </indexterm>
440 The master ftp site for the Exim distribution is
441 </para>
442 <literallayout>
443 <emphasis role="bold">ftp://ftp.csx.cam.ac.uk/pub/software/email/exim</emphasis>
444 </literallayout>
445 <para>
446 This is mirrored by
447 </para>
448 <literallayout>
449 <emphasis role="bold">ftp://ftp.exim.org/pub/exim</emphasis>
450 </literallayout>
451 <para>
452 The file references that follow are relative to the <filename>exim</filename> directories at
453 these sites. There are now quite a number of independent mirror sites around
454 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
455 </para>
456 <para>
457 Within the <filename>exim</filename> directory there are subdirectories called <filename>exim3</filename> (for
458 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
459 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
460 subdirectory, the current release can always be found in files called
461 </para>
462 <literallayout>
463 <filename>exim-n.nn.tar.gz</filename>
464 <filename>exim-n.nn.tar.bz2</filename>
465 </literallayout>
466 <para>
467 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The two
468 files contain identical data; the only difference is the type of compression.
469 The <filename>.bz2</filename> file is usually a lot smaller than the <filename>.gz</filename> file.
470 </para>
471 <para>
472 <indexterm role="concept">
473 <primary>distribution</primary>
474 <secondary>signing details</secondary>
475 </indexterm>
476 <indexterm role="concept">
477 <primary>distribution</primary>
478 <secondary>public key</secondary>
479 </indexterm>
480 <indexterm role="concept">
481 <primary>public key for signed distribution</primary>
482 </indexterm>
483 The distributions are currently signed with Philip Hazel&#x2019;s GPG key. The
484 corresponding public key is available from a number of keyservers, and there is
485 also a copy in the file <filename>Public-Key</filename>. The signatures for the tar bundles are
486 in:
487 </para>
488 <literallayout>
489 <filename>exim-n.nn.tar.gz.sig</filename>
490 <filename>exim-n.nn.tar.bz2.sig</filename>
491 </literallayout>
492 <para>
493 For each released version, the log of changes is made separately available in a
494 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
495 find out what has changed without having to download the entire distribution.
496 </para>
497 <para>
498 <indexterm role="concept">
499 <primary>documentation</primary>
500 <secondary>available formats</secondary>
501 </indexterm>
502 The main distribution contains ASCII versions of this specification and other
503 documentation; other formats of the documents are available in separate files
504 inside the <filename>exim4</filename> directory of the FTP site:
505 </para>
506 <literallayout>
507 <filename>exim-html-n.nn.tar.gz</filename>
508 <filename>exim-pdf-n.nn.tar.gz</filename>
509 <filename>exim-postscript-n.nn.tar.gz</filename>
510 <filename>exim-texinfo-n.nn.tar.gz</filename>
511 </literallayout>
512 <para>
513 These tar files contain only the <filename>doc</filename> directory, not the complete
514 distribution, and are also available in <filename>.bz2</filename> as well as <filename>.gz</filename> forms.
515 <indexterm role="concept">
516 <primary>FAQ</primary>
517 </indexterm>
518 The FAQ is available for downloading in two different formats in these files:
519 </para>
520 <literallayout>
521 <filename>exim4/FAQ.txt.gz</filename>
522 <filename>exim4/FAQ.html.tar.gz</filename>
523 </literallayout>
524 <para>
525 The first of these is a single ASCII file that can be searched with a text
526 editor. The second is a directory of HTML files, normally accessed by starting
527 at <filename>index.html</filename>. The HTML version of the FAQ (which is also included in the
528 HTML documentation tarbundle) includes a keyword-in-context index, which is
529 often the most convenient way of finding your way around.
530 </para>
531 </section>
532 <section>
533 <title>Wish list</title>
534 <para>
535 <indexterm role="concept">
536 <primary>wish list</primary>
537 </indexterm>
538 </para>
539 <para revisionflag="changed">
540 A wish list is maintained, containing ideas for new features that have been
541 submitted. This used to be a single file that from time to time was exported to
542 the ftp site into the file <filename>exim4/WishList</filename>. However, it has now been
543 imported into Exim&#x2019;s Bugzilla data.
544 </para>
545 </section>
546 <section>
547 <title>Contributed material</title>
548 <para>
549 <indexterm role="concept">
550 <primary>contributed material</primary>
551 </indexterm>
552 At the ftp site, there is a directory called <filename>Contrib</filename> that contains
553 miscellaneous files contributed to the Exim community by Exim users. There is
554 also a collection of contributed configuration examples in
555 <filename>exim4/config.samples.tar.gz</filename>. These samples are referenced from the FAQ.
556 </para>
557 </section>
558 <section>
559 <title>Limitations</title>
560 <itemizedlist>
561 <listitem>
562 <para>
563 <indexterm role="concept">
564 <primary>limitations of Exim</primary>
565 </indexterm>
566 <indexterm role="concept">
567 <primary>bang paths</primary>
568 <secondary>not handled by Exim</secondary>
569 </indexterm>
570 Exim is designed for use as an Internet MTA, and therefore handles addresses in
571 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
572 simple two-component bang paths can be converted by a straightforward rewriting
573 configuration. This restriction does not prevent Exim from being interfaced to
574 UUCP as a transport mechanism, provided that domain addresses are used.
575 </para>
576 </listitem>
577 <listitem>
578 <para>
579 <indexterm role="concept">
580 <primary>domainless addresses</primary>
581 </indexterm>
582 <indexterm role="concept">
583 <primary>address</primary>
584 <secondary>without domain</secondary>
585 </indexterm>
586 Exim insists that every address it handles has a domain attached. For incoming
587 local messages, domainless addresses are automatically qualified with a
588 configured domain value. Configuration options specify from which remote
589 systems unqualified addresses are acceptable. These are then qualified on
590 arrival.
591 </para>
592 </listitem>
593 <listitem>
594 <para>
595 <indexterm role="concept">
596 <primary>transport</primary>
597 <secondary>external</secondary>
598 </indexterm>
599 <indexterm role="concept">
600 <primary>external transports</primary>
601 </indexterm>
602 The only external transport mechanisms that are currently implemented are SMTP
603 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
604 transport is available, and there are facilities for writing messages to files
605 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
606 to send messages to other transport mechanisms such as UUCP, provided they can
607 handle domain-style addresses. Batched SMTP input is also catered for.
608 </para>
609 </listitem>
610 <listitem>
611 <para>
612 Exim is not designed for storing mail for dial-in hosts. When the volumes of
613 such mail are large, it is better to get the messages <quote>delivered</quote> into files
614 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
615 other means.
616 </para>
617 </listitem>
618 <listitem>
619 <para>
620 Although Exim does have basic facilities for scanning incoming messages, these
621 are not comprehensive enough to do full virus or spam scanning. Such operations
622 are best carried out using additional specialized software packages. If you
623 compile Exim with the content-scanning extension, straightforward interfaces to
624 a number of common scanners are provided.
625 </para>
626 </listitem>
627 </itemizedlist>
628 </section>
629 <section>
630 <title>Run time configuration</title>
631 <para>
632 Exim&#x2019;s run time configuration is held in a single text file that is divided
633 into a number of sections. The entries in this file consist of keywords and
634 values, in the style of Smail 3 configuration files. A default configuration
635 file which is suitable for simple online installations is provided in the
636 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
637 </para>
638 </section>
639 <section>
640 <title>Calling interface</title>
641 <para>
642 <indexterm role="concept">
643 <primary>Sendmail compatibility</primary>
644 <secondary>command line interface</secondary>
645 </indexterm>
646 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
647 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
648 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
649 about Sendmail in order to run Exim. For actions other than sending messages,
650 Sendmail-compatible options also exist, but those that produce output (for
651 example, <option>-bp</option>, which lists the messages on the queue) do so in Exim&#x2019;s own
652 format. There are also some additional options that are compatible with Smail
653 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
654 documents all Exim&#x2019;s command line options. This information is automatically
655 made into the man page that forms part of the Exim distribution.
656 </para>
657 <para>
658 Control of messages on the queue can be done via certain privileged command
659 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
660 which displays current information in an X window, and which contains a menu
661 interface to Exim&#x2019;s command line administration options.
662 </para>
663 </section>
664 <section>
665 <title>Terminology</title>
666 <para>
667 <indexterm role="concept">
668 <primary>terminology definitions</primary>
669 </indexterm>
670 <indexterm role="concept">
671 <primary>body of message</primary>
672 <secondary>definition of</secondary>
673 </indexterm>
674 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
675 It is the last part of a message, and is separated from the <emphasis>header</emphasis> (see
676 below) by a blank line.
677 </para>
678 <para>
679 <indexterm role="concept">
680 <primary>bounce message</primary>
681 <secondary>definition of</secondary>
682 </indexterm>
683 When a message cannot be delivered, it is normally returned to the sender in a
684 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
685 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
686 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
687 failure error report</quote>. Such messages have an empty sender address in the
688 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
689 rise to further bounce messages.
690 </para>
691 <para>
692 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
693 value which is used in the absence of any setting in the configuration. It may
694 also qualify an action which is taken unless a configuration setting specifies
695 otherwise.
696 </para>
697 <para>
698 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
699 destination cannot immediately take place for some reason (a remote host may be
700 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
701 until a later time.
702 </para>
703 <para>
704 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
705 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
706 the part of an email address following the @ sign.
707 </para>
708 <para>
709 <indexterm role="concept">
710 <primary>envelope</primary>
711 <secondary>definition of</secondary>
712 </indexterm>
713 <indexterm role="concept">
714 <primary>sender</primary>
715 <secondary>definition of</secondary>
716 </indexterm>
717 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
718 body. The envelope contains a sender address (to which bounce messages should
719 be delivered), and any number of recipient addresses. References to the
720 sender or the recipients of a message usually mean the addresses in the
721 envelope. An MTA uses these addresses for delivery, and for returning bounce
722 messages, not the addresses that appear in the header lines.
723 </para>
724 <para>
725 <indexterm role="concept">
726 <primary>message header</primary>
727 <secondary>definition of</secondary>
728 </indexterm>
729 <indexterm role="concept">
730 <primary>header section</primary>
731 <secondary>definition of</secondary>
732 </indexterm>
733 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
734 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
735 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
736 indenting the continuations. The header is separated from the body by a blank
737 line.
738 </para>
739 <para>
740 <indexterm role="concept">
741 <primary>local part</primary>
742 <secondary>definition of</secondary>
743 </indexterm>
744 <indexterm role="concept">
745 <primary>domain</primary>
746 <secondary>definition of</secondary>
747 </indexterm>
748 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to that
749 part of an email address that precedes the @ sign. The part that follows the
750 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
751 </para>
752 <para>
753 <indexterm role="concept">
754 <primary>local delivery</primary>
755 <secondary>definition of</secondary>
756 </indexterm>
757 <indexterm role="concept">
758 <primary>remote delivery</primary>
759 <secondary>definition of</secondary>
760 </indexterm>
761 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
762 delivery to a file or a pipe on the local host from delivery by SMTP over
763 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
764 host it is running on are <emphasis>remote</emphasis>.
765 </para>
766 <para>
767 <indexterm role="concept">
768 <primary>return path</primary>
769 <secondary>definition of</secondary>
770 </indexterm>
771 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
772 message&#x2019;s envelope.
773 </para>
774 <para>
775 <indexterm role="concept">
776 <primary>queue</primary>
777 <secondary>definition of</secondary>
778 </indexterm>
779 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery,
780 because this term is in widespread use in the context of MTAs. However, in
781 Exim&#x2019;s case the reality is more like a pool than a queue, because there is
782 normally no ordering of waiting messages.
783 </para>
784 <para>
785 <indexterm role="concept">
786 <primary>queue runner</primary>
787 <secondary>definition of</secondary>
788 </indexterm>
789 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
790 and attempts to deliver those messages whose retry times have come. This term
791 is used by other MTAs, and also relates to the command <option>runq</option>, but in Exim
792 the waiting messages are normally processed in an unpredictable order.
793 </para>
794 <para>
795 <indexterm role="concept">
796 <primary>spool directory</primary>
797 <secondary>definition of</secondary>
798 </indexterm>
799 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
800 messages on its queue &ndash; that is, those that it is in the process of
801 delivering. This should not be confused with the directory in which local
802 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
803 the Exim documentation, <quote>spool</quote> is always used in the first sense.
804 </para>
805 </section>
806 </chapter>
807
808 <chapter>
809 <title>Incorporated code</title>
810 <para>
811 <indexterm role="concept">
812 <primary>incorporated code</primary>
813 </indexterm>
814 <indexterm role="concept">
815 <primary>regular expressions</primary>
816 <secondary>library</secondary>
817 </indexterm>
818 <indexterm role="concept">
819 <primary>PCRE</primary>
820 </indexterm>
821 A number of pieces of external code are included in the Exim distribution.
822 </para>
823 <itemizedlist>
824 <listitem>
825 <para>
826 Regular expressions are supported in the main Exim program and in the Exim
827 monitor using the freely-distributable PCRE library, copyright &copy;
828 University of Cambridge. The source is distributed in the directory
829 <filename>src/pcre</filename>. However, this is a cut-down version of PCRE. If you want to use
830 the PCRE library in other programs, you should obtain and install the full
831 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>.
832 </para>
833 </listitem>
834 <listitem>
835 <para>
836 <indexterm role="concept">
837 <primary>cdb</primary>
838 <secondary>acknowledgement</secondary>
839 </indexterm>
840 Support for the cdb (Constant DataBase) lookup method is provided by code
841 contributed by Nigel Metheringham of (at the time he contributed it) Planet
842 Online Ltd. The implementation is completely contained within the code of Exim.
843 It does not link against an external cdb library. The code contains the
844 following statements:
845 </para>
846 <blockquote>
847 <para>
848 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
849 </para>
850 <para>
851 This program is free software; you can redistribute it and/or modify it under
852 the terms of the GNU General Public License as published by the Free Software
853 Foundation; either version 2 of the License, or (at your option) any later
854 version.
855 </para>
856 <para>
857 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
858 the spec and sample code for cdb can be obtained from
859 <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
860 code from Dan Bernstein&#x2019;s implementation (which has no license restrictions
861 applied to it).
862 </para>
863 </blockquote>
864 </listitem>
865 <listitem>
866 <para>
867 <indexterm role="concept">
868 <primary>SPA authentication</primary>
869 </indexterm>
870 <indexterm role="concept">
871 <primary>Samba project</primary>
872 </indexterm>
873 <indexterm role="concept">
874 <primary>Microsoft Secure Password Authentication</primary>
875 </indexterm>
876 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
877 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
878 Tom Kistner. This includes code taken from the Samba project, which is released
879 under the Gnu GPL.
880 </para>
881 </listitem>
882 <listitem>
883 <para>
884 <indexterm role="concept">
885 <primary>Cyrus</primary>
886 </indexterm>
887 <indexterm role="concept">
888 <primary><emphasis>pwcheck</emphasis> daemon</primary>
889 </indexterm>
890 <indexterm role="concept">
891 <primary><emphasis>pwauthd</emphasis> daemon</primary>
892 </indexterm>
893 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
894 by code taken from the Cyrus-SASL library and adapted by Alexander S.
895 Sabourenkov. The permission notice appears below, in accordance with the
896 conditions expressed therein.
897 </para>
898 <blockquote>
899 <para>
900 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
901 </para>
902 <para>
903 Redistribution and use in source and binary forms, with or without
904 modification, are permitted provided that the following conditions
905 are met:
906 </para>
907 <orderedlist numeration="arabic">
908 <listitem>
909 <para>
910 Redistributions of source code must retain the above copyright
911 notice, this list of conditions and the following disclaimer.
912 </para>
913 </listitem>
914 <listitem>
915 <para>
916 Redistributions in binary form must reproduce the above copyright
917 notice, this list of conditions and the following disclaimer in
918 the documentation and/or other materials provided with the
919 distribution.
920 </para>
921 </listitem>
922 <listitem>
923 <para>
924 The name <quote>Carnegie Mellon University</quote> must not be used to
925 endorse or promote products derived from this software without
926 prior written permission. For permission or any other legal
927 details, please contact
928 </para>
929 <literallayout>
930               Office of Technology Transfer
931               Carnegie Mellon University
932               5000 Forbes Avenue
933               Pittsburgh, PA  15213-3890
934               (412) 268-4387, fax: (412) 268-7395
935               tech-transfer@andrew.cmu.edu
936 </literallayout>
937 </listitem>
938 <listitem>
939 <para>
940 Redistributions of any form whatsoever must retain the following
941 acknowledgment:
942 </para>
943 <para>
944 <quote>This product includes software developed by Computing Services
945 at Carnegie Mellon University (<emphasis role="bold"><ulink url="http://www.cmu.edu/computing/">http://www.cmu.edu/computing/</ulink></emphasis>.</quote>
946 </para>
947 <para>
948 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
949 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
950 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
951 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
952 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
953 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
954 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
955 </para>
956 </listitem>
957 </orderedlist>
958 </blockquote>
959 </listitem>
960 <listitem>
961 <para>
962 <indexterm role="concept">
963 <primary>Exim monitor</primary>
964 <secondary>acknowledgement</secondary>
965 </indexterm>
966 <indexterm role="concept">
967 <primary>X-windows</primary>
968 </indexterm>
969 <indexterm role="concept">
970 <primary>Athena</primary>
971 </indexterm>
972 The Exim Monitor program, which is an X-Window application, includes
973 modified versions of the Athena StripChart and TextPop widgets.
974 This code is copyright by DEC and MIT, and their permission notice appears
975 below, in accordance with the conditions expressed therein.
976 </para>
977 <blockquote>
978 <para>
979 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
980 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
981 </para>
982 <para>
983 All Rights Reserved
984 </para>
985 <para>
986 Permission to use, copy, modify, and distribute this software and its
987 documentation for any purpose and without fee is hereby granted,
988 provided that the above copyright notice appear in all copies and that
989 both that copyright notice and this permission notice appear in
990 supporting documentation, and that the names of Digital or MIT not be
991 used in advertising or publicity pertaining to distribution of the
992 software without specific, written prior permission.
993 </para>
994 <para>
995 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
996 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
997 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
998 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
999 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
1000 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1001 SOFTWARE.
1002 </para>
1003 </blockquote>
1004 </listitem>
1005 <listitem>
1006 <para>
1007 Many people have contributed code fragments, some large, some small, that were
1008 not covered by any specific licence requirements. It is assumed that the
1009 contributors are happy to see their code incoporated into Exim under the GPL.
1010 </para>
1011 </listitem>
1012 </itemizedlist>
1013 </chapter>
1014
1015 <chapter>
1016 <title>How Exim receives and delivers mail</title>
1017 <titleabbrev>Receiving and delivering mail</titleabbrev>
1018 <section>
1019 <title>Overall philosophy</title>
1020 <para>
1021 <indexterm role="concept">
1022 <primary>design philosophy</primary>
1023 </indexterm>
1024 Exim is designed to work efficiently on systems that are permanently connected
1025 to the Internet and are handling a general mix of mail. In such circumstances,
1026 most messages can be delivered immediately. Consequently, Exim does not
1027 maintain independent queues of messages for specific domains or hosts, though
1028 it does try to send several messages in a single SMTP connection after a host
1029 has been down, and it also maintains per-host retry information.
1030 </para>
1031 </section>
1032 <section>
1033 <title>Policy control</title>
1034 <para>
1035 <indexterm role="concept">
1036 <primary>policy control</primary>
1037 <secondary>overview</secondary>
1038 </indexterm>
1039 Policy controls are now an important feature of MTAs that are connected to the
1040 Internet. Perhaps their most important job is to stop MTAs being abused as
1041 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1042 unsolicited junk, and want to disguise its source. Exim provides flexible
1043 facilities for specifying policy controls on incoming mail:
1044 </para>
1045 <itemizedlist>
1046 <listitem>
1047 <para>
1048 <indexterm role="concept">
1049 <primary>access control lists (ACLs)</primary>
1050 <secondary>introduction</secondary>
1051 </indexterm>
1052 Exim 4 (unlike previous versions of Exim) implements policy controls on
1053 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1054 series of statements that may either grant or deny access. ACLs can be used at
1055 several places in the SMTP dialogue while receiving a message from a remote
1056 host. However, the most common places are after each RCPT command, and at the
1057 very end of the message. The sysadmin can specify conditions for accepting or
1058 rejecting individual recipients or the entire message, respectively, at these
1059 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1060 error code.
1061 </para>
1062 </listitem>
1063 <listitem>
1064 <para>
1065 An ACL is also available for locally generated, non-SMTP messages. In this
1066 case, the only available actions are to accept or deny the entire message.
1067 </para>
1068 </listitem>
1069 <listitem>
1070 <para>
1071 When Exim is compiled with the content-scanning extension, facilities are
1072 provided in the ACL mechanism for passing the message to external virus and/or
1073 spam scanning software. The result of such a scan is passed back to the ACL,
1074 which can then use it to decide what to do with the message.
1075 </para>
1076 </listitem>
1077 <listitem>
1078 <para>
1079 When a message has been received, either from a remote host or from the local
1080 host, but before the final acknowledgement has been sent, a locally supplied C
1081 function called <function>local_scan()</function> can be run to inspect the message and decide
1082 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1083 is accepted, the list of recipients can be modified by the function.
1084 </para>
1085 </listitem>
1086 <listitem>
1087 <para>
1088 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1089 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1090 Exim to be compiled with the content-scanning extension.
1091 </para>
1092 </listitem>
1093 <listitem>
1094 <para>
1095 After a message has been accepted, a further checking mechanism is available in
1096 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1097 runs at the start of every delivery process.
1098 </para>
1099 </listitem>
1100 </itemizedlist>
1101 </section>
1102 <section>
1103 <title>User filters</title>
1104 <para>
1105 <indexterm role="concept">
1106 <primary>filter</primary>
1107 <secondary>introduction</secondary>
1108 </indexterm>
1109 <indexterm role="concept">
1110 <primary>Sieve filter</primary>
1111 </indexterm>
1112 In a conventional Exim configuration, users are able to run private filters by
1113 setting up appropriate <filename>.forward</filename> files in their home directories. See
1114 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1115 configuration needed to support this, and the separate document entitled
1116 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1117 of filtering are available:
1118 </para>
1119 <itemizedlist>
1120 <listitem>
1121 <para>
1122 Sieve filters are written in the standard filtering language that is defined
1123 by RFC 3028.
1124 </para>
1125 </listitem>
1126 <listitem>
1127 <para>
1128 Exim filters are written in a syntax that is unique to Exim, but which is more
1129 powerful than Sieve, which it pre-dates.
1130 </para>
1131 </listitem>
1132 </itemizedlist>
1133 <para>
1134 User filters are run as part of the routing process, described below.
1135 </para>
1136 </section>
1137 <section id="SECTmessiden">
1138 <title>Message identification</title>
1139 <para>
1140 <indexterm role="concept">
1141 <primary>message ids</primary>
1142 <secondary>details of format</secondary>
1143 </indexterm>
1144 <indexterm role="concept">
1145 <primary>format</primary>
1146 <secondary>of message id</secondary>
1147 </indexterm>
1148 <indexterm role="concept">
1149 <primary>id of message</primary>
1150 </indexterm>
1151 <indexterm role="concept">
1152 <primary>base62</primary>
1153 </indexterm>
1154 <indexterm role="concept">
1155 <primary>base36</primary>
1156 </indexterm>
1157 <indexterm role="concept">
1158 <primary>Darwin</primary>
1159 </indexterm>
1160 <indexterm role="concept">
1161 <primary>Cygwin</primary>
1162 </indexterm>
1163 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1164 characters long. It is divided into three parts, separated by hyphens, for
1165 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1166 normally encoding numbers in base 62. However, in the Darwin operating
1167 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1168 (avoiding the use of lower case letters) is used instead, because the message
1169 id is used to construct file names, and the names of files in those systems are
1170 not always case-sensitive.
1171 </para>
1172 <para>
1173 <indexterm role="concept">
1174 <primary>pid (process id)</primary>
1175 <secondary>re-use of</secondary>
1176 </indexterm>
1177 The detail of the contents of the message id have changed as Exim has evolved.
1178 Earlier versions relied on the operating system not re-using a process id (pid)
1179 within one second. On modern operating systems, this assumption can no longer
1180 be made, so the algorithm had to be changed. To retain backward compatibility,
1181 the format of the message id was retained, which is why the following rules are
1182 somewhat eccentric:
1183 </para>
1184 <itemizedlist>
1185 <listitem>
1186 <para>
1187 The first six characters of the message id are the time at which the message
1188 started to be received, to a granularity of one second. That is, this field
1189 contains the number of seconds since the start of the epoch (the normal Unix
1190 way of representing the date and time of day).
1191 </para>
1192 </listitem>
1193 <listitem>
1194 <para>
1195 After the first hyphen, the next six characters are the id of the process that
1196 received the message.
1197 </para>
1198 </listitem>
1199 <listitem>
1200 <para>
1201 There are two different possibilities for the final two characters:
1202 </para>
1203 <orderedlist numeration="arabic">
1204 <listitem>
1205 <para>
1206 <indexterm role="concept">
1207 <primary><option>localhost_number</option></primary>
1208 </indexterm>
1209 If <option>localhost_number</option> is not set, this value is the fractional part of the
1210 time of reception, normally in units of 1/2000 of a second, but for systems
1211 that must use base 36 instead of base 62 (because of case-insensitive file
1212 systems), the units are 1/1000 of a second.
1213 </para>
1214 </listitem>
1215 <listitem>
1216 <para>
1217 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1218 the fractional part of the time, which in this case is in units of 1/200
1219 (1/100) of a second.
1220 </para>
1221 </listitem>
1222 </orderedlist>
1223 </listitem>
1224 </itemizedlist>
1225 <para>
1226 After a message has been received, Exim waits for the clock to tick at the
1227 appropriate resolution before proceeding, so that if another message is
1228 received by the same process, or by another process with the same (re-used)
1229 pid, it is guaranteed that the time will be different. In most cases, the clock
1230 will already have ticked while the message was being received.
1231 </para>
1232 </section>
1233 <section>
1234 <title>Receiving mail</title>
1235 <para>
1236 <indexterm role="concept">
1237 <primary>receiving mail</primary>
1238 </indexterm>
1239 <indexterm role="concept">
1240 <primary>message</primary>
1241 <secondary>reception</secondary>
1242 </indexterm>
1243 The only way Exim can receive mail from another host is using SMTP over
1244 TCP/IP, in which case the sender and recipient addresses are transferred using
1245 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1246 there are several possibilities:
1247 </para>
1248 <itemizedlist>
1249 <listitem>
1250 <para>
1251 If the process runs Exim with the <option>-bm</option> option, the message is read
1252 non-interactively (usually via a pipe), with the recipients taken from the
1253 command line, or from the body of the message if <option>-t</option> is also used.
1254 </para>
1255 </listitem>
1256 <listitem>
1257 <para>
1258 If the process runs Exim with the <option>-bS</option> option, the message is also read
1259 non-interactively, but in this case the recipients are listed at the start of
1260 the message in a series of SMTP RCPT commands, terminated by a DATA
1261 command. This is so-called <quote>batch SMTP</quote> format,
1262 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1263 envelope addresses in a non-interactive submission.
1264 </para>
1265 </listitem>
1266 <listitem>
1267 <para>
1268 If the process runs Exim with the <option>-bs</option> option, the message is read
1269 interactively, using the SMTP protocol. A two-way pipe is normally used for
1270 passing data between the local process and the Exim process.
1271 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1272 example, the ACLs for SMTP commands are used for this form of submission.
1273 </para>
1274 </listitem>
1275 <listitem>
1276 <para>
1277 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1278 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1279 does not treat the loopback address specially. It treats all such connections
1280 in the same way as connections from other hosts.
1281 </para>
1282 </listitem>
1283 </itemizedlist>
1284 <para>
1285 <indexterm role="concept">
1286 <primary>message sender</primary>
1287 <secondary>constructed by Exim</secondary>
1288 </indexterm>
1289 <indexterm role="concept">
1290 <primary>sender</primary>
1291 <secondary>constructed by Exim</secondary>
1292 </indexterm>
1293 In the three cases that do not involve TCP/IP, the sender address is
1294 constructed from the login name of the user that called Exim and a default
1295 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1296 option). For local or batch SMTP, a sender address that is passed using the
1297 SMTP MAIL command is ignored. However, the system administrator may allow
1298 certain users (<quote>trusted users</quote>) to specify a different sender address
1299 unconditionally, or all users to specify certain forms of different sender
1300 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1301 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1302 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1303 users to change sender addresses.
1304 </para>
1305 <para>
1306 Messages received by either of the non-interactive mechanisms are subject to
1307 checking by the non-SMTP ACL, if one is defined. Messages received using SMTP
1308 (either over TCP/IP, or interacting with a local process) can be checked by a
1309 number of ACLs that operate at different times during the SMTP session. Either
1310 individual recipients, or the entire message, can be rejected if local policy
1311 requirements are not met. The <function>local_scan()</function> function (see chapter
1312 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1313 </para>
1314 <para>
1315 Exim can be configured not to start a delivery process when a message is
1316 received; this can be unconditional, or depend on the number of incoming SMTP
1317 connections or the system load. In these situations, new messages wait on the
1318 queue until a queue runner process picks them up. However, in standard
1319 configurations under normal conditions, delivery is started as soon as a
1320 message is received.
1321 </para>
1322 </section>
1323 <section>
1324 <title>Handling an incoming message</title>
1325 <para>
1326 <indexterm role="concept">
1327 <primary>spool directory</primary>
1328 <secondary>files that hold a message</secondary>
1329 </indexterm>
1330 <indexterm role="concept">
1331 <primary>file</primary>
1332 <secondary>how a message is held</secondary>
1333 </indexterm>
1334 When Exim accepts a message, it writes two files in its spool directory. The
1335 first contains the envelope information, the current status of the message, and
1336 the header lines, and the second contains the body of the message. The names of
1337 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1338 file containing the envelope and header, and <literal>-D</literal> for the data file.
1339 </para>
1340 <para>
1341 <indexterm role="concept">
1342 <primary>spool directory</primary>
1343 <secondary><filename>input</filename> sub-directory</secondary>
1344 </indexterm>
1345 By default all these message files are held in a single directory called
1346 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1347 not perform very well if the number of files in a directory gets large; to
1348 improve performance in such cases, the <option>split_spool_directory</option> option can be
1349 used. This causes Exim to split up the input files into 62 sub-directories
1350 whose names are single letters or digits. When this is done, the queue is
1351 processed one sub-directory at a time instead of all at once, which can improve
1352 overall performance even when there are not enough files in each directory to
1353 affect file system performance.
1354 </para>
1355 <para>
1356 The envelope information consists of the address of the message&#x2019;s sender and
1357 the addresses of the recipients. This information is entirely separate from
1358 any addresses contained in the header lines. The status of the message includes
1359 a list of recipients who have already received the message. The format of the
1360 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1361 </para>
1362 <para>
1363 <indexterm role="concept">
1364 <primary>rewriting</primary>
1365 <secondary>addresses</secondary>
1366 </indexterm>
1367 Address rewriting that is specified in the rewrite section of the configuration
1368 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1369 both in the header lines and the envelope, at the time the message is accepted.
1370 If during the course of delivery additional addresses are generated (for
1371 example, via aliasing), these new addresses are rewritten as soon as they are
1372 generated. At the time a message is actually delivered (transported) further
1373 rewriting can take place; because this is a transport option, it can be
1374 different for different forms of delivery. It is also possible to specify the
1375 addition or removal of certain header lines at the time the message is
1376 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1377 <xref linkend="CHAPtransportgeneric"/>).
1378 </para>
1379 </section>
1380 <section>
1381 <title>Life of a message</title>
1382 <para>
1383 <indexterm role="concept">
1384 <primary>message</primary>
1385 <secondary>life of</secondary>
1386 </indexterm>
1387 <indexterm role="concept">
1388 <primary>message</primary>
1389 <secondary>frozen</secondary>
1390 </indexterm>
1391 A message remains in the spool directory until it is completely delivered to
1392 its recipients or to an error address, or until it is deleted by an
1393 administrator or by the user who originally created it. In cases when delivery
1394 cannot proceed &ndash; for example, when a message can neither be delivered to its
1395 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1396 spool, and no more deliveries are attempted.
1397 </para>
1398 <para>
1399 <indexterm role="concept">
1400 <primary>frozen messages</primary>
1401 <secondary>thawing</secondary>
1402 </indexterm>
1403 <indexterm role="concept">
1404 <primary>message</primary>
1405 <secondary>thawing frozen</secondary>
1406 </indexterm>
1407 An administrator can <quote>thaw</quote> such messages when the problem has been
1408 corrected, and can also freeze individual messages by hand if necessary. In
1409 addition, an administrator can force a delivery error, causing a bounce message
1410 to be sent.
1411 </para>
1412 <para>
1413 <indexterm role="concept">
1414 <primary><option>timeout_frozen_after</option></primary>
1415 </indexterm>
1416 <indexterm role="concept">
1417 <primary><option>ignore_bounce_errors_after</option></primary>
1418 </indexterm>
1419 There are options called <option>ignore_bounce_errors_after</option> and
1420 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1421 The first applies only to frozen bounces, the second to any frozen messages.
1422 </para>
1423 <para>
1424 <indexterm role="concept">
1425 <primary>message</primary>
1426 <secondary>log file for</secondary>
1427 </indexterm>
1428 <indexterm role="concept">
1429 <primary>log</primary>
1430 <secondary>file for each message</secondary>
1431 </indexterm>
1432 While Exim is working on a message, it writes information about each delivery
1433 attempt to its main log file. This includes successful, unsuccessful, and
1434 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1435 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1436 These logs are solely for the benefit of the administrator, and are normally
1437 deleted along with the spool files when processing of a message is complete.
1438 The use of individual message logs can be disabled by setting
1439 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1440 systems.
1441 </para>
1442 <para>
1443 <indexterm role="concept">
1444 <primary>journal file</primary>
1445 </indexterm>
1446 <indexterm role="concept">
1447 <primary>file</primary>
1448 <secondary>journal</secondary>
1449 </indexterm>
1450 All the information Exim itself needs to set up a delivery is kept in the first
1451 spool file, along with the header lines. When a successful delivery occurs, the
1452 address is immediately written at the end of a journal file, whose name is the
1453 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1454 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1455 is updated to indicate which these are, and the journal file is then deleted.
1456 Updating the spool file is done by writing a new file and renaming it, to
1457 minimize the possibility of data loss.
1458 </para>
1459 <para>
1460 Should the system or the program crash after a successful delivery but before
1461 the spool file has been updated, the journal is left lying around. The next
1462 time Exim attempts to deliver the message, it reads the journal file and
1463 updates the spool file before proceeding. This minimizes the chances of double
1464 deliveries caused by crashes.
1465 </para>
1466 </section>
1467 <section id="SECTprocaddress">
1468 <title>Processing an address for delivery</title>
1469 <para>
1470 <indexterm role="concept">
1471 <primary>drivers</primary>
1472 <secondary>definition of</secondary>
1473 </indexterm>
1474 <indexterm role="concept">
1475 <primary>router</primary>
1476 <secondary>definition of</secondary>
1477 </indexterm>
1478 <indexterm role="concept">
1479 <primary>transport</primary>
1480 <secondary>definition of</secondary>
1481 </indexterm>
1482 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1483 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1484 number of them is provided in the source distribution, and compile-time options
1485 specify which ones are included in the binary. Run time options specify which
1486 ones are actually used for delivering messages.
1487 </para>
1488 <para>
1489 <indexterm role="concept">
1490 <primary>drivers</primary>
1491 <secondary>instance definition</secondary>
1492 </indexterm>
1493 Each driver that is specified in the run time configuration is an <emphasis>instance</emphasis>
1494 of that particular driver type. Multiple instances are allowed; for example,
1495 you can set up several different <command>smtp</command> transports, each with different
1496 option values that might specify different ports or different timeouts. Each
1497 instance has its own identifying name. In what follows we will normally use the
1498 instance name when discussing one particular instance (that is, one specific
1499 configuration of the driver), and the generic driver name when discussing
1500 the driver&#x2019;s features in general.
1501 </para>
1502 <para>
1503 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1504 its delivery should happen, by assigning it to a specific transport, or
1505 converting the address into one or more new addresses (for example, via an
1506 alias file). A router may also explicitly choose to fail an address, causing it
1507 to be bounced.
1508 </para>
1509 <para>
1510 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1511 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1512 transport, the destination is a file or a pipe on the local host, whereas for a
1513 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1514 to a specific transport as a result of successful routing. If a message has
1515 several recipients, it may be passed to a number of different transports.
1516 </para>
1517 <para>
1518 <indexterm role="concept">
1519 <primary>preconditions</primary>
1520 <secondary>definition of</secondary>
1521 </indexterm>
1522 An address is processed by passing it to each configured router instance in
1523 turn, subject to certain preconditions, until a router accepts the address or
1524 specifies that it should be bounced. We will describe this process in more
1525 detail shortly. First, as a simple example, we consider how each recipient
1526 address in a message is processed in a small configuration of three routers.
1527 </para>
1528 <para>
1529 To make this a more concrete example, it is described in terms of some actual
1530 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1531 routers in many different ways, and there may be any number of routers in a
1532 configuration.
1533 </para>
1534 <para>
1535 The first router that is specified in a configuration is often one that handles
1536 addresses in domains that are not recognized specially by the local host. These
1537 are typically addresses for arbitrary domains on the Internet. A precondition
1538 is set up which looks for the special domains known to the host (for example,
1539 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1540 match. Typically, this is a router that looks up domains in the DNS in order to
1541 find the hosts to which this address routes. If it succeeds, the address is
1542 assigned to a suitable SMTP transport; if it does not succeed, the router is
1543 configured to fail the address.
1544 </para>
1545 <para>
1546 The second router is reached only when the domain is recognized as one that
1547 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1548 aliasing and forwarding. When it generates one or more new addresses from the
1549 original, each of them is routed independently from the start. Otherwise, the
1550 router may cause an address to fail, or it may simply decline to handle the
1551 address, in which case the address is passed to the next router.
1552 </para>
1553 <para>
1554 The final router in many configurations is one that checks to see if the
1555 address belongs to a local mailbox. The precondition may involve a check to
1556 see if the local part is the name of a login account, or it may look up the
1557 local part in a file or a database. If its preconditions are not met, or if
1558 the router declines, we have reached the end of the routers. When this happens,
1559 the address is bounced.
1560 </para>
1561 </section>
1562 <section>
1563 <title>Processing an address for verification</title>
1564 <para>
1565 <indexterm role="concept">
1566 <primary>router</primary>
1567 <secondary>for verification</secondary>
1568 </indexterm>
1569 <indexterm role="concept">
1570 <primary>verifying address</primary>
1571 <secondary>overview</secondary>
1572 </indexterm>
1573 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1574 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1575 one of the checks to be performed in an ACL for incoming messages, on both
1576 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1577 <option>-bvs</option> command line options.
1578 </para>
1579 <para>
1580 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1581 does not affect the way the routers work, but it is a state that can be
1582 detected. By this means, a router can be skipped or made to behave differently
1583 when verifying. A common example is a configuration in which the first router
1584 sends all messages to a message-scanning program, unless they have been
1585 previously scanned. Thus, the first router accepts all addresses without any
1586 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1587 would be set for such a router, causing it to be skipped in verify mode.
1588 </para>
1589 </section>
1590 <section id="SECTrunindrou">
1591 <title>Running an individual router</title>
1592 <para>
1593 <indexterm role="concept">
1594 <primary>router</primary>
1595 <secondary>running details</secondary>
1596 </indexterm>
1597 <indexterm role="concept">
1598 <primary>preconditions</primary>
1599 <secondary>checking</secondary>
1600 </indexterm>
1601 <indexterm role="concept">
1602 <primary>router</primary>
1603 <secondary>result of running</secondary>
1604 </indexterm>
1605 As explained in the example above, a number of preconditions are checked before
1606 running a router. If any are not met, the router is skipped, and the address is
1607 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1608 the router is run. What happens next depends on the outcome, which is one of
1609 the following:
1610 </para>
1611 <itemizedlist>
1612 <listitem>
1613 <para>
1614 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1615 transport, or generates one or more <quote>child</quote> addresses. Processing the
1616 original address ceases,
1617 <indexterm role="concept">
1618 <primary><option>unseen</option> option</primary>
1619 </indexterm>
1620 unless the <option>unseen</option> option is set on the router. This option
1621 can be used to set up multiple deliveries with different routing (for example,
1622 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1623 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1624 end of routing.
1625 </para>
1626 <para>
1627 Any child addresses generated by the router are processed independently,
1628 starting with the first router by default. It is possible to change this by
1629 setting the <option>redirect_router</option> option to specify which router to start at for
1630 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1631 <option>redirect_router</option> may be anywhere in the router configuration.
1632 </para>
1633 </listitem>
1634 <listitem>
1635 <para>
1636 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1637 requests that the address be passed to another router. By default the address
1638 is passed to the next router, but this can be changed by setting the
1639 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1640 must be below the current router (to avoid loops).
1641 </para>
1642 </listitem>
1643 <listitem>
1644 <para>
1645 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1646 recognize it at all. By default, the address is passed to the next router, but
1647 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1648 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1649 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1650 </para>
1651 </listitem>
1652 <listitem>
1653 <para>
1654 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1655 the generation of a bounce message. There is no further processing of the
1656 original address unless <option>unseen</option> is set on the router.
1657 </para>
1658 </listitem>
1659 <listitem>
1660 <para>
1661 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1662 database may be offline, or a DNS lookup may have timed out.) No further
1663 processing of the address happens in this delivery attempt. It is tried again
1664 next time the message is considered for delivery.
1665 </para>
1666 </listitem>
1667 <listitem>
1668 <para>
1669 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1670 its configuration). The action is as for defer.
1671 </para>
1672 </listitem>
1673 </itemizedlist>
1674 <para>
1675 If an address reaches the end of the routers without having been accepted by
1676 any of them, it is bounced as unrouteable. The default error message in this
1677 situation is <quote>unrouteable address</quote>, but you can set your own message by
1678 making use of the <option>cannot_route_message</option> option. This can be set for any
1679 router; the value from the last router that <quote>saw</quote> the address is used.
1680 </para>
1681 <para>
1682 Sometimes while routing you want to fail a delivery when some conditions are
1683 met but others are not, instead of passing the address on for further routing.
1684 You can do this by having a second router that explicitly fails the delivery
1685 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1686 facility for this purpose.
1687 </para>
1688 </section>
1689 <section>
1690 <title>Duplicate addresses</title>
1691 <para>
1692 <indexterm role="concept">
1693 <primary>case of local parts</primary>
1694 </indexterm>
1695 <indexterm role="concept">
1696 <primary>address duplicate</primary>
1697 <secondary>discarding</secondary>
1698 </indexterm>
1699 <indexterm role="concept">
1700 <primary>duplicate addresses</primary>
1701 </indexterm>
1702 Once routing is complete, Exim scans the addresses that are assigned to local
1703 and remote transports, and discards any duplicates that it finds. During this
1704 check, local parts are treated as case-sensitive. <phrase revisionflag="changed">This happens only when
1705 actually delivering a message; when testing routers with <option>-bt</option>, all the
1706 routed addresses are shown.</phrase>
1707 </para>
1708 </section>
1709 <section id="SECTrouprecon">
1710 <title>Router preconditions</title>
1711 <para>
1712 <indexterm role="concept">
1713 <primary>router preconditions</primary>
1714 <secondary>order of processing</secondary>
1715 </indexterm>
1716 <indexterm role="concept">
1717 <primary>preconditions</primary>
1718 <secondary>order of processing</secondary>
1719 </indexterm>
1720 The preconditions that are tested for each router are listed below, in the
1721 order in which they are tested. The individual configuration options are
1722 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1723 </para>
1724 <itemizedlist>
1725 <listitem>
1726 <para>
1727 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1728 the local parts handled by the router may or must have certain prefixes and/or
1729 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1730 skipped. These conditions are tested first. When an affix is present, it is
1731 removed from the local part before further processing, including the evaluation
1732 of any other conditions.
1733 </para>
1734 </listitem>
1735 <listitem>
1736 <para>
1737 Routers can be designated for use only when not verifying an address, that is,
1738 only when routing it for delivery (or testing its delivery routing). If the
1739 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1740 address.
1741 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1742 <option>verify_recipient</option>, which independently control the use of the router for
1743 sender and recipient verification. You can set these options directly if
1744 you want a router to be used for only one type of verification.
1745 </para>
1746 </listitem>
1747 <listitem>
1748 <para>
1749 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1750 run with the <option>-bt</option> option to test an address routing. This can be helpful
1751 when the first router sends all new messages to a scanner of some sort; it
1752 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1753 having to simulate the effect of the scanner.
1754 </para>
1755 </listitem>
1756 <listitem>
1757 <para>
1758 Routers can be designated for use only when verifying an address, as
1759 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1760 </para>
1761 </listitem>
1762 <listitem>
1763 <para>
1764 Individual routers can be explicitly skipped when running the routers to
1765 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1766 </para>
1767 </listitem>
1768 <listitem>
1769 <para>
1770 If the <option>domains</option> option is set, the domain of the address must be in the set
1771 of domains that it defines.
1772 </para>
1773 </listitem>
1774 <listitem>
1775 <para>
1776 <indexterm role="concept">
1777 <primary><varname>$local_part_prefix</varname></primary>
1778 </indexterm>
1779 <indexterm role="concept">
1780 <primary><varname>$local_part</varname></primary>
1781 </indexterm>
1782 <indexterm role="concept">
1783 <primary><varname>$local_part_suffix</varname></primary>
1784 </indexterm>
1785 If the <option>local_parts</option> option is set, the local part of the address must be in
1786 the set of local parts that it defines. If <option>local_part_prefix</option> or
1787 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1788 part before this check. If you want to do precondition tests on local parts
1789 that include affixes, you can do so by using a <option>condition</option> option (see below)
1790 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>, and
1791 <varname>$local_part_suffix</varname> as necessary.
1792 </para>
1793 </listitem>
1794 <listitem>
1795 <para>
1796 <indexterm role="concept">
1797 <primary><varname>$local_user_uid</varname></primary>
1798 </indexterm>
1799 <indexterm role="concept">
1800 <primary><varname>$local_user_gid</varname></primary>
1801 </indexterm>
1802 <indexterm role="concept">
1803 <primary><varname>$home</varname></primary>
1804 </indexterm>
1805 If the <option>check_local_user</option> option is set, the local part must be the name of
1806 an account on the local host. If this check succeeds, the uid and gid of the
1807 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1808 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1809 remaining preconditions.
1810 </para>
1811 </listitem>
1812 <listitem>
1813 <para>
1814 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1815 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1816 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1817 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1818 could lead to confusion.
1819 </para>
1820 </listitem>
1821 <listitem>
1822 <para>
1823 If the <option>senders</option> option is set, the envelope sender address must be in the
1824 set of addresses that it defines.
1825 </para>
1826 </listitem>
1827 <listitem>
1828 <para>
1829 If the <option>require_files</option> option is set, the existence or non-existence of
1830 specified files is tested.
1831 </para>
1832 </listitem>
1833 <listitem>
1834 <para>
1835 <indexterm role="concept">
1836 <primary>customizing</primary>
1837 <secondary>precondition</secondary>
1838 </indexterm>
1839 If the <option>condition</option> option is set, it is evaluated and tested. This option
1840 uses an expanded string to allow you to set up your own custom preconditions.
1841 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1842 </para>
1843 </listitem>
1844 </itemizedlist>
1845 <para>
1846 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1847 it to check for the existence of a file in which to lookup up a domain, local
1848 part, or sender. However, as these options are all expanded, you can use the
1849 <option>exists</option> expansion condition to make such tests within each condition. The
1850 <option>require_files</option> option is intended for checking files that the router may be
1851 going to use internally, or which are needed by a specific transport (for
1852 example, <filename>.procmailrc</filename>).
1853 </para>
1854 </section>
1855 <section>
1856 <title>Delivery in detail</title>
1857 <para>
1858 <indexterm role="concept">
1859 <primary>delivery</primary>
1860 <secondary>in detail</secondary>
1861 </indexterm>
1862 When a message is to be delivered, the sequence of events is as follows:
1863 </para>
1864 <itemizedlist>
1865 <listitem>
1866 <para>
1867 If a system-wide filter file is specified, the message is passed to it. The
1868 filter may add recipients to the message, replace the recipients, discard the
1869 message, cause a new message to be generated, or cause the message delivery to
1870 fail. The format of the system filter file is the same as for Exim user filter
1871 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1872 filtering</emphasis>.
1873 <indexterm role="concept">
1874 <primary>Sieve filter</primary>
1875 <secondary>not available for system filter</secondary>
1876 </indexterm>
1877 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1878 </para>
1879 <para>
1880 Some additional features are available in system filters &ndash; see chapter
1881 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1882 filter only once per delivery attempt, however many recipients it has. However,
1883 if there are several delivery attempts because one or more addresses could not
1884 be immediately delivered, the system filter is run each time. The filter
1885 condition <option>first_delivery</option> can be used to detect the first run of the system
1886 filter.
1887 </para>
1888 </listitem>
1889 <listitem>
1890 <para>
1891 Each recipient address is offered to each configured router in turn, subject to
1892 its preconditions, until one is able to handle it. If no router can handle the
1893 address, that is, if they all decline, the address is failed. Because routers
1894 can be targeted at particular domains, several locally handled domains can be
1895 processed entirely independently of each other.
1896 </para>
1897 </listitem>
1898 <listitem>
1899 <para>
1900 <indexterm role="concept">
1901 <primary>routing</primary>
1902 <secondary>loops in</secondary>
1903 </indexterm>
1904 <indexterm role="concept">
1905 <primary>loop</primary>
1906 <secondary>while routing</secondary>
1907 </indexterm>
1908 A router that accepts an address may assign it to a local or a remote
1909 transport. However, the transport is not run at this time. Instead, the address
1910 is placed on a list for the particular transport, which will be run later.
1911 Alternatively, the router may generate one or more new addresses (typically
1912 from alias, forward, or filter files). New addresses are fed back into this
1913 process from the top, but in order to avoid loops, a router ignores any address
1914 which has an identically-named ancestor that was processed by itself.
1915 </para>
1916 </listitem>
1917 <listitem>
1918 <para>
1919 When all the routing has been done, addresses that have been successfully
1920 handled are passed to their assigned transports. When local transports are
1921 doing real local deliveries, they handle only one address at a time, but if a
1922 local transport is being used as a pseudo-remote transport (for example, to
1923 collect batched SMTP messages for transmission by some other means) multiple
1924 addresses can be handled. Remote transports can always handle more than one
1925 address at a time, but can be configured not to do so, or to restrict multiple
1926 addresses to the same domain.
1927 </para>
1928 </listitem>
1929 <listitem>
1930 <para>
1931 Each local delivery to a file or a pipe runs in a separate process under a
1932 non-privileged uid, and these deliveries are run one at a time. Remote
1933 deliveries also run in separate processes, normally under a uid that is private
1934 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1935 run in parallel. The maximum number of simultaneous remote deliveries for any
1936 one message is set by the <option>remote_max_parallel</option> option.
1937 The order in which deliveries are done is not defined, except that all local
1938 deliveries happen before any remote deliveries.
1939 </para>
1940 </listitem>
1941 <listitem>
1942 <para>
1943 <indexterm role="concept">
1944 <primary>queue runner</primary>
1945 </indexterm>
1946 When it encounters a local delivery during a queue run, Exim checks its retry
1947 database to see if there has been a previous temporary delivery failure for the
1948 address before running the local transport. If there was a previous failure,
1949 Exim does not attempt a new delivery until the retry time for the address is
1950 reached. However, this happens only for delivery attempts that are part of a
1951 queue run. Local deliveries are always attempted when delivery immediately
1952 follows message reception, even if retry times are set for them. This makes for
1953 better behaviour if one particular message is causing problems (for example,
1954 causing quota overflow, or provoking an error in a filter file).
1955 </para>
1956 </listitem>
1957 <listitem>
1958 <para>
1959 <indexterm role="concept">
1960 <primary>delivery</primary>
1961 <secondary>retry in remote transports</secondary>
1962 </indexterm>
1963 Remote transports do their own retry handling, since an address may be
1964 deliverable to one of a number of hosts, each of which may have a different
1965 retry time. If there have been previous temporary failures and no host has
1966 reached its retry time, no delivery is attempted, whether in a queue run or
1967 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
1968 </para>
1969 </listitem>
1970 <listitem>
1971 <para>
1972 If there were any permanent errors, a bounce message is returned to an
1973 appropriate address (the sender in the common case), with details of the error
1974 for each failing address. Exim can be configured to send copies of bounce
1975 messages to other addresses.
1976 </para>
1977 </listitem>
1978 <listitem>
1979 <para>
1980 <indexterm role="concept">
1981 <primary>delivery</primary>
1982 <secondary>deferral</secondary>
1983 </indexterm>
1984 If one or more addresses suffered a temporary failure, the message is left on
1985 the queue, to be tried again later. Delivery of these addresses is said to be
1986 <emphasis>deferred</emphasis>.
1987 </para>
1988 </listitem>
1989 <listitem>
1990 <para>
1991 When all the recipient addresses have either been delivered or bounced,
1992 handling of the message is complete. The spool files and message log are
1993 deleted, though the message log can optionally be preserved if required.
1994 </para>
1995 </listitem>
1996 </itemizedlist>
1997 </section>
1998 <section>
1999 <title>Retry mechanism</title>
2000 <para>
2001 <indexterm role="concept">
2002 <primary>delivery</primary>
2003 <secondary>retry mechanism</secondary>
2004 </indexterm>
2005 <indexterm role="concept">
2006 <primary>retry</primary>
2007 <secondary>description of mechanism</secondary>
2008 </indexterm>
2009 <indexterm role="concept">
2010 <primary>queue runner</primary>
2011 </indexterm>
2012 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2013 attempt is the queue runner process. You must either run an Exim daemon that
2014 uses the <option>-q</option> option with a time interval to start queue runners at regular
2015 intervals, or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2016 not arrange for queue runners to be run, messages that fail temporarily at the
2017 first attempt will remain on your queue for ever. A queue runner process works
2018 its way through the queue, one message at a time, trying each delivery that has
2019 passed its retry time.
2020 You can run several queue runners at once.
2021 </para>
2022 <para>
2023 Exim uses a set of configured rules to determine when next to retry the failing
2024 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2025 should give up trying to deliver to the address, at which point it generates a
2026 bounce message. If no retry rules are set for a particular host, address, and
2027 error combination, no retries are attempted, and temporary errors are treated
2028 as permanent.
2029 </para>
2030 </section>
2031 <section>
2032 <title>Temporary delivery failure</title>
2033 <para>
2034 <indexterm role="concept">
2035 <primary>delivery</primary>
2036 <secondary>temporary failure</secondary>
2037 </indexterm>
2038 There are many reasons why a message may not be immediately deliverable to a
2039 particular address. Failure to connect to a remote machine (because it, or the
2040 connection to it, is down) is one of the most common. Temporary failures may be
2041 detected during routing as well as during the transport stage of delivery.
2042 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2043 is on a file system where the user is over quota. Exim can be configured to
2044 impose its own quotas on local mailboxes; where system quotas are set they will
2045 also apply.
2046 </para>
2047 <para>
2048 If a host is unreachable for a period of time, a number of messages may be
2049 waiting for it by the time it recovers, and sending them in a single SMTP
2050 connection is clearly beneficial. Whenever a delivery to a remote host is
2051 deferred,
2052 </para>
2053 <para>
2054 <indexterm role="concept">
2055 <primary>hints database</primary>
2056 </indexterm>
2057 Exim makes a note in its hints database, and whenever a successful
2058 SMTP delivery has happened, it looks to see if any other messages are waiting
2059 for the same host. If any are found, they are sent over the same SMTP
2060 connection, subject to a configuration limit as to the maximum number in any
2061 one connection.
2062 </para>
2063 </section>
2064 <section>
2065 <title>Permanent delivery failure</title>
2066 <para>
2067 <indexterm role="concept">
2068 <primary>delivery</primary>
2069 <secondary>permanent failure</secondary>
2070 </indexterm>
2071 <indexterm role="concept">
2072 <primary>bounce message</primary>
2073 <secondary>when generated</secondary>
2074 </indexterm>
2075 When a message cannot be delivered to some or all of its intended recipients, a
2076 bounce message is generated. Temporary delivery failures turn into permanent
2077 errors when their timeout expires. All the addresses that fail in a given
2078 delivery attempt are listed in a single message. If the original message has
2079 many recipients, it is possible for some addresses to fail in one delivery
2080 attempt and others to fail subsequently, giving rise to more than one bounce
2081 message. The wording of bounce messages can be customized by the administrator.
2082 See chapter <xref linkend="CHAPemsgcust"/> for details.
2083 </para>
2084 <para>
2085 <indexterm role="concept">
2086 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2087 </indexterm>
2088 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2089 failed addresses, for the benefit of programs that try to analyse such messages
2090 automatically.
2091 </para>
2092 <para>
2093 <indexterm role="concept">
2094 <primary>bounce message</primary>
2095 <secondary>recipient of</secondary>
2096 </indexterm>
2097 A bounce message is normally sent to the sender of the original message, as
2098 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2099 address given in the MAIL command. However, when an address is expanded via a
2100 forward or alias file, an alternative address can be specified for delivery
2101 failures of the generated addresses. For a mailing list expansion (see section
2102 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2103 of the list.
2104 </para>
2105 </section>
2106 <section>
2107 <title>Failures to deliver bounce messages</title>
2108 <para>
2109 <indexterm role="concept">
2110 <primary>bounce message</primary>
2111 <secondary>failure to deliver</secondary>
2112 </indexterm>
2113 If a bounce message (either locally generated or received from a remote host)
2114 itself suffers a permanent delivery failure, the message is left on the queue,
2115 but it is frozen, awaiting the attention of an administrator. There are options
2116 that can be used to make Exim discard such failed messages, or to keep them
2117 for only a short time (see <option>timeout_frozen_after</option> and
2118 <option>ignore_bounce_errors_after</option>).
2119 </para>
2120 </section>
2121 </chapter>
2122
2123 <chapter>
2124 <title>Building and installing Exim</title>
2125 <para>
2126 <indexterm role="concept" id="IIDbuex" class="startofrange">
2127 <primary>building Exim</primary>
2128 </indexterm>
2129 </para>
2130 <section>
2131 <title>Unpacking</title>
2132 <para>
2133 Exim is distributed as a gzipped or bzipped tar file which, when upacked,
2134 creates a directory with the name of the current release (for example,
2135 <filename>exim-4.63</filename>) into which the following files are placed:
2136 </para>
2137 <informaltable frame="none">
2138 <tgroup cols="2" colsep="0" rowsep="0">
2139 <colspec colwidth="140pt" align="left"/>
2140 <colspec colwidth="254pt" align="left"/>
2141 <tbody>
2142 <row>
2143 <entry><filename>ACKNOWLEDGMENTS</filename></entry>
2144 <entry>contains some acknowledgments</entry>
2145 </row>
2146 <row>
2147 <entry><filename>CHANGES</filename></entry>
2148 <entry>contains a reference to where changes are documented</entry>
2149 </row>
2150 <row>
2151 <entry><filename>LICENCE</filename></entry>
2152 <entry>the GNU General Public Licence</entry>
2153 </row>
2154 <row>
2155 <entry><filename>Makefile</filename></entry>
2156 <entry>top-level make file</entry>
2157 </row>
2158 <row>
2159 <entry><filename>NOTICE</filename></entry>
2160 <entry>conditions for the use of Exim</entry>
2161 </row>
2162 <row>
2163 <entry><filename>README</filename></entry>
2164 <entry>list of files, directories and simple build instructions</entry>
2165 </row>
2166 </tbody>
2167 </tgroup>
2168 </informaltable>
2169 <para>
2170 Other files whose names begin with <filename>README</filename> may also be present. The
2171 following subdirectories are created:
2172 </para>
2173 <informaltable frame="none">
2174 <tgroup cols="2" colsep="0" rowsep="0">
2175 <colspec colwidth="140pt" align="left"/>
2176 <colspec colwidth="254pt" align="left"/>
2177 <tbody>
2178 <row>
2179 <entry><filename>Local</filename></entry>
2180 <entry>an empty directory for local configuration files</entry>
2181 </row>
2182 <row>
2183 <entry><filename>OS</filename></entry>
2184 <entry>OS-specific files</entry>
2185 </row>
2186 <row>
2187 <entry><filename>doc</filename></entry>
2188 <entry>documentation files</entry>
2189 </row>
2190 <row>
2191 <entry><filename>exim_monitor</filename></entry>
2192 <entry>source files for the Exim monitor</entry>
2193 </row>
2194 <row>
2195 <entry><filename>scripts</filename></entry>
2196 <entry>scripts used in the build process</entry>
2197 </row>
2198 <row>
2199 <entry><filename>src</filename></entry>
2200 <entry>remaining source files</entry>
2201 </row>
2202 <row>
2203 <entry><filename>util</filename></entry>
2204 <entry>independent utilities</entry>
2205 </row>
2206 </tbody>
2207 </tgroup>
2208 </informaltable>
2209 <para>
2210 The main utility programs are contained in the <filename>src</filename> directory, and are built
2211 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2212 that may be useful to some sites.
2213 </para>
2214 </section>
2215 <section>
2216 <title>Multiple machine architectures and operating systems</title>
2217 <para>
2218 <indexterm role="concept">
2219 <primary>building Exim</primary>
2220 <secondary>multiple OS/architectures</secondary>
2221 </indexterm>
2222 The building process for Exim is arranged to make it easy to build binaries for
2223 a number of different architectures and operating systems from the same set of
2224 source files. Compilation does not take place in the <filename>src</filename> directory.
2225 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2226 system.
2227 <indexterm role="concept">
2228 <primary>symbolic link</primary>
2229 <secondary>to build directory</secondary>
2230 </indexterm>
2231 Symbolic links to the sources are installed in this directory, which is where
2232 the actual building takes place. In most cases, Exim can discover the machine
2233 architecture and operating system for itself, but the defaults can be
2234 overridden if necessary.
2235 </para>
2236 </section>
2237 <section id="SECTdb">
2238 <title>DBM libraries</title>
2239 <para>
2240 <indexterm role="concept">
2241 <primary>DBM libraries</primary>
2242 <secondary>discussion of</secondary>
2243 </indexterm>
2244 <indexterm role="concept">
2245 <primary>hints database</primary>
2246 <secondary>DBM files used for</secondary>
2247 </indexterm>
2248 Even if you do not use any DBM files in your configuration, Exim still needs a
2249 DBM library in order to operate, because it uses indexed files for its hints
2250 databases. Unfortunately, there are a number of DBM libraries in existence, and
2251 different operating systems often have different ones installed.
2252 </para>
2253 <para>
2254 <indexterm role="concept">
2255 <primary>Solaris</primary>
2256 <secondary>DBM library for</secondary>
2257 </indexterm>
2258 <indexterm role="concept">
2259 <primary>IRIX</primary>
2260 <secondary>DBM library for</secondary>
2261 </indexterm>
2262 <indexterm role="concept">
2263 <primary>BSD</primary>
2264 <secondary>DBM library for</secondary>
2265 </indexterm>
2266 <indexterm role="concept">
2267 <primary>Linux</primary>
2268 <secondary>DBM library for</secondary>
2269 </indexterm>
2270 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2271 Linux distribution, the DBM configuration should happen automatically, and you
2272 may be able to ignore this section. Otherwise, you may have to learn more than
2273 you would like about DBM libraries from what follows.
2274 </para>
2275 <para>
2276 <indexterm role="concept">
2277 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2278 </indexterm>
2279 Licensed versions of Unix normally contain a library of DBM functions operating
2280 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2281 versions of Unix seem to vary in what they contain as standard. In particular,
2282 some early versions of Linux have no default DBM library, and different
2283 distributors have chosen to bundle different libraries with their packaged
2284 versions. However, the more recent releases seem to have standardised on the
2285 Berkeley DB library.
2286 </para>
2287 <para>
2288 Different DBM libraries have different conventions for naming the files they
2289 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2290 possibilities:
2291 </para>
2292 <orderedlist numeration="arabic">
2293 <listitem>
2294 <para>
2295 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2296 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2297 </para>
2298 </listitem>
2299 <listitem>
2300 <para>
2301 <indexterm role="concept">
2302 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2303 </indexterm>
2304 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2305 compatibility interface it makes two different hard links to it with names
2306 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2307 file name is used unmodified.
2308 </para>
2309 </listitem>
2310 <listitem>
2311 <para>
2312 <indexterm role="concept">
2313 <primary>Berkeley DB library</primary>
2314 </indexterm>
2315 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2316 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2317 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2318 </para>
2319 </listitem>
2320 <listitem>
2321 <para>
2322 If the Berkeley package is used in its native mode, it operates on a single
2323 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2324 the traditional <emphasis>ndbm</emphasis> interface.
2325 </para>
2326 </listitem>
2327 <listitem>
2328 <para>
2329 To complicate things further, there are several very different versions of the
2330 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2331 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while, but the latest versions are now
2332 numbered 4.<emphasis>x</emphasis>. Maintenance of some of the earlier releases has ceased. All
2333 versions of Berkeley DB can be obtained from
2334 <emphasis role="bold"><ulink url="http://www.sleepycat.com/">http://www.sleepycat.com/</ulink></emphasis>.
2335 </para>
2336 </listitem>
2337 <listitem>
2338 <para>
2339 <indexterm role="concept">
2340 <primary><emphasis>tdb</emphasis> DBM library</primary>
2341 </indexterm>
2342 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2343 <emphasis role="bold"><ulink url="http://download.sourceforge.net/tdb">http://download.sourceforge.net/tdb</ulink></emphasis>. It has its own interface, and also
2344 operates on a single file.
2345 </para>
2346 </listitem>
2347 </orderedlist>
2348 <para>
2349 <indexterm role="concept">
2350 <primary>USE_DB</primary>
2351 </indexterm>
2352 <indexterm role="concept">
2353 <primary>DBM libraries</primary>
2354 <secondary>configuration for building</secondary>
2355 </indexterm>
2356 Exim and its utilities can be compiled to use any of these interfaces. In order
2357 to use any version of the Berkeley DB package in native mode, you must set
2358 USE_DB in an appropriate configuration file (typically
2359 <filename>Local/Makefile</filename>). For example:
2360 </para>
2361 <literallayout class="monospaced">
2362 USE_DB=yes
2363 </literallayout>
2364 <para>
2365 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2366 error is diagnosed if you set more than one of these.
2367 </para>
2368 <para>
2369 At the lowest level, the build-time configuration sets none of these options,
2370 thereby assuming an interface of type (1). However, some operating system
2371 configuration files (for example, those for the BSD operating systems and
2372 Linux) assume type (4) by setting USE_DB as their default, and the
2373 configuration files for Cygwin set USE_GDBM. Anything you set in
2374 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2375 </para>
2376 <para>
2377 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2378 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2379 in one of these lines:
2380 </para>
2381 <literallayout class="monospaced">
2382 DBMLIB = -ldb
2383 DBMLIB = -ltdb
2384 </literallayout>
2385 <para>
2386 Settings like that will work if the DBM library is installed in the standard
2387 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2388 the default path. You may need to set INCLUDE to specify where the header
2389 file is, and to specify the path to the library more fully in DBMLIB, as in
2390 this example:
2391 </para>
2392 <literallayout class="monospaced">
2393 INCLUDE=-I/usr/local/include/db-4.1
2394 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2395 </literallayout>
2396 <para>
2397 There is further detailed discussion about the various DBM libraries in the
2398 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2399 </para>
2400 </section>
2401 <section>
2402 <title>Pre-building configuration</title>
2403 <para>
2404 <indexterm role="concept">
2405 <primary>building Exim</primary>
2406 <secondary>pre-building configuration</secondary>
2407 </indexterm>
2408 <indexterm role="concept">
2409 <primary>configuration for building Exim</primary>
2410 </indexterm>
2411 <indexterm role="concept">
2412 <primary><filename>Local/Makefile</filename></primary>
2413 </indexterm>
2414 <indexterm role="concept">
2415 <primary><filename>src/EDITME</filename></primary>
2416 </indexterm>
2417 Before building Exim, a local configuration file that specifies options
2418 independent of any operating system has to be created with the name
2419 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2420 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2421 therein. These descriptions are therefore not repeated here. If you are
2422 building Exim for the first time, the simplest thing to do is to copy
2423 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2424 </para>
2425 <para>
2426 There are three settings that you must supply, because Exim will not build
2427 without them. They are the location of the run time configuration file
2428 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2429 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2430 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2431 a colon-separated list of file names; Exim uses the first of them that exists.
2432 </para>
2433 <para>
2434 There are a few other parameters that can be specified either at build time or
2435 at run time, to enable the same binary to be used on a number of different
2436 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2437 directory (if not within the spool directory) are fixed, it is recommended that
2438 you specify them in <filename>Local/Makefile</filename> instead of at run time, so that errors
2439 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2440 be logged.
2441 </para>
2442 <para>
2443 <indexterm role="concept">
2444 <primary>content scanning</primary>
2445 <secondary>specifying at build time</secondary>
2446 </indexterm>
2447 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2448 access control lists are not compiled by default. If you want to include these
2449 facilities, you need to set
2450 </para>
2451 <literallayout class="monospaced">
2452 WITH_CONTENT_SCAN=yes
2453 </literallayout>
2454 <para>
2455 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2456 chapter <xref linkend="CHAPexiscan"/>.
2457 </para>
2458 <para>
2459 <indexterm role="concept">
2460 <primary><filename>Local/eximon.conf</filename></primary>
2461 </indexterm>
2462 <indexterm role="concept">
2463 <primary>_exim_monitor/EDITME_</primary>
2464 </indexterm>
2465 If you are going to build the Exim monitor, a similar configuration process is
2466 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2467 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2468 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2469 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2470 </para>
2471 <para>
2472 This is all the configuration that is needed in straightforward cases for known
2473 operating systems. However, the building process is set up so that it is easy
2474 to override options that are set by default or by operating-system-specific
2475 configuration files, for example to change the name of the C compiler, which
2476 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2477 do this.
2478 </para>
2479 </section>
2480 <section>
2481 <title>Support for iconv()</title>
2482 <para>
2483 <indexterm role="concept">
2484 <primary><function>iconv()</function> support</primary>
2485 </indexterm>
2486 <indexterm role="concept">
2487 <primary>RFC 2047</primary>
2488 </indexterm>
2489 The contents of header lines in messages may be encoded according to the rules
2490 described RFC 2047. This makes it possible to transmit characters that are not
2491 in the ASCII character set, and to label them as being in a particular
2492 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2493 mechanism, it decodes them, and translates them into a specified character set
2494 (default ISO-8859-1). The translation is possible only if the operating system
2495 supports the <function>iconv()</function> function.
2496 </para>
2497 <para>
2498 However, some of the operating systems that supply <function>iconv()</function> do not support
2499 very many conversions. The GNU <option>libiconv</option> library (available from
2500 <emphasis role="bold"><ulink url="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2501 systems to remedy this deficiency, as well as on systems that do not supply
2502 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2503 </para>
2504 <literallayout class="monospaced">
2505 HAVE_ICONV=yes
2506 </literallayout>
2507 <para>
2508 to your <filename>Local/Makefile</filename> and rebuild Exim.
2509 </para>
2510 </section>
2511 <section id="SECTinctlsssl">
2512 <title>Including TLS/SSL encryption support</title>
2513 <para>
2514 <indexterm role="concept">
2515 <primary>TLS</primary>
2516 <secondary>including support for TLS</secondary>
2517 </indexterm>
2518 <indexterm role="concept">
2519 <primary>encryption</primary>
2520 <secondary>including support for</secondary>
2521 </indexterm>
2522 <indexterm role="concept">
2523 <primary>SUPPORT_TLS</primary>
2524 </indexterm>
2525 <indexterm role="concept">
2526 <primary>OpenSSL</primary>
2527 <secondary>building Exim with</secondary>
2528 </indexterm>
2529 <indexterm role="concept">
2530 <primary>GnuTLS</primary>
2531 <secondary>building Exim with</secondary>
2532 </indexterm>
2533 Exim can be built to support encrypted SMTP connections, using the STARTTLS
2534 command as per RFC 2487. It can also support legacy clients that expect to
2535 start a TLS session immediately on connection to a non-standard port (see the
2536 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2537 line option).
2538 </para>
2539 <para>
2540 If you want to build Exim with TLS support, you must first install either the
2541 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2542 implementing SSL.
2543 </para>
2544 <para>
2545 If OpenSSL is installed, you should set
2546 </para>
2547 <literallayout class="monospaced">
2548 SUPPORT_TLS=yes
2549 TLS_LIBS=-lssl -lcrypto
2550 </literallayout>
2551 <para>
2552 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2553 OpenSSL library and include files. For example:
2554 </para>
2555 <literallayout class="monospaced">
2556 SUPPORT_TLS=yes
2557 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2558 TLS_INCLUDE=-I/usr/local/openssl/include/
2559 </literallayout>
2560 <para>
2561 <indexterm role="concept">
2562 <primary>USE_GNUTLS</primary>
2563 </indexterm>
2564 If GnuTLS is installed, you should set
2565 </para>
2566 <literallayout class="monospaced">
2567 SUPPORT_TLS=yes
2568 USE_GNUTLS=yes
2569 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2570 </literallayout>
2571 <para>
2572 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2573 library and include files. For example:
2574 </para>
2575 <literallayout class="monospaced">
2576 SUPPORT_TLS=yes
2577 USE_GNUTLS=yes
2578 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2579 TLS_INCLUDE=-I/usr/gnu/include
2580 </literallayout>
2581 <para>
2582 You do not need to set TLS_INCLUDE if the relevant directory is already
2583 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2584 given in chapter <xref linkend="CHAPTLS"/>.
2585 </para>
2586 </section>
2587 <section>
2588 <title>Use of tcpwrappers</title>
2589 <para>
2590 <indexterm role="concept">
2591 <primary>tcpwrappers</primary>
2592 <secondary>building Exim to support</secondary>
2593 </indexterm>
2594 <indexterm role="concept">
2595 <primary>USE_TCP_WRAPPERS</primary>
2596 </indexterm>
2597 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2598 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2599 alternative to Exim&#x2019;s own checking facilities for installations that are
2600 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2601 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2602 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2603 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2604 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2605 you might have
2606 </para>
2607 <literallayout class="monospaced">
2608 USE_TCP_WRAPPERS=yes
2609 CFLAGS=-O -I/usr/local/include
2610 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2611 </literallayout>
2612 <para>
2613 in <filename>Local/Makefile</filename>. The name to use in the <emphasis>tcpwrappers</emphasis> control files is
2614 <quote>exim</quote>. For example, the line
2615 </para>
2616 <literallayout class="monospaced">
2617 exim : LOCAL  192.168.1.  .friendly.domain.example
2618 </literallayout>
2619 <para>
2620 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2621 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2622 All other connections are denied. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2623 further details.
2624 </para>
2625 </section>
2626 <section>
2627 <title>Including support for IPv6</title>
2628 <para>
2629 <indexterm role="concept">
2630 <primary>IPv6</primary>
2631 <secondary>including support for</secondary>
2632 </indexterm>
2633 Exim contains code for use on systems that have IPv6 support. Setting
2634 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2635 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2636 where the IPv6 support is not fully integrated into the normal include and
2637 library files.
2638 </para>
2639 <para>
2640 Two different types of DNS record for handling IPv6 addresses have been
2641 defined. AAAA records (analagous to A records for IPv4) are in use, and are
2642 currently seen as the mainstream. Another record type called A6 was proposed
2643 as better than AAAA because it had more flexibility. However, it was felt to be
2644 over-complex, and its status was reduced to <quote>experimental</quote>. It is not known
2645 if anyone is actually using A6 records. Exim has support for A6 records, but
2646 this is included only if you set <literal>SUPPORT_A6=YES</literal> in <filename>Local/Makefile</filename>. The
2647 support has not been tested for some time.
2648 </para>
2649 </section>
2650 <section>
2651 <title>The building process</title>
2652 <para>
2653 <indexterm role="concept">
2654 <primary>build directory</primary>
2655 </indexterm>
2656 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2657 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2658 operating system types, and creates a build directory if one does not exist.
2659 For example, on a Sun system running Solaris 8, the directory
2660 <filename>build-SunOS5-5.8-sparc</filename> is created.
2661 <indexterm role="concept">
2662 <primary>symbolic link</primary>
2663 <secondary>to source files</secondary>
2664 </indexterm>
2665 Symbolic links to relevant source files are installed in the build directory.
2666 </para>
2667 <para>
2668 <emphasis role="bold">Warning</emphasis>: The <option>-j</option> (parallel) flag must not be used with <emphasis>make</emphasis>; the
2669 building process fails if it is set.
2670 </para>
2671 <para>
2672 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2673 a make file inside the build directory, using the configuration files from the
2674 <filename>Local</filename> directory. The new make file is then passed to another instance of
2675 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2676 then compiling and linking the binaries for the Exim monitor (if configured), a
2677 number of utility programs, and finally Exim itself. The command <literal>make
2678 makefile</literal> can be used to force a rebuild of the make file in the build
2679 directory, should this ever be necessary.
2680 </para>
2681 <para>
2682 If you have problems building Exim, check for any comments there may be in the
2683 <filename>README</filename> file concerning your operating system, and also take a look at the
2684 FAQ, where some common problems are covered.
2685 </para>
2686 </section>
2687 <section>
2688 <title>Output from <quote>make</quote></title>
2689 <para>
2690 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2691 unreadable, because these lines can be very long. For this reason, the normal
2692 output is suppressed by default, and instead output similar to that which
2693 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2694 each module that is being compiled or linked. However, it is still possible to
2695 get the full output, by calling <emphasis>make</emphasis> like this:
2696 </para>
2697 <literallayout class="monospaced">
2698 FULLECHO='' make -e
2699 </literallayout>
2700 <para>
2701 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2702 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2703 given in addition to the the short output.
2704 </para>
2705 </section>
2706 <section id="SECToverride">
2707 <title>Overriding build-time options for Exim</title>
2708 <para>
2709 <indexterm role="concept">
2710 <primary>build-time options</primary>
2711 <secondary>overriding</secondary>
2712 </indexterm>
2713 The main make file that is created at the beginning of the building process
2714 consists of the concatenation of a number of files which set configuration
2715 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2716 more than once, the last setting overrides any previous ones. This provides a
2717 convenient way of overriding defaults. The files that are concatenated are, in
2718 order:
2719 </para>
2720 <literallayout>
2721 <filename>OS/Makefile-Default</filename>
2722 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2723 <filename>Local/Makefile</filename>
2724 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2725 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2726 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2727 <filename>OS/Makefile-Base</filename>
2728 </literallayout>
2729 <para>
2730 <indexterm role="concept">
2731 <primary><filename>Local/Makefile</filename></primary>
2732 </indexterm>
2733 <indexterm role="concept">
2734 <primary>building Exim</primary>
2735 <secondary>operating system type</secondary>
2736 </indexterm>
2737 <indexterm role="concept">
2738 <primary>building Exim</primary>
2739 <secondary>architecture type</secondary>
2740 </indexterm>
2741 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2742 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2743 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2744 and are often not needed.
2745 </para>
2746 <para>
2747 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2748 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2749 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2750 values are used, thereby providing a means of forcing particular settings.
2751 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2752 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2753 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2754 that Exim expects. You can run these scripts directly from the shell in order
2755 to find out what values are being used on your system.
2756 </para>
2757 <para>
2758 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2759 therein. Some (but not all) are mentioned below. If there is something that
2760 needs changing, review the contents of this file and the contents of the make
2761 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2762 default values are.
2763 </para>
2764 <para>
2765 <indexterm role="concept">
2766 <primary>building Exim</primary>
2767 <secondary>overriding default settings</secondary>
2768 </indexterm>
2769 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2770 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2771 need to change the original files. Instead, you should make the changes by
2772 putting the new values in an appropriate <filename>Local</filename> file. For example,
2773 <indexterm role="concept">
2774 <primary>Tru64-Unix build-time settings</primary>
2775 </indexterm>
2776 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2777 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2778 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2779 called with the option <option>-std1</option>, to make it recognize some of the features of
2780 Standard C that Exim uses. (Most other compilers recognize Standard C by
2781 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2782 containing the lines
2783 </para>
2784 <literallayout class="monospaced">
2785 CC=cc
2786 CFLAGS=-std1
2787 </literallayout>
2788 <para>
2789 If you are compiling for just one operating system, it may be easier to put
2790 these lines directly into <filename>Local/Makefile</filename>.
2791 </para>
2792 <para>
2793 Keeping all your local configuration settings separate from the distributed
2794 files makes it easy to transfer them to new versions of Exim simply by copying
2795 the contents of the <filename>Local</filename> directory.
2796 </para>
2797 <para>
2798 <indexterm role="concept">
2799 <primary>NIS lookup type</primary>
2800 <secondary>including support for</secondary>
2801 </indexterm>
2802 <indexterm role="concept">
2803 <primary>NIS+ lookup type</primary>
2804 <secondary>including support for</secondary>
2805 </indexterm>
2806 <indexterm role="concept">
2807 <primary>LDAP</primary>
2808 <secondary>including support for</secondary>
2809 </indexterm>
2810 <indexterm role="concept">
2811 <primary>lookup</primary>
2812 <secondary>inclusion in binary</secondary>
2813 </indexterm>
2814 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2815 lookup, but not all systems have these components installed, so the default is
2816 not to include the relevant code in the binary. All the different kinds of file
2817 and database lookup that Exim supports are implemented as separate code modules
2818 which are included only if the relevant compile-time options are set. In the
2819 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2820 </para>
2821 <literallayout class="monospaced">
2822 LOOKUP_LDAP=yes
2823 LOOKUP_NIS=yes
2824 LOOKUP_NISPLUS=yes
2825 </literallayout>
2826 <para>
2827 and similar settings apply to the other lookup types. They are all listed in
2828 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
2829 libraries need to be installed before compiling Exim.
2830 <indexterm role="concept">
2831 <primary>cdb</primary>
2832 <secondary>including support for</secondary>
2833 </indexterm>
2834 However, there are some optional lookup types (such as cdb) for which
2835 the code is entirely contained within Exim, and no external include
2836 files or libraries are required. When a lookup type is not included in the
2837 binary, attempts to configure Exim to use it cause run time configuration
2838 errors.
2839 </para>
2840 <para>
2841 <indexterm role="concept">
2842 <primary>Perl</primary>
2843 <secondary>including support for</secondary>
2844 </indexterm>
2845 Exim can be linked with an embedded Perl interpreter, allowing Perl
2846 subroutines to be called during string expansion. To enable this facility,
2847 </para>
2848 <literallayout class="monospaced">
2849 EXIM_PERL=perl.o
2850 </literallayout>
2851 <para>
2852 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
2853 chapter <xref linkend="CHAPperl"/>.
2854 </para>
2855 <para>
2856 <indexterm role="concept">
2857 <primary>X11 libraries</primary>
2858 <secondary>location of</secondary>
2859 </indexterm>
2860 The location of the X11 libraries is something that varies a lot between
2861 operating systems, and there may be different versions of X11 to cope
2862 with. Exim itself makes no use of X11, but if you are compiling the Exim
2863 monitor, the X11 libraries must be available.
2864 The following three variables are set in <filename>OS/Makefile-Default</filename>:
2865 </para>
2866 <literallayout class="monospaced">
2867 X11=/usr/X11R6
2868 XINCLUDE=-I$(X11)/include
2869 XLFLAGS=-L$(X11)/lib
2870 </literallayout>
2871 <para>
2872 These are overridden in some of the operating-system configuration files. For
2873 example, in <filename>OS/Makefile-SunOS5</filename> there is
2874 </para>
2875 <literallayout class="monospaced">
2876 X11=/usr/openwin
2877 XINCLUDE=-I$(X11)/include
2878 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
2879 </literallayout>
2880 <para>
2881 If you need to override the default setting for your operating system, place a
2882 definition of all three of these variables into your
2883 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
2884 </para>
2885 <para>
2886 <indexterm role="concept">
2887 <primary>EXTRALIBS</primary>
2888 </indexterm>
2889 If you need to add any extra libraries to the link steps, these can be put in a
2890 variable called EXTRALIBS, which appears in all the link commands, but by
2891 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
2892 command for linking the main Exim binary, and not for any associated utilities.
2893 </para>
2894 <para>
2895 <indexterm role="concept">
2896 <primary>DBM libraries</primary>
2897 <secondary>configuration for building</secondary>
2898 </indexterm>
2899 There is also DBMLIB, which appears in the link commands for binaries that
2900 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
2901 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
2902 binary, and which can be used, for example, to include additional X11
2903 libraries.
2904 </para>
2905 <para>
2906 <indexterm role="concept">
2907 <primary>configuration file</primary>
2908 <secondary>editing</secondary>
2909 </indexterm>
2910 The make file copes with rebuilding Exim correctly if any of the configuration
2911 files are edited. However, if an optional configuration file is deleted, it is
2912 necessary to touch the associated non-optional file (that is,
2913 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
2914 </para>
2915 </section>
2916 <section>
2917 <title>OS-specific header files</title>
2918 <para>
2919 <indexterm role="concept">
2920 <primary><filename>os.h</filename></primary>
2921 </indexterm>
2922 <indexterm role="concept">
2923 <primary>building Exim</primary>
2924 <secondary>OS-specific C header files</secondary>
2925 </indexterm>
2926 The <filename>OS</filename> directory contains a number of files with names of the form
2927 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
2928 normally need to be changed. There is a list of macro settings that are
2929 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
2930 are porting Exim to a new operating system.
2931 </para>
2932 </section>
2933 <section>
2934 <title>Overriding build-time options for the monitor</title>
2935 <para>
2936 <indexterm role="concept">
2937 <primary>building Eximon</primary>
2938 <secondary>overriding default options</secondary>
2939 </indexterm>
2940 A similar process is used for overriding things when building the Exim monitor,
2941 where the files that are involved are
2942 </para>
2943 <literallayout>
2944 <filename>OS/eximon.conf-Default</filename>
2945 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2946 <filename>Local/eximon.conf</filename>
2947 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2948 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2949 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2950 </literallayout>
2951 <para>
2952 <indexterm role="concept">
2953 <primary><filename>Local/eximon.conf</filename></primary>
2954 </indexterm>
2955 As with Exim itself, the final three files need not exist, and in this case the
2956 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
2957 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
2958 variables of the same name, preceded by EXIMON_. For example, setting
2959 EXIMON_LOG_DEPTH in the environment overrides the value of
2960 LOG_DEPTH at run time.
2961 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
2962 </para>
2963 </section>
2964 <section>
2965 <title>Installing Exim binaries and scripts</title>
2966 <para>
2967 <indexterm role="concept">
2968 <primary>installing Exim</primary>
2969 </indexterm>
2970 <indexterm role="concept">
2971 <primary>BIN_DIRECTORY</primary>
2972 </indexterm>
2973 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
2974 arguments. The script copies binaries and utility scripts into the directory
2975 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
2976 <indexterm role="concept">
2977 <primary>setuid</primary>
2978 <secondary>installing Exim with</secondary>
2979 </indexterm>
2980 The install script copies files only if they are newer than the files they are
2981 going to replace. The Exim binary is required to be owned by root and have the
2982 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
2983 install</literal> as root so that it can set up the Exim binary in this way. However, in
2984 some special situations (for example, if a host is doing no local deliveries)
2985 it may be possible to run Exim without making the binary setuid root (see
2986 chapter <xref linkend="CHAPsecurity"/> for details).
2987 </para>
2988 <para>
2989 <indexterm role="concept">
2990 <primary>CONFIGURE_FILE</primary>
2991 </indexterm>
2992 Exim&#x2019;s run time configuration file is named by the CONFIGURE_FILE setting
2993 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
2994 exist, the default configuration file <filename>src/configure.default</filename> is copied there
2995 by the installation script. If a run time configuration file already exists, it
2996 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
2997 alternative files, no default is installed.
2998 </para>
2999 <para>
3000 <indexterm role="concept">
3001 <primary>system aliases file</primary>
3002 </indexterm>
3003 <indexterm role="concept">
3004 <primary><filename>/etc/aliases</filename></primary>
3005 </indexterm>
3006 One change is made to the default configuration file when it is installed: the
3007 default configuration contains a router that references a system aliases file.
3008 The path to this file is set to the value specified by
3009 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3010 If the system aliases file does not exist, the installation script creates it,
3011 and outputs a comment to the user.
3012 </para>
3013 <para>
3014 The created file contains no aliases, but it does contain comments about the
3015 aliases a site should normally have. Mail aliases have traditionally been
3016 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3017 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3018 Exim&#x2019;s configuration if necessary.
3019 </para>
3020 <para>
3021 The default configuration uses the local host&#x2019;s name as the only local domain,
3022 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3023 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3024 directories are supported, but no NIS or NIS+ support is configured. Domains
3025 other than the name of the local host are routed using the DNS, with delivery
3026 over SMTP.
3027 </para>
3028 <para>
3029 It is possible to install Exim for special purposes (such as building a binary
3030 distribution) in a private part of the file system. You can do this by a
3031 command such as
3032 </para>
3033 <literallayout class="monospaced">
3034 make DESTDIR=/some/directory/ install
3035 </literallayout>
3036 <para>
3037 This has the effect of pre-pending the specified directory to all the file
3038 paths, except the name of the system aliases file that appears in the default
3039 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3040 For backwards compatibility, ROOT is used if DESTDIR is not set,
3041 but this usage is deprecated.
3042 </para>
3043 <para>
3044 <indexterm role="concept">
3045 <primary>installing Exim</primary>
3046 <secondary>what is not installed</secondary>
3047 </indexterm>
3048 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3049 <emphasis>convert4r4</emphasis>, or the <emphasis>pcretest</emphasis> test program. You will probably run the
3050 first of these only once (if you are upgrading from Exim 3), and the second
3051 isn&#x2019;t really part of Exim. None of the documentation files in the <filename>doc</filename>
3052 directory are copied, except for the info files when you have set
3053 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3054 </para>
3055 <para>
3056 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3057 to their names. The Exim binary itself, however, is handled differently. It is
3058 installed under a name that includes the version number and the compile number,
3059 for example <filename>exim-4.63-1</filename>. The script then arranges for a symbolic link
3060 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3061 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3062 from the directory (as seen by other processes).
3063 </para>
3064 <para>
3065 <indexterm role="concept">
3066 <primary>installing Exim</primary>
3067 <secondary>testing the script</secondary>
3068 </indexterm>
3069 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3070 real, you can pass the <option>-n</option> option to the installation script by this
3071 command:
3072 </para>
3073 <literallayout class="monospaced">
3074 make INSTALL_ARG=-n install
3075 </literallayout>
3076 <para>
3077 The contents of the variable INSTALL_ARG are passed to the installation
3078 script. You do not need to be root to run this test. Alternatively, you can run
3079 the installation script directly, but this must be from within the build
3080 directory. For example, from the top-level Exim directory you could use this
3081 command:
3082 </para>
3083 <literallayout class="monospaced">
3084 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3085 </literallayout>
3086 <para>
3087 <indexterm role="concept">
3088 <primary>installing Exim</primary>
3089 <secondary>install script options</secondary>
3090 </indexterm>
3091 There are two other options that can be supplied to the installation script.
3092 </para>
3093 <itemizedlist>
3094 <listitem>
3095 <para>
3096 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3097 to root, and the call to make it a setuid binary.
3098 </para>
3099 </listitem>
3100 <listitem>
3101 <para>
3102 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3103 installed binary.
3104 </para>
3105 </listitem>
3106 </itemizedlist>
3107 <para>
3108 INSTALL_ARG can be used to pass these options to the script. For example:
3109 </para>
3110 <literallayout class="monospaced">
3111 make INSTALL_ARG=-no_symlink install
3112 </literallayout>
3113 <para>
3114 The installation script can also be given arguments specifying which files are
3115 to be copied. For example, to install just the Exim binary, and nothing else,
3116 without creating the symbolic link, you could use:
3117 </para>
3118 <literallayout class="monospaced">
3119 make INSTALL_ARG='-no_symlink exim' install
3120 </literallayout>
3121 </section>
3122 <section id="SECTinsinfdoc">
3123 <title>Installing info documentation</title>
3124 <para>
3125 <indexterm role="concept">
3126 <primary>installing Exim</primary>
3127 <secondary><emphasis>info</emphasis> documentation</secondary>
3128 </indexterm>
3129 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3130 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3131 distribution. Instead it is available separately from the ftp site (see section
3132 <xref linkend="SECTavail"/>).
3133 </para>
3134 <para>
3135 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3136 source of the documentation is found in the source tree, running <literal>make
3137 install</literal> automatically builds the info files and installs them.
3138 </para>
3139 </section>
3140 <section>
3141 <title>Setting up the spool directory</title>
3142 <para>
3143 <indexterm role="concept">
3144 <primary>spool directory</primary>
3145 <secondary>creating</secondary>
3146 </indexterm>
3147 When it starts up, Exim tries to create its spool directory if it does not
3148 exist. The Exim uid and gid are used for the owner and group of the spool
3149 directory. Sub-directories are automatically created in the spool directory as
3150 necessary.
3151 </para>
3152 </section>
3153 <section>
3154 <title>Testing</title>
3155 <para>
3156 <indexterm role="concept">
3157 <primary>testing</primary>
3158 <secondary>installation</secondary>
3159 </indexterm>
3160 Having installed Exim, you can check that the run time configuration file is
3161 syntactically valid by running the following command, which assumes that the
3162 Exim binary directory is within your PATH environment variable:
3163 </para>
3164 <literallayout class="monospaced">
3165 exim -bV
3166 </literallayout>
3167 <para>
3168 If there are any errors in the configuration file, Exim outputs error messages.
3169 Otherwise it outputs the version number and build date,
3170 the DBM library that is being used, and information about which drivers and
3171 other optional code modules are included in the binary.
3172 Some simple routing tests can be done by using the address testing option. For
3173 example,
3174 </para>
3175 <literallayout>
3176 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3177 </literallayout>
3178 <para>
3179 should verify that it recognizes a local mailbox, and
3180 </para>
3181 <literallayout>
3182 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3183 </literallayout>
3184 <para>
3185 a remote one. Then try getting it to deliver mail, both locally and remotely.
3186 This can be done by passing messages directly to Exim, without going through a
3187 user agent. For example:
3188 </para>
3189 <literallayout class="monospaced">
3190 exim -v postmaster@your.domain.example
3191 From: user@your.domain.example
3192 To: postmaster@your.domain.example
3193 Subject: Testing Exim
3194
3195 This is a test message.
3196 ^D
3197 </literallayout>
3198 <para>
3199 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3200 In this case you should see copies of three log lines, one for the message&#x2019;s
3201 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3202 </para>
3203 <para>
3204 <indexterm role="concept">
3205 <primary>delivery</primary>
3206 <secondary>problems with</secondary>
3207 </indexterm>
3208 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3209 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3210 of information is running Exim with debugging turned on, by specifying the
3211 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3212 with debugging turned on by a command of the form
3213 </para>
3214 <literallayout>
3215 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3216 </literallayout>
3217 <para>
3218 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3219 produces rather a lot of output, but you can cut this down to specific areas.
3220 For example, if you use <option>-d-all+route</option> only the debugging information
3221 relevant to routing is included. (See the <option>-d</option> option in chapter
3222 <xref linkend="CHAPcommandline"/> for more details.)
3223 </para>
3224 <para>
3225 <indexterm role="concept">
3226 <primary><quote>sticky</quote> bit</primary>
3227 </indexterm>
3228 <indexterm role="concept">
3229 <primary>lock files</primary>
3230 </indexterm>
3231 One specific problem that has shown up on some sites is the inability to do
3232 local deliveries into a shared mailbox directory, because it does not have the
3233 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3234 writing to a mailbox file, and if it cannot create the lock file, the delivery
3235 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3236 directory, or by setting a specific group for local deliveries and allowing
3237 that group to create files in the directory (see the comments above the
3238 <command>local_delivery</command> transport in the default configuration file). Another
3239 approach is to configure Exim not to use lock files, but just to rely on
3240 <function>fcntl()</function> locking instead. However, you should do this only if all user
3241 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3242 see chapter <xref linkend="CHAPappendfile"/>.
3243 </para>
3244 <para>
3245 One thing that cannot be tested on a system that is already running an MTA is
3246 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3247 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3248 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3249 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3250 incoming SMTP mail.
3251 </para>
3252 <para>
3253 Testing a new version on a system that is already running Exim can most easily
3254 be done by building a binary with a different CONFIGURE_FILE setting. From
3255 within the run time configuration, all other file and directory names
3256 that Exim uses can be altered, in order to keep it entirely clear of the
3257 production version.
3258 </para>
3259 </section>
3260 <section>
3261 <title>Replacing another MTA with Exim</title>
3262 <para>
3263 <indexterm role="concept">
3264 <primary>replacing another MTA</primary>
3265 </indexterm>
3266 Building and installing Exim for the first time does not of itself put it in
3267 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3268 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3269 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3270 binary in order to get the user agents to pass messages to Exim. This is
3271 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3272 or <filename>/usr/lib/sendmail</filename>
3273 <indexterm role="concept">
3274 <primary>symbolic link</primary>
3275 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3276 </indexterm>
3277 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3278 privilege and executable status from the old MTA. It is then necessary to stop
3279 and restart the mailer daemon, if one is running.
3280 </para>
3281 <para>
3282 <indexterm role="concept">
3283 <primary>FreeBSD</primary>
3284 <secondary>MTA indirection</secondary>
3285 </indexterm>
3286 <indexterm role="concept">
3287 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3288 </indexterm>
3289 Some operating systems have introduced alternative ways of switching MTAs. For
3290 example, if you are running FreeBSD, you need to edit the file
3291 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3292 described. A typical example of the contents of this file for running Exim is
3293 as follows:
3294 </para>
3295 <literallayout class="monospaced">
3296 sendmail            /usr/exim/bin/exim
3297 send-mail           /usr/exim/bin/exim
3298 mailq               /usr/exim/bin/exim -bp
3299 newaliases          /usr/bin/true
3300 </literallayout>
3301 <para>
3302 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3303 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3304 favourite user agent.
3305 </para>
3306 <para>
3307 You should consider what to tell your users about the change of MTA. Exim may
3308 have different capabilities to what was previously running, and there are
3309 various operational differences such as the text of messages produced by
3310 command line options and in bounce messages. If you allow your users to make
3311 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3312 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3313 </para>
3314 </section>
3315 <section>
3316 <title>Upgrading Exim</title>
3317 <para>
3318 <indexterm role="concept">
3319 <primary>upgrading Exim</primary>
3320 </indexterm>
3321 If you are already running Exim on your host, building and installing a new
3322 version automatically makes it available to MUAs, or any other programs that
3323 call the MTA directly. However, if you are running an Exim daemon, you do need
3324 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3325 new binary. You do not need to stop processing mail in order to install a new
3326 version of Exim. The install script does not modify an existing runtime
3327 configuration file.
3328 </para>
3329 </section>
3330 <section>
3331 <title>Stopping the Exim daemon on Solaris</title>
3332 <para>
3333 <indexterm role="concept">
3334 <primary>Solaris</primary>
3335 <secondary>stopping Exim on</secondary>
3336 </indexterm>
3337 The standard command for stopping the mailer daemon on Solaris is
3338 </para>
3339 <literallayout class="monospaced">
3340 /etc/init.d/sendmail stop
3341 </literallayout>
3342 <para>
3343 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3344 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3345 for the text <quote>sendmail</quote>; this is not present because the actual program name
3346 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3347 solution is to replace the line that finds the process id with something like
3348 </para>
3349 <literallayout class="monospaced">
3350 pid=`cat /var/spool/exim/exim-daemon.pid`
3351 </literallayout>
3352 <para>
3353 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3354 </para>
3355 <para>
3356 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3357 still be received from local processes, and if automatic delivery is configured
3358 (the normal case), deliveries will still occur.
3359 </para>
3360 </section>
3361 </chapter>
3362
3363 <chapter id="CHAPcommandline">
3364 <title>The Exim command line</title>
3365 <para>
3366 <indexterm role="concept" id="IIDclo1" class="startofrange">
3367 <primary>command line</primary>
3368 <secondary>options</secondary>
3369 </indexterm>
3370 <indexterm role="concept" id="IIDclo2" class="startofrange">
3371 <primary>options</primary>
3372 <secondary>command line</secondary>
3373 </indexterm>
3374 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3375 each starting with a hyphen character, followed by a number of arguments. The
3376 options are compatible with the main options of Sendmail, and there are also
3377 some additional options, some of which are compatible with Smail 3. Certain
3378 combinations of options do not make sense, and provoke an error if used.
3379 The form of the arguments depends on which options are set.
3380 </para>
3381 <section>
3382 <title>Setting options by program name</title>
3383 <para>
3384 <indexterm role="concept">
3385 <primary><emphasis>mailq</emphasis></primary>
3386 </indexterm>
3387 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3388 were present before any other options.
3389 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3390 standard output.
3391 This feature is for compatibility with some systems that contain a command of
3392 that name in one of the standard libraries, symbolically linked to
3393 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3394 </para>
3395 <para>
3396 <indexterm role="concept">
3397 <primary><emphasis>rsmtp</emphasis></primary>
3398 </indexterm>
3399 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3400 were present before any other options, for compatibility with Smail. The
3401 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3402 format.
3403 </para>
3404 <para>
3405 <indexterm role="concept">
3406 <primary><emphasis>rmail</emphasis></primary>
3407 </indexterm>
3408 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3409 <option>-oee</option> options were present before any other options, for compatibility with
3410 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3411 </para>
3412 <para>
3413 <indexterm role="concept">
3414 <primary><emphasis>runq</emphasis></primary>
3415 </indexterm>
3416 <indexterm role="concept">
3417 <primary>queue runner</primary>
3418 </indexterm>
3419 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3420 were present before any other options, for compatibility with Smail. The <option>-q</option>
3421 option causes a single queue runner process to be started.
3422 </para>
3423 <para>
3424 <indexterm role="concept">
3425 <primary><emphasis>newaliases</emphasis></primary>
3426 </indexterm>
3427 <indexterm role="concept">
3428 <primary>alias file</primary>
3429 <secondary>building</secondary>
3430 </indexterm>
3431 <indexterm role="concept">
3432 <primary>Sendmail compatibility</primary>
3433 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3434 </indexterm>
3435 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3436 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3437 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3438 the concept of a single alias file, but can be configured to run a given
3439 command if called with the <option>-bi</option> option.
3440 </para>
3441 </section>
3442 <section id="SECTtrustedadmin">
3443 <title>Trusted and admin users</title>
3444 <para>
3445 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3446 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3447 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3448 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3449 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3450 </para>
3451 <itemizedlist>
3452 <listitem>
3453 <para>
3454 <indexterm role="concept">
3455 <primary>trusted user</primary>
3456 <secondary>definition of</secondary>
3457 </indexterm>
3458 <indexterm role="concept">
3459 <primary>user</primary>
3460 <secondary>trusted definition of</secondary>
3461 </indexterm>
3462 The trusted users are root, the Exim user, any user listed in the
3463 <option>trusted_users</option> configuration option, and any user whose current group or any
3464 supplementary group is one of those listed in the <option>trusted_groups</option>
3465 configuration option. Note that the Exim group is not automatically trusted.
3466 </para>
3467 <para>
3468 <indexterm role="concept">
3469 <primary><quote>From</quote> line</primary>
3470 </indexterm>
3471 <indexterm role="concept">
3472 <primary>envelope sender</primary>
3473 </indexterm>
3474 Trusted users are always permitted to use the <option>-f</option> option or a leading
3475 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3476 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3477 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3478 users to set envelope senders.
3479 </para>
3480 <para>
3481 <indexterm role="concept">
3482 <primary><emphasis>From:</emphasis> header line</primary>
3483 </indexterm>
3484 <indexterm role="concept">
3485 <primary><emphasis>Sender:</emphasis> header line</primary>
3486 </indexterm>
3487 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3488 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3489 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3490 </para>
3491 <para>
3492 Trusted users may also specify a host name, host address, interface address,
3493 protocol name, ident value, and authentication data when submitting a message
3494 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3495 have the characteristics of messages received from a remote host. Untrusted
3496 users may in some circumstances use <option>-f</option>, but can never set the other values
3497 that are available to trusted users.
3498 </para>
3499 </listitem>
3500 <listitem>
3501 <para>
3502 <indexterm role="concept">
3503 <primary>user</primary>
3504 <secondary>admin definition of</secondary>
3505 </indexterm>
3506 <indexterm role="concept">
3507 <primary>admin user</primary>
3508 <secondary>definition of</secondary>
3509 </indexterm>
3510 The admin users are root, the Exim user, and any user that is a member of the
3511 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3512 The current group does not have to be one of these groups.
3513 </para>
3514 <para>
3515 Admin users are permitted to list the queue, and to carry out certain
3516 operations on messages, for example, to force delivery failures. It is also
3517 necessary to be an admin user in order to see the full information provided by
3518 the Exim monitor, and full debugging output.
3519 </para>
3520 <para>
3521 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3522 Exim to attempt delivery of messages on its queue is restricted to admin users.
3523 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3524 option false (that is, specifying <option>no_prod_requires_admin</option>).
3525 </para>
3526 <para>
3527 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3528 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3529 false.
3530 </para>
3531 </listitem>
3532 </itemizedlist>
3533 <para>
3534 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3535 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3536 getting root. There is further discussion of this issue at the start of chapter
3537 <xref linkend="CHAPconf"/>.
3538 </para>
3539 </section>
3540 <section>
3541 <title>Command line options</title>
3542 <para revisionflag="changed">
3543 Exim&#x2019;s command line options are described in alphabetical order below. If none
3544 of the options that specifies a specific action (such as starting the daemon or
3545 a queue runner, or testing an address, or receiving a message in a specific
3546 format, or listing the queue) are present, and there is at least one argument
3547 on the command line, <option>-bm</option> (accept a local message on the standard input,
3548 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3549 outputs a brief message about itself and exits.
3550 </para>
3551 <!-- === Start of command line options === -->
3552 <variablelist>
3553 <varlistentry>
3554 <term><option>--</option></term>
3555 <listitem>
3556 <para>
3557 <indexterm role="option">
3558 <primary>--</primary>
3559 </indexterm>
3560 <indexterm role="concept">
3561 <primary>options</primary>
3562 <secondary>command line; terminating</secondary>
3563 </indexterm>
3564 This is a pseudo-option whose only purpose is to terminate the options and
3565 therefore to cause subsequent command line items to be treated as arguments
3566 rather than options, even if they begin with hyphens.
3567 </para>
3568 </listitem></varlistentry>
3569 <varlistentry>
3570 <term><option>--help</option></term>
3571 <listitem>
3572 <para>
3573 <indexterm role="option">
3574 <primary><option>--help</option></primary>
3575 </indexterm>
3576 This option causes Exim to output a few sentences stating what it is.
3577 The same output is generated if the Exim binary is called with no options and
3578 no arguments.
3579 </para>
3580 </listitem></varlistentry>
3581 <varlistentry>
3582 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3583 <listitem>
3584 <para>
3585 <indexterm role="option">
3586 <primary><option>-B</option></primary>
3587 </indexterm>
3588 <indexterm role="concept">
3589 <primary>8-bit characters</primary>
3590 </indexterm>
3591 <indexterm role="concept">
3592 <primary>Sendmail compatibility</primary>
3593 <secondary>8-bit characters</secondary>
3594 </indexterm>
3595 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3596 clean; it ignores this option.
3597 </para>
3598 </listitem></varlistentry>
3599 <varlistentry>
3600 <term><option>-bd</option></term>
3601 <listitem>
3602 <para>
3603 <indexterm role="option">
3604 <primary><option>-bd</option></primary>
3605 </indexterm>
3606 <indexterm role="concept">
3607 <primary>daemon</primary>
3608 </indexterm>
3609 <indexterm role="concept">
3610 <primary>SMTP listener</primary>
3611 </indexterm>
3612 <indexterm role="concept">
3613 <primary>queue runner</primary>
3614 </indexterm>
3615 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3616 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3617 that the daemon should also initiate periodic queue runs.
3618 </para>
3619 <para>
3620 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3621 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3622 disconnect from the controlling terminal. When running this way, it can be
3623 stopped by pressing ctrl-C.
3624 </para>
3625 <para>
3626 By default, Exim listens for incoming connections to the standard SMTP port on
3627 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3628 ports, on multiple ports, and only on specific interfaces. Chapter
3629 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3630 </para>
3631 <para>
3632 When a listening daemon
3633 <indexterm role="concept">
3634 <primary>daemon</primary>
3635 <secondary>process id (pid)</secondary>
3636 </indexterm>
3637 <indexterm role="concept">
3638 <primary>pid (process id)</primary>
3639 <secondary>of daemon</secondary>
3640 </indexterm>
3641 is started without the use of <option>-oX</option> (that is, without overriding the normal
3642 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3643 in Exim&#x2019;s spool directory. This location can be overridden by setting
3644 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3645 running as root.
3646 </para>
3647 <para>
3648 When <option>-oX</option> is used on the command line to start a listening daemon, the
3649 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3650 used to specify a path on the command line if a pid file is required.
3651 </para>
3652 <para>
3653 The SIGHUP signal
3654 <indexterm role="concept">
3655 <primary>SIGHUP</primary>
3656 </indexterm>
3657 can be used to cause the daemon to re-exec itself. This should be done whenever
3658 Exim&#x2019;s configuration file, or any file that is incorporated into it by means of
3659 the <option>.include</option> facility, is changed, and also whenever a new version of Exim
3660 is installed. It is not necessary to do this when other files that are
3661 referenced from the configuration (for example, alias files) are changed,
3662 because these are reread each time they are used.
3663 </para>
3664 </listitem></varlistentry>
3665 <varlistentry>
3666 <term><option>-bdf</option></term>
3667 <listitem>
3668 <para>
3669 <indexterm role="option">
3670 <primary><option>-bdf</option></primary>
3671 </indexterm>
3672 This option has the same effect as <option>-bd</option> except that it never disconnects
3673 from the controlling terminal, even when no debugging is specified.
3674 </para>
3675 </listitem></varlistentry>
3676 <varlistentry>
3677 <term><option>-be</option></term>
3678 <listitem>
3679 <para>
3680 <indexterm role="option">
3681 <primary><option>-be</option></primary>
3682 </indexterm>
3683 <indexterm role="concept">
3684 <primary>testing</primary>
3685 <secondary>string expansion</secondary>
3686 </indexterm>
3687 <indexterm role="concept">
3688 <primary>expansion</primary>
3689 <secondary>testing</secondary>
3690 </indexterm>
3691 Run Exim in expansion testing mode. Exim discards its root privilege, to
3692 prevent ordinary users from using this mode to read otherwise inaccessible
3693 files. If no arguments are given, Exim runs interactively, prompting for lines
3694 of data. Otherwise, it processes each argument in turn.
3695 </para>
3696 <para>
3697 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3698 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3699 used without command line arguments. If successful, it uses the <function>readline()</function>
3700 function, which provides extensive line-editing facilities, for reading the
3701 test data. A line history is supported.
3702 </para>
3703 <para>
3704 Long expansion expressions can be split over several lines by using backslash
3705 continuations. As in Exim&#x2019;s run time configuration, white space at the start of
3706 continuation lines is ignored. Each argument or data line is passed through the
3707 string expansion mechanism, and the result is output. Variable values from the
3708 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
3709 message-specific values (such as <varname>$domain</varname>) are set, because no message is
3710 being processed.
3711 </para>
3712 <para>
3713 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
3714 files or databases you are using, you must exit and restart Exim before trying
3715 the same lookup again. Otherwise, because each Exim process caches the results
3716 of lookups, you will just get the same result as before.
3717 </para>
3718 </listitem></varlistentry>
3719 <varlistentry>
3720 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3721 <listitem>
3722 <para>
3723 <indexterm role="option">
3724 <primary><option>-bF</option></primary>
3725 </indexterm>
3726 <indexterm role="concept">
3727 <primary>system filter</primary>
3728 <secondary>testing</secondary>
3729 </indexterm>
3730 <indexterm role="concept">
3731 <primary>testing</primary>
3732 <secondary>system filter</secondary>
3733 </indexterm>
3734 This option is the same as <option>-bf</option> except that it assumes that the filter being
3735 tested is a system filter. The additional commands that are available only in
3736 system filters are recognized.
3737 </para>
3738 </listitem></varlistentry>
3739 <varlistentry>
3740 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
3741 <listitem>
3742 <para>
3743 <indexterm role="option">
3744 <primary><option>-bf</option></primary>
3745 </indexterm>
3746 <indexterm role="concept">
3747 <primary>filter</primary>
3748 <secondary>testing</secondary>
3749 </indexterm>
3750 <indexterm role="concept">
3751 <primary>testing</primary>
3752 <secondary>filter file</secondary>
3753 </indexterm>
3754 <indexterm role="concept">
3755 <primary>forward file</primary>
3756 <secondary>testing</secondary>
3757 </indexterm>
3758 <indexterm role="concept">
3759 <primary>testing</primary>
3760 <secondary>forward file</secondary>
3761 </indexterm>
3762 <indexterm role="concept">
3763 <primary>Sieve filter</primary>
3764 <secondary>testing</secondary>
3765 </indexterm>
3766 This option runs Exim in user filter testing mode; the file is the filter file
3767 to be tested, and a test message must be supplied on the standard input. If
3768 there are no message-dependent tests in the filter, an empty file can be
3769 supplied.
3770 </para>
3771 <para>
3772 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
3773 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
3774 filter and a user filter in the same run. For example:
3775 </para>
3776 <literallayout class="monospaced">
3777 exim -bF /system/filter -bf /user/filter &lt;/test/message
3778 </literallayout>
3779 <para>
3780 This is helpful when the system filter adds header lines or sets filter
3781 variables that are used by the user filter.
3782 </para>
3783 <para>
3784 If the test filter file does not begin with one of the special lines
3785 </para>
3786 <literallayout class="monospaced">
3787 # Exim filter
3788 # Sieve filter
3789 </literallayout>
3790 <para>
3791 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
3792 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
3793 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
3794 redirection lists.
3795 </para>
3796 <para>
3797 The result of an Exim command that uses <option>-bf</option>, provided no errors are
3798 detected, is a list of the actions that Exim would try to take if presented
3799 with the message for real. More details of filter testing are given in the
3800 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
3801 </para>
3802 <para>
3803 When testing a filter file,
3804 <indexterm role="concept">
3805 <primary><quote>From</quote> line</primary>
3806 </indexterm>
3807 <indexterm role="concept">
3808 <primary>envelope sender</primary>
3809 </indexterm>
3810 <indexterm role="concept">
3811 <primary><option>-f</option> option</primary>
3812 <secondary>for filter testing</secondary>
3813 </indexterm>
3814 the envelope sender can be set by the <option>-f</option> option,
3815 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
3816 that would normally be taken from the envelope recipient address of the message
3817 can be set by means of additional command line options (see the next four
3818 options).
3819 </para>
3820 </listitem></varlistentry>
3821 <varlistentry>
3822 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
3823 <listitem>
3824 <para>
3825 <indexterm role="option">
3826 <primary><option>-bfd</option></primary>
3827 </indexterm>
3828 <indexterm role="concept">
3829 <primary><varname>$qualify_domain</varname></primary>
3830 </indexterm>
3831 This sets the domain of the recipient address when a filter file is being
3832 tested by means of the <option>-bf</option> option. The default is the value of
3833 <varname>$qualify_domain</varname>.
3834 </para>
3835 </listitem></varlistentry>
3836 <varlistentry>
3837 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
3838 <listitem>
3839 <para>
3840 <indexterm role="option">
3841 <primary><option>-bfl</option></primary>
3842 </indexterm>
3843 This sets the local part of the recipient address when a filter file is being
3844 tested by means of the <option>-bf</option> option. The default is the username of the
3845 process that calls Exim. A local part should be specified with any prefix or
3846 suffix stripped, because that is how it appears to the filter when a message is
3847 actually being delivered.
3848 </para>
3849 </listitem></varlistentry>
3850 <varlistentry>
3851 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
3852 <listitem>
3853 <para>
3854 <indexterm role="option">
3855 <primary><option>-bfp</option></primary>
3856 </indexterm>
3857 This sets the prefix of the local part of the recipient address when a filter
3858 file is being tested by means of the <option>-bf</option> option. The default is an empty
3859 prefix.
3860 </para>
3861 </listitem></varlistentry>
3862 <varlistentry>
3863 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
3864 <listitem>
3865 <para>
3866 <indexterm role="option">
3867 <primary><option>-bfs</option></primary>
3868 </indexterm>
3869 This sets the suffix of the local part of the recipient address when a filter
3870 file is being tested by means of the <option>-bf</option> option. The default is an empty
3871 suffix.
3872 </para>
3873 </listitem></varlistentry>
3874 <varlistentry>
3875 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3876 <listitem>
3877 <para>
3878 <indexterm role="option">
3879 <primary><option>-bh</option></primary>
3880 </indexterm>
3881 <indexterm role="concept">
3882 <primary>testing</primary>
3883 <secondary>incoming SMTP</secondary>
3884 </indexterm>
3885 <indexterm role="concept">
3886 <primary>SMTP</primary>
3887 <secondary>testing incoming</secondary>
3888 </indexterm>
3889 <indexterm role="concept">
3890 <primary>testing</primary>
3891 <secondary>relay control</secondary>
3892 </indexterm>
3893 <indexterm role="concept">
3894 <primary>relaying</primary>
3895 <secondary>testing configuration</secondary>
3896 </indexterm>
3897 <indexterm role="concept">
3898 <primary>policy control</primary>
3899 <secondary>testing</secondary>
3900 </indexterm>
3901 <indexterm role="concept">
3902 <primary>debugging</primary>
3903 <secondary><option>-bh</option> option</secondary>
3904 </indexterm>
3905 This option runs a fake SMTP session as if from the given IP address, using the
3906 standard input and output. The IP address may include a port number at the end,
3907 after a full stop. For example:
3908 </para>
3909 <literallayout class="monospaced">
3910 exim -bh 10.9.8.7.1234
3911 exim -bh fe80::a00:20ff:fe86:a061.5678
3912 </literallayout>
3913 <para>
3914 When an IPv6 address is given, it is converted into canonical form. In the case
3915 of the second example above, the value of <varname>$sender_host_address</varname> after
3916 conversion to the canonical form is
3917 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
3918 </para>
3919 <para>
3920 Comments as to what is going on are written to the standard error file. These
3921 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
3922 This facility is provided for testing configuration options for incoming
3923 messages, to make sure they implement the required policy. For example, you can
3924 test your relay controls using <option>-bh</option>.
3925 </para>
3926 <para>
3927 <emphasis role="bold">Warning 1</emphasis>:
3928 <indexterm role="concept">
3929 <primary>RFC 1413</primary>
3930 </indexterm>
3931 </para>
3932 <para revisionflag="changed">
3933 You can test features of the configuration that rely on ident (RFC 1413)
3934 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
3935 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
3936 connection.
3937 </para>
3938 <para>
3939 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
3940 are also skipped when testing using <option>-bh</option>. If you want these callouts to
3941 occur, use <option>-bhc</option> instead.
3942 </para>
3943 <para revisionflag="changed">
3944 Messages supplied during the testing session are discarded, and nothing is
3945 written to any of the real log files. There may be pauses when DNS (and other)
3946 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
3947 can be used to specify a specific IP interface and port if this is important,
3948 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
3949 session were authenticated.
3950 </para>
3951 <para>
3952 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
3953 output just states whether a given recipient address from a given host is
3954 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
3955 </para>
3956 </listitem></varlistentry>
3957 <varlistentry>
3958 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
3959 <listitem>
3960 <para>
3961 <indexterm role="option">
3962 <primary><option>-bhc</option></primary>
3963 </indexterm>
3964 This option operates in the same way as <option>-bh</option>, except that address
3965 verification callouts are performed if required. This includes consulting and
3966 updating the callout cache database.
3967 </para>
3968 </listitem></varlistentry>
3969 <varlistentry>
3970 <term><option>-bi</option></term>
3971 <listitem>
3972 <para>
3973 <indexterm role="option">
3974 <primary><option>-bi</option></primary>
3975 </indexterm>
3976 <indexterm role="concept">
3977 <primary>alias file</primary>
3978 <secondary>building</secondary>
3979 </indexterm>
3980 <indexterm role="concept">
3981 <primary>building alias file</primary>
3982 </indexterm>
3983 <indexterm role="concept">
3984 <primary>Sendmail compatibility</primary>
3985 <secondary><option>-bi</option> option</secondary>
3986 </indexterm>
3987 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
3988 Exim does not have the concept of a single alias file, and so it cannot mimic
3989 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
3990 tend to appear in various scripts such as NIS make files, so the option must be
3991 recognized.
3992 </para>
3993 <para>
3994 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
3995 configuration option is run, under the uid and gid of the caller of Exim. If
3996 the <option>-oA</option> option is used, its value is passed to the command as an argument.
3997 The command set by <option>bi_command</option> may not contain arguments. The command can
3998 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
3999 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4000 <option>-bi</option> is a no-op.
4001 </para>
4002 </listitem></varlistentry>
4003 <varlistentry>
4004 <term><option>-bm</option></term>
4005 <listitem>
4006 <para>
4007 <indexterm role="option">
4008 <primary><option>-bm</option></primary>
4009 </indexterm>
4010 <indexterm role="concept">
4011 <primary>local message reception</primary>
4012 </indexterm>
4013 This option runs an Exim receiving process that accepts an incoming,
4014 locally-generated message on the current input. The recipients are given as the
4015 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4016 argument can be a comma-separated list of RFC 2822 addresses. This is the
4017 default option for selecting the overall action of an Exim call; it is assumed
4018 if no other conflicting option is present.
4019 </para>
4020 <para>
4021 If any addresses in the message are unqualified (have no domain), they are
4022 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4023 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4024 suppressing this for special cases.
4025 </para>
4026 <para>
4027 Policy checks on the contents of local messages can be enforced by means of
4028 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4029 </para>
4030 <para>
4031 <indexterm role="concept">
4032 <primary>return code</primary>
4033 <secondary>for <option>-bm</option></secondary>
4034 </indexterm>
4035 The return code is zero if the message is successfully accepted. Otherwise, the
4036 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4037 </para>
4038 <para>
4039 The format
4040 <indexterm role="concept">
4041 <primary>message</primary>
4042 <secondary>format</secondary>
4043 </indexterm>
4044 <indexterm role="concept">
4045 <primary>format</primary>
4046 <secondary>message</secondary>
4047 </indexterm>
4048 <indexterm role="concept">
4049 <primary><quote>From</quote> line</primary>
4050 </indexterm>
4051 <indexterm role="concept">
4052 <primary>UUCP</primary>
4053 <secondary><quote>From</quote> line</secondary>
4054 </indexterm>
4055 <indexterm role="concept">
4056 <primary>Sendmail compatibility</primary>
4057 <secondary><quote>From</quote> line</secondary>
4058 </indexterm>
4059 of the message must be as defined in RFC 2822, except that, for
4060 compatibility with Sendmail and Smail, a line in one of the forms
4061 </para>
4062 <literallayout class="monospaced">
4063 From sender Fri Jan  5 12:55 GMT 1997
4064 From sender Fri, 5 Jan 97 12:55:01
4065 </literallayout>
4066 <para>
4067 (with the weekday optional, and possibly with additional text after the date)
4068 is permitted to appear at the start of the message. There appears to be no
4069 authoritative specification of the format of this line. Exim recognizes it by
4070 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4071 option, which can be changed if necessary.
4072 </para>
4073 <para>
4074 The
4075 <indexterm role="concept">
4076 <primary><option>-f</option> option</primary>
4077 <secondary>overriding <quote>From</quote> line</secondary>
4078 </indexterm>
4079 specified sender is treated as if it were given as the argument to the
4080 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4081 preference to the address taken from the message. The caller of Exim must be a
4082 trusted user for the sender of a message to be set in this way.
4083 </para>
4084 </listitem></varlistentry>
4085 <varlistentry>
4086 <term><option>-bnq</option></term>
4087 <listitem>
4088 <para>
4089 <indexterm role="option">
4090 <primary><option>-bnq</option></primary>
4091 </indexterm>
4092 <indexterm role="concept">
4093 <primary>address qualification</primary>
4094 <secondary>suppressing</secondary>
4095 </indexterm>
4096 By default, Exim automatically qualifies unqualified addresses (those
4097 without domains) that appear in messages that are submitted locally (that
4098 is, not over TCP/IP). This qualification applies both to addresses in
4099 envelopes, and addresses in header lines. Sender addresses are qualified using
4100 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4101 defaults to the value of <option>qualify_domain</option>).
4102 </para>
4103 <para>
4104 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4105 being used to re-submit messages that originally came from remote hosts after
4106 content scanning, you probably do not want to qualify unqualified addresses in
4107 header lines. (Such lines will be present only if you have not enabled a header
4108 syntax check in the appropriate ACL.)
4109 </para>
4110 <para>
4111 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4112 messages that originate on the local host. When this is used, unqualified
4113 addresses in the envelope provoke errors (causing message rejection) and
4114 unqualified addresses in header lines are left alone.
4115 </para>
4116 </listitem></varlistentry>
4117 <varlistentry>
4118 <term><option>-bP</option></term>
4119 <listitem>
4120 <para>
4121 <indexterm role="option">
4122 <primary><option>-bP</option></primary>
4123 </indexterm>
4124 <indexterm role="concept">
4125 <primary>configuration options</primary>
4126 <secondary>extracting</secondary>
4127 </indexterm>
4128 <indexterm role="concept">
4129 <primary>options</primary>
4130 <secondary>configuration &ndash; extracting</secondary>
4131 </indexterm>
4132 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4133 main configuration options to be written to the standard output. The values
4134 of one or more specific options can be requested by giving their names as
4135 arguments, for example:
4136 </para>
4137 <literallayout class="monospaced">
4138 exim -bP qualify_domain hold_domains
4139 </literallayout>
4140 <para>
4141 However, any option setting that is preceded by the word <quote>hide</quote> in the
4142 configuration file is not shown in full, except to an admin user. For other
4143 users, the output is as in this example:
4144 </para>
4145 <literallayout class="monospaced">
4146 mysql_servers = &lt;value not displayable&gt;
4147 </literallayout>
4148 <para>
4149 If <option>configure_file</option> is given as an argument, the name of the run time
4150 configuration file is output.
4151 If a list of configuration files was supplied, the value that is output here
4152 is the name of the file that was actually used.
4153 </para>
4154 <para>
4155 <indexterm role="concept">
4156 <primary>daemon</primary>
4157 <secondary>process id (pid)</secondary>
4158 </indexterm>
4159 <indexterm role="concept">
4160 <primary>pid (process id)</primary>
4161 <secondary>of daemon</secondary>
4162 </indexterm>
4163 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4164 directories where log files and daemon pid files are written are output,
4165 respectively. If these values are unset, log files are written in a
4166 sub-directory of the spool directory called <option>log</option>, and the pid file is
4167 written directly into the spool directory.
4168 </para>
4169 <para>
4170 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4171 </para>
4172 <literallayout class="monospaced">
4173 exim -bP +local_domains
4174 </literallayout>
4175 <para>
4176 it searches for a matching named list of any type (domain, host, address, or
4177 local part) and outputs what it finds.
4178 </para>
4179 <para>
4180 <indexterm role="concept">
4181 <primary>options</primary>
4182 <secondary>router &ndash; extracting</secondary>
4183 </indexterm>
4184 <indexterm role="concept">
4185 <primary>options</primary>
4186 <secondary>transport &ndash; extracting</secondary>
4187 </indexterm>
4188 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4189 followed by the name of an appropriate driver instance, the option settings for
4190 that driver are output. For example:
4191 </para>
4192 <literallayout class="monospaced">
4193 exim -bP transport local_delivery
4194 </literallayout>
4195 <para>
4196 The generic driver options are output first, followed by the driver&#x2019;s private
4197 options. A list of the names of drivers of a particular type can be obtained by
4198 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4199 <option>authenticator_list</option>, and a complete list of all drivers with their option
4200 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4201 <option>authenticators</option>.
4202 </para>
4203 </listitem></varlistentry>
4204 <varlistentry>
4205 <term><option>-bp</option></term>
4206 <listitem>
4207 <para>
4208 <indexterm role="option">
4209 <primary><option>-bp</option></primary>
4210 </indexterm>
4211 <indexterm role="concept">
4212 <primary>queue</primary>
4213 <secondary>listing messages on</secondary>
4214 </indexterm>
4215 <indexterm role="concept">
4216 <primary>listing</primary>
4217 <secondary>messages on the queue</secondary>
4218 </indexterm>
4219 This option requests a listing of the contents of the mail queue on the
4220 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4221 just those messages are listed. By default, this option can be used only by an
4222 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4223 to allow any user to see the queue.
4224 </para>
4225 <para>
4226 Each message on the queue is displayed as in the following example:
4227 </para>
4228 <literallayout class="monospaced">
4229 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4230           red.king@looking-glass.fict.example
4231           &lt;other addresses&gt;
4232 </literallayout>
4233 <para>
4234 <indexterm role="concept">
4235 <primary>message</primary>
4236 <secondary>size in queue listing</secondary>
4237 </indexterm>
4238 <indexterm role="concept">
4239 <primary>size</primary>
4240 <secondary>of message</secondary>
4241 </indexterm>
4242 The first line contains the length of time the message has been on the queue
4243 (in this case 25 minutes), the size of the message (2.9K), the unique local
4244 identifier for the message, and the message sender, as contained in the
4245 envelope. For bounce messages, the sender address is empty, and appears as
4246 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4247 the default sender address, the user&#x2019;s login name is shown in parentheses
4248 before the sender address.
4249 </para>
4250 <para>
4251 <indexterm role="concept">
4252 <primary>frozen messages</primary>
4253 <secondary>in queue listing</secondary>
4254 </indexterm>
4255 If the message is frozen (attempts to deliver it are suspended) then the text
4256 <quote>*** frozen ***</quote> is displayed at the end of this line.
4257 </para>
4258 <para>
4259 The recipients of the message (taken from the envelope, not the headers) are
4260 displayed on subsequent lines. Those addresses to which the message has already
4261 been delivered are marked with the letter D. If an original address gets
4262 expanded into several addresses via an alias or forward file, the original is
4263 displayed with a D only when deliveries for all of its child addresses are
4264 complete.
4265 </para>
4266 </listitem></varlistentry>
4267 <varlistentry>
4268 <term><option>-bpa</option></term>
4269 <listitem>
4270 <para>
4271 <indexterm role="option">
4272 <primary><option>-bpa</option></primary>
4273 </indexterm>
4274 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4275 that were generated from the original top level address(es) in each message by
4276 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4277 of just <quote>D</quote>.
4278 </para>
4279 </listitem></varlistentry>
4280 <varlistentry>
4281 <term><option>-bpc</option></term>
4282 <listitem>
4283 <para>
4284 <indexterm role="option">
4285 <primary><option>-bpc</option></primary>
4286 </indexterm>
4287 <indexterm role="concept">
4288 <primary>queue</primary>
4289 <secondary>count of messages on</secondary>
4290 </indexterm>
4291 This option counts the number of messages on the queue, and writes the total
4292 to the standard output. It is restricted to admin users, unless
4293 <option>queue_list_requires_admin</option> is set false.
4294 </para>
4295 </listitem></varlistentry>
4296 <varlistentry>
4297 <term><option>-bpr</option></term>
4298 <listitem>
4299 <para>
4300 <indexterm role="option">
4301 <primary><option>-bpr</option></primary>
4302 </indexterm>
4303 This option operates like <option>-bp</option>, but the output is not sorted into
4304 chronological order of message arrival. This can speed it up when there are
4305 lots of messages on the queue, and is particularly useful if the output is
4306 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4307 </para>
4308 </listitem></varlistentry>
4309 <varlistentry>
4310 <term><option>-bpra</option></term>
4311 <listitem>
4312 <para>
4313 <indexterm role="option">
4314 <primary><option>-bpra</option></primary>
4315 </indexterm>
4316 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4317 </para>
4318 </listitem></varlistentry>
4319 <varlistentry>
4320 <term><option>-bpru</option></term>
4321 <listitem>
4322 <para>
4323 <indexterm role="option">
4324 <primary><option>-bpru</option></primary>
4325 </indexterm>
4326 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4327 </para>
4328 </listitem></varlistentry>
4329 <varlistentry>
4330 <term><option>-bpu</option></term>
4331 <listitem>
4332 <para>
4333 <indexterm role="option">
4334 <primary><option>-bpu</option></primary>
4335 </indexterm>
4336 This option operates like <option>-bp</option> but shows only undelivered top-level
4337 addresses for each message displayed. Addresses generated by aliasing or
4338 forwarding are not shown, unless the message was deferred after processing by a
4339 router with the <option>one_time</option> option set.
4340 </para>
4341 </listitem></varlistentry>
4342 <varlistentry>
4343 <term><option>-brt</option></term>
4344 <listitem>
4345 <para>
4346 <indexterm role="option">
4347 <primary><option>-brt</option></primary>
4348 </indexterm>
4349 <indexterm role="concept">
4350 <primary>testing</primary>
4351 <secondary>retry configuration</secondary>
4352 </indexterm>
4353 <indexterm role="concept">
4354 <primary>retry</primary>
4355 <secondary>configuration testing</secondary>
4356 </indexterm>
4357 This option is for testing retry rules, and it must be followed by up to three
4358 arguments. It causes Exim to look for a retry rule that matches the values
4359 and to write it to the standard output. For example:
4360 </para>
4361 <literallayout class="monospaced">
4362 exim -brt bach.comp.mus.example
4363 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4364 </literallayout>
4365 <para>
4366 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4367 argument, which is required, can be a complete address in the form
4368 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4369 contains a dot, it is interpreted as an optional second domain name; if no
4370 retry rule is found for the first argument, the second is tried. This ties in
4371 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4372 rule is found that matches the host, one that matches the mail domain is
4373 sought. Finally, an argument that is the name of a specific delivery error, as
4374 used in setting up retry rules, can be given. For example:
4375 </para>
4376 <literallayout class="monospaced">
4377 exim -brt haydn.comp.mus.example quota_3d
4378 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4379 </literallayout>
4380 </listitem></varlistentry>
4381 <varlistentry>
4382 <term><option>-brw</option></term>
4383 <listitem>
4384 <para>
4385 <indexterm role="option">
4386 <primary><option>-brw</option></primary>
4387 </indexterm>
4388 <indexterm role="concept">
4389 <primary>testing</primary>
4390 <secondary>rewriting</secondary>
4391 </indexterm>
4392 <indexterm role="concept">
4393 <primary>rewriting</primary>
4394 <secondary>testing</secondary>
4395 </indexterm>
4396 This option is for testing address rewriting rules, and it must be followed by
4397 a single argument, consisting of either a local part without a domain, or a
4398 complete address with a fully qualified domain. Exim outputs how this address
4399 would be rewritten for each possible place it might appear. See chapter
4400 <xref linkend="CHAPrewrite"/> for further details.
4401 </para>
4402 </listitem></varlistentry>
4403 <varlistentry>
4404 <term><option>-bS</option></term>
4405 <listitem>
4406 <para>
4407 <indexterm role="option">
4408 <primary><option>-bS</option></primary>
4409 </indexterm>
4410 <indexterm role="concept">
4411 <primary>SMTP</primary>
4412 <secondary>batched incoming</secondary>
4413 </indexterm>
4414 <indexterm role="concept">
4415 <primary>batched SMTP input</primary>
4416 </indexterm>
4417 This option is used for batched SMTP input, which is an alternative interface
4418 for non-interactive local message submission. A number of messages can be
4419 submitted in a single run. However, despite its name, this is not really SMTP
4420 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4421 input, but generates no responses. If the caller is trusted, or
4422 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4423 believed; otherwise the sender is always the caller of Exim.
4424 </para>
4425 <para>
4426 The message itself is read from the standard input, in SMTP format (leading
4427 dots doubled), terminated by a line containing just a single dot. An error is
4428 provoked if the terminating dot is missing. A further message may then follow.
4429 </para>
4430 <para>
4431 As for other local message submissions, the contents of incoming batch SMTP
4432 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4433 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4434 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4435 </para>
4436 <para>
4437 Some other SMTP commands are recognized in the input. HELO and EHLO act
4438 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4439 QUIT quits, ignoring the rest of the standard input.
4440 </para>
4441 <para>
4442 <indexterm role="concept">
4443 <primary>return code</primary>
4444 <secondary>for <option>-bS</option></secondary>
4445 </indexterm>
4446 If any error is encountered, reports are written to the standard output and
4447 error streams, and Exim gives up immediately. The return code is 0 if no error
4448 was detected; it is 1 if one or more messages were accepted before the error
4449 was detected; otherwise it is 2.
4450 </para>
4451 <para>
4452 More details of input using batched SMTP are given in section
4453 <xref linkend="SECTincomingbatchedSMTP"/>.
4454 </para>
4455 </listitem></varlistentry>
4456 <varlistentry>
4457 <term><option>-bs</option></term>
4458 <listitem>
4459 <para>
4460 <indexterm role="option">
4461 <primary><option>-bs</option></primary>
4462 </indexterm>
4463 <indexterm role="concept">
4464 <primary>SMTP</primary>
4465 <secondary>local input</secondary>
4466 </indexterm>
4467 <indexterm role="concept">
4468 <primary>local SMTP input</primary>
4469 </indexterm>
4470 This option causes Exim to accept one or more messages by reading SMTP commands
4471 on the standard input, and producing SMTP replies on the standard output. SMTP
4472 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4473 Some user agents use this interface as a way of passing locally-generated
4474 messages to the MTA.
4475 </para>
4476 <para>
4477 In
4478 <indexterm role="concept">
4479 <primary>sender</primary>
4480 <secondary>source of</secondary>
4481 </indexterm>
4482 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4483 set, the senders of messages are taken from the SMTP MAIL commands.
4484 Otherwise the content of these commands is ignored and the sender is set up as
4485 the calling user. Unqualified addresses are automatically qualified using
4486 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4487 <option>-bnq</option> option is used.
4488 </para>
4489 <para>
4490 <indexterm role="concept">
4491 <primary>inetd</primary>
4492 </indexterm>
4493 The
4494 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4495 using a listening daemon. Exim can distinguish the two cases by checking
4496 whether the standard input is a TCP/IP socket. When Exim is called from
4497 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4498 above concerning senders and qualification do not apply. In this situation,
4499 Exim behaves in exactly the same way as it does when receiving a message via
4500 the listening daemon.
4501 </para>
4502 </listitem></varlistentry>
4503 <varlistentry>
4504 <term><option>-bt</option></term>
4505 <listitem>
4506 <para>
4507 <indexterm role="option">
4508 <primary><option>-bt</option></primary>
4509 </indexterm>
4510 <indexterm role="concept">
4511 <primary>testing</primary>
4512 <secondary>addresses</secondary>
4513 </indexterm>
4514 <indexterm role="concept">
4515 <primary>address</primary>
4516 <secondary>testing</secondary>
4517 </indexterm>
4518 This option runs Exim in address testing mode, in which each argument is taken
4519 as an address to be tested for deliverability. The results are written to the
4520 standard output. If a test fails, and the caller is not an admin user, no
4521 details of the failure are output, because these might contain sensitive
4522 information such as usernames and passwords for database lookups.
4523 </para>
4524 <para>
4525 If no arguments are given, Exim runs in an interactive manner, prompting with a
4526 right angle bracket for addresses to be tested.
4527 </para>
4528 <para>
4529 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4530 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
4531 security issues.
4532 </para>
4533 <para>
4534 Each address is handled as if it were the recipient address of a message
4535 (compare the <option>-bv</option> option). It is passed to the routers and the result is
4536 written to the standard output. However, any router that has
4537 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
4538 genuine routing tests if your first router passes everything to a scanner
4539 program.
4540 </para>
4541 <para>
4542 The
4543 <indexterm role="concept">
4544 <primary>return code</primary>
4545 <secondary>for <option>-bt</option></secondary>
4546 </indexterm>
4547 return code is 2 if any address failed outright; it is 1 if no address
4548 failed outright but at least one could not be resolved for some reason. Return
4549 code 0 is given only when all addresses succeed.
4550 </para>
4551 <para revisionflag="changed">
4552 <indexterm role="concept">
4553 <primary>duplicate addresses</primary>
4554 </indexterm>
4555 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
4556 addresses after routing is complete, so that only one delivery takes place.
4557 This does not happen when testing with <option>-bt</option>; the full results of routing are
4558 always shown.
4559 </para>
4560 <para>
4561 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
4562 routers in the configuration makes any tests on the sender address of a
4563 message,
4564 <indexterm role="concept">
4565 <primary><option>-f</option> option</primary>
4566 <secondary>for address testing</secondary>
4567 </indexterm>
4568 you can use the <option>-f</option> option to set an appropriate sender when running
4569 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
4570 default qualifying domain. However, if you have set up (for example) routers
4571 whose behaviour depends on the contents of an incoming message, you cannot test
4572 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
4573 doing such tests.
4574 </para>
4575 </listitem></varlistentry>
4576 <varlistentry>
4577 <term><option>-bV</option></term>
4578 <listitem>
4579 <para>
4580 <indexterm role="option">
4581 <primary><option>-bV</option></primary>
4582 </indexterm>
4583 <indexterm role="concept">
4584 <primary>version number of Exim</primary>
4585 <secondary>verifying</secondary>
4586 </indexterm>
4587 This option causes Exim to write the current version number, compilation
4588 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
4589 It also lists the DBM library this is being used, the optional modules (such as
4590 specific lookup types), the drivers that are included in the binary, and the
4591 name of the run time configuration file that is in use.
4592 </para>
4593 <para>
4594 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
4595 configuration file. However, this is a static check only. It cannot check
4596 values that are to be expanded. For example, although a misspelt ACL verb is
4597 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
4598 alone to discover (for example) all the typos in the configuration; some
4599 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
4600 dynamic testing facilities.
4601 </para>
4602 </listitem></varlistentry>
4603 <varlistentry>
4604 <term><option>-bv</option></term>
4605 <listitem>
4606 <para>
4607 <indexterm role="option">
4608 <primary><option>-bv</option></primary>
4609 </indexterm>
4610 <indexterm role="concept">
4611 <primary>verifying address</primary>
4612 <secondary>using <option>-bv</option></secondary>
4613 </indexterm>
4614 <indexterm role="concept">
4615 <primary>address</primary>
4616 <secondary>verification</secondary>
4617 </indexterm>
4618 </para>
4619 <para revisionflag="changed">
4620 This option runs Exim in address verification mode, in which each argument is
4621 taken as an address to be verified by the routers. (This does not involve any
4622 verification callouts). During normal operation, verification happens mostly as
4623 a consequence processing a <option>verify</option> condition in an ACL (see chapter
4624 <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly including callouts,
4625 see the <option>-bh</option> and <option>-bhc</option> options.
4626 </para>
4627 <para>
4628 If verification fails, and the caller is not an admin user, no details of the
4629 failure are output, because these might contain sensitive information such as
4630 usernames and passwords for database lookups.
4631 </para>
4632 <para>
4633 If no arguments are given, Exim runs in an interactive manner, prompting with a
4634 right angle bracket for addresses to be verified.
4635 </para>
4636 <para>
4637 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
4638 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
4639 security issues.
4640 </para>
4641 <para>
4642 Verification differs from address testing (the <option>-bt</option> option) in that routers
4643 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
4644 router that has <option>fail_verify</option> set, verification fails. The address is
4645 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
4646 address, <option>-bvs</option> should be used.
4647 </para>
4648 <para>
4649 If the <option>-v</option> option is not set, the output consists of a single line for each
4650 address, stating whether it was verified or not, and giving a reason in the
4651 latter case. Otherwise, more details are given of how the address has been
4652 handled, and in the case of address redirection, all the generated addresses
4653 are also considered. Without <option>-v</option>, generating more than one address by
4654 redirection causes verification to end successfully.
4655 </para>
4656 <para>
4657 The
4658 <indexterm role="concept">
4659 <primary>return code</primary>
4660 <secondary>for <option>-bv</option></secondary>
4661 </indexterm>
4662 return code is 2 if any address failed outright; it is 1 if no address
4663 failed outright but at least one could not be resolved for some reason. Return
4664 code 0 is given only when all addresses succeed.
4665 </para>
4666 <para>
4667 If any of the routers in the configuration makes any tests on the sender
4668 address of a message, you should use the <option>-f</option> option to set an appropriate
4669 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
4670 calling user at the default qualifying domain.
4671 </para>
4672 </listitem></varlistentry>
4673 <varlistentry>
4674 <term><option>-bvs</option></term>
4675 <listitem>
4676 <para>
4677 <indexterm role="option">
4678 <primary><option>-bvs</option></primary>
4679 </indexterm>
4680 This option acts like <option>-bv</option>, but verifies the address as a sender rather
4681 than a recipient address. This affects any rewriting and qualification that
4682 might happen.
4683 </para>
4684 </listitem></varlistentry>
4685 <varlistentry>
4686 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
4687 <listitem>
4688 <para>
4689 <indexterm role="option">
4690 <primary><option>-C</option></primary>
4691 </indexterm>
4692 <indexterm role="concept">
4693 <primary>configuration file</primary>
4694 <secondary>alternate</secondary>
4695 </indexterm>
4696 <indexterm role="concept">
4697 <primary>CONFIGURE_FILE</primary>
4698 </indexterm>
4699 <indexterm role="concept">
4700 <primary>alternate configuration file</primary>
4701 </indexterm>
4702 This option causes Exim to find the run time configuration file from the given
4703 list instead of from the list specified by the CONFIGURE_FILE
4704 compile-time setting. Usually, the list will consist of just a single file
4705 name, but it can be a colon-separated list of names. In this case, the first
4706 file that exists is used. Failure to open an existing file stops Exim from
4707 proceeding any further along the list, and an error is generated.
4708 </para>
4709 <para>
4710 When this option is used by a caller other than root or the Exim user, and the
4711 list is different from the compiled-in list, Exim gives up its root privilege
4712 immediately, and runs with the real and effective uid and gid set to those of
4713 the caller. However, if ALT_CONFIG_ROOT_ONLY is defined in
4714 <filename>Local/Makefile</filename>, root privilege is retained for <option>-C</option> only if the caller of
4715 Exim is root.
4716 </para>
4717 <para>
4718 That is, the Exim user is no longer privileged in this regard. This build-time
4719 option is not set by default in the Exim source distribution tarbundle.
4720 However, if you are using a <quote>packaged</quote> version of Exim (source or binary),
4721 the packagers might have enabled it.
4722 </para>
4723 <para>
4724 Setting ALT_CONFIG_ROOT_ONLY locks out the possibility of testing a
4725 configuration using <option>-C</option> right through message reception and delivery, even
4726 if the caller is root. The reception works, but by that time, Exim is running
4727 as the Exim user, so when it re-executes to regain privilege for the delivery,
4728 the use of <option>-C</option> causes privilege to be lost. However, root can test reception
4729 and delivery using two separate commands (one to put a message on the queue,
4730 using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
4731 </para>
4732 <para>
4733 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
4734 prefix string with which any file named in a <option>-C</option> command line option
4735 must start. In addition, the file name must not contain the sequence <literal>/../</literal>.
4736 However, if the value of the <option>-C</option> option is identical to the value of
4737 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
4738 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
4739 unset, any file name can be used with <option>-C</option>.
4740 </para>
4741 <para>
4742 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
4743 to a directory to which only root has access. This prevents someone who has
4744 broken into the Exim account from running a privileged Exim with an arbitrary
4745 configuration file.
4746 </para>
4747 <para>
4748 The <option>-C</option> facility is useful for ensuring that configuration files are
4749 syntactically correct, but cannot be used for test deliveries, unless the
4750 caller is privileged, or unless it is an exotic configuration that does not
4751 require privilege. No check is made on the owner or group of the files
4752 specified by this option.
4753 </para>
4754 </listitem></varlistentry>
4755 <varlistentry>
4756 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
4757 <listitem>
4758 <para>
4759 <indexterm role="option">
4760 <primary><option>-D</option></primary>
4761 </indexterm>
4762 <indexterm role="concept">
4763 <primary>macro</primary>
4764 <secondary>setting on command line</secondary>
4765 </indexterm>
4766 This option can be used to override macro definitions in the configuration file
4767 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
4768 unprivileged caller, it causes Exim to give up its root privilege.
4769 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
4770 completely disabled, and its use causes an immediate error exit.
4771 </para>
4772 <para>
4773 The entire option (including equals sign if present) must all be within one
4774 command line item. <option>-D</option> can be used to set the value of a macro to the empty
4775 string, in which case the equals sign is optional. These two commands are
4776 synonymous:
4777 </para>
4778 <literallayout class="monospaced">
4779 exim -DABC  ...
4780 exim -DABC= ...
4781 </literallayout>
4782 <para>
4783 To include spaces in a macro definition item, quotes must be used. If you use
4784 quotes, spaces are permitted around the macro name and the equals sign. For
4785 example:
4786 </para>
4787 <literallayout class="monospaced">
4788 exim '-D ABC = something' ...
4789 </literallayout>
4790 <para>
4791 <option>-D</option> may be repeated up to 10 times on a command line.
4792 </para>
4793 </listitem></varlistentry>
4794 <varlistentry>
4795 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4796 <listitem>
4797 <para>
4798 <indexterm role="option">
4799 <primary><option>-d</option></primary>
4800 </indexterm>
4801 <indexterm role="concept">
4802 <primary>debugging</primary>
4803 <secondary>list of selectors</secondary>
4804 </indexterm>
4805 <indexterm role="concept">
4806 <primary>debugging</primary>
4807 <secondary><option>-d</option> option</secondary>
4808 </indexterm>
4809 This option causes debugging information to be written to the standard
4810 error stream. It is restricted to admin users because debugging output may show
4811 database queries that contain password information. Also, the details of users&#x2019;
4812 filter files should be protected. When <option>-d</option> is used, <option>-v</option> is assumed. If
4813 <option>-d</option> is given on its own, a lot of standard debugging data is output. This
4814 can be reduced, or increased to include some more rarely needed information, by
4815 directly following <option>-d</option> with a string made up of names preceded by plus or
4816 minus characters. These add or remove sets of debugging data, respectively. For
4817 example, <option>-d+filter</option> adds filter debugging, whereas <option>-d-all+filter</option> selects
4818 only filter debugging. Note that no spaces are allowed in the debug setting.
4819 The available debugging categories are:
4820 </para>
4821 <literallayout>
4822 <literal>acl            </literal> ACL interpretation
4823 <literal>auth           </literal> authenticators
4824 <literal>deliver        </literal> general delivery logic
4825 <literal>dns            </literal> DNS lookups (see also resolver)
4826 <literal>dnsbl          </literal> DNS black list (aka RBL) code
4827 <literal>exec           </literal> arguments for <function>execv()</function> calls
4828 <literal>expand         </literal> detailed debugging for string expansions
4829 <literal>filter         </literal> filter handling
4830 <literal>hints_lookup   </literal> hints data lookups
4831 <literal>host_lookup    </literal> all types of name-to-IP address handling
4832 <literal>ident          </literal> ident lookup
4833 <literal>interface      </literal> lists of local interfaces
4834 <literal>lists          </literal> matching things in lists
4835 <literal>load           </literal> system load checks
4836 <literal>local_scan     </literal> can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)
4837 <literal>lookup         </literal> general lookup code and all lookups
4838 <literal>memory         </literal> memory handling
4839 <literal>pid            </literal> add pid to debug output lines
4840 <literal>process_info   </literal> setting info for the process log
4841 <literal>queue_run      </literal> queue runs
4842 <literal>receive        </literal> general message reception logic
4843 <literal>resolver       </literal> turn on the DNS resolver&#x2019;s debugging output
4844 <literal>retry          </literal> retry handling
4845 <literal>rewrite        </literal> address rewriting
4846 <literal>route          </literal> address routing
4847 <literal>timestamp      </literal> add timestamp to debug output lines
4848 <literal>tls            </literal> TLS logic
4849 <literal>transport      </literal> transports
4850 <literal>uid            </literal> changes of uid/gid and looking up uid/gid
4851 <literal>verify         </literal> address verification logic
4852 <literal>all            </literal> almost all of the above (see below), and also <option>-v</option>
4853 </literallayout>
4854 <para>
4855 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
4856 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
4857 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
4858 is included, an awful lot of output that is very rarely of interest is
4859 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
4860 turn everything off.
4861 </para>
4862 <para>
4863 <indexterm role="concept">
4864 <primary>resolver</primary>
4865 <secondary>debugging output</secondary>
4866 </indexterm>
4867 <indexterm role="concept">
4868 <primary>DNS resolver</primary>
4869 <secondary>debugging output</secondary>
4870 </indexterm>
4871 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
4872 with DEBUG enabled. This is not the case in some operating systems. Also,
4873 unfortunately, debugging output from the DNS resolver is written to stdout
4874 rather than stderr.
4875 </para>
4876 <para>
4877 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
4878 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
4879 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
4880 daemon, which then passes it on to any re-executed Exims. Exim also
4881 automatically adds the pid to debug lines when several remote deliveries are
4882 run in parallel.
4883 </para>
4884 <para>
4885 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
4886 of all debug output lines. This can be useful when trying to track down delays
4887 in processing.
4888 </para>
4889 <para>
4890 If the <option>debug_print</option> option is set in any driver, it produces output whenever
4891 any debugging is selected, or if <option>-v</option> is used.
4892 </para>
4893 </listitem></varlistentry>
4894 <varlistentry>
4895 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
4896 <listitem>
4897 <para>
4898 <indexterm role="option">
4899 <primary><option>-dd</option></primary>
4900 </indexterm>
4901 This option behaves exactly like <option>-d</option> except when used on a command that
4902 starts a daemon process. In that case, debugging is turned off for the
4903 subprocesses that the daemon creates. Thus, it is useful for monitoring the
4904 behaviour of the daemon without creating as much output as full debugging does.
4905 </para>
4906 </listitem></varlistentry>
4907 <varlistentry>
4908 <term><option>-dropcr</option></term>
4909 <listitem>
4910 <para>
4911 <indexterm role="option">
4912 <primary><option>-dropcr</option></primary>
4913 </indexterm>
4914 This is an obsolete option that is now a no-op. It used to affect the way Exim
4915 handled CR and LF characters in incoming messages. What happens now is
4916 described in section <xref linkend="SECTlineendings"/>.
4917 </para>
4918 </listitem></varlistentry>
4919 <varlistentry>
4920 <term><option>-E</option></term>
4921 <listitem>
4922 <para>
4923 <indexterm role="option">
4924 <primary><option>-E</option></primary>
4925 </indexterm>
4926 <indexterm role="concept">
4927 <primary>bounce message</primary>
4928 <secondary>generating</secondary>
4929 </indexterm>
4930 This option specifies that an incoming message is a locally-generated delivery
4931 failure report. It is used internally by Exim when handling delivery failures
4932 and is not intended for external use. Its only effect is to stop Exim
4933 generating certain messages to the postmaster, as otherwise message cascades
4934 could occur in some situations. As part of the same option, a message id may
4935 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
4936 new message contains the id, following <quote>R=</quote>, as a cross-reference.
4937 </para>
4938 </listitem></varlistentry>
4939 <varlistentry>
4940 <term><option>-e</option><emphasis>x</emphasis></term>
4941 <listitem>
4942 <para>
4943 <indexterm role="option">
4944 <primary><option>-e</option><emphasis>x</emphasis></primary>
4945 </indexterm>
4946 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
4947 called by various programs without the leading <option>o</option> in the option. For
4948 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
4949 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
4950 </para>
4951 </listitem></varlistentry>
4952 <varlistentry>
4953 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
4954 <listitem>
4955 <para>
4956 <indexterm role="option">
4957 <primary><option>-F</option></primary>
4958 </indexterm>
4959 <indexterm role="concept">
4960 <primary>sender</primary>
4961 <secondary>name</secondary>
4962 </indexterm>
4963 <indexterm role="concept">
4964 <primary>name</primary>
4965 <secondary>of sender</secondary>
4966 </indexterm>
4967 This option sets the sender&#x2019;s full name for use when a locally-generated
4968 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
4969 entry from the password data is used. As users are generally permitted to alter
4970 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
4971 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
4972 </para>
4973 </listitem></varlistentry>
4974 <varlistentry>
4975 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
4976 <listitem>
4977 <para>
4978 <indexterm role="option">
4979 <primary><option>-f</option></primary>
4980 </indexterm>
4981 <indexterm role="concept">
4982 <primary>sender</primary>
4983 <secondary>address</secondary>
4984 </indexterm>
4985 <indexterm role="concept">
4986 <primary>address</primary>
4987 <secondary>sender</secondary>
4988 </indexterm>
4989 <indexterm role="concept">
4990 <primary>trusted user</primary>
4991 </indexterm>
4992 <indexterm role="concept">
4993 <primary>envelope sender</primary>
4994 </indexterm>
4995 <indexterm role="concept">
4996 <primary>user</primary>
4997 <secondary>trusted</secondary>
4998 </indexterm>
4999 This option sets the address of the envelope sender of a locally-generated
5000 message (also known as the return path). The option can normally be used only
5001 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5002 users to use it.
5003 </para>
5004 <para>
5005 Processes running as root or the Exim user are always trusted. Other
5006 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5007 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5008 of a local message is set to the caller&#x2019;s login name at the default qualify
5009 domain.
5010 </para>
5011 <para>
5012 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5013 can be specified by any user, trusted or not, to create a message that can
5014 never provoke a bounce. An empty sender can be specified either as an empty
5015 string, or as a pair of angle brackets with nothing between them, as in these
5016 examples of shell commands:
5017 </para>
5018 <literallayout class="monospaced">
5019 exim -f '&lt;&gt;' user@domain
5020 exim -f "" user@domain
5021 </literallayout>
5022 <para>
5023 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5024 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5025 <option>-bv</option> options.
5026 </para>
5027 <para>
5028 Allowing untrusted users to change the sender address does not of itself make
5029 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5030 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5031 though this can be overridden by setting <option>no_local_from_check</option>.
5032 </para>
5033 <para>
5034 White
5035 <indexterm role="concept">
5036 <primary><quote>From</quote> line</primary>
5037 </indexterm>
5038 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5039 given as two arguments or one combined argument). The sender of a
5040 locally-generated message can also be set (when permitted) by an initial
5041 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5042 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5043 </para>
5044 </listitem></varlistentry>
5045 <varlistentry>
5046 <term><option>-G</option></term>
5047 <listitem>
5048 <para>
5049 <indexterm role="option">
5050 <primary><option>-G</option></primary>
5051 </indexterm>
5052 <indexterm role="concept">
5053 <primary>Sendmail compatibility</primary>
5054 <secondary><option>-G</option> option ignored</secondary>
5055 </indexterm>
5056 This is a Sendmail option which is ignored by Exim.
5057 </para>
5058 </listitem></varlistentry>
5059 <varlistentry>
5060 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5061 <listitem>
5062 <para>
5063 <indexterm role="option">
5064 <primary><option>-h</option></primary>
5065 </indexterm>
5066 <indexterm role="concept">
5067 <primary>Sendmail compatibility</primary>
5068 <secondary><option>-h</option> option ignored</secondary>
5069 </indexterm>
5070 This option is accepted for compatibility with Sendmail, but has no effect. (In
5071 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5072 headers.)
5073 </para>
5074 </listitem></varlistentry>
5075 <varlistentry>
5076 <term><option>-i</option></term>
5077 <listitem>
5078 <para>
5079 <indexterm role="option">
5080 <primary><option>-i</option></primary>
5081 </indexterm>
5082 <indexterm role="concept">
5083 <primary>Solaris</primary>
5084 <secondary><emphasis>mail</emphasis> command</secondary>
5085 </indexterm>
5086 <indexterm role="concept">
5087 <primary>dot in incoming</primary>
5088 <secondary>non-SMTP message</secondary>
5089 </indexterm>
5090 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5091 line by itself should not terminate an incoming, non-SMTP message. I can find
5092 no documentation for this option in Solaris 2.4 Sendmail, but the <emphasis>mailx</emphasis>
5093 command in Solaris 2.4 uses it. See also <option>-ti</option>.
5094 </para>
5095 </listitem></varlistentry>
5096 <varlistentry>
5097 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5098 <listitem>
5099 <para>
5100 <indexterm role="option">
5101 <primary><option>-M</option></primary>
5102 </indexterm>
5103 <indexterm role="concept">
5104 <primary>forcing delivery</primary>
5105 </indexterm>
5106 <indexterm role="concept">
5107 <primary>delivery</primary>
5108 <secondary>forcing attempt</secondary>
5109 </indexterm>
5110 <indexterm role="concept">
5111 <primary>frozen messages</primary>
5112 <secondary>forcing delivery</secondary>
5113 </indexterm>
5114 This option requests Exim to run a delivery attempt on each message in turn. If
5115 any of the messages are frozen, they are automatically thawed before the
5116 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5117 and <option>hold_domains</option> are ignored.
5118 </para>
5119 <para>
5120 Retry
5121 <indexterm role="concept">
5122 <primary>hints database</primary>
5123 <secondary>overriding retry hints</secondary>
5124 </indexterm>
5125 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5126 the normal retry time has not yet been reached. This option requires the caller
5127 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5128 which can be set false to relax this restriction (and also the same requirement
5129 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5130 </para>
5131 <para>
5132 The deliveries happen synchronously, that is, the original Exim process does
5133 not terminate until all the delivery attempts have finished. No output is
5134 produced unless there is a serious error. If you want to see what is happening,
5135 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5136 </para>
5137 </listitem></varlistentry>
5138 <varlistentry>
5139 <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>
5140 <listitem>
5141 <para>
5142 <indexterm role="option">
5143 <primary><option>-Mar</option></primary>
5144 </indexterm>
5145 <indexterm role="concept">
5146 <primary>message</primary>
5147 <secondary>adding recipients</secondary>
5148 </indexterm>
5149 <indexterm role="concept">
5150 <primary>recipient</primary>
5151 <secondary>adding</secondary>
5152 </indexterm>
5153 This option requests Exim to add the addresses to the list of recipients of the
5154 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5155 id, and the remaining ones must be email addresses. However, if the message is
5156 active (in the middle of a delivery attempt), it is not altered. This option
5157 can be used only by an admin user.
5158 </para>
5159 </listitem></varlistentry>
5160 <varlistentry>
5161 <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>
5162 <listitem>
5163 <para>
5164 <indexterm role="option">
5165 <primary><option>-MC</option></primary>
5166 </indexterm>
5167 <indexterm role="concept">
5168 <primary>SMTP</primary>
5169 <secondary>passed connection</secondary>
5170 </indexterm>
5171 <indexterm role="concept">
5172 <primary>SMTP</primary>
5173 <secondary>multiple deliveries</secondary>
5174 </indexterm>
5175 <indexterm role="concept">
5176 <primary>multiple SMTP deliveries</primary>
5177 </indexterm>
5178 This option is not intended for use by external callers. It is used internally
5179 by Exim to invoke another instance of itself to deliver a waiting message using
5180 an existing SMTP connection, which is passed as the standard input. Details are
5181 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5182 must be root or the Exim user in order to use it.
5183 </para>
5184 </listitem></varlistentry>
5185 <varlistentry>
5186 <term><option>-MCA</option></term>
5187 <listitem>
5188 <para>
5189 <indexterm role="option">
5190 <primary><option>-MCA</option></primary>
5191 </indexterm>
5192 This option is not intended for use by external callers. It is used internally
5193 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5194 connection to the remote host has been authenticated.
5195 </para>
5196 </listitem></varlistentry>
5197 <varlistentry>
5198 <term><option>-MCP</option></term>
5199 <listitem>
5200 <para>
5201 <indexterm role="option">
5202 <primary><option>-MCP</option></primary>
5203 </indexterm>
5204 This option is not intended for use by external callers. It is used internally
5205 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5206 which Exim is connected supports pipelining.
5207 </para>
5208 </listitem></varlistentry>
5209 <varlistentry>
5210 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5211 <listitem>
5212 <para>
5213 <indexterm role="option">
5214 <primary><option>-MCQ</option></primary>
5215 </indexterm>
5216 This option is not intended for use by external callers. It is used internally
5217 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5218 started by a queue runner. It passes on the process id of the queue runner,
5219 together with the file descriptor number of an open pipe. Closure of the pipe
5220 signals the final completion of the sequence of processes that are passing
5221 messages through the same SMTP connection.
5222 </para>
5223 </listitem></varlistentry>
5224 <varlistentry>
5225 <term><option>-MCS</option></term>
5226 <listitem>
5227 <para>
5228 <indexterm role="option">
5229 <primary><option>-MCS</option></primary>
5230 </indexterm>
5231 This option is not intended for use by external callers. It is used internally
5232 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5233 SMTP SIZE option should be used on messages delivered down the existing
5234 connection.
5235 </para>
5236 </listitem></varlistentry>
5237 <varlistentry>
5238 <term><option>-MCT</option></term>
5239 <listitem>
5240 <para>
5241 <indexterm role="option">
5242 <primary><option>-MCT</option></primary>
5243 </indexterm>
5244 This option is not intended for use by external callers. It is used internally
5245 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5246 host to which Exim is connected supports TLS encryption.
5247 </para>
5248 </listitem></varlistentry>
5249 <varlistentry>
5250 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5251 <listitem>
5252 <para>
5253 <indexterm role="option">
5254 <primary><option>-Mc</option></primary>
5255 </indexterm>
5256 <indexterm role="concept">
5257 <primary>hints database</primary>
5258 <secondary>not overridden by <option>-Mc</option></secondary>
5259 </indexterm>
5260 <indexterm role="concept">
5261 <primary>delivery</primary>
5262 <secondary>manually started &ndash; not forced</secondary>
5263 </indexterm>
5264 This option requests Exim to run a delivery attempt on each message in turn,
5265 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
5266 that are found. This option is not very useful to external callers. It is
5267 provided mainly for internal use by Exim when it needs to re-invoke itself in
5268 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
5269 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
5270 respects retry times and other options such as <option>hold_domains</option> that are
5271 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
5272 If you want to run a specific delivery as if in a queue run, you should use
5273 <option>-q</option> with a message id argument. A distinction between queue run deliveries
5274 and other deliveries is made in one or two places.
5275 </para>
5276 </listitem></varlistentry>
5277 <varlistentry>
5278 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5279 <listitem>
5280 <para>
5281 <indexterm role="option">
5282 <primary><option>-Mes</option></primary>
5283 </indexterm>
5284 <indexterm role="concept">
5285 <primary>message</primary>
5286 <secondary>changing sender</secondary>
5287 </indexterm>
5288 <indexterm role="concept">
5289 <primary>sender</primary>
5290 <secondary>changing</secondary>
5291 </indexterm>
5292 This option requests Exim to change the sender address in the message to the
5293 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
5294 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
5295 be a message id, and the second one an email address. However, if the message
5296 is active (in the middle of a delivery attempt), its status is not altered.
5297 This option can be used only by an admin user.
5298 </para>
5299 </listitem></varlistentry>
5300 <varlistentry>
5301 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5302 <listitem>
5303 <para>
5304 <indexterm role="option">
5305 <primary><option>-Mf</option></primary>
5306 </indexterm>
5307 <indexterm role="concept">
5308 <primary>freezing messages</primary>
5309 </indexterm>
5310 <indexterm role="concept">
5311 <primary>message</primary>
5312 <secondary>manually freezing</secondary>
5313 </indexterm>
5314 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
5315 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
5316 either manually or as a result of the <option>auto_thaw</option> configuration option.
5317 However, if any of the messages are active (in the middle of a delivery
5318 attempt), their status is not altered. This option can be used only by an admin
5319 user.
5320 </para>
5321 </listitem></varlistentry>
5322 <varlistentry>
5323 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5324 <listitem>
5325 <para>
5326 <indexterm role="option">
5327 <primary><option>-Mg</option></primary>
5328 </indexterm>
5329 <indexterm role="concept">
5330 <primary>giving up on messages</primary>
5331 </indexterm>
5332 <indexterm role="concept">
5333 <primary>message</primary>
5334 <secondary>abandoning delivery attempts</secondary>
5335 </indexterm>
5336 <indexterm role="concept">
5337 <primary>delivery</primary>
5338 <secondary>abandoning further attempts</secondary>
5339 </indexterm>
5340 This option requests Exim to give up trying to deliver the listed messages,
5341 including any that are frozen. However, if any of the messages are active,
5342 their status is not altered. For non-bounce messages, a delivery error message
5343 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
5344 Bounce messages are just discarded. This option can be used only by an admin
5345 user.
5346 </para>
5347 </listitem></varlistentry>
5348 <varlistentry>
5349 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5350 <listitem>
5351 <para>
5352 <indexterm role="option">
5353 <primary><option>-Mmad</option></primary>
5354 </indexterm>
5355 <indexterm role="concept">
5356 <primary>delivery</primary>
5357 <secondary>cancelling all</secondary>
5358 </indexterm>
5359 This option requests Exim to mark all the recipient addresses in the messages
5360 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
5361 message is active (in the middle of a delivery attempt), its status is not
5362 altered. This option can be used only by an admin user.
5363 </para>
5364 </listitem></varlistentry>
5365 <varlistentry>
5366 <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>
5367 <listitem>
5368 <para>
5369 <indexterm role="option">
5370 <primary><option>-Mmd</option></primary>
5371 </indexterm>
5372 <indexterm role="concept">
5373 <primary>delivery</primary>
5374 <secondary>cancelling by address</secondary>
5375 </indexterm>
5376 <indexterm role="concept">
5377 <primary>recipient</primary>
5378 <secondary>removing</secondary>
5379 </indexterm>
5380 <indexterm role="concept">
5381 <primary>removing recipients</primary>
5382 </indexterm>
5383 This option requests Exim to mark the given addresses as already delivered
5384 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
5385 the remaining ones must be email addresses. These are matched to recipient
5386 addresses in the message in a case-sensitive manner. If the message is active
5387 (in the middle of a delivery attempt), its status is not altered. This option
5388 can be used only by an admin user.
5389 </para>
5390 </listitem></varlistentry>
5391 <varlistentry>
5392 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5393 <listitem>
5394 <para>
5395 <indexterm role="option">
5396 <primary><option>-Mrm</option></primary>
5397 </indexterm>
5398 <indexterm role="concept">
5399 <primary>removing messages</primary>
5400 </indexterm>
5401 <indexterm role="concept">
5402 <primary>abandoning mail</primary>
5403 </indexterm>
5404 <indexterm role="concept">
5405 <primary>message</primary>
5406 <secondary>manually discarding</secondary>
5407 </indexterm>
5408 This option requests Exim to remove the given messages from the queue. No
5409 bounce messages are sent; each message is simply forgotten. However, if any of
5410 the messages are active, their status is not altered. This option can be used
5411 only by an admin user or by the user who originally caused the message to be
5412 placed on the queue.
5413 </para>
5414 </listitem></varlistentry>
5415 <varlistentry>
5416 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5417 <listitem>
5418 <para>
5419 <indexterm role="option">
5420 <primary><option>-Mt</option></primary>
5421 </indexterm>
5422 <indexterm role="concept">
5423 <primary>thawing messages</primary>
5424 </indexterm>
5425 <indexterm role="concept">
5426 <primary>unfreezing messages</primary>
5427 </indexterm>
5428 <indexterm role="concept">
5429 <primary>frozen messages</primary>
5430 <secondary>thawing</secondary>
5431 </indexterm>
5432 <indexterm role="concept">
5433 <primary>message</primary>
5434 <secondary>thawing frozen</secondary>
5435 </indexterm>
5436 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
5437 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
5438 messages are active, their status is not altered. This option can be used only
5439 by an admin user.
5440 </para>
5441 </listitem></varlistentry>
5442 <varlistentry>
5443 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5444 <listitem>
5445 <para>
5446 <indexterm role="option">
5447 <primary><option>-Mvb</option></primary>
5448 </indexterm>
5449 <indexterm role="concept">
5450 <primary>listing</primary>
5451 <secondary>message body</secondary>
5452 </indexterm>
5453 <indexterm role="concept">
5454 <primary>message</primary>
5455 <secondary>listing body of</secondary>
5456 </indexterm>
5457 This option causes the contents of the message body (-D) spool file to be
5458 written to the standard output. This option can be used only by an admin user.
5459 </para>
5460 </listitem></varlistentry>
5461 <varlistentry>
5462 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5463 <listitem>
5464 <para>
5465 <indexterm role="option">
5466 <primary><option>-Mvh</option></primary>
5467 </indexterm>
5468 <indexterm role="concept">
5469 <primary>listing</primary>
5470 <secondary>message headers</secondary>
5471 </indexterm>
5472 <indexterm role="concept">
5473 <primary>header lines</primary>
5474 <secondary>listing</secondary>
5475 </indexterm>
5476 <indexterm role="concept">
5477 <primary>message</primary>
5478 <secondary>listing header lines</secondary>
5479 </indexterm>
5480 This option causes the contents of the message headers (-H) spool file to be
5481 written to the standard output. This option can be used only by an admin user.
5482 </para>
5483 </listitem></varlistentry>
5484 <varlistentry>
5485 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5486 <listitem>
5487 <para>
5488 <indexterm role="option">
5489 <primary><option>-Mvl</option></primary>
5490 </indexterm>
5491 <indexterm role="concept">
5492 <primary>listing</primary>
5493 <secondary>message log</secondary>
5494 </indexterm>
5495 <indexterm role="concept">
5496 <primary>message</primary>
5497 <secondary>listing message log</secondary>
5498 </indexterm>
5499 This option causes the contents of the message log spool file to be written to
5500 the standard output. This option can be used only by an admin user.
5501 </para>
5502 </listitem></varlistentry>
5503 <varlistentry>
5504 <term><option>-m</option></term>
5505 <listitem>
5506 <para>
5507 <indexterm role="option">
5508 <primary><option>-m</option></primary>
5509 </indexterm>
5510 This is apparently a synonym for <option>-om</option> that is accepted by Sendmail, so Exim
5511 treats it that way too.
5512 </para>
5513 </listitem></varlistentry>
5514 <varlistentry>
5515 <term><option>-N</option></term>
5516 <listitem>
5517 <para>
5518 <indexterm role="option">
5519 <primary><option>-N</option></primary>
5520 </indexterm>
5521 <indexterm role="concept">
5522 <primary>debugging</primary>
5523 <secondary><option>-N</option> option</secondary>
5524 </indexterm>
5525 <indexterm role="concept">
5526 <primary>debugging</primary>
5527 <secondary>suppressing delivery</secondary>
5528 </indexterm>
5529 This is a debugging option that inhibits delivery of a message at the transport
5530 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
5531 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
5532 had successfully done so. However, it does not make any updates to the retry
5533 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
5534 than <quote>=&gt;</quote>.
5535 </para>
5536 <para>
5537 Because <option>-N</option> discards any message to which it applies, only root or the Exim
5538 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
5539 words, an ordinary user can use it only when supplying an incoming message to
5540 which it will apply. Although transportation never fails when <option>-N</option> is set, an
5541 address may be deferred because of a configuration problem on a transport, or a
5542 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
5543 the message, and applies to any subsequent delivery attempts that may happen
5544 for that message.
5545 </para>
5546 </listitem></varlistentry>
5547 <varlistentry>
5548 <term><option>-n</option></term>
5549 <listitem>
5550 <para>
5551 <indexterm role="option">
5552 <primary><option>-n</option></primary>
5553 </indexterm>
5554 <indexterm role="concept">
5555 <primary>Sendmail compatibility</primary>
5556 <secondary><option>-n</option> option ignored</secondary>
5557 </indexterm>
5558 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>. It is ignored
5559 by Exim.
5560 </para>
5561 </listitem></varlistentry>
5562 <varlistentry>
5563 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
5564 <listitem>
5565 <para>
5566 <indexterm role="option">
5567 <primary><option>-O</option></primary>
5568 </indexterm>
5569 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
5570 Exim.
5571 </para>
5572 </listitem></varlistentry>
5573 <varlistentry>
5574 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
5575 <listitem>
5576 <para>
5577 <indexterm role="option">
5578 <primary><option>-oA</option></primary>
5579 </indexterm>
5580 <indexterm role="concept">
5581 <primary>Sendmail compatibility</primary>
5582 <secondary><option>-oA</option> option</secondary>
5583 </indexterm>
5584 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
5585 alternative alias file name. Exim handles <option>-bi</option> differently; see the
5586 description above.
5587 </para>
5588 </listitem></varlistentry>
5589 <varlistentry>
5590 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
5591 <listitem>
5592 <para>
5593 <indexterm role="option">
5594 <primary><option>-oB</option></primary>
5595 </indexterm>
5596 <indexterm role="concept">
5597 <primary>SMTP</primary>
5598 <secondary>passed connection</secondary>
5599 </indexterm>
5600 <indexterm role="concept">
5601 <primary>SMTP</primary>
5602 <secondary>multiple deliveries</secondary>
5603 </indexterm>
5604 <indexterm role="concept">
5605 <primary>multiple SMTP deliveries</primary>
5606 </indexterm>
5607 This is a debugging option which limits the maximum number of messages that can
5608 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
5609 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
5610 </para>
5611 </listitem></varlistentry>
5612 <varlistentry>
5613 <term><option>-odb</option></term>
5614 <listitem>
5615 <para>
5616 <indexterm role="option">
5617 <primary><option>-odb</option></primary>
5618 </indexterm>
5619 <indexterm role="concept">
5620 <primary>background delivery</primary>
5621 </indexterm>
5622 <indexterm role="concept">
5623 <primary>delivery</primary>
5624 <secondary>in the background</secondary>
5625 </indexterm>
5626 This option applies to all modes in which Exim accepts incoming messages,
5627 including the listening daemon. It requests <quote>background</quote> delivery of such
5628 messages, which means that the accepting process automatically starts a
5629 delivery process for each message received, but does not wait for the delivery
5630 processes to finish.
5631 </para>
5632 <para>
5633 When all the messages have been received, the reception process exits,
5634 leaving the delivery processes to finish in their own time. The standard output
5635 and error streams are closed at the start of each delivery process.
5636 This is the default action if none of the <option>-od</option> options are present.
5637 </para>
5638 <para>
5639 If one of the queueing options in the configuration file
5640 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
5641 overrides it if <option>queue_only_override</option> is set true, which is the default
5642 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
5643 </para>
5644 </listitem></varlistentry>
5645 <varlistentry>
5646 <term><option>-odf</option></term>
5647 <listitem>
5648 <para>
5649 <indexterm role="option">
5650 <primary><option>-odf</option></primary>
5651 </indexterm>
5652 <indexterm role="concept">
5653 <primary>foreground delivery</primary>
5654 </indexterm>
5655 <indexterm role="concept">
5656 <primary>delivery</primary>
5657 <secondary>in the foreground</secondary>
5658 </indexterm>
5659 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
5660 accepted a locally-generated message. (For the daemon it is exactly the same as
5661 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
5662 and Exim waits for it to complete before proceeding.
5663 </para>
5664 <para>
5665 The original Exim reception process does not finish until the delivery
5666 process for the final message has ended. The standard error stream is left open
5667 during deliveries.
5668 </para>
5669 <para>
5670 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
5671 false and one of the queueing options in the configuration file is in effect.
5672 </para>
5673 <para>
5674 If there is a temporary delivery error during foreground delivery, the
5675 message is left on the queue for later delivery, and the original reception
5676 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
5677 restricted configuration that never queues messages.
5678 </para>
5679 </listitem></varlistentry>
5680 <varlistentry>
5681 <term><option>-odi</option></term>
5682 <listitem>
5683 <para>
5684 <indexterm role="option">
5685 <primary><option>-odi</option></primary>
5686 </indexterm>
5687 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
5688 Sendmail.
5689 </para>
5690 </listitem></varlistentry>
5691 <varlistentry>
5692 <term><option>-odq</option></term>
5693 <listitem>
5694 <para>
5695 <indexterm role="option">
5696 <primary><option>-odq</option></primary>
5697 </indexterm>
5698 <indexterm role="concept">
5699 <primary>non-immediate delivery</primary>
5700 </indexterm>
5701 <indexterm role="concept">
5702 <primary>delivery</primary>
5703 <secondary>suppressing immediate</secondary>
5704 </indexterm>
5705 <indexterm role="concept">
5706 <primary>queueing incoming messages</primary>
5707 </indexterm>
5708 This option applies to all modes in which Exim accepts incoming messages,
5709 including the listening daemon. It specifies that the accepting process should
5710 not automatically start a delivery process for each message received. Messages
5711 are placed on the queue, and remain there until a subsequent queue runner
5712 process encounters them. There are several configuration options (such as
5713 <option>queue_only</option>) that can be used to queue incoming messages under certain
5714 conditions. This option overrides all of them and also <option>-odqs</option>. It always
5715 forces queueing.
5716 </para>
5717 </listitem></varlistentry>
5718 <varlistentry>
5719 <term><option>-odqs</option></term>
5720 <listitem>
5721 <para>
5722 <indexterm role="option">
5723 <primary><option>-odqs</option></primary>
5724 </indexterm>
5725 <indexterm role="concept">
5726 <primary>SMTP</primary>
5727 <secondary>delaying delivery</secondary>
5728 </indexterm>
5729 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
5730 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
5731 <option>queue_only_override</option> is false and one of the queueing options in the
5732 configuration file is in effect.
5733 </para>
5734 <para>
5735 When <option>-odqs</option> does operate, a delivery process is started for each incoming
5736 message, in the background by default, but in the foreground if <option>-odi</option> is
5737 also present. The recipient addresses are routed, and local deliveries are done
5738 in the normal way. However, if any SMTP deliveries are required, they are not
5739 done at this time, so the message remains on the queue until a subsequent queue
5740 runner process encounters it. Because routing was done, Exim knows which
5741 messages are waiting for which hosts, and so a number of messages for the same
5742 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
5743 configuration option has the same effect for specific domains. See also the
5744 <option>-qq</option> option.
5745 </para>
5746 </listitem></varlistentry>
5747 <varlistentry>
5748 <term><option>-oee</option></term>
5749 <listitem>
5750 <para>
5751 <indexterm role="option">
5752 <primary><option>-oee</option></primary>
5753 </indexterm>
5754 <indexterm role="concept">
5755 <primary>error</primary>
5756 <secondary>reporting</secondary>
5757 </indexterm>
5758 If an error is detected while a non-SMTP message is being received (for
5759 example, a malformed address), the error is reported to the sender in a mail
5760 message.
5761 </para>
5762 <para>
5763 <indexterm role="concept">
5764 <primary>return code</primary>
5765 <secondary>for <option>-oee</option></secondary>
5766 </indexterm>
5767 Provided
5768 this error message is successfully sent, the Exim receiving process
5769 exits with a return code of zero. If not, the return code is 2 if the problem
5770 is that the original message has no recipients, or 1 any other error. This is
5771 the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
5772 </para>
5773 </listitem></varlistentry>
5774 <varlistentry>
5775 <term><option>-oem</option></term>
5776 <listitem>
5777 <para>
5778 <indexterm role="option">
5779 <primary><option>-oem</option></primary>
5780 </indexterm>
5781 <indexterm role="concept">
5782 <primary>error</primary>
5783 <secondary>reporting</secondary>
5784 </indexterm>
5785 <indexterm role="concept">
5786 <primary>return code</primary>
5787 <secondary>for <option>-oem</option></secondary>
5788 </indexterm>
5789 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
5790 return code, whether or not the error message was successfully sent.
5791 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
5792 </para>
5793 </listitem></varlistentry>
5794 <varlistentry>
5795 <term><option>-oep</option></term>
5796 <listitem>
5797 <para>
5798 <indexterm role="option">
5799 <primary><option>-oep</option></primary>
5800 </indexterm>
5801 <indexterm role="concept">
5802 <primary>error</primary>
5803 <secondary>reporting</secondary>
5804 </indexterm>
5805 If an error is detected while a non-SMTP message is being received, the
5806 error is reported by writing a message to the standard error file (stderr).
5807 <indexterm role="concept">
5808 <primary>return code</primary>
5809 <secondary>for <option>-oep</option></secondary>
5810 </indexterm>
5811 The return code is 1 for all errors.
5812 </para>
5813 </listitem></varlistentry>
5814 <varlistentry>
5815 <term><option>-oeq</option></term>
5816 <listitem>
5817 <para>
5818 <indexterm role="option">
5819 <primary><option>-oeq</option></primary>
5820 </indexterm>
5821 <indexterm role="concept">
5822 <primary>error</primary>
5823 <secondary>reporting</secondary>
5824 </indexterm>
5825 This option is supported for compatibility with Sendmail, but has the same
5826 effect as <option>-oep</option>.
5827 </para>
5828 </listitem></varlistentry>
5829 <varlistentry>
5830 <term><option>-oew</option></term>
5831 <listitem>
5832 <para>
5833 <indexterm role="option">
5834 <primary><option>-oew</option></primary>
5835 </indexterm>
5836 <indexterm role="concept">
5837 <primary>error</primary>
5838 <secondary>reporting</secondary>
5839 </indexterm>
5840 This option is supported for compatibility with Sendmail, but has the same
5841 effect as <option>-oem</option>.
5842 </para>
5843 </listitem></varlistentry>
5844 <varlistentry>
5845 <term><option>-oi</option></term>
5846 <listitem>
5847 <para>
5848 <indexterm role="option">
5849 <primary><option>-oi</option></primary>
5850 </indexterm>
5851 <indexterm role="concept">
5852 <primary>dot in incoming</primary>
5853 <secondary>non-SMTP message</secondary>
5854 </indexterm>
5855 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
5856 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
5857 single dot does terminate, though Exim does no special processing for other
5858 lines that start with a dot. This option is set by default if Exim is called as
5859 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
5860 </para>
5861 </listitem></varlistentry>
5862 <varlistentry>
5863 <term><option>-oitrue</option></term>
5864 <listitem>
5865 <para>
5866 <indexterm role="option">
5867 <primary><option>-oitrue</option></primary>
5868 </indexterm>
5869 This option is treated as synonymous with <option>-oi</option>.
5870 </para>
5871 </listitem></varlistentry>
5872 <varlistentry>
5873 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
5874 <listitem>
5875 <para>
5876 <indexterm role="option">
5877 <primary><option>-oMa</option></primary>
5878 </indexterm>
5879 <indexterm role="concept">
5880 <primary>sender host address</primary>
5881 <secondary>specifying for local message</secondary>
5882 </indexterm>
5883 A number of options starting with <option>-oM</option> can be used to set values associated
5884 with remote hosts on locally-submitted messages (that is, messages not received
5885 over TCP/IP). These options can be used by any caller in conjunction with the
5886 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
5887 other circumstances, they are ignored unless the caller is trusted.
5888 </para>
5889 <para>
5890 The <option>-oMa</option> option sets the sender host address. This may include a port
5891 number at the end, after a full stop (period). For example:
5892 </para>
5893 <literallayout class="monospaced">
5894 exim -bs -oMa 10.9.8.7.1234
5895 </literallayout>
5896 <para>
5897 An alternative syntax is to enclose the IP address in square brackets,
5898 followed by a colon and the port number:
5899 </para>
5900 <literallayout class="monospaced">
5901 exim -bs -oMa [10.9.8.7]:1234
5902 </literallayout>
5903 <para>
5904 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
5905 port, if present, in <varname>$sender_host_port</varname>. <phrase revisionflag="changed">If both <option>-oMa</option> and <option>-bh</option>
5906 are present on the command line, the sender host IP address is taken from
5907 whichever one is last.</phrase>
5908 </para>
5909 </listitem></varlistentry>
5910 <varlistentry>
5911 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
5912 <listitem>
5913 <para>
5914 <indexterm role="option">
5915 <primary><option>-oMaa</option></primary>
5916 </indexterm>
5917 <indexterm role="concept">
5918 <primary>authentication name</primary>
5919 <secondary>specifying for local message</secondary>
5920 </indexterm>
5921 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
5922 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
5923 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
5924 <phrase revisionflag="changed">This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
5925 authenticated SMTP session without actually using the SMTP AUTH command.</phrase>
5926 </para>
5927 </listitem></varlistentry>
5928 <varlistentry>
5929 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5930 <listitem>
5931 <para>
5932 <indexterm role="option">
5933 <primary><option>-oMai</option></primary>
5934 </indexterm>
5935 <indexterm role="concept">
5936 <primary>authentication id</primary>
5937 <secondary>specifying for local message</secondary>
5938 </indexterm>
5939 </para>
5940 <para revisionflag="changed">
5941 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
5942 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
5943 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
5944 where there is no default) for messages from local sources. See chapter
5945 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
5946 </para>
5947 </listitem></varlistentry>
5948 <varlistentry>
5949 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5950 <listitem>
5951 <para>
5952 <indexterm role="option">
5953 <primary><option>-oMas</option></primary>
5954 </indexterm>
5955 <indexterm role="concept">
5956 <primary>authentication sender</primary>
5957 <secondary>specifying for local message</secondary>
5958 </indexterm>
5959 </para>
5960 <para revisionflag="changed">
5961 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
5962 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
5963 overrides the sender address that is created from the caller&#x2019;s login id for
5964 messages from local sources, except when <option>-bh</option> is used, when there is no
5965 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
5966 specified on a MAIL command overrides this value. See chapter
5967 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
5968 </para>
5969 </listitem></varlistentry>
5970 <varlistentry>
5971 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
5972 <listitem>
5973 <para>
5974 <indexterm role="option">
5975 <primary><option>-oMi</option></primary>
5976 </indexterm>
5977 <indexterm role="concept">
5978 <primary>interface address</primary>
5979 <secondary>specifying for local message</secondary>
5980 </indexterm>
5981 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
5982 option sets the IP interface address value. A port number may be included,
5983 using the same syntax as for <option>-oMa</option>. The interface address is placed in
5984 <varname>$interface_address</varname> and the port number, if present, in <varname>$interface_port</varname>.
5985 </para>
5986 </listitem></varlistentry>
5987 <varlistentry>
5988 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
5989 <listitem>
5990 <para>
5991 <indexterm role="option">
5992 <primary><option>-oMr</option></primary>
5993 </indexterm>
5994 <indexterm role="concept">
5995 <primary>protocol</primary>
5996 <secondary>incoming &ndash; specifying for local message</secondary>
5997 </indexterm>
5998 <indexterm role="concept">
5999 <primary><varname>$received_protocol</varname></primary>
6000 </indexterm>
6001 </para>
6002 <para revisionflag="changed">
6003 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6004 option sets the received protocol value that is stored in
6005 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6006 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6007 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6008 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6009 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6010 be set by <option>-oMr</option>.
6011 </para>
6012 </listitem></varlistentry>
6013 <varlistentry>
6014 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6015 <listitem>
6016 <para>
6017 <indexterm role="option">
6018 <primary><option>-oMs</option></primary>
6019 </indexterm>
6020 <indexterm role="concept">
6021 <primary>sender host name</primary>
6022 <secondary>specifying for local message</secondary>
6023 </indexterm>
6024 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6025 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6026 present, Exim does not attempt to look up a host name from an IP address; it
6027 uses the name it is given.
6028 </para>
6029 </listitem></varlistentry>
6030 <varlistentry>
6031 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6032 <listitem>
6033 <para>
6034 <indexterm role="option">
6035 <primary><option>-oMt</option></primary>
6036 </indexterm>
6037 <indexterm role="concept">
6038 <primary>sender ident string</primary>
6039 <secondary>specifying for local message</secondary>
6040 </indexterm>
6041 </para>
6042 <para revisionflag="changed">
6043 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6044 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6045 local callers is the login id of the calling process, except when <option>-bh</option> is
6046 used, when there is no default.
6047 </para>
6048 </listitem></varlistentry>
6049 <varlistentry>
6050 <term><option>-om</option></term>
6051 <listitem>
6052 <para>
6053 <indexterm role="option">
6054 <primary><option>-om</option></primary>
6055 </indexterm>
6056 <indexterm role="concept">
6057 <primary>Sendmail compatibility</primary>
6058 <secondary><option>-om</option> option ignored</secondary>
6059 </indexterm>
6060 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6061 message should receive a copy of the message if the sender appears in an alias
6062 expansion. Exim always does this, so the option does nothing.
6063 </para>
6064 </listitem></varlistentry>
6065 <varlistentry>
6066 <term><option>-oo</option></term>
6067 <listitem>
6068 <para>
6069 <indexterm role="option">
6070 <primary><option>-oo</option></primary>
6071 </indexterm>
6072 <indexterm role="concept">
6073 <primary>Sendmail compatibility</primary>
6074 <secondary><option>-oo</option> option ignored</secondary>
6075 </indexterm>
6076 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6077 whatever that means.
6078 </para>
6079 </listitem></varlistentry>
6080 <varlistentry>
6081 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6082 <listitem>
6083 <para>
6084 <indexterm role="option">
6085 <primary><option>-oP</option></primary>
6086 </indexterm>
6087 <indexterm role="concept">
6088 <primary>pid (process id)</primary>
6089 <secondary>of daemon</secondary>
6090 </indexterm>
6091 <indexterm role="concept">
6092 <primary>daemon</primary>
6093 <secondary>process id (pid)</secondary>
6094 </indexterm>
6095 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6096 value. The option specifies the file to which the process id of the daemon is
6097 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6098 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6099 because in those cases, the normal pid file is not used.
6100 </para>
6101 </listitem></varlistentry>
6102 <varlistentry>
6103 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6104 <listitem>
6105 <para>
6106 <indexterm role="option">
6107 <primary><option>-or</option></primary>
6108 </indexterm>
6109 <indexterm role="concept">
6110 <primary>timeout</primary>
6111 <secondary>for non-SMTP input</secondary>
6112 </indexterm>
6113 This option sets a timeout value for incoming non-SMTP messages. If it is not
6114 set, Exim will wait forever for the standard input. The value can also be set
6115 by the <option>receive_timeout</option> option. The format used for specifying times is
6116 described in section <xref linkend="SECTtimeformat"/>.
6117 </para>
6118 </listitem></varlistentry>
6119 <varlistentry>
6120 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
6121 <listitem>
6122 <para>
6123 <indexterm role="option">
6124 <primary><option>-os</option></primary>
6125 </indexterm>
6126 <indexterm role="concept">
6127 <primary>timeout</primary>
6128 <secondary>for SMTP input</secondary>
6129 </indexterm>
6130 <indexterm role="concept">
6131 <primary>SMTP timeout</primary>
6132 <secondary>input</secondary>
6133 </indexterm>
6134 This option sets a timeout value for incoming SMTP messages. The timeout
6135 applies to each SMTP command and block of data. The value can also be set by
6136 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
6137 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
6138 </para>
6139 </listitem></varlistentry>
6140 <varlistentry>
6141 <term><option>-ov</option></term>
6142 <listitem>
6143 <para>
6144 <indexterm role="option">
6145 <primary><option>-ov</option></primary>
6146 </indexterm>
6147 This option has exactly the same effect as <option>-v</option>.
6148 </para>
6149 </listitem></varlistentry>
6150 <varlistentry>
6151 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
6152 <listitem>
6153 <para>
6154 <indexterm role="option">
6155 <primary><option>-oX</option></primary>
6156 </indexterm>
6157 <indexterm role="concept">
6158 <primary>TCP/IP</primary>
6159 <secondary>setting listening ports</secondary>
6160 </indexterm>
6161 <indexterm role="concept">
6162 <primary>TCP/IP</primary>
6163 <secondary>setting listening interfaces</secondary>
6164 </indexterm>
6165 <indexterm role="concept">
6166 <primary>port</primary>
6167 <secondary>receiving TCP/IP</secondary>
6168 </indexterm>
6169 This option is relevant only when the <option>-bd</option> (start listening daemon) option
6170 is also given. It controls which ports and interfaces the daemon uses. Details
6171 of the syntax, and how it interacts with configuration file options, are given
6172 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
6173 file is written unless <option>-oP</option> is also present to specify a pid file name.
6174 </para>
6175 </listitem></varlistentry>
6176 <varlistentry>
6177 <term><option>-pd</option></term>
6178 <listitem>
6179 <para>
6180 <indexterm role="option">
6181 <primary><option>-pd</option></primary>
6182 </indexterm>
6183 <indexterm role="concept">
6184 <primary>Perl</primary>
6185 <secondary>starting the interpreter</secondary>
6186 </indexterm>
6187 This option applies when an embedded Perl interpreter is linked with Exim (see
6188 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6189 option, forcing the starting of the interpreter to be delayed until it is
6190 needed.
6191 </para>
6192 </listitem></varlistentry>
6193 <varlistentry>
6194 <term><option>-ps</option></term>
6195 <listitem>
6196 <para>
6197 <indexterm role="option">
6198 <primary><option>-ps</option></primary>
6199 </indexterm>
6200 <indexterm role="concept">
6201 <primary>Perl</primary>
6202 <secondary>starting the interpreter</secondary>
6203 </indexterm>
6204 This option applies when an embedded Perl interpreter is linked with Exim (see
6205 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
6206 option, forcing the starting of the interpreter to occur as soon as Exim is
6207 started.
6208 </para>
6209 </listitem></varlistentry>
6210 <varlistentry>
6211 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
6212 <listitem>
6213 <para>
6214 <indexterm role="option">
6215 <primary><option>-p</option></primary>
6216 </indexterm>
6217 For compatibility with Sendmail, this option is equivalent to
6218 </para>
6219 <literallayout>
6220 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
6221 </literallayout>
6222 <para>
6223 It sets the incoming protocol and host name (for trusted callers). The
6224 host name and its colon can be omitted when only the protocol is to be set.
6225 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
6226 to embedded Perl. It is therefore impossible to set a protocol value of <literal>p</literal>
6227 or <literal>s</literal> using this option (but that does not seem a real limitation).
6228 </para>
6229 </listitem></varlistentry>
6230 <varlistentry>
6231 <term><option>-q</option></term>
6232 <listitem>
6233 <para>
6234 <indexterm role="option">
6235 <primary><option>-q</option></primary>
6236 </indexterm>
6237 <indexterm role="concept">
6238 <primary>queue runner</primary>
6239 <secondary>starting manually</secondary>
6240 </indexterm>
6241 This option is normally restricted to admin users. However, there is a
6242 configuration option called <option>prod_requires_admin</option> which can be set false to
6243 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
6244 and <option>-S</option> options).
6245 </para>
6246 <para>
6247 <indexterm role="concept">
6248 <primary>queue runner</primary>
6249 <secondary>description of operation</secondary>
6250 </indexterm>
6251 The <option>-q</option> option starts one queue runner process. This scans the queue of
6252 waiting messages, and runs a delivery process for each one in turn. It waits
6253 for each delivery process to finish before starting the next one. A delivery
6254 process may not actually do any deliveries if the retry times for the addresses
6255 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
6256 </para>
6257 <para>
6258 If
6259 <indexterm role="concept">
6260 <primary>SMTP</primary>
6261 <secondary>passed connection</secondary>
6262 </indexterm>
6263 <indexterm role="concept">
6264 <primary>SMTP</primary>
6265 <secondary>multiple deliveries</secondary>
6266 </indexterm>
6267 <indexterm role="concept">
6268 <primary>multiple SMTP deliveries</primary>
6269 </indexterm>
6270 the delivery process spawns other processes to deliver other messages down
6271 passed SMTP connections, the queue runner waits for these to finish before
6272 proceeding.
6273 </para>
6274 <para>
6275 When all the queued messages have been considered, the original queue runner
6276 process terminates. In other words, a single pass is made over the waiting
6277 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
6278 this to be repeated periodically.
6279 </para>
6280 <para>
6281 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
6282 random, but it is likely to be different each time, which is all that matters.
6283 If one particular message screws up a remote MTA, other messages to the same
6284 MTA have a chance of getting through if they get tried first.
6285 </para>
6286 <para>
6287 It is possible to cause the messages to be processed in lexical message id
6288 order, which is essentially the order in which they arrived, by setting the
6289 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
6290 </para>
6291 </listitem></varlistentry>
6292 <varlistentry>
6293 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
6294 <listitem>
6295 <para>
6296 The <option>-q</option> option may be followed by one or more flag letters that change its
6297 behaviour. They are all optional, but if more than one is present, they must
6298 appear in the correct order. Each flag is described in a separate item below.
6299 </para>
6300 </listitem></varlistentry>
6301 <varlistentry>
6302 <term><option>-qq...</option></term>
6303 <listitem>
6304 <para>
6305 <indexterm role="option">
6306 <primary><option>-qq</option></primary>
6307 </indexterm>
6308 <indexterm role="concept">
6309 <primary>queue</primary>
6310 <secondary>double scanning</secondary>
6311 </indexterm>
6312 <indexterm role="concept">
6313 <primary>queue</primary>
6314 <secondary>routing</secondary>
6315 </indexterm>
6316 <indexterm role="concept">
6317 <primary>routing</primary>
6318 <secondary>whole queue before delivery</secondary>
6319 </indexterm>
6320 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
6321 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
6322 every domain. Addresses are routed, local deliveries happen, but no remote
6323 transports are run.
6324 </para>
6325 <para>
6326 <indexterm role="concept">
6327 <primary>hints database</primary>
6328 <secondary>remembering routing</secondary>
6329 </indexterm>
6330 The hints database that remembers which messages are waiting for specific hosts
6331 is updated, as if delivery to those hosts had been deferred. After this is
6332 complete, a second, normal queue scan happens, with routing and delivery taking
6333 place as normal. Messages that are routed to the same host should mostly be
6334 delivered down a single SMTP
6335 <indexterm role="concept">
6336 <primary>SMTP</primary>
6337 <secondary>passed connection</secondary>
6338 </indexterm>
6339 <indexterm role="concept">
6340 <primary>SMTP</primary>
6341 <secondary>multiple deliveries</secondary>
6342 </indexterm>
6343 <indexterm role="concept">
6344 <primary>multiple SMTP deliveries</primary>
6345 </indexterm>
6346 connection because of the hints that were set up during the first queue scan.
6347 This option may be useful for hosts that are connected to the Internet
6348 intermittently.
6349 </para>
6350 </listitem></varlistentry>
6351 <varlistentry>
6352 <term><option>-q[q]i...</option></term>
6353 <listitem>
6354 <para>
6355 <indexterm role="option">
6356 <primary><option>-qi</option></primary>
6357 </indexterm>
6358 <indexterm role="concept">
6359 <primary>queue</primary>
6360 <secondary>initial delivery</secondary>
6361 </indexterm>
6362 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
6363 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
6364 delivery</quote>.) This can be helpful if you are putting messages on the queue using
6365 <option>-odq</option> and want a queue runner just to process the new messages.
6366 </para>
6367 </listitem></varlistentry>
6368 <varlistentry>
6369 <term><option>-q[q][i]f...</option></term>
6370 <listitem>
6371 <para>
6372 <indexterm role="option">
6373 <primary><option>-qf</option></primary>
6374 </indexterm>
6375 <indexterm role="concept">
6376 <primary>queue</primary>
6377 <secondary>forcing delivery</secondary>
6378 </indexterm>
6379 <indexterm role="concept">
6380 <primary>delivery</primary>
6381 <secondary>forcing in queue run</secondary>
6382 </indexterm>
6383 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
6384 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
6385 their retry times are tried.
6386 </para>
6387 </listitem></varlistentry>
6388 <varlistentry>
6389 <term><option>-q[q][i]ff...</option></term>
6390 <listitem>
6391 <para>
6392 <indexterm role="option">
6393 <primary><option>-qff</option></primary>
6394 </indexterm>
6395 <indexterm role="concept">
6396 <primary>frozen messages</primary>
6397 <secondary>forcing delivery</secondary>
6398 </indexterm>
6399 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
6400 frozen or not.
6401 </para>
6402 </listitem></varlistentry>
6403 <varlistentry>
6404 <term><option>-q[q][i][f[f]]l</option></term>
6405 <listitem>
6406 <para>
6407 <indexterm role="option">
6408 <primary><option>-ql</option></primary>
6409 </indexterm>
6410 <indexterm role="concept">
6411 <primary>queue</primary>
6412 <secondary>local deliveries only</secondary>
6413 </indexterm>
6414 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
6415 be done. If a message requires any remote deliveries, it remains on the queue
6416 for later delivery.
6417 </para>
6418 </listitem></varlistentry>
6419 <varlistentry>
6420 <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>
6421 <listitem>
6422 <para>
6423 <indexterm role="concept">
6424 <primary>queue</primary>
6425 <secondary>delivering specific messages</secondary>
6426 </indexterm>
6427 When scanning the queue, Exim can be made to skip over messages whose ids are
6428 lexically less than a given value by following the <option>-q</option> option with a
6429 starting message id. For example:
6430 </para>
6431 <literallayout class="monospaced">
6432 exim -q 0t5C6f-0000c8-00
6433 </literallayout>
6434 <para>
6435 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
6436 second message id is given, messages whose ids are lexically greater than it
6437 are also skipped. If the same id is given twice, for example,
6438 </para>
6439 <literallayout class="monospaced">
6440 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
6441 </literallayout>
6442 <para>
6443 just one delivery process is started, for that message. This differs from
6444 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
6445 that it counts as a delivery from a queue run. Note that the selection
6446 mechanism does not affect the order in which the messages are scanned. There
6447 are also other ways of selecting specific sets of messages for delivery in a
6448 queue run &ndash; see <option>-R</option> and <option>-S</option>.
6449 </para>
6450 </listitem></varlistentry>
6451 <varlistentry>
6452 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
6453 <listitem>
6454 <para>
6455 <indexterm role="concept">
6456 <primary>queue runner</primary>
6457 <secondary>starting periodically</secondary>
6458 </indexterm>
6459 <indexterm role="concept">
6460 <primary>periodic queue running</primary>
6461 </indexterm>
6462 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
6463 starting a queue runner process at intervals specified by the given time value
6464 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
6465 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
6466 single daemon process handles both functions. A common way of starting up a
6467 combined daemon at system boot time is to use a command such as
6468 </para>
6469 <literallayout class="monospaced">
6470 /usr/exim/bin/exim -bd -q30m
6471 </literallayout>
6472 <para>
6473 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
6474 process every 30 minutes.
6475 </para>
6476 <para>
6477 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
6478 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
6479 </para>
6480 </listitem></varlistentry>
6481 <varlistentry>
6482 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6483 <listitem>
6484 <para>
6485 <indexterm role="option">
6486 <primary><option>-qR</option></primary>
6487 </indexterm>
6488 This option is synonymous with <option>-R</option>. It is provided for Sendmail
6489 compatibility.
6490 </para>
6491 </listitem></varlistentry>
6492 <varlistentry>
6493 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6494 <listitem>
6495 <para>
6496 <indexterm role="option">
6497 <primary><option>-qS</option></primary>
6498 </indexterm>
6499 This option is synonymous with <option>-S</option>.
6500 </para>
6501 </listitem></varlistentry>
6502 <varlistentry>
6503 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6504 <listitem>
6505 <para>
6506 <indexterm role="option">
6507 <primary><option>-R</option></primary>
6508 </indexterm>
6509 <indexterm role="concept">
6510 <primary>queue runner</primary>
6511 <secondary>for specific recipients</secondary>
6512 </indexterm>
6513 <indexterm role="concept">
6514 <primary>delivery</primary>
6515 <secondary>to given domain</secondary>
6516 </indexterm>
6517 <indexterm role="concept">
6518 <primary>domain</primary>
6519 <secondary>delivery to</secondary>
6520 </indexterm>
6521 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
6522 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
6523 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
6524 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
6525 </para>
6526 <para>
6527 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
6528 perform a single queue run, except that, when scanning the messages on the
6529 queue, Exim processes only those that have at least one undelivered recipient
6530 address containing the given string, which is checked in a case-independent
6531 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
6532 regular expression; otherwise it is a literal string.
6533 </para>
6534 <para>
6535 Once a message is selected, all its addresses are processed. For the first
6536 selected message, Exim overrides any retry information and forces a delivery
6537 attempt for each undelivered address. This means that if delivery of any
6538 address in the first message is successful, any existing retry information is
6539 deleted, and so delivery attempts for that address in subsequently selected
6540 messages (which are processed without forcing) will run. However, if delivery
6541 of any address does not succeed, the retry information is updated, and in
6542 subsequently selected messages, the failing address will be skipped.
6543 </para>
6544 <para>
6545 <indexterm role="concept">
6546 <primary>frozen messages</primary>
6547 <secondary>forcing delivery</secondary>
6548 </indexterm>
6549 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
6550 all selected messages, not just the first; frozen messages are included when
6551 <emphasis>ff</emphasis> is present.
6552 </para>
6553 <para>
6554 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
6555 to a given domain after a host has been down for some time. When the SMTP
6556 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
6557 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
6558 an arbitrary command instead.
6559 </para>
6560 </listitem></varlistentry>
6561 <varlistentry>
6562 <term><option>-r</option></term>
6563 <listitem>
6564 <para>
6565 <indexterm role="option">
6566 <primary><option>-r</option></primary>
6567 </indexterm>
6568 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
6569 </para>
6570 </listitem></varlistentry>
6571 <varlistentry>
6572 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6573 <listitem>
6574 <para>
6575 <indexterm role="option">
6576 <primary><option>-S</option></primary>
6577 </indexterm>
6578 <indexterm role="concept">
6579 <primary>delivery</primary>
6580 <secondary>from given sender</secondary>
6581 </indexterm>
6582 <indexterm role="concept">
6583 <primary>queue runner</primary>
6584 <secondary>for specific senders</secondary>
6585 </indexterm>
6586 This option acts like <option>-R</option> except that it checks the string against each
6587 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
6588 conditions must be met for a message to be selected. If either of the options
6589 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
6590 </para>
6591 </listitem></varlistentry>
6592 <varlistentry>
6593 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
6594 <listitem>
6595 <para>
6596 <indexterm role="option">
6597 <primary><option>-Tqt</option></primary>
6598 </indexterm>
6599 This an option that is exclusively for use by the Exim testing suite. It is not
6600 recognized when Exim is run normally. It allows for the setting up of explicit
6601 <quote>queue times</quote> so that various warning/retry features can be tested.
6602 </para>
6603 </listitem></varlistentry>
6604 <varlistentry>
6605 <term><option>-t</option></term>
6606 <listitem>
6607 <para>
6608 <indexterm role="option">
6609 <primary><option>-t</option></primary>
6610 </indexterm>
6611 <indexterm role="concept">
6612 <primary>recipient</primary>
6613 <secondary>extracting from header lines</secondary>
6614 </indexterm>
6615 <indexterm role="concept">
6616 <primary><emphasis>Bcc:</emphasis> header line</primary>
6617 </indexterm>
6618 <indexterm role="concept">
6619 <primary><emphasis>Cc:</emphasis> header line</primary>
6620 </indexterm>
6621 <indexterm role="concept">
6622 <primary><emphasis>To:</emphasis> header line</primary>
6623 </indexterm>
6624 When Exim is receiving a locally-generated, non-SMTP message on its standard
6625 input, the <option>-t</option> option causes the recipients of the message to be obtained
6626 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
6627 from the command arguments. The addresses are extracted before any rewriting
6628 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
6629 </para>
6630 <para>
6631 <indexterm role="concept">
6632 <primary>Sendmail compatibility</primary>
6633 <secondary><option>-t</option> option</secondary>
6634 </indexterm>
6635 If the command has any arguments, they specify addresses to which the message
6636 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
6637 the recipients list obtained from the headers. This is compatible with Smail 3
6638 and in accordance with the documented behaviour of several versions of
6639 Sendmail, as described in man pages on a number of operating systems (e.g.
6640 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
6641 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
6642 Sendmail book documents it that way. Exim can be made to add argument addresses
6643 instead of subtracting them by setting the option
6644 <option>extract_addresses_remove_arguments</option> false.
6645 </para>
6646 <para>
6647 <indexterm role="concept">
6648 <primary><option>Resent-</option> header lines</primary>
6649 <secondary>with <option>-t</option></secondary>
6650 </indexterm>
6651 If there are any <option>Resent-</option> header lines in the message, Exim extracts
6652 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
6653 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
6654 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
6655 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
6656 </para>
6657 <para>
6658 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
6659 message is resent several times). The RFC also specifies that they should be
6660 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
6661 not at all clear how <option>-t</option> should operate in the present of multiple sets,
6662 nor indeed exactly what constitutes a <quote>set</quote>.
6663 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
6664 are often added at the end of the header, and if a message is resent more than
6665 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
6666 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
6667 </para>
6668 </listitem></varlistentry>
6669 <varlistentry>
6670 <term><option>-ti</option></term>
6671 <listitem>
6672 <para>
6673 <indexterm role="option">
6674 <primary><option>-ti</option></primary>
6675 </indexterm>
6676 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
6677 compatibility with Sendmail.
6678 </para>
6679 </listitem></varlistentry>
6680 <varlistentry>
6681 <term><option>-tls-on-connect</option></term>
6682 <listitem>
6683 <para>
6684 <indexterm role="option">
6685 <primary><option>-tls-on-connect</option></primary>
6686 </indexterm>
6687 <indexterm role="concept">
6688 <primary>TLS</primary>
6689 <secondary>use without STARTTLS</secondary>
6690 </indexterm>
6691 <indexterm role="concept">
6692 <primary>TLS</primary>
6693 <secondary>automatic start</secondary>
6694 </indexterm>
6695 This option is available when Exim is compiled with TLS support. It forces all
6696 incoming SMTP connections to behave as if the incoming port is listed in the
6697 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
6698 <xref linkend="CHAPTLS"/> for further details.
6699 </para>
6700 </listitem></varlistentry>
6701 <varlistentry>
6702 <term><option>-U</option></term>
6703 <listitem>
6704 <para>
6705 <indexterm role="option">
6706 <primary><option>-U</option></primary>
6707 </indexterm>
6708 <indexterm role="concept">
6709 <primary>Sendmail compatibility</primary>
6710 <secondary><option>-U</option> option ignored</secondary>
6711 </indexterm>
6712 Sendmail uses this option for <quote>initial message submission</quote>, and its
6713 documentation states that in future releases, it may complain about
6714 syntactically invalid messages rather than fixing them when this flag is not
6715 set. Exim ignores this option.
6716 </para>
6717 </listitem></varlistentry>
6718 <varlistentry>
6719 <term><option>-v</option></term>
6720 <listitem>
6721 <para>
6722 <indexterm role="option">
6723 <primary><option>-v</option></primary>
6724 </indexterm>
6725 This option causes Exim to write information to the standard error stream,
6726 describing what it is doing. In particular, it shows the log lines for
6727 receiving and delivering a message, and if an SMTP connection is made, the SMTP
6728 dialogue is shown. Some of the log lines shown may not actually be written to
6729 the log if the setting of <option>log_selector</option> discards them. Any relevant
6730 selectors are shown with each log line. If none are shown, the logging is
6731 unconditional.
6732 </para>
6733 </listitem></varlistentry>
6734 <varlistentry>
6735 <term><option>-x</option></term>
6736 <listitem>
6737 <para>
6738 <indexterm role="option">
6739 <primary><option>-x</option></primary>
6740 </indexterm>
6741 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
6742 National Language Support extended characters in the body of the mail item</quote>).
6743 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
6744 this option.
6745 </para>
6746 </listitem></varlistentry>
6747 </variablelist>
6748 <para>
6749 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
6750 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
6751 </para>
6752 <!-- === End of command line options === -->
6753 </section>
6754 </chapter>
6755
6756 <chapter id="CHAPconf">
6757 <title>The Exim run time configuration file</title>
6758 <titleabbrev>The runtime configuration file</titleabbrev>
6759 <para>
6760 <indexterm role="concept">
6761 <primary>run time configuration</primary>
6762 </indexterm>
6763 <indexterm role="concept">
6764 <primary>configuration file</primary>
6765 <secondary>general description</secondary>
6766 </indexterm>
6767 <indexterm role="concept">
6768 <primary>CONFIGURE_FILE</primary>
6769 </indexterm>
6770 <indexterm role="concept">
6771 <primary>configuration file</primary>
6772 <secondary>errors in</secondary>
6773 </indexterm>
6774 <indexterm role="concept">
6775 <primary>error</primary>
6776 <secondary>in configuration file</secondary>
6777 </indexterm>
6778 <indexterm role="concept">
6779 <primary>return code</primary>
6780 <secondary>for bad configuration</secondary>
6781 </indexterm>
6782 Exim uses a single run time configuration file that is read whenever an Exim
6783 binary is executed. Note that in normal operation, this happens frequently,
6784 because Exim is designed to operate in a distributed manner, without central
6785 control.
6786 </para>
6787 <para>
6788 If a syntax error is detected while reading the configuration file, Exim
6789 writes a message on the standard error, and exits with a non-zero return code.
6790 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
6791 errors can be detected at this time. The values of any expanded options are
6792 not checked until the expansion happens, even when the expansion does not
6793 actually alter the string.
6794 </para>
6795 <para>
6796 The name of the configuration file is compiled into the binary for security
6797 reasons, and is specified by the CONFIGURE_FILE compilation option. In
6798 most configurations, this specifies a single file. However, it is permitted to
6799 give a colon-separated list of file names, in which case Exim uses the first
6800 existing file in the list.
6801 </para>
6802 <para>
6803 <indexterm role="concept">
6804 <primary>EXIM_USER</primary>
6805 </indexterm>
6806 <indexterm role="concept">
6807 <primary>EXIM_GROUP</primary>
6808 </indexterm>
6809 <indexterm role="concept">
6810 <primary>CONFIGURE_OWNER</primary>
6811 </indexterm>
6812 <indexterm role="concept">
6813 <primary>CONFIGURE_GROUP</primary>
6814 </indexterm>
6815 <indexterm role="concept">
6816 <primary>configuration file</primary>
6817 <secondary>ownership</secondary>
6818 </indexterm>
6819 <indexterm role="concept">
6820 <primary>ownership</primary>
6821 <secondary>configuration file</secondary>
6822 </indexterm>
6823 The run time configuration file must be owned by root or by the user that is
6824 specified at compile time by the EXIM_USER option, or by the user that is
6825 specified at compile time by the CONFIGURE_OWNER option (if set). The
6826 configuration file must not be world-writeable or group-writeable, unless its
6827 group is the one specified at compile time by the EXIM_GROUP option or by the
6828 CONFIGURE_GROUP option.
6829 </para>
6830 <para>
6831 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
6832 to root, anybody who is able to edit the run time configuration file has an
6833 easy way to run commands as root. If you make your mail administrators members
6834 of the Exim group, but do not trust them with root, make sure that the run time
6835 configuration is not group writeable.
6836 </para>
6837 <para>
6838 A default configuration file, which will work correctly in simple situations,
6839 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
6840 defines just one file name, the installation process copies the default
6841 configuration to a new file of that name if it did not previously exist. If
6842 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
6843 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
6844 configuration.
6845 </para>
6846 <section>
6847 <title>Using a different configuration file</title>
6848 <para>
6849 <indexterm role="concept">
6850 <primary>configuration file</primary>
6851 <secondary>alternate</secondary>
6852 </indexterm>
6853 A one-off alternate configuration can be specified by the <option>-C</option> command line
6854 option, which may specify a single file or a list of files. However, when
6855 <option>-C</option> is used, Exim gives up its root privilege, unless called by root or the
6856 Exim user (or unless the argument for <option>-C</option> is identical to the built-in value
6857 from CONFIGURE_FILE). <option>-C</option> is useful mainly for checking the syntax of
6858 configuration files before installing them. No owner or group checks are done
6859 on a configuration file specified by <option>-C</option>.
6860 </para>
6861 <para>
6862 The privileged use of <option>-C</option> by the Exim user can be locked out by setting
6863 ALT_CONFIG_ROOT_ONLY in <filename>Local/Makefile</filename> when building Exim. However,
6864 if you do this, you also lock out the possibility of testing a
6865 configuration using <option>-C</option> right through message reception and delivery, even
6866 if the caller is root. The reception works, but by that time, Exim is running
6867 as the Exim user, so when it re-execs to regain privilege for the delivery, the
6868 use of <option>-C</option> causes privilege to be lost. However, root can test reception and
6869 delivery using two separate commands (one to put a message on the queue, using
6870 <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
6871 </para>
6872 <para>
6873 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
6874 prefix string with which any file named in a <option>-C</option> command line option must
6875 start. In addition, the file name must not contain the sequence <quote><literal>/../</literal></quote>.
6876 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any file
6877 name can be used with <option>-C</option>.
6878 </para>
6879 <para>
6880 One-off changes to a configuration can be specified by the <option>-D</option> command line
6881 option, which defines and overrides values for macros used inside the
6882 configuration file. However, like <option>-C</option>, the use of this option by a
6883 non-privileged user causes Exim to discard its root privilege.
6884 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
6885 completely disabled, and its use causes an immediate error exit.
6886 </para>
6887 <para>
6888 Some sites may wish to use the same Exim binary on different machines that
6889 share a file system, but to use different configuration files on each machine.
6890 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
6891 looks for a file whose name is the configuration file name followed by a dot
6892 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
6893 file does not exist, the standard name is tried. This processing occurs for
6894 each file name in the list given by CONFIGURE_FILE or <option>-C</option>.
6895 </para>
6896 <para>
6897 In some esoteric situations different versions of Exim may be run under
6898 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
6899 help with this. See the comments in <filename>src/EDITME</filename> for details.
6900 </para>
6901 </section>
6902 <section id="SECTconffilfor">
6903 <title>Configuration file format</title>
6904 <para>
6905 <indexterm role="concept">
6906 <primary>configuration file</primary>
6907 <secondary>format of</secondary>
6908 </indexterm>
6909 <indexterm role="concept">
6910 <primary>format</primary>
6911 <secondary>configuration file</secondary>
6912 </indexterm>
6913 Exim&#x2019;s configuration file is divided into a number of different parts. General
6914 option settings must always appear at the start of the file. The other parts
6915 are all optional, and may appear in any order. Each part other than the first
6916 is introduced by the word <quote>begin</quote> followed by the name of the part. The
6917 optional parts are:
6918 </para>
6919 <itemizedlist>
6920 <listitem>
6921 <para>
6922 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail.
6923 </para>
6924 </listitem>
6925 <listitem>
6926 <para>
6927 <indexterm role="concept">
6928 <primary>AUTH</primary>
6929 <secondary>configuration</secondary>
6930 </indexterm>
6931 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
6932 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
6933 </para>
6934 </listitem>
6935 <listitem>
6936 <para>
6937 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
6938 addresses and determine how the message is to be delivered.
6939 </para>
6940 </listitem>
6941 <listitem>
6942 <para>
6943 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
6944 define mechanisms for copying messages to destinations.
6945 </para>
6946 </listitem>
6947 <listitem>
6948 <para>
6949 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be immediately delivered.
6950 </para>
6951 </listitem>
6952 <listitem>
6953 <para>
6954 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
6955 when new addresses are generated during delivery.
6956 </para>
6957 </listitem>
6958 <listitem>
6959 <para>
6960 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
6961 want to use this feature, you must set
6962 </para>
6963 <literallayout class="monospaced">
6964 LOCAL_SCAN_HAS_OPTIONS=yes
6965 </literallayout>
6966 <para>
6967 in <filename>Local/Makefile</filename> before building Exim. Full details of the
6968 <function>local_scan()</function> facility are given in chapter <xref linkend="CHAPlocalscan"/>.
6969 </para>
6970 </listitem>
6971 </itemizedlist>
6972 <para>
6973 <indexterm role="concept">
6974 <primary>configuration file</primary>
6975 <secondary>leading white space in</secondary>
6976 </indexterm>
6977 <indexterm role="concept">
6978 <primary>configuration file</primary>
6979 <secondary>trailing white space in</secondary>
6980 </indexterm>
6981 <indexterm role="concept">
6982 <primary>white space</primary>
6983 <secondary>in configuration file</secondary>
6984 </indexterm>
6985 Leading and trailing white space in configuration lines is always ignored.
6986 </para>
6987 <para>
6988 Blank lines in the file, and lines starting with a # character (ignoring
6989 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
6990 # character other than at the beginning of a line is not treated specially,
6991 and does not introduce a comment.
6992 </para>
6993 <para>
6994 Any non-comment line can be continued by ending it with a backslash. Note that
6995 the general rule for white space means that trailing white space after the
6996 backslash and leading white space at the start of continuation
6997 lines is ignored. Comment lines beginning with # (but not empty lines) may
6998 appear in the middle of a sequence of continuation lines.
6999 </para>
7000 <para>
7001 A convenient way to create a configuration file is to start from the
7002 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
7003 change settings as required.
7004 </para>
7005 <para>
7006 The ACLs, retry rules, and rewriting rules have their own syntax which is
7007 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
7008 respectively. The other parts of the configuration file have some syntactic
7009 items in common, and these are described below, from section <xref linkend="SECTcos"/>
7010 onwards. Before that, the inclusion, macro, and conditional facilities are
7011 described.
7012 </para>
7013 </section>
7014 <section>
7015 <title>File inclusions in the configuration file</title>
7016 <para>
7017 <indexterm role="concept">
7018 <primary>inclusions in configuration file</primary>
7019 </indexterm>
7020 <indexterm role="concept">
7021 <primary>configuration file</primary>
7022 <secondary>including other files</secondary>
7023 </indexterm>
7024 <indexterm role="concept">
7025 <primary>.include in configuration file</primary>
7026 </indexterm>
7027 <indexterm role="concept">
7028 <primary>.include_if_exists in configuration file</primary>
7029 </indexterm>
7030 You can include other files inside Exim&#x2019;s run time configuration file by
7031 using this syntax:
7032 </para>
7033 <literallayout>
7034 <literal>.include</literal> &lt;<emphasis>file name</emphasis>&gt;
7035 <literal>.include_if_exists</literal> &lt;<emphasis>file name</emphasis>&gt;
7036 </literallayout>
7037 <para>
7038 on a line by itself. Double quotes round the file name are optional. If you use
7039 the first form, a configuration error occurs if the file does not exist; the
7040 second form does nothing for non-existent files. In all cases, an absolute file
7041 name is required.
7042 </para>
7043 <para>
7044 Includes may be nested to any depth, but remember that Exim reads its
7045 configuration file often, so it is a good idea to keep them to a minimum.
7046 If you change the contents of an included file, you must HUP the daemon,
7047 because an included file is read only when the configuration itself is read.
7048 </para>
7049 <para>
7050 The processing of inclusions happens early, at a physical line level, so, like
7051 comment lines, an inclusion can be used in the middle of an option setting,
7052 for example:
7053 </para>
7054 <literallayout class="monospaced">
7055 hosts_lookup = a.b.c \
7056                .include /some/file
7057 </literallayout>
7058 <para>
7059 Include processing happens after macro processing (see below). Its effect is to
7060 process the lines of the included file as if they occurred inline where the
7061 inclusion appears.
7062 </para>
7063 </section>
7064 <section id="SECTmacrodefs">
7065 <title>Macros in the configuration file</title>
7066 <para>
7067 <indexterm role="concept">
7068 <primary>macro</primary>
7069 <secondary>description of</secondary>
7070 </indexterm>
7071 <indexterm role="concept">
7072 <primary>configuration file</primary>
7073 <secondary>macros</secondary>
7074 </indexterm>
7075 If a line in the main part of the configuration (that is, before the first
7076 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
7077 definition, and must be of the form
7078 </para>
7079 <literallayout>
7080 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
7081 </literallayout>
7082 <para>
7083 The name must consist of letters, digits, and underscores, and need not all be
7084 in upper case, though that is recommended. The rest of the line, including any
7085 continuations, is the replacement text, and has leading and trailing white
7086 space removed. Quotes are not removed. The replacement text can never end with
7087 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
7088 </para>
7089 <para>
7090 Macros may also be defined between router, transport, authenticator, or ACL
7091 definitions. They may not, however, be defined within an individual driver or
7092 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
7093 </para>
7094 </section>
7095 <section>
7096 <title>Macro substitution</title>
7097 <para>
7098 Once a macro is defined, all subsequent lines in the file (and any included
7099 files) are scanned for the macro name; if there are several macros, the line is
7100 scanned for each in turn, in the order in which the macros are defined. The
7101 replacement text is not re-scanned for the current macro, though it is scanned
7102 for subsequently defined macros. For this reason, a macro name may not contain
7103 the name of a previously defined macro as a substring. You could, for example,
7104 define
7105 </para>
7106 <literallayout>
7107 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
7108 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
7109 </literallayout>
7110 <para>
7111 but putting the definitions in the opposite order would provoke a configuration
7112 error. Macro expansion is applied to individual physical lines from the file,
7113 before checking for line continuation or file inclusion (see above). If a line
7114 consists solely of a macro name, and the expansion of the macro is empty, the
7115 line is ignored. A macro at the start of a line may turn the line into a
7116 comment line or a <literal>.include</literal> line.
7117 </para>
7118 </section>
7119 <section>
7120 <title>Redefining macros</title>
7121 <para>
7122 Once defined, the value of a macro can be redefined later in the configuration
7123 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
7124 <emphasis>=</emphasis>. For example:
7125 </para>
7126 <literallayout class="monospaced">
7127 MAC =  initial value
7128 ...
7129 MAC == updated value
7130 </literallayout>
7131 <para>
7132 Redefinition does not alter the order in which the macros are applied to the
7133 subsequent lines of the configuration file. It is still the same order in which
7134 the macros were originally defined. All that changes is the macro&#x2019;s value.
7135 Redefinition makes it possible to accumulate values. For example:
7136 </para>
7137 <literallayout class="monospaced">
7138 MAC =  initial value
7139 ...
7140 MAC == MAC and something added
7141 </literallayout>
7142 <para>
7143 This can be helpful in situations where the configuration file is built
7144 from a number of other files.
7145 </para>
7146 </section>
7147 <section>
7148 <title>Overriding macro values</title>
7149 <para>
7150 The values set for macros in the configuration file can be overridden by the
7151 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
7152 used, unless called by root or the Exim user. A definition on the command line
7153 using the <option>-D</option> option causes all definitions and redefinitions within the
7154 file to be ignored.
7155 </para>
7156 </section>
7157 <section>
7158 <title>Example of macro usage</title>
7159 <para>
7160 As an example of macro usage, consider a configuration where aliases are looked
7161 up in a MySQL database. It helps to keep the file less cluttered if long
7162 strings such as SQL statements are defined separately as macros, for example:
7163 </para>
7164 <literallayout class="monospaced">
7165 ALIAS_QUERY = select mailbox from user where \
7166               login=${quote_mysql:$local_part};
7167 </literallayout>
7168 <para>
7169 This can then be used in a <command>redirect</command> router setting like this:
7170 </para>
7171 <literallayout class="monospaced">
7172 data = ${lookup mysql{ALIAS_QUERY}}
7173 </literallayout>
7174 <para>
7175 In earlier versions of Exim macros were sometimes used for domain, host, or
7176 address lists. In Exim 4 these are handled better by named lists &ndash; see
7177 section <xref linkend="SECTnamedlists"/>.
7178 </para>
7179 </section>
7180 <section>
7181 <title>Conditional skips in the configuration file</title>
7182 <para>
7183 <indexterm role="concept">
7184 <primary>configuration file</primary>
7185 <secondary>conditional skips</secondary>
7186 </indexterm>
7187 <indexterm role="concept">
7188 <primary>.ifdef</primary>
7189 </indexterm>
7190 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
7191 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
7192 portions of the configuration file. The processing happens whenever the file is
7193 read (that is, when an Exim binary starts to run).
7194 </para>
7195 <para>
7196 The implementation is very simple. Instances of the first four directives must
7197 be followed by text that includes the names of one or macros. The condition
7198 that is tested is whether or not any macro substitution has taken place in the
7199 line. Thus:
7200 </para>
7201 <literallayout class="monospaced">
7202 .ifdef AAA
7203 message_size_limit = 50M
7204 .else
7205 message_size_limit = 100M
7206 .endif
7207 </literallayout>
7208 <para>
7209 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined, and 100M
7210 otherwise. If there is more than one macro named on the line, the condition
7211 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
7212 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
7213 </para>
7214 <para>
7215 Although you can use a macro expansion to generate one of these directives,
7216 it is not very useful, because the condition <quote>there was a macro substitution
7217 in this line</quote> will always be true.
7218 </para>
7219 <para>
7220 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
7221 to clarify complicated nestings.
7222 </para>
7223 </section>
7224 <section id="SECTcos">
7225 <title>Common option syntax</title>
7226 <para>
7227 <indexterm role="concept">
7228 <primary>common option syntax</primary>
7229 </indexterm>
7230 <indexterm role="concept">
7231 <primary>syntax of common options</primary>
7232 </indexterm>
7233 <indexterm role="concept">
7234 <primary>configuration file</primary>
7235 <secondary>common option syntax</secondary>
7236 </indexterm>
7237 For the main set of options, driver options, and <function>local_scan()</function> options,
7238 each setting is on a line by itself, and starts with a name consisting of
7239 lower-case letters and underscores. Many options require a data value, and in
7240 these cases the name must be followed by an equals sign (with optional white
7241 space) and then the value. For example:
7242 </para>
7243 <literallayout class="monospaced">
7244 qualify_domain = mydomain.example.com
7245 </literallayout>
7246 <para>
7247 Some option settings may contain sensitive data, for example, passwords for
7248 accessing databases. To stop non-admin users from using the <option>-bP</option> command
7249 line option to read these values, you can precede the option settings with the
7250 word <quote>hide</quote>. For example:
7251 </para>
7252 <literallayout class="monospaced">
7253 hide mysql_servers = localhost/users/admin/secret-password
7254 </literallayout>
7255 <para>
7256 For non-admin users, such options are displayed like this:
7257 </para>
7258 <literallayout class="monospaced">
7259 mysql_servers = &lt;value not displayable&gt;
7260 </literallayout>
7261 <para>
7262 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
7263 all instances of the same driver.
7264 </para>
7265 <para>
7266 The following sections describe the syntax used for the different data types
7267 that are found in option settings.
7268 </para>
7269 </section>
7270 <section>
7271 <title>Boolean options</title>
7272 <para>
7273 <indexterm role="concept">
7274 <primary>format</primary>
7275 <secondary>boolean</secondary>
7276 </indexterm>
7277 <indexterm role="concept">
7278 <primary>boolean configuration values</primary>
7279 </indexterm>
7280 <indexterm role="option">
7281 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
7282 </indexterm>
7283 <indexterm role="option">
7284 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
7285 </indexterm>
7286 Options whose type is given as boolean are on/off switches. There are two
7287 different ways of specifying such options: with and without a data value. If
7288 the option name is specified on its own without data, the switch is turned on;
7289 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
7290 boolean options may be followed by an equals sign and one of the words
7291 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
7292 the following two settings have exactly the same effect:
7293 </para>
7294 <literallayout class="monospaced">
7295 queue_only
7296 queue_only = true
7297 </literallayout>
7298 <para>
7299 The following two lines also have the same (opposite) effect:
7300 </para>
7301 <literallayout class="monospaced">
7302 no_queue_only
7303 queue_only = false
7304 </literallayout>
7305 <para>
7306 You can use whichever syntax you prefer.
7307 </para>
7308 </section>
7309 <section>
7310 <title>Integer values</title>
7311 <para>
7312 <indexterm role="concept">
7313 <primary>integer configuration values</primary>
7314 </indexterm>
7315 <indexterm role="concept">
7316 <primary>format</primary>
7317 <secondary>integer</secondary>
7318 </indexterm>
7319 If an integer data item starts with the characters <quote>0x</quote>, the remainder of it
7320 is interpreted as a hexadecimal number. Otherwise, it is treated as octal if it
7321 starts with the digit 0, and decimal if not. If an integer value is followed by
7322 the letter K, it is multiplied by 1024; if it is followed by the letter M, it
7323 is multiplied by 1024x1024.
7324 </para>
7325 <para>
7326 When the values of integer option settings are output, values which are an
7327 exact multiple of 1024 or 1024x1024 are
7328 sometimes, but not always,
7329 printed using the letters K and M. The printing style is independent of the
7330 actual input format that was used.
7331 </para>
7332 </section>
7333 <section>
7334 <title>Octal integer values</title>
7335 <para>
7336 <indexterm role="concept">
7337 <primary>integer format</primary>
7338 </indexterm>
7339 <indexterm role="concept">
7340 <primary>format</primary>
7341 <secondary>octal integer</secondary>
7342 </indexterm>
7343 The value of an option specified as an octal integer is always interpreted in
7344 octal, whether or not it starts with the digit zero. Such options are always
7345 output in octal.
7346 </para>
7347 </section>
7348 <section>
7349 <title>Fixed point number values</title>
7350 <para>
7351 <indexterm role="concept">
7352 <primary>fixed point configuration values</primary>
7353 </indexterm>
7354 <indexterm role="concept">
7355 <primary>format</primary>
7356 <secondary>fixed point</secondary>
7357 </indexterm>
7358 A fixed point number consists of a decimal integer, optionally followed by a
7359 decimal point and up to three further digits.
7360 </para>
7361 </section>
7362 <section id="SECTtimeformat">
7363 <title>Time interval values</title>
7364 <para>
7365 <indexterm role="concept">
7366 <primary>time interval</primary>
7367 <secondary>specifying in configuration</secondary>
7368 </indexterm>
7369 <indexterm role="concept">
7370 <primary>format</primary>
7371 <secondary>time interval</secondary>
7372 </indexterm>
7373 A time interval is specified as a sequence of numbers, each followed by one of
7374 the following letters, with no intervening white space:
7375 </para>
7376 <informaltable frame="none">
7377 <tgroup cols="2" colsep="0" rowsep="0">
7378 <colspec colwidth="50pt" align="left"/>
7379 <colspec colwidth="254pt" align="left"/>
7380 <tbody>
7381 <row>
7382 <entry>&nbsp;<option>s</option></entry>
7383 <entry>seconds</entry>
7384 </row>
7385 <row>
7386 <entry>&nbsp;<option>m</option></entry>
7387 <entry>minutes</entry>
7388 </row>
7389 <row>
7390 <entry>&nbsp;<option>h</option></entry>
7391 <entry>hours</entry>
7392 </row>
7393 <row>
7394 <entry>&nbsp;<option>d</option></entry>
7395 <entry>days</entry>
7396 </row>
7397 <row>
7398 <entry>&nbsp;<option>w</option></entry>
7399 <entry>weeks</entry>
7400 </row>
7401 </tbody>
7402 </tgroup>
7403 </informaltable>
7404 <para>
7405 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
7406 intervals are output in the same format. Exim does not restrict the values; it
7407 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
7408 </para>
7409 </section>
7410 <section id="SECTstrings">
7411 <title>String values</title>
7412 <para>
7413 <indexterm role="concept">
7414 <primary>string</primary>
7415 <secondary>format of configuration values</secondary>
7416 </indexterm>
7417 <indexterm role="concept">
7418 <primary>format</primary>
7419 <secondary>string</secondary>
7420 </indexterm>
7421 If a string data item does not start with a double-quote character, it is taken
7422 as consisting of the remainder of the line plus any continuation lines,
7423 starting at the first character after any leading white space, with trailing
7424 white space removed, and with no interpretation of the characters in the
7425 string. Because Exim removes comment lines (those beginning with #) at an early
7426 stage, they can appear in the middle of a multi-line string. The following
7427 settings are therefore equivalent:
7428 </para>
7429 <literallayout class="monospaced">
7430 trusted_users = uucp:mail
7431
7432 trusted_users = uucp:\
7433                 # This comment line is ignored
7434                 mail
7435 </literallayout>
7436 <para>
7437 <indexterm role="concept">
7438 <primary>string</primary>
7439 <secondary>quoted</secondary>
7440 </indexterm>
7441 <indexterm role="concept">
7442 <primary>escape characters in quoted strings</primary>
7443 </indexterm>
7444 If a string does start with a double-quote, it must end with a closing
7445 double-quote, and any backslash characters other than those used for line
7446 continuation are interpreted as escape characters, as follows:
7447 </para>
7448 <informaltable frame="none">
7449 <tgroup cols="2" colsep="0" rowsep="0">
7450 <colspec colwidth="100pt" align="left"/>
7451 <colspec colwidth="254pt" align="left"/>
7452 <tbody>
7453 <row>
7454 <entry>&nbsp;<literal>\\</literal></entry>
7455 <entry>single backslash</entry>
7456 </row>
7457 <row>
7458 <entry>&nbsp;<literal>\n</literal></entry>
7459 <entry>newline</entry>
7460 </row>
7461 <row>
7462 <entry>&nbsp;<literal>\r</literal></entry>
7463 <entry>carriage return</entry>
7464 </row>
7465 <row>
7466 <entry>&nbsp;<literal>\t</literal></entry>
7467 <entry>tab</entry>
7468 </row>
7469 <row>
7470 <entry>&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
7471 <entry>up to 3 octal digits specify one character</entry>
7472 </row>
7473 <row>
7474 <entry>&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
7475 <entry>up to 2 hexadecimal digits specify one character</entry>
7476 </row>
7477 </tbody>
7478 </tgroup>
7479 </informaltable>
7480 <para>
7481 If a backslash is followed by some other character, including a double-quote
7482 character, that character replaces the pair.
7483 </para>
7484 <para>
7485 Quoting is necessary only if you want to make use of the backslash escapes to
7486 insert special characters, or if you need to specify a value with leading or
7487 trailing spaces. These cases are rare, so quoting is almost never needed in
7488 current versions of Exim. In versions of Exim before 3.14, quoting was required
7489 in order to continue lines, so you may come across older configuration files
7490 and examples that apparently quote unnecessarily.
7491 </para>
7492 </section>
7493 <section>
7494 <title>Expanded strings</title>
7495 <para>
7496 <indexterm role="concept">
7497 <primary>string expansion</primary>
7498 <secondary>definition of</secondary>
7499 </indexterm>
7500 <indexterm role="concept">
7501 <primary>expansion</primary>
7502 <secondary>definition of</secondary>
7503 </indexterm>
7504 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
7505 by which means various parts of the string may be changed according to the
7506 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
7507 is as just described; in particular, the handling of backslashes in quoted
7508 strings is done as part of the input process, before expansion takes place.
7509 However, backslash is also an escape character for the expander, so any
7510 backslashes that are required for that reason must be doubled if they are
7511 within a quoted configuration string.
7512 </para>
7513 </section>
7514 <section>
7515 <title>User and group names</title>
7516 <para>
7517 <indexterm role="concept">
7518 <primary>user name</primary>
7519 <secondary>format of</secondary>
7520 </indexterm>
7521 <indexterm role="concept">
7522 <primary>format</primary>
7523 <secondary>user name</secondary>
7524 </indexterm>
7525 <indexterm role="concept">
7526 <primary>group</primary>
7527 <secondary>name format</secondary>
7528 </indexterm>
7529 <indexterm role="concept">
7530 <primary>format</primary>
7531 <secondary>group name</secondary>
7532 </indexterm>
7533 User and group names are specified as strings, using the syntax described
7534 above, but the strings are interpreted specially. A user or group name must
7535 either consist entirely of digits, or be a name that can be looked up using the
7536 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
7537 </para>
7538 </section>
7539 <section id="SECTlistconstruct">
7540 <title>List construction</title>
7541 <para>
7542 <indexterm role="concept">
7543 <primary>list</primary>
7544 <secondary>syntax of in configuration</secondary>
7545 </indexterm>
7546 <indexterm role="concept">
7547 <primary>format</primary>
7548 <secondary>list item in configuration</secondary>
7549 </indexterm>
7550 <indexterm role="concept">
7551 <primary>string list</primary>
7552 <secondary>definition</secondary>
7553 </indexterm>
7554 The data for some configuration options is a list of items, with colon as the
7555 default separator. Many of these options are shown with type <quote>string list</quote> in
7556 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
7557 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
7558 are all the same; however, those other than <quote>string list</quote> are subject to
7559 particular kinds of interpretation, as described in chapter
7560 <xref linkend="CHAPdomhosaddlists"/>.
7561 </para>
7562 <para>
7563 In all these cases, the entire list is treated as a single string as far as the
7564 input syntax is concerned. The <option>trusted_users</option> setting in section
7565 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
7566 in a list, it must be entered as two colons. Leading and trailing white space
7567 on each item in a list is ignored. This makes it possible to include items that
7568 start with a colon, and in particular, certain forms of IPv6 address. For
7569 example, the list
7570 </para>
7571 <literallayout class="monospaced">
7572 local_interfaces = 127.0.0.1 : ::::1
7573 </literallayout>
7574 <para>
7575 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
7576 </para>
7577 <para>
7578 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
7579 list items, it is not ignored when parsing the list. The space after the first
7580 colon in the example above is necessary. If it were not there, the list would
7581 be interpreted as the two items 127.0.0.1:: and 1.
7582 </para>
7583 <para>
7584 <indexterm role="concept">
7585 <primary>list separator</primary>
7586 <secondary>changing</secondary>
7587 </indexterm>
7588 <indexterm role="concept">
7589 <primary>IPv6</primary>
7590 <secondary>addresses in lists</secondary>
7591 </indexterm>
7592 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
7593 introduced to allow the separator character to be changed. If a list begins
7594 with a left angle bracket, followed by any punctuation character, that
7595 character is used instead of colon as the list separator. For example, the list
7596 above can be rewritten to use a semicolon separator like this:
7597 </para>
7598 <literallayout class="monospaced">
7599 local_interfaces = &lt;; 127.0.0.1 ; ::1
7600 </literallayout>
7601 <para>
7602 This facility applies to all lists, with the exception of the list in
7603 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
7604 confined to circumstances where they really are needed.
7605 </para>
7606 </section>
7607 <section id="SECTempitelis">
7608 <title>Empty items in lists</title>
7609 <para>
7610 <indexterm role="concept">
7611 <primary>list</primary>
7612 <secondary>empty item in</secondary>
7613 </indexterm>
7614 An empty item at the end of a list is always ignored. In other words, trailing
7615 separator characters are ignored. Thus, the list in
7616 </para>
7617 <literallayout class="monospaced">
7618 senders = user@domain :
7619 </literallayout>
7620 <para>
7621 contains only a single item. If you want to include an empty string as one item
7622 in a list, it must not be the last item. For example, this list contains three
7623 items, the second of which is empty:
7624 </para>
7625 <literallayout class="monospaced">
7626 senders = user1@domain : : user2@domain
7627 </literallayout>
7628 <para>
7629 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
7630 are interpreted as representing a single colon data character (and the list
7631 would then contain just one item). If you want to specify a list that contains
7632 just one, empty item, you can do it as in this example:
7633 </para>
7634 <literallayout class="monospaced">
7635 senders = :
7636 </literallayout>
7637 <para>
7638 In this case, the first item is empty, and the second is discarded because it
7639 is at the end of the list.
7640 </para>
7641 </section>
7642 <section id="SECTfordricon">
7643 <title>Format of driver configurations</title>
7644 <para>
7645 <indexterm role="concept">
7646 <primary>drivers</primary>
7647 <secondary>configuration format</secondary>
7648 </indexterm>
7649 There are separate parts in the configuration for defining routers, transports,
7650 and authenticators. In each part, you are defining a number of driver
7651 instances, each with its own set of options. Each driver instance is defined by
7652 a sequence of lines like this:
7653 </para>
7654 <literallayout>
7655 &lt;<emphasis>instance name</emphasis>&gt;:
7656   &lt;<emphasis>option</emphasis>&gt;
7657   ...
7658   &lt;<emphasis>option</emphasis>&gt;
7659 </literallayout>
7660 <para>
7661 In the following example, the instance name is <command>localuser</command>, and it is
7662 followed by three options settings:
7663 </para>
7664 <literallayout class="monospaced">
7665 localuser:
7666   driver = accept
7667   check_local_user
7668   transport = local_delivery
7669 </literallayout>
7670 <para>
7671 For each driver instance, you specify which Exim code module it uses &ndash; by the
7672 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
7673 settings. For example, in the case of transports, if you want a transport to
7674 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
7675 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
7676 described in detail in its own separate chapter later in this manual.
7677 </para>
7678 <para>
7679 You can have several routers, transports, or authenticators that are based on
7680 the same underlying driver (each must have a different instance name).
7681 </para>
7682 <para>
7683 The order in which routers are defined is important, because addresses are
7684 passed to individual routers one by one, in order. The order in which
7685 transports are defined does not matter at all. The order in which
7686 authenticators are defined is used only when Exim, as a client, is searching
7687 them to find one that matches an authentication mechanism offered by the
7688 server.
7689 </para>
7690 <para>
7691 <indexterm role="concept">
7692 <primary>generic options</primary>
7693 </indexterm>
7694 <indexterm role="concept">
7695 <primary>options</primary>
7696 <secondary>generic &ndash; definition of</secondary>
7697 </indexterm>
7698 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
7699 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
7700 same type (that is, all routers, all transports or all authenticators). The
7701 <option>driver</option> option is a generic option that must appear in every definition.
7702 <indexterm role="concept">
7703 <primary>private options</primary>
7704 </indexterm>
7705 The private options are special for each driver, and none need appear, because
7706 they all have default values.
7707 </para>
7708 <para>
7709 The options may appear in any order, except that the <option>driver</option> option must
7710 precede any private options, since these depend on the particular driver. For
7711 this reason, it is recommended that <option>driver</option> always be the first option.
7712 </para>
7713 <para>
7714 Driver instance names, which are used for reference in log entries and
7715 elsewhere, can be any sequence of letters, digits, and underscores (starting
7716 with a letter) and must be unique among drivers of the same type. A router and
7717 a transport (for example) can each have the same name, but no two router
7718 instances can have the same name. The name of a driver instance should not be
7719 confused with the name of the underlying driver module. For example, the
7720 configuration lines:
7721 </para>
7722 <literallayout class="monospaced">
7723 remote_smtp:
7724   driver = smtp
7725 </literallayout>
7726 <para>
7727 create an instance of the <command>smtp</command> transport driver whose name is
7728 <command>remote_smtp</command>. The same driver code can be used more than once, with
7729 different instance names and different option settings each time. A second
7730 instance of the <command>smtp</command> transport, with different options, might be defined
7731 thus:
7732 </para>
7733 <literallayout class="monospaced">
7734 special_smtp:
7735   driver = smtp
7736   port = 1234
7737   command_timeout = 10s
7738 </literallayout>
7739 <para>
7740 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
7741 these transport instances from routers, and these names would appear in log
7742 lines.
7743 </para>
7744 <para>
7745 Comment lines may be present in the middle of driver specifications. The full
7746 list of option settings for any particular driver instance, including all the
7747 defaulted values, can be extracted by making use of the <option>-bP</option> command line
7748 option.
7749 </para>
7750 </section>
7751 </chapter>
7752
7753 <chapter id="CHAPdefconfil">
7754 <title>The default configuration file</title>
7755 <para>
7756 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
7757 <primary>configuration file</primary>
7758 <secondary>default <quote>walk through</quote></secondary>
7759 </indexterm>
7760 <indexterm role="concept">
7761 <primary>default</primary>
7762 <secondary>configuration file <quote>walk through</quote></secondary>
7763 </indexterm>
7764 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
7765 is sufficient for a host with simple mail requirements. As an introduction to
7766 the way Exim is configured, this chapter <quote>walks through</quote> the default
7767 configuration, giving brief explanations of the settings. Detailed descriptions
7768 of the options are given in subsequent chapters. The default configuration file
7769 itself contains extensive comments about ways you might want to modify the
7770 initial settings. However, note that there are many options that are not
7771 mentioned at all in the default configuration.
7772 </para>
7773 <section id="SECTdefconfmain">
7774 <title>Main configuration settings</title>
7775 <para>
7776 The main (global) configuration option settings must always come first in the
7777 file. The first thing you&#x2019;ll see in the file, after some initial comments, is
7778 the line
7779 </para>
7780 <literallayout class="monospaced">
7781 # primary_hostname =
7782 </literallayout>
7783 <para>
7784 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
7785 to know the official, fully qualified name of your host, and this is where you
7786 can specify it. However, in most cases you do not need to set this option. When
7787 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
7788 </para>
7789 <para>
7790 The first three non-comment configuration lines are as follows:
7791 </para>
7792 <literallayout class="monospaced">
7793 domainlist local_domains = @
7794 domainlist relay_to_domains =
7795 hostlist   relay_from_hosts = 127.0.0.1
7796 </literallayout>
7797 <para>
7798 These are not, in fact, option settings. They are definitions of two named
7799 domain lists and one named host list. Exim allows you to give names to lists of
7800 domains, hosts, and email addresses, in order to make it easier to manage the
7801 configuration file (see section <xref linkend="SECTnamedlists"/>).
7802 </para>
7803 <para>
7804 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
7805 later in the configuration to identify domains that are to be delivered
7806 on the local host.
7807 </para>
7808 <para>
7809 <indexterm role="concept">
7810 <primary>@ in a domain list</primary>
7811 </indexterm>
7812 There is just one item in this list, the string <quote>@</quote>. This is a special form
7813 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
7814 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
7815 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
7816 the same configuration file can be used on different hosts.
7817 </para>
7818 <para>
7819 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
7820 list itself is empty. Later in the configuration we will come to the part that
7821 controls mail relaying through the local host; it allows relaying to any
7822 domains in this list. By default, therefore, no relaying on the basis of a mail
7823 domain is permitted.
7824 </para>
7825 <para>
7826 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
7827 used later in the configuration to permit relaying from any host or IP address
7828 that matches the list. The default contains just the IP address of the IPv4
7829 loopback interface, which means that processes on the local host are able to
7830 submit mail for relaying by sending it over TCP/IP to that interface. No other
7831 hosts are permitted to submit messages for relaying.
7832 </para>
7833 <para>
7834 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
7835 we aren&#x2019;t actually setting up any controls. We are just defining some domains
7836 and hosts that will be used in the controls that are specified later.
7837 </para>
7838 <para>
7839 The next two configuration lines are genuine option settings:
7840 </para>
7841 <literallayout class="monospaced">
7842 acl_smtp_rcpt = acl_check_rcpt
7843 acl_smtp_data = acl_check_data
7844 </literallayout>
7845 <para>
7846 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
7847 during an incoming SMTP session for every recipient of a message (every RCPT
7848 command), and after the contents of the message have been received,
7849 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
7850 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
7851 section of the configuration. The RCPT ACL controls which recipients are
7852 accepted for an incoming message &ndash; if a configuration does not provide an ACL
7853 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
7854 contents of a message to be checked.
7855 </para>
7856 <para>
7857 Two commented-out option settings are next:
7858 </para>
7859 <literallayout class="monospaced">
7860 # av_scanner = clamd:/tmp/clamd
7861 # spamd_address = 127.0.0.1 783
7862 </literallayout>
7863 <para>
7864 These are example settings that can be used when Exim is compiled with the
7865 content-scanning extension. The first specifies the interface to the virus
7866 scanner, and the second specifies the interface to SpamAssassin. Further
7867 details are given in chapter <xref linkend="CHAPexiscan"/>.
7868 </para>
7869 <para revisionflag="changed">
7870 Three more commented-out option settings follow:
7871 </para>
7872 <literallayout class="monospaced" revisionflag="changed">
7873 # tls_advertise_hosts = *
7874 # tls_certificate = /etc/ssl/exim.crt
7875 # tls_privatekey = /etc/ssl/exim.pem
7876 </literallayout>
7877 <para revisionflag="changed">
7878 These are example settings that can be used when Exim is compiled with
7879 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
7880 first one specifies the list of clients that are allowed to use TLS when
7881 connecting to this server; in this case the wildcard means all clients. The
7882 other options specify where Exim should find its TLS certificate and private
7883 key, which together prove the server&#x2019;s identity to any clients that connect.
7884 More details are given in chapter <xref linkend="CHAPTLS"/>.
7885 </para>
7886 <para revisionflag="changed">
7887 Another two commented-out option settings follow:
7888 </para>
7889 <literallayout class="monospaced" revisionflag="changed">
7890 # daemon_smtp_ports = 25 : 465 : 587
7891 # tls_on_connect_ports = 465
7892 </literallayout>
7893 <para revisionflag="changed">
7894 <indexterm role="concept">
7895 <primary>port</primary>
7896 <secondary>465 and 587</secondary>
7897 </indexterm>
7898 <indexterm role="concept">
7899 <primary>port</primary>
7900 <secondary>for message submission</secondary>
7901 </indexterm>
7902 <indexterm role="concept">
7903 <primary>message</primary>
7904 <secondary>submission, ports for</secondary>
7905 </indexterm>
7906 <indexterm role="concept">
7907 <primary>ssmtp protocol</primary>
7908 </indexterm>
7909 <indexterm role="concept">
7910 <primary>smtps protocol</primary>
7911 </indexterm>
7912 <indexterm role="concept">
7913 <primary>SMTP</primary>
7914 <secondary>ssmtp protocol</secondary>
7915 </indexterm>
7916 <indexterm role="concept">
7917 <primary>SMTP</primary>
7918 <secondary>smtps protocol</secondary>
7919 </indexterm>
7920 These options provide better support for roaming users who wish to use this
7921 server for message submission. They are not much use unless you have turned on
7922 TLS (as described in the previous paragraph) and authentication (about which
7923 more in section <xref linkend="SECTdefconfauth"/>). The usual SMTP port 25 is often blocked
7924 on end-user networks, so RFC 4409 specifies that message submission should use
7925 port 587 instead. However some software (notably Microsoft Outlook) cannot be
7926 configured to use port 587 correctly, so these settings also enable the
7927 non-standard <quote>smtps</quote> (aka <quote>ssmtp</quote>) port 465 (see section
7928 <xref linkend="SECTsupobssmt"/>).
7929 </para>
7930 <para>
7931 Two more commented-out options settings follow:
7932 </para>
7933 <literallayout class="monospaced">
7934 # qualify_domain =
7935 # qualify_recipient =
7936 </literallayout>
7937 <para>
7938 The first of these specifies a domain that Exim uses when it constructs a
7939 complete email address from a local login name. This is often needed when Exim
7940 receives a message from a local process. If you do not set <option>qualify_domain</option>,
7941 the value of <option>primary_hostname</option> is used. If you set both of these options,
7942 you can have different qualification domains for sender and recipient
7943 addresses. If you set only the first one, its value is used in both cases.
7944 </para>
7945 <para>
7946 <indexterm role="concept">
7947 <primary>domain literal</primary>
7948 <secondary>recognizing format</secondary>
7949 </indexterm>
7950 The following line must be uncommented if you want Exim to recognize
7951 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
7952 (an IP address within square brackets) instead of a named domain.
7953 </para>
7954 <literallayout class="monospaced">
7955 # allow_domain_literals
7956 </literallayout>
7957 <para>
7958 The RFCs still require this form, but many people think that in the modern
7959 Internet it makes little sense to permit mail to be sent to specific hosts by
7960 quoting their IP addresses. This ancient format has been used by people who
7961 try to abuse hosts by using them for unwanted relaying. However, some
7962 people believe there are circumstances (for example, messages addressed to
7963 <emphasis>postmaster</emphasis>) where domain literals are still useful.
7964 </para>
7965 <para>
7966 The next configuration line is a kind of trigger guard:
7967 </para>
7968 <literallayout class="monospaced">
7969 never_users = root
7970 </literallayout>
7971 <para>
7972 It specifies that no delivery must ever be run as the root user. The normal
7973 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
7974 setting is a guard against slips in the configuration.
7975 The list of users specified by <option>never_users</option> is not, however, the complete
7976 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
7977 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
7978 contents of <option>never_users</option> are added to this list. By default
7979 FIXED_NEVER_USERS also specifies root.
7980 </para>
7981 <para>
7982 When a remote host connects to Exim in order to send mail, the only information
7983 Exim has about the host&#x2019;s identity is its IP address. The next configuration
7984 line,
7985 </para>
7986 <literallayout class="monospaced">
7987 host_lookup = *
7988 </literallayout>
7989 <para>
7990 specifies that Exim should do a reverse DNS lookup on all incoming connections,
7991 in order to get a host name. This improves the quality of the logging
7992 information, but if you feel it is too expensive, you can remove it entirely,
7993 or restrict the lookup to hosts on <quote>nearby</quote> networks.
7994 Note that it is not always possible to find a host name from an IP address,
7995 because not all DNS reverse zones are maintained, and sometimes DNS servers are
7996 unreachable.
7997 </para>
7998 <para>
7999 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
8000 1413 (hence their names):
8001 </para>
8002 <literallayout class="monospaced">
8003 rfc1413_hosts = *
8004 rfc1413_query_timeout = 5s
8005 </literallayout>
8006 <para>
8007 These settings cause Exim to make ident callbacks for all incoming SMTP calls.
8008 You can limit the hosts to which these calls are made, or change the timeout
8009 that is used. If you set the timeout to zero, all ident calls are disabled.
8010 Although they are cheap and can provide useful information for tracing problem
8011 messages, some hosts and firewalls have problems with ident calls. This can
8012 result in a timeout instead of an immediate refused connection, leading to
8013 delays on starting up an incoming SMTP session.
8014 </para>
8015 <para>
8016 When Exim receives messages over SMTP connections, it expects all addresses to
8017 be fully qualified with a domain, as required by the SMTP definition. However,
8018 if you are running a server to which simple clients submit messages, you may
8019 find that they send unqualified addresses. The two commented-out options:
8020 </para>
8021 <literallayout class="monospaced">
8022 # sender_unqualified_hosts =
8023 # recipient_unqualified_hosts =
8024 </literallayout>
8025 <para>
8026 show how you can specify hosts that are permitted to send unqualified sender
8027 and recipient addresses, respectively.
8028 </para>
8029 <para>
8030 The <option>percent_hack_domains</option> option is also commented out:
8031 </para>
8032 <literallayout class="monospaced">
8033 # percent_hack_domains =
8034 </literallayout>
8035 <para>
8036 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
8037 This is an almost obsolete form of explicit email routing. If you do not know
8038 anything about it, you can safely ignore this topic.
8039 </para>
8040 <para>
8041 The last two settings in the main part of the default configuration are
8042 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
8043 message is frozen, Exim no longer continues to try to deliver it. Freezing
8044 occurs when a bounce message encounters a permanent failure because the sender
8045 address of the original message that caused the bounce is invalid, so the
8046 bounce cannot be delivered. This is probably the most common case, but there
8047 are also other conditions that cause freezing, and frozen messages are not
8048 always bounce messages.
8049 </para>
8050 <literallayout class="monospaced">
8051 ignore_bounce_errors_after = 2d
8052 timeout_frozen_after = 7d
8053 </literallayout>
8054 <para>
8055 The first of these options specifies that failing bounce messages are to be
8056 discarded after 2 days on the queue. The second specifies that any frozen
8057 message (whether a bounce message or not) is to be timed out (and discarded)
8058 after a week. In this configuration, the first setting ensures that no failing
8059 bounce message ever lasts a week.
8060 </para>
8061 </section>
8062 <section>
8063 <title>ACL configuration</title>
8064 <para>
8065 <indexterm role="concept">
8066 <primary>default</primary>
8067 <secondary>ACLs</secondary>
8068 </indexterm>
8069 <indexterm role="concept">
8070 <primary>access control lists (ACLs)</primary>
8071 <secondary>default configuration</secondary>
8072 </indexterm>
8073 In the default configuration, the ACL section follows the main configuration.
8074 It starts with the line
8075 </para>
8076 <literallayout class="monospaced">
8077 begin acl
8078 </literallayout>
8079 <para>
8080 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
8081 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
8082 and <option>acl_smtp_data</option> above.
8083 </para>
8084 <para>
8085 <indexterm role="concept">
8086 <primary>RCPT</primary>
8087 <secondary>ACL for</secondary>
8088 </indexterm>
8089 The first ACL is used for every RCPT command in an incoming SMTP message. Each
8090 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
8091 are considered in order, until the recipient address is either accepted or
8092 rejected. The RCPT command is then accepted or rejected, according to the
8093 result of the ACL processing.
8094 </para>
8095 <literallayout class="monospaced">
8096 acl_check_rcpt:
8097 </literallayout>
8098 <para>
8099 This line, consisting of a name terminated by a colon, marks the start of the
8100 ACL, and names it.
8101 </para>
8102 <literallayout class="monospaced">
8103 accept  hosts = :
8104 </literallayout>
8105 <para>
8106 This ACL statement accepts the recipient if the sending host matches the list.
8107 But what does that strange list mean? It doesn&#x2019;t actually contain any host
8108 names or IP addresses. The presence of the colon puts an empty item in the
8109 list; Exim matches this only if the incoming message did not come from a remote
8110 host, because in that case, the remote hostname is empty. The colon is
8111 important. Without it, the list itself is empty, and can never match anything.
8112 </para>
8113 <para>
8114 What this statement is doing is to accept unconditionally all recipients in
8115 messages that are submitted by SMTP from local processes using the standard
8116 input and output (that is, not using TCP/IP). A number of MUAs operate in this
8117 manner.
8118 </para>
8119 <literallayout class="monospaced">
8120 deny    message       = Restricted characters in address
8121         domains       = +local_domains
8122         local_parts   = ^[.] : ^.*[@%!/|]
8123
8124 deny    message       = Restricted characters in address
8125         domains       = !+local_domains
8126         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
8127 </literallayout>
8128 <para>
8129 These statements are concerned with local parts that contain any of the
8130 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
8131 Although these characters are entirely legal in local parts (in the case of
8132 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
8133 in Internet mail addresses.
8134 </para>
8135 <para>
8136 The first three have in the past been associated with explicitly routed
8137 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
8138 option). Addresses containing these characters are regularly tried by spammers
8139 in an attempt to bypass relaying restrictions, and also by open relay testing
8140 programs. Unless you really need them it is safest to reject these characters
8141 at this early stage. This configuration is heavy-handed in rejecting these
8142 characters for all messages it accepts from remote hosts. This is a deliberate
8143 policy of being as safe as possible.
8144 </para>
8145 <para>
8146 The first rule above is stricter, and is applied to messages that are addressed
8147 to one of the local domains handled by this host. This is implemented by the
8148 first condition, which restricts it to domains that are listed in the
8149 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8150 reference to a named list. In this configuration, there is just one domain in
8151 <emphasis>local_domains</emphasis>, but in general there may be many.
8152 </para>
8153 <para>
8154 The second condition on the first statement uses two regular expressions to
8155 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
8156 or <quote>|</quote>. If you have local accounts that include these characters, you will
8157 have to modify this rule.
8158 </para>
8159 <para>
8160 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
8161 allows them because they have been encountered in practice. (Consider the
8162 common convention of local parts constructed as
8163 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
8164 the author of Exim, who has no second initial.) However, a local part starting
8165 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
8166 file name (for example, for a mailing list). This is also true for local parts
8167 that contain slashes. A pipe symbol can also be troublesome if the local part
8168 is incorporated unthinkingly into a shell command line.
8169 </para>
8170 <para>
8171 The second rule above applies to all other domains, and is less strict. This
8172 allows your own users to send outgoing messages to sites that use slashes
8173 and vertical bars in their local parts. It blocks local parts that begin
8174 with a dot, slash, or vertical bar, but allows these characters within the
8175 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
8176 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
8177 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
8178 </para>
8179 <literallayout class="monospaced">
8180 accept  local_parts   = postmaster
8181         domains       = +local_domains
8182 </literallayout>
8183 <para>
8184 This statement, which has two conditions, accepts an incoming address if the
8185 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
8186 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
8187 reference to a named list. In this configuration, there is just one domain in
8188 <emphasis>local_domains</emphasis>, but in general there may be many.
8189 </para>
8190 <para>
8191 The presence of this statement means that mail to postmaster is never blocked
8192 by any of the subsequent tests. This can be helpful while sorting out problems
8193 in cases where the subsequent tests are incorrectly denying access.
8194 </para>
8195 <literallayout class="monospaced">
8196 require verify        = sender
8197 </literallayout>
8198 <para>
8199 This statement requires the sender address to be verified before any subsequent
8200 ACL statement can be used. If verification fails, the incoming recipient
8201 address is refused. Verification consists of trying to route the address, to
8202 see if a bounce message could be delivered to it. In the case of remote
8203 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
8204 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
8205 discusses the details of address verification.
8206 </para>
8207 <literallayout class="monospaced">
8208 accept  hosts         = +relay_from_hosts
8209         control       = submission
8210 </literallayout>
8211 <para>
8212 This statement accepts the address if the message is coming from one of the
8213 hosts that are defined as being allowed to relay through this host. Recipient
8214 verification is omitted here, because in many cases the clients are dumb MUAs
8215 that do not cope well with SMTP error responses. For the same reason, the
8216 second line specifies <quote>submission mode</quote> for messages that are accepted. This
8217 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
8218 messages that are deficient in some way, for example, because they lack a
8219 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
8220 probably add recipient verification here, and disable submission mode.
8221 </para>
8222 <literallayout class="monospaced">
8223 accept  authenticated = *
8224         control       = submission
8225 </literallayout>
8226 <para>
8227 This statement accepts the address if the client host has authenticated itself.
8228 Submission mode is again specified, on the grounds that such messages are most
8229 likely to come from MUAs. The default configuration does not define any
8230 authenticators, though it does include some nearly complete commented-out
8231 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
8232 fact authenticate until you complete the authenticator definitions.
8233 </para>
8234 <literallayout class="monospaced" revisionflag="changed">
8235 require message = relay not permitted
8236         domains = +local_domains : +relay_domains
8237 </literallayout>
8238 <para revisionflag="changed">
8239 This statement rejects the address if its domain is neither a local domain nor
8240 one of the domains for which this host is a relay.
8241 </para>
8242 <literallayout class="monospaced" revisionflag="changed">
8243 require verify = recipient
8244 </literallayout>
8245 <para revisionflag="changed">
8246 This statement requires the recipient address to be verified; if verification
8247 fails, the address is rejected.
8248 </para>
8249 <literallayout class="monospaced" revisionflag="changed">
8250 # deny    message     = rejected because $sender_host_address \
8251 #                       is in a black list at $dnslist_domain\n\
8252 #                       $dnslist_text
8253 #         dnslists    = black.list.example
8254 #
8255 # warn    dnslists    = black.list.example
8256 #         add_header  = X-Warning: $sender_host_address is in \
8257 #                       a black list at $dnslist_domain
8258 #         log_message = found in $dnslist_domain
8259 </literallayout>
8260 <para revisionflag="changed">
8261 These commented-out lines are examples of how you could configure Exim to check
8262 sending hosts against a DNS black list. The first statement rejects messages
8263 from blacklisted hosts, whereas the second just inserts a warning header
8264 line.
8265 </para>
8266 <literallayout class="monospaced" revisionflag="changed">
8267 # require verify = csa
8268 </literallayout>
8269 <para revisionflag="changed">
8270 This commented-out line is an example of how you could turn on client SMTP
8271 authorization (CSA) checking. Such checks do DNS lookups for special SRV
8272 records.
8273 </para>
8274 <literallayout class="monospaced" revisionflag="changed">
8275 accept
8276 </literallayout>
8277 <para revisionflag="changed">
8278 The final statement in the first ACL unconditionally accepts any recipient
8279 address that has successfully passed all the previous tests.
8280 </para>
8281 <literallayout class="monospaced">
8282 acl_check_data:
8283 </literallayout>
8284 <para>
8285 This line marks the start of the second ACL, and names it. Most of the contents
8286 of this ACL are commented out:
8287 </para>
8288 <literallayout class="monospaced">
8289 # deny    malware   = *
8290 #         message   = This message contains a virus \
8291 #                     ($malware_name).
8292 </literallayout>
8293 <para>
8294 These lines are examples of how to arrange for messages to be scanned for
8295 viruses when Exim has been compiled with the content-scanning extension, and a
8296 suitable virus scanner is installed. If the message is found to contain a
8297 virus, it is rejected with the given custom error message.
8298 </para>
8299 <literallayout class="monospaced">
8300 # warn    spam      = nobody
8301 #         message   = X-Spam_score: $spam_score\n\
8302 #                     X-Spam_score_int: $spam_score_int\n\
8303 #                     X-Spam_bar: $spam_bar\n\
8304 #                     X-Spam_report: $spam_report
8305 </literallayout>
8306 <para>
8307 These lines are an example of how to arrange for messages to be scanned by
8308 SpamAssassin when Exim has been compiled with the content-scanning extension,
8309 and SpamAssassin has been installed. The SpamAssassin check is run with
8310 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
8311 series of extra header line. In this case, the message is not rejected,
8312 whatever the spam score.
8313 </para>
8314 <literallayout class="monospaced">
8315 accept
8316 </literallayout>
8317 <para>
8318 This final line in the DATA ACL accepts the message unconditionally.
8319 </para>
8320 </section>
8321 <section>
8322 <title>Router configuration</title>
8323 <para>
8324 <indexterm role="concept">
8325 <primary>default</primary>
8326 <secondary>routers</secondary>
8327 </indexterm>
8328 <indexterm role="concept">
8329 <primary>routers</primary>
8330 <secondary>default</secondary>
8331 </indexterm>
8332 The router configuration comes next in the default configuration, introduced
8333 by the line
8334 </para>
8335 <literallayout class="monospaced">
8336 begin routers
8337 </literallayout>
8338 <para>
8339 Routers are the modules in Exim that make decisions about where to send
8340 messages. An address is passed to each router in turn, until it is either
8341 accepted, or failed. This means that the order in which you define the routers
8342 matters. Each router is fully described in its own chapter later in this
8343 manual. Here we give only brief overviews.
8344 </para>
8345 <literallayout class="monospaced">
8346 # domain_literal:
8347 #   driver = ipliteral
8348 #   domains = !+local_domains
8349 #   transport = remote_smtp
8350 </literallayout>
8351 <para>
8352 <indexterm role="concept">
8353 <primary>domain literal</primary>
8354 <secondary>default router</secondary>
8355 </indexterm>
8356 This router is commented out because the majority of sites do not want to
8357 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
8358 you uncomment this router, you also need to uncomment the setting of
8359 <option>allow_domain_literals</option> in the main part of the configuration.
8360 </para>
8361 <literallayout class="monospaced">
8362 dnslookup:
8363   driver = dnslookup
8364   domains = ! +local_domains
8365   transport = remote_smtp
8366   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
8367   no_more
8368 </literallayout>
8369 <para>
8370 The first uncommented router handles addresses that do not involve any local
8371 domains. This is specified by the line
8372 </para>
8373 <literallayout class="monospaced">
8374 domains = ! +local_domains
8375 </literallayout>
8376 <para>
8377 The <option>domains</option> option lists the domains to which this router applies, but the
8378 exclamation mark is a negation sign, so the router is used only for domains
8379 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
8380 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
8381 indicates that it is referring to a named list. Addresses in other domains are
8382 passed on to the following routers.
8383 </para>
8384 <para>
8385 The name of the router driver is <command>dnslookup</command>,
8386 and is specified by the <option>driver</option> option. Do not be confused by the fact that
8387 the name of this router instance is the same as the name of the driver. The
8388 instance name is arbitrary, but the name set in the <option>driver</option> option must be
8389 one of the driver modules that is in the Exim binary.
8390 </para>
8391 <para>
8392 The <command>dnslookup</command> router routes addresses by looking up their domains in the
8393 DNS in order to obtain a list of hosts to which the address is routed. If the
8394 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
8395 specified by the <option>transport</option> option. If the router does not find the domain
8396 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
8397 the address fails and is bounced.
8398 </para>
8399 <para>
8400 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
8401 be entirely ignored. This option is present because a number of cases have been
8402 encountered where MX records in the DNS point to host names
8403 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
8404 Completely ignoring these IP addresses causes Exim to fail to route the
8405 email address, so it bounces. Otherwise, Exim would log a routing problem, and
8406 continue to try to deliver the message periodically until the address timed
8407 out.
8408 </para>
8409 <literallayout class="monospaced">
8410 system_aliases:
8411   driver = redirect
8412   allow_fail
8413   allow_defer
8414   data = ${lookup{$local_part}lsearch{/etc/aliases}}
8415 # user = exim
8416   file_transport = address_file
8417   pipe_transport = address_pipe
8418 </literallayout>
8419 <para>
8420 Control reaches this and subsequent routers only for addresses in the local
8421 domains. This router checks to see whether the local part is defined as an
8422 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
8423 data that it looks up from that file. If no data is found for the local part,
8424 the value of the <option>data</option> option is empty, causing the address to be passed to
8425 the next router.
8426 </para>
8427 <para>
8428 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
8429 often used. That is why it is referenced by from the default configuration
8430 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
8431 <filename>Local/Makefile</filename> before building Exim.
8432 </para>
8433 <literallayout class="monospaced">
8434 userforward:
8435   driver = redirect
8436   check_local_user
8437 # local_part_suffix = +* : -*
8438 # local_part_suffix_optional
8439   file = $home/.forward
8440 # allow_filter
8441   no_verify
8442   no_expn
8443   check_ancestor
8444   file_transport = address_file
8445   pipe_transport = address_pipe
8446   reply_transport = address_reply
8447 </literallayout>
8448 <para>
8449 This is the most complicated router in the default configuration. It is another
8450 redirection router, but this time it is looking for forwarding data set up by
8451 individual users. The <option>check_local_user</option> setting specifies a check that the
8452 local part of the address is the login name of a local user. If it is not, the
8453 router is skipped. The two commented options that follow <option>check_local_user</option>,
8454 namely:
8455 </para>
8456 <literallayout class="monospaced">
8457 # local_part_suffix = +* : -*
8458 # local_part_suffix_optional
8459 </literallayout>
8460 <para>
8461 <indexterm role="concept">
8462 <primary><varname>$local_part_suffix</varname></primary>
8463 </indexterm>
8464 show how you can specify the recognition of local part suffixes. If the first
8465 is uncommented, a suffix beginning with either a plus or a minus sign, followed
8466 by any sequence of characters, is removed from the local part and placed in the
8467 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
8468 presence of a suffix in the local part is optional. When a suffix is present,
8469 the check for a local login uses the local part with the suffix removed.
8470 </para>
8471 <para>
8472 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
8473 home directory is consulted. If it does not exist, or is empty, the router
8474 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
8475 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
8476 </para>
8477 <para>
8478 <indexterm role="concept">
8479 <primary>Sieve filter</primary>
8480 <secondary>enabling in default router</secondary>
8481 </indexterm>
8482 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
8483 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
8484 is commented out by default), the contents of the file are interpreted as a set
8485 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
8486 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
8487 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
8488 </para>
8489 <para>
8490 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
8491 verifying addresses, or when running as a consequence of an SMTP EXPN command.
8492 There are two reasons for doing this:
8493 </para>
8494 <orderedlist numeration="arabic">
8495 <listitem>
8496 <para>
8497 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
8498 checking an address for validity; it makes sense not to waste resources doing
8499 unnecessary work.
8500 </para>
8501 </listitem>
8502 <listitem>
8503 <para>
8504 More importantly, when Exim is verifying addresses or handling an EXPN
8505 command during an SMTP session, it is running as the Exim user, not as root.
8506 The group is the Exim group, and no additional groups are set up.
8507 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
8508 this time.
8509 </para>
8510 </listitem>
8511 </orderedlist>
8512 <para>
8513 The setting of <option>check_ancestor</option> prevents the router from generating a new
8514 address that is the same as any previous address that was redirected. (This
8515 works round a problem concerning a bad interaction between aliasing and
8516 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
8517 </para>
8518 <para>
8519 The final three option settings specify the transports that are to be used when
8520 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
8521 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
8522 </para>
8523 <literallayout class="monospaced">
8524 a.nother@elsewhere.example, /home/spqr/archive
8525 </literallayout>
8526 <para>
8527 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
8528 transport.
8529 </para>
8530 <literallayout class="monospaced">
8531 localuser:
8532   driver = accept
8533   check_local_user
8534 # local_part_suffix = +* : -*
8535 # local_part_suffix_optional
8536   transport = local_delivery
8537 </literallayout>
8538 <para>
8539 The final router sets up delivery into local mailboxes, provided that the local
8540 part is the name of a local login, by accepting the address and assigning it to
8541 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
8542 routers, so the address is bounced. The commented suffix settings fulfil the
8543 same purpose as they do for the <command>userforward</command> router.
8544 </para>
8545 </section>
8546 <section>
8547 <title>Transport configuration</title>
8548 <para>
8549 <indexterm role="concept">
8550 <primary>default</primary>
8551 <secondary>transports</secondary>
8552 </indexterm>
8553 <indexterm role="concept">
8554 <primary>transports</primary>
8555 <secondary>default</secondary>
8556 </indexterm>
8557 Transports define mechanisms for actually delivering messages. They operate
8558 only when referenced from routers, so the order in which they are defined does
8559 not matter. The transports section of the configuration starts with
8560 </para>
8561 <literallayout class="monospaced">
8562 begin transports
8563 </literallayout>
8564 <para>
8565 One remote transport and four local transports are defined.
8566 </para>
8567 <literallayout class="monospaced">
8568 remote_smtp:
8569   driver = smtp
8570 </literallayout>
8571 <para>
8572 This transport is used for delivering messages over SMTP connections. All its
8573 options are defaulted. The list of remote hosts comes from the router.
8574 </para>
8575 <literallayout class="monospaced">
8576 local_delivery:
8577   driver = appendfile
8578   file = /var/mail/$local_part
8579   delivery_date_add
8580   envelope_to_add
8581   return_path_add
8582 # group = mail
8583 # mode = 0660
8584 </literallayout>
8585 <para>
8586 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
8587 traditional BSD mailbox format. By default it runs under the uid and gid of the
8588 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
8589 directory. Some systems use the alternative approach of running mail deliveries
8590 under a particular group instead of using the sticky bit. The commented options
8591 show how this can be done.
8592 </para>
8593 <para>
8594 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
8595 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
8596 similarly-named options above.
8597 </para>
8598 <literallayout class="monospaced">
8599 address_pipe:
8600   driver = pipe
8601   return_output
8602 </literallayout>
8603 <para>
8604 This transport is used for handling deliveries to pipes that are generated by
8605 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
8606 option specifies that any output generated by the pipe is to be returned to the
8607 sender.
8608 </para>
8609 <literallayout class="monospaced">
8610 address_file:
8611   driver = appendfile
8612   delivery_date_add
8613   envelope_to_add
8614   return_path_add
8615 </literallayout>
8616 <para>
8617 This transport is used for handling deliveries to files that are generated by
8618 redirection. The name of the file is not specified in this instance of
8619 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
8620 </para>
8621 <literallayout class="monospaced">
8622 address_reply:
8623   driver = autoreply
8624 </literallayout>
8625 <para>
8626 This transport is used for handling automatic replies generated by users&#x2019;
8627 filter files.
8628 </para>
8629 </section>
8630 <section>
8631 <title>Default retry rule</title>
8632 <para>
8633 <indexterm role="concept">
8634 <primary>retry</primary>
8635 <secondary>default rule</secondary>
8636 </indexterm>
8637 <indexterm role="concept">
8638 <primary>default</primary>
8639 <secondary>retry rule</secondary>
8640 </indexterm>
8641 The retry section of the configuration file contains rules which affect the way
8642 Exim retries deliveries that cannot be completed at the first attempt. It is
8643 introduced by the line
8644 </para>
8645 <literallayout class="monospaced">
8646 begin retry
8647 </literallayout>
8648 <para>
8649 In the default configuration, there is just one rule, which applies to all
8650 errors:
8651 </para>
8652 <literallayout class="monospaced">
8653 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
8654 </literallayout>
8655 <para>
8656 This causes any temporarily failing address to be retried every 15 minutes for
8657 2 hours, then at intervals starting at one hour and increasing by a factor of
8658 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
8659 is not delivered after 4 days of temporary failure, it is bounced.
8660 </para>
8661 </section>
8662 <section>
8663 <title>Rewriting configuration</title>
8664 <para>
8665 The rewriting section of the configuration, introduced by
8666 </para>
8667 <literallayout class="monospaced">
8668 begin rewrite
8669 </literallayout>
8670 <para>
8671 contains rules for rewriting addresses in messages as they arrive. There are no
8672 rewriting rules in the default configuration file.
8673 </para>
8674 </section>
8675 <section id="SECTdefconfauth">
8676 <title>Authenticators configuration</title>
8677 <para>
8678 <indexterm role="concept">
8679 <primary>AUTH</primary>
8680 <secondary>configuration</secondary>
8681 </indexterm>
8682 The authenticators section of the configuration, introduced by
8683 </para>
8684 <literallayout class="monospaced">
8685 begin authenticators
8686 </literallayout>
8687 <para>
8688 defines mechanisms for the use of the SMTP AUTH command. The default
8689 configuration file contains two commented-out example authenticators
8690 which support plaintext username/password authentication using the
8691 standard PLAIN mechanism and the traditional but non-standard LOGIN
8692 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
8693 to support most MUA software.
8694 </para>
8695 <para>
8696 The example PLAIN authenticator looks like this:
8697 </para>
8698 <literallayout class="monospaced">
8699 #PLAIN:
8700 #  driver                     = plaintext
8701 #  server_set_id              = $auth2
8702 #  server_prompts             = :
8703 #  server_condition           = Authentication is not yet configured
8704 #  server_advertise_condition = ${if def:tls_cipher }
8705 </literallayout>
8706 <para>
8707 And the example LOGIN authenticator looks like this:
8708 </para>
8709 <literallayout class="monospaced">
8710 #LOGIN:
8711 #  driver                     = plaintext
8712 #  server_set_id              = $auth1
8713 #  server_prompts             = &lt;| Username: | Password:
8714 #  server_condition           = Authentication is not yet configured
8715 #  server_advertise_condition = ${if def:tls_cipher }
8716 </literallayout>
8717 <para>
8718 The <option>server_set_id</option> option makes Exim remember the authenticated username
8719 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
8720 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
8721 that it implements the details of the specific authentication mechanism,
8722 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
8723 when Exim offers authentication to clients; in the examples, this is only
8724 when TLS or SSL has been started, so to enable the authenticators you also
8725 need to add support for TLS as described in <xref linkend="SECTdefconfmain"/>.
8726 </para>
8727 <para>
8728 The <option>server_condition</option> setting defines how to verify that the username and
8729 password are correct. In the examples it just produces an error message.
8730 To make the authenticators work, you can use a string expansion
8731 expression like one of the examples in <xref linkend="CHAPplaintext"/>.
8732 </para>
8733 <para>
8734 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
8735 </para>
8736 </section>
8737 </chapter>
8738
8739 <chapter id="CHAPregexp">
8740 <title>Regular expressions</title>
8741 <para>
8742 <indexterm role="concept">
8743 <primary>regular expressions</primary>
8744 <secondary>library</secondary>
8745 </indexterm>
8746 <indexterm role="concept">
8747 <primary>PCRE</primary>
8748 </indexterm>
8749 Exim supports the use of regular expressions in many of its options. It
8750 uses the PCRE regular expression library; this provides regular expression
8751 matching that is compatible with Perl 5. The syntax and semantics of
8752 regular expressions is discussed in many Perl reference books, and also in
8753 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
8754 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
8755 </para>
8756 <para>
8757 The documentation for the syntax and semantics of the regular expressions that
8758 are supported by PCRE is included in plain text in the file
8759 <filename>doc/pcrepattern.txt</filename> in the Exim distribution, and also in the HTML
8760 tarbundle of Exim documentation. It describes in detail the features of the
8761 regular expressions that PCRE supports, so no further description is included
8762 here. The PCRE functions are called from Exim using the default option settings
8763 (that is, with no PCRE options set), except that the PCRE_CASELESS option is
8764 set when the matching is required to be case-insensitive.
8765 </para>
8766 <para>
8767 In most cases, when a regular expression is required in an Exim configuration,
8768 it has to start with a circumflex, in order to distinguish it from plain text
8769 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
8770 second item in the colon-separated list is a regular expression.
8771 </para>
8772 <literallayout class="monospaced">
8773 domains = a.b.c : ^\\d{3} : *.y.z : ...
8774 </literallayout>
8775 <para>
8776 The doubling of the backslash is required because of string expansion that
8777 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
8778 of this issue, and a way of avoiding the need for doubling backslashes. The
8779 regular expression that is eventually used in this example contains just one
8780 backslash. The circumflex is included in the regular expression, and has the
8781 normal effect of <quote>anchoring</quote> it to the start of the string that is being
8782 matched.
8783 </para>
8784 <para>
8785 There are, however, two cases where a circumflex is not required for the
8786 recognition of a regular expression: these are the <option>match</option> condition in a
8787 string expansion, and the <option>matches</option> condition in an Exim filter file. In
8788 these cases, the relevant string is always treated as a regular expression; if
8789 it does not start with a circumflex, the expression is not anchored, and can
8790 match anywhere in the subject string.
8791 </para>
8792 <para>
8793 In all cases, if you want a regular expression to match at the end of a string,
8794 you must code the $ metacharacter to indicate this. For example:
8795 </para>
8796 <literallayout class="monospaced">
8797 domains = ^\\d{3}\\.example
8798 </literallayout>
8799 <para>
8800 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
8801 You need to use:
8802 </para>
8803 <literallayout class="monospaced">
8804 domains = ^\\d{3}\\.example\$
8805 </literallayout>
8806 <para>
8807 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
8808 $ is needed because string expansion also interprets dollar characters.
8809 </para>
8810 <section>
8811 <title>Testing regular expressions</title>
8812 <para>
8813 <indexterm role="concept">
8814 <primary>testing</primary>
8815 <secondary>regular expressions</secondary>
8816 </indexterm>
8817 <indexterm role="concept">
8818 <primary>regular expressions</primary>
8819 <secondary>testing</secondary>
8820 </indexterm>
8821 <indexterm role="concept">
8822 <primary><emphasis>pcretest</emphasis></primary>
8823 </indexterm>
8824 A program called <emphasis>pcretest</emphasis> forms part of the PCRE distribution and is built
8825 with PCRE during the process of building Exim. It is primarily intended for
8826 testing PCRE itself, but it can also be used for experimenting with regular
8827 expressions. After building Exim, the binary can be found in the build
8828 directory (it is not installed anywhere automatically). There is documentation
8829 of various options in <filename>doc/pcretest.txt</filename>, but for simple testing, none are
8830 needed. This is the output of a sample run of <emphasis>pcretest</emphasis>:
8831 </para>
8832 <literallayout>
8833 <literal>  re&gt; </literal><emphasis role="bold"><literal>/^([@]+)@.+\.(ac|edu)\.(?!kr)[a-z]{2}$/</literal></emphasis>
8834 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.uk</literal></emphasis>
8835 <literal> 0: x@y.ac.uk</literal>
8836 <literal> 1: x</literal>
8837 <literal> 2: ac</literal>
8838 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.ac.kr</literal></emphasis>
8839 <literal>No match</literal>
8840 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.com</literal></emphasis>
8841 <literal>No match</literal>
8842 <literal>data&gt; </literal><emphasis role="bold"><literal>x@y.edu.co</literal></emphasis>
8843 <literal> 0: x@y.edu.co</literal>
8844 <literal> 1: x</literal>
8845 <literal> 2: edu</literal>
8846 </literallayout>
8847 <para>
8848 Input typed by the user is shown in bold face. After the <quote>re&gt;</quote> prompt, a
8849 regular expression enclosed in delimiters is expected. If this compiles without
8850 error, <quote>data&gt;</quote> prompts are given for strings against which the expression is
8851 matched. An empty data line causes a new regular expression to be read. If the
8852 match is successful, the captured substring values (that is, what would be in
8853 the variables <varname>$0</varname>, <varname>$1</varname>, <varname>$2</varname>, etc.) are shown. The above example tests for
8854 an email address whose domain ends with either <quote>ac</quote> or <quote>edu</quote> followed by a
8855 two-character top-level domain that is not <quote>kr</quote>. The local part is captured
8856 in <varname>$1</varname> and the <quote>ac</quote> or <quote>edu</quote> in <varname>$2</varname>.
8857 </para>
8858 </section>
8859 </chapter>
8860
8861 <chapter id="CHAPfdlookup">
8862 <title>File and database lookups</title>
8863 <para>
8864 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
8865 <primary>file</primary>
8866 <secondary>lookups</secondary>
8867 </indexterm>
8868 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
8869 <primary>database lookups</primary>
8870 </indexterm>
8871 <indexterm role="concept">
8872 <primary>lookup</primary>
8873 <secondary>description of</secondary>
8874 </indexterm>
8875 Exim can be configured to look up data in files or databases as it processes
8876 messages. Two different kinds of syntax are used:
8877 </para>
8878 <orderedlist numeration="arabic">
8879 <listitem>
8880 <para>
8881 A string that is to be expanded may contain explicit lookup requests. These
8882 cause parts of the string to be replaced by data that is obtained from the
8883 lookup. Lookups of this type are conditional expansion items. Different results
8884 can be defined for the cases of lookup success and failure. See chapter
8885 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
8886 </para>
8887 </listitem>
8888 <listitem>
8889 <para>
8890 Lists of domains, hosts, and email addresses can contain lookup requests as a
8891 way of avoiding excessively long linear lists. In this case, the data that is
8892 returned by the lookup is often (but not always) discarded; whether the lookup
8893 succeeds or fails is what really counts. These kinds of list are described in
8894 chapter <xref linkend="CHAPdomhosaddlists"/>.
8895 </para>
8896 </listitem>
8897 </orderedlist>
8898 <para>
8899 String expansions, lists, and lookups interact with each other in such a way
8900 that there is no order in which to describe any one of them that does not
8901 involve references to the others. Each of these three chapters makes more sense
8902 if you have read the other two first. If you are reading this for the first
8903 time, be aware that some of it will make a lot more sense after you have read
8904 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
8905 </para>
8906 <section>
8907 <title>Examples of different lookup syntax</title>
8908 <para>
8909 It is easy to confuse the two different kinds of lookup, especially as the
8910 lists that may contain the second kind are always expanded before being
8911 processed as lists. Therefore, they may also contain lookups of the first kind.
8912 Be careful to distinguish between the following two examples:
8913 </para>
8914 <literallayout class="monospaced">
8915 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
8916 domains = lsearch;/some/file
8917 </literallayout>
8918 <para>
8919 The first uses a string expansion, the result of which must be a domain list.
8920 No strings have been specified for a successful or a failing lookup; the
8921 defaults in this case are the looked-up data and an empty string, respectively.
8922 The expansion takes place before the string is processed as a list, and the
8923 file that is searched could contain lines like this:
8924 </para>
8925 <literallayout class="monospaced">
8926 192.168.3.4: domain1:domain2:...
8927 192.168.1.9: domain3:domain4:...
8928 </literallayout>
8929 <para>
8930 When the lookup succeeds, the result of the expansion is a list of domains (and
8931 possibly other types of item that are allowed in domain lists).
8932 </para>
8933 <para>
8934 In the second example, the lookup is a single item in a domain list. It causes
8935 Exim to use a lookup to see if the domain that is being processed can be found
8936 in the file. The file could contains lines like this:
8937 </para>
8938 <literallayout class="monospaced">
8939 domain1:
8940 domain2:
8941 </literallayout>
8942 <para>
8943 Any data that follows the keys is not relevant when checking that the domain
8944 matches the list item.
8945 </para>
8946 <para>
8947 It is possible, though no doubt confusing, to use both kinds of lookup at once.
8948 Consider a file containing lines like this:
8949 </para>
8950 <literallayout class="monospaced">
8951 192.168.5.6: lsearch;/another/file
8952 </literallayout>
8953 <para>
8954 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
8955 first <option>domains</option> setting above generates the second setting, which therefore
8956 causes a second lookup to occur.
8957 </para>
8958 <para>
8959 The rest of this chapter describes the different lookup types that are
8960 available. Any of them can be used in any part of the configuration where a
8961 lookup is permitted.
8962 </para>
8963 </section>
8964 <section>
8965 <title>Lookup types</title>
8966 <para>
8967 <indexterm role="concept">
8968 <primary>lookup</primary>
8969 <secondary>types of</secondary>
8970 </indexterm>
8971 <indexterm role="concept">
8972 <primary>single-key lookup</primary>
8973 <secondary>definition of</secondary>
8974 </indexterm>
8975 Two different types of data lookup are implemented:
8976 </para>
8977 <itemizedlist>
8978 <listitem>
8979 <para>
8980 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
8981 and a single key to search for. The key must be a non-empty string for the
8982 lookup to succeed. The lookup type determines how the file is searched.
8983 </para>
8984 </listitem>
8985 <listitem>
8986 <para>
8987 <indexterm role="concept">
8988 <primary>query-style lookup</primary>
8989 <secondary>definition of</secondary>
8990 </indexterm>
8991 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
8992 key value is assumed by Exim for query-style lookups. You can use whichever
8993 Exim variables you need to construct the database query.
8994 </para>
8995 </listitem>
8996 </itemizedlist>
8997 <para>
8998 The code for each lookup type is in a separate source file that is included in
8999 the binary of Exim only if the corresponding compile-time option is set. The
9000 default settings in <filename>src/EDITME</filename> are:
9001 </para>
9002 <literallayout class="monospaced">
9003 LOOKUP_DBM=yes
9004 LOOKUP_LSEARCH=yes
9005 </literallayout>
9006 <para>
9007 which means that only linear searching and DBM lookups are included by default.
9008 For some types of lookup (e.g. SQL databases), you need to install appropriate
9009 libraries and header files before building Exim.
9010 </para>
9011 </section>
9012 <section id="SECTsinglekeylookups">
9013 <title>Single-key lookup types</title>
9014 <para>
9015 <indexterm role="concept">
9016 <primary>lookup</primary>
9017 <secondary>single-key types</secondary>
9018 </indexterm>
9019 <indexterm role="concept">
9020 <primary>single-key lookup</primary>
9021 <secondary>list of types</secondary>
9022 </indexterm>
9023 The following single-key lookup types are implemented:
9024 </para>
9025 <itemizedlist>
9026 <listitem>
9027 <para>
9028 <indexterm role="concept">
9029 <primary>cdb</primary>
9030 <secondary>description of</secondary>
9031 </indexterm>
9032 <indexterm role="concept">
9033 <primary>lookup</primary>
9034 <secondary>cdb</secondary>
9035 </indexterm>
9036 <indexterm role="concept">
9037 <primary>binary zero</primary>
9038 <secondary>in lookup key</secondary>
9039 </indexterm>
9040 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
9041 string without a terminating binary zero. The cdb format is designed for
9042 indexed files that are read frequently and never updated, except by total
9043 re-creation. As such, it is particulary suitable for large files containing
9044 aliases or other indexed data referenced by an MTA. Information about cdb can
9045 be found in several places:
9046 </para>
9047 <literallayout>
9048 <emphasis role="bold"><ulink url="http://www.pobox.com/~djb/cdb.html">http://www.pobox.com/~djb/cdb.html</ulink></emphasis>
9049 <emphasis role="bold"><ulink url="ftp://ftp.corpit.ru/pub/tinycdb/">ftp://ftp.corpit.ru/pub/tinycdb/</ulink></emphasis>
9050 <emphasis role="bold"><ulink url="http://packages.debian.org/stable/utils/freecdb.html">http://packages.debian.org/stable/utils/freecdb.html</ulink></emphasis>
9051 </literallayout>
9052 <para>
9053 A cdb distribution is not needed in order to build Exim with cdb support,
9054 because the code for reading cdb files is included directly in Exim itself.
9055 However, no means of building or testing cdb files is provided with Exim, so
9056 you need to obtain a cdb distribution in order to do this.
9057 </para>
9058 </listitem>
9059 <listitem>
9060 <para>
9061 <indexterm role="concept">
9062 <primary>DBM</primary>
9063 <secondary>lookup type</secondary>
9064 </indexterm>
9065 <indexterm role="concept">
9066 <primary>lookup</primary>
9067 <secondary>dbm</secondary>
9068 </indexterm>
9069 <indexterm role="concept">
9070 <primary>binary zero</primary>
9071 <secondary>in lookup key</secondary>
9072 </indexterm>
9073 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
9074 DBM file by looking up the record with the given key. A terminating binary
9075 zero is included in the key that is passed to the DBM library. See section
9076 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
9077 </para>
9078 <para>
9079 <indexterm role="concept">
9080 <primary>Berkeley DB library</primary>
9081 <secondary>file format</secondary>
9082 </indexterm>
9083 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
9084 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
9085 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
9086 the DB_UNKNOWN option. This enables it to handle any of the types of database
9087 that the library supports, and can be useful for accessing DBM files created by
9088 other applications. (For earlier DB versions, DB_HASH is always used.)
9089 </para>
9090 </listitem>
9091 <listitem>
9092 <para>
9093 <indexterm role="concept">
9094 <primary>lookup</primary>
9095 <secondary>dbmnz</secondary>
9096 </indexterm>
9097 <indexterm role="concept">
9098 <primary>lookup</primary>
9099 <secondary>dbm &ndash; terminating zero</secondary>
9100 </indexterm>
9101 <indexterm role="concept">
9102 <primary>binary zero</primary>
9103 <secondary>in lookup key</secondary>
9104 </indexterm>
9105 <indexterm role="concept">
9106 <primary>Courier</primary>
9107 </indexterm>
9108 <indexterm role="concept">
9109 <primary><filename>/etc/userdbshadow.dat</filename></primary>
9110 </indexterm>
9111 <indexterm role="concept">
9112 <primary>dmbnz lookup type</primary>
9113 </indexterm>
9114 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
9115 is not included in the key that is passed to the DBM library. You may need this
9116 if you want to look up data in files that are created by or shared with some
9117 other application that does not use terminating zeros. For example, you need to
9118 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
9119 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
9120 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
9121 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
9122 </para>
9123 </listitem>
9124 <listitem>
9125 <para>
9126 <indexterm role="concept">
9127 <primary>lookup</primary>
9128 <secondary>dsearch</secondary>
9129 </indexterm>
9130 <indexterm role="concept">
9131 <primary>dsearch lookup type</primary>
9132 </indexterm>
9133 <command>dsearch</command>: The given file must be a directory; this is searched for a file
9134 whose name is the key. The key may not contain any forward slash characters.
9135 The result of a successful lookup is the name of the file. An example of how
9136 this lookup can be used to support virtual domains is given in section
9137 <xref linkend="SECTvirtualdomains"/>.
9138 </para>
9139 </listitem>
9140 <listitem>
9141 <para>
9142 <indexterm role="concept">
9143 <primary>lookup</primary>
9144 <secondary>iplsearch</secondary>
9145 </indexterm>
9146 <indexterm role="concept">
9147 <primary>iplsearch lookup type</primary>
9148 </indexterm>
9149 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
9150 terminated by a colon or white space or the end of the line. The keys in the
9151 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
9152 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
9153 being interpreted as a key terminator. For example:
9154 </para>
9155 <literallayout class="monospaced">
9156 1.2.3.4:           data for 1.2.3.4
9157 192.168.0.0/16     data for 192.168.0.0/16
9158 "abcd::cdab":      data for abcd::cdab
9159 "abcd:abcd::/32"   data for abcd:abcd::/32
9160 </literallayout>
9161 <para>
9162 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
9163 file is searched linearly, using the CIDR masks where present, until a matching
9164 key is found. The first key that matches is used; there is no attempt to find a
9165 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
9166 <command>iplsearch</command> is the same as for <command>lsearch</command>.
9167 </para>
9168 <para>
9169 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
9170 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9171 lookup types support only literal keys.
9172 </para>
9173 <para>
9174 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
9175 the implicit key is the host&#x2019;s IP address rather than its name (see section
9176 <xref linkend="SECThoslispatsikey"/>).
9177 </para>
9178 </listitem>
9179 <listitem>
9180 <para revisionflag="changed">
9181 <indexterm role="concept">
9182 <primary>linear search</primary>
9183 </indexterm>
9184 <indexterm role="concept">
9185 <primary>lookup</primary>
9186 <secondary>lsearch</secondary>
9187 </indexterm>
9188 <indexterm role="concept">
9189 <primary>lsearch lookup type</primary>
9190 </indexterm>
9191 <indexterm role="concept">
9192 <primary>case sensitivity</primary>
9193 <secondary>in lsearch lookup</secondary>
9194 </indexterm>
9195 <command>lsearch</command>: The given file is a text file that is searched linearly for a
9196 line beginning with the search key, terminated by a colon or white space or the
9197 end of the line. The search is case-insensitive; that is, upper and lower case
9198 letters are treated as the same. The first occurrence of the key that is found
9199 in the file is used.
9200 </para>
9201 <para>
9202 White space between the key and the colon is permitted. The remainder of the
9203 line, with leading and trailing white space removed, is the data. This can be
9204 continued onto subsequent lines by starting them with any amount of white
9205 space, but only a single space character is included in the data at such a
9206 junction. If the data begins with a colon, the key must be terminated by a
9207 colon, for example:
9208 </para>
9209 <literallayout class="monospaced">
9210 baduser:  :fail:
9211 </literallayout>
9212 <para>
9213 Empty lines and lines beginning with # are ignored, even if they occur in the
9214 middle of an item. This is the traditional textual format of alias files. Note
9215 that the keys in an <command>lsearch</command> file are literal strings. There is no
9216 wildcarding of any kind.
9217 </para>
9218 <para>
9219 <indexterm role="concept">
9220 <primary>lookup</primary>
9221 <secondary>lsearch &ndash; colons in keys</secondary>
9222 </indexterm>
9223 <indexterm role="concept">
9224 <primary>white space</primary>
9225 <secondary>in lsearch key</secondary>
9226 </indexterm>
9227 In most <command>lsearch</command> files, keys are not required to contain colons or #
9228 characters, or white space. However, if you need this feature, it is available.
9229 If a key begins with a doublequote character, it is terminated only by a
9230 matching quote (or end of line), and the normal escaping rules apply to its
9231 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
9232 quoted keys (exactly as for unquoted keys). There is no special handling of
9233 quotes for the data part of an <command>lsearch</command> line.
9234 </para>
9235 </listitem>
9236 <listitem>
9237 <para>
9238 <indexterm role="concept">
9239 <primary>NIS lookup type</primary>
9240 </indexterm>
9241 <indexterm role="concept">
9242 <primary>lookup</primary>
9243 <secondary>NIS</secondary>
9244 </indexterm>
9245 <indexterm role="concept">
9246 <primary>binary zero</primary>
9247 <secondary>in lookup key</secondary>
9248 </indexterm>
9249 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
9250 the given key, without a terminating binary zero. There is a variant called
9251 <command>nis0</command> which does include the terminating binary zero in the key. This is
9252 reportedly needed for Sun-style alias files. Exim does not recognize NIS
9253 aliases; the full map names must be used.
9254 </para>
9255 </listitem>
9256 <listitem>
9257 <para>
9258 <indexterm role="concept">
9259 <primary>wildlsearch lookup type</primary>
9260 </indexterm>
9261 <indexterm role="concept">
9262 <primary>lookup</primary>
9263 <secondary>wildlsearch</secondary>
9264 </indexterm>
9265 <indexterm role="concept">
9266 <primary>nwildlsearch lookup type</primary>
9267 </indexterm>
9268 <indexterm role="concept">
9269 <primary>lookup</primary>
9270 <secondary>nwildlsearch</secondary>
9271 </indexterm>
9272 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
9273 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
9274 the file may be wildcarded. The difference between these two lookup types is
9275 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
9276 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
9277 </para>
9278 <para revisionflag="changed">
9279 <indexterm role="concept">
9280 <primary>case sensitivity</primary>
9281 <secondary>in (n)wildlsearch lookup</secondary>
9282 </indexterm>
9283 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
9284 file that are regular expressions can be made case-sensitive by the use of
9285 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
9286 </para>
9287 <orderedlist numeration="arabic">
9288 <listitem>
9289 <para>
9290 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
9291 </para>
9292 <literallayout class="monospaced">
9293     *.a.b.c       data for anything.a.b.c
9294     *fish         data for anythingfish
9295 </literallayout>
9296 </listitem>
9297 <listitem>
9298 <para>
9299 The string may begin with a circumflex to indicate a regular expression. For
9300 example, for <command>wildlsearch</command>:
9301 </para>
9302 <literallayout class="monospaced">
9303     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
9304 </literallayout>
9305 <para>
9306 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
9307 expression. If you are using <command>nwildlsearch</command>, where the keys are not
9308 string-expanded, the equivalent entry is:
9309 </para>
9310 <literallayout class="monospaced">
9311     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
9312 </literallayout>
9313 <para revisionflag="changed">
9314 The case-insensitive flag is set at the start of compiling the regular
9315 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
9316 For example, to make the entire pattern case-sensitive:
9317 </para>
9318 <literallayout class="monospaced" revisionflag="changed">
9319     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
9320 </literallayout>
9321 <para>
9322 If the regular expression contains white space or colon characters, you must
9323 either quote it (see <command>lsearch</command> above), or represent these characters in other
9324 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
9325 colon. This may be easier than quoting, because if you quote, you have to
9326 escape all the backslashes inside the quotes.
9327 </para>
9328 <para>
9329 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
9330 match for later use, because the results of all lookups are cached. If a lookup
9331 is repeated, the result is taken from the cache, and no actual pattern matching
9332 takes place. The values of all the numeric variables are unset after a
9333 <command>(n)wildlsearch</command> match.
9334 </para>
9335 </listitem>
9336 <listitem>
9337 <para>
9338 Although I cannot see it being of much use, the general matching function that
9339 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
9340 lookup name terminated by a semicolon, and followed by lookup data. For
9341 example:
9342 </para>
9343 <literallayout class="monospaced">
9344     cdb;/some/file  data for keys that match the file
9345 </literallayout>
9346 <para>
9347 The data that is obtained from the nested lookup is discarded.
9348 </para>
9349 </listitem>
9350 </orderedlist>
9351 <para>
9352 Keys that do not match any of these patterns are interpreted literally. The
9353 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
9354 be followed by optional colons.
9355 </para>
9356 <para>
9357 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
9358 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
9359 lookup types support only literal keys.
9360 </para>
9361 </listitem>
9362 </itemizedlist>
9363 </section>
9364 <section>
9365 <title>Query-style lookup types</title>
9366 <para>
9367 <indexterm role="concept">
9368 <primary>lookup</primary>
9369 <secondary>query-style types</secondary>
9370 </indexterm>
9371 <indexterm role="concept">
9372 <primary>query-style lookup</primary>
9373 <secondary>list of types</secondary>
9374 </indexterm>
9375 The supported query-style lookup types are listed below. Further details about
9376 many of them are given in later sections.
9377 </para>
9378 <itemizedlist>
9379 <listitem>
9380 <para>
9381 <indexterm role="concept">
9382 <primary>DNS</primary>
9383 <secondary>as a lookup type</secondary>
9384 </indexterm>
9385 <indexterm role="concept">
9386 <primary>lookup</primary>
9387 <secondary>DNS</secondary>
9388 </indexterm>
9389 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
9390 are given in the supplied query. The resulting data is the contents of the
9391 records. See section <xref linkend="SECTdnsdb"/>.
9392 </para>
9393 </listitem>
9394 <listitem>
9395 <para>
9396 <indexterm role="concept">
9397 <primary>InterBase lookup type</primary>
9398 </indexterm>
9399 <indexterm role="concept">
9400 <primary>lookup</primary>
9401 <secondary>InterBase</secondary>
9402 </indexterm>
9403 <command>ibase</command>: This does a lookup in an InterBase database.
9404 </para>
9405 </listitem>
9406 <listitem>
9407 <para>
9408 <indexterm role="concept">
9409 <primary>LDAP</primary>
9410 <secondary>lookup type</secondary>
9411 </indexterm>
9412 <indexterm role="concept">
9413 <primary>lookup</primary>
9414 <secondary>LDAP</secondary>
9415 </indexterm>
9416 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
9417 returns attributes from a single entry. There is a variant called <command>ldapm</command>
9418 that permits values from multiple entries to be returned. A third variant
9419 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
9420 any attribute values. See section <xref linkend="SECTldap"/>.
9421 </para>
9422 </listitem>
9423 <listitem>
9424 <para>
9425 <indexterm role="concept">
9426 <primary>MySQL</primary>
9427 <secondary>lookup type</secondary>
9428 </indexterm>
9429 <indexterm role="concept">
9430 <primary>lookup</primary>
9431 <secondary>MySQL</secondary>
9432 </indexterm>
9433 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
9434 MySQL database. See section <xref linkend="SECTsql"/>.
9435 </para>
9436 </listitem>
9437 <listitem>
9438 <para>
9439 <indexterm role="concept">
9440 <primary>NIS+ lookup type</primary>
9441 </indexterm>
9442 <indexterm role="concept">
9443 <primary>lookup</primary>
9444 <secondary>NIS+</secondary>
9445 </indexterm>
9446 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
9447 the field to be returned. See section <xref linkend="SECTnisplus"/>.
9448 </para>
9449 </listitem>
9450 <listitem>
9451 <para>
9452 <indexterm role="concept">
9453 <primary>Oracle</primary>
9454 <secondary>lookup type</secondary>
9455 </indexterm>
9456 <indexterm role="concept">
9457 <primary>lookup</primary>
9458 <secondary>Oracle</secondary>
9459 </indexterm>
9460 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
9461 Oracle database. See section <xref linkend="SECTsql"/>.
9462 </para>
9463 </listitem>
9464 <listitem>
9465 <para>
9466 <indexterm role="concept">
9467 <primary>lookup</primary>
9468 <secondary>passwd</secondary>
9469 </indexterm>
9470 <indexterm role="concept">
9471 <primary>passwd lookup type</primary>
9472 </indexterm>
9473 <indexterm role="concept">
9474 <primary><filename>/etc/passwd</filename></primary>
9475 </indexterm>
9476 <command>passwd</command> is a query-style lookup with queries that are just user names. The
9477 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
9478 success, the result string is the same as you would get from an <command>lsearch</command>
9479 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
9480 password value. For example:
9481 </para>
9482 <literallayout class="monospaced">
9483 *:42:42:King Rat:/home/kr:/bin/bash
9484 </literallayout>
9485 </listitem>
9486 <listitem>
9487 <para>
9488 <indexterm role="concept">
9489 <primary>PostgreSQL lookup type</primary>
9490 </indexterm>
9491 <indexterm role="concept">
9492 <primary>lookup</primary>
9493 <secondary>PostgreSQL</secondary>
9494 </indexterm>
9495 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
9496 PostgreSQL database. See section <xref linkend="SECTsql"/>.
9497 </para>
9498 </listitem>
9499 <listitem>
9500 <para>
9501 <indexterm role="concept">
9502 <primary>sqlite lookup type</primary>
9503 </indexterm>
9504 <indexterm role="concept">
9505 <primary>lookup</primary>
9506 <secondary>sqlite</secondary>
9507 </indexterm>
9508 <command>sqlite</command>: The format of the query is a file name followed by an SQL statement
9509 that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
9510 </para>
9511 </listitem>
9512 <listitem>
9513 <para>
9514 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
9515 not likely to be useful in normal operation.
9516 </para>
9517 </listitem>
9518 <listitem>
9519 <para>
9520 <indexterm role="concept">
9521 <primary>whoson lookup type</primary>
9522 </indexterm>
9523 <indexterm role="concept">
9524 <primary>lookup</primary>
9525 <secondary>whoson</secondary>
9526 </indexterm>
9527 <command>whoson</command>: <emphasis>Whoson</emphasis> (<emphasis role="bold"><ulink url="http://whoson.sourceforge.net">http://whoson.sourceforge.net</ulink></emphasis>) is a proposed
9528 Internet protocol that allows Internet server programs to check whether a
9529 particular (dynamically allocated) IP address is currently allocated to a known
9530 (trusted) user and, optionally, to obtain the identity of the said user. In
9531 Exim, this can be used to implement <quote>POP before SMTP</quote> checking using ACL
9532 statements such as
9533 </para>
9534 <literallayout class="monospaced">
9535 require condition = \
9536   ${lookup whoson {$sender_host_address}{yes}{no}}
9537 </literallayout>
9538 <para>
9539 The query consists of a single IP address. The value returned is the name of
9540 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
9541 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
9542 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
9543 </para>
9544 </listitem>
9545 </itemizedlist>
9546 </section>
9547 <section>
9548 <title>Temporary errors in lookups</title>
9549 <para>
9550 <indexterm role="concept">
9551 <primary>lookup</primary>
9552 <secondary>temporary error in</secondary>
9553 </indexterm>
9554 Lookup functions can return temporary error codes if the lookup cannot be
9555 completed. For example, an SQL or LDAP database might be unavailable. For this
9556 reason, it is not advisable to use a lookup that might do this for critical
9557 options such as a list of local domains.
9558 </para>
9559 <para>
9560 When a lookup cannot be completed in a router or transport, delivery
9561 of the message (to the relevant address) is deferred, as for any other
9562 temporary error. In other circumstances Exim may assume the lookup has failed,
9563 or may give up altogether.
9564 </para>
9565 </section>
9566 <section id="SECTdefaultvaluelookups">
9567 <title>Default values in single-key lookups</title>
9568 <para>
9569 <indexterm role="concept">
9570 <primary>wildcard lookups</primary>
9571 </indexterm>
9572 <indexterm role="concept">
9573 <primary>lookup</primary>
9574 <secondary>default values</secondary>
9575 </indexterm>
9576 <indexterm role="concept">
9577 <primary>lookup</primary>
9578 <secondary>wildcard</secondary>
9579 </indexterm>
9580 <indexterm role="concept">
9581 <primary>lookup</primary>
9582 <secondary>* added to type</secondary>
9583 </indexterm>
9584 <indexterm role="concept">
9585 <primary>default</primary>
9586 <secondary>in single-key lookups</secondary>
9587 </indexterm>
9588 In this context, a <quote>default value</quote> is a value specified by the administrator
9589 that is to be used if a lookup fails.
9590 </para>
9591 <para>
9592 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
9593 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
9594 provide a default value. See also the section on partial matching below.
9595 </para>
9596 <para>
9597 <indexterm role="concept">
9598 <primary>*@ with single-key lookup</primary>
9599 </indexterm>
9600 <indexterm role="concept">
9601 <primary>lookup</primary>
9602 <secondary>*@ added to type</secondary>
9603 </indexterm>
9604 <indexterm role="concept">
9605 <primary>alias file</primary>
9606 <secondary>per-domain default</secondary>
9607 </indexterm>
9608 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
9609 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
9610 character, a second lookup is done with everything before the last @ replaced
9611 by *. This makes it possible to provide per-domain defaults in alias files
9612 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
9613 take place because there is no @ in the key), <quote>*</quote> is looked up.
9614 For example, a <command>redirect</command> router might contain:
9615 </para>
9616 <literallayout class="monospaced">
9617 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
9618 </literallayout>
9619 <para>
9620 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
9621 looks up these keys, in this order:
9622 </para>
9623 <literallayout class="monospaced">
9624 jane@eyre.example
9625 *@eyre.example
9626 *
9627 </literallayout>
9628 <para>
9629 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
9630 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
9631 complete scan is done for each key, and only if it is not found at all does
9632 Exim move on to try the next key.
9633 </para>
9634 </section>
9635 <section id="SECTpartiallookup">
9636 <title>Partial matching in single-key lookups</title>
9637 <para>
9638 <indexterm role="concept">
9639 <primary>partial matching</primary>
9640 </indexterm>
9641 <indexterm role="concept">
9642 <primary>wildcard lookups</primary>
9643 </indexterm>
9644 <indexterm role="concept">
9645 <primary>lookup</primary>
9646 <secondary>partial matching</secondary>
9647 </indexterm>
9648 <indexterm role="concept">
9649 <primary>lookup</primary>
9650 <secondary>wildcard</secondary>
9651 </indexterm>
9652 <indexterm role="concept">
9653 <primary>asterisk</primary>
9654 <secondary>in search type</secondary>
9655 </indexterm>
9656 The normal operation of a single-key lookup is to search the file for an exact
9657 match with the given key. However, in a number of situations where domains are
9658 being looked up, it is useful to be able to do partial matching. In this case,
9659 information in the file that has a key starting with <quote>*.</quote> is matched by any
9660 domain that ends with the components that follow the full stop. For example, if
9661 a key in a DBM file is
9662 </para>
9663 <literallayout class="monospaced">
9664 *.dates.fict.example
9665 </literallayout>
9666 <para>
9667 then when partial matching is enabled this is matched by (amongst others)
9668 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
9669 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
9670 file.
9671 </para>
9672 <para>
9673 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
9674 also not available for any lookup items in address lists (see section
9675 <xref linkend="SECTaddresslist"/>).
9676 </para>
9677 <para>
9678 Partial matching is implemented by doing a series of separate lookups using
9679 keys constructed by modifying the original subject key. This means that it can
9680 be used with any of the single-key lookup types, provided that
9681 partial matching keys
9682 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
9683 Keys in the file that do not begin with the prefix are matched only by
9684 unmodified subject keys when partial matching is in use.
9685 </para>
9686 <para>
9687 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
9688 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
9689 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
9690 is added at the start of the subject key, and it is looked up again. If that
9691 fails, further lookups are tried with dot-separated components removed from the
9692 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
9693 remains.
9694 </para>
9695 <para>
9696 A minimum number of two non-* components are required. This can be adjusted
9697 by including a number before the hyphen in the search type. For example,
9698 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
9699 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
9700 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
9701 up when the minimum number of non-* components is two:
9702 </para>
9703 <literallayout class="monospaced">
9704 2250.dates.fict.example
9705 *.2250.dates.fict.example
9706 *.dates.fict.example
9707 *.fict.example
9708 </literallayout>
9709 <para>
9710 As soon as one key in the sequence is successfully looked up, the lookup
9711 finishes.
9712 </para>
9713 <para>
9714 <indexterm role="concept">
9715 <primary>lookup</primary>
9716 <secondary>partial matching &ndash; changing prefix</secondary>
9717 </indexterm>
9718 <indexterm role="concept">
9719 <primary>prefix</primary>
9720 <secondary>for partial matching</secondary>
9721 </indexterm>
9722 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
9723 changed. The motivation for this feature is to allow Exim to operate with file
9724 formats that are used by other MTAs. A different prefix can be supplied in
9725 parentheses instead of the hyphen after <quote>partial</quote>. For example:
9726 </para>
9727 <literallayout class="monospaced">
9728 domains = partial(.)lsearch;/some/file
9729 </literallayout>
9730 <para>
9731 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9732 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
9733 components is unchanged). The prefix may consist of any punctuation characters
9734 other than a closing parenthesis. It may be empty, for example:
9735 </para>
9736 <literallayout class="monospaced">
9737 domains = partial1()cdb;/some/file
9738 </literallayout>
9739 <para>
9740 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
9741 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
9742 </para>
9743 <para>
9744 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
9745 just one non-wild component has failed, and the original key is shortened right
9746 down to the null string) depends on the prefix:
9747 </para>
9748 <itemizedlist>
9749 <listitem>
9750 <para>
9751 If the prefix has zero length, the whole lookup fails.
9752 </para>
9753 </listitem>
9754 <listitem>
9755 <para>
9756 If the prefix has length 1, a lookup for just the prefix is done. For
9757 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
9758 </para>
9759 </listitem>
9760 <listitem>
9761 <para>
9762 Otherwise, if the prefix ends in a dot, the dot is removed, and the
9763 remainder is looked up. With the default prefix, therefore, the final lookup is
9764 for <quote>*</quote> on its own.
9765 </para>
9766 </listitem>
9767 <listitem>
9768 <para>
9769 Otherwise, the whole prefix is looked up.
9770 </para>
9771 </listitem>
9772 </itemizedlist>
9773 <para>
9774 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
9775 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
9776 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
9777 specified, adding <quote>*</quote> to the search type has no effect with the default
9778 prefix, because the <quote>*</quote> key is already included in the sequence of partial
9779 lookups. However, there might be a use for lookup types such as
9780 <quote>partial0(.)lsearch*</quote>.
9781 </para>
9782 <para>
9783 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
9784 in domain lists and the like. Partial matching works only in terms of
9785 dot-separated components; a key such as <literal>*fict.example</literal>
9786 in a database file is useless, because the asterisk in a partial matching
9787 subject key is always followed by a dot.
9788 </para>
9789 </section>
9790 <section>
9791 <title>Lookup caching</title>
9792 <para>
9793 <indexterm role="concept">
9794 <primary>lookup</primary>
9795 <secondary>caching</secondary>
9796 </indexterm>
9797 <indexterm role="concept">
9798 <primary>caching</primary>
9799 <secondary>lookup data</secondary>
9800 </indexterm>
9801 Exim caches all lookup results in order to avoid needless repetition of
9802 lookups. However, because (apart from the daemon) Exim operates as a collection
9803 of independent, short-lived processes, this caching applies only within a
9804 single Exim process. There is no inter-process lookup caching facility.
9805 </para>
9806 <para>
9807 For single-key lookups, Exim keeps the relevant files open in case there is
9808 another lookup that needs them. In some types of configuration this can lead to
9809 many files being kept open for messages with many recipients. To avoid hitting
9810 the operating system limit on the number of simultaneously open files, Exim
9811 closes the least recently used file when it needs to open more files than its
9812 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
9813 </para>
9814 <para>
9815 The single-key lookup files are closed and the lookup caches are flushed at
9816 strategic points during delivery &ndash; for example, after all routing is
9817 complete.
9818 </para>
9819 </section>
9820 <section>
9821 <title>Quoting lookup data</title>
9822 <para>
9823 <indexterm role="concept">
9824 <primary>lookup</primary>
9825 <secondary>quoting</secondary>
9826 </indexterm>
9827 <indexterm role="concept">
9828 <primary>quoting</primary>
9829 <secondary>in lookups</secondary>
9830 </indexterm>
9831 When data from an incoming message is included in a query-style lookup, there
9832 is the possibility of special characters in the data messing up the syntax of
9833 the query. For example, a NIS+ query that contains
9834 </para>
9835 <literallayout class="monospaced">
9836 [name=$local_part]
9837 </literallayout>
9838 <para>
9839 will be broken if the local part happens to contain a closing square bracket.
9840 For NIS+, data can be enclosed in double quotes like this:
9841 </para>
9842 <literallayout class="monospaced">
9843 [name="$local_part"]
9844 </literallayout>
9845 <para>
9846 but this still leaves the problem of a double quote in the data. The rule for
9847 NIS+ is that double quotes must be doubled. Other lookup types have different
9848 rules, and to cope with the differing requirements, an expansion operator
9849 of the following form is provided:
9850 </para>
9851 <literallayout class="monospaced">
9852 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
9853 </literallayout>
9854 <para>
9855 For example, the safest way to write the NIS+ query is
9856 </para>
9857 <literallayout class="monospaced">
9858 [name="${quote_nisplus:$local_part}"]
9859 </literallayout>
9860 <para>
9861 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
9862 operator can be used for all lookup types, but has no effect for single-key
9863 lookups, since no quoting is ever needed in their key strings.
9864 </para>
9865 </section>
9866 <section id="SECTdnsdb">
9867 <title>More about dnsdb</title>
9868 <para>
9869 <indexterm role="concept">
9870 <primary>dnsdb lookup</primary>
9871 </indexterm>
9872 <indexterm role="concept">
9873 <primary>lookup</primary>
9874 <secondary>dnsdb</secondary>
9875 </indexterm>
9876 <indexterm role="concept">
9877 <primary>DNS</primary>
9878 <secondary>as a lookup type</secondary>
9879 </indexterm>
9880 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
9881 of a record type and a domain name, separated by an equals sign. For example,
9882 an expansion string could contain:
9883 </para>
9884 <literallayout class="monospaced">
9885 ${lookup dnsdb{mx=a.b.example}{$value}fail}
9886 </literallayout>
9887 <para>
9888 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
9889 is used on its own as the result. If the lookup <phrase revisionflag="changed">does not succeed,</phrase> the
9890 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
9891 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
9892 </para>
9893 <para>
9894 The supported DNS record types are A, CNAME, MX, NS, PTR, SRV, and TXT, and,
9895 when Exim is compiled with IPv6 support, AAAA (and A6 if that is also
9896 configured). If no type is given, TXT is assumed. When the type is PTR,
9897 the data can be an IP address, written as normal; inversion and the addition of
9898 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
9899 </para>
9900 <literallayout class="monospaced">
9901 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
9902 </literallayout>
9903 <para>
9904 If the data for a PTR record is not a syntactically valid IP address, it is not
9905 altered and nothing is added.
9906 </para>
9907 <para>
9908 <indexterm role="concept">
9909 <primary>MX record</primary>
9910 <secondary>in <command>dnsdb</command> lookup</secondary>
9911 </indexterm>
9912 <indexterm role="concept">
9913 <primary>SRV record</primary>
9914 <secondary>in <command>dnsdb</command> lookup</secondary>
9915 </indexterm>
9916 For an MX lookup, both the preference value and the host name are returned for
9917 each record, separated by a space. For an SRV lookup, the priority, weight,
9918 port, and host name are returned for each record, separated by spaces.
9919 </para>
9920 <para>
9921 For any record type, if multiple records are found (or, for A6 lookups, if a
9922 single record leads to multiple addresses), the data is returned as a
9923 concatenation, with newline as the default separator. The order, of course,
9924 depends on the DNS resolver. You can specify a different separator character
9925 between multiple records by putting a right angle-bracket followed immediately
9926 by the new separator at the start of the query. For example:
9927 </para>
9928 <literallayout class="monospaced">
9929 ${lookup dnsdb{&gt;: a=host1.example}}
9930 </literallayout>
9931 <para>
9932 It is permitted to specify a space as the separator character. Further
9933 white space is ignored.
9934 </para>
9935 </section>
9936 <section>
9937 <title>Pseudo dnsdb record types</title>
9938 <para>
9939 <indexterm role="concept">
9940 <primary>MX record</primary>
9941 <secondary>in <command>dnsdb</command> lookup</secondary>
9942 </indexterm>
9943 By default, both the preference value and the host name are returned for
9944 each MX record, separated by a space. If you want only host names, you can use
9945 the pseudo-type MXH:
9946 </para>
9947 <literallayout class="monospaced">
9948 ${lookup dnsdb{mxh=a.b.example}}
9949 </literallayout>
9950 <para>
9951 In this case, the preference values are omitted, and just the host names are
9952 returned.
9953 </para>
9954 <para>
9955 <indexterm role="concept">
9956 <primary>name server</primary>
9957 <secondary>for enclosing domain</secondary>
9958 </indexterm>
9959 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
9960 records on the given domain, but if none are found, it removes the first
9961 component of the domain name, and tries again. This process continues until NS
9962 records are found or there are no more components left (or there is a DNS
9963 error). In other words, it may return the name servers for a top-level domain,
9964 but it never returns the root name servers. If there are no NS records for the
9965 top-level domain, the lookup fails. Consider these examples:
9966 </para>
9967 <literallayout class="monospaced">
9968 ${lookup dnsdb{zns=xxx.quercite.com}}
9969 ${lookup dnsdb{zns=xxx.edu}}
9970 </literallayout>
9971 <para>
9972 Assuming that in each case there are no NS records for the full domain name,
9973 the first returns the name servers for <option>quercite.com</option>, and the second returns
9974 the name servers for <option>edu</option>.
9975 </para>
9976 <para>
9977 You should be careful about how you use this lookup because, unless the
9978 top-level domain does not exist, the lookup always returns some host names. The
9979 sort of use to which this might be put is for seeing if the name servers for a
9980 given domain are on a blacklist. You can probably assume that the name servers
9981 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
9982 such a list.
9983 </para>
9984 <para>
9985 <indexterm role="concept">
9986 <primary>CSA</primary>
9987 <secondary>in <command>dnsdb</command> lookup</secondary>
9988 </indexterm>
9989 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
9990 records according to the CSA rules, which are described in section
9991 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
9992 not sufficient because of the extra parent domain search behaviour of CSA. The
9993 result of a successful lookup such as:
9994 </para>
9995 <literallayout class="monospaced">
9996 ${lookup dnsdb {csa=$sender_helo_name}}
9997 </literallayout>
9998 <para>
9999 has two space-separated fields: an authorization code and a target host name.
10000 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
10001 authorization required but absent, or <quote>?</quote> for unknown.
10002 </para>
10003 </section>
10004 <section>
10005 <title>Multiple dnsdb lookups</title>
10006 <para>
10007 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
10008 However, you can specify a list of domains or IP addresses in a single
10009 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
10010 the default separator, but with the ability to change this. For example:
10011 </para>
10012 <literallayout class="monospaced">
10013 ${lookup dnsdb{one.domain.com:two.domain.com}}
10014 ${lookup dnsdb{a=one.host.com:two.host.com}}
10015 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
10016 </literallayout>
10017 <para>
10018 In order to retain backwards compatibility, there is one special case: if
10019 the lookup type is PTR and no change of separator is specified, Exim looks
10020 to see if the rest of the string is precisely one IPv6 address. In this
10021 case, it does not treat it as a list.
10022 </para>
10023 <para>
10024 The data from each lookup is concatenated, with newline separators by default,
10025 in the same way that multiple DNS records for a single item are handled. A
10026 different separator can be specified, as described above.
10027 </para>
10028 <para>
10029 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
10030 temporary DNS error for any of them, the behaviour is controlled by
10031 an optional keyword followed by a comma that may appear before the record
10032 type. The possible keywords are <quote>defer_strict</quote>, <quote>defer_never</quote>, and
10033 <quote>defer_lax</quote>. With <quote>strict</quote> behaviour, any temporary DNS error causes the
10034 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
10035 ignored, and the behaviour is as if the DNS lookup failed to find anything.
10036 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
10037 error causes the whole lookup to defer only if none of the other lookups
10038 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
10039 </para>
10040 <literallayout class="monospaced">
10041 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
10042 ${lookup dnsdb{a=one.host.com:two.host.com}}
10043 </literallayout>
10044 <para>
10045 Thus, in the default case, as long as at least one of the DNS lookups
10046 yields some data, the lookup succeeds.
10047 </para>
10048 </section>
10049 <section id="SECTldap">
10050 <title>More about LDAP</title>
10051 <para>
10052 <indexterm role="concept">
10053 <primary>LDAP lookup</primary>
10054 </indexterm>
10055 <indexterm role="concept">
10056 <primary>lookup</primary>
10057 <secondary>LDAP</secondary>
10058 </indexterm>
10059 <indexterm role="concept">
10060 <primary>Solaris</primary>
10061 <secondary>LDAP</secondary>
10062 </indexterm>
10063 The original LDAP implementation came from the University of Michigan; this has
10064 become <quote>Open LDAP</quote>, and there are now two different releases. Another
10065 implementation comes from Netscape, and Solaris 7 and subsequent releases
10066 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
10067 the lookup function level, their error handling is different. For this reason
10068 it is necessary to set a compile-time variable when building Exim with LDAP, to
10069 indicate which LDAP library is in use. One of the following should appear in
10070 your <filename>Local/Makefile</filename>:
10071 </para>
10072 <literallayout class="monospaced">
10073 LDAP_LIB_TYPE=UMICHIGAN
10074 LDAP_LIB_TYPE=OPENLDAP1
10075 LDAP_LIB_TYPE=OPENLDAP2
10076 LDAP_LIB_TYPE=NETSCAPE
10077 LDAP_LIB_TYPE=SOLARIS
10078 </literallayout>
10079 <para>
10080 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
10081 same interface as the University of Michigan version.
10082 </para>
10083 <para>
10084 There are three LDAP lookup types in Exim. These behave slightly differently in
10085 the way they handle the results of a query:
10086 </para>
10087 <itemizedlist>
10088 <listitem>
10089 <para>
10090 <command>ldap</command> requires the result to contain just one entry; if there are more, it
10091 gives an error.
10092 </para>
10093 </listitem>
10094 <listitem>
10095 <para>
10096 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
10097 Distinguished Name that is returned rather than any attribute values.
10098 </para>
10099 </listitem>
10100 <listitem>
10101 <para>
10102 <command>ldapm</command> permits the result to contain more than one entry; the attributes
10103 from all of them are returned.
10104 </para>
10105 </listitem>
10106 </itemizedlist>
10107 <para>
10108 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
10109 Exim behaves as if the entry did not exist, and the lookup fails. The format of
10110 the data returned by a successful lookup is described in the next section.
10111 First we explain how LDAP queries are coded.
10112 </para>
10113 </section>
10114 <section id="SECTforldaque">
10115 <title>Format of LDAP queries</title>
10116 <para>
10117 <indexterm role="concept">
10118 <primary>LDAP</primary>
10119 <secondary>query format</secondary>
10120 </indexterm>
10121 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
10122 the configuration of a <command>redirect</command> router one might have this setting:
10123 </para>
10124 <literallayout class="monospaced">
10125 data = ${lookup ldap \
10126   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
10127   c=UK?mailbox?base?}}
10128 </literallayout>
10129 <para>
10130 <indexterm role="concept">
10131 <primary>LDAP</primary>
10132 <secondary>with TLS</secondary>
10133 </indexterm>
10134 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
10135 secure (encrypted) LDAP connections. The second of these ensures that an
10136 encrypted TLS connection is used.
10137 </para>
10138 </section>
10139 <section>
10140 <title>LDAP quoting</title>
10141 <para>
10142 <indexterm role="concept">
10143 <primary>LDAP</primary>
10144 <secondary>quoting</secondary>
10145 </indexterm>
10146 Two levels of quoting are required in LDAP queries, the first for LDAP itself
10147 and the second because the LDAP query is represented as a URL. Furthermore,
10148 within an LDAP query, two different kinds of quoting are required. For this
10149 reason, there are two different LDAP-specific quoting operators.
10150 </para>
10151 <para>
10152 The <option>quote_ldap</option> operator is designed for use on strings that are part of
10153 filter specifications. Conceptually, it first does the following conversions on
10154 the string:
10155 </para>
10156 <literallayout class="monospaced">
10157 *   =&gt;   \2A
10158 (   =&gt;   \28
10159 )   =&gt;   \29
10160 \   =&gt;   \5C
10161 </literallayout>
10162 <para>
10163 in accordance with RFC 2254. The resulting string is then quoted according
10164 to the rules for URLs, that is, all non-alphanumeric characters except
10165 </para>
10166 <literallayout class="monospaced">
10167 ! $ ' - . _ ( ) * +
10168 </literallayout>
10169 <para>
10170 are converted to their hex values, preceded by a percent sign. For example:
10171 </para>
10172 <literallayout class="monospaced">
10173 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
10174 </literallayout>
10175 <para>
10176 yields
10177 </para>
10178 <literallayout class="monospaced">
10179 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
10180 </literallayout>
10181 <para>
10182 Removing the URL quoting, this is (with a leading and a trailing space):
10183 </para>
10184 <literallayout class="monospaced">
10185 a\28bc\29\2A, a&lt;yz&gt;;
10186 </literallayout>
10187 <para>
10188 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
10189 base DN specifications in queries. Conceptually, it first converts the string
10190 by inserting a backslash in front of any of the following characters:
10191 </para>
10192 <literallayout class="monospaced">
10193 , + " \ &lt; &gt; ;
10194 </literallayout>
10195 <para>
10196 It also inserts a backslash before any leading spaces or # characters, and
10197 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
10198 is then quoted according to the rules for URLs. For example:
10199 </para>
10200 <literallayout class="monospaced">
10201 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
10202 </literallayout>
10203 <para>
10204 yields
10205 </para>
10206 <literallayout class="monospaced">
10207 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
10208 </literallayout>
10209 <para>
10210 Removing the URL quoting, this is (with a trailing space):
10211 </para>
10212 <literallayout class="monospaced">
10213 \ a(bc)*\, a\&lt;yz\&gt;\;\
10214 </literallayout>
10215 <para>
10216 There are some further comments about quoting in the section on LDAP
10217 authentication below.
10218 </para>
10219 </section>
10220 <section>
10221 <title>LDAP connections</title>
10222 <para>
10223 <indexterm role="concept">
10224 <primary>LDAP</primary>
10225 <secondary>connections</secondary>
10226 </indexterm>
10227 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
10228 is in use, via a Unix domain socket. The example given above does not specify
10229 an LDAP server. A server that is reached by TCP/IP can be specified in a query
10230 by starting it with
10231 </para>
10232 <literallayout class="monospaced">
10233 ldap://&lt;hostname&gt;:&lt;port&gt;/...
10234 </literallayout>
10235 <para>
10236 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
10237 used. When no server is specified in a query, a list of default servers is
10238 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
10239 colon-separated list of servers which are tried in turn until one successfully
10240 handles a query, or there is a serious error. Successful handling either
10241 returns the requested data, or indicates that it does not exist. Serious errors
10242 are syntactical, or multiple values when only a single value is expected.
10243 Errors which cause the next server to be tried are connection failures, bind
10244 failures, and timeouts.
10245 </para>
10246 <para>
10247 For each server name in the list, a port number can be given. The standard way
10248 of specifing a host and port is to use a colon separator (RFC 1738). Because
10249 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
10250 doubled. For example
10251 </para>
10252 <literallayout class="monospaced">
10253 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
10254 </literallayout>
10255 <para>
10256 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
10257 to the LDAP library with no server name, and the library&#x2019;s default (normally
10258 the local host) is used.
10259 </para>
10260 <para>
10261 If you are using the OpenLDAP library, you can connect to an LDAP server using
10262 a Unix domain socket instead of a TCP/IP connection. This is specified by using
10263 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
10264 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
10265 not available.
10266 </para>
10267 <para>
10268 For this type of connection, instead of a host name for the server, a pathname
10269 for the socket is required, and the port number is not relevant. The pathname
10270 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
10271 the query. In the former case, you can have settings such as
10272 </para>
10273 <literallayout class="monospaced">
10274 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
10275 </literallayout>
10276 <para>
10277 When the pathname is given in the query, you have to escape the slashes as
10278 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
10279 </para>
10280 <literallayout class="monospaced">
10281 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
10282 </literallayout>
10283 <para>
10284 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
10285 a pathname, it uses the Unix domain socket code, even if the query actually
10286 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
10287 socket connection. This behaviour means that you can use a setting of
10288 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
10289 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
10290 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
10291 backup host.
10292 </para>
10293 <para>
10294 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
10295 specified, an error is diagnosed. However, if there are more items in
10296 <option>ldap_default_servers</option>, they are tried. In other words:
10297 </para>
10298 <itemizedlist>
10299 <listitem>
10300 <para>
10301 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
10302 interface.
10303 </para>
10304 </listitem>
10305 <listitem>
10306 <para>
10307 Using <literal>ldapi</literal> with a host name causes an error.
10308 </para>
10309 </listitem>
10310 </itemizedlist>
10311 <para>
10312 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
10313 <option>ldap_default_servers</option>, does whatever the library does by default.
10314 </para>
10315 </section>
10316 <section>
10317 <title>LDAP authentication and control information</title>
10318 <para>
10319 <indexterm role="concept">
10320 <primary>LDAP</primary>
10321 <secondary>authentication</secondary>
10322 </indexterm>
10323 The LDAP URL syntax provides no way of passing authentication and other control
10324 information to the server. To make this possible, the URL in an LDAP query may
10325 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
10326 spaces. If a value contains spaces it must be enclosed in double quotes, and
10327 when double quotes are used, backslash is interpreted in the usual way inside
10328 them. The following names are recognized:
10329 </para>
10330 <literallayout revisionflag="changed">
10331 <literal>DEREFERENCE</literal>  set the dereferencing parameter
10332 <literal>NETTIME    </literal>  set a timeout for a network operation
10333 <literal>USER       </literal>  set the DN, for authenticating the LDAP bind
10334 <literal>PASS       </literal>  set the password, likewise
10335 <literal>REFERRALS  </literal>  set the referrals parameter
10336 <literal>SIZE       </literal>  set the limit for the number of entries returned
10337 <literal>TIME       </literal>  set the maximum waiting time for a query
10338 </literallayout>
10339 <para revisionflag="changed">
10340 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
10341 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
10342 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
10343 library from trying to follow referrals issued by the LDAP server.
10344 </para>
10345 <para>
10346 The name CONNECT is an obsolete name for NETTIME, retained for
10347 backwards compatibility. This timeout (specified as a number of seconds) is
10348 enforced from the client end for operations that can be carried out over a
10349 network. Specifically, it applies to network connections and calls to the
10350 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
10351 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
10352 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
10353 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
10354 Netscape SDK; for OpenLDAP no action is taken.
10355 </para>
10356 <para>
10357 The TIME parameter (also a number of seconds) is passed to the server to
10358 set a server-side limit on the time taken to complete a search.
10359 </para>
10360 <para>
10361 Here is an example of an LDAP query in an Exim lookup that uses some of these
10362 values. This is a single line, folded to fit on the page:
10363 </para>
10364 <literallayout class="monospaced">
10365 ${lookup ldap
10366   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
10367   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
10368   {$value}fail}
10369 </literallayout>
10370 <para>
10371 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
10372 any of the auxiliary data. Exim configuration settings that include lookups
10373 which contain password information should be preceded by <quote>hide</quote> to prevent
10374 non-admin users from using the <option>-bP</option> option to see their values.
10375 </para>
10376 <para>
10377 The auxiliary data items may be given in any order. The default is no
10378 connection timeout (the system timeout is used), no user or password, no limit
10379 on the number of entries returned, and no time limit on queries.
10380 </para>
10381 <para>
10382 When a DN is quoted in the USER= setting for LDAP authentication, Exim
10383 removes any URL quoting that it may contain before passing it LDAP. Apparently
10384 some libraries do this for themselves, but some do not. Removing the URL
10385 quoting has two advantages:
10386 </para>
10387 <itemizedlist>
10388 <listitem>
10389 <para>
10390 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
10391 DNs as with DNs inside actual queries.
10392 </para>
10393 </listitem>
10394 <listitem>
10395 <para>
10396 It permits spaces inside USER= DNs.
10397 </para>
10398 </listitem>
10399 </itemizedlist>
10400 <para>
10401 For example, a setting such as
10402 </para>
10403 <literallayout class="monospaced">
10404 USER=cn=${quote_ldap_dn:$1}
10405 </literallayout>
10406 <para>
10407 should work even if <varname>$1</varname> contains spaces.
10408 </para>
10409 <para>
10410 Expanded data for the PASS= value should be quoted using the <option>quote</option>
10411 expansion operator, rather than the LDAP quote operators. The only reason this
10412 field needs quoting is to ensure that it conforms to the Exim syntax, which
10413 does not allow unquoted spaces. For example:
10414 </para>
10415 <literallayout class="monospaced">
10416 PASS=${quote:$3}
10417 </literallayout>
10418 <para>
10419 The LDAP authentication mechanism can be used to check passwords as part of
10420 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
10421 <xref linkend="CHAPexpand"/>.
10422 </para>
10423 </section>
10424 <section>
10425 <title>Format of data returned by LDAP</title>
10426 <para>
10427 <indexterm role="concept">
10428 <primary>LDAP</primary>
10429 <secondary>returned data formats</secondary>
10430 </indexterm>
10431 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
10432 as a sequence of values, for example
10433 </para>
10434 <literallayout class="monospaced">
10435 cn=manager, o=University of Cambridge, c=UK
10436 </literallayout>
10437 <para>
10438 The <command>ldap</command> lookup type generates an error if more than one entry matches the
10439 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
10440 the result between the data from different entries. It is possible for multiple
10441 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
10442 you know that whatever values are returned all came from a single entry in the
10443 directory.
10444 </para>
10445 <para>
10446 In the common case where you specify a single attribute in your LDAP query, the
10447 result is not quoted, and does not contain the attribute name. If the attribute
10448 has multiple values, they are separated by commas.
10449 </para>
10450 <para>
10451 If you specify multiple attributes, the result contains space-separated, quoted
10452 strings, each preceded by the attribute name and an equals sign. Within the
10453 quotes, the quote character, backslash, and newline are escaped with
10454 backslashes, and commas are used to separate multiple values for the attribute.
10455 Apart from the escaping, the string within quotes takes the same form as the
10456 output when a single attribute is requested. Specifying no attributes is the
10457 same as specifying all of an entry&#x2019;s attributes.
10458 </para>
10459 <para>
10460 Here are some examples of the output format. The first line of each pair is an
10461 LDAP query, and the second is the data that is returned. The attribute called
10462 <option>attr1</option> has two values, whereas <option>attr2</option> has only one value:
10463 </para>
10464 <literallayout class="monospaced">
10465 ldap:///o=base?attr1?sub?(uid=fred)
10466 value1.1, value1.2
10467
10468 ldap:///o=base?attr2?sub?(uid=fred)
10469 value two
10470
10471 ldap:///o=base?attr1,attr2?sub?(uid=fred)
10472 attr1="value1.1, value1.2" attr2="value two"
10473
10474 ldap:///o=base??sub?(uid=fred)
10475 objectClass="top" attr1="value1.1, value1.2" attr2="value two"
10476 </literallayout>
10477 <para>
10478 The <option>extract</option> operator in string expansions can be used to pick out
10479 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs. You can
10480 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
10481 results of LDAP lookups.
10482 </para>
10483 </section>
10484 <section id="SECTnisplus">
10485 <title>More about NIS+</title>
10486 <para>
10487 <indexterm role="concept">
10488 <primary>NIS+ lookup type</primary>
10489 </indexterm>
10490 <indexterm role="concept">
10491 <primary>lookup</primary>
10492 <secondary>NIS+</secondary>
10493 </indexterm>
10494 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
10495 and field name. If this is given, the result of a successful query is the
10496 contents of the named field; otherwise the result consists of a concatenation
10497 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
10498 values containing spaces are quoted. For example, the query
10499 </para>
10500 <literallayout class="monospaced">
10501 [name=mg1456],passwd.org_dir
10502 </literallayout>
10503 <para>
10504 might return the string
10505 </para>
10506 <literallayout class="monospaced">
10507 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
10508 home=/home/mg1456 shell=/bin/bash shadow=""
10509 </literallayout>
10510 <para>
10511 (split over two lines here to fit on the page), whereas
10512 </para>
10513 <literallayout class="monospaced">
10514 [name=mg1456],passwd.org_dir:gcos
10515 </literallayout>
10516 <para>
10517 would just return
10518 </para>
10519 <literallayout class="monospaced">
10520 Martin Guerre
10521 </literallayout>
10522 <para>
10523 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
10524 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
10525 operator is to double any quote characters within the text.
10526 </para>
10527 </section>
10528 <section id="SECTsql">
10529 <title>SQL lookups</title>
10530 <para>
10531 <indexterm role="concept">
10532 <primary>SQL lookup types</primary>
10533 </indexterm>
10534 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, and SQLite
10535 databases. Queries for these databases contain SQL statements, so an example
10536 might be
10537 </para>
10538 <literallayout class="monospaced">
10539 ${lookup mysql{select mailbox from users where id='userx'}\
10540   {$value}fail}
10541 </literallayout>
10542 <para>
10543 If the result of the query contains more than one field, the data for each
10544 field in the row is returned, preceded by its name, so the result of
10545 </para>
10546 <literallayout class="monospaced">
10547 ${lookup pgsql{select home,name from users where id='userx'}\
10548   {$value}}
10549 </literallayout>
10550 <para>
10551 might be
10552 </para>
10553 <literallayout class="monospaced">
10554 home=/home/userx name="Mister X"
10555 </literallayout>
10556 <para>
10557 Empty values and values containing spaces are double quoted, with embedded
10558 quotes escaped by a backslash. If the result of the query contains just one
10559 field, the value is passed back verbatim, without a field name, for example:
10560 </para>
10561 <literallayout class="monospaced">
10562 Mister X
10563 </literallayout>
10564 <para>
10565 If the result of the query yields more than one row, it is all concatenated,
10566 with a newline between the data for each row.
10567 </para>
10568 </section>
10569 <section>
10570 <title>More about MySQL, PostgreSQL, Oracle, and InterBase</title>
10571 <para>
10572 <indexterm role="concept">
10573 <primary>MySQL</primary>
10574 <secondary>lookup type</secondary>
10575 </indexterm>
10576 <indexterm role="concept">
10577 <primary>PostgreSQL lookup type</primary>
10578 </indexterm>
10579 <indexterm role="concept">
10580 <primary>lookup</primary>
10581 <secondary>MySQL</secondary>
10582 </indexterm>
10583 <indexterm role="concept">
10584 <primary>lookup</primary>
10585 <secondary>PostgreSQL</secondary>
10586 </indexterm>
10587 <indexterm role="concept">
10588 <primary>Oracle</primary>
10589 <secondary>lookup type</secondary>
10590 </indexterm>
10591 <indexterm role="concept">
10592 <primary>lookup</primary>
10593 <secondary>Oracle</secondary>
10594 </indexterm>
10595 <indexterm role="concept">
10596 <primary>InterBase lookup type</primary>
10597 </indexterm>
10598 <indexterm role="concept">
10599 <primary>lookup</primary>
10600 <secondary>InterBase</secondary>
10601 </indexterm>
10602 If any MySQL, PostgreSQL, Oracle, or InterBase lookups are used, the
10603 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, or <option>ibase_servers</option>
10604 option (as appropriate) must be set to a colon-separated list of server
10605 information. Each item in the list is a slash-separated list of four items:
10606 host name, database name, user name, and password. In the case of Oracle, the
10607 host name field is used for the <quote>service name</quote>, and the database name field
10608 is not used and should be empty. For example:
10609 </para>
10610 <literallayout class="monospaced">
10611 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
10612 </literallayout>
10613 <para>
10614 Because password data is sensitive, you should always precede the setting with
10615 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
10616 option. Here is an example where two MySQL servers are listed:
10617 </para>
10618 <literallayout class="monospaced">
10619 hide mysql_servers = localhost/users/root/secret:\
10620                      otherhost/users/root/othersecret
10621 </literallayout>
10622 <para>
10623 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
10624 because this is a colon-separated list, the colon has to be doubled. For each
10625 query, these parameter groups are tried in order until a connection and a query
10626 succeeds.
10627 </para>
10628 <para>
10629 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
10630 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
10631 respectively, and the characters single-quote, double-quote, and backslash
10632 itself are escaped with backslashes. The <option>quote_pgsql</option> expansion operator, in
10633 addition, escapes the percent and underscore characters. This cannot be done
10634 for MySQL because these escapes are not recognized in contexts where these
10635 characters are not special.
10636 </para>
10637 </section>
10638 <section>
10639 <title>Special MySQL features</title>
10640 <para>
10641 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
10642 causes a connection to the server on the local host by means of a Unix domain
10643 socket. An alternate socket can be specified in parentheses. The full syntax of
10644 each item in <option>mysql_servers</option> is:
10645 </para>
10646 <literallayout>
10647 &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;
10648 </literallayout>
10649 <para>
10650 Any of the three sub-parts of the first field can be omitted. For normal use on
10651 the local host it can be left blank or set to just <quote>localhost</quote>.
10652 </para>
10653 <para>
10654 No database need be supplied &ndash; but if it is absent here, it must be given in
10655 the queries.
10656 </para>
10657 <para>
10658 If a MySQL query is issued that does not request any data (an insert, update,
10659 or delete command), the result of the lookup is the number of rows affected.
10660 </para>
10661 <para>
10662 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
10663 anything (for example, setting a field to the value it already has), the result
10664 is zero because no rows are affected.
10665 </para>
10666 </section>
10667 <section>
10668 <title>Special PostgreSQL features</title>
10669 <para>
10670 PostgreSQL lookups can also use Unix domain socket connections to the database.
10671 This is usually faster and costs less CPU time than a TCP/IP connection.
10672 However it can be used only if the mail server runs on the same machine as the
10673 database server. A configuration line for PostgreSQL via Unix domain sockets
10674 looks like this:
10675 </para>
10676 <literallayout class="monospaced">
10677 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
10678 </literallayout>
10679 <para>
10680 In other words, instead of supplying a host name, a path to the socket is
10681 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
10682 visually confused with the delimiters for the other server parameters.
10683 </para>
10684 <para>
10685 If a PostgreSQL query is issued that does not request any data (an insert,
10686 update, or delete command), the result of the lookup is the number of rows
10687 affected.
10688 </para>
10689 </section>
10690 <section id="SECTsqlite">
10691 <title>More about SQLite</title>
10692 <para>
10693 <indexterm role="concept">
10694 <primary>lookup</primary>
10695 <secondary>SQLite</secondary>
10696 </indexterm>
10697 <indexterm role="concept">
10698 <primary>SQLite lookup type</primary>
10699 </indexterm>
10700 SQLite is different to the other SQL lookups because a file name is required in
10701 addition to the SQL query. An SQLite database is a single file, and there is no
10702 daemon as in the other SQL databases. The interface to Exim requires the name
10703 of the file, as an absolute path, to be given at the start of the query. It is
10704 separated from the query by white space. This means that the path name cannot
10705 contain white space. Here is a lookup expansion example:
10706 </para>
10707 <literallayout class="monospaced">
10708 ${lookup sqlite {/some/thing/sqlitedb \
10709   select name from aliases where id='userx';}}
10710 </literallayout>
10711 <para>
10712 In a list, the syntax is similar. For example:
10713 </para>
10714 <literallayout class="monospaced">
10715 domainlist relay_domains = sqlite;/some/thing/sqlitedb \
10716    select * from relays where ip='$sender_host_address';
10717 </literallayout>
10718 <para>
10719 The only character affected by the <option>quote_sqlite</option> operator is a single
10720 quote, which it doubles.
10721 </para>
10722 <para>
10723 The SQLite library handles multiple simultaneous accesses to the database
10724 internally. Multiple readers are permitted, but only one process can
10725 update at once. Attempts to access the database while it is being updated
10726 are rejected after a timeout period, during which the SQLite library
10727 waits for the lock to be released. In Exim, the default timeout is set
10728 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
10729 option.
10730 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
10731 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
10732 </para>
10733 </section>
10734 </chapter>
10735
10736 <chapter id="CHAPdomhosaddlists">
10737 <title>Domain, host, address, and local part lists</title>
10738 <titleabbrev>Domain, host, and address lists</titleabbrev>
10739 <para>
10740 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
10741 <primary>lists of domains; hosts; etc.</primary>
10742 </indexterm>
10743 A number of Exim configuration options contain lists of domains, hosts,
10744 email addresses, or local parts. For example, the <option>hold_domains</option> option
10745 contains a list of domains whose delivery is currently suspended. These lists
10746 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
10747 arguments to expansion conditions such as <option>match_domain</option>.
10748 </para>
10749 <para>
10750 Each item in one of these lists is a pattern to be matched against a domain,
10751 host, email address, or local part, respectively. In the sections below, the
10752 different types of pattern for each case are described, but first we cover some
10753 general facilities that apply to all four kinds of list.
10754 </para>
10755 <section>
10756 <title>Expansion of lists</title>
10757 <para>
10758 <indexterm role="concept">
10759 <primary>expansion</primary>
10760 <secondary>of lists</secondary>
10761 </indexterm>
10762 Each list is expanded as a single string before it is used. The result of
10763 expansion must be a list, possibly containing empty items, which is split up
10764 into separate items for matching. By default, colon is the separator character,
10765 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
10766 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
10767 discusses the way to specify empty list items.
10768 </para>
10769 <para>
10770 If the string expansion is forced to fail, Exim behaves as if the item it is
10771 testing (domain, host, address, or local part) is not in the list. Other
10772 expansion failures cause temporary errors.
10773 </para>
10774 <para>
10775 If an item in a list is a regular expression, backslashes, dollars and possibly
10776 other special characters in the expression must be protected against
10777 misinterpretation by the string expander. The easiest way to do this is to use
10778 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
10779 expression should not be expanded. For example, in an ACL you might have:
10780 </para>
10781 <literallayout class="monospaced">
10782 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
10783                ${lookup{$domain}lsearch{/badsenders/bydomain}}
10784 </literallayout>
10785 <para>
10786 The first item is a regular expression that is protected from expansion by
10787 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
10788 senders based on the receiving domain.
10789 </para>
10790 </section>
10791 <section>
10792 <title>Negated items in lists</title>
10793 <para>
10794 <indexterm role="concept">
10795 <primary>list</primary>
10796 <secondary>negation</secondary>
10797 </indexterm>
10798 <indexterm role="concept">
10799 <primary>negation</primary>
10800 <secondary>in lists</secondary>
10801 </indexterm>
10802 Items in a list may be positive or negative. Negative items are indicated by a
10803 leading exclamation mark, which may be followed by optional white space. A list
10804 defines a set of items (domains, etc). When Exim processes one of these lists,
10805 it is trying to find out whether a domain, host, address, or local part
10806 (respectively) is in the set that is defined by the list. It works like this:
10807 </para>
10808 <para>
10809 The list is scanned from left to right. If a positive item is matched, the
10810 subject that is being checked is in the set; if a negative item is matched, the
10811 subject is not in the set. If the end of the list is reached without the
10812 subject having matched any of the patterns, it is in the set if the last item
10813 was a negative one, but not if it was a positive one. For example, the list in
10814 </para>
10815 <literallayout class="monospaced">
10816 domainlist relay_domains = !a.b.c : *.b.c
10817 </literallayout>
10818 <para>
10819 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
10820 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
10821 list is positive. However, if the setting were
10822 </para>
10823 <literallayout class="monospaced">
10824 domainlist relay_domains = !a.b.c
10825 </literallayout>
10826 <para>
10827 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
10828 list is negative. In other words, a list that ends with a negative item behaves
10829 as if it had an extra item <literal>:*</literal> on the end.
10830 </para>
10831 <para>
10832 Another way of thinking about positive and negative items in lists is to read
10833 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
10834 item.
10835 </para>
10836 </section>
10837 <section id="SECTfilnamlis">
10838 <title>File names in lists</title>
10839 <para>
10840 <indexterm role="concept">
10841 <primary>list</primary>
10842 <secondary>file name in</secondary>
10843 </indexterm>
10844 If an item in a domain, host, address, or local part list is an absolute file
10845 name (beginning with a slash character), each line of the file is read and
10846 processed as if it were an independent item in the list, except that further
10847 file names are not allowed,
10848 and no expansion of the data from the file takes place.
10849 Empty lines in the file are ignored, and the file may also contain comment
10850 lines:
10851 </para>
10852 <itemizedlist>
10853 <listitem>
10854 <para>
10855 For domain and host lists, if a # character appears anywhere in a line of the
10856 file, it and all following characters are ignored.
10857 </para>
10858 </listitem>
10859 <listitem>
10860 <para>
10861 Because local parts may legitimately contain # characters, a comment in an
10862 address list or local part list file is recognized only if # is preceded by
10863 white space or the start of the line. For example:
10864 </para>
10865 <literallayout class="monospaced">
10866 not#comment@x.y.z   # but this is a comment
10867 </literallayout>
10868 </listitem>
10869 </itemizedlist>
10870 <para>
10871 Putting a file name in a list has the same effect as inserting each line of the
10872 file as an item in the list (blank lines and comments excepted). However, there
10873 is one important difference: the file is read each time the list is processed,
10874 so if its contents vary over time, Exim&#x2019;s behaviour changes.
10875 </para>
10876 <para>
10877 If a file name is preceded by an exclamation mark, the sense of any match
10878 within the file is inverted. For example, if
10879 </para>
10880 <literallayout class="monospaced">
10881 hold_domains = !/etc/nohold-domains
10882 </literallayout>
10883 <para>
10884 and the file contains the lines
10885 </para>
10886 <literallayout class="monospaced">
10887 !a.b.c
10888 *.b.c
10889 </literallayout>
10890 <para>
10891 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
10892 any domain matching <literal>*.b.c</literal> is not.
10893 </para>
10894 </section>
10895 <section>
10896 <title>An lsearch file is not an out-of-line list</title>
10897 <para>
10898 As will be described in the sections that follow, lookups can be used in lists
10899 to provide indexed methods of checking list membership. There has been some
10900 confusion about the way <command>lsearch</command> lookups work in lists. Because
10901 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
10902 sometimes thought that it is allowed to contain wild cards and other kinds of
10903 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
10904 always fixed strings, just as for any other single-key lookup type.
10905 </para>
10906 <para revisionflag="changed">
10907 If you want to use a file to contain wild-card patterns that form part of a
10908 list, just give the file name on its own, without a search type, as described
10909 in the previous section. You could also use the <command>wildlsearch</command> or
10910 <command>nwildlsearch</command>, but there is no advantage in doing this.
10911 </para>
10912 </section>
10913 <section id="SECTnamedlists">
10914 <title>Named lists</title>
10915 <para>
10916 <indexterm role="concept">
10917 <primary>named lists</primary>
10918 </indexterm>
10919 <indexterm role="concept">
10920 <primary>list</primary>
10921 <secondary>named</secondary>
10922 </indexterm>
10923 A list of domains, hosts, email addresses, or local parts can be given a name
10924 which is then used to refer to the list elsewhere in the configuration. This is
10925 particularly convenient if the same list is required in several different
10926 places. It also allows lists to be given meaningful names, which can improve
10927 the readability of the configuration. For example, it is conventional to define
10928 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
10929 locally on a host, using a configuration line such as
10930 </para>
10931 <literallayout class="monospaced">
10932 domainlist local_domains = localhost:my.dom.example
10933 </literallayout>
10934 <para>
10935 Named lists are referenced by giving their name preceded by a plus sign, so,
10936 for example, a router that is intended to handle local domains would be
10937 configured with the line
10938 </para>
10939 <literallayout class="monospaced">
10940 domains = +local_domains
10941 </literallayout>
10942 <para>
10943 The first router in a configuration is often one that handles all domains
10944 except the local ones, using a configuration with a negated item like this:
10945 </para>
10946 <literallayout class="monospaced">
10947 dnslookup:
10948   driver = dnslookup
10949   domains = ! +local_domains
10950   transport = remote_smtp
10951   no_more
10952 </literallayout>
10953 <para>
10954 The four kinds of named list are created by configuration lines starting with
10955 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
10956 respectively. Then there follows the name that you are defining, followed by an
10957 equals sign and the list itself. For example:
10958 </para>
10959 <literallayout class="monospaced">
10960 hostlist    relay_hosts = 192.168.23.0/24 : my.friend.example
10961 addresslist bad_senders = cdb;/etc/badsenders
10962 </literallayout>
10963 <para>
10964 A named list may refer to other named lists:
10965 </para>
10966 <literallayout class="monospaced">
10967 domainlist  dom1 = first.example : second.example
10968 domainlist  dom2 = +dom1 : third.example
10969 domainlist  dom3 = fourth.example : +dom2 : fifth.example
10970 </literallayout>
10971 <para>
10972 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
10973 effect may not be what you intended, because the negation does not propagate
10974 out to the higher level. For example, consider:
10975 </para>
10976 <literallayout class="monospaced">
10977 domainlist  dom1 = !a.b
10978 domainlist  dom2 = +dom1 : *.b
10979 </literallayout>
10980 <para>
10981 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
10982 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
10983 means it matches the second list as well. The effect is not the same as
10984 </para>
10985 <literallayout class="monospaced">
10986 domainlist  dom2 = !a.b : *.b
10987 </literallayout>
10988 <para>
10989 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
10990 referenced lists if you can.
10991 </para>
10992 <para>
10993 Named lists may have a performance advantage. When Exim is routing an
10994 address or checking an incoming message, it caches the result of tests on named
10995 lists. So, if you have a setting such as
10996 </para>
10997 <literallayout class="monospaced">
10998 domains = +local_domains
10999 </literallayout>
11000 <para>
11001 on several of your routers
11002 or in several ACL statements,
11003 the actual test is done only for the first one. However, the caching works only
11004 if there are no expansions within the list itself or any sublists that it
11005 references. In other words, caching happens only for lists that are known to be
11006 the same each time they are referenced.
11007 </para>
11008 <para>
11009 By default, there may be up to 16 named lists of each type. This limit can be
11010 extended by changing a compile-time variable. The use of domain and host lists
11011 is recommended for concepts such as local domains, relay domains, and relay
11012 hosts. The default configuration is set up like this.
11013 </para>
11014 </section>
11015 <section>
11016 <title>Named lists compared with macros</title>
11017 <para>
11018 <indexterm role="concept">
11019 <primary>list</primary>
11020 <secondary>named compared with macro</secondary>
11021 </indexterm>
11022 <indexterm role="concept">
11023 <primary>macro</primary>
11024 <secondary>compared with named list</secondary>
11025 </indexterm>
11026 At first sight, named lists might seem to be no different from macros in the
11027 configuration file. However, macros are just textual substitutions. If you
11028 write
11029 </para>
11030 <literallayout class="monospaced">
11031 ALIST = host1 : host2
11032 auth_advertise_hosts = !ALIST
11033 </literallayout>
11034 <para>
11035 it probably won&#x2019;t do what you want, because that is exactly the same as
11036 </para>
11037 <literallayout class="monospaced">
11038 auth_advertise_hosts = !host1 : host2
11039 </literallayout>
11040 <para>
11041 Notice that the second host name is not negated. However, if you use a host
11042 list, and write
11043 </para>
11044 <literallayout class="monospaced">
11045 hostlist alist = host1 : host2
11046 auth_advertise_hosts = ! +alist
11047 </literallayout>
11048 <para>
11049 the negation applies to the whole list, and so that is equivalent to
11050 </para>
11051 <literallayout class="monospaced">
11052 auth_advertise_hosts = !host1 : !host2
11053 </literallayout>
11054 </section>
11055 <section>
11056 <title>Named list caching</title>
11057 <para>
11058 <indexterm role="concept">
11059 <primary>list</primary>
11060 <secondary>caching of named</secondary>
11061 </indexterm>
11062 <indexterm role="concept">
11063 <primary>caching</primary>
11064 <secondary>named lists</secondary>
11065 </indexterm>
11066 While processing a message, Exim caches the result of checking a named list if
11067 it is sure that the list is the same each time. In practice, this means that
11068 the cache operates only if the list contains no $ characters, which guarantees
11069 that it will not change when it is expanded. Sometimes, however, you may have
11070 an expanded list that you know will be the same each time within a given
11071 message. For example:
11072 </para>
11073 <literallayout class="monospaced">
11074 domainlist special_domains = \
11075            ${lookup{$sender_host_address}cdb{/some/file}}
11076 </literallayout>
11077 <para>
11078 This provides a list of domains that depends only on the sending host&#x2019;s IP
11079 address. If this domain list is referenced a number of times (for example,
11080 in several ACL lines, or in several routers) the result of the check is not
11081 cached by default, because Exim does not know that it is going to be the
11082 same list each time.
11083 </para>
11084 <para>
11085 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
11086 cache the result anyway. For example:
11087 </para>
11088 <literallayout class="monospaced">
11089 domainlist_cache special_domains = ${lookup{...
11090 </literallayout>
11091 <para>
11092 If you do this, you should be absolutely sure that caching is going to do
11093 the right thing in all cases. When in doubt, leave it out.
11094 </para>
11095 </section>
11096 <section id="SECTdomainlist">
11097 <title>Domain lists</title>
11098 <para>
11099 <indexterm role="concept">
11100 <primary>domain list</primary>
11101 <secondary>patterns for</secondary>
11102 </indexterm>
11103 <indexterm role="concept">
11104 <primary>list</primary>
11105 <secondary>domain list</secondary>
11106 </indexterm>
11107 Domain lists contain patterns that are to be matched against a mail domain.
11108 The following types of item may appear in domain lists:
11109 </para>
11110 <itemizedlist>
11111 <listitem>
11112 <para>
11113 <indexterm role="concept">
11114 <primary>primary host name</primary>
11115 </indexterm>
11116 <indexterm role="concept">
11117 <primary>host name</primary>
11118 <secondary>matched in domain list</secondary>
11119 </indexterm>
11120 <indexterm role="concept">
11121 <primary><option>primary_hostname</option></primary>
11122 </indexterm>
11123 <indexterm role="concept">
11124 <primary>domain list</primary>
11125 <secondary>matching primary host name</secondary>
11126 </indexterm>
11127 <indexterm role="concept">
11128 <primary>@ in a domain list</primary>
11129 </indexterm>
11130 If a pattern consists of a single @ character, it matches the local host name,
11131 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
11132 possible to use the same configuration file on several different hosts that
11133 differ only in their names.
11134 </para>
11135 </listitem>
11136 <listitem>
11137 <para>
11138 <indexterm role="concept">
11139 <primary>@[] in a domain list</primary>
11140 </indexterm>
11141 <indexterm role="concept">
11142 <primary>domain list</primary>
11143 <secondary>matching local IP interfaces</secondary>
11144 </indexterm>
11145 <indexterm role="concept">
11146 <primary>domain literal</primary>
11147 </indexterm>
11148 If a pattern consists of the string <literal>@[]</literal> it matches any local IP interface
11149 address, enclosed in square brackets, as in an email address that contains a
11150 domain literal.
11151 In today&#x2019;s Internet, the use of domain literals is controversial.
11152 </para>
11153 </listitem>
11154 <listitem>
11155 <para>
11156 <indexterm role="concept">
11157 <primary>@mx_any</primary>
11158 </indexterm>
11159 <indexterm role="concept">
11160 <primary>@mx_primary</primary>
11161 </indexterm>
11162 <indexterm role="concept">
11163 <primary>@mx_secondary</primary>
11164 </indexterm>
11165 <indexterm role="concept">
11166 <primary>domain list</primary>
11167 <secondary>matching MX pointers to local host</secondary>
11168 </indexterm>
11169 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
11170 has an MX record pointing to the local host or to any host that is listed in
11171 <indexterm role="concept">
11172 <primary><option>hosts_treat_as_local</option></primary>
11173 </indexterm>
11174 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
11175 are similar, except that the first matches only when a primary MX target is the
11176 local host, and the second only when no primary MX target is the local host,
11177 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
11178 preference value &ndash; there may of course be more than one of them.
11179 </para>
11180 <para>
11181 The MX lookup that takes place when matching a pattern of this type is
11182 performed with the resolver options for widening names turned off. Thus, for
11183 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
11184 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
11185 options of the <command>dnslookup</command> router for a discussion of domain widening.
11186 </para>
11187 <para>
11188 Sometimes you may want to ignore certain IP addresses when using one of these
11189 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
11190 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
11191 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
11192 on a router). For example:
11193 </para>
11194 <literallayout class="monospaced">
11195 domains = @mx_any/ignore=127.0.0.1
11196 </literallayout>
11197 <para>
11198 This example matches any domain that has an MX record pointing to one of
11199 the local host&#x2019;s IP addresses other than 127.0.0.1.
11200 </para>
11201 <para>
11202 The list of IP addresses is in fact processed by the same code that processes
11203 host lists, so it may contain CIDR-coded network specifications and it may also
11204 contain negative items.
11205 </para>
11206 <para>
11207 Because the list of IP addresses is a sublist within a domain list, you have to
11208 be careful about delimiters if there is more than one address. Like any other
11209 list, the default delimiter can be changed. Thus, you might have:
11210 </para>
11211 <literallayout class="monospaced">
11212 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
11213           an.other.domain : ...
11214 </literallayout>
11215 <para>
11216 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
11217 involved, it is easiest to change the delimiter for the main list as well:
11218 </para>
11219 <literallayout class="monospaced">
11220 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
11221           an.other.domain ? ...
11222 </literallayout>
11223 </listitem>
11224 <listitem>
11225 <para>
11226 <indexterm role="concept">
11227 <primary>asterisk</primary>
11228 <secondary>in domain list</secondary>
11229 </indexterm>
11230 <indexterm role="concept">
11231 <primary>domain list</primary>
11232 <secondary>asterisk in</secondary>
11233 </indexterm>
11234 <indexterm role="concept">
11235 <primary>domain list</primary>
11236 <secondary>matching <quote>ends with</quote></secondary>
11237 </indexterm>
11238 If a pattern starts with an asterisk, the remaining characters of the pattern
11239 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
11240 domain lists differs from its use in partial matching lookups. In a domain
11241 list, the character following the asterisk need not be a dot, whereas partial
11242 matching works only in terms of dot-separated components. For example, a domain
11243 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
11244 <emphasis>cipher.key.ex</emphasis>.
11245 </para>
11246 </listitem>
11247 <listitem>
11248 <para>
11249 <indexterm role="concept">
11250 <primary>regular expressions</primary>
11251 <secondary>in domain list</secondary>
11252 </indexterm>
11253 <indexterm role="concept">
11254 <primary>domain list</primary>
11255 <secondary>matching regular expression</secondary>
11256 </indexterm>
11257 If a pattern starts with a circumflex character, it is treated as a regular
11258 expression, and matched against the domain using a regular expression matching
11259 function. The circumflex is treated as part of the regular expression.
11260 References to descriptions of the syntax of regular expressions are given in
11261 chapter <xref linkend="CHAPregexp"/>.
11262 </para>
11263 <para>
11264 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
11265 must escape any backslash and dollar characters in the regular expression, or
11266 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
11267 it is not to be expanded (unless you really do want to build a regular
11268 expression by expansion, of course).
11269 </para>
11270 </listitem>
11271 <listitem>
11272 <para>
11273 <indexterm role="concept">
11274 <primary>lookup</primary>
11275 <secondary>in domain list</secondary>
11276 </indexterm>
11277 <indexterm role="concept">
11278 <primary>domain list</primary>
11279 <secondary>matching by lookup</secondary>
11280 </indexterm>
11281 If a pattern starts with the name of a single-key lookup type followed by a
11282 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
11283 must be a file name in a suitable format for the lookup type. For example, for
11284 <quote>cdb;</quote> it must be an absolute path:
11285 </para>
11286 <literallayout class="monospaced">
11287 domains = cdb;/etc/mail/local_domains.cdb
11288 </literallayout>
11289 <para>
11290 The appropriate type of lookup is done on the file using the domain name as the
11291 key. In most cases, the data that is looked up is not used; Exim is interested
11292 only in whether or not the key is present in the file. However, when a lookup
11293 is used for the <option>domains</option> option on a router
11294 or a <option>domains</option> condition in an ACL statement, the data is preserved in the
11295 <varname>$domain_data</varname> variable and can be referred to in other router options or
11296 other statements in the same ACL.
11297 </para>
11298 </listitem>
11299 <listitem>
11300 <para>
11301 Any of the single-key lookup type names may be preceded by
11302 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
11303 </para>
11304 <literallayout class="monospaced">
11305 domains = partial-dbm;/partial/domains
11306 </literallayout>
11307 <para>
11308 This causes partial matching logic to be invoked; a description of how this
11309 works is given in section <xref linkend="SECTpartiallookup"/>.
11310 </para>
11311 </listitem>
11312 <listitem>
11313 <para>
11314 <indexterm role="concept">
11315 <primary>asterisk</primary>
11316 <secondary>in lookup type</secondary>
11317 </indexterm>
11318 Any of the single-key lookup types may be followed by an asterisk. This causes
11319 a default lookup for a key consisting of a single asterisk to be done if the
11320 original lookup fails. This is not a useful feature when using a domain list to
11321 select particular domains (because any domain would match), but it might have
11322 value if the result of the lookup is being used via the <varname>$domain_data</varname>
11323 expansion variable.
11324 </para>
11325 </listitem>
11326 <listitem>
11327 <para>
11328 If the pattern starts with the name of a query-style lookup type followed by a
11329 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
11330 pattern must be an appropriate query for the lookup type, as described in
11331 chapter <xref linkend="CHAPfdlookup"/>. For example:
11332 </para>
11333 <literallayout class="monospaced">
11334 hold_domains = mysql;select domain from holdlist \
11335   where domain = '$domain';
11336 </literallayout>
11337 <para>
11338 In most cases, the data that is looked up is not used (so for an SQL query, for
11339 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
11340 whether or not the query succeeds. However, when a lookup is used for the
11341 <option>domains</option> option on a router, the data is preserved in the <varname>$domain_data</varname>
11342 variable and can be referred to in other options.
11343 </para>
11344 </listitem>
11345 <listitem>
11346 <para>
11347 <indexterm role="concept">
11348 <primary>domain list</primary>
11349 <secondary>matching literal domain name</secondary>
11350 </indexterm>
11351 If none of the above cases apply, a caseless textual comparison is made
11352 between the pattern and the domain.
11353 </para>
11354 </listitem>
11355 </itemizedlist>
11356 <para>
11357 Here is an example that uses several different kinds of pattern:
11358 </para>
11359 <literallayout class="monospaced">
11360 domainlist funny_domains = \
11361   @ : \
11362   lib.unseen.edu : \
11363   *.foundation.fict.example : \
11364   \N^[1-2]\d{3}\.fict\.example$\N : \
11365   partial-dbm;/opt/data/penguin/book : \
11366   nis;domains.byname : \
11367   nisplus;[name=$domain,status=local],domains.org_dir
11368 </literallayout>
11369 <para>
11370 There are obvious processing trade-offs among the various matching modes. Using
11371 an asterisk is faster than a regular expression, and listing a few names
11372 explicitly probably is too. The use of a file or database lookup is expensive,
11373 but may be the only option if hundreds of names are required. Because the
11374 patterns are tested in order, it makes sense to put the most commonly matched
11375 patterns earlier.
11376 </para>
11377 </section>
11378 <section id="SECThostlist">
11379 <title>Host lists</title>
11380 <para>
11381 <indexterm role="concept">
11382 <primary>host list</primary>
11383 <secondary>patterns in</secondary>
11384 </indexterm>
11385 <indexterm role="concept">
11386 <primary>list</primary>
11387 <secondary>host list</secondary>
11388 </indexterm>
11389 Host lists are used to control what remote hosts are allowed to do. For
11390 example, some hosts may be allowed to use the local host as a relay, and some
11391 may be permitted to use the SMTP ETRN command. Hosts can be identified in
11392 two different ways, by name or by IP address. In a host list, some types of
11393 pattern are matched to a host name, and some are matched to an IP address.
11394 You need to be particularly careful with this when single-key lookups are
11395 involved, to ensure that the right value is being used as the key.
11396 </para>
11397 </section>
11398 <section>
11399 <title>Special host list patterns</title>
11400 <para>
11401 <indexterm role="concept">
11402 <primary>empty item in hosts list</primary>
11403 </indexterm>
11404 <indexterm role="concept">
11405 <primary>host list</primary>
11406 <secondary>empty string in</secondary>
11407 </indexterm>
11408 If a host list item is the empty string, it matches only when no remote host is
11409 involved. This is the case when a message is being received from a local
11410 process using SMTP on the standard input, that is, when a TCP/IP connection is
11411 not used.
11412 </para>
11413 <para>
11414 <indexterm role="concept">
11415 <primary>asterisk</primary>
11416 <secondary>in host list</secondary>
11417 </indexterm>
11418 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
11419 the IP address nor the name is actually inspected.
11420 </para>
11421 </section>
11422 <section id="SECThoslispatip">
11423 <title>Host list patterns that match by IP address</title>
11424 <para>
11425 <indexterm role="concept">
11426 <primary>host list</primary>
11427 <secondary>matching IP addresses</secondary>
11428 </indexterm>
11429 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
11430 the incoming address actually appears in the IPv6 host as
11431 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
11432 list, it is converted into a traditional IPv4 address first. (Not all operating
11433 systems accept IPv4 calls on IPv6 sockets, as there have been some security
11434 concerns.)
11435 </para>
11436 <para>
11437 The following types of pattern in a host list check the remote host by
11438 inspecting its IP address:
11439 </para>
11440 <itemizedlist>
11441 <listitem>
11442 <para>
11443 If the pattern is a plain domain name (not a regular expression, not starting
11444 with *, not a lookup of any kind), Exim calls the operating system function
11445 to find the associated IP address(es). Exim uses the newer
11446 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
11447 This typically causes a forward DNS lookup of the name. The result is compared
11448 with the IP address of the subject host.
11449 </para>
11450 <para>
11451 If there is a temporary problem (such as a DNS timeout) with the host name
11452 lookup, a temporary error occurs. For example, if the list is being used in an
11453 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
11454 temporary SMTP error code. If no IP address can be found for the host name,
11455 what happens is described in section <xref linkend="SECTbehipnot"/> below.
11456 </para>
11457 </listitem>
11458 <listitem>
11459 <para>
11460 <indexterm role="concept">
11461 <primary>@ in a host list</primary>
11462 </indexterm>
11463 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
11464 domain name, as just described.
11465 </para>
11466 </listitem>
11467 <listitem>
11468 <para>
11469 If the pattern is an IP address, it is matched against the IP address of the
11470 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
11471 IPv6 addresses can be given in colon-separated format, but the colons have to
11472 be doubled so as not to be taken as item separators when the default list
11473 separator is used. IPv6 addresses are recognized even when Exim is compiled
11474 without IPv6 support. This means that if they appear in a host list on an
11475 IPv4-only host, Exim will not treat them as host names. They are just addresses
11476 that can never match a client host.
11477 </para>
11478 </listitem>
11479 <listitem>
11480 <para>
11481 <indexterm role="concept">
11482 <primary>@[] in a host list</primary>
11483 </indexterm>
11484 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
11485 the local host. For example, if the local host is an IPv4 host with one
11486 interface address 10.45.23.56, these two ACL statements have the same effect:
11487 </para>
11488 <literallayout class="monospaced">
11489 accept hosts = 127.0.0.1 : 10.45.23.56
11490 accept hosts = @[]
11491 </literallayout>
11492 </listitem>
11493 <listitem>
11494 <para>
11495 <indexterm role="concept">
11496 <primary>CIDR notation</primary>
11497 </indexterm>
11498 If the pattern is an IP address followed by a slash and a mask length (for
11499 example 10.11.42.0/24), it is matched against the IP address of the subject
11500 host under the given mask. This allows, an entire network of hosts to be
11501 included (or excluded) by a single item. The mask uses CIDR notation; it
11502 specifies the number of address bits that must match, starting from the most
11503 significant end of the address.
11504 </para>
11505 <para>
11506 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
11507 of a range of addresses. It is the number of bits in the network portion of the
11508 address. The above example specifies a 24-bit netmask, so it matches all 256
11509 addresses in the 10.11.42.0 network. An item such as
11510 </para>
11511 <literallayout class="monospaced">
11512 192.168.23.236/31
11513 </literallayout>
11514 <para>
11515 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
11516 32 for an IPv4 address is the same as no mask at all; just a single address
11517 matches.
11518 </para>
11519 <para>
11520 Here is another example which shows an IPv4 and an IPv6 network:
11521 </para>
11522 <literallayout class="monospaced">
11523 recipient_unqualified_hosts = 192.168.0.0/16: \
11524                               3ffe::ffff::836f::::/48
11525 </literallayout>
11526 <para>
11527 The doubling of list separator characters applies only when these items
11528 appear inline in a host list. It is not required when indirecting via a file.
11529 For example:
11530 </para>
11531 <literallayout class="monospaced">
11532 recipient_unqualified_hosts = /opt/exim/unqualnets
11533 </literallayout>
11534 <para>
11535 could make use of a file containing
11536 </para>
11537 <literallayout class="monospaced">
11538 172.16.0.0/12
11539 3ffe:ffff:836f::/48
11540 </literallayout>
11541 <para>
11542 to have exactly the same effect as the previous example. When listing IPv6
11543 addresses inline, it is usually more convenient to use the facility for
11544 changing separator characters. This list contains the same two networks:
11545 </para>
11546 <literallayout class="monospaced">
11547 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
11548                                  3ffe:ffff:836f::/48
11549 </literallayout>
11550 <para>
11551 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
11552 list.
11553 </para>
11554 </listitem>
11555 </itemizedlist>
11556 </section>
11557 <section id="SECThoslispatsikey">
11558 <title>Host list patterns for single-key lookups by host address</title>
11559 <para>
11560 <indexterm role="concept">
11561 <primary>host list</primary>
11562 <secondary>lookup of IP address</secondary>
11563 </indexterm>
11564 When a host is to be identified by a single-key lookup of its complete IP
11565 address, the pattern takes this form:
11566 </para>
11567 <literallayout>
11568 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
11569 </literallayout>
11570 <para>
11571 For example:
11572 </para>
11573 <literallayout class="monospaced">
11574 hosts_lookup = net-cdb;/hosts-by-ip.db
11575 </literallayout>
11576 <para>
11577 The text form of the IP address of the subject host is used as the lookup key.
11578 IPv6 addresses are converted to an unabbreviated form, using lower case
11579 letters, with dots as separators because colon is the key terminator in
11580 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
11581 quoting the keys, but this is a facility that was added later.] The data
11582 returned by the lookup is not used.
11583 </para>
11584 <para>
11585 <indexterm role="concept">
11586 <primary>IP address</primary>
11587 <secondary>masking</secondary>
11588 </indexterm>
11589 <indexterm role="concept">
11590 <primary>host list</primary>
11591 <secondary>masked IP address</secondary>
11592 </indexterm>
11593 Single-key lookups can also be performed using masked IP addresses, using
11594 patterns of this form:
11595 </para>
11596 <literallayout>
11597 <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>
11598 </literallayout>
11599 <para>
11600 For example:
11601 </para>
11602 <literallayout class="monospaced">
11603 net24-dbm;/networks.db
11604 </literallayout>
11605 <para>
11606 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
11607 length. A textual string is constructed from the masked value, followed by the
11608 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
11609 is 192.168.34.6, the key that is looked up for the above example is
11610 <quote>192.168.34.0/24</quote>. IPv6 addresses are converted to a text value using lower
11611 case letters and dots as separators instead of the more usual colon, because
11612 colon is the key terminator in <command>lsearch</command> files. Full, unabbreviated IPv6
11613 addresses are always used.
11614 </para>
11615 <para>
11616 <emphasis role="bold">Warning</emphasis>: Specifing <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
11617 IPv6 address) is not the same as specifing just <option>net-</option> without a number. In
11618 the former case the key strings include the mask value, whereas in the latter
11619 case the IP address is used on its own.
11620 </para>
11621 </section>
11622 <section id="SECThoslispatnam">
11623 <title>Host list patterns that match by host name</title>
11624 <para>
11625 <indexterm role="concept">
11626 <primary>host</primary>
11627 <secondary>lookup failures</secondary>
11628 </indexterm>
11629 <indexterm role="concept">
11630 <primary>unknown host name</primary>
11631 </indexterm>
11632 <indexterm role="concept">
11633 <primary>host list</primary>
11634 <secondary>matching host name</secondary>
11635 </indexterm>
11636 There are several types of pattern that require Exim to know the name of the
11637 remote host. These are either wildcard patterns or lookups by name. (If a
11638 complete hostname is given without any wildcarding, it is used to find an IP
11639 address to match against, as described in the section <xref linkend="SECThoslispatip"/>
11640 above.)
11641 </para>
11642 <para>
11643 If the remote host name is not already known when Exim encounters one of these
11644 patterns, it has to be found from the IP address.
11645 Although many sites on the Internet are conscientious about maintaining reverse
11646 DNS data for their hosts, there are also many that do not do this.
11647 Consequently, a name cannot always be found, and this may lead to unwanted
11648 effects. Take care when configuring host lists with wildcarded name patterns.
11649 Consider what will happen if a name cannot be found.
11650 </para>
11651 <para>
11652 Because of the problems of determining host names from IP addresses, matching
11653 against host names is not as common as matching against IP addresses.
11654 </para>
11655 <para>
11656 By default, in order to find a host name, Exim first does a reverse DNS lookup;
11657 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
11658 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
11659 are done can be changed by setting the <option>host_lookup_order</option> option.
11660 </para>
11661 <para>
11662 There are some options that control what happens if a host name cannot be
11663 found. These are described in section <xref linkend="SECTbehipnot"/> below.
11664 </para>
11665 <para>
11666 <indexterm role="concept">
11667 <primary>host</primary>
11668 <secondary>alias for</secondary>
11669 </indexterm>
11670 <indexterm role="concept">
11671 <primary>alias for host</primary>
11672 </indexterm>
11673 As a result of aliasing, hosts may have more than one name. When processing any
11674 of the following types of pattern, all the host&#x2019;s names are checked:
11675 </para>
11676 <itemizedlist>
11677 <listitem>
11678 <para>
11679 <indexterm role="concept">
11680 <primary>asterisk</primary>
11681 <secondary>in host list</secondary>
11682 </indexterm>
11683 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
11684 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
11685 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
11686 requirement. Other kinds of wildcarding require the use of a regular
11687 expression.
11688 </para>
11689 </listitem>
11690 <listitem>
11691 <para>
11692 <indexterm role="concept">
11693 <primary>regular expressions</primary>
11694 <secondary>in host list</secondary>
11695 </indexterm>
11696 <indexterm role="concept">
11697 <primary>host list</primary>
11698 <secondary>regular expression in</secondary>
11699 </indexterm>
11700 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
11701 matched against the host name. For example,
11702 </para>
11703 <literallayout class="monospaced">
11704 ^(a|b)\.c\.d$
11705 </literallayout>
11706 <para>
11707 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
11708 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
11709 that backslash and dollar characters are not misinterpreted as part of the
11710 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
11711 part of the string as non-expandable. For example:
11712 </para>
11713 <literallayout class="monospaced">
11714 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
11715 </literallayout>
11716 <para>
11717 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
11718 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
11719 example. Without it, a match at the start of the host name is all that is
11720 required.
11721 </para>
11722 </listitem>
11723 </itemizedlist>
11724 </section>
11725 <section id="SECTbehipnot">
11726 <title>Behaviour when an IP address or name cannot be found</title>
11727 <para>
11728 <indexterm role="concept">
11729 <primary>host</primary>
11730 <secondary>lookup failures</secondary>
11731 </indexterm>
11732 While processing a host list, Exim may need to look up an IP address from a
11733 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
11734 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
11735 behaviour when it fails to find the information it is seeking is the same.
11736 </para>
11737 <para>
11738 <indexterm role="concept">
11739 <primary><literal>+include_unknown</literal></primary>
11740 </indexterm>
11741 <indexterm role="concept">
11742 <primary><literal>+ignore_unknown</literal></primary>
11743 </indexterm>
11744 By default, Exim behaves as if the host does not match the list. This may not
11745 always be what you want to happen. To change Exim&#x2019;s behaviour, the special
11746 items <literal>+include_unknown</literal> or <literal>+ignore_unknown</literal> may appear in the list (at
11747 top level &ndash; they are not recognized in an indirected file).
11748 </para>
11749 <itemizedlist>
11750 <listitem>
11751 <para>
11752 If any item that follows <literal>+include_unknown</literal> requires information that
11753 cannot found, Exim behaves as if the host does match the list. For example,
11754 </para>
11755 <literallayout class="monospaced">
11756 host_reject_connection = +include_unknown:*.enemy.ex
11757 </literallayout>
11758 <para>
11759 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
11760 any hosts whose name it cannot find.
11761 </para>
11762 </listitem>
11763 <listitem>
11764 <para>
11765 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
11766 be found, Exim ignores that item and proceeds to the rest of the list. For
11767 example:
11768 </para>
11769 <literallayout class="monospaced">
11770 accept hosts = +ignore_unknown : friend.example : \
11771                192.168.4.5
11772 </literallayout>
11773 <para>
11774 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
11775 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
11776 name can be found for 192.168.4.5, it is rejected.
11777 </para>
11778 </listitem>
11779 </itemizedlist>
11780 <para>
11781 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
11782 list. The effect of each one lasts until the next, or until the end of the
11783 list.
11784 </para>
11785 <para>
11786 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
11787 apply to temporary DNS errors. They always cause a defer action (except when
11788 <option>dns_again_means_nonexist</option> converts them into permanent errors).
11789 </para>
11790 </section>
11791 <section id="SECThoslispatnamsk">
11792 <title>Host list patterns for single-key lookups by host name</title>
11793 <para>
11794 <indexterm role="concept">
11795 <primary>host</primary>
11796 <secondary>lookup failures</secondary>
11797 </indexterm>
11798 <indexterm role="concept">
11799 <primary>unknown host name</primary>
11800 </indexterm>
11801 <indexterm role="concept">
11802 <primary>host list</primary>
11803 <secondary>matching host name</secondary>
11804 </indexterm>
11805 If a pattern is of the form
11806 </para>
11807 <literallayout>
11808 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
11809 </literallayout>
11810 <para>
11811 for example
11812 </para>
11813 <literallayout class="monospaced">
11814 dbm;/host/accept/list
11815 </literallayout>
11816 <para>
11817 a single-key lookup is performend, using the host name as its key. If the
11818 lookup succeeds, the host matches the item. The actual data that is looked up
11819 is not used.
11820 </para>
11821 <para>
11822 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
11823 keys in the file, not IP addresses. If you want to do lookups based on IP
11824 addresses, you must precede the search type with <quote>net-</quote> (see section
11825 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
11826 two items in the same list, one doing an address lookup and one doing a name
11827 lookup, both using the same file.
11828 </para>
11829 </section>
11830 <section>
11831 <title>Host list patterns for query-style lookups</title>
11832 <para>
11833 If a pattern is of the form
11834 </para>
11835 <literallayout>
11836 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
11837 </literallayout>
11838 <para>
11839 the query is obeyed, and if it succeeds, the host matches the item. The actual
11840 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
11841 <varname>$sender_host_name</varname> can be used in the query. For example:
11842 </para>
11843 <literallayout class="monospaced">
11844 hosts_lookup = pgsql;\
11845   select ip from hostlist where ip='$sender_host_address'
11846 </literallayout>
11847 <para>
11848 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
11849 can use the <option>sg</option> expansion item to change this if you need to. If you want to
11850 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
11851 operator.
11852 </para>
11853 <para>
11854 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
11855 looks up the host name if has not already done so. (See section
11856 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
11857 </para>
11858 <para>
11859 Historical note: prior to release 4.30, Exim would always attempt to find a
11860 host name before running the query, unless the search type was preceded by
11861 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
11862 still recognized for query-style lookups, but its presence or absence has no
11863 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
11864 See section <xref linkend="SECThoslispatsikey"/>.)
11865 </para>
11866 </section>
11867 <section id="SECTmixwilhos">
11868 <title>Mixing wildcarded host names and addresses in host lists</title>
11869 <para>
11870 <indexterm role="concept">
11871 <primary>host list</primary>
11872 <secondary>mixing names and addresses in</secondary>
11873 </indexterm>
11874 If you have name lookups or wildcarded host names and IP addresses in the same
11875 host list, you should normally put the IP addresses first. For example, in an
11876 ACL you could have:
11877 </para>
11878 <literallayout class="monospaced">
11879 accept hosts = 10.9.8.7 : *.friend.example
11880 </literallayout>
11881 <para>
11882 The reason for this lies in the left-to-right way that Exim processes lists.
11883 It can test IP addresses without doing any DNS lookups, but when it reaches an
11884 item that requires a host name, it fails if it cannot find a host name to
11885 compare with the pattern. If the above list is given in the opposite order, the
11886 <option>accept</option> statement fails for a host whose name cannot be found, even if its
11887 IP address is 10.9.8.7.
11888 </para>
11889 <para>
11890 If you really do want to do the name check first, and still recognize the IP
11891 address, you can rewrite the ACL like this:
11892 </para>
11893 <literallayout class="monospaced">
11894 accept hosts = *.friend.example
11895 accept hosts = 10.9.8.7
11896 </literallayout>
11897 <para>
11898 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
11899 <xref linkend="CHAPACL"/> for details of ACLs.
11900 </para>
11901 </section>
11902 <section id="SECTaddresslist">
11903 <title>Address lists</title>
11904 <para>
11905 <indexterm role="concept">
11906 <primary>list</primary>
11907 <secondary>address list</secondary>
11908 </indexterm>
11909 <indexterm role="concept">
11910 <primary>address list</primary>
11911 <secondary>empty item</secondary>
11912 </indexterm>
11913 <indexterm role="concept">
11914 <primary>address list</primary>
11915 <secondary>patterns</secondary>
11916 </indexterm>
11917 Address lists contain patterns that are matched against mail addresses. There
11918 is one special case to be considered: the sender address of a bounce message is
11919 always empty. You can test for this by providing an empty item in an address
11920 list. For example, you can set up a router to process bounce messages by
11921 using this option setting:
11922 </para>
11923 <literallayout class="monospaced">
11924 senders = :
11925 </literallayout>
11926 <para>
11927 The presence of the colon creates an empty item. If you do not provide any
11928 data, the list is empty and matches nothing. The empty sender can also be
11929 detected by a regular expression that matches an empty string,
11930 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
11931 </para>
11932 <para>
11933 Non-empty items in an address list can be straightforward email addresses. For
11934 example:
11935 </para>
11936 <literallayout class="monospaced">
11937 senders = jbc@askone.example : hs@anacreon.example
11938 </literallayout>
11939 <para>
11940 A certain amount of wildcarding is permitted. If a pattern contains an @
11941 character, but is not a regular expression and does not begin with a
11942 semicolon-terminated lookup type (described below), the local part of the
11943 subject address is compared with the local part of the pattern, which may start
11944 with an asterisk. If the local parts match, the domain is checked in exactly
11945 the same way as for a pattern in a domain list. For example, the domain can be
11946 wildcarded, refer to a named list, or be a lookup:
11947 </para>
11948 <literallayout class="monospaced">
11949 deny senders = *@*.spamming.site:\
11950                *@+hostile_domains:\
11951                bozo@partial-lsearch;/list/of/dodgy/sites:\
11952                *@dbm;/bad/domains.db
11953 </literallayout>
11954 <para>
11955 <indexterm role="concept">
11956 <primary>local part</primary>
11957 <secondary>starting with !</secondary>
11958 </indexterm>
11959 <indexterm role="concept">
11960 <primary>address list</primary>
11961 <secondary>local part starting with !</secondary>
11962 </indexterm>
11963 If a local part that begins with an exclamation mark is required, it has to be
11964 specified using a regular expression, because otherwise the exclamation mark is
11965 treated as a sign of negation, as is standard in lists.
11966 </para>
11967 <para>
11968 If a non-empty pattern that is not a regular expression or a lookup does not
11969 contain an @ character, it is matched against the domain part of the subject
11970 address. The only two formats that are recognized this way are a literal
11971 domain, or a domain pattern that starts with *. In both these cases, the effect
11972 is the same as if <literal>*@</literal> preceded the pattern. For example:
11973 </para>
11974 <literallayout class="monospaced">
11975 deny senders = enemy.domain : *.enemy.domain
11976 </literallayout>
11977 <para>
11978 The following kinds of more complicated address list pattern can match any
11979 address, including the empty address that is characteristic of bounce message
11980 senders:
11981 </para>
11982 <itemizedlist>
11983 <listitem>
11984 <para>
11985 <indexterm role="concept">
11986 <primary>regular expressions</primary>
11987 <secondary>in address list</secondary>
11988 </indexterm>
11989 <indexterm role="concept">
11990 <primary>address list</primary>
11991 <secondary>regular expression in</secondary>
11992 </indexterm>
11993 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
11994 done against the complete address, with the pattern as the regular expression.
11995 You must take care that backslash and dollar characters are not misinterpreted
11996 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
11997 to mark that part of the string as non-expandable. For example:
11998 </para>
11999 <literallayout class="monospaced">
12000 deny senders = \N^.*this.*@example\.com$\N : \
12001                \N^\d{8}.+@spamhaus.example$\N : ...
12002 </literallayout>
12003 <para>
12004 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
12005 start with <quote>^</quote> by the time they are being interpreted as address patterns.
12006 </para>
12007 </listitem>
12008 <listitem>
12009 <para>
12010 <indexterm role="concept">
12011 <primary>address list</primary>
12012 <secondary>lookup for complete address</secondary>
12013 </indexterm>
12014 Complete addresses can be looked up by using a pattern that starts with a
12015 lookup type terminated by a semicolon, followed by the data for the lookup. For
12016 example:
12017 </para>
12018 <literallayout class="monospaced">
12019 deny senders = cdb;/etc/blocked.senders : \
12020   mysql;select address from blocked where \
12021   address='${quote_mysql:$sender_address}'
12022 </literallayout>
12023 <para>
12024 Both query-style and single-key lookup types can be used. For a single-key
12025 lookup type, Exim uses the complete address as the key. However, empty keys are
12026 not supported for single-key lookups, so a match against the empty address
12027 always fails. This restriction does not apply to query-style lookups.
12028 </para>
12029 <para>
12030 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
12031 cannot be used, and is ignored if specified, with an entry being written to the
12032 panic log.
12033 <indexterm role="concept">
12034 <primary>*@ with single-key lookup</primary>
12035 </indexterm>
12036 However, you can configure lookup defaults, as described in section
12037 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
12038 default. For example, with this lookup:
12039 </para>
12040 <literallayout class="monospaced">
12041 accept senders = lsearch*@;/some/file
12042 </literallayout>
12043 <para>
12044 the file could contains lines like this:
12045 </para>
12046 <literallayout class="monospaced">
12047 user1@domain1.example
12048 *@domain2.example
12049 </literallayout>
12050 <para>
12051 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
12052 that are tried is:
12053 </para>
12054 <literallayout class="monospaced">
12055 nimrod@jaeger.example
12056 *@jaeger.example
12057 *
12058 </literallayout>
12059 <para>
12060 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
12061 would mean that every address matches, thus rendering the test useless.
12062 </para>
12063 <para>
12064 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
12065 </para>
12066 <literallayout class="monospaced">
12067 deny recipients = dbm*@;/some/file
12068 deny recipients = *@dbm;/some/file
12069 </literallayout>
12070 <para>
12071 The first does a whole address lookup, with defaulting, as just described,
12072 because it starts with a lookup type. The second matches the local part and
12073 domain independently, as described in a bullet point below.
12074 </para>
12075 </listitem>
12076 </itemizedlist>
12077 <para>
12078 The following kinds of address list pattern can match only non-empty addresses.
12079 If the subject address is empty, a match against any of these pattern types
12080 always fails.
12081 </para>
12082 <itemizedlist>
12083 <listitem>
12084 <para>
12085 <indexterm role="concept">
12086 <primary>@@ with single-key lookup</primary>
12087 </indexterm>
12088 <indexterm role="concept">
12089 <primary>address list</primary>
12090 <secondary>@@ lookup type</secondary>
12091 </indexterm>
12092 <indexterm role="concept">
12093 <primary>address list</primary>
12094 <secondary>split local part and domain</secondary>
12095 </indexterm>
12096 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
12097 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
12098 split into a local part and a domain. The domain is looked up in the file. If
12099 it is not found, there is no match. If it is found, the data that is looked up
12100 from the file is treated as a colon-separated list of local part patterns, each
12101 of which is matched against the subject local part in turn.
12102 </para>
12103 <para>
12104 <indexterm role="concept">
12105 <primary>asterisk</primary>
12106 <secondary>in address list</secondary>
12107 </indexterm>
12108 The lookup may be a partial one, and/or one involving a search for a default
12109 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
12110 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
12111 even be further lookups. They may also be independently negated. For example,
12112 with
12113 </para>
12114 <literallayout class="monospaced">
12115 deny senders = @@dbm;/etc/reject-by-domain
12116 </literallayout>
12117 <para>
12118 the data from which the DBM file is built could contain lines like
12119 </para>
12120 <literallayout class="monospaced">
12121 baddomain.com:  !postmaster : *
12122 </literallayout>
12123 <para>
12124 to reject all senders except <option>postmaster</option> from that domain.
12125 </para>
12126 <para>
12127 <indexterm role="concept">
12128 <primary>local part</primary>
12129 <secondary>starting with !</secondary>
12130 </indexterm>
12131 If a local part that actually begins with an exclamation mark is required, it
12132 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
12133 may be split over several lines by indenting the second and subsequent lines,
12134 but the separating colon must still be included at line breaks. White space
12135 surrounding the colons is ignored. For example:
12136 </para>
12137 <literallayout class="monospaced">
12138 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
12139 spammer3 : spammer4
12140 </literallayout>
12141 <para>
12142 As in all colon-separated lists in Exim, a colon can be included in an item by
12143 doubling.
12144 </para>
12145 <para>
12146 If the last item in the list starts with a right angle-bracket, the remainder
12147 of the item is taken as a new key to look up in order to obtain a continuation
12148 list of local parts. The new key can be any sequence of characters. Thus one
12149 might have entries like
12150 </para>
12151 <literallayout class="monospaced">
12152 aol.com: spammer1 : spammer 2 : &gt;*
12153 xyz.com: spammer3 : &gt;*
12154 *:       ^\d{8}$
12155 </literallayout>
12156 <para>
12157 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
12158 local parts for all domains, in addition to the specific local parts listed for
12159 each domain. Of course, using this feature costs another lookup each time a
12160 chain is followed, but the effort needed to maintain the data is reduced.
12161 </para>
12162 <para>
12163 <indexterm role="concept">
12164 <primary>loop</primary>
12165 <secondary>in lookups</secondary>
12166 </indexterm>
12167 It is possible to construct loops using this facility, and in order to catch
12168 them, the chains may be no more than fifty items long.
12169 </para>
12170 </listitem>
12171 <listitem>
12172 <para>
12173 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
12174 lookup, but in this case, the chaining facility is not available. The lookup
12175 can only return a single list of local parts.
12176 </para>
12177 </listitem>
12178 </itemizedlist>
12179 <para>
12180 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
12181 in these two examples:
12182 </para>
12183 <literallayout class="monospaced">
12184 senders = +my_list
12185 senders = *@+my_list
12186 </literallayout>
12187 <para>
12188 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
12189 example it is a named domain list.
12190 </para>
12191 </section>
12192 <section id="SECTcasletadd">
12193 <title>Case of letters in address lists</title>
12194 <para>
12195 <indexterm role="concept">
12196 <primary>case of local parts</primary>
12197 </indexterm>
12198 <indexterm role="concept">
12199 <primary>address list</primary>
12200 <secondary>case forcing</secondary>
12201 </indexterm>
12202 <indexterm role="concept">
12203 <primary>case forcing in address lists</primary>
12204 </indexterm>
12205 Domains in email addresses are always handled caselessly, but for local parts
12206 case may be significant on some systems (see <option>caseful_local_part</option> for how
12207 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
12208 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
12209 blocking lists should be done in a case-independent manner. Since most address
12210 lists in Exim are used for this kind of control, Exim attempts to do this by
12211 default.
12212 </para>
12213 <para>
12214 The domain portion of an address is always lowercased before matching it to an
12215 address list. The local part is lowercased by default, and any string
12216 comparisons that take place are done caselessly. This means that the data in
12217 the address list itself, in files included as plain file names, and in any file
12218 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
12219 keys in files that are looked up by a search type other than <command>lsearch</command> (which
12220 works caselessly) must be in lower case, because these lookups are not
12221 case-independent.
12222 </para>
12223 <para>
12224 <indexterm role="concept">
12225 <primary><literal>+caseful</literal></primary>
12226 </indexterm>
12227 To allow for the possibility of caseful address list matching, if an item in
12228 an address list is the string <quote>+caseful</quote>, the original case of the local
12229 part is restored for any comparisons that follow, and string comparisons are no
12230 longer case-independent. This does not affect the domain, which remains in
12231 lower case. However, although independent matches on the domain alone are still
12232 performed caselessly, regular expressions that match against an entire address
12233 become case-sensitive after <quote>+caseful</quote> has been seen.
12234 </para>
12235 </section>
12236 <section id="SECTlocparlis">
12237 <title>Local part lists</title>
12238 <para>
12239 <indexterm role="concept">
12240 <primary>list</primary>
12241 <secondary>local part list</secondary>
12242 </indexterm>
12243 <indexterm role="concept">
12244 <primary>local part</primary>
12245 <secondary>list</secondary>
12246 </indexterm>
12247 Case-sensitivity in local part lists is handled in the same way as for address
12248 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
12249 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
12250 set false, the subject is lowercased and the matching is initially
12251 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
12252 matching in the local part list, but not elsewhere in the router. If
12253 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
12254 option is case-sensitive from the start.
12255 </para>
12256 <para>
12257 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
12258 comments are handled in the same way as address lists &ndash; they are recognized
12259 only if the # is preceded by white space or the start of the line.
12260 Otherwise, local part lists are matched in the same way as domain lists, except
12261 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
12262 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
12263 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
12264 types.
12265 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
12266 </para>
12267 </section>
12268 </chapter>
12269
12270 <chapter id="CHAPexpand">
12271 <title>String expansions</title>
12272 <para>
12273 <indexterm role="concept" id="IIDstrexp" class="startofrange">
12274 <primary>expansion</primary>
12275 <secondary>of strings</secondary>
12276 </indexterm>
12277 Many strings in Exim&#x2019;s run time configuration are expanded before use. Some of
12278 them are expanded every time they are used; others are expanded only once.
12279 </para>
12280 <para>
12281 When a string is being expanded it is copied verbatim from left to right except
12282 when a dollar or backslash character is encountered. A dollar specifies the
12283 start of a portion of the string that is interpreted and replaced as described
12284 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
12285 escape character, as described in the following section.
12286 </para>
12287 <section id="SECTlittext">
12288 <title>Literal text in expanded strings</title>
12289 <para>
12290 <indexterm role="concept">
12291 <primary>expansion</primary>
12292 <secondary>including literal text</secondary>
12293 </indexterm>
12294 An uninterpreted dollar can be included in an expanded string by putting a
12295 backslash in front of it. A backslash can be used to prevent any special
12296 character being treated specially in an expansion, including backslash itself.
12297 If the string appears in quotes in the configuration file, two backslashes are
12298 required because the quotes themselves cause interpretation of backslashes when
12299 the string is read in (see section <xref linkend="SECTstrings"/>).
12300 </para>
12301 <para>
12302 <indexterm role="concept">
12303 <primary>expansion</primary>
12304 <secondary>non-expandable substrings</secondary>
12305 </indexterm>
12306 A portion of the string can specified as non-expandable by placing it between
12307 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
12308 expressions, which often contain backslashes and dollar signs. For example:
12309 </para>
12310 <literallayout class="monospaced">
12311 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
12312 </literallayout>
12313 <para>
12314 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
12315 without interpretation until it reaches the next <literal>\N</literal> or the end of the
12316 string.
12317 </para>
12318 </section>
12319 <section>
12320 <title>Character escape sequences in expanded strings</title>
12321 <para>
12322 <indexterm role="concept">
12323 <primary>expansion</primary>
12324 <secondary>escape sequences</secondary>
12325 </indexterm>
12326 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
12327 expanded string is recognized as an escape sequence for the character newline,
12328 carriage return, or tab, respectively. A backslash followed by up to three
12329 octal digits is recognized as an octal encoding for a single character, and a
12330 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
12331 encoding.
12332 </para>
12333 <para>
12334 These escape sequences are also recognized in quoted strings when they are read
12335 in. Their interpretation in expansions as well is useful for unquoted strings,
12336 and for other cases such as looked-up strings that are then expanded.
12337 </para>
12338 </section>
12339 <section>
12340 <title>Testing string expansions</title>
12341 <para>
12342 <indexterm role="concept">
12343 <primary>expansion</primary>
12344 <secondary>testing</secondary>
12345 </indexterm>
12346 <indexterm role="concept">
12347 <primary>testing</primary>
12348 <secondary>string expansion</secondary>
12349 </indexterm>
12350 <indexterm role="concept">
12351 <primary><option>-be</option> option</primary>
12352 </indexterm>
12353 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
12354 takes the command arguments, or lines from the standard input if there are no
12355 arguments, runs them through the string expansion code, and writes the results
12356 to the standard output. Variables based on configuration values are set up, but
12357 since no message is being processed, variables such as <varname>$local_part</varname> have no
12358 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
12359 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
12360 and <option>nhash</option>.
12361 </para>
12362 <para>
12363 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
12364 instead runs under the uid and gid it was called with, to prevent users from
12365 using <option>-be</option> for reading files to which they do not have access.
12366 </para>
12367 </section>
12368 <section id="SECTforexpfai">
12369 <title>Forced expansion failure</title>
12370 <para>
12371 <indexterm role="concept">
12372 <primary>expansion</primary>
12373 <secondary>forced failure</secondary>
12374 </indexterm>
12375 A number of expansions that are described in the following section have
12376 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
12377 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
12378 used depends on some condition that is evaluated as part of the expansion. If,
12379 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
12380 the entire string expansion fails in a way that can be detected by the code
12381 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
12382 its consequences depend on the circumstances. In some cases it is no different
12383 from any other expansion failure, but in others a different action may be
12384 taken. Such variations are mentioned in the documentation of the option that is
12385 being expanded.
12386 </para>
12387 </section>
12388 <section id="SECTexpansionitems">
12389 <title>Expansion items</title>
12390 <para>
12391 The following items are recognized in expanded strings. White space may be used
12392 between sub-items that are keywords or substrings enclosed in braces inside an
12393 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
12394 white space is significant.
12395 </para>
12396 <variablelist>
12397 <varlistentry>
12398 <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>
12399 <listitem>
12400 <para>
12401 <indexterm role="concept">
12402 <primary>expansion</primary>
12403 <secondary>variables</secondary>
12404 </indexterm>
12405 Substitute the contents of the named variable, for example:
12406 </para>
12407 <literallayout class="monospaced">
12408 $local_part
12409 ${domain}
12410 </literallayout>
12411 <para>
12412 The second form can be used to separate the name from subsequent alphanumeric
12413 characters. This form (using braces) is available only for variables; it does
12414 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
12415 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
12416 given, the expansion fails.
12417 </para>
12418 </listitem></varlistentry>
12419 <varlistentry>
12420 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
12421 <listitem>
12422 <para>
12423 <indexterm role="concept">
12424 <primary>expansion</primary>
12425 <secondary>operators</secondary>
12426 </indexterm>
12427 The string is first itself expanded, and then the operation specified by
12428 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
12429 </para>
12430 <literallayout class="monospaced">
12431 ${lc:$local_part}
12432 </literallayout>
12433 <para>
12434 The string starts with the first character after the colon, which may be
12435 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
12436 below. The operator notation is used for simple expansion items that have just
12437 one argument, because it reduces the number of braces and therefore makes the
12438 string easier to understand.
12439 </para>
12440 </listitem></varlistentry>
12441 <varlistentry>
12442 <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>
12443 <listitem>
12444 <para>
12445 <indexterm role="concept">
12446 <primary><option>dlfunc</option></primary>
12447 </indexterm>
12448 This expansion dynamically loads and then calls a locally-written C function.
12449 This functionality is available only if Exim is compiled with
12450 </para>
12451 <literallayout class="monospaced">
12452 EXPAND_DLFUNC=yes
12453 </literallayout>
12454 <para>
12455 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
12456 object so that it doesn&#x2019;t reload the same object file in the same Exim process
12457 (but of course Exim does start new processes frequently).
12458 </para>
12459 <para>
12460 There may be from zero to eight arguments to the function. When compiling
12461 a local function that is to be called in this way, <filename>local_scan.h</filename> should be
12462 included. The Exim variables and functions that are defined by that API
12463 are also available for dynamically loaded functions. The function itself
12464 must have the following type:
12465 </para>
12466 <literallayout class="monospaced">
12467 int dlfunction(uschar **yield, int argc, uschar *argv[])
12468 </literallayout>
12469 <para>
12470 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
12471 function should return one of the following values:
12472 </para>
12473 <para>
12474 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
12475 into the expanded string that is being built.
12476 </para>
12477 <para>
12478 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
12479 from <emphasis>yield</emphasis>, if it is set.
12480 </para>
12481 <para>
12482 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
12483 taken from <emphasis>yield</emphasis> if it is set.
12484 </para>
12485 <para>
12486 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
12487 </para>
12488 <para>
12489 When compiling a function that is to be used in this way with gcc,
12490 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
12491 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
12492 </para>
12493 </listitem></varlistentry>
12494 <varlistentry>
12495 <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>
12496 <listitem>
12497 <para>
12498 <indexterm role="concept">
12499 <primary>expansion</primary>
12500 <secondary>extracting substrings by key</secondary>
12501 </indexterm>
12502 <indexterm role="concept">
12503 <primary><option>extract</option></primary>
12504 <secondary>substrings by key</secondary>
12505 </indexterm>
12506 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
12507 white space is removed from the key (but not from any of the strings). The key
12508 must not consist entirely of digits. The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the
12509 form:
12510 </para>
12511 <literallayout>
12512 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
12513 </literallayout>
12514 <para>
12515 <indexterm role="concept">
12516 <primary><varname>$value</varname></primary>
12517 </indexterm>
12518 where the equals signs and spaces (but not both) are optional. If any of the
12519 values contain white space, they must be enclosed in double quotes, and any
12520 values that are enclosed in double quotes are subject to escape processing as
12521 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
12522 for the value that corresponds to the key. The search is case-insensitive. If
12523 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
12524 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
12525 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
12526 is restored to any previous value it might have had.
12527 </para>
12528 <para>
12529 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
12530 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
12531 extracted is used. Thus, for example, these two expansions are identical, and
12532 yield <quote>2001</quote>:
12533 </para>
12534 <literallayout class="monospaced">
12535 ${extract{gid}{uid=1984 gid=2001}}
12536 ${extract{gid}{uid=1984 gid=2001}{$value}}
12537 </literallayout>
12538 <para>
12539 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
12540 appear, for example:
12541 </para>
12542 <literallayout class="monospaced">
12543 ${extract{Z}{A=... B=...}{$value} fail }
12544 </literallayout>
12545 <para>
12546 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
12547 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
12548 </para>
12549 </listitem></varlistentry>
12550 <varlistentry>
12551 <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>
12552 <listitem>
12553 <para>
12554 <indexterm role="concept">
12555 <primary>expansion</primary>
12556 <secondary>extracting substrings by number</secondary>
12557 </indexterm>
12558 <indexterm role="concept">
12559 <primary><option>extract</option></primary>
12560 <secondary>substrings by number</secondary>
12561 </indexterm>
12562 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
12563 apart from leading and trailing white space, which is ignored.
12564 This is what distinguishes this form of <option>extract</option> from the previous kind. It
12565 behaves in the same way, except that, instead of extracting a named field, it
12566 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
12567 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
12568 &lt;<emphasis>string3</emphasis>&gt; as before.
12569 </para>
12570 <para>
12571 The fields in the string are separated by any one of the characters in the
12572 separator string. These may include space or tab characters.
12573 The first field is numbered one. If the number is negative, the fields are
12574 counted from the end of the string, with the rightmost one numbered -1. If the
12575 number given is zero, the entire string is returned. If the modulus of the
12576 number is greater than the number of fields in the string, the result is the
12577 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
12578 provided. For example:
12579 </para>
12580 <literallayout class="monospaced">
12581 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12582 </literallayout>
12583 <para>
12584 yields <quote>42</quote>, and
12585 </para>
12586 <literallayout class="monospaced">
12587 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
12588 </literallayout>
12589 <para>
12590 yields <quote>99</quote>. Two successive separators mean that the field between them is
12591 empty (for example, the fifth field above).
12592 </para>
12593 </listitem></varlistentry>
12594 <varlistentry>
12595 <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>
12596 <listitem>
12597 <para>
12598 <indexterm role="concept">
12599 <primary>hash function</primary>
12600 <secondary>textual</secondary>
12601 </indexterm>
12602 <indexterm role="concept">
12603 <primary>expansion</primary>
12604 <secondary>textual hash</secondary>
12605 </indexterm>
12606 This is a textual hashing function, and was the first to be implemented in
12607 early versions of Exim. In current releases, there are other hashing functions
12608 (numeric, MD5, and SHA-1), which are described below.
12609 </para>
12610 <para>
12611 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
12612 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
12613 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
12614 use the simpler operator notation that avoids some of the braces:
12615 </para>
12616 <literallayout class="monospaced">
12617 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
12618 </literallayout>
12619 <para>
12620 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
12621 or equal to the length of the string, the expansion item returns the string.
12622 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
12623 function to the string. The new string consists of characters taken from the
12624 first &lt;<emphasis>m</emphasis>&gt; characters of the string
12625 </para>
12626 <literallayout class="monospaced">
12627 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
12628 </literallayout>
12629 <para>
12630 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
12631 letters appear. For example:
12632 </para>
12633 <literallayout>
12634 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
12635 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
12636 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
12637 </literallayout>
12638 </listitem></varlistentry>
12639 <varlistentry>
12640 <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>
12641 <listitem>
12642 <para>
12643 See <emphasis role="bold">$rheader</emphasis> below.
12644 </para>
12645 </listitem></varlistentry>
12646 <varlistentry>
12647 <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>
12648 <listitem>
12649 <para>
12650 See <emphasis role="bold">$rheader</emphasis> below.
12651 </para>
12652 </listitem></varlistentry>
12653 <varlistentry>
12654 <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>
12655 <listitem>
12656 <para>
12657 <indexterm role="concept">
12658 <primary>expansion</primary>
12659 <secondary>header insertion</secondary>
12660 </indexterm>
12661 <indexterm role="concept">
12662 <primary><varname>$header_</varname></primary>
12663 </indexterm>
12664 <indexterm role="concept">
12665 <primary><varname>$bheader_</varname></primary>
12666 </indexterm>
12667 <indexterm role="concept">
12668 <primary><varname>$rheader_</varname></primary>
12669 </indexterm>
12670 <indexterm role="concept">
12671 <primary>header lines</primary>
12672 <secondary>in expansion strings</secondary>
12673 </indexterm>
12674 <indexterm role="concept">
12675 <primary>header lines</primary>
12676 <secondary>character sets</secondary>
12677 </indexterm>
12678 <indexterm role="concept">
12679 <primary>header lines</primary>
12680 <secondary>decoding</secondary>
12681 </indexterm>
12682 Substitute the contents of the named message header line, for example
12683 </para>
12684 <literallayout class="monospaced">
12685 $header_reply-to:
12686 </literallayout>
12687 <para>
12688 The newline that terminates a header line is not included in the expansion, but
12689 internal newlines (caused by splitting the header line over several physical
12690 lines) may be present.
12691 </para>
12692 <para>
12693 The difference between <option>rheader</option>, <option>bheader</option>, and <option>header</option> is in the way
12694 the data in the header line is interpreted.
12695 </para>
12696 <itemizedlist>
12697 <listitem>
12698 <para>
12699 <indexterm role="concept">
12700 <primary>white space</primary>
12701 <secondary>in header lines</secondary>
12702 </indexterm>
12703 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
12704 processing at all, and without the removal of leading and trailing white space.
12705 </para>
12706 </listitem>
12707 <listitem>
12708 <para>
12709 <indexterm role="concept">
12710 <primary>base64 encoding</primary>
12711 <secondary>in header lines</secondary>
12712 </indexterm>
12713 <option>bheader</option> removes leading and trailing white space, and then decodes base64
12714 or quoted-printable MIME <quote>words</quote> within the header text, but does no
12715 character set translation. If decoding of what looks superficially like a MIME
12716 <quote>word</quote> fails, the raw string is returned. If decoding
12717 <indexterm role="concept">
12718 <primary>binary zero</primary>
12719 <secondary>in header line</secondary>
12720 </indexterm>
12721 produces a binary zero character, it is replaced by a question mark &ndash; this is
12722 what Exim does for binary zeros that are actually received in header lines.
12723 </para>
12724 </listitem>
12725 <listitem>
12726 <para>
12727 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
12728 standard character set. This is an attempt to produce the same string as would
12729 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
12730 returned. Translation is attempted only on operating systems that support the
12731 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
12732 a system Makefile or in <filename>Local/Makefile</filename>.
12733 </para>
12734 </listitem>
12735 </itemizedlist>
12736 <para>
12737 In a filter file, the target character set for <option>header</option> can be specified by a
12738 command of the following form:
12739 </para>
12740 <literallayout class="monospaced">
12741 headers charset "UTF-8"
12742 </literallayout>
12743 <para>
12744 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
12745 subsequently obeyed filter commands. In the absence of this command, the target
12746 character set in a filter is taken from the setting of the <option>headers_charset</option>
12747 option in the runtime configuration. The value of this option defaults to the
12748 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
12749 ISO-8859-1.
12750 </para>
12751 <para>
12752 Header names follow the syntax of RFC 2822, which states that they may contain
12753 any printing characters except space and colon. Consequently, curly brackets
12754 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
12755 if they were variables. Attempting to do so causes a syntax error.
12756 </para>
12757 <para>
12758 Only header lines that are common to all copies of a message are visible to
12759 this mechanism. These are the original header lines that are received with the
12760 message, and any that are added by an ACL <option>warn</option> statement or by a system
12761 filter. Header lines that are added to a particular copy of a message by a
12762 router or transport are not accessible.
12763 </para>
12764 <para>
12765 For incoming SMTP messages, no header lines are visible in ACLs that are obeyed
12766 before the DATA ACL, because the header structure is not set up until the
12767 message is received. Header lines that are added by <option>warn</option> statements in a
12768 RCPT ACL (for example) are saved until the message&#x2019;s incoming header lines
12769 are available, at which point they are added. When a DATA ACL is running,
12770 however, header lines added by earlier ACLs are visible.
12771 </para>
12772 <para>
12773 Upper case and lower case letters are synonymous in header names. If the
12774 following character is white space, the terminating colon may be omitted, but
12775 this is not recommended, because you may then forget it when it is needed. When
12776 white space terminates the header name, it is included in the expanded string.
12777 If the message does not contain the given header, the expansion item is
12778 replaced by an empty string. (See the <option>def</option> condition in section
12779 <xref linkend="SECTexpcond"/> for a means of testing for the existence of a header.)
12780 </para>
12781 <para>
12782 If there is more than one header with the same name, they are all
12783 concatenated to form the substitution string, up to a maximum length of 64K. A
12784 newline character is inserted between each line. For the <option>header</option> expansion,
12785 for those headers that contain lists of addresses, a comma is also inserted at
12786 the junctions between lines. This does not happen for the <option>rheader</option>
12787 expansion.
12788 </para>
12789 </listitem></varlistentry>
12790 <varlistentry>
12791 <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>
12792 <listitem>
12793 <para>
12794 <indexterm role="concept">
12795 <primary>expansion</primary>
12796 <secondary>hmac hashing</secondary>
12797 </indexterm>
12798 <indexterm role="concept">
12799 <primary><option>hmac</option></primary>
12800 </indexterm>
12801 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
12802 shared secret and some text into a message authentication code, as specified in
12803 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
12804 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
12805 cryptographic hash, allowing for authentication that is not possible with MD5
12806 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
12807 present. For example:
12808 </para>
12809 <literallayout class="monospaced">
12810 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
12811 </literallayout>
12812 <para>
12813 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
12814 produces:
12815 </para>
12816 <literallayout class="monospaced">
12817 dd97e3ba5d1a61b5006108f8c8252953
12818 </literallayout>
12819 <para>
12820 As an example of how this might be used, you might put in the main part of
12821 an Exim configuration:
12822 </para>
12823 <literallayout class="monospaced">
12824 SPAMSCAN_SECRET=cohgheeLei2thahw
12825 </literallayout>
12826 <para>
12827 In a router or a transport you could then have:
12828 </para>
12829 <literallayout class="monospaced">
12830 headers_add = \
12831   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
12832   ${hmac{md5}{SPAMSCAN_SECRET}\
12833   {${primary_hostname},${message_exim_id},$h_message-id:}}
12834 </literallayout>
12835 <para>
12836 Then given a message, you can check where it was scanned by looking at the
12837 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
12838 this header line is authentic by recomputing the authentication code from the
12839 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
12840 using Exim&#x2019;s <option>-be</option> option, or by other means, for example by using the
12841 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
12842 </para>
12843 </listitem></varlistentry>
12844 <varlistentry>
12845 <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>
12846 <listitem>
12847 <para>
12848 <indexterm role="concept">
12849 <primary>expansion</primary>
12850 <secondary>conditional</secondary>
12851 </indexterm>
12852 <indexterm role="concept">
12853 <primary><option>if</option>, expansion item</primary>
12854 </indexterm>
12855 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
12856 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
12857 in section <xref linkend="SECTexpcond"/> below. For example:
12858 </para>
12859 <literallayout class="monospaced">
12860 ${if eq {$local_part}{postmaster} {yes}{no} }
12861 </literallayout>
12862 <para>
12863 The second string need not be present; if it is not and the condition is not
12864 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
12865 be present instead of the second string (without any curly brackets). In this
12866 case, the expansion is forced to fail if the condition is not true (see section
12867 <xref linkend="SECTforexpfai"/>).
12868 </para>
12869 <para>
12870 If both strings are omitted, the result is the string <literal>true</literal> if the condition
12871 is true, and the empty string if the condition is false. This makes it less
12872 cumbersome to write custom ACL and router conditions. For example, instead of
12873 </para>
12874 <literallayout class="monospaced">
12875 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
12876 </literallayout>
12877 <para>
12878 you can use
12879 </para>
12880 <literallayout class="monospaced">
12881 condition = ${if &gt;{$acl_m4}{3}}
12882 </literallayout>
12883 </listitem></varlistentry>
12884 <varlistentry>
12885 <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>
12886 <listitem>
12887 <para>
12888 <indexterm role="concept">
12889 <primary>expansion</primary>
12890 <secondary>string truncation</secondary>
12891 </indexterm>
12892 <indexterm role="concept">
12893 <primary><option>length</option></primary>
12894 <secondary>expansion item</secondary>
12895 </indexterm>
12896 The <option>length</option> item is used to extract the initial portion of a string. Both
12897 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
12898 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
12899 change when expanded, you can use the simpler operator notation that avoids
12900 some of the braces:
12901 </para>
12902 <literallayout class="monospaced">
12903 ${length_&lt;n&gt;:&lt;string&gt;}
12904 </literallayout>
12905 <para>
12906 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; characters or the whole
12907 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
12908 <option>strlen</option>, which gives the length of a string.
12909 </para>
12910 </listitem></varlistentry>
12911 <varlistentry>
12912 <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>
12913 <listitem>
12914 <para>
12915 This is the first of one of two different types of lookup item, which are both
12916 described in the next item.
12917 </para>
12918 </listitem></varlistentry>
12919 <varlistentry>
12920 <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>
12921 <listitem>
12922 <para>
12923 <indexterm role="concept">
12924 <primary>expansion</primary>
12925 <secondary>lookup in</secondary>
12926 </indexterm>
12927 <indexterm role="concept">
12928 <primary>file</primary>
12929 <secondary>lookups</secondary>
12930 </indexterm>
12931 <indexterm role="concept">
12932 <primary>lookup</primary>
12933 <secondary>in expanded string</secondary>
12934 </indexterm>
12935 The two forms of lookup item specify data lookups in files and databases, as
12936 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
12937 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
12938 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
12939 </para>
12940 <para>
12941 If there is any white space in a lookup item which is part of a filter command,
12942 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
12943 other place where white space is significant, the lookup item must be enclosed
12944 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
12945 out by the system administrator.
12946 </para>
12947 <para>
12948 <indexterm role="concept">
12949 <primary><varname>$value</varname></primary>
12950 </indexterm>
12951 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
12952 During its expansion, the variable <varname>$value</varname> contains the data returned by the
12953 lookup. Afterwards it reverts to the value it had previously (at the outer
12954 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
12955 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
12956 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
12957 lookup, thus providing a mechanism for looking up a default value when the
12958 original lookup fails.
12959 </para>
12960 <para>
12961 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
12962 data for the outer lookup while the parameters of the second lookup are
12963 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
12964 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
12965 appear, and in this case, if the lookup fails, the entire expansion is forced
12966 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
12967 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
12968 successful lookup, and nothing in the case of failure.
12969 </para>
12970 <para>
12971 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
12972 search type in order to do partial matching, and * or *@ may follow a search
12973 type to request default lookups if the key does not match (see sections
12974 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
12975 </para>
12976 <para>
12977 <indexterm role="concept">
12978 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
12979 <secondary>in lookup expansion</secondary>
12980 </indexterm>
12981 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
12982 and non-wild parts of the key during the expansion of the replacement text.
12983 They return to their previous values at the end of the lookup item.
12984 </para>
12985 <para>
12986 This example looks up the postmaster alias in the conventional alias file:
12987 </para>
12988 <literallayout class="monospaced">
12989 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
12990 </literallayout>
12991 <para>
12992 This example uses NIS+ to look up the full name of the user corresponding to
12993 the local part of an address, forcing the expansion to fail if it is not found:
12994 </para>
12995 <literallayout class="monospaced">
12996 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
12997   {$value}fail}
12998 </literallayout>
12999 </listitem></varlistentry>
13000 <varlistentry>
13001 <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>
13002 <listitem>
13003 <para>
13004 <indexterm role="concept">
13005 <primary>expansion</primary>
13006 <secondary>numeric hash</secondary>
13007 </indexterm>
13008 <indexterm role="concept">
13009 <primary>hash function</primary>
13010 <secondary>numeric</secondary>
13011 </indexterm>
13012 The three strings are expanded; the first two must yield numbers. Call them
13013 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13014 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13015 can use the simpler operator notation that avoids some of the braces:
13016 </para>
13017 <literallayout class="monospaced">
13018 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13019 </literallayout>
13020 <para>
13021 The second number is optional (in both notations). If there is only one number,
13022 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
13023 processed by a div/mod hash function that returns two numbers, separated by a
13024 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
13025 example,
13026 </para>
13027 <literallayout class="monospaced">
13028 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
13029 </literallayout>
13030 <para>
13031 returns the string <quote>6/33</quote>.
13032 </para>
13033 </listitem></varlistentry>
13034 <varlistentry>
13035 <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>
13036 <listitem>
13037 <para>
13038 <indexterm role="concept">
13039 <primary>Perl</primary>
13040 <secondary>use in expanded string</secondary>
13041 </indexterm>
13042 <indexterm role="concept">
13043 <primary>expansion</primary>
13044 <secondary>calling Perl from</secondary>
13045 </indexterm>
13046 This item is available only if Exim has been built to include an embedded Perl
13047 interpreter. The subroutine name and the arguments are first separately
13048 expanded, and then the Perl subroutine is called with those arguments. No
13049 additional arguments need be given; the maximum number permitted, including the
13050 name of the subroutine, is nine.
13051 </para>
13052 <para>
13053 The return value of the subroutine is inserted into the expanded string, unless
13054 the return value is <option>undef</option>. In that case, the expansion fails in the same
13055 way as an explicit <quote>fail</quote> on a lookup item. The return value is a scalar.
13056 Whatever you return is evaluated in a scalar context. For example, if you
13057 return the name of a Perl vector, the return value is the size of the vector,
13058 not its contents.
13059 </para>
13060 <para>
13061 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
13062 with the error message that was passed to <option>die</option>. More details of the embedded
13063 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
13064 </para>
13065 <para>
13066 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
13067 out the use of this expansion item in filter files.
13068 </para>
13069 </listitem></varlistentry>
13070 <varlistentry>
13071 <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>
13072 <listitem>
13073 <para>
13074 <indexterm role="concept">
13075 <primary>prvs</primary>
13076 <secondary>expansion item</secondary>
13077 </indexterm>
13078 The first argument is a complete email address and the second is secret
13079 keystring. The third argument, specifying a key number, is optional. If absent,
13080 it defaults to 0. The result of the expansion is a prvs-signed email address,
13081 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
13082 as part of a bounce address tag validation (BATV) scheme. For more discussion
13083 and an example, see section <xref linkend="SECTverifyPRVS"/>.
13084 </para>
13085 </listitem></varlistentry>
13086 <varlistentry>
13087 <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>
13088 <listitem>
13089 <para>
13090 <indexterm role="concept">
13091 <primary>prvscheck</primary>
13092 <secondary>expansion item</secondary>
13093 </indexterm>
13094 This expansion item is the complement of the <option>prvs</option> item. It is used for
13095 checking prvs-signed addresses. If the expansion of the first argument does not
13096 yield a syntactically valid prvs-signed address, the whole item expands to the
13097 empty string. When the first argument does expand to a syntactically valid
13098 prvs-signed address, the second argument is expanded, with the prvs-decoded
13099 version of the address and the key number extracted from the address in the
13100 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
13101 </para>
13102 <para>
13103 These two variables can be used in the expansion of the second argument to
13104 retrieve the secret. The validity of the prvs-signed address is then checked
13105 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
13106 which is empty for failure or <quote>1</quote> for success.
13107 </para>
13108 <para>
13109 The third argument is optional; if it is missing, it defaults to an empty
13110 string. This argument is now expanded. If the result is an empty string, the
13111 result of the expansion is the decoded version of the address. This is the case
13112 whether or not the signature was valid. Otherwise, the result of the expansion
13113 is the expansion of the third argument.
13114 </para>
13115 <para>
13116 All three variables can be used in the expansion of the third argument.
13117 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
13118 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
13119 </para>
13120 </listitem></varlistentry>
13121 <varlistentry>
13122 <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>
13123 <listitem>
13124 <para>
13125 <indexterm role="concept">
13126 <primary>expansion</primary>
13127 <secondary>inserting an entire file</secondary>
13128 </indexterm>
13129 <indexterm role="concept">
13130 <primary>file</primary>
13131 <secondary>inserting into expansion</secondary>
13132 </indexterm>
13133 <indexterm role="concept">
13134 <primary><option>readfile</option> expansion item</primary>
13135 </indexterm>
13136 The file name and end-of-line string are first expanded separately. The file is
13137 then read, and its contents replace the entire item. All newline characters in
13138 the file are replaced by the end-of-line string if it is present. Otherwise,
13139 newlines are left in the string.
13140 String expansion is not applied to the contents of the file. If you want this,
13141 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
13142 the string expansion fails.
13143 </para>
13144 <para>
13145 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
13146 locks out the use of this expansion item in filter files.
13147 </para>
13148 </listitem></varlistentry>
13149 <varlistentry>
13150 <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>
13151 <listitem>
13152 <para>
13153 <indexterm role="concept">
13154 <primary>expansion</primary>
13155 <secondary>inserting from a socket</secondary>
13156 </indexterm>
13157 <indexterm role="concept">
13158 <primary>socket</primary>
13159 <secondary>use of in expansion</secondary>
13160 </indexterm>
13161 <indexterm role="concept">
13162 <primary><option>readsocket</option> expansion item</primary>
13163 </indexterm>
13164 This item inserts data from a Unix domain or Internet socket into the expanded
13165 string. The minimal way of using it uses just two arguments, as in these
13166 examples:
13167 </para>
13168 <literallayout class="monospaced">
13169 ${readsocket{/socket/name}{request string}}
13170 ${readsocket{inet:some.host:1234}{request string}}
13171 </literallayout>
13172 <para>
13173 For a Unix domain socket, the first substring must be the path to the socket.
13174 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
13175 a host name or IP address, followed by a colon and a port, which can be a
13176 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
13177 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
13178 example:
13179 </para>
13180 <literallayout class="monospaced">
13181 ${readsocket{inet:[::1]:1234}{request string}}
13182 </literallayout>
13183 <para>
13184 Only a single host name may be given, but if looking it up yields more than
13185 one IP address, they are each tried in turn until a connection is made. For
13186 both kinds of socket, Exim makes a connection, writes the request string
13187 (unless it is an empty string) and reads from the socket until an end-of-file
13188 is read. A timeout of 5 seconds is applied. Additional, optional arguments
13189 extend what can be done. Firstly, you can vary the timeout. For example:
13190 </para>
13191 <literallayout class="monospaced">
13192 ${readsocket{/socket/name}{request string}{3s}}
13193 </literallayout>
13194 <para>
13195 A fourth argument allows you to change any newlines that are in the data
13196 that is read, in the same way as for <option>readfile</option> (see above). This example
13197 turns them into spaces:
13198 </para>
13199 <literallayout class="monospaced">
13200 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
13201 </literallayout>
13202 <para>
13203 As with all expansions, the substrings are expanded before the processing
13204 happens. Errors in these sub-expansions cause the expansion to fail. In
13205 addition, the following errors can occur:
13206 </para>
13207 <itemizedlist>
13208 <listitem>
13209 <para>
13210 Failure to create a socket file descriptor;
13211 </para>
13212 </listitem>
13213 <listitem>
13214 <para>
13215 Failure to connect the socket;
13216 </para>
13217 </listitem>
13218 <listitem>
13219 <para>
13220 Failure to write the request string;
13221 </para>
13222 </listitem>
13223 <listitem>
13224 <para>
13225 Timeout on reading from the socket.
13226 </para>
13227 </listitem>
13228 </itemizedlist>
13229 <para>
13230 By default, any of these errors causes the expansion to fail. However, if
13231 you supply a fifth substring, it is expanded and used when any of the above
13232 errors occurs. For example:
13233 </para>
13234 <literallayout class="monospaced">
13235 ${readsocket{/socket/name}{request string}{3s}{\n}\
13236   {socket failure}}
13237 </literallayout>
13238 <para>
13239 You can test for the existence of a Unix domain socket by wrapping this
13240 expansion in <literal>${if exists</literal>, but there is a race condition between that test
13241 and the actual opening of the socket, so it is safer to use the fifth argument
13242 if you want to be absolutely sure of avoiding an expansion error for a
13243 non-existent Unix domain socket, or a failure to connect to an Internet socket.
13244 </para>
13245 <para>
13246 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
13247 locks out the use of this expansion item in filter files.
13248 </para>
13249 </listitem></varlistentry>
13250 <varlistentry>
13251 <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>
13252 <listitem>
13253 <para>
13254 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
13255 expansion item above.
13256 </para>
13257 </listitem></varlistentry>
13258 <varlistentry>
13259 <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>
13260 <listitem>
13261 <para>
13262 <indexterm role="concept">
13263 <primary>expansion</primary>
13264 <secondary>running a command</secondary>
13265 </indexterm>
13266 <indexterm role="concept">
13267 <primary><option>run</option> expansion item</primary>
13268 </indexterm>
13269 The command and its arguments are first expanded separately, and then the
13270 command is run in a separate process, but under the same uid and gid. As in
13271 other command executions from Exim, a shell is not used by default. If you want
13272 a shell, you must explicitly code it.
13273 </para>
13274 <para>
13275 <indexterm role="concept">
13276 <primary>return code</primary>
13277 <secondary>from <option>run</option> expansion</secondary>
13278 </indexterm>
13279 <indexterm role="concept">
13280 <primary><varname>$value</varname></primary>
13281 </indexterm>
13282 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
13283 and replaces the entire item; during this expansion, the standard output from
13284 the command is in the variable <varname>$value</varname>. If the command fails, &lt;<emphasis>string2</emphasis>&gt;,
13285 if present, is expanded and used. Once again, during the expansion, the
13286 standard output from the command is in the variable <varname>$value</varname>. If &lt;<emphasis>string2</emphasis>&gt;
13287 is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt; can be the word
13288 <quote>fail</quote> (not in braces) to force expansion failure if the command does not
13289 succeed. If both strings are omitted, the result is contents of the standard
13290 output on success, and nothing on failure.
13291 </para>
13292 <para>
13293 <indexterm role="concept">
13294 <primary><varname>$runrc</varname></primary>
13295 </indexterm>
13296 The return code from the command is put in the variable <varname>$runrc</varname>, and this
13297 remains set afterwards, so in a filter file you can do things like this:
13298 </para>
13299 <literallayout class="monospaced">
13300 if "${run{x y z}{}}$runrc" is 1 then ...
13301   elif $runrc is 2 then ...
13302   ...
13303 endif
13304 </literallayout>
13305 <para>
13306 If execution of the command fails (for example, the command does not exist),
13307 the return code is 127 &ndash; the same code that shells use for non-existent
13308 commands.
13309 </para>
13310 <para>
13311 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
13312 option values are expanded, except for those preconditions whose order of
13313 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
13314 by the expansion of one option, and use it in another.
13315 </para>
13316 <para>
13317 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
13318 out the use of this expansion item in filter files.
13319 </para>
13320 </listitem></varlistentry>
13321 <varlistentry>
13322 <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>
13323 <listitem>
13324 <para>
13325 <indexterm role="concept">
13326 <primary>expansion</primary>
13327 <secondary>string substitution</secondary>
13328 </indexterm>
13329 <indexterm role="concept">
13330 <primary><option>sg</option> expansion item</primary>
13331 </indexterm>
13332 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
13333 option; hence its name. However, unlike the Perl equivalent, Exim does not
13334 modify the subject string; instead it returns the modified string for insertion
13335 into the overall expansion. The item takes three arguments: the subject string,
13336 a regular expression, and a substitution string. For example:
13337 </para>
13338 <literallayout class="monospaced">
13339 ${sg{abcdefabcdef}{abc}{xyz}}
13340 </literallayout>
13341 <para>
13342 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
13343 if any $ or \ characters are required in the regular expression or in the
13344 substitution string, they have to be escaped. For example:
13345 </para>
13346 <literallayout class="monospaced">
13347 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
13348 </literallayout>
13349 <para>
13350 yields <quote>defabc</quote>, and
13351 </para>
13352 <literallayout class="monospaced">
13353 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
13354 </literallayout>
13355 <para>
13356 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
13357 the regular expression from string expansion.
13358 </para>
13359 </listitem></varlistentry>
13360 <varlistentry>
13361 <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>
13362 <listitem>
13363 <para>
13364 <indexterm role="concept">
13365 <primary><option>substr</option></primary>
13366 </indexterm>
13367 <indexterm role="concept">
13368 <primary>substring extraction</primary>
13369 </indexterm>
13370 <indexterm role="concept">
13371 <primary>expansion</primary>
13372 <secondary>substring extraction</secondary>
13373 </indexterm>
13374 The three strings are expanded; the first two must yield numbers. Call them
13375 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
13376 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
13377 can use the simpler operator notation that avoids some of the braces:
13378 </para>
13379 <literallayout class="monospaced">
13380 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
13381 </literallayout>
13382 <para>
13383 The second number is optional (in both notations).
13384 If it is absent in the simpler format, the preceding underscore must also be
13385 omitted.
13386 </para>
13387 <para>
13388 The <option>substr</option> item can be used to extract more general substrings than
13389 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
13390 length required. For example
13391 </para>
13392 <literallayout class="monospaced">
13393 ${substr{3}{2}{$local_part}}
13394 </literallayout>
13395 <para>
13396 If the starting offset is greater than the string length the result is the
13397 null string; if the length plus starting offset is greater than the string
13398 length, the result is the right-hand part of the string, starting from the
13399 given offset. The first character in the string has offset zero.
13400 </para>
13401 <para>
13402 The <option>substr</option> expansion item can take negative offset values to count
13403 from the right-hand end of its operand. The last character is offset -1, the
13404 second-last is offset -2, and so on. Thus, for example,
13405 </para>
13406 <literallayout class="monospaced">
13407 ${substr{-5}{2}{1234567}}
13408 </literallayout>
13409 <para>
13410 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
13411 length of the string, the substring starts at the beginning of the string, and
13412 the length is reduced by the amount of overshoot. Thus, for example,
13413 </para>
13414 <literallayout class="monospaced">
13415 ${substr{-5}{2}{12}}
13416 </literallayout>
13417 <para>
13418 yields an empty string, but
13419 </para>
13420 <literallayout class="monospaced">
13421 ${substr{-3}{2}{12}}
13422 </literallayout>
13423 <para>
13424 yields <quote>1</quote>.
13425 </para>
13426 <para>
13427 When the second number is omitted from <option>substr</option>, the remainder of the string
13428 is taken if the offset is positive. If it is negative, all characters in the
13429 string preceding the offset point are taken. For example, an offset of -1 and
13430 no length, as in these semantically identical examples:
13431 </para>
13432 <literallayout class="monospaced">
13433 ${substr_-1:abcde}
13434 ${substr{-1}{abcde}}
13435 </literallayout>
13436 <para>
13437 yields all but the last character of the string, that is, <quote>abcd</quote>.
13438 </para>
13439 </listitem></varlistentry>
13440 <varlistentry>
13441 <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>
13442 <listitem>
13443 <para>
13444 <indexterm role="concept">
13445 <primary>expansion</primary>
13446 <secondary>character translation</secondary>
13447 </indexterm>
13448 <indexterm role="concept">
13449 <primary><option>tr</option> expansion item</primary>
13450 </indexterm>
13451 This item does single-character translation on its subject string. The second
13452 argument is a list of characters to be translated in the subject string. Each
13453 matching character is replaced by the corresponding character from the
13454 replacement list. For example
13455 </para>
13456 <literallayout class="monospaced">
13457 ${tr{abcdea}{ac}{13}}
13458 </literallayout>
13459 <para>
13460 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
13461 last occurrence is used. If the third string is shorter than the second, its
13462 last character is replicated. However, if it is empty, no translation takes
13463 place.
13464 </para>
13465 </listitem></varlistentry>
13466 </variablelist>
13467 </section>
13468 <section id="SECTexpop">
13469 <title>Expansion operators</title>
13470 <para>
13471 <indexterm role="concept">
13472 <primary>expansion</primary>
13473 <secondary>operators</secondary>
13474 </indexterm>
13475 For expansion items that perform transformations on a single argument string,
13476 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
13477 The substring is first expanded before the operation is applied to it. The
13478 following operations can be performed:
13479 </para>
13480 <variablelist>
13481 <varlistentry>
13482 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13483 <listitem>
13484 <para>
13485 <indexterm role="concept">
13486 <primary>expansion</primary>
13487 <secondary>RFC 2822 address handling</secondary>
13488 </indexterm>
13489 <indexterm role="concept">
13490 <primary><option>address</option></primary>
13491 <secondary>expansion item</secondary>
13492 </indexterm>
13493 The string is interpreted as an RFC 2822 address, as it might appear in a
13494 header line, and the effective address is extracted from it. If the string does
13495 not parse successfully, the result is empty.
13496 </para>
13497 </listitem></varlistentry>
13498 <varlistentry>
13499 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13500 <listitem>
13501 <para>
13502 <indexterm role="concept">
13503 <primary><option>base62</option></primary>
13504 </indexterm>
13505 <indexterm role="concept">
13506 <primary>expansion</primary>
13507 <secondary>conversion to base 62</secondary>
13508 </indexterm>
13509 The string must consist entirely of decimal digits. The number is converted to
13510 base 62 and output as a string of six characters, including leading zeros. In
13511 the few operating environments where Exim uses base 36 instead of base 62 for
13512 its message identifiers (because those systems do not have case-sensitive file
13513 names), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just to
13514 be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
13515 </para>
13516 </listitem></varlistentry>
13517 <varlistentry>
13518 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13519 <listitem>
13520 <para>
13521 <indexterm role="concept">
13522 <primary><option>base62d</option></primary>
13523 </indexterm>
13524 <indexterm role="concept">
13525 <primary>expansion</primary>
13526 <secondary>conversion to base 62</secondary>
13527 </indexterm>
13528 The string must consist entirely of base-62 digits, or, in operating
13529 environments where Exim uses base 36 instead of base 62 for its message
13530 identifiers, base-36 digits. The number is converted to decimal and output as a
13531 string.
13532 </para>
13533 </listitem></varlistentry>
13534 <varlistentry>
13535 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13536 <listitem>
13537 <para>
13538 <indexterm role="concept">
13539 <primary>domain</primary>
13540 <secondary>extraction</secondary>
13541 </indexterm>
13542 <indexterm role="concept">
13543 <primary>expansion</primary>
13544 <secondary>domain extraction</secondary>
13545 </indexterm>
13546 The string is interpreted as an RFC 2822 address and the domain is extracted
13547 from it. If the string does not parse successfully, the result is empty.
13548 </para>
13549 </listitem></varlistentry>
13550 <varlistentry>
13551 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13552 <listitem>
13553 <para>
13554 <indexterm role="concept">
13555 <primary>expansion</primary>
13556 <secondary>escaping non-printing characters</secondary>
13557 </indexterm>
13558 <indexterm role="concept">
13559 <primary><option>escape</option>, expansion item</primary>
13560 </indexterm>
13561 If the string contains any non-printing characters, they are converted to
13562 escape sequences starting with a backslash. Whether characters with the most
13563 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
13564 is controlled by the <option>print_topbitchars</option> option.
13565 </para>
13566 </listitem></varlistentry>
13567 <varlistentry>
13568 <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>
13569 <listitem>
13570 <para>
13571 <indexterm role="concept">
13572 <primary>expansion</primary>
13573 <secondary>expression evaluation</secondary>
13574 </indexterm>
13575 <indexterm role="concept">
13576 <primary>expansion</primary>
13577 <secondary>arithmetic expression</secondary>
13578 </indexterm>
13579 <indexterm role="concept">
13580 <primary><option>eval</option> expansion item</primary>
13581 </indexterm>
13582 These items supports simple arithmetic in expansion strings. The string (after
13583 expansion) must be a conventional arithmetic expression, but it is limited to
13584 five basic operators (plus, minus, times, divide, remainder) and parentheses.
13585 All operations are carried out using integer arithmetic. Plus and minus have a
13586 lower priority than times, divide, and remainder; operators with the same
13587 priority are evaluated from left to right.
13588 </para>
13589 <para revisionflag="changed">
13590 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
13591 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
13592 decimal, even if they start with a leading zero; hexadecimal numbers are not
13593 permitted. This can be useful when processing numbers extracted from dates or
13594 times, which often do have leading zeros.
13595 </para>
13596 <para>
13597 A number may be followed by <quote>K</quote> or <quote>M</quote> to multiply it by 1024 or 1024*1024,
13598 respectively. Negative numbers are supported. The result of the computation is
13599 a decimal representation of the answer (without <quote>K</quote> or <quote>M</quote>). For example:
13600 </para>
13601 <literallayout>
13602 <literal>${eval:1+1}     </literal>  yields 2
13603 <literal>${eval:1+2*3}   </literal>  yields 7
13604 <literal>${eval:(1+2)*3} </literal>  yields 9
13605 <literal>${eval:2+42%5}  </literal>  yields 4
13606 </literallayout>
13607 <para>
13608 As a more realistic example, in an ACL you might have
13609 </para>
13610 <literallayout class="monospaced">
13611 deny   message = Too many bad recipients
13612        condition =                    \
13613          ${if and {                   \
13614            {&gt;{$rcpt_count}{10}}       \
13615            {                          \
13616            &lt;                          \
13617              {$recipients_count}      \
13618              {${eval:$rcpt_count/2}}  \
13619            }                          \
13620          }{yes}{no}}
13621 </literallayout>
13622 <para>
13623 The condition is true if there have been more than 10 RCPT commands and
13624 fewer than half of them have resulted in a valid recipient.
13625 </para>
13626 </listitem></varlistentry>
13627 <varlistentry>
13628 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13629 <listitem>
13630 <para>
13631 <indexterm role="concept">
13632 <primary>expansion</primary>
13633 <secondary>re-expansion of substring</secondary>
13634 </indexterm>
13635 The <option>expand</option> operator causes a string to be expanded for a second time. For
13636 example,
13637 </para>
13638 <literallayout class="monospaced">
13639 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
13640 </literallayout>
13641 <para>
13642 first looks up a string in a file while expanding the operand for <option>expand</option>,
13643 and then re-expands what it has found.
13644 </para>
13645 </listitem></varlistentry>
13646 <varlistentry>
13647 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13648 <listitem>
13649 <para>
13650 <indexterm role="concept">
13651 <primary>Unicode</primary>
13652 </indexterm>
13653 <indexterm role="concept">
13654 <primary>UTF-8</primary>
13655 <secondary>conversion from</secondary>
13656 </indexterm>
13657 <indexterm role="concept">
13658 <primary>expansion</primary>
13659 <secondary>UTF-8 conversion</secondary>
13660 </indexterm>
13661 <indexterm role="concept">
13662 <primary><option>from_utf8</option></primary>
13663 </indexterm>
13664 The world is slowly moving towards Unicode, although there are no standards for
13665 email yet. However, other applications (including some databases) are starting
13666 to store data in Unicode, using UTF-8 encoding. This operator converts from a
13667 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
13668 converted to underscores. The input must be a valid UTF-8 string. If it is not,
13669 the result is an undefined sequence of bytes.
13670 </para>
13671 <para>
13672 Unicode code points with values less than 256 are compatible with ASCII and
13673 ISO-8859-1 (also known as Latin-1).
13674 For example, character 169 is the copyright symbol in both cases, though the
13675 way it is encoded is different. In UTF-8, more than one byte is needed for
13676 characters with code values greater than 127, whereas ISO-8859-1 is a
13677 single-byte encoding (but thereby limited to 256 characters). This makes
13678 translation from UTF-8 to ISO-8859-1 straightforward.
13679 </para>
13680 </listitem></varlistentry>
13681 <varlistentry>
13682 <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>
13683 <listitem>
13684 <para>
13685 <indexterm role="concept">
13686 <primary>hash function</primary>
13687 <secondary>textual</secondary>
13688 </indexterm>
13689 <indexterm role="concept">
13690 <primary>expansion</primary>
13691 <secondary>textual hash</secondary>
13692 </indexterm>
13693 The <option>hash</option> operator is a simpler interface to the hashing function that can
13694 be used when the two parameters are fixed numbers (as opposed to strings that
13695 change when expanded). The effect is the same as
13696 </para>
13697 <literallayout class="monospaced">
13698 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
13699 </literallayout>
13700 <para>
13701 See the description of the general <option>hash</option> item above for details. The
13702 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
13703 </para>
13704 </listitem></varlistentry>
13705 <varlistentry>
13706 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13707 <listitem>
13708 <para>
13709 <indexterm role="concept">
13710 <primary>base64 encoding</primary>
13711 <secondary>conversion from hex</secondary>
13712 </indexterm>
13713 <indexterm role="concept">
13714 <primary>expansion</primary>
13715 <secondary>hex to base64</secondary>
13716 </indexterm>
13717 <indexterm role="concept">
13718 <primary><option>hex2b64</option></primary>
13719 </indexterm>
13720 This operator converts a hex string into one that is base64 encoded. This can
13721 be useful for processing the output of the MD5 and SHA-1 hashing functions.
13722 </para>
13723 </listitem></varlistentry>
13724 <varlistentry>
13725 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13726 <listitem>
13727 <para>
13728 <indexterm role="concept">
13729 <primary>case forcing in strings</primary>
13730 </indexterm>
13731 <indexterm role="concept">
13732 <primary>string</primary>
13733 <secondary>case forcing</secondary>
13734 </indexterm>
13735 <indexterm role="concept">
13736 <primary>lower casing</primary>
13737 </indexterm>
13738 <indexterm role="concept">
13739 <primary>expansion</primary>
13740 <secondary>case forcing</secondary>
13741 </indexterm>
13742 <indexterm role="concept">
13743 <primary><option>lc</option> expansion item</primary>
13744 </indexterm>
13745 This forces the letters in the string into lower-case, for example:
13746 </para>
13747 <literallayout class="monospaced">
13748 ${lc:$local_part}
13749 </literallayout>
13750 </listitem></varlistentry>
13751 <varlistentry>
13752 <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>
13753 <listitem>
13754 <para>
13755 <indexterm role="concept">
13756 <primary>expansion</primary>
13757 <secondary>string truncation</secondary>
13758 </indexterm>
13759 <indexterm role="concept">
13760 <primary><option>length</option></primary>
13761 <secondary>expansion item</secondary>
13762 </indexterm>
13763 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
13764 can be used when the parameter is a fixed number (as opposed to a string that
13765 changes when expanded). The effect is the same as
13766 </para>
13767 <literallayout class="monospaced">
13768 ${length{&lt;number&gt;}{&lt;string&gt;}}
13769 </literallayout>
13770 <para>
13771 See the description of the general <option>length</option> item above for details. Note that
13772 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
13773 when <option>length</option> is used as an operator.
13774 </para>
13775 </listitem></varlistentry>
13776 <varlistentry>
13777 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13778 <listitem>
13779 <para>
13780 <indexterm role="concept">
13781 <primary>expansion</primary>
13782 <secondary>local part extraction</secondary>
13783 </indexterm>
13784 <indexterm role="concept">
13785 <primary><option>local_part</option> expansion item</primary>
13786 </indexterm>
13787 The string is interpreted as an RFC 2822 address and the local part is
13788 extracted from it. If the string does not parse successfully, the result is
13789 empty.
13790 </para>
13791 </listitem></varlistentry>
13792 <varlistentry>
13793 <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>
13794 <listitem>
13795 <para>
13796 <indexterm role="concept">
13797 <primary>masked IP address</primary>
13798 </indexterm>
13799 <indexterm role="concept">
13800 <primary>IP address</primary>
13801 <secondary>masking</secondary>
13802 </indexterm>
13803 <indexterm role="concept">
13804 <primary>CIDR notation</primary>
13805 </indexterm>
13806 <indexterm role="concept">
13807 <primary>expansion</primary>
13808 <secondary>IP address masking</secondary>
13809 </indexterm>
13810 <indexterm role="concept">
13811 <primary><option>mask</option>, expansion item</primary>
13812 </indexterm>
13813 If the form of the string to be operated on is not an IP address followed by a
13814 slash and an integer (that is, a network address in CIDR notation), the
13815 expansion fails. Otherwise, this operator converts the IP address to binary,
13816 masks off the least significant bits according to the bit count, and converts
13817 the result back to text, with mask appended. For example,
13818 </para>
13819 <literallayout class="monospaced">
13820 ${mask:10.111.131.206/28}
13821 </literallayout>
13822 <para>
13823 returns the string <quote>10.111.131.192/28</quote>. Since this operation is expected to
13824 be mostly used for looking up masked addresses in files, the result for an IPv6
13825 address uses dots to separate components instead of colons, because colon
13826 terminates a key string in lsearch files. So, for example,
13827 </para>
13828 <literallayout class="monospaced">
13829 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
13830 </literallayout>
13831 <para>
13832 returns the string
13833 </para>
13834 <literallayout class="monospaced">
13835 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
13836 </literallayout>
13837 <para>
13838 Letters in IPv6 addresses are always output in lower case.
13839 </para>
13840 </listitem></varlistentry>
13841 <varlistentry>
13842 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13843 <listitem>
13844 <para>
13845 <indexterm role="concept">
13846 <primary>MD5 hash</primary>
13847 </indexterm>
13848 <indexterm role="concept">
13849 <primary>expansion</primary>
13850 <secondary>MD5 hash</secondary>
13851 </indexterm>
13852 <indexterm role="concept">
13853 <primary><option>md5</option> expansion item</primary>
13854 </indexterm>
13855 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
13856 as a 32-digit hexadecimal number, in which any letters are in lower case.
13857 </para>
13858 </listitem></varlistentry>
13859 <varlistentry>
13860 <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>
13861 <listitem>
13862 <para>
13863 <indexterm role="concept">
13864 <primary>expansion</primary>
13865 <secondary>numeric hash</secondary>
13866 </indexterm>
13867 <indexterm role="concept">
13868 <primary>hash function</primary>
13869 <secondary>numeric</secondary>
13870 </indexterm>
13871 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
13872 that can be used when the two parameters are fixed numbers (as opposed to
13873 strings that change when expanded). The effect is the same as
13874 </para>
13875 <literallayout class="monospaced">
13876 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
13877 </literallayout>
13878 <para>
13879 See the description of the general <option>nhash</option> item above for details.
13880 </para>
13881 </listitem></varlistentry>
13882 <varlistentry>
13883 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13884 <listitem>
13885 <para>
13886 <indexterm role="concept">
13887 <primary>quoting</primary>
13888 <secondary>in string expansions</secondary>
13889 </indexterm>
13890 <indexterm role="concept">
13891 <primary>expansion</primary>
13892 <secondary>quoting</secondary>
13893 </indexterm>
13894 <indexterm role="concept">
13895 <primary><option>quote</option>, expansion item</primary>
13896 </indexterm>
13897 The <option>quote</option> operator puts its argument into double quotes if it
13898 is an empty string or
13899 contains anything other than letters, digits, underscores, dots, and hyphens.
13900 Any occurrences of double quotes and backslashes are escaped with a backslash.
13901 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
13902 respectively For example,
13903 </para>
13904 <literallayout class="monospaced">
13905 ${quote:ab"*"cd}
13906 </literallayout>
13907 <para>
13908 becomes
13909 </para>
13910 <literallayout class="monospaced">
13911 "ab\"*\"cd"
13912 </literallayout>
13913 <para>
13914 The place where this is useful is when the argument is a substitution from a
13915 variable or a message header.
13916 </para>
13917 </listitem></varlistentry>
13918 <varlistentry>
13919 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13920 <listitem>
13921 <para>
13922 <indexterm role="concept">
13923 <primary><option>quote_local_part</option> expansion item</primary>
13924 </indexterm>
13925 This operator is like <option>quote</option>, except that it quotes the string only if
13926 required to do so by the rules of RFC 2822 for quoting local parts. For
13927 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
13928 If you are creating a new email address from the contents of <varname>$local_part</varname>
13929 (or any other unknown data), you should always use this operator.
13930 </para>
13931 </listitem></varlistentry>
13932 <varlistentry>
13933 <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>
13934 <listitem>
13935 <para>
13936 <indexterm role="concept">
13937 <primary>quoting</primary>
13938 <secondary>lookup-specific</secondary>
13939 </indexterm>
13940 This operator applies lookup-specific quoting rules to the string. Each
13941 query-style lookup type has its own quoting rules which are described with
13942 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
13943 </para>
13944 <literallayout class="monospaced">
13945 ${quote_ldap:two * two}
13946 </literallayout>
13947 <para>
13948 returns
13949 </para>
13950 <literallayout class="monospaced">
13951 two%20%5C2A%20two
13952 </literallayout>
13953 <para>
13954 For single-key lookup types, no quoting is ever necessary and this operator
13955 yields an unchanged string.
13956 </para>
13957 </listitem></varlistentry>
13958 <varlistentry>
13959 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13960 <listitem>
13961 <para>
13962 <indexterm role="concept">
13963 <primary>expansion</primary>
13964 <secondary>RFC 2047</secondary>
13965 </indexterm>
13966 <indexterm role="concept">
13967 <primary>RFC 2047</primary>
13968 <secondary>expansion operator</secondary>
13969 </indexterm>
13970 <indexterm role="concept">
13971 <primary><option>rfc2047</option> expansion item</primary>
13972 </indexterm>
13973 This operator encodes text according to the rules of RFC 2047. This is an
13974 encoding that is used in header lines to encode non-ASCII characters. It is
13975 assumed that the input string is in the encoding specified by the
13976 <option>headers_charset</option> option, which defaults to ISO-8859-1. If the string
13977 contains only characters in the range 33&ndash;126, and no instances of the
13978 characters
13979 </para>
13980 <literallayout class="monospaced">
13981 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
13982 </literallayout>
13983 <para>
13984 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
13985 string, using as many <quote>encoded words</quote> as necessary to encode all the
13986 characters.
13987 </para>
13988 </listitem></varlistentry>
13989 <varlistentry>
13990 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
13991 <listitem>
13992 <para>
13993 <indexterm role="concept">
13994 <primary>quoting</primary>
13995 <secondary>in regular expressions</secondary>
13996 </indexterm>
13997 <indexterm role="concept">
13998 <primary>regular expressions</primary>
13999 <secondary>quoting</secondary>
14000 </indexterm>
14001 <indexterm role="concept">
14002 <primary><option>rxquote</option> expansion item</primary>
14003 </indexterm>
14004 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
14005 characters in its argument. This is useful when substituting the values of
14006 variables or headers inside regular expressions.
14007 </para>
14008 </listitem></varlistentry>
14009 <varlistentry>
14010 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14011 <listitem>
14012 <para>
14013 <indexterm role="concept">
14014 <primary>SHA-1 hash</primary>
14015 </indexterm>
14016 <indexterm role="concept">
14017 <primary>expansion</primary>
14018 <secondary>SHA-1 hashing</secondary>
14019 </indexterm>
14020 <indexterm role="concept">
14021 <primary><option>sha2</option> expansion item</primary>
14022 </indexterm>
14023 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
14024 it as a 40-digit hexadecimal number, in which any letters are in upper case.
14025 </para>
14026 </listitem></varlistentry>
14027 <varlistentry>
14028 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14029 <listitem>
14030 <para>
14031 <indexterm role="concept">
14032 <primary>expansion</primary>
14033 <secondary>statting a file</secondary>
14034 </indexterm>
14035 <indexterm role="concept">
14036 <primary>file</primary>
14037 <secondary>extracting characteristics</secondary>
14038 </indexterm>
14039 <indexterm role="concept">
14040 <primary><option>stat</option> expansion item</primary>
14041 </indexterm>
14042 The string, after expansion, must be a file path. A call to the <function>stat()</function>
14043 function is made for this path. If <function>stat()</function> fails, an error occurs and the
14044 expansion fails. If it succeeds, the data from the stat replaces the item, as a
14045 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
14046 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
14047 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
14048 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
14049 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
14050 can extract individual fields using the <option>extract</option> expansion item.
14051 </para>
14052 <para>
14053 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
14054 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
14055 systems for files larger than 2GB.
14056 </para>
14057 </listitem></varlistentry>
14058 <varlistentry>
14059 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14060 <listitem>
14061 <para>
14062 <indexterm role="concept">
14063 <primary>expansion</primary>
14064 <secondary>base64 encoding</secondary>
14065 </indexterm>
14066 <indexterm role="concept">
14067 <primary>base64 encoding</primary>
14068 <secondary>in string expansion</secondary>
14069 </indexterm>
14070 <indexterm role="concept">
14071 <primary><option>str2b64</option> expansion item</primary>
14072 </indexterm>
14073 This operator converts a string into one that is base64 encoded.
14074 </para>
14075 </listitem></varlistentry>
14076 <varlistentry>
14077 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14078 <listitem>
14079 <para>
14080 <indexterm role="concept">
14081 <primary>expansion</primary>
14082 <secondary>string length</secondary>
14083 </indexterm>
14084 <indexterm role="concept">
14085 <primary>string</primary>
14086 <secondary>length in expansion</secondary>
14087 </indexterm>
14088 <indexterm role="concept">
14089 <primary><option>strlen</option> expansion item</primary>
14090 </indexterm>
14091 The item is replace by the length of the expanded string, expressed as a
14092 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
14093 </para>
14094 </listitem></varlistentry>
14095 <varlistentry>
14096 <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>
14097 <listitem>
14098 <para>
14099 <indexterm role="concept">
14100 <primary><option>substr</option> expansion item</primary>
14101 </indexterm>
14102 <indexterm role="concept">
14103 <primary>substring extraction</primary>
14104 </indexterm>
14105 <indexterm role="concept">
14106 <primary>expansion</primary>
14107 <secondary>substring expansion</secondary>
14108 </indexterm>
14109 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
14110 can be used when the two parameters are fixed numbers (as opposed to strings
14111 that change when expanded). The effect is the same as
14112 </para>
14113 <literallayout class="monospaced">
14114 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
14115 </literallayout>
14116 <para>
14117 See the description of the general <option>substr</option> item above for details. The
14118 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
14119 </para>
14120 </listitem></varlistentry>
14121 <varlistentry>
14122 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14123 <listitem>
14124 <para>
14125 <indexterm role="concept">
14126 <primary><option>time_eval</option> expansion item</primary>
14127 </indexterm>
14128 <indexterm role="concept">
14129 <primary>time interval</primary>
14130 <secondary>decoding</secondary>
14131 </indexterm>
14132 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
14133 seconds.
14134 </para>
14135 </listitem></varlistentry>
14136 <varlistentry>
14137 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14138 <listitem>
14139 <para>
14140 <indexterm role="concept">
14141 <primary><option>time_interval</option> expansion item</primary>
14142 </indexterm>
14143 <indexterm role="concept">
14144 <primary>time interval</primary>
14145 <secondary>formatting</secondary>
14146 </indexterm>
14147 The argument (after sub-expansion) must be a sequence of decimal digits that
14148 represents an interval of time as a number of seconds. It is converted into a
14149 number of larger units and output in Exim&#x2019;s normal time format, for example,
14150 <literal>1w3d4h2m6s</literal>.
14151 </para>
14152 </listitem></varlistentry>
14153 <varlistentry>
14154 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14155 <listitem>
14156 <para>
14157 <indexterm role="concept">
14158 <primary>case forcing in strings</primary>
14159 </indexterm>
14160 <indexterm role="concept">
14161 <primary>string</primary>
14162 <secondary>case forcing</secondary>
14163 </indexterm>
14164 <indexterm role="concept">
14165 <primary>upper casing</primary>
14166 </indexterm>
14167 <indexterm role="concept">
14168 <primary>expansion</primary>
14169 <secondary>case forcing</secondary>
14170 </indexterm>
14171 <indexterm role="concept">
14172 <primary><option>uc</option> expansion item</primary>
14173 </indexterm>
14174 This forces the letters in the string into upper-case.
14175 </para>
14176 </listitem></varlistentry>
14177 </variablelist>
14178 </section>
14179 <section id="SECTexpcond">
14180 <title>Expansion conditions</title>
14181 <para>
14182 <indexterm role="concept">
14183 <primary>expansion</primary>
14184 <secondary>conditions</secondary>
14185 </indexterm>
14186 The following conditions are available for testing by the <option>${if</option> construct
14187 while expanding strings:
14188 </para>
14189 <variablelist>
14190 <varlistentry>
14191 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
14192 <listitem>
14193 <para>
14194 <indexterm role="concept">
14195 <primary>expansion</primary>
14196 <secondary>negating a condition</secondary>
14197 </indexterm>
14198 <indexterm role="concept">
14199 <primary>negation</primary>
14200 <secondary>in expansion condition</secondary>
14201 </indexterm>
14202 Preceding any condition with an exclamation mark negates the result of the
14203 condition.
14204 </para>
14205 </listitem></varlistentry>
14206 <varlistentry>
14207 <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>
14208 <listitem>
14209 <para>
14210 <indexterm role="concept">
14211 <primary>numeric comparison</primary>
14212 </indexterm>
14213 <indexterm role="concept">
14214 <primary>expansion</primary>
14215 <secondary>numeric comparison</secondary>
14216 </indexterm>
14217 There are a number of symbolic operators for doing numeric comparisons. They
14218 are:
14219 </para>
14220 <literallayout>
14221 <literal>=   </literal>   equal
14222 <literal>==  </literal>   equal
14223 <literal>&gt;   </literal>   greater
14224 <literal>&gt;=  </literal>   greater or equal
14225 <literal>&lt;   </literal>   less
14226 <literal>&lt;=  </literal>   less or equal
14227 </literallayout>
14228 <para>
14229 For example:
14230 </para>
14231 <literallayout class="monospaced">
14232 ${if &gt;{$message_size}{10M} ...
14233 </literallayout>
14234 <para>
14235 Note that the general negation operator provides for inequality testing. The
14236 two strings must take the form of optionally signed decimal integers,
14237 optionally followed by one of the letters <quote>K</quote> or <quote>M</quote> (in either upper or
14238 lower case), signifying multiplication by 1024 or 1024*1024, respectively.
14239 </para>
14240 </listitem></varlistentry>
14241 <varlistentry>
14242 <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>
14243 <listitem>
14244 <para>
14245 <indexterm role="concept">
14246 <primary>expansion</primary>
14247 <secondary>encrypted comparison</secondary>
14248 </indexterm>
14249 <indexterm role="concept">
14250 <primary>encrypted strings</primary>
14251 <secondary>comparing</secondary>
14252 </indexterm>
14253 <indexterm role="concept">
14254 <primary><option>crypteq</option> expansion condition</primary>
14255 </indexterm>
14256 This condition is included in the Exim binary if it is built to support any
14257 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
14258 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
14259 included in the binary.
14260 </para>
14261 <para>
14262 The <option>crypteq</option> condition has two arguments. The first is encrypted and
14263 compared against the second, which is already encrypted. The second string may
14264 be in the LDAP form for storing encrypted strings, which starts with the
14265 encryption type in curly brackets, followed by the data. If the second string
14266 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
14267 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
14268 Typically this will be a field from a password file. An example of an encrypted
14269 string in LDAP form is:
14270 </para>
14271 <literallayout class="monospaced">
14272 {md5}CY9rzUYh03PK3k6DJie09g==
14273 </literallayout>
14274 <para>
14275 If such a string appears directly in an expansion, the curly brackets have to
14276 be quoted, because they are part of the expansion syntax. For example:
14277 </para>
14278 <literallayout class="monospaced">
14279 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
14280 </literallayout>
14281 <para>
14282 The following encryption types (whose names are matched case-independently) are
14283 supported:
14284 </para>
14285 <itemizedlist>
14286 <listitem>
14287 <para>
14288 <indexterm role="concept">
14289 <primary>MD5 hash</primary>
14290 </indexterm>
14291 <indexterm role="concept">
14292 <primary>base64 encoding</primary>
14293 <secondary>in encrypted password</secondary>
14294 </indexterm>
14295 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
14296 printable characters to compare with the remainder of the second string. If the
14297 length of the comparison string is 24, Exim assumes that it is base64 encoded
14298 (as in the above example). If the length is 32, Exim assumes that it is a
14299 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
14300 comparison fails.
14301 </para>
14302 </listitem>
14303 <listitem>
14304 <para>
14305 <indexterm role="concept">
14306 <primary>SHA-1 hash</primary>
14307 </indexterm>
14308 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
14309 printable characters to compare with the remainder of the second string. If the
14310 length of the comparison string is 28, Exim assumes that it is base64 encoded.
14311 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
14312 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
14313 </para>
14314 </listitem>
14315 <listitem>
14316 <para>
14317 <indexterm role="concept">
14318 <primary><function>crypt()</function></primary>
14319 </indexterm>
14320 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
14321 only the first eight characters of the password. However, in modern operating
14322 systems this is no longer true, and in many cases the entire password is used,
14323 whatever its length.
14324 </para>
14325 </listitem>
14326 <listitem>
14327 <para>
14328 <indexterm role="concept">
14329 <primary><function>crypt16()</function></primary>
14330 </indexterm>
14331 <option>{crypt16}</option> calls the <function>crypt16()</function> function (also known as <function>bigcrypt()</function>),
14332 which was orginally created to use up to 16 characters of the password. Again,
14333 in modern operating systems, more characters may be used.
14334 </para>
14335 </listitem>
14336 </itemizedlist>
14337 <para>
14338 Exim has its own version of <function>crypt16()</function> (which is just a double call to
14339 <function>crypt()</function>). For operating systems that have their own version, setting
14340 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
14341 operating system version instead of its own. This option is set by default in
14342 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
14343 support <function>crypt16()</function>.
14344 </para>
14345 <para>
14346 If you do not put any curly bracket encryption type in a <option>crypteq</option>
14347 comparison, the default is either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as determined
14348 by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default default is
14349 <literal>{crypt}</literal>. Whatever the default, you can always use either function by
14350 specifying it explicitly in curly brackets.
14351 </para>
14352 <para>
14353 Note that if a password is no longer than 8 characters, the results of
14354 encrypting it with <function>crypt()</function> and <function>crypt16()</function> are identical. That means that
14355 <function>crypt16()</function> is backwards compatible, as long as nobody feeds it a password
14356 longer than 8 characters.
14357 </para>
14358 </listitem></varlistentry>
14359 <varlistentry>
14360 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
14361 <listitem>
14362 <para>
14363 <indexterm role="concept">
14364 <primary>expansion</primary>
14365 <secondary>checking for empty variable</secondary>
14366 </indexterm>
14367 <indexterm role="concept">
14368 <primary><option>def</option> expansion condition</primary>
14369 </indexterm>
14370 The <option>def</option> condition must be followed by the name of one of the expansion
14371 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
14372 variable does not contain the empty string. For example:
14373 </para>
14374 <literallayout class="monospaced">
14375 ${if def:sender_ident {from $sender_ident}}
14376 </literallayout>
14377 <para>
14378 Note that the variable name is given without a leading <option>$</option> character. If the
14379 variable does not exist, the expansion fails.
14380 </para>
14381 </listitem></varlistentry>
14382 <varlistentry>
14383 <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>
14384 <listitem>
14385 <para>
14386 <indexterm role="concept">
14387 <primary>expansion</primary>
14388 <secondary>checking header line existence</secondary>
14389 </indexterm>
14390 This condition is true if a message is being processed and the named header
14391 exists in the message. For example,
14392 </para>
14393 <literallayout class="monospaced">
14394 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
14395 </literallayout>
14396 <para>
14397 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
14398 the header name must be terminated by a colon if white space does not follow.
14399 </para>
14400 </listitem></varlistentry>
14401 <varlistentry>
14402 <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>
14403 <listitem>
14404 <para>
14405 <indexterm role="concept">
14406 <primary>string</primary>
14407 <secondary>comparison</secondary>
14408 </indexterm>
14409 <indexterm role="concept">
14410 <primary>expansion</primary>
14411 <secondary>string comparison</secondary>
14412 </indexterm>
14413 <indexterm role="concept">
14414 <primary><option>eq</option> expansion condition</primary>
14415 </indexterm>
14416 The two substrings are first expanded. The condition is true if the two
14417 resulting strings are identical, including the case of letters.
14418 </para>
14419 </listitem></varlistentry>
14420 <varlistentry>
14421 <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>
14422 <listitem>
14423 <para>
14424 <indexterm role="concept">
14425 <primary>string</primary>
14426 <secondary>comparison</secondary>
14427 </indexterm>
14428 <indexterm role="concept">
14429 <primary>expansion</primary>
14430 <secondary>string comparison</secondary>
14431 </indexterm>
14432 <indexterm role="concept">
14433 <primary><option>eqi</option> expansion condition</primary>
14434 </indexterm>
14435 The two substrings are first expanded. The condition is true if the two
14436 resulting strings are identical when compared in a case-independent way.
14437 </para>
14438 </listitem></varlistentry>
14439 <varlistentry>
14440 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14441 <listitem>
14442 <para>
14443 <indexterm role="concept">
14444 <primary>expansion</primary>
14445 <secondary>file existence test</secondary>
14446 </indexterm>
14447 <indexterm role="concept">
14448 <primary>file</primary>
14449 <secondary>existence test</secondary>
14450 </indexterm>
14451 <indexterm role="concept">
14452 <primary><option>exists</option>, expansion condition</primary>
14453 </indexterm>
14454 The substring is first expanded and then interpreted as an absolute path. The
14455 condition is true if the named file (or directory) exists. The existence test
14456 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
14457 users&#x2019; filter files may be locked out by the system administrator.
14458 </para>
14459 </listitem></varlistentry>
14460 <varlistentry>
14461 <term><emphasis role="bold">first_delivery</emphasis></term>
14462 <listitem>
14463 <para>
14464 <indexterm role="concept">
14465 <primary>delivery</primary>
14466 <secondary>first</secondary>
14467 </indexterm>
14468 <indexterm role="concept">
14469 <primary>first delivery</primary>
14470 </indexterm>
14471 <indexterm role="concept">
14472 <primary>expansion</primary>
14473 <secondary>first delivery test</secondary>
14474 </indexterm>
14475 <indexterm role="concept">
14476 <primary><option>first_delivery</option> expansion condition</primary>
14477 </indexterm>
14478 This condition, which has no data, is true during a message&#x2019;s first delivery
14479 attempt. It is false during any subsequent delivery attempts.
14480 </para>
14481 </listitem></varlistentry>
14482 <varlistentry>
14483 <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>
14484 <listitem>
14485 <para>
14486 <indexterm role="concept">
14487 <primary><option>ge</option> expansion condition</primary>
14488 </indexterm>
14489 See <emphasis role="bold">gei</emphasis>.
14490 </para>
14491 </listitem></varlistentry>
14492 <varlistentry>
14493 <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>
14494 <listitem>
14495 <para>
14496 <indexterm role="concept">
14497 <primary>string</primary>
14498 <secondary>comparison</secondary>
14499 </indexterm>
14500 <indexterm role="concept">
14501 <primary>expansion</primary>
14502 <secondary>string comparison</secondary>
14503 </indexterm>
14504 <indexterm role="concept">
14505 <primary><option>gei</option> expansion condition</primary>
14506 </indexterm>
14507 The two substrings are first expanded. The condition is true if the first
14508 string is lexically greater than or equal to the second string: for <option>ge</option> the
14509 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
14510 case-independent.
14511 </para>
14512 </listitem></varlistentry>
14513 <varlistentry>
14514 <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>
14515 <listitem>
14516 <para>
14517 <indexterm role="concept">
14518 <primary><option>gt</option> expansion condition</primary>
14519 </indexterm>
14520 See <emphasis role="bold">gti</emphasis>.
14521 </para>
14522 </listitem></varlistentry>
14523 <varlistentry>
14524 <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>
14525 <listitem>
14526 <para>
14527 <indexterm role="concept">
14528 <primary>string</primary>
14529 <secondary>comparison</secondary>
14530 </indexterm>
14531 <indexterm role="concept">
14532 <primary>expansion</primary>
14533 <secondary>string comparison</secondary>
14534 </indexterm>
14535 <indexterm role="concept">
14536 <primary><option>gti</option> expansion condition</primary>
14537 </indexterm>
14538 The two substrings are first expanded. The condition is true if the first
14539 string is lexically greater than the second string: for <option>gt</option> the comparison
14540 includes the case of letters, whereas for <option>gti</option> the comparison is
14541 case-independent.
14542 </para>
14543 </listitem></varlistentry>
14544 <varlistentry>
14545 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14546 <listitem>
14547 <para>
14548 <indexterm role="concept">
14549 <primary><option>isip</option> expansion condition</primary>
14550 </indexterm>
14551 See <emphasis role="bold">isip6</emphasis>.
14552 </para>
14553 </listitem></varlistentry>
14554 <varlistentry>
14555 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14556 <listitem>
14557 <para>
14558 <indexterm role="concept">
14559 <primary><option>isip4</option> expansion condition</primary>
14560 </indexterm>
14561 See <emphasis role="bold">isip6</emphasis>.
14562 </para>
14563 </listitem></varlistentry>
14564 <varlistentry>
14565 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14566 <listitem>
14567 <para>
14568 <indexterm role="concept">
14569 <primary>IP address</primary>
14570 <secondary>testing string format</secondary>
14571 </indexterm>
14572 <indexterm role="concept">
14573 <primary>string</primary>
14574 <secondary>testing for IP address</secondary>
14575 </indexterm>
14576 <indexterm role="concept">
14577 <primary><option>isip6</option> expansion condition</primary>
14578 </indexterm>
14579 The substring is first expanded, and then tested to see if it has the form of
14580 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
14581 <option>isip4</option> and <option>isip6</option> test just for IPv4 or IPv6 addresses, respectively. For
14582 example, you could use
14583 </para>
14584 <literallayout class="monospaced">
14585 ${if isip4{$sender_host_address}...
14586 </literallayout>
14587 <para>
14588 to test which version of IP an incoming SMTP connection is using.
14589 </para>
14590 </listitem></varlistentry>
14591 <varlistentry>
14592 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14593 <listitem>
14594 <para>
14595 <indexterm role="concept">
14596 <primary>LDAP</primary>
14597 <secondary>use for authentication</secondary>
14598 </indexterm>
14599 <indexterm role="concept">
14600 <primary>expansion</primary>
14601 <secondary>LDAP authentication test</secondary>
14602 </indexterm>
14603 <indexterm role="concept">
14604 <primary><option>ldapauth</option> expansion condition</primary>
14605 </indexterm>
14606 This condition supports user authentication using LDAP. See section
14607 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
14608 queries. For this use, the query must contain a user name and password. The
14609 query itself is not used, and can be empty. The condition is true if the
14610 password is not empty, and the user name and password are accepted by the LDAP
14611 server. An empty password is rejected without calling LDAP because LDAP binds
14612 with an empty password are considered anonymous regardless of the username, and
14613 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
14614 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
14615 this can be used.
14616 </para>
14617 </listitem></varlistentry>
14618 <varlistentry>
14619 <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>
14620 <listitem>
14621 <para>
14622 <indexterm role="concept">
14623 <primary><option>le</option> expansion condition</primary>
14624 </indexterm>
14625 See <emphasis role="bold">lei</emphasis>.
14626 </para>
14627 </listitem></varlistentry>
14628 <varlistentry>
14629 <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>
14630 <listitem>
14631 <para>
14632 <indexterm role="concept">
14633 <primary>string</primary>
14634 <secondary>comparison</secondary>
14635 </indexterm>
14636 <indexterm role="concept">
14637 <primary>expansion</primary>
14638 <secondary>string comparison</secondary>
14639 </indexterm>
14640 <indexterm role="concept">
14641 <primary><option>lei</option> expansion condition</primary>
14642 </indexterm>
14643 The two substrings are first expanded. The condition is true if the first
14644 string is lexically less than or equal to the second string: for <option>le</option> the
14645 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
14646 case-independent.
14647 </para>
14648 </listitem></varlistentry>
14649 <varlistentry>
14650 <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>
14651 <listitem>
14652 <para>
14653 <indexterm role="concept">
14654 <primary><option>lt</option> expansion condition</primary>
14655 </indexterm>
14656 See <emphasis role="bold">lti</emphasis>.
14657 </para>
14658 </listitem></varlistentry>
14659 <varlistentry>
14660 <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>
14661 <listitem>
14662 <para>
14663 <indexterm role="concept">
14664 <primary>string</primary>
14665 <secondary>comparison</secondary>
14666 </indexterm>
14667 <indexterm role="concept">
14668 <primary>expansion</primary>
14669 <secondary>string comparison</secondary>
14670 </indexterm>
14671 <indexterm role="concept">
14672 <primary><option>lti</option> expansion condition</primary>
14673 </indexterm>
14674 The two substrings are first expanded. The condition is true if the first
14675 string is lexically less than the second string: for <option>lt</option> the comparison
14676 includes the case of letters, whereas for <option>lti</option> the comparison is
14677 case-independent.
14678 </para>
14679 </listitem></varlistentry>
14680 <varlistentry>
14681 <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>
14682 <listitem>
14683 <para>
14684 <indexterm role="concept">
14685 <primary>expansion</primary>
14686 <secondary>regular expression comparison</secondary>
14687 </indexterm>
14688 <indexterm role="concept">
14689 <primary>regular expressions</primary>
14690 <secondary>match in expanded string</secondary>
14691 </indexterm>
14692 <indexterm role="concept">
14693 <primary><option>match</option>, expansion condition</primary>
14694 </indexterm>
14695 The two substrings are first expanded. The second is then treated as a regular
14696 expression and applied to the first. Because of the pre-expansion, if the
14697 regular expression contains dollar, or backslash characters, they must be
14698 escaped. Care must also be taken if the regular expression contains braces
14699 (curly brackets). A closing brace must be escaped so that it is not taken as a
14700 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
14701 <literal>\N</literal> feature to disable expansion of the regular expression.
14702 For example,
14703 </para>
14704 <literallayout class="monospaced">
14705 ${if match {$local_part}{\N^\d{3}\N} ...
14706 </literallayout>
14707 <para>
14708 If the whole expansion string is in double quotes, further escaping of
14709 backslashes is also required.
14710 </para>
14711 <para>
14712 The condition is true if the regular expression match succeeds.
14713 The regular expression is not required to begin with a circumflex
14714 metacharacter, but if there is no circumflex, the expression is not anchored,
14715 and it may match anywhere in the subject, not just at the start. If you want
14716 the pattern to match at the end of the subject, you must include the <literal>$</literal>
14717 metacharacter at an appropriate point.
14718 </para>
14719 <para>
14720 <indexterm role="concept">
14721 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
14722 <secondary>in <option>if</option> expansion</secondary>
14723 </indexterm>
14724 At the start of an <option>if</option> expansion the values of the numeric variable
14725 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
14726 succeeds causes them to be reset to the substrings of that condition and they
14727 will have these values during the expansion of the success string. At the end
14728 of the <option>if</option> expansion, the previous values are restored. After testing a
14729 combination of conditions using <option>or</option>, the subsequent values of the numeric
14730 variables are those of the condition that succeeded.
14731 </para>
14732 </listitem></varlistentry>
14733 <varlistentry>
14734 <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>
14735 <listitem>
14736 <para>
14737 <indexterm role="concept">
14738 <primary><option>match_address</option> expansion condition</primary>
14739 </indexterm>
14740 See <emphasis role="bold">match_local_part</emphasis>.
14741 </para>
14742 </listitem></varlistentry>
14743 <varlistentry>
14744 <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>
14745 <listitem>
14746 <para>
14747 <indexterm role="concept">
14748 <primary><option>match_domain</option> expansion condition</primary>
14749 </indexterm>
14750 See <emphasis role="bold">match_local_part</emphasis>.
14751 </para>
14752 </listitem></varlistentry>
14753 <varlistentry>
14754 <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>
14755 <listitem>
14756 <para>
14757 <indexterm role="concept">
14758 <primary><option>match_ip</option> expansion condition</primary>
14759 </indexterm>
14760 This condition matches an IP address to a list of IP address patterns. It must
14761 be followed by two argument strings. The first (after expansion) must be an IP
14762 address or an empty string. The second (after expansion) is a restricted host
14763 list that can match only an IP address, not a host name. For example:
14764 </para>
14765 <literallayout class="monospaced">
14766 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
14767 </literallayout>
14768 <para>
14769 The specific types of host list item that are permitted in the list are:
14770 </para>
14771 <itemizedlist>
14772 <listitem>
14773 <para>
14774 An IP address, optionally with a CIDR mask.
14775 </para>
14776 </listitem>
14777 <listitem>
14778 <para>
14779 A single asterisk, which matches any IP address.
14780 </para>
14781 </listitem>
14782 <listitem>
14783 <para>
14784 An empty item, which matches only if the IP address is empty. This could be
14785 useful for testing for a locally submitted message or one from specific hosts
14786 in a single test such as
14787 </para>
14788 <literallayout class="monospaced">
14789   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
14790 </literallayout>
14791 <para>
14792 where the first item in the list is the empty string.
14793 </para>
14794 </listitem>
14795 <listitem>
14796 <para>
14797 The item @[] matches any of the local host&#x2019;s interface addresses.
14798 </para>
14799 </listitem>
14800 <listitem>
14801 <para>
14802 Lookups are assumed to be <quote>net-</quote> style lookups, even if <literal>net-</literal> is not
14803 specified. Thus, the following are equivalent:
14804 </para>
14805 <literallayout class="monospaced">
14806   ${if match_ip{$sender_host_address}{lsearch;/some/file}...
14807   ${if match_ip{$sender_host_address}{net-lsearch;/some/file}...
14808 </literallayout>
14809 <para revisionflag="changed">
14810 You do need to specify the <literal>net-</literal> prefix if you want to specify a
14811 specific address mask, for example, by using <literal>net24-</literal>. However, unless you
14812 are combining a <option>match_ip</option> condition with others, it is usually neater to use
14813 an expansion lookup such as:
14814 </para>
14815 <literallayout class="monospaced" revisionflag="changed">
14816   ${lookup{${mask:$sender_host_address/24}}lsearch{/some/file}...
14817 </literallayout>
14818 </listitem>
14819 </itemizedlist>
14820 <para>
14821 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
14822 </para>
14823 </listitem></varlistentry>
14824 <varlistentry>
14825 <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>
14826 <listitem>
14827 <para>
14828 <indexterm role="concept">
14829 <primary>domain list</primary>
14830 <secondary>in expansion condition</secondary>
14831 </indexterm>
14832 <indexterm role="concept">
14833 <primary>address list</primary>
14834 <secondary>in expansion condition</secondary>
14835 </indexterm>
14836 <indexterm role="concept">
14837 <primary>local part list</primary>
14838 <secondary>in expansion condition</secondary>
14839 </indexterm>
14840 <indexterm role="concept">
14841 <primary><option>match_local_part</option> expansion condition</primary>
14842 </indexterm>
14843 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
14844 possible to test domain, address, and local part lists within expansions. Each
14845 condition requires two arguments: an item and a list to match. A trivial
14846 example is:
14847 </para>
14848 <literallayout class="monospaced">
14849 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
14850 </literallayout>
14851 <para>
14852 In each case, the second argument may contain any of the allowable items for a
14853 list of the appropriate type. Also, because the second argument (after
14854 expansion) is a standard form of list, it is possible to refer to a named list.
14855 Thus, you can use conditions like this:
14856 </para>
14857 <literallayout class="monospaced">
14858 ${if match_domain{$domain}{+local_domains}{...
14859 </literallayout>
14860 <para>
14861 <indexterm role="concept">
14862 <primary><literal>+caseful</literal></primary>
14863 </indexterm>
14864 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
14865 item can be used, as in all address lists, to cause subsequent items to
14866 have their local parts matched casefully. Domains are always matched
14867 caselessly.
14868 </para>
14869 <para>
14870 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
14871 hosts have two identities: a name and an IP address, and it is not clear
14872 how to specify cleanly how such a test would work. However, IP addresses can be
14873 matched using <option>match_ip</option>.
14874 </para>
14875 </listitem></varlistentry>
14876 <varlistentry>
14877 <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>
14878 <listitem>
14879 <para>
14880 <indexterm role="concept">
14881 <primary>PAM authentication</primary>
14882 </indexterm>
14883 <indexterm role="concept">
14884 <primary>AUTH</primary>
14885 <secondary>with PAM</secondary>
14886 </indexterm>
14887 <indexterm role="concept">
14888 <primary>Solaris</primary>
14889 <secondary>PAM support</secondary>
14890 </indexterm>
14891 <indexterm role="concept">
14892 <primary>expansion</primary>
14893 <secondary>PAM authentication test</secondary>
14894 </indexterm>
14895 <indexterm role="concept">
14896 <primary><option>pam</option> expansion condition</primary>
14897 </indexterm>
14898 <emphasis>Pluggable Authentication Modules</emphasis>
14899 (<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
14900 available in the latest releases of Solaris and in some GNU/Linux
14901 distributions. The Exim support, which is intended for use in conjunction with
14902 the SMTP AUTH command, is available only if Exim is compiled with
14903 </para>
14904 <literallayout class="monospaced">
14905 SUPPORT_PAM=yes
14906 </literallayout>
14907 <para>
14908 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
14909 in some releases of GNU/Linux <option>-ldl</option> is also needed.
14910 </para>
14911 <para>
14912 The argument string is first expanded, and the result must be a
14913 colon-separated list of strings. Leading and trailing white space is ignored.
14914 The PAM module is initialized with the service name <quote>exim</quote> and the user name
14915 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
14916 The remaining items in the data string are passed over in response to requests
14917 from the authentication function. In the simple case there will only be one
14918 request, for a password, so the data consists of just two strings.
14919 </para>
14920 <para>
14921 There can be problems if any of the strings are permitted to contain colon
14922 characters. In the usual way, these have to be doubled to avoid being taken as
14923 separators. If the data is being inserted from a variable, the <option>sg</option> expansion
14924 item can be used to double any existing colons. For example, the configuration
14925 of a LOGIN authenticator might contain this setting:
14926 </para>
14927 <literallayout class="monospaced" revisionflag="changed">
14928 server_condition = ${if pam{$auth1:${sg{$auth2}{:}{::}}}}
14929 </literallayout>
14930 <para revisionflag="changed">
14931 For a PLAIN authenticator you could use:
14932 </para>
14933 <literallayout class="monospaced" revisionflag="changed">
14934 server_condition = ${if pam{$auth2:${sg{$auth3}{:}{::}}}}
14935 </literallayout>
14936 <para>
14937 In some operating systems, PAM authentication can be done only from a process
14938 running as root. Since Exim is running as the Exim user when receiving
14939 messages, this means that PAM cannot be used directly in those systems.
14940 A patched version of the <emphasis>pam_unix</emphasis> module that comes with the
14941 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>.
14942 The patched module allows one special uid/gid combination, in addition to root,
14943 to authenticate. If you build the patched module to allow the Exim user and
14944 group, PAM can then be used from an Exim authenticator.
14945 </para>
14946 </listitem></varlistentry>
14947 <varlistentry>
14948 <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>
14949 <listitem>
14950 <para>
14951 <indexterm role="concept">
14952 <primary><emphasis>pwcheck</emphasis> daemon</primary>
14953 </indexterm>
14954 <indexterm role="concept">
14955 <primary>Cyrus</primary>
14956 </indexterm>
14957 <indexterm role="concept">
14958 <primary>expansion</primary>
14959 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
14960 </indexterm>
14961 <indexterm role="concept">
14962 <primary><option>pwcheck</option> expansion condition</primary>
14963 </indexterm>
14964 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
14965 This is one way of making it possible for passwords to be checked by a process
14966 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
14967 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
14968 </para>
14969 <para>
14970 The pwcheck support is not included in Exim by default. You need to specify
14971 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
14972 building Exim. For example:
14973 </para>
14974 <literallayout class="monospaced">
14975 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
14976 </literallayout>
14977 <para>
14978 You do not need to install the full Cyrus software suite in order to use
14979 the pwcheck daemon. You can compile and install just the daemon alone
14980 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
14981 access to the <filename>/var/pwcheck</filename> directory.
14982 </para>
14983 <para>
14984 The <option>pwcheck</option> condition takes one argument, which must be the user name and
14985 password, separated by a colon. For example, in a LOGIN authenticator
14986 configuration, you might have this:
14987 </para>
14988 <literallayout class="monospaced" revisionflag="changed">
14989 server_condition = ${if pwcheck{$auth1:$auth2}}
14990 </literallayout>
14991 </listitem></varlistentry>
14992 <varlistentry>
14993 <term><emphasis role="bold">queue_running</emphasis></term>
14994 <listitem>
14995 <para>
14996 <indexterm role="concept">
14997 <primary>queue runner</primary>
14998 <secondary>detecting when delivering from</secondary>
14999 </indexterm>
15000 <indexterm role="concept">
15001 <primary>expansion</primary>
15002 <secondary>queue runner test</secondary>
15003 </indexterm>
15004 <indexterm role="concept">
15005 <primary><option>queue_runnint</option> expansion condition</primary>
15006 </indexterm>
15007 This condition, which has no data, is true during delivery attempts that are
15008 initiated by queue runner processes, and false otherwise.
15009 </para>
15010 </listitem></varlistentry>
15011 <varlistentry>
15012 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
15013 <listitem>
15014 <para>
15015 <indexterm role="concept">
15016 <primary>Radius</primary>
15017 </indexterm>
15018 <indexterm role="concept">
15019 <primary>expansion</primary>
15020 <secondary>Radius authentication</secondary>
15021 </indexterm>
15022 <indexterm role="concept">
15023 <primary><option>radiu</option> expansion condition</primary>
15024 </indexterm>
15025 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
15026 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
15027 the Radius client configuration file in order to build Exim with Radius
15028 support.
15029 </para>
15030 <para>
15031 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
15032 library, using the original API. If you are using release 0.4.0 or later of
15033 this library, you need to set
15034 </para>
15035 <literallayout class="monospaced">
15036 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
15037 </literallayout>
15038 <para>
15039 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
15040 <option>libradius</option> library that comes with FreeBSD. To do this, set
15041 </para>
15042 <literallayout class="monospaced">
15043 RADIUS_LIB_TYPE=RADLIB
15044 </literallayout>
15045 <para>
15046 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
15047 You may also have to supply a suitable setting in EXTRALIBS so that the
15048 Radius library can be found when Exim is linked.
15049 </para>
15050 <para>
15051 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
15052 Radius client library, which calls the Radius server. The condition is true if
15053 the authentication is successful. For example:
15054 </para>
15055 <literallayout class="monospaced">
15056 server_condition = ${if radius{&lt;arguments&gt;}}
15057 </literallayout>
15058 </listitem></varlistentry>
15059 <varlistentry>
15060 <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>
15061 <listitem>
15062 <para>
15063 <indexterm role="concept">
15064 <primary><emphasis>saslauthd</emphasis> daemon</primary>
15065 </indexterm>
15066 <indexterm role="concept">
15067 <primary>Cyrus</primary>
15068 </indexterm>
15069 <indexterm role="concept">
15070 <primary>expansion</primary>
15071 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
15072 </indexterm>
15073 <indexterm role="concept">
15074 <primary><option>saslauthd</option> expansion condition</primary>
15075 </indexterm>
15076 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
15077 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
15078 Using this daemon is one way of making it possible for passwords to be checked
15079 by a process that is not running as root.
15080 </para>
15081 <para>
15082 The saslauthd support is not included in Exim by default. You need to specify
15083 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
15084 building Exim. For example:
15085 </para>
15086 <literallayout class="monospaced">
15087 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
15088 </literallayout>
15089 <para>
15090 You do not need to install the full Cyrus software suite in order to use
15091 the saslauthd daemon. You can compile and install just the daemon alone
15092 from the Cyrus SASL library.
15093 </para>
15094 <para>
15095 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
15096 two are mandatory. For example:
15097 </para>
15098 <literallayout class="monospaced" revisionflag="changed">
15099 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
15100 </literallayout>
15101 <para>
15102 The service and the realm are optional (which is why the arguments are enclosed
15103 in their own set of braces). For details of the meaning of the service and
15104 realm, and how to run the daemon, consult the Cyrus documentation.
15105 </para>
15106 </listitem></varlistentry>
15107 </variablelist>
15108 </section>
15109 <section>
15110 <title>Combining expansion conditions</title>
15111 <para>
15112 <indexterm role="concept">
15113 <primary>expansion</primary>
15114 <secondary>combining conditions</secondary>
15115 </indexterm>
15116 Several conditions can be tested at once by combining them using the <option>and</option>
15117 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
15118 conditions on their own, and precede their lists of sub-conditions. Each
15119 sub-condition must be enclosed in braces within the overall braces that contain
15120 the list. No repetition of <option>if</option> is used.
15121 </para>
15122 <variablelist>
15123 <varlistentry>
15124 <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>
15125 <listitem>
15126 <para>
15127 <indexterm role="concept">
15128 <primary><quote>or</quote> expansion condition</primary>
15129 </indexterm>
15130 <indexterm role="concept">
15131 <primary>expansion</primary>
15132 <secondary><quote>or</quote> of conditions</secondary>
15133 </indexterm>
15134 The sub-conditions are evaluated from left to right. The condition is true if
15135 any one of the sub-conditions is true.
15136 For example,
15137 </para>
15138 <literallayout class="monospaced">
15139 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
15140 </literallayout>
15141 <para>
15142 When a true sub-condition is found, the following ones are parsed but not
15143 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
15144 numeric variables afterwards are taken from the first one that succeeds.
15145 </para>
15146 </listitem></varlistentry>
15147 <varlistentry>
15148 <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>
15149 <listitem>
15150 <para>
15151 <indexterm role="concept">
15152 <primary><quote>and</quote> expansion condition</primary>
15153 </indexterm>
15154 <indexterm role="concept">
15155 <primary>expansion</primary>
15156 <secondary><quote>and</quote> of conditions</secondary>
15157 </indexterm>
15158 The sub-conditions are evaluated from left to right. The condition is true if
15159 all of the sub-conditions are true. If there are several <quote>match</quote>
15160 sub-conditions, the values of the numeric variables afterwards are taken from
15161 the last one. When a false sub-condition is found, the following ones are
15162 parsed but not evaluated.
15163 </para>
15164 </listitem></varlistentry>
15165 </variablelist>
15166 </section>
15167 <section id="SECTexpvar">
15168 <title>Expansion variables</title>
15169 <para>
15170 <indexterm role="concept">
15171 <primary>expansion variables</primary>
15172 <secondary>list of</secondary>
15173 </indexterm>
15174 This section contains an alphabetical list of all the expansion variables. Some
15175 of them are available only when Exim is compiled with specific options such as
15176 support for TLS or the content scanning extension.
15177 </para>
15178 <variablelist>
15179 <varlistentry>
15180 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
15181 <listitem>
15182 <para>
15183 <indexterm role="concept">
15184 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15185 </indexterm>
15186 When a <option>match</option> expansion condition succeeds, these variables contain the
15187 captured substrings identified by the regular expression during subsequent
15188 processing of the success string of the containing <option>if</option> expansion item. They
15189 may also be set externally by some other matching process which precedes the
15190 expansion of the string. For example, the commands available in Exim filter
15191 files include an <option>if</option> command with its own regular expression matching
15192 condition.
15193 </para>
15194 </listitem></varlistentry>
15195 <varlistentry>
15196 <term><varname>$acl_c0</varname> &ndash; <varname>$acl_c19</varname></term>
15197 <listitem>
15198 <para>
15199 Values can be placed in these variables by the <option>set</option> modifier in an ACL. The
15200 values persist throughout the lifetime of an SMTP connection. They can be used
15201 to pass information between ACLs and between different invocations of the same
15202 ACL. When a message is received, the values of these variables are saved with
15203 the message, and can be accessed by filters, routers, and transports during
15204 subsequent delivery.
15205 </para>
15206 </listitem></varlistentry>
15207 <varlistentry>
15208 <term><varname>$acl_m0</varname> &ndash; <varname>$acl_m19</varname></term>
15209 <listitem>
15210 <para>
15211 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
15212 retain their values while a message is being received, but are reset
15213 afterwards. They are also reset by MAIL, RSET, EHLO, HELO, and after starting a
15214 TLS session. When a message is received, the values of these variables are
15215 saved with the message, and can be accessed by filters, routers, and transports
15216 during subsequent delivery.
15217 </para>
15218 </listitem></varlistentry>
15219 <varlistentry>
15220 <term><varname>$acl_verify_message</varname></term>
15221 <listitem>
15222 <para>
15223 <indexterm role="concept">
15224 <primary><varname>$acl_verify_message</varname></primary>
15225 </indexterm>
15226 After an address verification has failed, this variable contains the failure
15227 message. It retains its value for use in subsequent modifiers. The message can
15228 be preserved by coding like this:
15229 </para>
15230 <literallayout class="monospaced">
15231 warn !verify = sender
15232      set acl_m0 = $acl_verify_message
15233 </literallayout>
15234 <para>
15235 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
15236 <option>log_message</option> modifiers, to include information about the verification
15237 failure.
15238 </para>
15239 </listitem></varlistentry>
15240 <varlistentry>
15241 <term><varname>$address_data</varname></term>
15242 <listitem>
15243 <para>
15244 <indexterm role="concept">
15245 <primary><varname>$address_data</varname></primary>
15246 </indexterm>
15247 This variable is set by means of the <option>address_data</option> option in routers. The
15248 value then remains with the address while it is processed by subsequent routers
15249 and eventually a transport. If the transport is handling multiple addresses,
15250 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
15251 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
15252 user filter files.
15253 </para>
15254 <para>
15255 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
15256 a recipient address, the final value is still in the variable for subsequent
15257 conditions and modifiers of the ACL statement. If routing the address caused it
15258 to be redirected to just one address, the child address is also routed as part
15259 of the verification, and in this case the final value of <varname>$address_data</varname> is
15260 from the child&#x2019;s routing.
15261 </para>
15262 <para>
15263 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
15264 sender address, the final value is also preserved, but this time in
15265 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
15266 address.
15267 </para>
15268 <para>
15269 In both cases (recipient and sender verification), the value does not persist
15270 after the end of the current ACL statement. If you want to preserve
15271 these values for longer, you can save them in ACL variables.
15272 </para>
15273 </listitem></varlistentry>
15274 <varlistentry>
15275 <term><varname>$address_file</varname></term>
15276 <listitem>
15277 <para>
15278 <indexterm role="concept">
15279 <primary><varname>$address_file</varname></primary>
15280 </indexterm>
15281 When, as a result of aliasing, forwarding, or filtering, a message is directed
15282 to a specific file, this variable holds the name of the file when the transport
15283 is running. At other times, the variable is empty. For example, using the
15284 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
15285 </para>
15286 <literallayout class="monospaced">
15287 /home/r2d2/savemail
15288 </literallayout>
15289 <para>
15290 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
15291 contains <quote>/home/r2d2/savemail</quote>.
15292 </para>
15293 <para>
15294 <indexterm role="concept">
15295 <primary>Sieve filter</primary>
15296 <secondary>value of <varname>$address_file</varname></secondary>
15297 </indexterm>
15298 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
15299 then up to the transport configuration to generate an appropriate absolute path
15300 to the relevant file.
15301 </para>
15302 </listitem></varlistentry>
15303 <varlistentry>
15304 <term><varname>$address_pipe</varname></term>
15305 <listitem>
15306 <para>
15307 <indexterm role="concept">
15308 <primary><varname>$address_pipe</varname></primary>
15309 </indexterm>
15310 When, as a result of aliasing or forwarding, a message is directed to a pipe,
15311 this variable holds the pipe command when the transport is running.
15312 </para>
15313 </listitem></varlistentry>
15314 <varlistentry>
15315 <term><varname>$auth1</varname> &ndash; <varname>$auth3</varname></term>
15316 <listitem>
15317 <para>
15318 <indexterm role="concept">
15319 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
15320 </indexterm>
15321 These variables are used in SMTP authenticators (see chapters
15322 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPspa"/>). Elsewhere, they are empty.
15323 </para>
15324 </listitem></varlistentry>
15325 <varlistentry>
15326 <term><varname>$authenticated_id</varname></term>
15327 <listitem>
15328 <para>
15329 <indexterm role="concept">
15330 <primary>authentication</primary>
15331 <secondary>id</secondary>
15332 </indexterm>
15333 <indexterm role="concept">
15334 <primary><varname>$authenticated_id</varname></primary>
15335 </indexterm>
15336 When a server successfully authenticates a client it may be configured to
15337 preserve some of the authentication information in the variable
15338 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
15339 user/password authenticator configuration might preserve the user name for use
15340 in the routers. Note that this is not the same information that is saved in
15341 <varname>$sender_host_authenticated</varname>.
15342 <phrase revisionflag="changed">When a message is submitted locally (that is, not over a TCP connection)
15343 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
15344 process. However, a trusted user can override this by means of the <option>-oMai</option>
15345 command line option.</phrase>
15346 </para>
15347 </listitem></varlistentry>
15348 <varlistentry>
15349 <term><varname>$authenticated_sender</varname></term>
15350 <listitem>
15351 <para>
15352 <indexterm role="concept">
15353 <primary>sender</primary>
15354 <secondary>authenticated</secondary>
15355 </indexterm>
15356 <indexterm role="concept">
15357 <primary>authentication</primary>
15358 <secondary>sender</secondary>
15359 </indexterm>
15360 <indexterm role="concept">
15361 <primary>AUTH</primary>
15362 <secondary>on MAIL command</secondary>
15363 </indexterm>
15364 <indexterm role="concept">
15365 <primary><varname>$authenticated_sender</varname></primary>
15366 </indexterm>
15367 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
15368 SMTP MAIL command if it believes the sender is sufficiently trusted, as
15369 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
15370 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
15371 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
15372 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
15373 </para>
15374 <para revisionflag="changed">
15375 <indexterm role="concept">
15376 <primary><varname>$qualify_domain</varname></primary>
15377 </indexterm>
15378 When a message is submitted locally (that is, not over a TCP connection), the
15379 value of <varname>$authenticated_sender</varname> is an address constructed from the login
15380 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
15381 can override this by means of the <option>-oMas</option> command line option.
15382 </para>
15383 </listitem></varlistentry>
15384 <varlistentry>
15385 <term><varname>$authentication_failed</varname></term>
15386 <listitem>
15387 <para>
15388 <indexterm role="concept">
15389 <primary>authentication</primary>
15390 <secondary>failure</secondary>
15391 </indexterm>
15392 <indexterm role="concept">
15393 <primary><varname>$authentication_failed</varname></primary>
15394 </indexterm>
15395 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
15396 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
15397 possible to distinguish between <quote>did not try to authenticate</quote>
15398 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
15399 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
15400 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>). Failure includes any
15401 negative response to an AUTH command, including (for example) an attempt to use
15402 an undefined mechanism.
15403 </para>
15404 </listitem></varlistentry>
15405 <varlistentry>
15406 <term><varname>$body_linecount</varname></term>
15407 <listitem>
15408 <para>
15409 <indexterm role="concept">
15410 <primary>message body</primary>
15411 <secondary>line count</secondary>
15412 </indexterm>
15413 <indexterm role="concept">
15414 <primary>body of message</primary>
15415 <secondary>line count</secondary>
15416 </indexterm>
15417 <indexterm role="concept">
15418 <primary><varname>$body_linecount</varname></primary>
15419 </indexterm>
15420 When a message is being received or delivered, this variable contains the
15421 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
15422 </para>
15423 </listitem></varlistentry>
15424 <varlistentry>
15425 <term><varname>$body_zerocount</varname></term>
15426 <listitem>
15427 <para>
15428 <indexterm role="concept">
15429 <primary>message body</primary>
15430 <secondary>binary zero count</secondary>
15431 </indexterm>
15432 <indexterm role="concept">
15433 <primary>body of message</primary>
15434 <secondary>binary zero count</secondary>
15435 </indexterm>
15436 <indexterm role="concept">
15437 <primary>binary zero</primary>
15438 <secondary>in message body</secondary>
15439 </indexterm>
15440 <indexterm role="concept">
15441 <primary><varname>$body_zerocount</varname></primary>
15442 </indexterm>
15443 When a message is being received or delivered, this variable contains the
15444 number of binary zero bytes in the message&#x2019;s body.
15445 </para>
15446 </listitem></varlistentry>
15447 <varlistentry>
15448 <term><varname>$bounce_recipient</varname></term>
15449 <listitem>
15450 <para>
15451 <indexterm role="concept">
15452 <primary><varname>$bounce_recipient</varname></primary>
15453 </indexterm>
15454 This is set to the recipient address of a bounce message while Exim is creating
15455 it. It is useful if a customized bounce message text file is in use (see
15456 chapter <xref linkend="CHAPemsgcust"/>).
15457 </para>
15458 </listitem></varlistentry>
15459 <varlistentry>
15460 <term><varname>$bounce_return_size_limit</varname></term>
15461 <listitem>
15462 <para>
15463 <indexterm role="concept">
15464 <primary><varname>$bounce_return_size_limit</varname></primary>
15465 </indexterm>
15466 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
15467 up to a multiple of 1000. It is useful when a customized error message text
15468 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
15469 </para>
15470 </listitem></varlistentry>
15471 <varlistentry>
15472 <term><varname>$caller_gid</varname></term>
15473 <listitem>
15474 <para>
15475 <indexterm role="concept">
15476 <primary>gid (group id)</primary>
15477 <secondary>caller</secondary>
15478 </indexterm>
15479 <indexterm role="concept">
15480 <primary><varname>$caller_gid</varname></primary>
15481 </indexterm>
15482 The real group id under which the process that called Exim was running. This is
15483 not the same as the group id of the originator of a message (see
15484 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
15485 incarnation normally contains the Exim gid.
15486 </para>
15487 </listitem></varlistentry>
15488 <varlistentry>
15489 <term><varname>$caller_uid</varname></term>
15490 <listitem>
15491 <para>
15492 <indexterm role="concept">
15493 <primary>uid (user id)</primary>
15494 <secondary>caller</secondary>
15495 </indexterm>
15496 <indexterm role="concept">
15497 <primary><varname>$caller_uid</varname></primary>
15498 </indexterm>
15499 The real user id under which the process that called Exim was running. This is
15500 not the same as the user id of the originator of a message (see
15501 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
15502 incarnation normally contains the Exim uid.
15503 </para>
15504 </listitem></varlistentry>
15505 <varlistentry>
15506 <term><varname>$compile_date</varname></term>
15507 <listitem>
15508 <para>
15509 <indexterm role="concept">
15510 <primary><varname>$compile_date</varname></primary>
15511 </indexterm>
15512 The date on which the Exim binary was compiled.
15513 </para>
15514 </listitem></varlistentry>
15515 <varlistentry>
15516 <term><varname>$compile_number</varname></term>
15517 <listitem>
15518 <para>
15519 <indexterm role="concept">
15520 <primary><varname>$compile_number</varname></primary>
15521 </indexterm>
15522 The building process for Exim keeps a count of the number
15523 of times it has been compiled. This serves to distinguish different
15524 compilations of the same version of the program.
15525 </para>
15526 </listitem></varlistentry>
15527 <varlistentry>
15528 <term><varname>$demime_errorlevel</varname></term>
15529 <listitem>
15530 <para>
15531 <indexterm role="concept">
15532 <primary><varname>$demime_errorlevel</varname></primary>
15533 </indexterm>
15534 This variable is available when Exim is compiled with
15535 the content-scanning extension and the obsolete <option>demime</option> condition. For
15536 details, see section <xref linkend="SECTdemimecond"/>.
15537 </para>
15538 </listitem></varlistentry>
15539 <varlistentry>
15540 <term><varname>$demime_reason</varname></term>
15541 <listitem>
15542 <para>
15543 <indexterm role="concept">
15544 <primary><varname>$demime_reason</varname></primary>
15545 </indexterm>
15546 This variable is available when Exim is compiled with the
15547 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15548 see section <xref linkend="SECTdemimecond"/>.
15549 </para>
15550 </listitem></varlistentry>
15551 <varlistentry>
15552 <term><varname>$dnslist_domain</varname></term>
15553 <listitem>
15554 <para>
15555 <indexterm role="concept">
15556 <primary>black list (DNS)</primary>
15557 </indexterm>
15558 <indexterm role="concept">
15559 <primary><varname>$dnslist_domain</varname></primary>
15560 </indexterm>
15561 When a client host is found to be on a DNS (black) list,
15562 the list&#x2019;s domain name is put into this variable so that it can be included in
15563 the rejection message.
15564 </para>
15565 </listitem></varlistentry>
15566 <varlistentry>
15567 <term><varname>$dnslist_text</varname></term>
15568 <listitem>
15569 <para>
15570 <indexterm role="concept">
15571 <primary><varname>$dnslist_text</varname></primary>
15572 </indexterm>
15573 When a client host is found to be on a DNS (black) list, the
15574 contents of any associated TXT record are placed in this variable.
15575 </para>
15576 </listitem></varlistentry>
15577 <varlistentry>
15578 <term><varname>$dnslist_value</varname></term>
15579 <listitem>
15580 <para>
15581 <indexterm role="concept">
15582 <primary><varname>$dnslist_value</varname></primary>
15583 </indexterm>
15584 When a client host is found to be on a DNS (black) list,
15585 the IP address from the resource record is placed in this variable.
15586 If there are multiple records, all the addresses are included, comma-space
15587 separated.
15588 </para>
15589 </listitem></varlistentry>
15590 <varlistentry>
15591 <term><varname>$domain</varname></term>
15592 <listitem>
15593 <para>
15594 <indexterm role="concept">
15595 <primary><varname>$domain</varname></primary>
15596 </indexterm>
15597 When an address is being routed, or delivered on its own, this variable
15598 contains the domain. Global address rewriting happens when a message is
15599 received, so the value of <varname>$domain</varname> during routing and delivery is the value
15600 after rewriting. <varname>$domain</varname> is set during user filtering, but not during system
15601 filtering, because a message may have many recipients and the system filter is
15602 called just once.
15603 </para>
15604 <para>
15605 When more than one address is being delivered at once (for example, several
15606 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
15607 have the same domain. Transports can be restricted to handling only one domain
15608 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
15609 the default for local transports. For further details of the environment in
15610 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
15611 </para>
15612 <para>
15613 <indexterm role="concept">
15614 <primary><option>delay_warning_condition</option></primary>
15615 </indexterm>
15616 At the end of a delivery, if all deferred addresses have the same domain, it is
15617 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
15618 </para>
15619 <para>
15620 The <varname>$domain</varname> variable is also used in some other circumstances:
15621 </para>
15622 <itemizedlist>
15623 <listitem>
15624 <para>
15625 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
15626 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
15627 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
15628 normally set during the running of the MAIL ACL. However, if the sender address
15629 is verified with a callout during the MAIL ACL, the sender domain is placed in
15630 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
15631 the <command>smtp</command> transport.
15632 </para>
15633 </listitem>
15634 <listitem>
15635 <para>
15636 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15637 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
15638 it can be used in the expansion of the replacement address, for example, to
15639 rewrite domains by file lookup.
15640 </para>
15641 </listitem>
15642 <listitem>
15643 <para>
15644 With one important exception, whenever a domain list is being scanned,
15645 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
15646 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
15647 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
15648 that, in a RCPT ACL, the sender domain list can be dependent on the
15649 recipient domain (which is what is in <varname>$domain</varname> at this time).
15650 </para>
15651 </listitem>
15652 <listitem>
15653 <para>
15654 <indexterm role="concept">
15655 <primary>ETRN</primary>
15656 <secondary>value of <varname>$domain</varname></secondary>
15657 </indexterm>
15658 <indexterm role="concept">
15659 <primary><option>smtp_etrn_command</option></primary>
15660 </indexterm>
15661 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
15662 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
15663 </para>
15664 </listitem>
15665 </itemizedlist>
15666 </listitem></varlistentry>
15667 <varlistentry>
15668 <term><varname>$domain_data</varname></term>
15669 <listitem>
15670 <para>
15671 <indexterm role="concept">
15672 <primary><varname>$domain_data</varname></primary>
15673 </indexterm>
15674 When the <option>domains</option> option on a router matches a domain by
15675 means of a lookup, the data read by the lookup is available during the running
15676 of the router as <varname>$domain_data</varname>. In addition, if the driver routes the
15677 address to a transport, the value is available in that transport. If the
15678 transport is handling multiple addresses, the value from the first address is
15679 used.
15680 </para>
15681 <para>
15682 <varname>$domain_data</varname> is also set when the <option>domains</option> condition in an ACL matches a
15683 domain by means of a lookup. The data read by the lookup is available during
15684 the rest of the ACL statement. In all other situations, this variable expands
15685 to nothing.
15686 </para>
15687 </listitem></varlistentry>
15688 <varlistentry>
15689 <term><varname>$exim_gid</varname></term>
15690 <listitem>
15691 <para>
15692 <indexterm role="concept">
15693 <primary><varname>$exim_gid</varname></primary>
15694 </indexterm>
15695 This variable contains the numerical value of the Exim group id.
15696 </para>
15697 </listitem></varlistentry>
15698 <varlistentry>
15699 <term><varname>$exim_path</varname></term>
15700 <listitem>
15701 <para>
15702 <indexterm role="concept">
15703 <primary><varname>$exim_path</varname></primary>
15704 </indexterm>
15705 This variable contains the path to the Exim binary.
15706 </para>
15707 </listitem></varlistentry>
15708 <varlistentry>
15709 <term><varname>$exim_uid</varname></term>
15710 <listitem>
15711 <para>
15712 <indexterm role="concept">
15713 <primary><varname>$exim_uid</varname></primary>
15714 </indexterm>
15715 This variable contains the numerical value of the Exim user id.
15716 </para>
15717 </listitem></varlistentry>
15718 <varlistentry>
15719 <term><varname>$found_extension</varname></term>
15720 <listitem>
15721 <para>
15722 <indexterm role="concept">
15723 <primary><varname>$found_extension</varname></primary>
15724 </indexterm>
15725 This variable is available when Exim is compiled with the
15726 content-scanning extension and the obsolete <option>demime</option> condition. For details,
15727 see section <xref linkend="SECTdemimecond"/>.
15728 </para>
15729 </listitem></varlistentry>
15730 <varlistentry>
15731 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
15732 <listitem>
15733 <para>
15734 This is not strictly an expansion variable. It is expansion syntax for
15735 inserting the message header line with the given name. Note that the name must
15736 be terminated by colon or white space, because it may contain a wide variety of
15737 characters. Note also that braces must <emphasis>not</emphasis> be used.
15738 </para>
15739 </listitem></varlistentry>
15740 <varlistentry>
15741 <term><varname>$home</varname></term>
15742 <listitem>
15743 <para>
15744 <indexterm role="concept">
15745 <primary><varname>$home</varname></primary>
15746 </indexterm>
15747 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
15748 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
15749 means it is set during the running of users&#x2019; filter files. A router may also
15750 explicitly set a home directory for use by a transport; this can be overridden
15751 by a setting on the transport itself.
15752 </para>
15753 <para>
15754 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
15755 of the environment variable HOME.
15756 </para>
15757 </listitem></varlistentry>
15758 <varlistentry>
15759 <term><varname>$host</varname></term>
15760 <listitem>
15761 <para revisionflag="changed">
15762 <indexterm role="concept">
15763 <primary><varname>$host</varname></primary>
15764 </indexterm>
15765 If a router assigns an address to a transport (any transport), and passes a
15766 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
15767 to run is the name of the first host on the list. Note that this applies both
15768 to local and remote transports.
15769 </para>
15770 <para revisionflag="changed">
15771 <indexterm role="concept">
15772 <primary>transport</primary>
15773 <secondary>filter</secondary>
15774 </indexterm>
15775 <indexterm role="concept">
15776 <primary>filter</primary>
15777 <secondary>transport filter</secondary>
15778 </indexterm>
15779 For the <command>smtp</command> transport, if there is more than one host, the value of
15780 <varname>$host</varname> changes as the transport works its way through the list. In
15781 particular, when the <command>smtp</command> transport is expanding its options for encryption
15782 using TLS, or for specifying a transport filter (see chapter
15783 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
15784 is connected.
15785 </para>
15786 <para revisionflag="changed">
15787 When used in the client part of an authenticator configuration (see chapter
15788 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
15789 client is connected.
15790 </para>
15791 </listitem></varlistentry>
15792 <varlistentry>
15793 <term><varname>$host_address</varname></term>
15794 <listitem>
15795 <para>
15796 <indexterm role="concept">
15797 <primary><varname>$host_address</varname></primary>
15798 </indexterm>
15799 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
15800 for a remote connection. It is also set to the IP address that is being checked
15801 when the <option>ignore_target_hosts</option> option is being processed.
15802 </para>
15803 </listitem></varlistentry>
15804 <varlistentry>
15805 <term><varname>$host_data</varname></term>
15806 <listitem>
15807 <para>
15808 <indexterm role="concept">
15809 <primary><varname>$host_data</varname></primary>
15810 </indexterm>
15811 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
15812 result of the lookup is made available in the <varname>$host_data</varname> variable. This
15813 allows you, for example, to do things like this:
15814 </para>
15815 <literallayout class="monospaced">
15816 deny  hosts = net-lsearch;/some/file
15817 message = $host_data
15818 </literallayout>
15819 </listitem></varlistentry>
15820 <varlistentry>
15821 <term><varname>$host_lookup_deferred</varname></term>
15822 <listitem>
15823 <para>
15824 <indexterm role="concept">
15825 <primary>host name lookup</primary>
15826 <secondary>failure of</secondary>
15827 </indexterm>
15828 <indexterm role="concept">
15829 <primary><varname>$host_lookup_deferred</varname></primary>
15830 </indexterm>
15831 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
15832 message comes from a remote host and there is an attempt to look up the host&#x2019;s
15833 name from its IP address, and the attempt is not successful, one of these
15834 variables is set to <quote>1</quote>.
15835 </para>
15836 <itemizedlist>
15837 <listitem>
15838 <para>
15839 If the lookup receives a definite negative response (for example, a DNS lookup
15840 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
15841 </para>
15842 </listitem>
15843 <listitem>
15844 <para>
15845 If there is any kind of problem during the lookup, such that Exim cannot
15846 tell whether or not the host name is defined (for example, a timeout for a DNS
15847 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
15848 </para>
15849 </listitem>
15850 </itemizedlist>
15851 <para>
15852 Looking up a host&#x2019;s name from its IP address consists of more than just a
15853 single reverse lookup. Exim checks that a forward lookup of at least one of the
15854 names it receives from a reverse lookup yields the original IP address. If this
15855 is not the case, Exim does not accept the looked up name(s), and
15856 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
15857 IP address (for example, the existence of a PTR record in the DNS) is not
15858 sufficient on its own for the success of a host name lookup. If the reverse
15859 lookup succeeds, but there is a lookup problem such as a timeout when checking
15860 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
15861 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
15862 </para>
15863 </listitem></varlistentry>
15864 <varlistentry>
15865 <term><varname>$host_lookup_failed</varname></term>
15866 <listitem>
15867 <para>
15868 <indexterm role="concept">
15869 <primary><varname>$host_lookup_failed</varname></primary>
15870 </indexterm>
15871 See <varname>$host_lookup_deferred</varname>.
15872 </para>
15873 </listitem></varlistentry>
15874 <varlistentry>
15875 <term><varname>$inode</varname></term>
15876 <listitem>
15877 <para>
15878 <indexterm role="concept">
15879 <primary><varname>$inode</varname></primary>
15880 </indexterm>
15881 The only time this variable is set is while expanding the <option>directory_file</option>
15882 option in the <command>appendfile</command> transport. The variable contains the inode number
15883 of the temporary file which is about to be renamed. It can be used to construct
15884 a unique name for the file.
15885 </para>
15886 </listitem></varlistentry>
15887 <varlistentry>
15888 <term><varname>$interface_address</varname></term>
15889 <listitem>
15890 <para>
15891 <indexterm role="concept">
15892 <primary><varname>$interface_address</varname></primary>
15893 </indexterm>
15894 As soon as a server starts processing a TCP/IP connection, this variable is set
15895 to the address of the local IP interface, and <varname>$interface_port</varname> is set to the
15896 port number. These values are therefore available for use in the <quote>connect</quote>
15897 ACL. See also the <option>-oMi</option> command line option. As well as being used in ACLs,
15898 these variable could be used, for example, to make the file name for a TLS
15899 certificate depend on which interface and/or port is being used.
15900 </para>
15901 </listitem></varlistentry>
15902 <varlistentry>
15903 <term><varname>$interface_port</varname></term>
15904 <listitem>
15905 <para>
15906 <indexterm role="concept">
15907 <primary><varname>$interface_port</varname></primary>
15908 </indexterm>
15909 See <varname>$interface_address</varname>.
15910 </para>
15911 </listitem></varlistentry>
15912 <varlistentry>
15913 <term><varname>$ldap_dn</varname></term>
15914 <listitem>
15915 <para>
15916 <indexterm role="concept">
15917 <primary><varname>$ldap_dn</varname></primary>
15918 </indexterm>
15919 This variable, which is available only when Exim is compiled with LDAP support,
15920 contains the DN from the last entry in the most recently successful LDAP
15921 lookup.
15922 </para>
15923 </listitem></varlistentry>
15924 <varlistentry>
15925 <term><varname>$load_average</varname></term>
15926 <listitem>
15927 <para>
15928 <indexterm role="concept">
15929 <primary><varname>$load_average</varname></primary>
15930 </indexterm>
15931 This variable contains the system load average, multiplied by 1000 to that it
15932 is an integer. For example, if the load average is 0.21, the value of the
15933 variable is 210. The value is recomputed every time the variable is referenced.
15934 </para>
15935 </listitem></varlistentry>
15936 <varlistentry>
15937 <term><varname>$local_part</varname></term>
15938 <listitem>
15939 <para>
15940 <indexterm role="concept">
15941 <primary><varname>$local_part</varname></primary>
15942 </indexterm>
15943 When an address is being routed, or delivered on its own, this
15944 variable contains the local part. When a number of addresses are being
15945 delivered together (for example, multiple RCPT commands in an SMTP
15946 session), <varname>$local_part</varname> is not set.
15947 </para>
15948 <para>
15949 Global address rewriting happens when a message is received, so the value of
15950 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
15951 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
15952 because a message may have many recipients and the system filter is called just
15953 once.
15954 </para>
15955 <para>
15956 <indexterm role="concept">
15957 <primary><varname>$local_part_prefix</varname></primary>
15958 </indexterm>
15959 <indexterm role="concept">
15960 <primary><varname>$local_part_suffix</varname></primary>
15961 </indexterm>
15962 If a local part prefix or suffix has been recognized, it is not included in the
15963 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
15964 any prefix or suffix are in <varname>$local_part_prefix</varname> and
15965 <varname>$local_part_suffix</varname>, respectively.
15966 </para>
15967 <para>
15968 When a message is being delivered to a file, pipe, or autoreply transport as a
15969 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
15970 the parent address, not to the file name or command (see <varname>$address_file</varname> and
15971 <varname>$address_pipe</varname>).
15972 </para>
15973 <para>
15974 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
15975 local part of the recipient address.
15976 </para>
15977 <para>
15978 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
15979 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
15980 it can be used in the expansion of the replacement address, for example.
15981 </para>
15982 <para>
15983 In all cases, all quoting is removed from the local part. For example, for both
15984 the addresses
15985 </para>
15986 <literallayout class="monospaced">
15987 "abc:xyz"@test.example
15988 abc\:xyz@test.example
15989 </literallayout>
15990 <para>
15991 the value of <varname>$local_part</varname> is
15992 </para>
15993 <literallayout class="monospaced">
15994 abc:xyz
15995 </literallayout>
15996 <para>
15997 If you use <varname>$local_part</varname> to create another address, you should always wrap it
15998 inside a quoting operator. For example, in a <command>redirect</command> router you could
15999 have:
16000 </para>
16001 <literallayout class="monospaced">
16002 data = ${quote_local_part:$local_part}@new.domain.example
16003 </literallayout>
16004 <para>
16005 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
16006 to process local parts in a case-dependent manner in a router, you can set the
16007 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
16008 </para>
16009 </listitem></varlistentry>
16010 <varlistentry>
16011 <term><varname>$local_part_data</varname></term>
16012 <listitem>
16013 <para>
16014 <indexterm role="concept">
16015 <primary><varname>$local_part_data</varname></primary>
16016 </indexterm>
16017 When the <option>local_parts</option> option on a router matches a local part by means of a
16018 lookup, the data read by the lookup is available during the running of the
16019 router as <varname>$local_part_data</varname>. In addition, if the driver routes the address
16020 to a transport, the value is available in that transport. If the transport is
16021 handling multiple addresses, the value from the first address is used.
16022 </para>
16023 <para>
16024 <varname>$local_part_data</varname> is also set when the <option>local_parts</option> condition in an ACL
16025 matches a local part by means of a lookup. The data read by the lookup is
16026 available during the rest of the ACL statement. In all other situations, this
16027 variable expands to nothing.
16028 </para>
16029 </listitem></varlistentry>
16030 <varlistentry>
16031 <term><varname>$local_part_prefix</varname></term>
16032 <listitem>
16033 <para>
16034 <indexterm role="concept">
16035 <primary><varname>$local_part_prefix</varname></primary>
16036 </indexterm>
16037 When an address is being routed or delivered, and a
16038 specific prefix for the local part was recognized, it is available in this
16039 variable, having been removed from <varname>$local_part</varname>.
16040 </para>
16041 </listitem></varlistentry>
16042 <varlistentry>
16043 <term><varname>$local_part_suffix</varname></term>
16044 <listitem>
16045 <para>
16046 <indexterm role="concept">
16047 <primary><varname>$local_part_suffix</varname></primary>
16048 </indexterm>
16049 When an address is being routed or delivered, and a
16050 specific suffix for the local part was recognized, it is available in this
16051 variable, having been removed from <varname>$local_part</varname>.
16052 </para>
16053 </listitem></varlistentry>
16054 <varlistentry>
16055 <term><varname>$local_scan_data</varname></term>
16056 <listitem>
16057 <para>
16058 <indexterm role="concept">
16059 <primary><varname>$local_scan_data</varname></primary>
16060 </indexterm>
16061 This variable contains the text returned by the <function>local_scan()</function> function when
16062 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
16063 </para>
16064 </listitem></varlistentry>
16065 <varlistentry>
16066 <term><varname>$local_user_gid</varname></term>
16067 <listitem>
16068 <para>
16069 <indexterm role="concept">
16070 <primary><varname>$local_user_gid</varname></primary>
16071 </indexterm>
16072 See <varname>$local_user_uid</varname>.
16073 </para>
16074 </listitem></varlistentry>
16075 <varlistentry>
16076 <term><varname>$local_user_uid</varname></term>
16077 <listitem>
16078 <para>
16079 <indexterm role="concept">
16080 <primary><varname>$local_user_uid</varname></primary>
16081 </indexterm>
16082 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
16083 <option>check_local_user</option> router precondition succeeds. This means that their values
16084 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
16085 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
16086 router-specific expansions. At all other times, the values in these variables
16087 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
16088 </para>
16089 </listitem></varlistentry>
16090 <varlistentry>
16091 <term><varname>$localhost_number</varname></term>
16092 <listitem>
16093 <para>
16094 <indexterm role="concept">
16095 <primary><varname>$localhost_number</varname></primary>
16096 </indexterm>
16097 This contains the expanded value of the
16098 <option>localhost_number</option> option. The expansion happens after the main options have
16099 been read.
16100 </para>
16101 </listitem></varlistentry>
16102 <varlistentry>
16103 <term><varname>$log_inodes</varname></term>
16104 <listitem>
16105 <para>
16106 <indexterm role="concept">
16107 <primary><varname>$log_inodes</varname></primary>
16108 </indexterm>
16109 The number of free inodes in the disk partition where Exim&#x2019;s
16110 log files are being written. The value is recalculated whenever the variable is
16111 referenced. If the relevant file system does not have the concept of inodes,
16112 the value of is -1. See also the <option>check_log_inodes</option> option.
16113 </para>
16114 </listitem></varlistentry>
16115 <varlistentry>
16116 <term><varname>$log_space</varname></term>
16117 <listitem>
16118 <para>
16119 <indexterm role="concept">
16120 <primary><varname>$log_space</varname></primary>
16121 </indexterm>
16122 The amount of free space (as a number of kilobytes) in the disk
16123 partition where Exim&#x2019;s log files are being written. The value is recalculated
16124 whenever the variable is referenced. If the operating system does not have the
16125 ability to find the amount of free space (only true for experimental systems),
16126 the space value is -1. See also the <option>check_log_space</option> option.
16127 </para>
16128 </listitem></varlistentry>
16129 <varlistentry>
16130 <term><varname>$mailstore_basename</varname></term>
16131 <listitem>
16132 <para>
16133 <indexterm role="concept">
16134 <primary><varname>$mailstore_basename</varname></primary>
16135 </indexterm>
16136 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
16137 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
16138 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
16139 contains the basename of the files that are being written, that is, the name
16140 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
16141 variable is empty.
16142 </para>
16143 </listitem></varlistentry>
16144 <varlistentry>
16145 <term><varname>$malware_name</varname></term>
16146 <listitem>
16147 <para>
16148 <indexterm role="concept">
16149 <primary><varname>$malware_name</varname></primary>
16150 </indexterm>
16151 This variable is available when Exim is compiled with the
16152 content-scanning extension. It is set to the name of the virus that was found
16153 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
16154 </para>
16155 </listitem></varlistentry>
16156 <varlistentry>
16157 <term><varname>$message_age</varname></term>
16158 <listitem>
16159 <para>
16160 <indexterm role="concept">
16161 <primary>message</primary>
16162 <secondary>age of</secondary>
16163 </indexterm>
16164 <indexterm role="concept">
16165 <primary><varname>$message_age</varname></primary>
16166 </indexterm>
16167 This variable is set at the start of a delivery attempt to contain the number
16168 of seconds since the message was received. It does not change during a single
16169 delivery attempt.
16170 </para>
16171 </listitem></varlistentry>
16172 <varlistentry>
16173 <term><varname>$message_body</varname></term>
16174 <listitem>
16175 <para>
16176 <indexterm role="concept">
16177 <primary>body of message</primary>
16178 <secondary>expansion variable</secondary>
16179 </indexterm>
16180 <indexterm role="concept">
16181 <primary>message body</primary>
16182 <secondary>in expansion</secondary>
16183 </indexterm>
16184 <indexterm role="concept">
16185 <primary>binary zero</primary>
16186 <secondary>in message body</secondary>
16187 </indexterm>
16188 <indexterm role="concept">
16189 <primary><varname>$message_body</varname></primary>
16190 </indexterm>
16191 This variable contains the initial portion of a message&#x2019;s
16192 body while it is being delivered, and is intended mainly for use in filter
16193 files. The maximum number of characters of the body that are put into the
16194 variable is set by the <option>message_body_visible</option> configuration option; the
16195 default is 500. Newlines are converted into spaces to make it easier to search
16196 for phrases that might be split over a line break.
16197 Binary zeros are also converted into spaces.
16198 </para>
16199 </listitem></varlistentry>
16200 <varlistentry>
16201 <term><varname>$message_body_end</varname></term>
16202 <listitem>
16203 <para>
16204 <indexterm role="concept">
16205 <primary>body of message</primary>
16206 <secondary>expansion variable</secondary>
16207 </indexterm>
16208 <indexterm role="concept">
16209 <primary>message body</primary>
16210 <secondary>in expansion</secondary>
16211 </indexterm>
16212 <indexterm role="concept">
16213 <primary><varname>$message_body_end</varname></primary>
16214 </indexterm>
16215 This variable contains the final portion of a message&#x2019;s
16216 body while it is being delivered. The format and maximum size are as for
16217 <varname>$message_body</varname>.
16218 </para>
16219 </listitem></varlistentry>
16220 <varlistentry>
16221 <term><varname>$message_body_size</varname></term>
16222 <listitem>
16223 <para>
16224 <indexterm role="concept">
16225 <primary>body of message</primary>
16226 <secondary>size</secondary>
16227 </indexterm>
16228 <indexterm role="concept">
16229 <primary>message body</primary>
16230 <secondary>size</secondary>
16231 </indexterm>
16232 <indexterm role="concept">
16233 <primary><varname>$message_body_size</varname></primary>
16234 </indexterm>
16235 When a message is being delivered, this variable contains the size of the body
16236 in bytes. The count starts from the character after the blank line that
16237 separates the body from the header. Newlines are included in the count. See
16238 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16239 </para>
16240 </listitem></varlistentry>
16241 <varlistentry>
16242 <term><varname>$message_exim_id</varname></term>
16243 <listitem>
16244 <para>
16245 <indexterm role="concept">
16246 <primary><varname>$message_exim_id</varname></primary>
16247 </indexterm>
16248 When a message is being received or delivered, this variable contains the
16249 unique message id that is generated and used by Exim to identify the message.
16250 An id is not created for a message until after its header has been successfully
16251 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
16252 line; it is the local id that Exim assigns to the message, for example:
16253 <literal>1BXTIK-0001yO-VA</literal>.
16254 </para>
16255 </listitem></varlistentry>
16256 <varlistentry>
16257 <term><varname>$message_headers</varname></term>
16258 <listitem>
16259 <para>
16260 This variable contains a concatenation of all the header lines when a message
16261 is being processed, except for lines added by routers or transports. The header
16262 lines are separated by newline characters.
16263 </para>
16264 </listitem></varlistentry>
16265 <varlistentry>
16266 <term><varname>$message_id</varname></term>
16267 <listitem>
16268 <para>
16269 This is an old name for <varname>$message_exim_id</varname>, which is now deprecated.
16270 </para>
16271 </listitem></varlistentry>
16272 <varlistentry>
16273 <term><varname>$message_linecount</varname></term>
16274 <listitem>
16275 <para>
16276 <indexterm role="concept">
16277 <primary><varname>$message_linecount</varname></primary>
16278 </indexterm>
16279 This variable contains the total number of lines in the header and body of the
16280 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
16281 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
16282 number of lines received. Before delivery happens (that is, before filters,
16283 routers, and transports run) the count is increased to include the
16284 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
16285 lines that are added by ACLs. The blank line that separates the message header
16286 from the body is not counted. Here is an example of the use of this variable in
16287 a DATA ACL:
16288 </para>
16289 <literallayout class="monospaced">
16290 deny message   = Too many lines in message header
16291      condition = \
16292        ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
16293 </literallayout>
16294 <para>
16295 In the MAIL and RCPT ACLs, the value is zero because at that stage the
16296 message has not yet been received.
16297 </para>
16298 </listitem></varlistentry>
16299 <varlistentry>
16300 <term><varname>$message_size</varname></term>
16301 <listitem>
16302 <para>
16303 <indexterm role="concept">
16304 <primary>size</primary>
16305 <secondary>of message</secondary>
16306 </indexterm>
16307 <indexterm role="concept">
16308 <primary>message</primary>
16309 <secondary>size</secondary>
16310 </indexterm>
16311 <indexterm role="concept">
16312 <primary><varname>$message_size</varname></primary>
16313 </indexterm>
16314 When a message is being processed, this variable contains its size in bytes. In
16315 most cases, the size includes those headers that were received with the
16316 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
16317 deliveries as they are written. However, there is one special case: during the
16318 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
16319 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
16320 precise size of the file that has been written. See also
16321 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
16322 </para>
16323 <para>
16324 <indexterm role="concept">
16325 <primary>RCPT</primary>
16326 <secondary>value of <varname>$message_size</varname></secondary>
16327 </indexterm>
16328 While running an ACL at the time of an SMTP RCPT command, <varname>$message_size</varname>
16329 contains the size supplied on the MAIL command, or -1 if no size was given. The
16330 value may not, of course, be truthful.
16331 </para>
16332 </listitem></varlistentry>
16333 <varlistentry>
16334 <term><varname>$mime_</varname><emphasis>xxx</emphasis></term>
16335 <listitem>
16336 <para>
16337 A number of variables whose names start with <varname>$mime</varname> are
16338 available when Exim is compiled with the content-scanning extension. For
16339 details, see section <xref linkend="SECTscanmimepart"/>.
16340 </para>
16341 </listitem></varlistentry>
16342 <varlistentry>
16343 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
16344 <listitem>
16345 <para>
16346 These variables are counters that can be incremented by means
16347 of the <option>add</option> command in filter files.
16348 </para>
16349 </listitem></varlistentry>
16350 <varlistentry>
16351 <term><varname>$original_domain</varname></term>
16352 <listitem>
16353 <para>
16354 <indexterm role="concept">
16355 <primary><varname>$domain</varname></primary>
16356 </indexterm>
16357 <indexterm role="concept">
16358 <primary><varname>$original_domain</varname></primary>
16359 </indexterm>
16360 When a top-level address is being processed for delivery, this contains the
16361 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
16362 generated by an alias, forward, or filter file) is being processed, this
16363 variable contains the domain of the original address. This differs from
16364 <varname>$parent_domain</varname> only when there is more than one level of aliasing or
16365 forwarding. When more than one address is being delivered in a single transport
16366 run, <varname>$original_domain</varname> is not set.
16367 </para>
16368 <para>
16369 If a new address is created by means of a <option>deliver</option> command in a system
16370 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16371 part <emphasis>system-filter</emphasis> and the default qualify domain.
16372 </para>
16373 </listitem></varlistentry>
16374 <varlistentry>
16375 <term><varname>$original_local_part</varname></term>
16376 <listitem>
16377 <para>
16378 <indexterm role="concept">
16379 <primary><varname>$local_part</varname></primary>
16380 </indexterm>
16381 <indexterm role="concept">
16382 <primary><varname>$original_local_part</varname></primary>
16383 </indexterm>
16384 When a top-level address is being processed for delivery, this contains the
16385 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
16386 local part, because <varname>$original_local_part</varname> always contains the full local
16387 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
16388 filter file) is being processed, this variable contains the full local part of
16389 the original address.
16390 </para>
16391 <para>
16392 If the router that did the redirection processed the local part
16393 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
16394 This variable differs from <varname>$parent_local_part</varname> only when there is more than
16395 one level of aliasing or forwarding. When more than one address is being
16396 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
16397 </para>
16398 <para>
16399 If a new address is created by means of a <option>deliver</option> command in a system
16400 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
16401 part <emphasis>system-filter</emphasis> and the default qualify domain.
16402 </para>
16403 </listitem></varlistentry>
16404 <varlistentry>
16405 <term><varname>$originator_gid</varname></term>
16406 <listitem>
16407 <para>
16408 <indexterm role="concept">
16409 <primary>gid (group id)</primary>
16410 <secondary>of originating user</secondary>
16411 </indexterm>
16412 <indexterm role="concept">
16413 <primary>sender</primary>
16414 <secondary>gid</secondary>
16415 </indexterm>
16416 <indexterm role="concept">
16417 <primary><varname>$caller_gid</varname></primary>
16418 </indexterm>
16419 <indexterm role="concept">
16420 <primary><varname>$originator_gid</varname></primary>
16421 </indexterm>
16422 This variable contains the value of <varname>$caller_gid</varname> that was set when the
16423 message was received. For messages received via the command line, this is the
16424 gid of the sending user. For messages received by SMTP over TCP/IP, this is
16425 normally the gid of the Exim user.
16426 </para>
16427 </listitem></varlistentry>
16428 <varlistentry>
16429 <term><varname>$originator_uid</varname></term>
16430 <listitem>
16431 <para>
16432 <indexterm role="concept">
16433 <primary>uid (user id)</primary>
16434 <secondary>of originating user</secondary>
16435 </indexterm>
16436 <indexterm role="concept">
16437 <primary>sender</primary>
16438 <secondary>uid</secondary>
16439 </indexterm>
16440 <indexterm role="concept">
16441 <primary><varname>$caller_uid</varname></primary>
16442 </indexterm>
16443 <indexterm role="concept">
16444 <primary><varname>$originaltor_uid</varname></primary>
16445 </indexterm>
16446 The value of <varname>$caller_uid</varname> that was set when the message was received. For
16447 messages received via the command line, this is the uid of the sending user.
16448 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
16449 user.
16450 </para>
16451 </listitem></varlistentry>
16452 <varlistentry>
16453 <term><varname>$parent_domain</varname></term>
16454 <listitem>
16455 <para>
16456 <indexterm role="concept">
16457 <primary><varname>$parent_domain</varname></primary>
16458 </indexterm>
16459 This variable is similar to <varname>$original_domain</varname> (see
16460 above), except that it refers to the immediately preceding parent address.
16461 </para>
16462 </listitem></varlistentry>
16463 <varlistentry>
16464 <term><varname>$parent_local_part</varname></term>
16465 <listitem>
16466 <para>
16467 <indexterm role="concept">
16468 <primary><varname>$parent_local_part</varname></primary>
16469 </indexterm>
16470 This variable is similar to <varname>$original_local_part</varname>
16471 (see above), except that it refers to the immediately preceding parent address.
16472 </para>
16473 </listitem></varlistentry>
16474 <varlistentry>
16475 <term><varname>$pid</varname></term>
16476 <listitem>
16477 <para>
16478 <indexterm role="concept">
16479 <primary>pid (process id)</primary>
16480 <secondary>of current process</secondary>
16481 </indexterm>
16482 <indexterm role="concept">
16483 <primary><varname>$pid</varname></primary>
16484 </indexterm>
16485 This variable contains the current process id.
16486 </para>
16487 </listitem></varlistentry>
16488 <varlistentry>
16489 <term><varname>$pipe_addresses</varname></term>
16490 <listitem>
16491 <para>
16492 <indexterm role="concept">
16493 <primary>filter</primary>
16494 <secondary>transport filter</secondary>
16495 </indexterm>
16496 <indexterm role="concept">
16497 <primary>transport</primary>
16498 <secondary>filter</secondary>
16499 </indexterm>
16500 <indexterm role="concept">
16501 <primary><varname>$pipe_addresses</varname></primary>
16502 </indexterm>
16503 This is not an expansion variable, but is mentioned here because the string
16504 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
16505 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
16506 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
16507 It cannot be used in general expansion strings, and provokes an <quote>unknown
16508 variable</quote> error if encountered.
16509 </para>
16510 </listitem></varlistentry>
16511 <varlistentry>
16512 <term><varname>$primary_hostname</varname></term>
16513 <listitem>
16514 <para>
16515 <indexterm role="concept">
16516 <primary><varname>$primary_hostname</varname></primary>
16517 </indexterm>
16518 This variable contains the value set by <option>primary_hostname</option> in the
16519 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
16520 a single-component name, Exim calls <function>gethostbyname()</function> (or
16521 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
16522 qualified host name. See also <varname>$smtp_active_hostname</varname>.
16523 </para>
16524 </listitem></varlistentry>
16525 <varlistentry>
16526 <term><varname>$prvscheck_address</varname></term>
16527 <listitem>
16528 <para>
16529 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16530 which is described in sections <xref linkend="SECTexpansionitems"/> and
16531 <xref linkend="SECTverifyPRVS"/>.
16532 </para>
16533 </listitem></varlistentry>
16534 <varlistentry>
16535 <term><varname>$prvscheck_keynum</varname></term>
16536 <listitem>
16537 <para>
16538 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16539 which is described in sections <xref linkend="SECTexpansionitems"/> and
16540 <xref linkend="SECTverifyPRVS"/>.
16541 </para>
16542 </listitem></varlistentry>
16543 <varlistentry>
16544 <term><varname>$prvscheck_result</varname></term>
16545 <listitem>
16546 <para>
16547 This variable is used in conjunction with the <option>prvscheck</option> expansion item,
16548 which is described in sections <xref linkend="SECTexpansionitems"/> and
16549 <xref linkend="SECTverifyPRVS"/>.
16550 </para>
16551 </listitem></varlistentry>
16552 <varlistentry>
16553 <term><varname>$qualify_domain</varname></term>
16554 <listitem>
16555 <para>
16556 <indexterm role="concept">
16557 <primary><varname>$qualify_domain</varname></primary>
16558 </indexterm>
16559 The value set for the <option>qualify_domain</option> option in the configuration file.
16560 </para>
16561 </listitem></varlistentry>
16562 <varlistentry>
16563 <term><varname>$qualify_recipient</varname></term>
16564 <listitem>
16565 <para>
16566 <indexterm role="concept">
16567 <primary><varname>$qualify_recipient</varname></primary>
16568 </indexterm>
16569 The value set for the <option>qualify_recipient</option> option in the configuration file,
16570 or if not set, the value of <varname>$qualify_domain</varname>.
16571 </para>
16572 </listitem></varlistentry>
16573 <varlistentry>
16574 <term><varname>$rcpt_count</varname></term>
16575 <listitem>
16576 <para>
16577 <indexterm role="concept">
16578 <primary><varname>$rcpt_count</varname></primary>
16579 </indexterm>
16580 When a message is being received by SMTP, this variable contains the number of
16581 RCPT commands received for the current message. If this variable is used in a
16582 RCPT ACL, its value includes the current command.
16583 </para>
16584 </listitem></varlistentry>
16585 <varlistentry>
16586 <term><varname>$rcpt_defer_count</varname></term>
16587 <listitem>
16588 <para>
16589 <indexterm role="concept">
16590 <primary><varname>$rcpt_defer_count</varname></primary>
16591 </indexterm>
16592 When a message is being received by SMTP, this variable contains the number of
16593 RCPT commands in the current message that have previously been rejected with a
16594 temporary (4<emphasis>xx</emphasis>) response.
16595 </para>
16596 </listitem></varlistentry>
16597 <varlistentry>
16598 <term><varname>$rcpt_fail_count</varname></term>
16599 <listitem>
16600 <para>
16601 <indexterm role="concept">
16602 <primary><varname>$rcpt_fail_count</varname></primary>
16603 </indexterm>
16604 When a message is being received by SMTP, this variable contains the number of
16605 RCPT commands in the current message that have previously been rejected with a
16606 permanent (5<emphasis>xx</emphasis>) response.
16607 </para>
16608 </listitem></varlistentry>
16609 <varlistentry>
16610 <term><varname>$received_count</varname></term>
16611 <listitem>
16612 <para>
16613 <indexterm role="concept">
16614 <primary><varname>$received_count</varname></primary>
16615 </indexterm>
16616 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
16617 including the one added by Exim (so its value is always greater than zero). It
16618 is available in the DATA ACL, the non-SMTP ACL, and while routing and
16619 delivering.
16620 </para>
16621 </listitem></varlistentry>
16622 <varlistentry>
16623 <term><varname>$received_for</varname></term>
16624 <listitem>
16625 <para>
16626 <indexterm role="concept">
16627 <primary><varname>$received_for</varname></primary>
16628 </indexterm>
16629 If there is only a single recipient address in an incoming message, this
16630 variable contains that address when the <emphasis>Received:</emphasis> header line is being
16631 built. The value is copied after recipient rewriting has happened, but before
16632 the <function>local_scan()</function> function is run.
16633 </para>
16634 </listitem></varlistentry>
16635 <varlistentry>
16636 <term><varname>$received_protocol</varname></term>
16637 <listitem>
16638 <para>
16639 <indexterm role="concept">
16640 <primary><varname>$received_protocol</varname></primary>
16641 </indexterm>
16642 When a message is being processed, this variable contains the name of the
16643 protocol by which it was received. Most of the names used by Exim are defined
16644 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
16645 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
16646 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
16647 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
16648 connection and the client was successfully authenticated.
16649 </para>
16650 <para>
16651 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
16652 automatically set up on connection without the use of STARTTLS (see
16653 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
16654 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
16655 where the client initially uses EHLO, sets up an encrypted connection using
16656 STARTTLS, and then uses HELO afterwards.
16657 </para>
16658 <para>
16659 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
16660 messages that are injected locally by trusted callers. This is commonly used to
16661 identify messages that are being re-injected after some kind of scanning.
16662 </para>
16663 </listitem></varlistentry>
16664 <varlistentry>
16665 <term><varname>$received_time</varname></term>
16666 <listitem>
16667 <para>
16668 <indexterm role="concept">
16669 <primary><varname>$received_time</varname></primary>
16670 </indexterm>
16671 This variable contains the date and time when the current message was received,
16672 as a number of seconds since the start of the Unix epoch.
16673 </para>
16674 </listitem></varlistentry>
16675 <varlistentry>
16676 <term><varname>$recipient_data</varname></term>
16677 <listitem>
16678 <para>
16679 <indexterm role="concept">
16680 <primary><varname>$recipient_data</varname></primary>
16681 </indexterm>
16682 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
16683 condition. It contains the data from the lookup, and the value remains set
16684 until the next <option>recipients</option> test. Thus, you can do things like this:
16685 </para>
16686 <literallayout>
16687 <literal>require recipients  = cdb*@;/some/file</literal>
16688 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
16689 </literallayout>
16690 <para>
16691 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16692 method in the address list, using the semicolon syntax as in the example above.
16693 The variable is not set for a lookup that is used as part of the string
16694 expansion that all such lists undergo before being interpreted.
16695 </para>
16696 </listitem></varlistentry>
16697 <varlistentry>
16698 <term><varname>$recipient_verify_failure</varname></term>
16699 <listitem>
16700 <para>
16701 <indexterm role="concept">
16702 <primary><varname>$recipient_verify_failure</varname></primary>
16703 </indexterm>
16704 In an ACL, when a recipient verification fails, this variable contains
16705 information about the failure. It is set to one of the following words:
16706 </para>
16707 <itemizedlist>
16708 <listitem>
16709 <para>
16710 <quote>qualify</quote>: The address was unqualified (no domain), and the message
16711 was neither local nor came from an exempted host.
16712 </para>
16713 </listitem>
16714 <listitem>
16715 <para>
16716 <quote>route</quote>: Routing failed.
16717 </para>
16718 </listitem>
16719 <listitem>
16720 <para>
16721 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
16722 or before the MAIL command (that is, on initial connection, HELO, or
16723 MAIL).
16724 </para>
16725 </listitem>
16726 <listitem>
16727 <para>
16728 <quote>recipient</quote>: The RCPT command in a callout was rejected.
16729 </para>
16730 </listitem>
16731 <listitem>
16732 <para>
16733 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
16734 </para>
16735 </listitem>
16736 </itemizedlist>
16737 <para>
16738 The main use of this variable is expected to be to distinguish between
16739 rejections of MAIL and rejections of RCPT.
16740 </para>
16741 </listitem></varlistentry>
16742 <varlistentry>
16743 <term><varname>$recipients</varname></term>
16744 <listitem>
16745 <para>
16746 <indexterm role="concept">
16747 <primary><varname>$recipients</varname></primary>
16748 </indexterm>
16749 This variable contains a list of envelope recipients for a
16750 message. A comma and a space separate the addresses in the replacement text.
16751 However, the variable is not generally available, to prevent exposure of Bcc
16752 recipients in unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only
16753 in these two cases:
16754 </para>
16755 <orderedlist numeration="arabic">
16756 <listitem>
16757 <para>
16758 In a system filter file.
16759 </para>
16760 </listitem>
16761 <listitem>
16762 <para revisionflag="changed">
16763 In the ACLs associated with the DATA command and with non-SMTP messages, that
16764 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
16765 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
16766 <option>acl_not_smtp_mime</option>.
16767 </para>
16768 </listitem>
16769 </orderedlist>
16770 </listitem></varlistentry>
16771 <varlistentry>
16772 <term><varname>$recipients_count</varname></term>
16773 <listitem>
16774 <para>
16775 <indexterm role="concept">
16776 <primary><varname>$recipients_count</varname></primary>
16777 </indexterm>
16778 When a message is being processed, this variable contains the number of
16779 envelope recipients that came with the message. Duplicates are not excluded
16780 from the count. While a message is being received over SMTP, the number
16781 increases for each accepted recipient. It can be referenced in an ACL.
16782 </para>
16783 </listitem></varlistentry>
16784 <varlistentry revisionflag="changed">
16785 <term><varname>$regex_match_string</varname></term>
16786 <listitem>
16787 <para revisionflag="changed">
16788 <indexterm role="concept">
16789 <primary><varname>$regex_match_string</varname></primary>
16790 </indexterm>
16791 This variable is set to contain the matching regular expression after a
16792 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
16793 </para>
16794 </listitem></varlistentry>
16795 <varlistentry>
16796 <term><varname>$reply_address</varname></term>
16797 <listitem>
16798 <para>
16799 <indexterm role="concept">
16800 <primary><varname>$reply_address</varname></primary>
16801 </indexterm>
16802 When a message is being processed, this variable contains the contents of the
16803 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
16804 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
16805 white space, the value is not processed in any way. In particular, no RFC 2047
16806 decoding or character code translation takes place.
16807 </para>
16808 </listitem></varlistentry>
16809 <varlistentry>
16810 <term><varname>$return_path</varname></term>
16811 <listitem>
16812 <para>
16813 <indexterm role="concept">
16814 <primary><varname>$return_path</varname></primary>
16815 </indexterm>
16816 When a message is being delivered, this variable contains the return path &ndash;
16817 the sender field that will be sent as part of the envelope. It is not enclosed
16818 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
16819 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
16820 mailing list has been expanded by a router which specifies a different address
16821 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
16822 address, whereas <varname>$sender_address</varname> always contains the original sender address
16823 that was received with the message. In other words, <varname>$sender_address</varname> contains
16824 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
16825 envelope sender.
16826 </para>
16827 </listitem></varlistentry>
16828 <varlistentry>
16829 <term><varname>$return_size_limit</varname></term>
16830 <listitem>
16831 <para>
16832 <indexterm role="concept">
16833 <primary><varname>$return_size_limit</varname></primary>
16834 </indexterm>
16835 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
16836 </para>
16837 </listitem></varlistentry>
16838 <varlistentry>
16839 <term><varname>$runrc</varname></term>
16840 <listitem>
16841 <para>
16842 <indexterm role="concept">
16843 <primary>return code</primary>
16844 <secondary>from <option>run</option> expansion</secondary>
16845 </indexterm>
16846 <indexterm role="concept">
16847 <primary><varname>$runrc</varname></primary>
16848 </indexterm>
16849 This variable contains the return code from a command that is run by the
16850 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
16851 assume the order in which option values are expanded, except for those
16852 preconditions whose order of testing is documented. Therefore, you cannot
16853 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
16854 another.
16855 </para>
16856 </listitem></varlistentry>
16857 <varlistentry>
16858 <term><varname>$self_hostname</varname></term>
16859 <listitem>
16860 <para>
16861 <indexterm role="concept">
16862 <primary><option>self</option> option</primary>
16863 <secondary>value of host name</secondary>
16864 </indexterm>
16865 <indexterm role="concept">
16866 <primary><varname>$self_hostname</varname></primary>
16867 </indexterm>
16868 When an address is routed to a supposedly remote host that turns out to be the
16869 local host, what happens is controlled by the <option>self</option> generic router option.
16870 One of its values causes the address to be passed to another router. When this
16871 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
16872 original router encountered. In other circumstances its contents are null.
16873 </para>
16874 </listitem></varlistentry>
16875 <varlistentry>
16876 <term><varname>$sender_address</varname></term>
16877 <listitem>
16878 <para>
16879 <indexterm role="concept">
16880 <primary><varname>$sender_address</varname></primary>
16881 </indexterm>
16882 When a message is being processed, this variable contains the sender&#x2019;s address
16883 that was received in the message&#x2019;s envelope. For bounce messages, the value of
16884 this variable is the empty string. See also <varname>$return_path</varname>.
16885 </para>
16886 </listitem></varlistentry>
16887 <varlistentry>
16888 <term><varname>$sender_address_data</varname></term>
16889 <listitem>
16890 <para>
16891 <indexterm role="concept">
16892 <primary><varname>$address_data</varname></primary>
16893 </indexterm>
16894 <indexterm role="concept">
16895 <primary><varname>$sender_address_data</varname></primary>
16896 </indexterm>
16897 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
16898 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
16899 distinguish it from data from a recipient address. The value does not persist
16900 after the end of the current ACL statement. If you want to preserve it for
16901 longer, you can save it in an ACL variable.
16902 </para>
16903 </listitem></varlistentry>
16904 <varlistentry>
16905 <term><varname>$sender_address_domain</varname></term>
16906 <listitem>
16907 <para>
16908 <indexterm role="concept">
16909 <primary><varname>$sender_address_domain</varname></primary>
16910 </indexterm>
16911 The domain portion of <varname>$sender_address</varname>.
16912 </para>
16913 </listitem></varlistentry>
16914 <varlistentry>
16915 <term><varname>$sender_address_local_part</varname></term>
16916 <listitem>
16917 <para>
16918 <indexterm role="concept">
16919 <primary><varname>$sender_address_local_part</varname></primary>
16920 </indexterm>
16921 The local part portion of <varname>$sender_address</varname>.
16922 </para>
16923 </listitem></varlistentry>
16924 <varlistentry>
16925 <term><varname>$sender_data</varname></term>
16926 <listitem>
16927 <para>
16928 <indexterm role="concept">
16929 <primary><varname>$sender_data</varname></primary>
16930 </indexterm>
16931 This variable is set after a lookup success in an ACL <option>senders</option> condition or
16932 in a router <option>senders</option> option. It contains the data from the lookup, and the
16933 value remains set until the next <option>senders</option> test. Thus, you can do things like
16934 this:
16935 </para>
16936 <literallayout>
16937 <literal>require senders      = cdb*@;/some/file</literal>
16938 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
16939 </literallayout>
16940 <para>
16941 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
16942 method in the address list, using the semicolon syntax as in the example above.
16943 The variable is not set for a lookup that is used as part of the string
16944 expansion that all such lists undergo before being interpreted.
16945 </para>
16946 </listitem></varlistentry>
16947 <varlistentry>
16948 <term><varname>$sender_fullhost</varname></term>
16949 <listitem>
16950 <para>
16951 <indexterm role="concept">
16952 <primary><varname>$sender_fullhost</varname></primary>
16953 </indexterm>
16954 When a message is received from a remote host, this variable contains the host
16955 name and IP address in a single string. It ends with the IP address in square
16956 brackets, followed by a colon and a port number if the logging of ports is
16957 enabled. The format of the rest of the string depends on whether the host
16958 issued a HELO or EHLO SMTP command, and whether the host name was verified by
16959 looking up its IP address. (Looking up the IP address can be forced by the
16960 <option>host_lookup</option> option, independent of verification.) A plain host name at the
16961 start of the string is a verified host name; if this is not present,
16962 verification either failed or was not requested. A host name in parentheses is
16963 the argument of a HELO or EHLO command. This is omitted if it is identical to
16964 the verified host name or to the host&#x2019;s IP address in square brackets.
16965 </para>
16966 </listitem></varlistentry>
16967 <varlistentry>
16968 <term><varname>$sender_helo_name</varname></term>
16969 <listitem>
16970 <para>
16971 <indexterm role="concept">
16972 <primary><varname>$sender_helo_name</varname></primary>
16973 </indexterm>
16974 When a message is received from a remote host that has issued a HELO or EHLO
16975 command, the argument of that command is placed in this variable. It is also
16976 set if HELO or EHLO is used when a message is received using SMTP locally via
16977 the <option>-bs</option> or <option>-bS</option> options.
16978 </para>
16979 </listitem></varlistentry>
16980 <varlistentry>
16981 <term><varname>$sender_host_address</varname></term>
16982 <listitem>
16983 <para>
16984 <indexterm role="concept">
16985 <primary><varname>$sender_host_address</varname></primary>
16986 </indexterm>
16987 When a message is received from a remote host, this variable contains that
16988 host&#x2019;s IP address. For locally submitted messages, it is empty.
16989 </para>
16990 </listitem></varlistentry>
16991 <varlistentry>
16992 <term><varname>$sender_host_authenticated</varname></term>
16993 <listitem>
16994 <para>
16995 <indexterm role="concept">
16996 <primary><varname>$sender_host_authenticated</varname></primary>
16997 </indexterm>
16998 This variable contains the name (not the public name) of the authenticator
16999 driver that successfully authenticated the client from which the message was
17000 received. It is empty if there was no successful authentication. See also
17001 <varname>$authenticated_id</varname>.
17002 </para>
17003 </listitem></varlistentry>
17004 <varlistentry>
17005 <term><varname>$sender_host_name</varname></term>
17006 <listitem>
17007 <para>
17008 <indexterm role="concept">
17009 <primary><varname>$sender_host_name</varname></primary>
17010 </indexterm>
17011 When a message is received from a remote host, this variable contains the
17012 host&#x2019;s name as obtained by looking up its IP address. For messages received by
17013 other means, this variable is empty.
17014 </para>
17015 <para>
17016 <indexterm role="concept">
17017 <primary><varname>$host_lookup_failed</varname></primary>
17018 </indexterm>
17019 If the host name has not previously been looked up, a reference to
17020 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
17021 A looked up name is accepted only if it leads back to the original IP address
17022 via a forward lookup. If either the reverse or the forward lookup fails to find
17023 any data, or if the forward lookup does not yield the original IP address,
17024 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
17025 </para>
17026 <para>
17027 <indexterm role="concept">
17028 <primary><varname>$host_lookup_deferred</varname></primary>
17029 </indexterm>
17030 However, if either of the lookups cannot be completed (for example, there is a
17031 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
17032 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
17033 </para>
17034 <para revisionflag="changed">
17035 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
17036 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
17037 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
17038 is set to <quote>1</quote>.
17039 </para>
17040 <para>
17041 Exim does not automatically look up every calling host&#x2019;s name. If you want
17042 maximum efficiency, you should arrange your configuration so that it avoids
17043 these lookups altogether. The lookup happens only if one or more of the
17044 following are true:
17045 </para>
17046 <itemizedlist>
17047 <listitem>
17048 <para>
17049 A string containing <varname>$sender_host_name</varname> is expanded.
17050 </para>
17051 </listitem>
17052 <listitem>
17053 <para>
17054 The calling host matches the list in <option>host_lookup</option>. In the default
17055 configuration, this option is set to *, so it must be changed if lookups are
17056 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
17057 </para>
17058 </listitem>
17059 <listitem>
17060 <para>
17061 Exim needs the host name in order to test an item in a host list. The items
17062 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
17063 <xref linkend="SECThoslispatnamsk"/>.
17064 </para>
17065 </listitem>
17066 <listitem>
17067 <para>
17068 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
17069 In this case, the host name is required to compare with the name quoted in any
17070 EHLO or HELO commands that the client issues.
17071 </para>
17072 </listitem>
17073 <listitem>
17074 <para>
17075 The remote host issues a EHLO or HELO command that quotes one of the
17076 domains in <option>helo_lookup_domains</option>. The default value of this option is
17077 </para>
17078 <literallayout class="monospaced">
17079   helo_lookup_domains = @ : @[]
17080 </literallayout>
17081 <para>
17082 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
17083 IP address in an EHLO or HELO command.
17084 </para>
17085 </listitem>
17086 </itemizedlist>
17087 </listitem></varlistentry>
17088 <varlistentry>
17089 <term><varname>$sender_host_port</varname></term>
17090 <listitem>
17091 <para>
17092 <indexterm role="concept">
17093 <primary><varname>$sender_host_port</varname></primary>
17094 </indexterm>
17095 When a message is received from a remote host, this variable contains the port
17096 number that was used on the remote host.
17097 </para>
17098 </listitem></varlistentry>
17099 <varlistentry>
17100 <term><varname>$sender_ident</varname></term>
17101 <listitem>
17102 <para>
17103 <indexterm role="concept">
17104 <primary><varname>$sender_ident</varname></primary>
17105 </indexterm>
17106 When a message is received from a remote host, this variable contains the
17107 identification received in response to an RFC 1413 request. When a message has
17108 been received locally, this variable contains the login name of the user that
17109 called Exim.
17110 </para>
17111 </listitem></varlistentry>
17112 <varlistentry>
17113 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
17114 <listitem>
17115 <para>
17116 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
17117 <option>ratelimit</option> ACL condition. Details are given in section
17118 <xref linkend="SECTratelimiting"/>.
17119 </para>
17120 </listitem></varlistentry>
17121 <varlistentry>
17122 <term><varname>$sender_rcvhost</varname></term>
17123 <listitem>
17124 <para>
17125 <indexterm role="concept">
17126 <primary>DNS</primary>
17127 <secondary>reverse lookup</secondary>
17128 </indexterm>
17129 <indexterm role="concept">
17130 <primary>reverse DNS lookup</primary>
17131 </indexterm>
17132 <indexterm role="concept">
17133 <primary><varname>$sender_rcvhost</varname></primary>
17134 </indexterm>
17135 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
17136 either the verified host name (as obtained from a reverse DNS lookup) or, if
17137 there is no verified host name, the IP address in square brackets. After that
17138 there may be text in parentheses. When the first item is a verified host name,
17139 the first thing in the parentheses is the IP address in square brackets,
17140 followed by a colon and a port number if port logging is enabled. When the
17141 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
17142 the parentheses.
17143 </para>
17144 <para>
17145 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
17146 was used and its argument was not identical to the real host name or IP
17147 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
17148 all three items are present in the parentheses, a newline and tab are inserted
17149 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
17150 </para>
17151 </listitem></varlistentry>
17152 <varlistentry>
17153 <term><varname>$sender_verify_failure</varname></term>
17154 <listitem>
17155 <para>
17156 <indexterm role="concept">
17157 <primary><varname>$sender_verify_failure</varname></primary>
17158 </indexterm>
17159 In an ACL, when a sender verification fails, this variable contains information
17160 about the failure. The details are the same as for
17161 <varname>$recipient_verify_failure</varname>.
17162 </para>
17163 </listitem></varlistentry>
17164 <varlistentry>
17165 <term><varname>$smtp_active_hostname</varname></term>
17166 <listitem>
17167 <para>
17168 <indexterm role="concept">
17169 <primary><varname>$smtp_active_hostname</varname></primary>
17170 </indexterm>
17171 During an SMTP session, this variable contains the value of the active host
17172 name, as specified by the <option>smtp_active_hostname</option> option. The value of
17173 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
17174 value can be consulted during routing and delivery.
17175 </para>
17176 </listitem></varlistentry>
17177 <varlistentry>
17178 <term><varname>$smtp_command</varname></term>
17179 <listitem>
17180 <para>
17181 <indexterm role="concept">
17182 <primary><varname>$smtp_command</varname></primary>
17183 </indexterm>
17184 During the processing of an incoming SMTP command, this variable contains the
17185 entire command. This makes it possible to distinguish between HELO and EHLO in
17186 the HELO ACL, and also to distinguish between commands such as these:
17187 </para>
17188 <literallayout class="monospaced">
17189 MAIL FROM:&lt;&gt;
17190 MAIL FROM: &lt;&gt;
17191 </literallayout>
17192 <para>
17193 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
17194 command, the address in <varname>$smtp_command</varname> is the original address before any
17195 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
17196 the address after SMTP-time rewriting.
17197 </para>
17198 </listitem></varlistentry>
17199 <varlistentry>
17200 <term><varname>$smtp_command_argument</varname></term>
17201 <listitem>
17202 <para>
17203 <indexterm role="concept">
17204 <primary>SMTP command</primary>
17205 <secondary>argument for</secondary>
17206 </indexterm>
17207 <indexterm role="concept">
17208 <primary><varname>$smtp_command_argument</varname></primary>
17209 </indexterm>
17210 While an ACL is running to check an SMTP command, this variable contains the
17211 argument, that is, the text that follows the command name, with leading white
17212 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
17213 somewhat redundant, but is retained for backwards compatibility.
17214 </para>
17215 </listitem></varlistentry>
17216 <varlistentry>
17217 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
17218 <listitem>
17219 <para>
17220 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
17221 that were current at the end of the system filter file. This allows a system
17222 filter file to set values that can be tested in users&#x2019; filter files. For
17223 example, a system filter could set a value indicating how likely it is that a
17224 message is junk mail.
17225 </para>
17226 </listitem></varlistentry>
17227 <varlistentry>
17228 <term><varname>$spam_</varname><emphasis>xxx</emphasis></term>
17229 <listitem>
17230 <para>
17231 A number of variables whose names start with <varname>$spam</varname> are available when Exim
17232 is compiled with the content-scanning extension. For details, see section
17233 <xref linkend="SECTscanspamass"/>.
17234 </para>
17235 </listitem></varlistentry>
17236 <varlistentry>
17237 <term><varname>$spool_directory</varname></term>
17238 <listitem>
17239 <para>
17240 <indexterm role="concept">
17241 <primary><varname>$spool_directory</varname></primary>
17242 </indexterm>
17243 The name of Exim&#x2019;s spool directory.
17244 </para>
17245 </listitem></varlistentry>
17246 <varlistentry>
17247 <term><varname>$spool_inodes</varname></term>
17248 <listitem>
17249 <para>
17250 <indexterm role="concept">
17251 <primary><varname>$spool_inodes</varname></primary>
17252 </indexterm>
17253 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
17254 being written. The value is recalculated whenever the variable is referenced.
17255 If the relevant file system does not have the concept of inodes, the value of
17256 is -1. See also the <option>check_spool_inodes</option> option.
17257 </para>
17258 </listitem></varlistentry>
17259 <varlistentry>
17260 <term><varname>$spool_space</varname></term>
17261 <listitem>
17262 <para>
17263 <indexterm role="concept">
17264 <primary><varname>$spool_space</varname></primary>
17265 </indexterm>
17266 The amount of free space (as a number of kilobytes) in the disk partition where
17267 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
17268 variable is referenced. If the operating system does not have the ability to
17269 find the amount of free space (only true for experimental systems), the space
17270 value is -1. For example, to check in an ACL that there is at least 50
17271 megabytes free on the spool, you could write:
17272 </para>
17273 <literallayout class="monospaced">
17274 condition = ${if &gt; {$spool_space}{50000}}
17275 </literallayout>
17276 <para>
17277 See also the <option>check_spool_space</option> option.
17278 </para>
17279 </listitem></varlistentry>
17280 <varlistentry>
17281 <term><varname>$thisaddress</varname></term>
17282 <listitem>
17283 <para>
17284 <indexterm role="concept">
17285 <primary><varname>$thisaddress</varname></primary>
17286 </indexterm>
17287 This variable is set only during the processing of the <option>foranyaddress</option>
17288 command in a filter file. Its use is explained in the description of that
17289 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
17290 interfaces to mail filtering</emphasis>.
17291 </para>
17292 </listitem></varlistentry>
17293 <varlistentry>
17294 <term><varname>$tls_certificate_verified</varname></term>
17295 <listitem>
17296 <para>
17297 <indexterm role="concept">
17298 <primary><varname>$tls_certificate_verified</varname></primary>
17299 </indexterm>
17300 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
17301 message was received, and <quote>0</quote> otherwise.
17302 </para>
17303 </listitem></varlistentry>
17304 <varlistentry>
17305 <term><varname>$tls_cipher</varname></term>
17306 <listitem>
17307 <para>
17308 <indexterm role="concept">
17309 <primary><varname>$tls_cipher</varname></primary>
17310 </indexterm>
17311 When a message is received from a remote host over an encrypted SMTP
17312 connection, this variable is set to the cipher suite that was negotiated, for
17313 example DES-CBC3-SHA. In other circumstances, in particular, for message
17314 received over unencrypted connections, the variable is empty. See chapter
17315 <xref linkend="CHAPTLS"/> for details of TLS support.
17316 </para>
17317 </listitem></varlistentry>
17318 <varlistentry>
17319 <term><varname>$tls_peerdn</varname></term>
17320 <listitem>
17321 <para>
17322 <indexterm role="concept">
17323 <primary><varname>$tls_peerdn</varname></primary>
17324 </indexterm>
17325 When a message is received from a remote host over an encrypted SMTP
17326 connection, and Exim is configured to request a certificate from the client,
17327 the value of the Distinguished Name of the certificate is made available in the
17328 <varname>$tls_peerdn</varname> during subsequent processing.
17329 </para>
17330 </listitem></varlistentry>
17331 <varlistentry>
17332 <term><varname>$tod_bsdinbox</varname></term>
17333 <listitem>
17334 <para>
17335 <indexterm role="concept">
17336 <primary><varname>$tod_bsdinbox</varname></primary>
17337 </indexterm>
17338 The time of day and the date, in the format required for BSD-style mailbox
17339 files, for example: Thu Oct 17 17:14:09 1995.
17340 </para>
17341 </listitem></varlistentry>
17342 <varlistentry>
17343 <term><varname>$tod_epoch</varname></term>
17344 <listitem>
17345 <para>
17346 <indexterm role="concept">
17347 <primary><varname>$tod_epoch</varname></primary>
17348 </indexterm>
17349 The time and date as a number of seconds since the start of the Unix epoch.
17350 </para>
17351 </listitem></varlistentry>
17352 <varlistentry>
17353 <term><varname>$tod_full</varname></term>
17354 <listitem>
17355 <para>
17356 <indexterm role="concept">
17357 <primary><varname>$tod_full</varname></primary>
17358 </indexterm>
17359 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
17360 +0100. The timezone is always given as a numerical offset from UTC, with
17361 positive values used for timezones that are ahead (east) of UTC, and negative
17362 values for those that are behind (west).
17363 </para>
17364 </listitem></varlistentry>
17365 <varlistentry>
17366 <term><varname>$tod_log</varname></term>
17367 <listitem>
17368 <para>
17369 <indexterm role="concept">
17370 <primary><varname>$tod_log</varname></primary>
17371 </indexterm>
17372 The time and date in the format used for writing Exim&#x2019;s log files, for example:
17373 1995-10-12 15:32:29, but without a timezone.
17374 </para>
17375 </listitem></varlistentry>
17376 <varlistentry>
17377 <term><varname>$tod_logfile</varname></term>
17378 <listitem>
17379 <para>
17380 <indexterm role="concept">
17381 <primary><varname>$tod_logfile</varname></primary>
17382 </indexterm>
17383 This variable contains the date in the format yyyymmdd. This is the format that
17384 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
17385 flag.
17386 </para>
17387 </listitem></varlistentry>
17388 <varlistentry>
17389 <term><varname>$tod_zone</varname></term>
17390 <listitem>
17391 <para>
17392 <indexterm role="concept">
17393 <primary><varname>$tod_zone</varname></primary>
17394 </indexterm>
17395 This variable contains the numerical value of the local timezone, for example:
17396 -0500.
17397 </para>
17398 </listitem></varlistentry>
17399 <varlistentry>
17400 <term><varname>$tod_zulu</varname></term>
17401 <listitem>
17402 <para>
17403 <indexterm role="concept">
17404 <primary><varname>$tod_zulu</varname></primary>
17405 </indexterm>
17406 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
17407 by ISO 8601, for example: 20030221154023Z.
17408 </para>
17409 </listitem></varlistentry>
17410 <varlistentry>
17411 <term><varname>$value</varname></term>
17412 <listitem>
17413 <para>
17414 <indexterm role="concept">
17415 <primary><varname>$value</varname></primary>
17416 </indexterm>
17417 This variable contains the result of an expansion lookup, extraction operation,
17418 or external command, as described above.
17419 </para>
17420 </listitem></varlistentry>
17421 <varlistentry>
17422 <term><varname>$version_number</varname></term>
17423 <listitem>
17424 <para>
17425 <indexterm role="concept">
17426 <primary><varname>$version_number</varname></primary>
17427 </indexterm>
17428 The version number of Exim.
17429 </para>
17430 </listitem></varlistentry>
17431 <varlistentry>
17432 <term><varname>$warn_message_delay</varname></term>
17433 <listitem>
17434 <para>
17435 <indexterm role="concept">
17436 <primary><varname>$warn_message_delay</varname></primary>
17437 </indexterm>
17438 This variable is set only during the creation of a message warning about a
17439 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17440 </para>
17441 </listitem></varlistentry>
17442 <varlistentry>
17443 <term><varname>$warn_message_recipients</varname></term>
17444 <listitem>
17445 <para>
17446 <indexterm role="concept">
17447 <primary><varname>$warn_message_recipients</varname></primary>
17448 </indexterm>
17449 This variable is set only during the creation of a message warning about a
17450 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
17451 </para>
17452 </listitem></varlistentry>
17453 </variablelist>
17454 <para>
17455 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
17456 </para>
17457 </section>
17458 </chapter>
17459
17460 <chapter id="CHAPperl">
17461 <title>Embedded Perl</title>
17462 <para>
17463 <indexterm role="concept" id="IIDperl" class="startofrange">
17464 <primary>Perl</primary>
17465 <secondary>calling from Exim</secondary>
17466 </indexterm>
17467 Exim can be built to include an embedded Perl interpreter. When this is done,
17468 Perl subroutines can be called as part of the string expansion process. To make
17469 use of the Perl support, you need version 5.004 or later of Perl installed on
17470 your system. To include the embedded interpreter in the Exim binary, include
17471 the line
17472 </para>
17473 <literallayout class="monospaced">
17474 EXIM_PERL = perl.o
17475 </literallayout>
17476 <para>
17477 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
17478 </para>
17479 <section>
17480 <title>Setting up so Perl can be used</title>
17481 <para>
17482 <indexterm role="concept">
17483 <primary><option>perl_startup</option></primary>
17484 </indexterm>
17485 Access to Perl subroutines is via a global configuration option called
17486 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
17487 no <option>perl_startup</option> option in the Exim configuration file then no Perl
17488 interpreter is started and there is almost no overhead for Exim (since none of
17489 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
17490 option then the associated value is taken to be Perl code which is executed in
17491 a newly created Perl interpreter.
17492 </para>
17493 <para>
17494 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
17495 need backslashes before any characters to escape special meanings. The option
17496 should usually be something like
17497 </para>
17498 <literallayout class="monospaced">
17499 perl_startup = do '/etc/exim.pl'
17500 </literallayout>
17501 <para>
17502 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
17503 use from Exim. Exim can be configured either to start up a Perl interpreter as
17504 soon as it is entered, or to wait until the first time it is needed. Starting
17505 the interpreter at the beginning ensures that it is done while Exim still has
17506 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
17507 fact used in a particular run. Also, note that this does not mean that Exim is
17508 necessarily running as root when Perl is called at a later time. By default,
17509 the interpreter is started only when it is needed, but this can be changed in
17510 two ways:
17511 </para>
17512 <itemizedlist>
17513 <listitem>
17514 <para>
17515 <indexterm role="concept">
17516 <primary><option>perl_at_start</option></primary>
17517 </indexterm>
17518 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
17519 a startup when Exim is entered.
17520 </para>
17521 </listitem>
17522 <listitem>
17523 <para>
17524 The command line option <option>-ps</option> also requests a startup when Exim is entered,
17525 overriding the setting of <option>perl_at_start</option>.
17526 </para>
17527 </listitem>
17528 </itemizedlist>
17529 <para>
17530 There is also a command line option <option>-pd</option> (for delay) which suppresses the
17531 initial startup, even if <option>perl_at_start</option> is set.
17532 </para>
17533 </section>
17534 <section>
17535 <title>Calling Perl subroutines</title>
17536 <para>
17537 When the configuration file includes a <option>perl_startup</option> option you can make use
17538 of the string expansion item to call the Perl subroutines that are defined
17539 by the <option>perl_startup</option> code. The operator is used in any of the following
17540 forms:
17541 </para>
17542 <literallayout class="monospaced">
17543 ${perl{foo}}
17544 ${perl{foo}{argument}}
17545 ${perl{foo}{argument1}{argument2} ... }
17546 </literallayout>
17547 <para>
17548 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
17549 arguments may be passed. Passing more than this results in an expansion failure
17550 with an error message of the form
17551 </para>
17552 <literallayout class="monospaced">
17553 Too many arguments passed to Perl subroutine "foo" (max is 8)
17554 </literallayout>
17555 <para>
17556 The return value of the Perl subroutine is evaluated in a scalar context before
17557 it is passed back to Exim to be inserted into the expanded string. If the
17558 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
17559 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
17560 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
17561 that was passed to <option>die</option>.
17562 </para>
17563 </section>
17564 <section>
17565 <title>Calling Exim functions from Perl</title>
17566 <para>
17567 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
17568 is available to call back into Exim&#x2019;s string expansion function. For example,
17569 the Perl code
17570 </para>
17571 <literallayout class="monospaced">
17572 my $lp = Exim::expand_string('$local_part');
17573 </literallayout>
17574 <para>
17575 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
17576 Note those are single quotes and not double quotes to protect against
17577 <varname>$local_part</varname> being interpolated as a Perl variable.
17578 </para>
17579 <para>
17580 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
17581 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
17582 expansion string, the Perl call from the original expansion string fails with
17583 an appropriate error message, in the same way as if <option>die</option> were used.
17584 </para>
17585 <para>
17586 <indexterm role="concept">
17587 <primary>debugging</primary>
17588 <secondary>from embedded Perl</secondary>
17589 </indexterm>
17590 <indexterm role="concept">
17591 <primary>log</primary>
17592 <secondary>writing from embedded Perl</secondary>
17593 </indexterm>
17594 Two other Exim functions are available for use from within Perl code.
17595 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
17596 debugging is enabled. If you want a newline at the end, you must supply it.
17597 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
17598 timestamp. In this case, you should not supply a terminating newline.
17599 </para>
17600 </section>
17601 <section>
17602 <title>Use of standard output and error by Perl</title>
17603 <para>
17604 <indexterm role="concept">
17605 <primary>Perl</primary>
17606 <secondary>standard output and error</secondary>
17607 </indexterm>
17608 You should not write to the standard error or output streams from within your
17609 Perl code, as it is not defined how these are set up. In versions of Exim
17610 before 4.50, it is possible for the standard output or error to refer to the
17611 SMTP connection during message reception via the daemon. Writing to this stream
17612 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
17613 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
17614 avoided, but the output is lost.
17615 </para>
17616 <para>
17617 <indexterm role="concept">
17618 <primary>Perl</primary>
17619 <secondary>use of <option>warn</option></secondary>
17620 </indexterm>
17621 The Perl <option>warn</option> statement writes to the standard error stream by default.
17622 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
17623 you have no control. When Exim starts up the Perl interpreter, it arranges for
17624 output from the <option>warn</option> statement to be written to the Exim main log. You can
17625 change this by including appropriate Perl magic somewhere in your Perl code.
17626 For example, to discard <option>warn</option> output completely, you need this:
17627 </para>
17628 <literallayout class="monospaced">
17629 $SIG{__WARN__} = sub { };
17630 </literallayout>
17631 <para>
17632 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
17633 example, the code for the subroutine is empty, so it does nothing, but you can
17634 include any Perl code that you like. The text of the <option>warn</option> message is passed
17635 as the first subroutine argument.
17636 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
17637 </para>
17638 </section>
17639 </chapter>
17640
17641 <chapter id="CHAPinterfaces">
17642 <title>Starting the daemon and the use of network interfaces</title>
17643 <titleabbrev>Starting the daemon</titleabbrev>
17644 <para>
17645 <indexterm role="concept">
17646 <primary>daemon</primary>
17647 <secondary>starting</secondary>
17648 </indexterm>
17649 <indexterm role="concept">
17650 <primary>interface</primary>
17651 <secondary>listening</secondary>
17652 </indexterm>
17653 <indexterm role="concept">
17654 <primary>network interface</primary>
17655 </indexterm>
17656 <indexterm role="concept">
17657 <primary>interface</primary>
17658 <secondary>network</secondary>
17659 </indexterm>
17660 <indexterm role="concept">
17661 <primary>IP address</primary>
17662 <secondary>for listening</secondary>
17663 </indexterm>
17664 <indexterm role="concept">
17665 <primary>daemon</primary>
17666 <secondary>listening IP addresses</secondary>
17667 </indexterm>
17668 <indexterm role="concept">
17669 <primary>TCP/IP</primary>
17670 <secondary>setting listening interfaces</secondary>
17671 </indexterm>
17672 <indexterm role="concept">
17673 <primary>TCP/IP</primary>
17674 <secondary>setting listening ports</secondary>
17675 </indexterm>
17676 A host that is connected to a TCP/IP network may have one or more physical
17677 hardware network interfaces. Each of these interfaces may be configured as one
17678 or more <quote>logical</quote> interfaces, which are the entities that a program actually
17679 works with. Each of these logical interfaces is associated with an IP address.
17680 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
17681 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
17682 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
17683 </para>
17684 <orderedlist numeration="arabic">
17685 <listitem>
17686 <para>
17687 When a listening daemon is started, Exim needs to know which interfaces
17688 and ports to listen on.
17689 </para>
17690 </listitem>
17691 <listitem>
17692 <para>
17693 When Exim is routing an address, it needs to know which IP addresses
17694 are associated with local interfaces. This is required for the correct
17695 processing of MX lists by removing the local host and others with the
17696 same or higher priority values. Also, Exim needs to detect cases
17697 when an address is routed to an IP address that in fact belongs to the
17698 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
17699 option of the smtp transport is set (as appropriate), this is treated
17700 as an error situation.
17701 </para>
17702 </listitem>
17703 <listitem>
17704 <para>
17705 When Exim connects to a remote host, it may need to know which interface to use
17706 for the outgoing connection.
17707 </para>
17708 </listitem>
17709 </orderedlist>
17710 <para>
17711 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
17712 of cases. If your host has only one interface, and you want all its IP
17713 addresses to be treated in the same way, and you are using only the
17714 standard SMTP port, you should not need to take any special action. The
17715 rest of this chapter does not apply to you.
17716 </para>
17717 <para>
17718 In a more complicated situation you may want to listen only on certain
17719 interfaces, or on different ports, and for this reason there are a number of
17720 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
17721 chapter describes how they operate.
17722 </para>
17723 <para>
17724 When a message is received over TCP/IP, the interface and port that were
17725 actually used are set in <varname>$interface_address</varname> and <varname>$interface_port</varname>.
17726 </para>
17727 <section>
17728 <title>Starting a listening daemon</title>
17729 <para>
17730 When a listening daemon is started (by means of the <option>-bd</option> command line
17731 option), the interfaces and ports on which it listens are controlled by the
17732 following options:
17733 </para>
17734 <itemizedlist>
17735 <listitem>
17736 <para>
17737 <option>daemon_smtp_ports</option> contains a list of default ports. (For backward
17738 compatibility, this option can also be specified in the singular.)
17739 </para>
17740 </listitem>
17741 <listitem>
17742 <para>
17743 <option>local_interfaces</option> contains list of interface IP addresses on which to
17744 listen. Each item may optionally also specify a port.
17745 </para>
17746 </listitem>
17747 </itemizedlist>
17748 <para>
17749 The default list separator in both cases is a colon, but this can be changed as
17750 described in section <xref linkend="SECTlistconstruct"/>. When IPv6 addresses are involved,
17751 it is usually best to change the separator to avoid having to double all the
17752 colons. For example:
17753 </para>
17754 <literallayout class="monospaced">
17755 local_interfaces = &lt;; 127.0.0.1 ; \
17756                       192.168.23.65 ; \
17757                       ::1 ; \
17758                       3ffe:ffff:836f::fe86:a061
17759 </literallayout>
17760 <para>
17761 There are two different formats for specifying a port along with an IP address
17762 in <option>local_interfaces</option>:
17763 </para>
17764 <orderedlist numeration="arabic">
17765 <listitem>
17766 <para>
17767 The port is added onto the address with a dot separator. For example, to listen
17768 on port 1234 on two different IP addresses:
17769 </para>
17770 <literallayout class="monospaced">
17771 local_interfaces = &lt;; 192.168.23.65.1234 ; \
17772                       3ffe:ffff:836f::fe86:a061.1234
17773 </literallayout>
17774 </listitem>
17775 <listitem>
17776 <para>
17777 The IP address is enclosed in square brackets, and the port is added
17778 with a colon separator, for example:
17779 </para>
17780 <literallayout class="monospaced">
17781 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
17782                       [3ffe:ffff:836f::fe86:a061]:1234
17783 </literallayout>
17784 </listitem>
17785 </orderedlist>
17786 <para>
17787 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
17788 default setting contains just one port:
17789 </para>
17790 <literallayout class="monospaced">
17791 daemon_smtp_ports = smtp
17792 </literallayout>
17793 <para>
17794 If more than one port is listed, each interface that does not have its own port
17795 specified listens on all of them. Ports that are listed in
17796 <option>daemon_smtp_ports</option> can be identified either by name (defined in
17797 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
17798 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
17799 </para>
17800 </section>
17801 <section>
17802 <title>Special IP listening addresses</title>
17803 <para>
17804 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
17805 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
17806 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
17807 instead of setting up separate listening sockets for each interface. The
17808 default value of <option>local_interfaces</option> is
17809 </para>
17810 <literallayout class="monospaced">
17811 local_interfaces = 0.0.0.0
17812 </literallayout>
17813 <para>
17814 when Exim is built without IPv6 support; otherwise it is:
17815 </para>
17816 <literallayout class="monospaced">
17817 local_interfaces = &lt;; ::0 ; 0.0.0.0
17818 </literallayout>
17819 <para>
17820 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
17821 </para>
17822 </section>
17823 <section>
17824 <title>Overriding local_interfaces and daemon_smtp_ports</title>
17825 <para>
17826 The <option>-oX</option> command line option can be used to override the values of
17827 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
17828 instance. Another way of doing this would be to use macros and the <option>-D</option>
17829 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
17830 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
17831 exim.
17832 </para>
17833 <para>
17834 The value of <option>-oX</option> is a list of items. The default colon separator can be
17835 changed in the usual way if required. If there are any items that do not
17836 contain dots or colons (that is, are not IP addresses), the value of
17837 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
17838 items that do contain dots or colons, the value of <option>local_interfaces</option> is
17839 replaced by those items. Thus, for example,
17840 </para>
17841 <literallayout class="monospaced">
17842 -oX 1225
17843 </literallayout>
17844 <para>
17845 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
17846 whereas
17847 </para>
17848 <literallayout class="monospaced">
17849 -oX 192.168.34.5.1125
17850 </literallayout>
17851 <para>
17852 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
17853 (However, since <option>local_interfaces</option> now contains no items without ports, the
17854 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
17855 </para>
17856 </section>
17857 <section id="SECTsupobssmt">
17858 <title>Support for the obsolete SSMTP (or SMTPS) protocol</title>
17859 <para>
17860 <indexterm role="concept">
17861 <primary>ssmtp protocol</primary>
17862 </indexterm>
17863 <indexterm role="concept">
17864 <primary>smtps protocol</primary>
17865 </indexterm>
17866 <indexterm role="concept">
17867 <primary>SMTP</primary>
17868 <secondary>ssmtp protocol</secondary>
17869 </indexterm>
17870 <indexterm role="concept">
17871 <primary>SMTP</primary>
17872 <secondary>smtps protocol</secondary>
17873 </indexterm>
17874 Exim supports the obsolete SSMTP protocol (also known as SMTPS) that was used
17875 before the STARTTLS command was standardized for SMTP. Some legacy clients
17876 still use this protocol. If the <option>tls_on_connect_ports</option> option is set to a
17877 list of port numbers, connections to those ports must use SSMTP. The most
17878 common use of this option is expected to be
17879 </para>
17880 <literallayout class="monospaced">
17881 tls_on_connect_ports = 465
17882 </literallayout>
17883 <para>
17884 because 465 is the usual port number used by the legacy clients. There is also
17885 a command line option <option>-tls-on-connect</option>, which forces all ports to behave in
17886 this way when a daemon is started.
17887 </para>
17888 <para>
17889 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
17890 daemon to listen on those ports. You must still specify them in
17891 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
17892 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
17893 connections via the daemon.)
17894 </para>
17895 </section>
17896 <section>
17897 <title>IPv6 address scopes</title>
17898 <para>
17899 <indexterm role="concept">
17900 <primary>IPv6</primary>
17901 <secondary>address scopes</secondary>
17902 </indexterm>
17903 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
17904 can, in principle, have the same link-local IPv6 address on different
17905 interfaces. Thus, additional information is needed, over and above the IP
17906 address, to distinguish individual interfaces. A convention of using a
17907 percent sign followed by something (often the interface name) has been
17908 adopted in some cases, leading to addresses like this:
17909 </para>
17910 <literallayout class="monospaced">
17911 fe80::202:b3ff:fe03:45c1%eth0
17912 </literallayout>
17913 <para>
17914 To accommodate this usage, a percent sign followed by an arbitrary string is
17915 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
17916 to convert a textual IPv6 address for actual use. This function recognizes the
17917 percent convention in operating systems that support it, and it processes the
17918 address appropriately. Unfortunately, some older libraries have problems with
17919 <function>getaddrinfo()</function>. If
17920 </para>
17921 <literallayout class="monospaced">
17922 IPV6_USE_INET_PTON=yes
17923 </literallayout>
17924 <para>
17925 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
17926 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
17927 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
17928 function.) Of course, this means that the additional functionality of
17929 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
17930 </para>
17931 </section>
17932 <section>
17933 <title>Disabling IPv6</title>
17934 <para>
17935 <indexterm role="concept">
17936 <primary>IPv6</primary>
17937 <secondary>disabling</secondary>
17938 </indexterm>
17939 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
17940 run on a host whose kernel does not support IPv6. The binary will fall back to
17941 using IPv4, but it may waste resources looking up AAAA records, and trying to
17942 connect to IPv6 addresses, causing delays to mail delivery. If you set the
17943 <indexterm role="option">
17944 <primary><option>disable_ipv6</option></primary>
17945 </indexterm>
17946 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
17947 activities take place. AAAA records are never looked up, and any IPv6 addresses
17948 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
17949 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
17950 to handle IPv6 literal addresses.
17951 </para>
17952 <para>
17953 On the other hand, when IPv6 is in use, there may be times when you want to
17954 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
17955 option to globally suppress the lookup of AAAA records for specified domains,
17956 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
17957 IPv6 addresses in an individual router.
17958 </para>
17959 </section>
17960 <section>
17961 <title>Examples of starting a listening daemon</title>
17962 <para>
17963 The default case in an IPv6 environment is
17964 </para>
17965 <literallayout class="monospaced">
17966 daemon_smtp_ports = smtp
17967 local_interfaces = &lt;; ::0 ; 0.0.0.0
17968 </literallayout>
17969 <para>
17970 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
17971 Either one or two sockets may be used, depending on the characteristics of
17972 the TCP/IP stack. (This is complicated and messy; for more information,
17973 read the comments in the <filename>daemon.c</filename> source file.)
17974 </para>
17975 <para>
17976 To specify listening on ports 25 and 26 on all interfaces:
17977 </para>
17978 <literallayout class="monospaced">
17979 daemon_smtp_ports = 25 : 26
17980 </literallayout>
17981 <para>
17982 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
17983 </para>
17984 <literallayout class="monospaced">
17985 local_interfaces = &lt;; ::0.25     ; ::0.26 \
17986                       0.0.0.0.25 ; 0.0.0.0.26
17987 </literallayout>
17988 <para>
17989 To listen on the default port on all IPv4 interfaces, and on port 26 on the
17990 IPv4 loopback address only:
17991 </para>
17992 <literallayout class="monospaced">
17993 local_interfaces = 0.0.0.0 : 127.0.0.1.26
17994 </literallayout>
17995 <para>
17996 To specify listening on the default port on specific interfaces only:
17997 </para>
17998 <literallayout class="monospaced">
17999 local_interfaces = 192.168.34.67 : 192.168.34.67
18000 </literallayout>
18001 <para>
18002 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
18003 </para>
18004 </section>
18005 <section id="SECTreclocipadd">
18006 <title>Recognising the local host</title>
18007 <para>
18008 The <option>local_interfaces</option> option is also used when Exim needs to determine
18009 whether or not an IP address refers to the local host. That is, the IP
18010 addresses of all the interfaces on which a daemon is listening are always
18011 treated as local.
18012 </para>
18013 <para>
18014 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
18015 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
18016 available interfaces from the operating system, and extracts the relevant
18017 (that is, IPv4 or IPv6) addresses to use for checking.
18018 </para>
18019 <para>
18020 Some systems set up large numbers of virtual interfaces in order to provide
18021 many virtual web servers. In this situation, you may want to listen for
18022 email on only a few of the available interfaces, but nevertheless treat all
18023 interfaces as local when routing. You can do this by setting
18024 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
18025 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
18026 used for listening. Consider this example:
18027 </para>
18028 <literallayout class="monospaced">
18029 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
18030                       192.168.53.235 ; \
18031                       3ffe:2101:12:1:a00:20ff:fe86:a061
18032
18033 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
18034 </literallayout>
18035 <para>
18036 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
18037 address, but all available interface addresses are treated as local when
18038 Exim is routing.
18039 </para>
18040 <para>
18041 In some environments the local host name may be in an MX list, but with an IP
18042 address that is not assigned to any local interface. In other cases it may be
18043 desirable to treat other host names as if they referred to the local host. Both
18044 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
18045 This contains host names rather than IP addresses. When a host is referenced
18046 during routing, either via an MX record or directly, it is treated as the local
18047 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
18048 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
18049 </para>
18050 </section>
18051 <section>
18052 <title>Delivering to a remote host</title>
18053 <para>
18054 Delivery to a remote host is handled by the smtp transport. By default, it
18055 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
18056 there is more than one) when connecting to a remote host. However, the
18057 <option>interface</option> option can be set to specify which interface is used. See the
18058 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
18059 details.
18060 </para>
18061 </section>
18062 </chapter>
18063
18064 <chapter id="CHAPmainconfig">
18065 <title>Main configuration</title>
18066 <para>
18067 <indexterm role="concept" id="IIDconfima" class="startofrange">
18068 <primary>configuration file</primary>
18069 <secondary>main section</secondary>
18070 </indexterm>
18071 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
18072 <primary>main configuration</primary>
18073 </indexterm>
18074 The first part of the run time configuration file contains three types of item:
18075 </para>
18076 <itemizedlist>
18077 <listitem>
18078 <para>
18079 Macro definitions: These lines start with an upper case letter. See section
18080 <xref linkend="SECTmacrodefs"/> for details of macro processing.
18081 </para>
18082 </listitem>
18083 <listitem>
18084 <para>
18085 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
18086 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
18087 section <xref linkend="SECTnamedlists"/>.
18088 </para>
18089 </listitem>
18090 <listitem>
18091 <para>
18092 Main configuration settings: Each setting occupies one line of the file
18093 (with possible continuations). If any setting is preceded by the word
18094 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
18095 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
18096 settings.
18097 </para>
18098 </listitem>
18099 </itemizedlist>
18100 <para>
18101 This chapter specifies all the main configuration options, along with their
18102 types and default values. For ease of finding a particular option, they appear
18103 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
18104 are now so many options, they are first listed briefly in functional groups, as
18105 an aid to finding the name of the option you are looking for. Some options are
18106 listed in more than one group.
18107 </para>
18108 <section>
18109 <title>Miscellaneous</title>
18110 <informaltable frame="none">
18111 <tgroup cols="2" colsep="0" rowsep="0">
18112 <colspec colwidth="196pt" align="left"/>
18113 <colspec colwidth="254pt" align="left"/>
18114 <tbody>
18115 <row>
18116 <entry><option>bi_command</option></entry>
18117 <entry>to run for <option>-bi</option> command line option</entry>
18118 </row>
18119 <row>
18120 <entry><option>disable_ipv6</option></entry>
18121 <entry>do no IPv6 processing</entry>
18122 </row>
18123 <row>
18124 <entry><option>keep_malformed</option></entry>
18125 <entry>for broken files &ndash; should not happen</entry>
18126 </row>
18127 <row>
18128 <entry><option>localhost_number</option></entry>
18129 <entry>for unique message ids in clusters</entry>
18130 </row>
18131 <row>
18132 <entry><option>message_body_visible</option></entry>
18133 <entry>how much to show in <varname>$message_body</varname></entry>
18134 </row>
18135 <row>
18136 <entry><option>mua_wrapper</option></entry>
18137 <entry>run in <quote>MUA wrapper</quote> mode</entry>
18138 </row>
18139 <row>
18140 <entry><option>print_topbitchars</option></entry>
18141 <entry>top-bit characters are printing</entry>
18142 </row>
18143 <row>
18144 <entry><option>timezone</option></entry>
18145 <entry>force time zone</entry>
18146 </row>
18147 </tbody>
18148 </tgroup>
18149 </informaltable>
18150 </section>
18151 <section>
18152 <title>Exim parameters</title>
18153 <informaltable frame="none">
18154 <tgroup cols="2" colsep="0" rowsep="0">
18155 <colspec colwidth="196pt" align="left"/>
18156 <colspec colwidth="254pt" align="left"/>
18157 <tbody>
18158 <row>
18159 <entry><option>exim_group</option></entry>
18160 <entry>override compiled-in value</entry>
18161 </row>
18162 <row>
18163 <entry><option>exim_path</option></entry>
18164 <entry>override compiled-in value</entry>
18165 </row>
18166 <row>
18167 <entry><option>exim_user</option></entry>
18168 <entry>override compiled-in value</entry>
18169 </row>
18170 <row>
18171 <entry><option>primary_hostname</option></entry>
18172 <entry>default from <function>uname()</function></entry>
18173 </row>
18174 <row>
18175 <entry><option>split_spool_directory</option></entry>
18176 <entry>use multiple directories</entry>
18177 </row>
18178 <row>
18179 <entry><option>spool_directory</option></entry>
18180 <entry>override compiled-in value</entry>
18181 </row>
18182 </tbody>
18183 </tgroup>
18184 </informaltable>
18185 </section>
18186 <section>
18187 <title>Privilege controls</title>
18188 <informaltable frame="none">
18189 <tgroup cols="2" colsep="0" rowsep="0">
18190 <colspec colwidth="196pt" align="left"/>
18191 <colspec colwidth="254pt" align="left"/>
18192 <tbody>
18193 <row>
18194 <entry><option>admin_groups</option></entry>
18195 <entry>groups that are Exim admin users</entry>
18196 </row>
18197 <row>
18198 <entry><option>deliver_drop_privilege</option></entry>
18199 <entry>drop root for delivery processes</entry>
18200 </row>
18201 <row>
18202 <entry><option>local_from_check</option></entry>
18203 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
18204 </row>
18205 <row>
18206 <entry><option>local_from_prefix</option></entry>
18207 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18208 </row>
18209 <row>
18210 <entry><option>local_from_suffix</option></entry>
18211 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
18212 </row>
18213 <row>
18214 <entry><option>local_sender_retain</option></entry>
18215 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
18216 </row>
18217 <row>
18218 <entry><option>never_users</option></entry>
18219 <entry>do not run deliveries as these</entry>
18220 </row>
18221 <row>
18222 <entry><option>prod_requires_admin</option></entry>
18223 <entry>forced delivery requires admin user</entry>
18224 </row>
18225 <row>
18226 <entry><option>queue_list_requires_admin</option></entry>
18227 <entry>queue listing requires admin user</entry>
18228 </row>
18229 <row>
18230 <entry><option>trusted_groups</option></entry>
18231 <entry>groups that are trusted</entry>
18232 </row>
18233 <row>
18234 <entry><option>trusted_users</option></entry>
18235 <entry>users that are trusted</entry>
18236 </row>
18237 </tbody>
18238 </tgroup>
18239 </informaltable>
18240 </section>
18241 <section>
18242 <title>Logging</title>
18243 <informaltable frame="none">
18244 <tgroup cols="2" colsep="0" rowsep="0">
18245 <colspec colwidth="196pt" align="left"/>
18246 <colspec colwidth="254pt" align="left"/>
18247 <tbody>
18248 <row>
18249 <entry><option>hosts_connection_nolog</option></entry>
18250 <entry>exemption from connect logging</entry>
18251 </row>
18252 <row>
18253 <entry><option>log_file_path</option></entry>
18254 <entry>override compiled-in value</entry>
18255 </row>
18256 <row>
18257 <entry><option>log_selector</option></entry>
18258 <entry>set/unset optional logging</entry>
18259 </row>
18260 <row>
18261 <entry><option>log_timezone</option></entry>
18262 <entry>add timezone to log lines</entry>
18263 </row>
18264 <row>
18265 <entry><option>message_logs</option></entry>
18266 <entry>create per-message logs</entry>
18267 </row>
18268 <row>
18269 <entry><option>preserve_message_logs</option></entry>
18270 <entry>after message completion</entry>
18271 </row>
18272 <row>
18273 <entry><option>process_log_path</option></entry>
18274 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
18275 </row>
18276 <row>
18277 <entry><option>syslog_duplication</option></entry>
18278 <entry>controls duplicate log lines on syslog</entry>
18279 </row>
18280 <row>
18281 <entry><option>syslog_facility</option></entry>
18282 <entry>set syslog <quote>facility</quote> field</entry>
18283 </row>
18284 <row>
18285 <entry><option>syslog_processname</option></entry>
18286 <entry>set syslog <quote>ident</quote> field</entry>
18287 </row>
18288 <row>
18289 <entry><option>syslog_timestamp</option></entry>
18290 <entry>timestamp syslog lines</entry>
18291 </row>
18292 <row>
18293 <entry><option>write_rejectlog</option></entry>
18294 <entry>control use of message log</entry>
18295 </row>
18296 </tbody>
18297 </tgroup>
18298 </informaltable>
18299 </section>
18300 <section>
18301 <title>Frozen messages</title>
18302 <informaltable frame="none">
18303 <tgroup cols="2" colsep="0" rowsep="0">
18304 <colspec colwidth="196pt" align="left"/>
18305 <colspec colwidth="254pt" align="left"/>
18306 <tbody>
18307 <row>
18308 <entry><option>auto_thaw</option></entry>
18309 <entry>sets time for retrying frozen messages</entry>
18310 </row>
18311 <row>
18312 <entry><option>freeze_tell</option></entry>
18313 <entry>send message when freezing</entry>
18314 </row>
18315 <row>
18316 <entry><option>move_frozen_messages</option></entry>
18317 <entry>to another directory</entry>
18318 </row>
18319 <row>
18320 <entry><option>timeout_frozen_after</option></entry>
18321 <entry>keep frozen messages only so long</entry>
18322 </row>
18323 </tbody>
18324 </tgroup>
18325 </informaltable>
18326 </section>
18327 <section>
18328 <title>Data lookups</title>
18329 <informaltable frame="none">
18330 <tgroup cols="2" colsep="0" rowsep="0">
18331 <colspec colwidth="196pt" align="left"/>
18332 <colspec colwidth="254pt" align="left"/>
18333 <tbody>
18334 <row>
18335 <entry><option>ldap_default_servers</option></entry>
18336 <entry>used if no server in query</entry>
18337 </row>
18338 <row>
18339 <entry><option>ldap_version</option></entry>
18340 <entry>set protocol version</entry>
18341 </row>
18342 <row>
18343 <entry><option>lookup_open_max</option></entry>
18344 <entry>lookup files held open</entry>
18345 </row>
18346 <row>
18347 <entry><option>mysql_servers</option></entry>
18348 <entry>as it says</entry>
18349 </row>
18350 <row>
18351 <entry><option>oracle_servers</option></entry>
18352 <entry>as it says</entry>
18353 </row>
18354 <row>
18355 <entry><option>pgsql_servers</option></entry>
18356 <entry>as it says</entry>
18357 </row>
18358 <row>
18359 <entry><option>sqlite_lock_timeout</option></entry>
18360 <entry>as it says</entry>
18361 </row>
18362 </tbody>
18363 </tgroup>
18364 </informaltable>
18365 </section>
18366 <section>
18367 <title>Message ids</title>
18368 <informaltable frame="none">
18369 <tgroup cols="2" colsep="0" rowsep="0">
18370 <colspec colwidth="196pt" align="left"/>
18371 <colspec colwidth="254pt" align="left"/>
18372 <tbody>
18373 <row>
18374 <entry><option>message_id_header_domain</option></entry>
18375 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
18376 </row>
18377 <row>
18378 <entry><option>message_id_header_text</option></entry>
18379 <entry>ditto</entry>
18380 </row>
18381 </tbody>
18382 </tgroup>
18383 </informaltable>
18384 </section>
18385 <section>
18386 <title>Embedded Perl Startup</title>
18387 <informaltable frame="none">
18388 <tgroup cols="2" colsep="0" rowsep="0">
18389 <colspec colwidth="196pt" align="left"/>
18390 <colspec colwidth="254pt" align="left"/>
18391 <tbody>
18392 <row>
18393 <entry><option>perl_at_start</option></entry>
18394 <entry>always start the interpreter</entry>
18395 </row>
18396 <row>
18397 <entry><option>perl_startup</option></entry>
18398 <entry>code to obey when starting Perl</entry>
18399 </row>
18400 </tbody>
18401 </tgroup>
18402 </informaltable>
18403 </section>
18404 <section>
18405 <title>Daemon</title>
18406 <informaltable frame="none">
18407 <tgroup cols="2" colsep="0" rowsep="0">
18408 <colspec colwidth="196pt" align="left"/>
18409 <colspec colwidth="254pt" align="left"/>
18410 <tbody>
18411 <row>
18412 <entry><option>daemon_smtp_ports</option></entry>
18413 <entry>default ports</entry>
18414 </row>
18415 <row>
18416 <entry><option>daemon_startup_retries</option></entry>
18417 <entry>number of times to retry</entry>
18418 </row>
18419 <row>
18420 <entry><option>daemon_startup_sleep</option></entry>
18421 <entry>time to sleep between tries</entry>
18422 </row>
18423 <row>
18424 <entry><option>extra_local_interfaces</option></entry>
18425 <entry>not necessarily listened on</entry>
18426 </row>
18427 <row>
18428 <entry><option>local_interfaces</option></entry>
18429 <entry>on which to listen, with optional ports</entry>
18430 </row>
18431 <row>
18432 <entry><option>pid_file_path</option></entry>
18433 <entry>override compiled-in value</entry>
18434 </row>
18435 <row>
18436 <entry><option>queue_run_max</option></entry>
18437 <entry>maximum simultaneous queue runners</entry>
18438 </row>
18439 </tbody>
18440 </tgroup>
18441 </informaltable>
18442 </section>
18443 <section>
18444 <title>Resource control</title>
18445 <informaltable frame="none">
18446 <tgroup cols="2" colsep="0" rowsep="0">
18447 <colspec colwidth="196pt" align="left"/>
18448 <colspec colwidth="254pt" align="left"/>
18449 <tbody>
18450 <row>
18451 <entry><option>check_log_inodes</option></entry>
18452 <entry>before accepting a message</entry>
18453 </row>
18454 <row>
18455 <entry><option>check_log_space</option></entry>
18456 <entry>before accepting a message</entry>
18457 </row>
18458 <row>
18459 <entry><option>check_spool_inodes</option></entry>
18460 <entry>before accepting a message</entry>
18461 </row>
18462 <row>
18463 <entry><option>check_spool_space</option></entry>
18464 <entry>before accepting a message</entry>
18465 </row>
18466 <row>
18467 <entry><option>deliver_queue_load_max</option></entry>
18468 <entry>no queue deliveries if load high</entry>
18469 </row>
18470 <row>
18471 <entry><option>queue_only_load</option></entry>
18472 <entry>queue incoming if load high</entry>
18473 </row>
18474 <row>
18475 <entry><option>queue_run_max</option></entry>
18476 <entry>maximum simultaneous queue runners</entry>
18477 </row>
18478 <row>
18479 <entry><option>remote_max_parallel</option></entry>
18480 <entry>parallel SMTP delivery per message</entry>
18481 </row>
18482 <row>
18483 <entry><option>smtp_accept_max</option></entry>
18484 <entry>simultaneous incoming connections</entry>
18485 </row>
18486 <row>
18487 <entry><option>smtp_accept_max_nommail</option></entry>
18488 <entry>non-mail commands</entry>
18489 </row>
18490 <row>
18491 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18492 <entry>hosts to which the limit applies</entry>
18493 </row>
18494 <row>
18495 <entry><option>smtp_accept_max_per_connection</option></entry>
18496 <entry>messages per connection</entry>
18497 </row>
18498 <row>
18499 <entry><option>smtp_accept_max_per_host</option></entry>
18500 <entry>connections from one host</entry>
18501 </row>
18502 <row>
18503 <entry><option>smtp_accept_queue</option></entry>
18504 <entry>queue mail if more connections</entry>
18505 </row>
18506 <row>
18507 <entry><option>smtp_accept_queue_per_connection</option></entry>
18508 <entry>queue if more messages per connection</entry>
18509 </row>
18510 <row>
18511 <entry><option>smtp_accept_reserve</option></entry>
18512 <entry>only reserve hosts if more connections</entry>
18513 </row>
18514 <row>
18515 <entry><option>smtp_check_spool_space</option></entry>
18516 <entry>from SIZE on MAIL command</entry>
18517 </row>
18518 <row>
18519 <entry><option>smtp_connect_backlog</option></entry>
18520 <entry>passed to TCP/IP stack</entry>
18521 </row>
18522 <row>
18523 <entry><option>smtp_load_reserve</option></entry>
18524 <entry>SMTP from reserved hosts if load high</entry>
18525 </row>
18526 <row>
18527 <entry><option>smtp_reserve_hosts</option></entry>
18528 <entry>these are the reserve hosts</entry>
18529 </row>
18530 </tbody>
18531 </tgroup>
18532 </informaltable>
18533 </section>
18534 <section>
18535 <title>Policy controls</title>
18536 <informaltable frame="none">
18537 <tgroup cols="2" colsep="0" rowsep="0">
18538 <colspec colwidth="196pt" align="left"/>
18539 <colspec colwidth="254pt" align="left"/>
18540 <tbody>
18541 <row>
18542 <entry><option>acl_not_smtp</option></entry>
18543 <entry>ACL for non-SMTP messages</entry>
18544 </row>
18545 <row>
18546 <entry><option>acl_not_smtp_mime</option></entry>
18547 <entry>ACL for non-SMTP MIME parts</entry>
18548 </row>
18549 <phrase revisionflag="changed"><row>
18550 <entry><option>acl_not_smtp_start</option></entry>
18551 <entry>ACL for start of non-SMTP message</entry>
18552 </row>
18553 </phrase><row>
18554 <entry><option>acl_smtp_auth</option></entry>
18555 <entry>ACL for AUTH</entry>
18556 </row>
18557 <row>
18558 <entry><option>acl_smtp_connect</option></entry>
18559 <entry>ACL for connection</entry>
18560 </row>
18561 <row>
18562 <entry><option>acl_smtp_data</option></entry>
18563 <entry>ACL for DATA</entry>
18564 </row>
18565 <row>
18566 <entry><option>acl_smtp_etrn</option></entry>
18567 <entry>ACL for ETRN</entry>
18568 </row>
18569 <row>
18570 <entry><option>acl_smtp_expn</option></entry>
18571 <entry>ACL for EXPN</entry>
18572 </row>
18573 <row>
18574 <entry><option>acl_smtp_helo</option></entry>
18575 <entry>ACL for EHLO or HELO</entry>
18576 </row>
18577 <row>
18578 <entry><option>acl_smtp_mail</option></entry>
18579 <entry>ACL for MAIL</entry>
18580 </row>
18581 <row>
18582 <entry><option>acl_smtp_mailauth</option></entry>
18583 <entry>ACL for AUTH on MAIL command</entry>
18584 </row>
18585 <row>
18586 <entry><option>acl_smtp_mime</option></entry>
18587 <entry>ACL for MIME parts</entry>
18588 </row>
18589 <row>
18590 <entry><option>acl_smtp_predata</option></entry>
18591 <entry>ACL for start of data</entry>
18592 </row>
18593 <row>
18594 <entry><option>acl_smtp_quit</option></entry>
18595 <entry>ACL for QUIT</entry>
18596 </row>
18597 <row>
18598 <entry><option>acl_smtp_rcpt</option></entry>
18599 <entry>ACL for RCPT</entry>
18600 </row>
18601 <row>
18602 <entry><option>acl_smtp_starttls</option></entry>
18603 <entry>ACL for STARTTLS</entry>
18604 </row>
18605 <row>
18606 <entry><option>acl_smtp_vrfy</option></entry>
18607 <entry>ACL for VRFY</entry>
18608 </row>
18609 <row>
18610 <entry><option>av_scanner</option></entry>
18611 <entry>specify virus scanner</entry>
18612 </row>
18613 <row>
18614 <entry><option>check_rfc2047_length</option></entry>
18615 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
18616 </row>
18617 <row>
18618 <entry><option>dns_csa_search_limit</option></entry>
18619 <entry>control CSA parent search depth</entry>
18620 </row>
18621 <row>
18622 <entry><option>dns_csa_use_reverse</option></entry>
18623 <entry>en/disable CSA IP reverse search</entry>
18624 </row>
18625 <row>
18626 <entry><option>header_maxsize</option></entry>
18627 <entry>total size of message header</entry>
18628 </row>
18629 <row>
18630 <entry><option>header_line_maxsize</option></entry>
18631 <entry>individual header line limit</entry>
18632 </row>
18633 <row>
18634 <entry><option>helo_accept_junk_hosts</option></entry>
18635 <entry>allow syntactic junk from these hosts</entry>
18636 </row>
18637 <row>
18638 <entry><option>helo_allow_chars</option></entry>
18639 <entry>allow illegal chars in HELO names</entry>
18640 </row>
18641 <row>
18642 <entry><option>helo_lookup_domains</option></entry>
18643 <entry>lookup hostname for these HELO names</entry>
18644 </row>
18645 <row>
18646 <entry><option>helo_try_verify_hosts</option></entry>
18647 <entry>HELO soft-checked for these hosts</entry>
18648 </row>
18649 <row>
18650 <entry><option>helo_verify_hosts</option></entry>
18651 <entry>HELO hard-checked for these hosts</entry>
18652 </row>
18653 <row>
18654 <entry><option>host_lookup</option></entry>
18655 <entry>host name looked up for these hosts</entry>
18656 </row>
18657 <row>
18658 <entry><option>host_lookup_order</option></entry>
18659 <entry>order of DNS and local name lookups</entry>
18660 </row>
18661 <row>
18662 <entry><option>host_reject_connection</option></entry>
18663 <entry>reject connection from these hosts</entry>
18664 </row>
18665 <row>
18666 <entry><option>hosts_treat_as_local</option></entry>
18667 <entry>useful in some cluster configurations</entry>
18668 </row>
18669 <row>
18670 <entry><option>local_scan_timeout</option></entry>
18671 <entry>timeout for <function>local_scan()</function></entry>
18672 </row>
18673 <row>
18674 <entry><option>message_size_limit</option></entry>
18675 <entry>for all messages</entry>
18676 </row>
18677 <row>
18678 <entry><option>percent_hack_domains</option></entry>
18679 <entry>recognize %-hack for these domains</entry>
18680 </row>
18681 <row>
18682 <entry><option>spamd_address</option></entry>
18683 <entry>set interface to SpamAssassin</entry>
18684 </row>
18685 </tbody>
18686 </tgroup>
18687 </informaltable>
18688 </section>
18689 <section>
18690 <title>Callout cache</title>
18691 <informaltable frame="none">
18692 <tgroup cols="2" colsep="0" rowsep="0">
18693 <colspec colwidth="196pt" align="left"/>
18694 <colspec colwidth="254pt" align="left"/>
18695 <tbody>
18696 <row>
18697 <entry><option>callout_domain_negative_expire</option></entry>
18698 <entry>timeout for negative domain cache item</entry>
18699 </row>
18700 <row>
18701 <entry><option>callout_domain_positive_expire</option></entry>
18702 <entry>timeout for positive domain cache item</entry>
18703 </row>
18704 <row>
18705 <entry><option>callout_negative_expire</option></entry>
18706 <entry>timeout for negative address cache item</entry>
18707 </row>
18708 <row>
18709 <entry><option>callout_positive_expire</option></entry>
18710 <entry>timeout for positive address cache item</entry>
18711 </row>
18712 <row>
18713 <entry><option>callout_random_local_part</option></entry>
18714 <entry>string to use for <quote>random</quote> testing</entry>
18715 </row>
18716 </tbody>
18717 </tgroup>
18718 </informaltable>
18719 </section>
18720 <section>
18721 <title>TLS</title>
18722 <informaltable frame="none">
18723 <tgroup cols="2" colsep="0" rowsep="0">
18724 <colspec colwidth="196pt" align="left"/>
18725 <colspec colwidth="254pt" align="left"/>
18726 <tbody>
18727 <row>
18728 <entry><option>tls_advertise_hosts</option></entry>
18729 <entry>advertise TLS to these hosts</entry>
18730 </row>
18731 <row>
18732 <entry><option>tls_certificate</option></entry>
18733 <entry>location of server certificate</entry>
18734 </row>
18735 <row>
18736 <entry><option>tls_crl</option></entry>
18737 <entry>certificate revocation list</entry>
18738 </row>
18739 <row>
18740 <entry><option>tls_dhparam</option></entry>
18741 <entry>DH parameters for server</entry>
18742 </row>
18743 <row>
18744 <entry><option>tls_on_connect_ports</option></entry>
18745 <entry>specify SSMTP (SMTPS) ports</entry>
18746 </row>
18747 <row>
18748 <entry><option>tls_privatekey</option></entry>
18749 <entry>location of server private key</entry>
18750 </row>
18751 <row>
18752 <entry><option>tls_remember_esmtp</option></entry>
18753 <entry>don&#x2019;t reset after starting TLS</entry>
18754 </row>
18755 <row>
18756 <entry><option>tls_require_ciphers</option></entry>
18757 <entry>specify acceptable cipers</entry>
18758 </row>
18759 <row>
18760 <entry><option>tls_try_verify_hosts</option></entry>
18761 <entry>try to verify client certificate</entry>
18762 </row>
18763 <row>
18764 <entry><option>tls_verify_certificates</option></entry>
18765 <entry>expected client certificates</entry>
18766 </row>
18767 <row>
18768 <entry><option>tls_verify_hosts</option></entry>
18769 <entry>insist on client certificate verify</entry>
18770 </row>
18771 </tbody>
18772 </tgroup>
18773 </informaltable>
18774 </section>
18775 <section>
18776 <title>Local user handling</title>
18777 <informaltable frame="none">
18778 <tgroup cols="2" colsep="0" rowsep="0">
18779 <colspec colwidth="196pt" align="left"/>
18780 <colspec colwidth="254pt" align="left"/>
18781 <tbody>
18782 <row>
18783 <entry><option>finduser_retries</option></entry>
18784 <entry>useful in NIS environments</entry>
18785 </row>
18786 <row>
18787 <entry><option>gecos_name</option></entry>
18788 <entry>used when creating <emphasis>Sender:</emphasis></entry>
18789 </row>
18790 <row>
18791 <entry><option>gecos_pattern</option></entry>
18792 <entry>ditto</entry>
18793 </row>
18794 <row>
18795 <entry><option>max_username_length</option></entry>
18796 <entry>for systems that truncate</entry>
18797 </row>
18798 <row>
18799 <entry><option>unknown_login</option></entry>
18800 <entry>used when no login name found</entry>
18801 </row>
18802 <row>
18803 <entry><option>unknown_username</option></entry>
18804 <entry>ditto</entry>
18805 </row>
18806 <row>
18807 <entry><option>uucp_from_pattern</option></entry>
18808 <entry>for recognizing <quote>From </quote> lines</entry>
18809 </row>
18810 <row>
18811 <entry><option>uucp_from_sender</option></entry>
18812 <entry>ditto</entry>
18813 </row>
18814 </tbody>
18815 </tgroup>
18816 </informaltable>
18817 </section>
18818 <section>
18819 <title>All incoming messages (SMTP and non-SMTP)</title>
18820 <informaltable frame="none">
18821 <tgroup cols="2" colsep="0" rowsep="0">
18822 <colspec colwidth="196pt" align="left"/>
18823 <colspec colwidth="254pt" align="left"/>
18824 <tbody>
18825 <row>
18826 <entry><option>header_maxsize</option></entry>
18827 <entry>total size of message header</entry>
18828 </row>
18829 <row>
18830 <entry><option>header_line_maxsize</option></entry>
18831 <entry>individual header line limit</entry>
18832 </row>
18833 <row>
18834 <entry><option>message_size_limit</option></entry>
18835 <entry>applies to all messages</entry>
18836 </row>
18837 <row>
18838 <entry><option>percent_hack_domains</option></entry>
18839 <entry>recognize %-hack for these domains</entry>
18840 </row>
18841 <row>
18842 <entry><option>received_header_text</option></entry>
18843 <entry>expanded to make <emphasis>Received:</emphasis></entry>
18844 </row>
18845 <row>
18846 <entry><option>received_headers_max</option></entry>
18847 <entry>for mail loop detection</entry>
18848 </row>
18849 <row>
18850 <entry><option>recipients_max</option></entry>
18851 <entry>limit per message</entry>
18852 </row>
18853 <row>
18854 <entry><option>recipients_max_reject</option></entry>
18855 <entry>permanently reject excess</entry>
18856 </row>
18857 </tbody>
18858 </tgroup>
18859 </informaltable>
18860 </section>
18861 <section>
18862 <title>Non-SMTP incoming messages</title>
18863 <informaltable frame="none">
18864 <tgroup cols="2" colsep="0" rowsep="0">
18865 <colspec colwidth="196pt" align="left"/>
18866 <colspec colwidth="254pt" align="left"/>
18867 <tbody>
18868 <row>
18869 <entry><option>receive_timeout</option></entry>
18870 <entry>for non-SMTP messages</entry>
18871 </row>
18872 </tbody>
18873 </tgroup>
18874 </informaltable>
18875 </section>
18876 <section>
18877 <title>Incoming SMTP messages</title>
18878 <para>
18879 See also the <emphasis>Policy controls</emphasis> section above.
18880 </para>
18881 <informaltable frame="none">
18882 <tgroup cols="2" colsep="0" rowsep="0">
18883 <colspec colwidth="196pt" align="left"/>
18884 <colspec colwidth="254pt" align="left"/>
18885 <tbody>
18886 <row>
18887 <entry><option>host_lookup</option></entry>
18888 <entry>host name looked up for these hosts</entry>
18889 </row>
18890 <row>
18891 <entry><option>host_lookup_order</option></entry>
18892 <entry>order of DNS and local name lookups</entry>
18893 </row>
18894 <row>
18895 <entry><option>recipient_unqualified_hosts</option></entry>
18896 <entry>may send unqualified recipients</entry>
18897 </row>
18898 <row>
18899 <entry><option>rfc1413_hosts</option></entry>
18900 <entry>make ident calls to these hosts</entry>
18901 </row>
18902 <row>
18903 <entry><option>rfc1413_query_timeout</option></entry>
18904 <entry>zero disables ident calls</entry>
18905 </row>
18906 <row>
18907 <entry><option>sender_unqualified_hosts</option></entry>
18908 <entry>may send unqualified senders</entry>
18909 </row>
18910 <row>
18911 <entry><option>smtp_accept_keepalive</option></entry>
18912 <entry>some TCP/IP magic</entry>
18913 </row>
18914 <row>
18915 <entry><option>smtp_accept_max</option></entry>
18916 <entry>simultaneous incoming connections</entry>
18917 </row>
18918 <row>
18919 <entry><option>smtp_accept_max_nonmail</option></entry>
18920 <entry>non-mail commands</entry>
18921 </row>
18922 <row>
18923 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
18924 <entry>hosts to which the limit applies</entry>
18925 </row>
18926 <row>
18927 <entry><option>smtp_accept_max_per_connection</option></entry>
18928 <entry>messages per connection</entry>
18929 </row>
18930 <row>
18931 <entry><option>smtp_accept_max_per_host</option></entry>
18932 <entry>connections from one host</entry>
18933 </row>
18934 <row>
18935 <entry><option>smtp_accept_queue</option></entry>
18936 <entry>queue mail if more connections</entry>
18937 </row>
18938 <row>
18939 <entry><option>smtp_accept_queue_per_connection</option></entry>
18940 <entry>queue if more messages per connection</entry>
18941 </row>
18942 <row>
18943 <entry><option>smtp_accept_reserve</option></entry>
18944 <entry>only reserve hosts if more connections</entry>
18945 </row>
18946 <row>
18947 <entry><option>smtp_active_hostname</option></entry>
18948 <entry>host name to use in messages</entry>
18949 </row>
18950 <row>
18951 <entry><option>smtp_banner</option></entry>
18952 <entry>text for welcome banner</entry>
18953 </row>
18954 <row>
18955 <entry><option>smtp_check_spool_space</option></entry>
18956 <entry>from SIZE on MAIL command</entry>
18957 </row>
18958 <row>
18959 <entry><option>smtp_connect_backlog</option></entry>
18960 <entry>passed to TCP/IP stack</entry>
18961 </row>
18962 <row>
18963 <entry><option>smtp_enforce_sync</option></entry>
18964 <entry>of SMTP command/responses</entry>
18965 </row>
18966 <row>
18967 <entry><option>smtp_etrn_command</option></entry>
18968 <entry>what to run for ETRN</entry>
18969 </row>
18970 <row>
18971 <entry><option>smtp_etrn_serialize</option></entry>
18972 <entry>only one at once</entry>
18973 </row>
18974 <row>
18975 <entry><option>smtp_load_reserve</option></entry>
18976 <entry>only reserve hosts if this load</entry>
18977 </row>
18978 <row>
18979 <entry><option>smtp_max_unknown_commands</option></entry>
18980 <entry>before dropping connection</entry>
18981 </row>
18982 <row>
18983 <entry><option>smtp_ratelimit_hosts</option></entry>
18984 <entry>apply ratelimiting to these hosts</entry>
18985 </row>
18986 <row>
18987 <entry><option>smtp_ratelimit_mail</option></entry>
18988 <entry>ratelimit for MAIL commands</entry>
18989 </row>
18990 <row>
18991 <entry><option>smtp_ratelimit_rcpt</option></entry>
18992 <entry>ratelimit for RCPT commands</entry>
18993 </row>
18994 <row>
18995 <entry><option>smtp_receive_timeout</option></entry>
18996 <entry>per command or data line</entry>
18997 </row>
18998 <row>
18999 <entry><option>smtp_reserve_hosts</option></entry>
19000 <entry>these are the reserve hosts</entry>
19001 </row>
19002 <row>
19003 <entry><option>smtp_return_error_details</option></entry>
19004 <entry>give detail on rejections</entry>
19005 </row>
19006 </tbody>
19007 </tgroup>
19008 </informaltable>
19009 </section>
19010 <section>
19011 <title>SMTP extensions</title>
19012 <informaltable frame="none">
19013 <tgroup cols="2" colsep="0" rowsep="0">
19014 <colspec colwidth="196pt" align="left"/>
19015 <colspec colwidth="254pt" align="left"/>
19016 <tbody>
19017 <row>
19018 <entry><option>accept_8bitmime</option></entry>
19019 <entry>advertise 8BITMIME</entry>
19020 </row>
19021 <row>
19022 <entry><option>auth_advertise_hosts</option></entry>
19023 <entry>advertise AUTH to these hosts</entry>
19024 </row>
19025 <row>
19026 <entry><option>ignore_fromline_hosts</option></entry>
19027 <entry>allow <quote>From </quote> from these hosts</entry>
19028 </row>
19029 <row>
19030 <entry><option>ignore_fromline_local</option></entry>
19031 <entry>allow <quote>From </quote> from local SMTP</entry>
19032 </row>
19033 <row>
19034 <entry><option>pipelining_advertise_hosts</option></entry>
19035 <entry>advertise pipelining to these hosts</entry>
19036 </row>
19037 <row>
19038 <entry><option>tls_advertise_hosts</option></entry>
19039 <entry>advertise TLS to these hosts</entry>
19040 </row>
19041 </tbody>
19042 </tgroup>
19043 </informaltable>
19044 </section>
19045 <section>
19046 <title>Processing messages</title>
19047 <informaltable frame="none">
19048 <tgroup cols="2" colsep="0" rowsep="0">
19049 <colspec colwidth="196pt" align="left"/>
19050 <colspec colwidth="254pt" align="left"/>
19051 <tbody>
19052 <row>
19053 <entry><option>allow_domain_literals</option></entry>
19054 <entry>recognize domain literal syntax</entry>
19055 </row>
19056 <row>
19057 <entry><option>allow_mx_to_ip</option></entry>
19058 <entry>allow MX to point to IP address</entry>
19059 </row>
19060 <row>
19061 <entry><option>allow_utf8_domains</option></entry>
19062 <entry>in addresses</entry>
19063 </row>
19064 <row>
19065 <entry><option>check_rfc2047_length</option></entry>
19066 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
19067 </row>
19068 <row>
19069 <entry><option>delivery_date_remove</option></entry>
19070 <entry>from incoming messages</entry>
19071 </row>
19072 <row>
19073 <entry><option>envelope_to_remove</option></entry>
19074 <entry>from incoming messages</entry>
19075 </row>
19076 <row>
19077 <entry><option>extract_addresses_remove_arguments</option></entry>
19078 <entry>affects <option>-t</option> processing</entry>
19079 </row>
19080 <row>
19081 <entry><option>headers_charset</option></entry>
19082 <entry>default for translations</entry>
19083 </row>
19084 <row>
19085 <entry><option>qualify_domain</option></entry>
19086 <entry>default for senders</entry>
19087 </row>
19088 <row>
19089 <entry><option>qualify_recipient</option></entry>
19090 <entry>default for recipients</entry>
19091 </row>
19092 <row>
19093 <entry><option>return_path_remove</option></entry>
19094 <entry>from incoming messages</entry>
19095 </row>
19096 <row>
19097 <entry><option>strip_excess_angle_brackets</option></entry>
19098 <entry>in addresses</entry>
19099 </row>
19100 <row>
19101 <entry><option>strip_trailing_dot</option></entry>
19102 <entry>at end of addresses</entry>
19103 </row>
19104 <row>
19105 <entry><option>untrusted_set_sender</option></entry>
19106 <entry>untrusted can set envelope sender</entry>
19107 </row>
19108 </tbody>
19109 </tgroup>
19110 </informaltable>
19111 </section>
19112 <section>
19113 <title>System filter</title>
19114 <informaltable frame="none">
19115 <tgroup cols="2" colsep="0" rowsep="0">
19116 <colspec colwidth="196pt" align="left"/>
19117 <colspec colwidth="254pt" align="left"/>
19118 <tbody>
19119 <row>
19120 <entry><option>system_filter</option></entry>
19121 <entry>locate system filter</entry>
19122 </row>
19123 <row>
19124 <entry><option>system_filter_directory_transport</option></entry>
19125 <entry>transport for delivery to a directory</entry>
19126 </row>
19127 <row>
19128 <entry><option>system_filter_file_transport</option></entry>
19129 <entry>transport for delivery to a file</entry>
19130 </row>
19131 <row>
19132 <entry><option>system_filter_group</option></entry>
19133 <entry>group for filter running</entry>
19134 </row>
19135 <row>
19136 <entry><option>system_filter_pipe_transport</option></entry>
19137 <entry>transport for delivery to a pipe</entry>
19138 </row>
19139 <row>
19140 <entry><option>system_filter_reply_transport</option></entry>
19141 <entry>transport for autoreply delivery</entry>
19142 </row>
19143 <row>
19144 <entry><option>system_filter_user</option></entry>
19145 <entry>user for filter running</entry>
19146 </row>
19147 </tbody>
19148 </tgroup>
19149 </informaltable>
19150 </section>
19151 <section>
19152 <title>Routing and delivery</title>
19153 <informaltable frame="none">
19154 <tgroup cols="2" colsep="0" rowsep="0">
19155 <colspec colwidth="196pt" align="left"/>
19156 <colspec colwidth="254pt" align="left"/>
19157 <tbody>
19158 <row>
19159 <entry><option>disable_ipv6</option></entry>
19160 <entry>do no IPv6 processing</entry>
19161 </row>
19162 <row>
19163 <entry><option>dns_again_means_nonexist</option></entry>
19164 <entry>for broken domains</entry>
19165 </row>
19166 <row>
19167 <entry><option>dns_check_names_pattern</option></entry>
19168 <entry>pre-DNS syntax check</entry>
19169 </row>
19170 <row>
19171 <entry><option>dns_ipv4_lookup</option></entry>
19172 <entry>only v4 lookup for these domains</entry>
19173 </row>
19174 <row>
19175 <entry><option>dns_retrans</option></entry>
19176 <entry>parameter for resolver</entry>
19177 </row>
19178 <row>
19179 <entry><option>dns_retry</option></entry>
19180 <entry>parameter for resolver</entry>
19181 </row>
19182 <row>
19183 <entry><option>hold_domains</option></entry>
19184 <entry>hold delivery for these domains</entry>
19185 </row>
19186 <row>
19187 <entry><option>local_interfaces</option></entry>
19188 <entry>for routing checks</entry>
19189 </row>
19190 <row>
19191 <entry><option>queue_domains</option></entry>
19192 <entry>no immediate delivery for these</entry>
19193 </row>
19194 <row>
19195 <entry><option>queue_only</option></entry>
19196 <entry>no immediate delivery at all</entry>
19197 </row>
19198 <row>
19199 <entry><option>queue_only_file</option></entry>
19200 <entry>no immediate delivery if file exists</entry>
19201 </row>
19202 <row>
19203 <entry><option>queue_only_load</option></entry>
19204 <entry>no immediate delivery if load is high</entry>
19205 </row>
19206 <row>
19207 <entry><option>queue_only_override</option></entry>
19208 <entry>allow command line to override</entry>
19209 </row>
19210 <row>
19211 <entry><option>queue_run_in_order</option></entry>
19212 <entry>order of arrival</entry>
19213 </row>
19214 <row>
19215 <entry><option>queue_run_max</option></entry>
19216 <entry>of simultaneous queue runners</entry>
19217 </row>
19218 <row>
19219 <entry><option>queue_smtp_domains</option></entry>
19220 <entry>no immediate SMTP delivery for these</entry>
19221 </row>
19222 <row>
19223 <entry><option>remote_max_parallel</option></entry>
19224 <entry>parallel SMTP delivery per message</entry>
19225 </row>
19226 <row>
19227 <entry><option>remote_sort_domains</option></entry>
19228 <entry>order of remote deliveries</entry>
19229 </row>
19230 <row>
19231 <entry><option>retry_data_expire</option></entry>
19232 <entry>timeout for retry data</entry>
19233 </row>
19234 <row>
19235 <entry><option>retry_interval_max</option></entry>
19236 <entry>safety net for retry rules</entry>
19237 </row>
19238 </tbody>
19239 </tgroup>
19240 </informaltable>
19241 </section>
19242 <section>
19243 <title>Bounce and warning messages</title>
19244 <informaltable frame="none">
19245 <tgroup cols="2" colsep="0" rowsep="0">
19246 <colspec colwidth="196pt" align="left"/>
19247 <colspec colwidth="254pt" align="left"/>
19248 <tbody>
19249 <row>
19250 <entry><option>bounce_message_file</option></entry>
19251 <entry>content of bounce</entry>
19252 </row>
19253 <row>
19254 <entry><option>bounce_message_text</option></entry>
19255 <entry>content of bounce</entry>
19256 </row>
19257 <row>
19258 <entry><option>bounce_return_body</option></entry>
19259 <entry>include body if returning message</entry>
19260 </row>
19261 <row>
19262 <entry><option>bounce_return_message</option></entry>
19263 <entry>include original message in bounce</entry>
19264 </row>
19265 <row>
19266 <entry><option>bounce_return_size_limit</option></entry>
19267 <entry>limit on returned message</entry>
19268 </row>
19269 <row>
19270 <entry><option>bounce_sender_authentication</option></entry>
19271 <entry>send authenticated sender with bounce</entry>
19272 </row>
19273 <row>
19274 <entry><option>errors_copy</option></entry>
19275 <entry>copy bounce messages</entry>
19276 </row>
19277 <row>
19278 <entry><option>errors_reply_to</option></entry>
19279 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
19280 </row>
19281 <row>
19282 <entry><option>delay_warning</option></entry>
19283 <entry>time schedule</entry>
19284 </row>
19285 <row>
19286 <entry><option>delay_warning_condition</option></entry>
19287 <entry>condition for warning messages</entry>
19288 </row>
19289 <row>
19290 <entry><option>ignore_bounce_errors_after</option></entry>
19291 <entry>discard undeliverable bounces</entry>
19292 </row>
19293 <row>
19294 <entry><option>smtp_return_error_details</option></entry>
19295 <entry>give detail on rejections</entry>
19296 </row>
19297 <row>
19298 <entry><option>warn_message_file</option></entry>
19299 <entry>content of warning message</entry>
19300 </row>
19301 </tbody>
19302 </tgroup>
19303 </informaltable>
19304 </section>
19305 <section id="SECTalomo">
19306 <title>Alphabetical list of main options</title>
19307 <para>
19308 Those options that undergo string expansion before use are marked with
19309 &dagger;.
19310 </para>
19311 <para>
19312 <indexterm role="option">
19313 <primary>accept_8bitmime</primary>
19314 </indexterm>
19315 </para>
19316 <informaltable frame="all">
19317 <tgroup cols="4" colsep="0" rowsep="0">
19318 <colspec colwidth="8*" align="left"/>
19319 <colspec colwidth="5*" align="center"/>
19320 <colspec colwidth="5*" align="center"/>
19321 <colspec colwidth="6*" align="right"/>
19322 <tbody>
19323 <row>
19324 <entry><option>accept_8bitmime</option></entry>
19325 <entry>Use: <emphasis>main</emphasis></entry>
19326 <entry>Type: <emphasis>boolean</emphasis></entry>
19327 <entry>Default: <emphasis>false</emphasis></entry>
19328 </row>
19329 </tbody>
19330 </tgroup>
19331 </informaltable>
19332 <para>
19333 <indexterm role="concept">
19334 <primary>8BITMIME</primary>
19335 </indexterm>
19336 <indexterm role="concept">
19337 <primary>8-bit characters</primary>
19338 </indexterm>
19339 This option causes Exim to send 8BITMIME in its response to an SMTP
19340 EHLO command, and to accept the BODY= parameter on MAIL commands.
19341 However, though Exim is 8-bit clean, it is not a protocol converter, and it
19342 takes no steps to do anything special with messages received by this route.
19343 Consequently, this option is turned off by default.
19344 </para>
19345 <para>
19346 <indexterm role="option">
19347 <primary>acl_not_smtp</primary>
19348 </indexterm>
19349 </para>
19350 <informaltable frame="all">
19351 <tgroup cols="4" colsep="0" rowsep="0">
19352 <colspec colwidth="8*" align="left"/>
19353 <colspec colwidth="5*" align="center"/>
19354 <colspec colwidth="5*" align="center"/>
19355 <colspec colwidth="6*" align="right"/>
19356 <tbody>
19357 <row>
19358 <entry><option>acl_not_smtp</option></entry>
19359 <entry>Use: <emphasis>main</emphasis></entry>
19360 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19361 <entry>Default: <emphasis>unset</emphasis></entry>
19362 </row>
19363 </tbody>
19364 </tgroup>
19365 </informaltable>
19366 <para>
19367 <indexterm role="concept">
19368 <primary>access control lists (ACLs)</primary>
19369 <secondary>for non-SMTP messages</secondary>
19370 </indexterm>
19371 <indexterm role="concept">
19372 <primary>non-SMTP messages</primary>
19373 <secondary>ACLs for</secondary>
19374 </indexterm>
19375 This option defines the ACL that is run when a non-SMTP message has been
19376 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
19377 further details.
19378 </para>
19379 <para>
19380 <indexterm role="option">
19381 <primary>acl_not_smtp_mime</primary>
19382 </indexterm>
19383 </para>
19384 <informaltable frame="all">
19385 <tgroup cols="4" colsep="0" rowsep="0">
19386 <colspec colwidth="8*" align="left"/>
19387 <colspec colwidth="5*" align="center"/>
19388 <colspec colwidth="5*" align="center"/>
19389 <colspec colwidth="6*" align="right"/>
19390 <tbody>
19391 <row>
19392 <entry><option>acl_not_smtp_mime</option></entry>
19393 <entry>Use: <emphasis>main</emphasis></entry>
19394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19395 <entry>Default: <emphasis>unset</emphasis></entry>
19396 </row>
19397 </tbody>
19398 </tgroup>
19399 </informaltable>
19400 <para>
19401 This option defines the ACL that is run for individual MIME parts of non-SMTP
19402 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
19403 SMTP messages.
19404 </para>
19405 <para revisionflag="changed">
19406 <indexterm role="option">
19407 <primary>acl_not_smtp_start</primary>
19408 </indexterm>
19409 </para>
19410 <informaltable frame="all" revisionflag="changed">
19411 <tgroup cols="4" colsep="0" rowsep="0">
19412 <colspec colwidth="8*" align="left"/>
19413 <colspec colwidth="5*" align="center"/>
19414 <colspec colwidth="5*" align="center"/>
19415 <colspec colwidth="6*" align="right"/>
19416 <tbody>
19417 <row>
19418 <entry><option>acl_not_smtp_start</option></entry>
19419 <entry>Use: <emphasis>main</emphasis></entry>
19420 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19421 <entry>Default: <emphasis>unset</emphasis></entry>
19422 </row>
19423 </tbody>
19424 </tgroup>
19425 </informaltable>
19426 <para revisionflag="changed">
19427 <indexterm role="concept">
19428 <primary>access control lists (ACLs)</primary>
19429 <secondary>at start of non-SMTP message</secondary>
19430 </indexterm>
19431 <indexterm role="concept">
19432 <primary>non-SMTP messages</primary>
19433 <secondary>ACLs for</secondary>
19434 </indexterm>
19435 This option defines the ACL that is run before Exim starts reading a
19436 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
19437 </para>
19438 <para>
19439 <indexterm role="option">
19440 <primary>acl_smtp_auth</primary>
19441 </indexterm>
19442 </para>
19443 <informaltable frame="all">
19444 <tgroup cols="4" colsep="0" rowsep="0">
19445 <colspec colwidth="8*" align="left"/>
19446 <colspec colwidth="5*" align="center"/>
19447 <colspec colwidth="5*" align="center"/>
19448 <colspec colwidth="6*" align="right"/>
19449 <tbody>
19450 <row>
19451 <entry><option>acl_smtp_auth</option></entry>
19452 <entry>Use: <emphasis>main</emphasis></entry>
19453 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19454 <entry>Default: <emphasis>unset</emphasis></entry>
19455 </row>
19456 </tbody>
19457 </tgroup>
19458 </informaltable>
19459 <para>
19460 <indexterm role="concept">
19461 <primary>access control lists (ACLs)</primary>
19462 <secondary>setting up for SMTP commands</secondary>
19463 </indexterm>
19464 <indexterm role="concept">
19465 <primary>AUTH</primary>
19466 <secondary>ACL for</secondary>
19467 </indexterm>
19468 This option defines the ACL that is run when an SMTP AUTH command is
19469 received. See chapter <xref linkend="CHAPACL"/> for further details.
19470 </para>
19471 <para>
19472 <indexterm role="option">
19473 <primary>acl_smtp_connect</primary>
19474 </indexterm>
19475 </para>
19476 <informaltable frame="all">
19477 <tgroup cols="4" colsep="0" rowsep="0">
19478 <colspec colwidth="8*" align="left"/>
19479 <colspec colwidth="5*" align="center"/>
19480 <colspec colwidth="5*" align="center"/>
19481 <colspec colwidth="6*" align="right"/>
19482 <tbody>
19483 <row>
19484 <entry><option>acl_smtp_connect</option></entry>
19485 <entry>Use: <emphasis>main</emphasis></entry>
19486 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19487 <entry>Default: <emphasis>unset</emphasis></entry>
19488 </row>
19489 </tbody>
19490 </tgroup>
19491 </informaltable>
19492 <para>
19493 <indexterm role="concept">
19494 <primary>access control lists (ACLs)</primary>
19495 <secondary>on SMTP connection</secondary>
19496 </indexterm>
19497 This option defines the ACL that is run when an SMTP connection is received.
19498 See chapter <xref linkend="CHAPACL"/> for further details.
19499 </para>
19500 <para>
19501 <indexterm role="option">
19502 <primary>acl_smtp_data</primary>
19503 </indexterm>
19504 </para>
19505 <informaltable frame="all">
19506 <tgroup cols="4" colsep="0" rowsep="0">
19507 <colspec colwidth="8*" align="left"/>
19508 <colspec colwidth="5*" align="center"/>
19509 <colspec colwidth="5*" align="center"/>
19510 <colspec colwidth="6*" align="right"/>
19511 <tbody>
19512 <row>
19513 <entry><option>acl_smtp_data</option></entry>
19514 <entry>Use: <emphasis>main</emphasis></entry>
19515 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19516 <entry>Default: <emphasis>unset</emphasis></entry>
19517 </row>
19518 </tbody>
19519 </tgroup>
19520 </informaltable>
19521 <para>
19522 <indexterm role="concept">
19523 <primary>DATA</primary>
19524 <secondary>ACL for</secondary>
19525 </indexterm>
19526 This option defines the ACL that is run after an SMTP DATA command has been
19527 processed and the message itself has been received, but before the final
19528 acknowledgement is sent. See chapter <xref linkend="CHAPACL"/> for further details.
19529 </para>
19530 <para>
19531 <indexterm role="option">
19532 <primary>acl_smtp_etrn</primary>
19533 </indexterm>
19534 </para>
19535 <informaltable frame="all">
19536 <tgroup cols="4" colsep="0" rowsep="0">
19537 <colspec colwidth="8*" align="left"/>
19538 <colspec colwidth="5*" align="center"/>
19539 <colspec colwidth="5*" align="center"/>
19540 <colspec colwidth="6*" align="right"/>
19541 <tbody>
19542 <row>
19543 <entry><option>acl_smtp_etrn</option></entry>
19544 <entry>Use: <emphasis>main</emphasis></entry>
19545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19546 <entry>Default: <emphasis>unset</emphasis></entry>
19547 </row>
19548 </tbody>
19549 </tgroup>
19550 </informaltable>
19551 <para>
19552 <indexterm role="concept">
19553 <primary>ETRN</primary>
19554 <secondary>ACL for</secondary>
19555 </indexterm>
19556 This option defines the ACL that is run when an SMTP ETRN command is
19557 received. See chapter <xref linkend="CHAPACL"/> for further details.
19558 </para>
19559 <para>
19560 <indexterm role="option">
19561 <primary>acl_smtp_expn</primary>
19562 </indexterm>
19563 </para>
19564 <informaltable frame="all">
19565 <tgroup cols="4" colsep="0" rowsep="0">
19566 <colspec colwidth="8*" align="left"/>
19567 <colspec colwidth="5*" align="center"/>
19568 <colspec colwidth="5*" align="center"/>
19569 <colspec colwidth="6*" align="right"/>
19570 <tbody>
19571 <row>
19572 <entry><option>acl_smtp_expn</option></entry>
19573 <entry>Use: <emphasis>main</emphasis></entry>
19574 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19575 <entry>Default: <emphasis>unset</emphasis></entry>
19576 </row>
19577 </tbody>
19578 </tgroup>
19579 </informaltable>
19580 <para>
19581 <indexterm role="concept">
19582 <primary>EXPN</primary>
19583 <secondary>ACL for</secondary>
19584 </indexterm>
19585 This option defines the ACL that is run when an SMTP EXPN command is
19586 received. See chapter <xref linkend="CHAPACL"/> for further details.
19587 </para>
19588 <para>
19589 <indexterm role="option">
19590 <primary>acl_smtp_helo</primary>
19591 </indexterm>
19592 </para>
19593 <informaltable frame="all">
19594 <tgroup cols="4" colsep="0" rowsep="0">
19595 <colspec colwidth="8*" align="left"/>
19596 <colspec colwidth="5*" align="center"/>
19597 <colspec colwidth="5*" align="center"/>
19598 <colspec colwidth="6*" align="right"/>
19599 <tbody>
19600 <row>
19601 <entry><option>acl_smtp_helo</option></entry>
19602 <entry>Use: <emphasis>main</emphasis></entry>
19603 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19604 <entry>Default: <emphasis>unset</emphasis></entry>
19605 </row>
19606 </tbody>
19607 </tgroup>
19608 </informaltable>
19609 <para>
19610 <indexterm role="concept">
19611 <primary>EHLO</primary>
19612 <secondary>ACL for</secondary>
19613 </indexterm>
19614 <indexterm role="concept">
19615 <primary>HELO</primary>
19616 <secondary>ACL for</secondary>
19617 </indexterm>
19618 This option defines the ACL that is run when an SMTP EHLO or HELO
19619 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
19620 </para>
19621 <para>
19622 <indexterm role="option">
19623 <primary>acl_smtp_mail</primary>
19624 </indexterm>
19625 </para>
19626 <informaltable frame="all">
19627 <tgroup cols="4" colsep="0" rowsep="0">
19628 <colspec colwidth="8*" align="left"/>
19629 <colspec colwidth="5*" align="center"/>
19630 <colspec colwidth="5*" align="center"/>
19631 <colspec colwidth="6*" align="right"/>
19632 <tbody>
19633 <row>
19634 <entry><option>acl_smtp_mail</option></entry>
19635 <entry>Use: <emphasis>main</emphasis></entry>
19636 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19637 <entry>Default: <emphasis>unset</emphasis></entry>
19638 </row>
19639 </tbody>
19640 </tgroup>
19641 </informaltable>
19642 <para>
19643 <indexterm role="concept">
19644 <primary>MAIL</primary>
19645 <secondary>ACL for</secondary>
19646 </indexterm>
19647 This option defines the ACL that is run when an SMTP MAIL command is
19648 received. See chapter <xref linkend="CHAPACL"/> for further details.
19649 </para>
19650 <para>
19651 <indexterm role="option">
19652 <primary>acl_smtp_mailauth</primary>
19653 </indexterm>
19654 </para>
19655 <informaltable frame="all">
19656 <tgroup cols="4" colsep="0" rowsep="0">
19657 <colspec colwidth="8*" align="left"/>
19658 <colspec colwidth="5*" align="center"/>
19659 <colspec colwidth="5*" align="center"/>
19660 <colspec colwidth="6*" align="right"/>
19661 <tbody>
19662 <row>
19663 <entry><option>acl_smtp_mailauth</option></entry>
19664 <entry>Use: <emphasis>main</emphasis></entry>
19665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19666 <entry>Default: <emphasis>unset</emphasis></entry>
19667 </row>
19668 </tbody>
19669 </tgroup>
19670 </informaltable>
19671 <para>
19672 <indexterm role="concept">
19673 <primary>AUTH</primary>
19674 <secondary>on MAIL command</secondary>
19675 </indexterm>
19676 This option defines the ACL that is run when there is an AUTH parameter on
19677 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
19678 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
19679 </para>
19680 <para>
19681 <indexterm role="option">
19682 <primary>acl_smtp_mime</primary>
19683 </indexterm>
19684 </para>
19685 <informaltable frame="all">
19686 <tgroup cols="4" colsep="0" rowsep="0">
19687 <colspec colwidth="8*" align="left"/>
19688 <colspec colwidth="5*" align="center"/>
19689 <colspec colwidth="5*" align="center"/>
19690 <colspec colwidth="6*" align="right"/>
19691 <tbody>
19692 <row>
19693 <entry><option>acl_smtp_mime</option></entry>
19694 <entry>Use: <emphasis>main</emphasis></entry>
19695 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19696 <entry>Default: <emphasis>unset</emphasis></entry>
19697 </row>
19698 </tbody>
19699 </tgroup>
19700 </informaltable>
19701 <para>
19702 <indexterm role="concept">
19703 <primary>MIME content scanning</primary>
19704 <secondary>ACL for</secondary>
19705 </indexterm>
19706 This option is available when Exim is built with the content-scanning
19707 extension. It defines the ACL that is run for each MIME part in a message. See
19708 section <xref linkend="SECTscanmimepart"/> for details.
19709 </para>
19710 <para>
19711 <indexterm role="option">
19712 <primary>acl_smtp_predata</primary>
19713 </indexterm>
19714 </para>
19715 <informaltable frame="all">
19716 <tgroup cols="4" colsep="0" rowsep="0">
19717 <colspec colwidth="8*" align="left"/>
19718 <colspec colwidth="5*" align="center"/>
19719 <colspec colwidth="5*" align="center"/>
19720 <colspec colwidth="6*" align="right"/>
19721 <tbody>
19722 <row>
19723 <entry><option>acl_smtp_predata</option></entry>
19724 <entry>Use: <emphasis>main</emphasis></entry>
19725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19726 <entry>Default: <emphasis>unset</emphasis></entry>
19727 </row>
19728 </tbody>
19729 </tgroup>
19730 </informaltable>
19731 <para>
19732 This option defines the ACL that is run when an SMTP DATA command is
19733 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
19734 further details.
19735 </para>
19736 <para>
19737 <indexterm role="option">
19738 <primary>acl_smtp_quit</primary>
19739 </indexterm>
19740 </para>
19741 <informaltable frame="all">
19742 <tgroup cols="4" colsep="0" rowsep="0">
19743 <colspec colwidth="8*" align="left"/>
19744 <colspec colwidth="5*" align="center"/>
19745 <colspec colwidth="5*" align="center"/>
19746 <colspec colwidth="6*" align="right"/>
19747 <tbody>
19748 <row>
19749 <entry><option>acl_smtp_quit</option></entry>
19750 <entry>Use: <emphasis>main</emphasis></entry>
19751 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19752 <entry>Default: <emphasis>unset</emphasis></entry>
19753 </row>
19754 </tbody>
19755 </tgroup>
19756 </informaltable>
19757 <para>
19758 <indexterm role="concept">
19759 <primary>QUIT</primary>
19760 <secondary>ACL for</secondary>
19761 </indexterm>
19762 This option defines the ACL that is run when an SMTP QUIT command is
19763 received. See chapter <xref linkend="CHAPACL"/> for further details.
19764 </para>
19765 <para>
19766 <indexterm role="option">
19767 <primary>acl_smtp_rcpt</primary>
19768 </indexterm>
19769 </para>
19770 <informaltable frame="all">
19771 <tgroup cols="4" colsep="0" rowsep="0">
19772 <colspec colwidth="8*" align="left"/>
19773 <colspec colwidth="5*" align="center"/>
19774 <colspec colwidth="5*" align="center"/>
19775 <colspec colwidth="6*" align="right"/>
19776 <tbody>
19777 <row>
19778 <entry><option>acl_smtp_rcpt</option></entry>
19779 <entry>Use: <emphasis>main</emphasis></entry>
19780 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19781 <entry>Default: <emphasis>unset</emphasis></entry>
19782 </row>
19783 </tbody>
19784 </tgroup>
19785 </informaltable>
19786 <para>
19787 <indexterm role="concept">
19788 <primary>RCPT</primary>
19789 <secondary>ACL for</secondary>
19790 </indexterm>
19791 This option defines the ACL that is run when an SMTP RCPT command is
19792 received. See chapter <xref linkend="CHAPACL"/> for further details.
19793 </para>
19794 <para>
19795 <indexterm role="option">
19796 <primary>acl_smtp_starttls</primary>
19797 </indexterm>
19798 </para>
19799 <informaltable frame="all">
19800 <tgroup cols="4" colsep="0" rowsep="0">
19801 <colspec colwidth="8*" align="left"/>
19802 <colspec colwidth="5*" align="center"/>
19803 <colspec colwidth="5*" align="center"/>
19804 <colspec colwidth="6*" align="right"/>
19805 <tbody>
19806 <row>
19807 <entry><option>acl_smtp_starttls</option></entry>
19808 <entry>Use: <emphasis>main</emphasis></entry>
19809 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19810 <entry>Default: <emphasis>unset</emphasis></entry>
19811 </row>
19812 </tbody>
19813 </tgroup>
19814 </informaltable>
19815 <para>
19816 <indexterm role="concept">
19817 <primary>STARTTLS</primary>
19818 <secondary>ACL for</secondary>
19819 </indexterm>
19820 This option defines the ACL that is run when an SMTP STARTTLS command is
19821 received. See chapter <xref linkend="CHAPACL"/> for further details.
19822 </para>
19823 <para>
19824 <indexterm role="option">
19825 <primary>acl_smtp_vrfy</primary>
19826 </indexterm>
19827 </para>
19828 <informaltable frame="all">
19829 <tgroup cols="4" colsep="0" rowsep="0">
19830 <colspec colwidth="8*" align="left"/>
19831 <colspec colwidth="5*" align="center"/>
19832 <colspec colwidth="5*" align="center"/>
19833 <colspec colwidth="6*" align="right"/>
19834 <tbody>
19835 <row>
19836 <entry><option>acl_smtp_vrfy</option></entry>
19837 <entry>Use: <emphasis>main</emphasis></entry>
19838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
19839 <entry>Default: <emphasis>unset</emphasis></entry>
19840 </row>
19841 </tbody>
19842 </tgroup>
19843 </informaltable>
19844 <para>
19845 <indexterm role="concept">
19846 <primary>VRFY</primary>
19847 <secondary>ACL for</secondary>
19848 </indexterm>
19849 This option defines the ACL that is run when an SMTP VRFY command is
19850 received. See chapter <xref linkend="CHAPACL"/> for further details.
19851 </para>
19852 <para>
19853 <indexterm role="option">
19854 <primary>admin_groups</primary>
19855 </indexterm>
19856 </para>
19857 <informaltable frame="all">
19858 <tgroup cols="4" colsep="0" rowsep="0">
19859 <colspec colwidth="8*" align="left"/>
19860 <colspec colwidth="5*" align="center"/>
19861 <colspec colwidth="5*" align="center"/>
19862 <colspec colwidth="6*" align="right"/>
19863 <tbody>
19864 <row>
19865 <entry><option>admin_groups</option></entry>
19866 <entry>Use: <emphasis>main</emphasis></entry>
19867 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
19868 <entry>Default: <emphasis>unset</emphasis></entry>
19869 </row>
19870 </tbody>
19871 </tgroup>
19872 </informaltable>
19873 <para>
19874 <indexterm role="concept">
19875 <primary>admin user</primary>
19876 </indexterm>
19877 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
19878 current group or any of the supplementary groups of an Exim caller is in this
19879 colon-separated list, the caller has admin privileges. If all your system
19880 programmers are in a specific group, for example, you can give them all Exim
19881 admin privileges by putting that group in <option>admin_groups</option>. However, this does
19882 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
19883 To permit this, you have to add individuals to the Exim group.
19884 </para>
19885 <para>
19886 <indexterm role="option">
19887 <primary>allow_domain_literals</primary>
19888 </indexterm>
19889 </para>
19890 <informaltable frame="all">
19891 <tgroup cols="4" colsep="0" rowsep="0">
19892 <colspec colwidth="8*" align="left"/>
19893 <colspec colwidth="5*" align="center"/>
19894 <colspec colwidth="5*" align="center"/>
19895 <colspec colwidth="6*" align="right"/>
19896 <tbody>
19897 <row>
19898 <entry><option>allow_domain_literals</option></entry>
19899 <entry>Use: <emphasis>main</emphasis></entry>
19900 <entry>Type: <emphasis>boolean</emphasis></entry>
19901 <entry>Default: <emphasis>false</emphasis></entry>
19902 </row>
19903 </tbody>
19904 </tgroup>
19905 </informaltable>
19906 <para>
19907 <indexterm role="concept">
19908 <primary>domain literal</primary>
19909 </indexterm>
19910 If this option is set, the RFC 2822 domain literal format is permitted in
19911 email addresses. The option is not set by default, because the domain literal
19912 format is not normally required these days, and few people know about it. It
19913 has, however, been exploited by mail abusers.
19914 </para>
19915 <para>
19916 Unfortunately, it seems that some DNS black list maintainers are using this
19917 format to report black listing to postmasters. If you want to accept messages
19918 addressed to your hosts by IP address, you need to set
19919 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
19920 domains (defined in the named domain list <option>local_domains</option> in the default
19921 configuration). This <quote>magic string</quote> matches the domain literal form of all
19922 the local host&#x2019;s IP addresses.
19923 </para>
19924 <para>
19925 <indexterm role="option">
19926 <primary>allow_mx_to_ip</primary>
19927 </indexterm>
19928 </para>
19929 <informaltable frame="all">
19930 <tgroup cols="4" colsep="0" rowsep="0">
19931 <colspec colwidth="8*" align="left"/>
19932 <colspec colwidth="5*" align="center"/>
19933 <colspec colwidth="5*" align="center"/>
19934 <colspec colwidth="6*" align="right"/>
19935 <tbody>
19936 <row>
19937 <entry><option>allow_mx_to_ip</option></entry>
19938 <entry>Use: <emphasis>main</emphasis></entry>
19939 <entry>Type: <emphasis>boolean</emphasis></entry>
19940 <entry>Default: <emphasis>false</emphasis></entry>
19941 </row>
19942 </tbody>
19943 </tgroup>
19944 </informaltable>
19945 <para>
19946 <indexterm role="concept">
19947 <primary>MX record</primary>
19948 <secondary>pointing to IP address</secondary>
19949 </indexterm>
19950 It appears that more and more DNS zone administrators are breaking the rules
19951 and putting domain names that look like IP addresses on the right hand side of
19952 MX records. Exim follows the rules and rejects this, giving an error message
19953 that explains the mis-configuration. However, some other MTAs support this
19954 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
19955 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
19956 recommended, except when you have no other choice.
19957 </para>
19958 <para>
19959 <indexterm role="option">
19960 <primary>allow_utf8_domains</primary>
19961 </indexterm>
19962 </para>
19963 <informaltable frame="all">
19964 <tgroup cols="4" colsep="0" rowsep="0">
19965 <colspec colwidth="8*" align="left"/>
19966 <colspec colwidth="5*" align="center"/>
19967 <colspec colwidth="5*" align="center"/>
19968 <colspec colwidth="6*" align="right"/>
19969 <tbody>
19970 <row>
19971 <entry><option>allow_utf8_domains</option></entry>
19972 <entry>Use: <emphasis>main</emphasis></entry>
19973 <entry>Type: <emphasis>boolean</emphasis></entry>
19974 <entry>Default: <emphasis>false</emphasis></entry>
19975 </row>
19976 </tbody>
19977 </tgroup>
19978 </informaltable>
19979 <para>
19980 <indexterm role="concept">
19981 <primary>domain</primary>
19982 <secondary>UTF-8 characters in</secondary>
19983 </indexterm>
19984 <indexterm role="concept">
19985 <primary>UTF-8</primary>
19986 <secondary>in domain name</secondary>
19987 </indexterm>
19988 Lots of discussion is going on about internationalized domain names. One
19989 camp is strongly in favour of just using UTF-8 characters, and it seems
19990 that at least two other MTAs permit this. This option allows Exim users to
19991 experiment if they wish.
19992 </para>
19993 <para>
19994 If it is set true, Exim&#x2019;s domain parsing function allows valid
19995 UTF-8 multicharacters to appear in domain name components, in addition to
19996 letters, digits, and hyphens. However, just setting this option is not
19997 enough; if you want to look up these domain names in the DNS, you must also
19998 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
19999 suitable setting is:
20000 </para>
20001 <literallayout class="monospaced">
20002 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
20003   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
20004 </literallayout>
20005 <para>
20006 Alternatively, you can just disable this feature by setting
20007 </para>
20008 <literallayout class="monospaced">
20009 dns_check_names_pattern =
20010 </literallayout>
20011 <para>
20012 That is, set the option to an empty string so that no check is done.
20013 </para>
20014 <para>
20015 <indexterm role="option">
20016 <primary>auth_advertise_hosts</primary>
20017 </indexterm>
20018 </para>
20019 <informaltable frame="all">
20020 <tgroup cols="4" colsep="0" rowsep="0">
20021 <colspec colwidth="8*" align="left"/>
20022 <colspec colwidth="5*" align="center"/>
20023 <colspec colwidth="5*" align="center"/>
20024 <colspec colwidth="6*" align="right"/>
20025 <tbody>
20026 <row>
20027 <entry><option>auth_advertise_hosts</option></entry>
20028 <entry>Use: <emphasis>main</emphasis></entry>
20029 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
20030 <entry>Default: <emphasis>*</emphasis></entry>
20031 </row>
20032 </tbody>
20033 </tgroup>
20034 </informaltable>
20035 <para>
20036 <indexterm role="concept">
20037 <primary>authentication</primary>
20038 <secondary>advertising</secondary>
20039 </indexterm>
20040 <indexterm role="concept">
20041 <primary>AUTH</primary>
20042 <secondary>advertising</secondary>
20043 </indexterm>
20044 If any server authentication mechanisms are configured, Exim advertises them in
20045 response to an EHLO command only if the calling host matches this list.
20046 Otherwise, Exim does not advertise AUTH.
20047 Exim does not accept AUTH commands from clients to which it has not
20048 advertised the availability of AUTH. The advertising of individual
20049 authentication mechanisms can be controlled by the use of the
20050 <option>server_advertise_condition</option> generic authenticator option on the individual
20051 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
20052 </para>
20053 <para>
20054 Certain mail clients (for example, Netscape) require the user to provide a name
20055 and password for authentication if AUTH is advertised, even though it may
20056 not be needed (the host may accept messages from hosts on its local LAN without
20057 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
20058 to make these clients more friendly by excluding them from the set of hosts to
20059 which Exim advertises AUTH.
20060 </para>
20061 <para>
20062 <indexterm role="concept">
20063 <primary>AUTH</primary>
20064 <secondary>advertising when encrypted</secondary>
20065 </indexterm>
20066 If you want to advertise the availability of AUTH only when the connection
20067 is encrypted using TLS, you can make use of the fact that the value of this
20068 option is expanded, with a setting like this:
20069 </para>
20070 <literallayout class="monospaced">
20071 auth_advertise_hosts = ${if eq{$tls_cipher}{}{}{*}}
20072 </literallayout>
20073 <para>
20074 <indexterm role="concept">
20075 <primary><varname>$tls_cipher</varname></primary>
20076 </indexterm>
20077 If <varname>$tls_cipher</varname> is empty, the session is not encrypted, and the result of
20078 the expansion is empty, thus matching no hosts. Otherwise, the result of the
20079 expansion is *, which matches all hosts.
20080 </para>
20081 <para>
20082 <indexterm role="option">
20083 <primary>auto_thaw</primary>
20084 </indexterm>
20085 </para>
20086 <informaltable frame="all">
20087 <tgroup cols="4" colsep="0" rowsep="0">
20088 <colspec colwidth="8*" align="left"/>
20089 <colspec colwidth="5*" align="center"/>
20090 <colspec colwidth="5*" align="center"/>
20091 <colspec colwidth="6*" align="right"/>
20092 <tbody>
20093 <row>
20094 <entry><option>auto_thaw</option></entry>
20095 <entry>Use: <emphasis>main</emphasis></entry>
20096 <entry>Type: <emphasis>time</emphasis></entry>
20097 <entry>Default: <emphasis>0s</emphasis></entry>
20098 </row>
20099 </tbody>
20100 </tgroup>
20101 </informaltable>
20102 <para>
20103 <indexterm role="concept">
20104 <primary>thawing messages</primary>
20105 </indexterm>
20106 <indexterm role="concept">
20107 <primary>unfreezing messages</primary>
20108 </indexterm>
20109 If this option is set to a time greater than zero, a queue runner will try a
20110 new delivery attempt on any frozen message, other than a bounce message, if
20111 this much time has passed since it was frozen. This may result in the message
20112 being re-frozen if nothing has changed since the last attempt. It is a way of
20113 saying <quote>keep on trying, even though there are big problems</quote>.
20114 </para>
20115 <para>
20116 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
20117 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
20118 thought to be very useful any more, and its use should probably be avoided.
20119 </para>
20120 <para>
20121 <indexterm role="option">
20122 <primary>av_scanner</primary>
20123 </indexterm>
20124 </para>
20125 <informaltable frame="all">
20126 <tgroup cols="4" colsep="0" rowsep="0">
20127 <colspec colwidth="8*" align="left"/>
20128 <colspec colwidth="5*" align="center"/>
20129 <colspec colwidth="5*" align="center"/>
20130 <colspec colwidth="6*" align="right"/>
20131 <tbody>
20132 <row>
20133 <entry><option>av_scanner</option></entry>
20134 <entry>Use: <emphasis>main</emphasis></entry>
20135 <entry>Type: <emphasis>string</emphasis></entry>
20136 <entry>Default: <emphasis>see below</emphasis></entry>
20137 </row>
20138 </tbody>
20139 </tgroup>
20140 </informaltable>
20141 <para>
20142 This option is available if Exim is built with the content-scanning extension.
20143 It specifies which anti-virus scanner to use. The default value is:
20144 </para>
20145 <literallayout class="monospaced">
20146 sophie:/var/run/sophie
20147 </literallayout>
20148 <para>
20149 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
20150 before use. See section <xref linkend="SECTscanvirus"/> for further details.
20151 </para>
20152 <para>
20153 <indexterm role="option">
20154 <primary>bi_command</primary>
20155 </indexterm>
20156 </para>
20157 <informaltable frame="all">
20158 <tgroup cols="4" colsep="0" rowsep="0">
20159 <colspec colwidth="8*" align="left"/>
20160 <colspec colwidth="5*" align="center"/>
20161 <colspec colwidth="5*" align="center"/>
20162 <colspec colwidth="6*" align="right"/>
20163 <tbody>
20164 <row>
20165 <entry><option>bi_command</option></entry>
20166 <entry>Use: <emphasis>main</emphasis></entry>
20167 <entry>Type: <emphasis>string</emphasis></entry>
20168 <entry>Default: <emphasis>unset</emphasis></entry>
20169 </row>
20170 </tbody>
20171 </tgroup>
20172 </informaltable>
20173 <para>
20174 <indexterm role="concept">
20175 <primary><option>-bi</option> option</primary>
20176 </indexterm>
20177 This option supplies the name of a command that is run when Exim is called with
20178 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
20179 just the command name, it is not a complete command line. If an argument is
20180 required, it must come from the <option>-oA</option> command line option.
20181 </para>
20182 <para>
20183 <indexterm role="option">
20184 <primary>bounce_message_file</primary>
20185 </indexterm>
20186 </para>
20187 <informaltable frame="all">
20188 <tgroup cols="4" colsep="0" rowsep="0">
20189 <colspec colwidth="8*" align="left"/>
20190 <colspec colwidth="5*" align="center"/>
20191 <colspec colwidth="5*" align="center"/>
20192 <colspec colwidth="6*" align="right"/>
20193 <tbody>
20194 <row>
20195 <entry><option>bounce_message_file</option></entry>
20196 <entry>Use: <emphasis>main</emphasis></entry>
20197 <entry>Type: <emphasis>string</emphasis></entry>
20198 <entry>Default: <emphasis>unset</emphasis></entry>
20199 </row>
20200 </tbody>
20201 </tgroup>
20202 </informaltable>
20203 <para>
20204 <indexterm role="concept">
20205 <primary>bounce message</primary>
20206 <secondary>customizing</secondary>
20207 </indexterm>
20208 <indexterm role="concept">
20209 <primary>customizing</primary>
20210 <secondary>bounce message</secondary>
20211 </indexterm>
20212 This option defines a template file containing paragraphs of text to be used
20213 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
20214 chapter <xref linkend="CHAPemsgcust"/>. See also <option>warn_message_file</option>.
20215 </para>
20216 <para>
20217 <indexterm role="option">
20218 <primary>bounce_message_text</primary>
20219 </indexterm>
20220 </para>
20221 <informaltable frame="all">
20222 <tgroup cols="4" colsep="0" rowsep="0">
20223 <colspec colwidth="8*" align="left"/>
20224 <colspec colwidth="5*" align="center"/>
20225 <colspec colwidth="5*" align="center"/>
20226 <colspec colwidth="6*" align="right"/>
20227 <tbody>
20228 <row>
20229 <entry><option>bounce_message_text</option></entry>
20230 <entry>Use: <emphasis>main</emphasis></entry>
20231 <entry>Type: <emphasis>string</emphasis></entry>
20232 <entry>Default: <emphasis>unset</emphasis></entry>
20233 </row>
20234 </tbody>
20235 </tgroup>
20236 </informaltable>
20237 <para>
20238 When this option is set, its contents are included in the default bounce
20239 message immediately after <quote>This message was created automatically by mail
20240 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
20241 </para>
20242 <para>
20243 <indexterm role="option">
20244 <primary>bounce_return_body</primary>
20245 </indexterm>
20246 </para>
20247 <informaltable frame="all">
20248 <tgroup cols="4" colsep="0" rowsep="0">
20249 <colspec colwidth="8*" align="left"/>
20250 <colspec colwidth="5*" align="center"/>
20251 <colspec colwidth="5*" align="center"/>
20252 <colspec colwidth="6*" align="right"/>
20253 <tbody>
20254 <row>
20255 <entry><option>bounce_return_body</option></entry>
20256 <entry>Use: <emphasis>main</emphasis></entry>
20257 <entry>Type: <emphasis>boolean</emphasis></entry>
20258 <entry>Default: <emphasis>true</emphasis></entry>
20259 </row>
20260 </tbody>
20261 </tgroup>
20262 </informaltable>
20263 <para>
20264 <indexterm role="concept">
20265 <primary>bounce message</primary>
20266 <secondary>including body</secondary>
20267 </indexterm>
20268 This option controls whether the body of an incoming message is included in a
20269 bounce message when <option>bounce_return_message</option> is true. The default setting
20270 causes the entire message, both header and body, to be returned (subject to the
20271 value of <option>bounce_return_size_limit</option>). If this option is false, only the
20272 message header is included. In the case of a non-SMTP message containing an
20273 error that is detected during reception, only those header lines preceding the
20274 point at which the error was detected are returned.
20275 <indexterm role="concept">
20276 <primary>bounce message</primary>
20277 <secondary>including original</secondary>
20278 </indexterm>
20279 </para>
20280 <para>
20281 <indexterm role="option">
20282 <primary>bounce_return_message</primary>
20283 </indexterm>
20284 </para>
20285 <informaltable frame="all">
20286 <tgroup cols="4" colsep="0" rowsep="0">
20287 <colspec colwidth="8*" align="left"/>
20288 <colspec colwidth="5*" align="center"/>
20289 <colspec colwidth="5*" align="center"/>
20290 <colspec colwidth="6*" align="right"/>
20291 <tbody>
20292 <row>
20293 <entry><option>bounce_return_message</option></entry>
20294 <entry>Use: <emphasis>main</emphasis></entry>
20295 <entry>Type: <emphasis>boolean</emphasis></entry>
20296 <entry>Default: <emphasis>true</emphasis></entry>
20297 </row>
20298 </tbody>
20299 </tgroup>
20300 </informaltable>
20301 <para>
20302 If this option is set false, none of the original message is included in
20303 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
20304 <option>bounce_return_body</option>.
20305 </para>
20306 <para>
20307 <indexterm role="option">
20308 <primary>bounce_return_size_limit</primary>
20309 </indexterm>
20310 </para>
20311 <informaltable frame="all">
20312 <tgroup cols="4" colsep="0" rowsep="0">
20313 <colspec colwidth="8*" align="left"/>
20314 <colspec colwidth="5*" align="center"/>
20315 <colspec colwidth="5*" align="center"/>
20316 <colspec colwidth="6*" align="right"/>
20317 <tbody>
20318 <row>
20319 <entry><option>bounce_return_size_limit</option></entry>
20320 <entry>Use: <emphasis>main</emphasis></entry>
20321 <entry>Type: <emphasis>integer</emphasis></entry>
20322 <entry>Default: <emphasis>100K</emphasis></entry>
20323 </row>
20324 </tbody>
20325 </tgroup>
20326 </informaltable>
20327 <para>
20328 <indexterm role="concept">
20329 <primary>size limit</primary>
20330 <secondary>of bounce</secondary>
20331 </indexterm>
20332 <indexterm role="concept">
20333 <primary>bounce message</primary>
20334 <secondary>size limit</secondary>
20335 </indexterm>
20336 <indexterm role="concept">
20337 <primary>limit</primary>
20338 <secondary>bounce message size</secondary>
20339 </indexterm>
20340 This option sets a limit in bytes on the size of messages that are returned to
20341 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
20342 limit should be less than the value of the global <option>message_size_limit</option> and of
20343 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
20344 that Exim generates. If this option is set to zero there is no limit.
20345 </para>
20346 <para>
20347 When the body of any message that is to be included in a bounce message is
20348 greater than the limit, it is truncated, and a comment pointing this out is
20349 added at the top. The actual cutoff may be greater than the value given, owing
20350 to the use of buffering for transferring the message in chunks (typically 8K in
20351 size). The idea is to save bandwidth on those undeliverable 15-megabyte
20352 messages.
20353 </para>
20354 <para>
20355 <indexterm role="option">
20356 <primary>bounce_sender_authentication</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>bounce_sender_authentication</option></entry>
20368 <entry>Use: <emphasis>main</emphasis></entry>
20369 <entry>Type: <emphasis>string</emphasis></entry>
20370 <entry>Default: <emphasis>unset</emphasis></entry>
20371 </row>
20372 </tbody>
20373 </tgroup>
20374 </informaltable>
20375 <para>
20376 <indexterm role="concept">
20377 <primary>bounce message</primary>
20378 <secondary>sender authentication</secondary>
20379 </indexterm>
20380 <indexterm role="concept">
20381 <primary>authentication</primary>
20382 <secondary>bounce message</secondary>
20383 </indexterm>
20384 <indexterm role="concept">
20385 <primary>AUTH</primary>
20386 <secondary>on bounce message</secondary>
20387 </indexterm>
20388 This option provides an authenticated sender address that is sent with any
20389 bounce messages generated by Exim that are sent over an authenticated SMTP
20390 connection. A typical setting might be:
20391 </para>
20392 <literallayout class="monospaced">
20393 bounce_sender_authentication = mailer-daemon@my.domain.example
20394 </literallayout>
20395 <para>
20396 which would cause bounce messages to be sent using the SMTP command:
20397 </para>
20398 <literallayout class="monospaced">
20399 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
20400 </literallayout>
20401 <para>
20402 The value of <option>bounce_sender_authentication</option> must always be a complete email
20403 address.
20404 </para>
20405 <para>
20406 <indexterm role="option">
20407 <primary>callout_domain_negative_expire</primary>
20408 </indexterm>
20409 </para>
20410 <informaltable frame="all">
20411 <tgroup cols="4" colsep="0" rowsep="0">
20412 <colspec colwidth="8*" align="left"/>
20413 <colspec colwidth="5*" align="center"/>
20414 <colspec colwidth="5*" align="center"/>
20415 <colspec colwidth="6*" align="right"/>
20416 <tbody>
20417 <row>
20418 <entry><option>callout_domain_negative_expire</option></entry>
20419 <entry>Use: <emphasis>main</emphasis></entry>
20420 <entry>Type: <emphasis>time</emphasis></entry>
20421 <entry>Default: <emphasis>3h</emphasis></entry>
20422 </row>
20423 </tbody>
20424 </tgroup>
20425 </informaltable>
20426 <para>
20427 <indexterm role="concept">
20428 <primary>caching</primary>
20429 <secondary>callout timeouts</secondary>
20430 </indexterm>
20431 <indexterm role="concept">
20432 <primary>callout</primary>
20433 <secondary>caching timeouts</secondary>
20434 </indexterm>
20435 This option specifies the expiry time for negative callout cache data for a
20436 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20437 section <xref linkend="SECTcallvercache"/> for details of the caching.
20438 </para>
20439 <para>
20440 <indexterm role="option">
20441 <primary>callout_domain_positive_expire</primary>
20442 </indexterm>
20443 </para>
20444 <informaltable frame="all">
20445 <tgroup cols="4" colsep="0" rowsep="0">
20446 <colspec colwidth="8*" align="left"/>
20447 <colspec colwidth="5*" align="center"/>
20448 <colspec colwidth="5*" align="center"/>
20449 <colspec colwidth="6*" align="right"/>
20450 <tbody>
20451 <row>
20452 <entry><option>callout_domain_positive_expire</option></entry>
20453 <entry>Use: <emphasis>main</emphasis></entry>
20454 <entry>Type: <emphasis>time</emphasis></entry>
20455 <entry>Default: <emphasis>7d</emphasis></entry>
20456 </row>
20457 </tbody>
20458 </tgroup>
20459 </informaltable>
20460 <para>
20461 This option specifies the expiry time for positive callout cache data for a
20462 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20463 section <xref linkend="SECTcallvercache"/> for details of the caching.
20464 </para>
20465 <para>
20466 <indexterm role="option">
20467 <primary>callout_negative_expire</primary>
20468 </indexterm>
20469 </para>
20470 <informaltable frame="all">
20471 <tgroup cols="4" colsep="0" rowsep="0">
20472 <colspec colwidth="8*" align="left"/>
20473 <colspec colwidth="5*" align="center"/>
20474 <colspec colwidth="5*" align="center"/>
20475 <colspec colwidth="6*" align="right"/>
20476 <tbody>
20477 <row>
20478 <entry><option>callout_negative_expire</option></entry>
20479 <entry>Use: <emphasis>main</emphasis></entry>
20480 <entry>Type: <emphasis>time</emphasis></entry>
20481 <entry>Default: <emphasis>2h</emphasis></entry>
20482 </row>
20483 </tbody>
20484 </tgroup>
20485 </informaltable>
20486 <para>
20487 This option specifies the expiry time for negative callout cache data for an
20488 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20489 section <xref linkend="SECTcallvercache"/> for details of the caching.
20490 </para>
20491 <para>
20492 <indexterm role="option">
20493 <primary>callout_positive_expire</primary>
20494 </indexterm>
20495 </para>
20496 <informaltable frame="all">
20497 <tgroup cols="4" colsep="0" rowsep="0">
20498 <colspec colwidth="8*" align="left"/>
20499 <colspec colwidth="5*" align="center"/>
20500 <colspec colwidth="5*" align="center"/>
20501 <colspec colwidth="6*" align="right"/>
20502 <tbody>
20503 <row>
20504 <entry><option>callout_positive_expire</option></entry>
20505 <entry>Use: <emphasis>main</emphasis></entry>
20506 <entry>Type: <emphasis>time</emphasis></entry>
20507 <entry>Default: <emphasis>24h</emphasis></entry>
20508 </row>
20509 </tbody>
20510 </tgroup>
20511 </informaltable>
20512 <para>
20513 This option specifies the expiry time for positive callout cache data for an
20514 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
20515 section <xref linkend="SECTcallvercache"/> for details of the caching.
20516 </para>
20517 <para>
20518 <indexterm role="option">
20519 <primary>callout_random_local_part</primary>
20520 </indexterm>
20521 </para>
20522 <informaltable frame="all">
20523 <tgroup cols="4" colsep="0" rowsep="0">
20524 <colspec colwidth="8*" align="left"/>
20525 <colspec colwidth="5*" align="center"/>
20526 <colspec colwidth="5*" align="center"/>
20527 <colspec colwidth="6*" align="right"/>
20528 <tbody>
20529 <row>
20530 <entry><option>callout_random_local_part</option></entry>
20531 <entry>Use: <emphasis>main</emphasis></entry>
20532 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20533 <entry>Default: <emphasis>see below</emphasis></entry>
20534 </row>
20535 </tbody>
20536 </tgroup>
20537 </informaltable>
20538 <para>
20539 This option defines the <quote>random</quote> local part that can be used as part of
20540 callout verification. The default value is
20541 </para>
20542 <literallayout class="monospaced">
20543 $primary_host_name-$tod_epoch-testing
20544 </literallayout>
20545 <para>
20546 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
20547 </para>
20548 <para>
20549 <indexterm role="option">
20550 <primary>check_log_inodes</primary>
20551 </indexterm>
20552 </para>
20553 <informaltable frame="all">
20554 <tgroup cols="4" colsep="0" rowsep="0">
20555 <colspec colwidth="8*" align="left"/>
20556 <colspec colwidth="5*" align="center"/>
20557 <colspec colwidth="5*" align="center"/>
20558 <colspec colwidth="6*" align="right"/>
20559 <tbody>
20560 <row>
20561 <entry><option>check_log_inodes</option></entry>
20562 <entry>Use: <emphasis>main</emphasis></entry>
20563 <entry>Type: <emphasis>integer</emphasis></entry>
20564 <entry>Default: <emphasis>0</emphasis></entry>
20565 </row>
20566 </tbody>
20567 </tgroup>
20568 </informaltable>
20569 <para>
20570 See <option>check_spool_space</option> below.
20571 </para>
20572 <para>
20573 <indexterm role="option">
20574 <primary>check_log_space</primary>
20575 </indexterm>
20576 </para>
20577 <informaltable frame="all">
20578 <tgroup cols="4" colsep="0" rowsep="0">
20579 <colspec colwidth="8*" align="left"/>
20580 <colspec colwidth="5*" align="center"/>
20581 <colspec colwidth="5*" align="center"/>
20582 <colspec colwidth="6*" align="right"/>
20583 <tbody>
20584 <row>
20585 <entry><option>check_log_space</option></entry>
20586 <entry>Use: <emphasis>main</emphasis></entry>
20587 <entry>Type: <emphasis>integer</emphasis></entry>
20588 <entry>Default: <emphasis>0</emphasis></entry>
20589 </row>
20590 </tbody>
20591 </tgroup>
20592 </informaltable>
20593 <para>
20594 See <option>check_spool_space</option> below.
20595 </para>
20596 <para>
20597 <indexterm role="option">
20598 <primary><option>check_rfc2047_length</option></primary>
20599 </indexterm>
20600 <indexterm role="concept">
20601 <primary>RFC 2047</primary>
20602 <secondary>disabling length check</secondary>
20603 </indexterm>
20604 <indexterm role="option">
20605 <primary>check_rfc2047_length</primary>
20606 </indexterm>
20607 </para>
20608 <informaltable frame="all">
20609 <tgroup cols="4" colsep="0" rowsep="0">
20610 <colspec colwidth="8*" align="left"/>
20611 <colspec colwidth="5*" align="center"/>
20612 <colspec colwidth="5*" align="center"/>
20613 <colspec colwidth="6*" align="right"/>
20614 <tbody>
20615 <row>
20616 <entry><option>check_rfc2047_length</option></entry>
20617 <entry>Use: <emphasis> User: main</emphasis></entry>
20618 <entry>Type: <emphasis>boolean</emphasis></entry>
20619 <entry>Default: <emphasis>true</emphasis></entry>
20620 </row>
20621 </tbody>
20622 </tgroup>
20623 </informaltable>
20624 <para>
20625 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
20626 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
20627 word; strings to be encoded that exceed this length are supposed to use
20628 multiple encoded words. By default, Exim does not recognize encoded words that
20629 exceed the maximum length. However, it seems that some software, in violation
20630 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
20631 set false, Exim recognizes encoded words of any length.
20632 </para>
20633 <para>
20634 <indexterm role="option">
20635 <primary>check_spool_inodes</primary>
20636 </indexterm>
20637 </para>
20638 <informaltable frame="all">
20639 <tgroup cols="4" colsep="0" rowsep="0">
20640 <colspec colwidth="8*" align="left"/>
20641 <colspec colwidth="5*" align="center"/>
20642 <colspec colwidth="5*" align="center"/>
20643 <colspec colwidth="6*" align="right"/>
20644 <tbody>
20645 <row>
20646 <entry><option>check_spool_inodes</option></entry>
20647 <entry>Use: <emphasis>main</emphasis></entry>
20648 <entry>Type: <emphasis>integer</emphasis></entry>
20649 <entry>Default: <emphasis>0</emphasis></entry>
20650 </row>
20651 </tbody>
20652 </tgroup>
20653 </informaltable>
20654 <para>
20655 See <option>check_spool_space</option> below.
20656 </para>
20657 <para>
20658 <indexterm role="option">
20659 <primary>check_spool_space</primary>
20660 </indexterm>
20661 </para>
20662 <informaltable frame="all">
20663 <tgroup cols="4" colsep="0" rowsep="0">
20664 <colspec colwidth="8*" align="left"/>
20665 <colspec colwidth="5*" align="center"/>
20666 <colspec colwidth="5*" align="center"/>
20667 <colspec colwidth="6*" align="right"/>
20668 <tbody>
20669 <row>
20670 <entry><option>check_spool_space</option></entry>
20671 <entry>Use: <emphasis>main</emphasis></entry>
20672 <entry>Type: <emphasis>integer</emphasis></entry>
20673 <entry>Default: <emphasis>0</emphasis></entry>
20674 </row>
20675 </tbody>
20676 </tgroup>
20677 </informaltable>
20678 <para>
20679 <indexterm role="concept">
20680 <primary>checking disk space</primary>
20681 </indexterm>
20682 <indexterm role="concept">
20683 <primary>disk space</primary>
20684 <secondary>checking</secondary>
20685 </indexterm>
20686 <indexterm role="concept">
20687 <primary>spool directory</primary>
20688 <secondary>checking space</secondary>
20689 </indexterm>
20690 The four <option>check_...</option> options allow for checking of disk resources before a
20691 message is accepted.
20692 </para>
20693 <para>
20694 <indexterm role="concept">
20695 <primary><varname>$log_inodes</varname></primary>
20696 </indexterm>
20697 <indexterm role="concept">
20698 <primary><varname>$log_space</varname></primary>
20699 </indexterm>
20700 <indexterm role="concept">
20701 <primary><varname>$spool_inodes</varname></primary>
20702 </indexterm>
20703 <indexterm role="concept">
20704 <primary><varname>$spool_space</varname></primary>
20705 </indexterm>
20706 When any of these options are set, they apply to all incoming messages. If you
20707 want to apply different checks to different kinds of message, you can do so by
20708 testing the the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
20709 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
20710 </para>
20711 <para>
20712 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
20713 either value is greater than zero, for example:
20714 </para>
20715 <literallayout class="monospaced">
20716 check_spool_space = 10M
20717 check_spool_inodes = 100
20718 </literallayout>
20719 <para>
20720 The spool partition is the one that contains the directory defined by
20721 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
20722 transit.
20723 </para>
20724 <para>
20725 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
20726 files are written if either is greater than zero. These should be set only if
20727 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
20728 </para>
20729 <para>
20730 If there is less space or fewer inodes than requested, Exim refuses to accept
20731 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
20732 error response to the MAIL command. If ESMTP is in use and there was a
20733 SIZE parameter on the MAIL command, its value is added to the
20734 <option>check_spool_space</option> value, and the check is performed even if
20735 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
20736 </para>
20737 <para>
20738 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
20739 number of kilobytes. If a non-multiple of 1024 is specified, it is rounded up.
20740 </para>
20741 <para>
20742 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
20743 failure a message is written to stderr and Exim exits with a non-zero code, as
20744 it obviously cannot send an error message of any kind.
20745 </para>
20746 <para>
20747 <indexterm role="option">
20748 <primary>daemon_smtp_ports</primary>
20749 </indexterm>
20750 </para>
20751 <informaltable frame="all">
20752 <tgroup cols="4" colsep="0" rowsep="0">
20753 <colspec colwidth="8*" align="left"/>
20754 <colspec colwidth="5*" align="center"/>
20755 <colspec colwidth="5*" align="center"/>
20756 <colspec colwidth="6*" align="right"/>
20757 <tbody>
20758 <row>
20759 <entry><option>daemon_smtp_ports</option></entry>
20760 <entry>Use: <emphasis>main</emphasis></entry>
20761 <entry>Type: <emphasis>string</emphasis></entry>
20762 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
20763 </row>
20764 </tbody>
20765 </tgroup>
20766 </informaltable>
20767 <para>
20768 <indexterm role="concept">
20769 <primary>port</primary>
20770 <secondary>for daemon</secondary>
20771 </indexterm>
20772 <indexterm role="concept">
20773 <primary>TCP/IP</primary>
20774 <secondary>setting listening ports</secondary>
20775 </indexterm>
20776 This option specifies one or more default SMTP ports on which the Exim daemon
20777 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
20778 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
20779 </para>
20780 <para>
20781 <indexterm role="option">
20782 <primary>daemon_startup_retries</primary>
20783 </indexterm>
20784 </para>
20785 <informaltable frame="all">
20786 <tgroup cols="4" colsep="0" rowsep="0">
20787 <colspec colwidth="8*" align="left"/>
20788 <colspec colwidth="5*" align="center"/>
20789 <colspec colwidth="5*" align="center"/>
20790 <colspec colwidth="6*" align="right"/>
20791 <tbody>
20792 <row>
20793 <entry><option>daemon_startup_retries</option></entry>
20794 <entry>Use: <emphasis>main</emphasis></entry>
20795 <entry>Type: <emphasis>integer</emphasis></entry>
20796 <entry>Default: <emphasis>9</emphasis></entry>
20797 </row>
20798 </tbody>
20799 </tgroup>
20800 </informaltable>
20801 <para>
20802 <indexterm role="concept">
20803 <primary>daemon startup</primary>
20804 <secondary>retrying</secondary>
20805 </indexterm>
20806 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
20807 the daemon at startup when it cannot immediately bind a listening socket
20808 (typically because the socket is already in use): <option>daemon_startup_retries</option>
20809 defines the number of retries after the first failure, and
20810 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
20811 </para>
20812 <para>
20813 <indexterm role="option">
20814 <primary>daemon_startup_sleep</primary>
20815 </indexterm>
20816 </para>
20817 <informaltable frame="all">
20818 <tgroup cols="4" colsep="0" rowsep="0">
20819 <colspec colwidth="8*" align="left"/>
20820 <colspec colwidth="5*" align="center"/>
20821 <colspec colwidth="5*" align="center"/>
20822 <colspec colwidth="6*" align="right"/>
20823 <tbody>
20824 <row>
20825 <entry><option>daemon_startup_sleep</option></entry>
20826 <entry>Use: <emphasis>main</emphasis></entry>
20827 <entry>Type: <emphasis>time</emphasis></entry>
20828 <entry>Default: <emphasis>30s</emphasis></entry>
20829 </row>
20830 </tbody>
20831 </tgroup>
20832 </informaltable>
20833 <para>
20834 See <option>daemon_startup_retries</option>.
20835 </para>
20836 <para>
20837 <indexterm role="option">
20838 <primary>delay_warning</primary>
20839 </indexterm>
20840 </para>
20841 <informaltable frame="all">
20842 <tgroup cols="4" colsep="0" rowsep="0">
20843 <colspec colwidth="8*" align="left"/>
20844 <colspec colwidth="5*" align="center"/>
20845 <colspec colwidth="5*" align="center"/>
20846 <colspec colwidth="6*" align="right"/>
20847 <tbody>
20848 <row>
20849 <entry><option>delay_warning</option></entry>
20850 <entry>Use: <emphasis>main</emphasis></entry>
20851 <entry>Type: <emphasis>time list</emphasis></entry>
20852 <entry>Default: <emphasis>24h</emphasis></entry>
20853 </row>
20854 </tbody>
20855 </tgroup>
20856 </informaltable>
20857 <para>
20858 <indexterm role="concept">
20859 <primary>warning of delay</primary>
20860 </indexterm>
20861 <indexterm role="concept">
20862 <primary>delay warning</primary>
20863 <secondary>specifying</secondary>
20864 </indexterm>
20865 When a message is delayed, Exim sends a warning message to the sender at
20866 intervals specified by this option. The data is a colon-separated list of times
20867 after which to send warning messages. If the value of the option is an empty
20868 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
20869 message has been on the queue for longer than the last time, the last interval
20870 between the times is used to compute subsequent warning times. For example,
20871 with
20872 </para>
20873 <literallayout class="monospaced">
20874 delay_warning = 4h:8h:24h
20875 </literallayout>
20876 <para>
20877 the first message is sent after 4 hours, the second after 8 hours, and
20878 the third one after 24 hours. After that, messages are sent every 16 hours,
20879 because that is the interval between the last two times on the list. If you set
20880 just one time, it specifies the repeat interval. For example, with:
20881 </para>
20882 <literallayout class="monospaced">
20883 delay_warning = 6h
20884 </literallayout>
20885 <para>
20886 messages are repeated every six hours. To stop warnings after a given time, set
20887 a very large time at the end of the list. For example:
20888 </para>
20889 <literallayout class="monospaced">
20890 delay_warning = 2h:12h:99d
20891 </literallayout>
20892 <para>
20893 <indexterm role="option">
20894 <primary>delay_warning_condition</primary>
20895 </indexterm>
20896 </para>
20897 <informaltable frame="all">
20898 <tgroup cols="4" colsep="0" rowsep="0">
20899 <colspec colwidth="8*" align="left"/>
20900 <colspec colwidth="5*" align="center"/>
20901 <colspec colwidth="5*" align="center"/>
20902 <colspec colwidth="6*" align="right"/>
20903 <tbody>
20904 <row>
20905 <entry><option>delay_warning_condition</option></entry>
20906 <entry>Use: <emphasis>main</emphasis></entry>
20907 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
20908 <entry>Default: <emphasis>see below</emphasis></entry>
20909 </row>
20910 </tbody>
20911 </tgroup>
20912 </informaltable>
20913 <para>
20914 <indexterm role="concept">
20915 <primary><varname>$domain</varname></primary>
20916 </indexterm>
20917 The string is expanded at the time a warning message might be sent. If all the
20918 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
20919 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
20920 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
20921 <quote>false</quote> (the comparison being done caselessly) then the warning message is
20922 not sent. The default is:
20923 </para>
20924 <literallayout class="monospaced" revisionflag="changed">
20925 delay_warning_condition = ${if or {\
20926   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
20927   { match{$h_precedence:}{(?i)bulk|list|junk} }\
20928   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
20929   } {no}{yes}}
20930 </literallayout>
20931 <para revisionflag="changed">
20932 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
20933 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
20934 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
20935 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
20936 </para>
20937 <para>
20938 <indexterm role="option">
20939 <primary>deliver_drop_privilege</primary>
20940 </indexterm>
20941 </para>
20942 <informaltable frame="all">
20943 <tgroup cols="4" colsep="0" rowsep="0">
20944 <colspec colwidth="8*" align="left"/>
20945 <colspec colwidth="5*" align="center"/>
20946 <colspec colwidth="5*" align="center"/>
20947 <colspec colwidth="6*" align="right"/>
20948 <tbody>
20949 <row>
20950 <entry><option>deliver_drop_privilege</option></entry>
20951 <entry>Use: <emphasis>main</emphasis></entry>
20952 <entry>Type: <emphasis>boolean</emphasis></entry>
20953 <entry>Default: <emphasis>false</emphasis></entry>
20954 </row>
20955 </tbody>
20956 </tgroup>
20957 </informaltable>
20958 <para>
20959 <indexterm role="concept">
20960 <primary>unprivileged delivery</primary>
20961 </indexterm>
20962 <indexterm role="concept">
20963 <primary>delivery</primary>
20964 <secondary>unprivileged</secondary>
20965 </indexterm>
20966 If this option is set true, Exim drops its root privilege at the start of a
20967 delivery process, and runs as the Exim user throughout. This severely restricts
20968 the kinds of local delivery that are possible, but is viable in certain types
20969 of configuration. There is a discussion about the use of root privilege in
20970 chapter <xref linkend="CHAPsecurity"/>.
20971 </para>
20972 <para>
20973 <indexterm role="option">
20974 <primary>deliver_queue_load_max</primary>
20975 </indexterm>
20976 </para>
20977 <informaltable frame="all">
20978 <tgroup cols="4" colsep="0" rowsep="0">
20979 <colspec colwidth="8*" align="left"/>
20980 <colspec colwidth="5*" align="center"/>
20981 <colspec colwidth="5*" align="center"/>
20982 <colspec colwidth="6*" align="right"/>
20983 <tbody>
20984 <row>
20985 <entry><option>deliver_queue_load_max</option></entry>
20986 <entry>Use: <emphasis>main</emphasis></entry>
20987 <entry>Type: <emphasis>fixed-point</emphasis></entry>
20988 <entry>Default: <emphasis>unset</emphasis></entry>
20989 </row>
20990 </tbody>
20991 </tgroup>
20992 </informaltable>
20993 <para>
20994 <indexterm role="concept">
20995 <primary>load average</primary>
20996 </indexterm>
20997 <indexterm role="concept">
20998 <primary>queue runner</primary>
20999 <secondary>abandoning</secondary>
21000 </indexterm>
21001 When this option is set, a queue run is abandoned if the system load average
21002 becomes greater than the value of the option. The option has no effect on
21003 ancient operating systems on which Exim cannot determine the load average.
21004 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
21005 </para>
21006 <para>
21007 <indexterm role="option">
21008 <primary>delivery_date_remove</primary>
21009 </indexterm>
21010 </para>
21011 <informaltable frame="all">
21012 <tgroup cols="4" colsep="0" rowsep="0">
21013 <colspec colwidth="8*" align="left"/>
21014 <colspec colwidth="5*" align="center"/>
21015 <colspec colwidth="5*" align="center"/>
21016 <colspec colwidth="6*" align="right"/>
21017 <tbody>
21018 <row>
21019 <entry><option>delivery_date_remove</option></entry>
21020 <entry>Use: <emphasis>main</emphasis></entry>
21021 <entry>Type: <emphasis>boolean</emphasis></entry>
21022 <entry>Default: <emphasis>true</emphasis></entry>
21023 </row>
21024 </tbody>
21025 </tgroup>
21026 </informaltable>
21027 <para>
21028 <indexterm role="concept">
21029 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
21030 </indexterm>
21031 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
21032 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21033 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
21034 should not be present in incoming messages, and this option causes them to be
21035 removed at the time the message is received, to avoid any problems that might
21036 occur when a delivered message is subsequently sent on to some other recipient.
21037 </para>
21038 <para>
21039 <indexterm role="option">
21040 <primary>disable_ipv6</primary>
21041 </indexterm>
21042 </para>
21043 <informaltable frame="all">
21044 <tgroup cols="4" colsep="0" rowsep="0">
21045 <colspec colwidth="8*" align="left"/>
21046 <colspec colwidth="5*" align="center"/>
21047 <colspec colwidth="5*" align="center"/>
21048 <colspec colwidth="6*" align="right"/>
21049 <tbody>
21050 <row>
21051 <entry><option>disable_ipv6</option></entry>
21052 <entry>Use: <emphasis>main</emphasis></entry>
21053 <entry>Type: <emphasis>boolean</emphasis></entry>
21054 <entry>Default: <emphasis>false</emphasis></entry>
21055 </row>
21056 </tbody>
21057 </tgroup>
21058 </informaltable>
21059 <para>
21060 <indexterm role="concept">
21061 <primary>IPv6</primary>
21062 <secondary>disabling</secondary>
21063 </indexterm>
21064 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
21065 activities take place. AAAA records are never looked up, and any IPv6 addresses
21066 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
21067 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
21068 to handle IPv6 literal addresses.
21069 </para>
21070 <para>
21071 <indexterm role="option">
21072 <primary>dns_again_means_nonexist</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>dns_again_means_nonexist</option></entry>
21084 <entry>Use: <emphasis>main</emphasis></entry>
21085 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21086 <entry>Default: <emphasis>unset</emphasis></entry>
21087 </row>
21088 </tbody>
21089 </tgroup>
21090 </informaltable>
21091 <para>
21092 <indexterm role="concept">
21093 <primary>DNS</primary>
21094 <secondary><quote>try again</quote> response; overriding</secondary>
21095 </indexterm>
21096 DNS lookups give a <quote>try again</quote> response for the DNS errors
21097 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
21098 keep trying to deliver a message, or to give repeated temporary errors to
21099 incoming mail. Sometimes the effect is caused by a badly set up name server and
21100 may persist for a long time. If a domain which exhibits this problem matches
21101 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
21102 This option should be used with care. You can make it apply to reverse lookups
21103 by a setting such as this:
21104 </para>
21105 <literallayout class="monospaced">
21106 dns_again_means_nonexist = *.in-addr.arpa
21107 </literallayout>
21108 <para>
21109 This option applies to all DNS lookups that Exim does. It also applies when the
21110 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
21111 since these are most likely to be caused by DNS lookup problems. The
21112 <command>dnslookup</command> router has some options of its own for controlling what happens
21113 when lookups for MX or SRV records give temporary errors. These more specific
21114 options are applied after this global option.
21115 </para>
21116 <para>
21117 <indexterm role="option">
21118 <primary>dns_check_names_pattern</primary>
21119 </indexterm>
21120 </para>
21121 <informaltable frame="all">
21122 <tgroup cols="4" colsep="0" rowsep="0">
21123 <colspec colwidth="8*" align="left"/>
21124 <colspec colwidth="5*" align="center"/>
21125 <colspec colwidth="5*" align="center"/>
21126 <colspec colwidth="6*" align="right"/>
21127 <tbody>
21128 <row>
21129 <entry><option>dns_check_names_pattern</option></entry>
21130 <entry>Use: <emphasis>main</emphasis></entry>
21131 <entry>Type: <emphasis>string</emphasis></entry>
21132 <entry>Default: <emphasis>see below</emphasis></entry>
21133 </row>
21134 </tbody>
21135 </tgroup>
21136 </informaltable>
21137 <para>
21138 <indexterm role="concept">
21139 <primary>DNS</primary>
21140 <secondary>pre-check of name syntax</secondary>
21141 </indexterm>
21142 When this option is set to a non-empty string, it causes Exim to check domain
21143 names for characters that are not allowed in host names before handing them to
21144 the DNS resolver, because some resolvers give temporary errors for names that
21145 contain unusual characters. If a domain name contains any unwanted characters,
21146 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
21147 done by matching the domain name against a regular expression, which is the
21148 value of this option. The default pattern is
21149 </para>
21150 <literallayout class="monospaced">
21151 dns_check_names_pattern = \
21152   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
21153 </literallayout>
21154 <para>
21155 which permits only letters, digits, slashes, and hyphens in components, but
21156 they must start and end with a letter or digit. Hyphens are not, in fact,
21157 permitted in host names, but they are found in certain NS records (which can be
21158 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
21159 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
21160 empty string.
21161 </para>
21162 <para>
21163 <indexterm role="option">
21164 <primary>dns_csa_search_limit</primary>
21165 </indexterm>
21166 </para>
21167 <informaltable frame="all">
21168 <tgroup cols="4" colsep="0" rowsep="0">
21169 <colspec colwidth="8*" align="left"/>
21170 <colspec colwidth="5*" align="center"/>
21171 <colspec colwidth="5*" align="center"/>
21172 <colspec colwidth="6*" align="right"/>
21173 <tbody>
21174 <row>
21175 <entry><option>dns_csa_search_limit</option></entry>
21176 <entry>Use: <emphasis>main</emphasis></entry>
21177 <entry>Type: <emphasis>integer</emphasis></entry>
21178 <entry>Default: <emphasis>5</emphasis></entry>
21179 </row>
21180 </tbody>
21181 </tgroup>
21182 </informaltable>
21183 <para>
21184 This option controls the depth of parental searching for CSA SRV records in the
21185 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
21186 </para>
21187 <para>
21188 <indexterm role="option">
21189 <primary>dns_csa_use_reverse</primary>
21190 </indexterm>
21191 </para>
21192 <informaltable frame="all">
21193 <tgroup cols="4" colsep="0" rowsep="0">
21194 <colspec colwidth="8*" align="left"/>
21195 <colspec colwidth="5*" align="center"/>
21196 <colspec colwidth="5*" align="center"/>
21197 <colspec colwidth="6*" align="right"/>
21198 <tbody>
21199 <row>
21200 <entry><option>dns_csa_use_reverse</option></entry>
21201 <entry>Use: <emphasis>main</emphasis></entry>
21202 <entry>Type: <emphasis>boolean</emphasis></entry>
21203 <entry>Default: <emphasis>true</emphasis></entry>
21204 </row>
21205 </tbody>
21206 </tgroup>
21207 </informaltable>
21208 <para>
21209 This option controls whether or not an IP address, given as a CSA domain, is
21210 reversed and looked up in the reverse DNS, as described in more detail in
21211 section <xref linkend="SECTverifyCSA"/>.
21212 </para>
21213 <para>
21214 <indexterm role="option">
21215 <primary>dns_ipv4_lookup</primary>
21216 </indexterm>
21217 </para>
21218 <informaltable frame="all">
21219 <tgroup cols="4" colsep="0" rowsep="0">
21220 <colspec colwidth="8*" align="left"/>
21221 <colspec colwidth="5*" align="center"/>
21222 <colspec colwidth="5*" align="center"/>
21223 <colspec colwidth="6*" align="right"/>
21224 <tbody>
21225 <row>
21226 <entry><option>dns_ipv4_lookup</option></entry>
21227 <entry>Use: <emphasis>main</emphasis></entry>
21228 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
21229 <entry>Default: <emphasis>unset</emphasis></entry>
21230 </row>
21231 </tbody>
21232 </tgroup>
21233 </informaltable>
21234 <para>
21235 <indexterm role="concept">
21236 <primary>IPv6</primary>
21237 <secondary>DNS lookup for AAAA records</secondary>
21238 </indexterm>
21239 <indexterm role="concept">
21240 <primary>DNS</primary>
21241 <secondary>IPv6 lookup for AAAA records</secondary>
21242 </indexterm>
21243 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
21244 looks for IPv6 address records (AAAA records) as well as IPv4 address records
21245 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
21246 domain matches this list.
21247 </para>
21248 <para>
21249 This is a fudge to help with name servers that give big delays or otherwise do
21250 not work for the AAAA record type. In due course, when the world&#x2019;s name
21251 servers have all been upgraded, there should be no need for this option.
21252 </para>
21253 <para>
21254 <indexterm role="option">
21255 <primary>dns_retrans</primary>
21256 </indexterm>
21257 </para>
21258 <informaltable frame="all">
21259 <tgroup cols="4" colsep="0" rowsep="0">
21260 <colspec colwidth="8*" align="left"/>
21261 <colspec colwidth="5*" align="center"/>
21262 <colspec colwidth="5*" align="center"/>
21263 <colspec colwidth="6*" align="right"/>
21264 <tbody>
21265 <row>
21266 <entry><option>dns_retrans</option></entry>
21267 <entry>Use: <emphasis>main</emphasis></entry>
21268 <entry>Type: <emphasis>time</emphasis></entry>
21269 <entry>Default: <emphasis>0s</emphasis></entry>
21270 </row>
21271 </tbody>
21272 </tgroup>
21273 </informaltable>
21274 <para>
21275 <indexterm role="concept">
21276 <primary>DNS</primary>
21277 <secondary>resolver options</secondary>
21278 </indexterm>
21279 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
21280 retransmission and retry parameters for DNS lookups. Values of zero (the
21281 defaults) leave the system default settings unchanged. The first value is the
21282 time between retries, and the second is the number of retries. It isn&#x2019;t
21283 totally clear exactly how these settings affect the total time a DNS lookup may
21284 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
21285 parameter values are available in the external resolver interface structure,
21286 but nowhere does it seem to describe how they are used or what you might want
21287 to set in them.
21288 </para>
21289 <para>
21290 <indexterm role="option">
21291 <primary>dns_retry</primary>
21292 </indexterm>
21293 </para>
21294 <informaltable frame="all">
21295 <tgroup cols="4" colsep="0" rowsep="0">
21296 <colspec colwidth="8*" align="left"/>
21297 <colspec colwidth="5*" align="center"/>
21298 <colspec colwidth="5*" align="center"/>
21299 <colspec colwidth="6*" align="right"/>
21300 <tbody>
21301 <row>
21302 <entry><option>dns_retry</option></entry>
21303 <entry>Use: <emphasis>main</emphasis></entry>
21304 <entry>Type: <emphasis>integer</emphasis></entry>
21305 <entry>Default: <emphasis>0</emphasis></entry>
21306 </row>
21307 </tbody>
21308 </tgroup>
21309 </informaltable>
21310 <para>
21311 See <option>dns_retrans</option> above.
21312 </para>
21313 <para>
21314 <indexterm role="option">
21315 <primary>drop_cr</primary>
21316 </indexterm>
21317 </para>
21318 <informaltable frame="all">
21319 <tgroup cols="4" colsep="0" rowsep="0">
21320 <colspec colwidth="8*" align="left"/>
21321 <colspec colwidth="5*" align="center"/>
21322 <colspec colwidth="5*" align="center"/>
21323 <colspec colwidth="6*" align="right"/>
21324 <tbody>
21325 <row>
21326 <entry><option>drop_cr</option></entry>
21327 <entry>Use: <emphasis>main</emphasis></entry>
21328 <entry>Type: <emphasis>boolean</emphasis></entry>
21329 <entry>Default: <emphasis>false</emphasis></entry>
21330 </row>
21331 </tbody>
21332 </tgroup>
21333 </informaltable>
21334 <para>
21335 This is an obsolete option that is now a no-op. It used to affect the way Exim
21336 handled CR and LF characters in incoming messages. What happens now is
21337 described in section <xref linkend="SECTlineendings"/>.
21338 </para>
21339 <para>
21340 <indexterm role="option">
21341 <primary>envelope_to_remove</primary>
21342 </indexterm>
21343 </para>
21344 <informaltable frame="all">
21345 <tgroup cols="4" colsep="0" rowsep="0">
21346 <colspec colwidth="8*" align="left"/>
21347 <colspec colwidth="5*" align="center"/>
21348 <colspec colwidth="5*" align="center"/>
21349 <colspec colwidth="6*" align="right"/>
21350 <tbody>
21351 <row>
21352 <entry><option>envelope_to_remove</option></entry>
21353 <entry>Use: <emphasis>main</emphasis></entry>
21354 <entry>Type: <emphasis>boolean</emphasis></entry>
21355 <entry>Default: <emphasis>true</emphasis></entry>
21356 </row>
21357 </tbody>
21358 </tgroup>
21359 </informaltable>
21360 <para>
21361 <indexterm role="concept">
21362 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
21363 </indexterm>
21364 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
21365 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
21366 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
21367 messages&#x2019;s envelope that caused the delivery to happen. Such headers should not
21368 be present in incoming messages, and this option causes them to be removed at
21369 the time the message is received, to avoid any problems that might occur when a
21370 delivered message is subsequently sent on to some other recipient.
21371 </para>
21372 <para>
21373 <indexterm role="option">
21374 <primary>errors_copy</primary>
21375 </indexterm>
21376 </para>
21377 <informaltable frame="all">
21378 <tgroup cols="4" colsep="0" rowsep="0">
21379 <colspec colwidth="8*" align="left"/>
21380 <colspec colwidth="5*" align="center"/>
21381 <colspec colwidth="5*" align="center"/>
21382 <colspec colwidth="6*" align="right"/>
21383 <tbody>
21384 <row>
21385 <entry><option>errors_copy</option></entry>
21386 <entry>Use: <emphasis>main</emphasis></entry>
21387 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
21388 <entry>Default: <emphasis>unset</emphasis></entry>
21389 </row>
21390 </tbody>
21391 </tgroup>
21392 </informaltable>
21393 <para>
21394 <indexterm role="concept">
21395 <primary>bounce message</primary>
21396 <secondary>copy to other address</secondary>
21397 </indexterm>
21398 <indexterm role="concept">
21399 <primary>copy of bounce message</primary>
21400 </indexterm>
21401 Setting this option causes Exim to send bcc copies of bounce messages that it
21402 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
21403 coming from elsewhere. The value of the option is a colon-separated list of
21404 items. Each item consists of a pattern, terminated by white space, followed by
21405 a comma-separated list of email addresses. If a pattern contains spaces, it
21406 must be enclosed in double quotes.
21407 </para>
21408 <para>
21409 Each pattern is processed in the same way as a single item in an address list
21410 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
21411 the bounce message, the message is copied to the addresses on the list. The
21412 items are scanned in order, and once a matching one is found, no further items
21413 are examined. For example:
21414 </para>
21415 <literallayout class="monospaced">
21416 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
21417               rqps@mydomain   hostmaster@mydomain.example,\
21418                               postmaster@mydomain.example
21419 </literallayout>
21420 <para>
21421 <indexterm role="concept">
21422 <primary><varname>$domain</varname></primary>
21423 </indexterm>
21424 <indexterm role="concept">
21425 <primary><varname>$local_part</varname></primary>
21426 </indexterm>
21427 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
21428 and <varname>$domain</varname> are set from the original recipient of the error message, and if
21429 there was any wildcard matching in the pattern, the expansion
21430 <indexterm role="concept">
21431 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21432 <secondary>in <option>errors_copy</option></secondary>
21433 </indexterm>
21434 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
21435 </para>
21436 <para>
21437 <indexterm role="option">
21438 <primary>errors_reply_to</primary>
21439 </indexterm>
21440 </para>
21441 <informaltable frame="all">
21442 <tgroup cols="4" colsep="0" rowsep="0">
21443 <colspec colwidth="8*" align="left"/>
21444 <colspec colwidth="5*" align="center"/>
21445 <colspec colwidth="5*" align="center"/>
21446 <colspec colwidth="6*" align="right"/>
21447 <tbody>
21448 <row>
21449 <entry><option>errors_reply_to</option></entry>
21450 <entry>Use: <emphasis>main</emphasis></entry>
21451 <entry>Type: <emphasis>string</emphasis></entry>
21452 <entry>Default: <emphasis>unset</emphasis></entry>
21453 </row>
21454 </tbody>
21455 </tgroup>
21456 </informaltable>
21457 <para>
21458 <indexterm role="concept">
21459 <primary>bounce message</primary>
21460 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
21461 </indexterm>
21462 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
21463 </para>
21464 <literallayout>
21465 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
21466 </literallayout>
21467 <para>
21468 <indexterm role="option">
21469 <primary><option>quota_warn_message</option></primary>
21470 </indexterm>
21471 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
21472 A warning message that is generated by the <option>quota_warn_message</option> option in an
21473 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
21474 overrides the default.
21475 </para>
21476 <para>
21477 Experience shows that people reply to bounce messages. If the
21478 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
21479 and warning messages. For example:
21480 </para>
21481 <literallayout class="monospaced">
21482 errors_reply_to = postmaster@my.domain.example
21483 </literallayout>
21484 <para>
21485 The value of the option is not expanded. It must specify a valid RFC 2822
21486 address. However, if a warning message that is generated by the
21487 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
21488 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
21489 not used.
21490 </para>
21491 <para>
21492 <indexterm role="option">
21493 <primary>exim_group</primary>
21494 </indexterm>
21495 </para>
21496 <informaltable frame="all">
21497 <tgroup cols="4" colsep="0" rowsep="0">
21498 <colspec colwidth="8*" align="left"/>
21499 <colspec colwidth="5*" align="center"/>
21500 <colspec colwidth="5*" align="center"/>
21501 <colspec colwidth="6*" align="right"/>
21502 <tbody>
21503 <row>
21504 <entry><option>exim_group</option></entry>
21505 <entry>Use: <emphasis>main</emphasis></entry>
21506 <entry>Type: <emphasis>string</emphasis></entry>
21507 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21508 </row>
21509 </tbody>
21510 </tgroup>
21511 </informaltable>
21512 <para>
21513 <indexterm role="concept">
21514 <primary>gid (group id)</primary>
21515 <secondary>Exim&#x2019;s own</secondary>
21516 </indexterm>
21517 <indexterm role="concept">
21518 <primary>Exim group</primary>
21519 </indexterm>
21520 This option changes the gid under which Exim runs when it gives up root
21521 privilege. The default value is compiled into the binary. The value of this
21522 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
21523 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
21524 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
21525 security issues.
21526 </para>
21527 <para>
21528 <indexterm role="option">
21529 <primary>exim_path</primary>
21530 </indexterm>
21531 </para>
21532 <informaltable frame="all">
21533 <tgroup cols="4" colsep="0" rowsep="0">
21534 <colspec colwidth="8*" align="left"/>
21535 <colspec colwidth="5*" align="center"/>
21536 <colspec colwidth="5*" align="center"/>
21537 <colspec colwidth="6*" align="right"/>
21538 <tbody>
21539 <row>
21540 <entry><option>exim_path</option></entry>
21541 <entry>Use: <emphasis>main</emphasis></entry>
21542 <entry>Type: <emphasis>string</emphasis></entry>
21543 <entry>Default: <emphasis>see below</emphasis></entry>
21544 </row>
21545 </tbody>
21546 </tgroup>
21547 </informaltable>
21548 <para>
21549 <indexterm role="concept">
21550 <primary>Exim binary</primary>
21551 <secondary>path name</secondary>
21552 </indexterm>
21553 This option specifies the path name of the Exim binary, which is used when Exim
21554 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
21555 the directory configured at compile time by the BIN_DIRECTORY setting. It
21556 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
21557 other place.
21558 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
21559 you will break those Exim utilities that scan the configuration file to find
21560 where the binary is. (They then use the <option>-bP</option> option to extract option
21561 settings such as the value of <option>spool_directory</option>.)
21562 </para>
21563 <para>
21564 <indexterm role="option">
21565 <primary>exim_user</primary>
21566 </indexterm>
21567 </para>
21568 <informaltable frame="all">
21569 <tgroup cols="4" colsep="0" rowsep="0">
21570 <colspec colwidth="8*" align="left"/>
21571 <colspec colwidth="5*" align="center"/>
21572 <colspec colwidth="5*" align="center"/>
21573 <colspec colwidth="6*" align="right"/>
21574 <tbody>
21575 <row>
21576 <entry><option>exim_user</option></entry>
21577 <entry>Use: <emphasis>main</emphasis></entry>
21578 <entry>Type: <emphasis>string</emphasis></entry>
21579 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
21580 </row>
21581 </tbody>
21582 </tgroup>
21583 </informaltable>
21584 <para>
21585 <indexterm role="concept">
21586 <primary>uid (user id)</primary>
21587 <secondary>Exim&#x2019;s own</secondary>
21588 </indexterm>
21589 <indexterm role="concept">
21590 <primary>Exim user</primary>
21591 </indexterm>
21592 This option changes the uid under which Exim runs when it gives up root
21593 privilege. The default value is compiled into the binary. Ownership of the run
21594 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
21595 options is checked against the values in the binary, not what is set here.
21596 </para>
21597 <para>
21598 Unless it consists entirely of digits, the string is looked up using
21599 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
21600 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
21601 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
21602 </para>
21603 <para>
21604 <indexterm role="option">
21605 <primary>extra_local_interfaces</primary>
21606 </indexterm>
21607 </para>
21608 <informaltable frame="all">
21609 <tgroup cols="4" colsep="0" rowsep="0">
21610 <colspec colwidth="8*" align="left"/>
21611 <colspec colwidth="5*" align="center"/>
21612 <colspec colwidth="5*" align="center"/>
21613 <colspec colwidth="6*" align="right"/>
21614 <tbody>
21615 <row>
21616 <entry><option>extra_local_interfaces</option></entry>
21617 <entry>Use: <emphasis>main</emphasis></entry>
21618 <entry>Type: <emphasis>string list</emphasis></entry>
21619 <entry>Default: <emphasis>unset</emphasis></entry>
21620 </row>
21621 </tbody>
21622 </tgroup>
21623 </informaltable>
21624 <para>
21625 This option defines network interfaces that are to be considered local when
21626 routing, but which are not used for listening by the daemon. See section
21627 <xref linkend="SECTreclocipadd"/> for details.
21628 </para>
21629 <para>
21630 <indexterm role="option">
21631 <primary>extract_addresses_remove_ &nbsp;arguments</primary>
21632 </indexterm>
21633 </para>
21634 <informaltable frame="all">
21635 <tgroup cols="4" colsep="0" rowsep="0">
21636 <colspec colwidth="8*" align="left"/>
21637 <colspec colwidth="5*" align="center"/>
21638 <colspec colwidth="5*" align="center"/>
21639 <colspec colwidth="6*" align="right"/>
21640 <tbody>
21641 <row>
21642 <entry><option>extract_addresses_remove_ &nbsp;arguments</option></entry>
21643 <entry>Use: <emphasis>main</emphasis></entry>
21644 <entry>Type: <emphasis>boolean</emphasis></entry>
21645 <entry>Default: <emphasis>true</emphasis></entry>
21646 </row>
21647 </tbody>
21648 </tgroup>
21649 </informaltable>
21650 <para>
21651 <indexterm role="concept">
21652 <primary><option>-t</option> option</primary>
21653 </indexterm>
21654 <indexterm role="concept">
21655 <primary>command line</primary>
21656 <secondary>addresses with <option>-t</option></secondary>
21657 </indexterm>
21658 <indexterm role="concept">
21659 <primary>Sendmail compatibility</primary>
21660 <secondary><option>-t</option> option</secondary>
21661 </indexterm>
21662 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
21663 are present on the command line when the <option>-t</option> option is used to build an
21664 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
21665 line addresses are removed from the recipients list. This is also how Smail
21666 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
21667 command line addresses are added to those obtained from the header lines. When
21668 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
21669 argument headers. If it is set false, Exim adds rather than removes argument
21670 addresses.
21671 </para>
21672 <para>
21673 <indexterm role="option">
21674 <primary>finduser_retries</primary>
21675 </indexterm>
21676 </para>
21677 <informaltable frame="all">
21678 <tgroup cols="4" colsep="0" rowsep="0">
21679 <colspec colwidth="8*" align="left"/>
21680 <colspec colwidth="5*" align="center"/>
21681 <colspec colwidth="5*" align="center"/>
21682 <colspec colwidth="6*" align="right"/>
21683 <tbody>
21684 <row>
21685 <entry><option>finduser_retries</option></entry>
21686 <entry>Use: <emphasis>main</emphasis></entry>
21687 <entry>Type: <emphasis>integer</emphasis></entry>
21688 <entry>Default: <emphasis>0</emphasis></entry>
21689 </row>
21690 </tbody>
21691 </tgroup>
21692 </informaltable>
21693 <para>
21694 <indexterm role="concept">
21695 <primary>NIS</primary>
21696 <secondary>looking up users; retrying</secondary>
21697 </indexterm>
21698 On systems running NIS or other schemes in which user and group information is
21699 distributed from a remote system, there can be times when <function>getpwnam()</function> and
21700 related functions fail, even when given valid data, because things time out.
21701 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
21702 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
21703 many extra times to find a user or a group, waiting for one second between
21704 retries.
21705 </para>
21706 <para>
21707 <indexterm role="concept">
21708 <primary><filename>/etc/passwd</filename></primary>
21709 <secondary>multiple reading of</secondary>
21710 </indexterm>
21711 You should not set this option greater than zero if your user information is in
21712 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
21713 search the file multiple times for non-existent users, and also cause delay.
21714 </para>
21715 <para>
21716 <indexterm role="option">
21717 <primary>freeze_tell</primary>
21718 </indexterm>
21719 </para>
21720 <informaltable frame="all">
21721 <tgroup cols="4" colsep="0" rowsep="0">
21722 <colspec colwidth="8*" align="left"/>
21723 <colspec colwidth="5*" align="center"/>
21724 <colspec colwidth="5*" align="center"/>
21725 <colspec colwidth="6*" align="right"/>
21726 <tbody>
21727 <row>
21728 <entry><option>freeze_tell</option></entry>
21729 <entry>Use: <emphasis>main</emphasis></entry>
21730 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
21731 <entry>Default: <emphasis>unset</emphasis></entry>
21732 </row>
21733 </tbody>
21734 </tgroup>
21735 </informaltable>
21736 <para>
21737 <indexterm role="concept">
21738 <primary>freezing messages</primary>
21739 <secondary>sending a message when freezing</secondary>
21740 </indexterm>
21741 On encountering certain errors, or when configured to do so in a system filter,
21742 ACL, or special router, Exim freezes a message. This means that no further
21743 delivery attempts take place until an administrator thaws the message, or the
21744 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
21745 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
21746 warning message whenever it freezes something, unless the message it is
21747 freezing is a locally-generated bounce message. (Without this exception there
21748 is the possibility of looping.) The warning message is sent to the addresses
21749 supplied as the comma-separated value of this option. If several of the
21750 message&#x2019;s addresses cause freezing, only a single message is sent. If the
21751 freezing was automatic, the reason(s) for freezing can be found in the message
21752 log. If you configure freezing in a filter or ACL, you must arrange for any
21753 logging that you require.
21754 </para>
21755 <para>
21756 <indexterm role="option">
21757 <primary>gecos_name</primary>
21758 </indexterm>
21759 </para>
21760 <informaltable frame="all">
21761 <tgroup cols="4" colsep="0" rowsep="0">
21762 <colspec colwidth="8*" align="left"/>
21763 <colspec colwidth="5*" align="center"/>
21764 <colspec colwidth="5*" align="center"/>
21765 <colspec colwidth="6*" align="right"/>
21766 <tbody>
21767 <row>
21768 <entry><option>gecos_name</option></entry>
21769 <entry>Use: <emphasis>main</emphasis></entry>
21770 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
21771 <entry>Default: <emphasis>unset</emphasis></entry>
21772 </row>
21773 </tbody>
21774 </tgroup>
21775 </informaltable>
21776 <para>
21777 <indexterm role="concept">
21778 <primary>HP-UX</primary>
21779 </indexterm>
21780 <indexterm role="concept">
21781 <primary><quote>gecos</quote> field</primary>
21782 <secondary>parsing</secondary>
21783 </indexterm>
21784 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
21785 password file to hold other information in addition to users&#x2019; real names. Exim
21786 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
21787 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
21788 of the field are used unchanged, except that, if an ampersand is encountered,
21789 it is replaced by the user&#x2019;s login name with the first character forced to
21790 upper case, since this is a convention that is observed on many systems.
21791 </para>
21792 <para>
21793 When these options are set, <option>gecos_pattern</option> is treated as a regular
21794 expression that is to be applied to the field (again with &amp; replaced by the
21795 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
21796 user&#x2019;s name.
21797 </para>
21798 <para>
21799 <indexterm role="concept">
21800 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
21801 <secondary>in <option>gecos_name</option></secondary>
21802 </indexterm>
21803 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
21804 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
21805 name terminates at the first comma, the following can be used:
21806 </para>
21807 <literallayout class="monospaced">
21808 gecos_pattern = ([^,]*)
21809 gecos_name = $1
21810 </literallayout>
21811 <para>
21812 <indexterm role="option">
21813 <primary>gecos_pattern</primary>
21814 </indexterm>
21815 </para>
21816 <informaltable frame="all">
21817 <tgroup cols="4" colsep="0" rowsep="0">
21818 <colspec colwidth="8*" align="left"/>
21819 <colspec colwidth="5*" align="center"/>
21820 <colspec colwidth="5*" align="center"/>
21821 <colspec colwidth="6*" align="right"/>
21822 <tbody>
21823 <row>
21824 <entry><option>gecos_pattern</option></entry>
21825 <entry>Use: <emphasis>main</emphasis></entry>
21826 <entry>Type: <emphasis>string</emphasis></entry>
21827 <entry>Default: <emphasis>unset</emphasis></entry>
21828 </row>
21829 </tbody>
21830 </tgroup>
21831 </informaltable>
21832 <para>
21833 See <option>gecos_name</option> above.
21834 </para>
21835 <para>
21836 <indexterm role="option">
21837 <primary>headers_charset</primary>
21838 </indexterm>
21839 </para>
21840 <informaltable frame="all">
21841 <tgroup cols="4" colsep="0" rowsep="0">
21842 <colspec colwidth="8*" align="left"/>
21843 <colspec colwidth="5*" align="center"/>
21844 <colspec colwidth="5*" align="center"/>
21845 <colspec colwidth="6*" align="right"/>
21846 <tbody>
21847 <row>
21848 <entry><option>headers_charset</option></entry>
21849 <entry>Use: <emphasis>main</emphasis></entry>
21850 <entry>Type: <emphasis>string</emphasis></entry>
21851 <entry>Default: <emphasis>see below</emphasis></entry>
21852 </row>
21853 </tbody>
21854 </tgroup>
21855 </informaltable>
21856 <para>
21857 This option sets a default character set for translating from encoded MIME
21858 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
21859 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
21860 ultimate default is ISO-8859-1. For more details see the description of header
21861 insertions in section <xref linkend="SECTexpansionitems"/>.
21862 </para>
21863 <para>
21864 <indexterm role="option">
21865 <primary>header_maxsize</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>header_maxsize</option></entry>
21877 <entry>Use: <emphasis>main</emphasis></entry>
21878 <entry>Type: <emphasis>integer</emphasis></entry>
21879 <entry>Default: <emphasis>see below</emphasis></entry>
21880 </row>
21881 </tbody>
21882 </tgroup>
21883 </informaltable>
21884 <para>
21885 <indexterm role="concept">
21886 <primary>header section</primary>
21887 <secondary>maximum size of</secondary>
21888 </indexterm>
21889 <indexterm role="concept">
21890 <primary>limit</primary>
21891 <secondary>size of message header section</secondary>
21892 </indexterm>
21893 This option controls the overall maximum size of a message&#x2019;s header
21894 section. The default is the value of HEADER_MAXSIZE in
21895 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
21896 sections are rejected.
21897 </para>
21898 <para>
21899 <indexterm role="option">
21900 <primary>header_line_maxsize</primary>
21901 </indexterm>
21902 </para>
21903 <informaltable frame="all">
21904 <tgroup cols="4" colsep="0" rowsep="0">
21905 <colspec colwidth="8*" align="left"/>
21906 <colspec colwidth="5*" align="center"/>
21907 <colspec colwidth="5*" align="center"/>
21908 <colspec colwidth="6*" align="right"/>
21909 <tbody>
21910 <row>
21911 <entry><option>header_line_maxsize</option></entry>
21912 <entry>Use: <emphasis>main</emphasis></entry>
21913 <entry>Type: <emphasis>integer</emphasis></entry>
21914 <entry>Default: <emphasis>0</emphasis></entry>
21915 </row>
21916 </tbody>
21917 </tgroup>
21918 </informaltable>
21919 <para>
21920 <indexterm role="concept">
21921 <primary>header lines</primary>
21922 <secondary>maximum size of</secondary>
21923 </indexterm>
21924 <indexterm role="concept">
21925 <primary>limit</primary>
21926 <secondary>size of one header line</secondary>
21927 </indexterm>
21928 This option limits the length of any individual header line in a message, after
21929 all the continuations have been joined together. Messages with individual
21930 header lines that are longer than the limit are rejected. The default value of
21931 zero means <quote>no limit</quote>.
21932 </para>
21933 <para>
21934 <indexterm role="option">
21935 <primary>helo_accept_junk_hosts</primary>
21936 </indexterm>
21937 </para>
21938 <informaltable frame="all">
21939 <tgroup cols="4" colsep="0" rowsep="0">
21940 <colspec colwidth="8*" align="left"/>
21941 <colspec colwidth="5*" align="center"/>
21942 <colspec colwidth="5*" align="center"/>
21943 <colspec colwidth="6*" align="right"/>
21944 <tbody>
21945 <row>
21946 <entry><option>helo_accept_junk_hosts</option></entry>
21947 <entry>Use: <emphasis>main</emphasis></entry>
21948 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
21949 <entry>Default: <emphasis>unset</emphasis></entry>
21950 </row>
21951 </tbody>
21952 </tgroup>
21953 </informaltable>
21954 <para>
21955 <indexterm role="concept">
21956 <primary>HELO</primary>
21957 <secondary>accepting junk data</secondary>
21958 </indexterm>
21959 <indexterm role="concept">
21960 <primary>EHLO</primary>
21961 <secondary>accepting junk data</secondary>
21962 </indexterm>
21963 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
21964 mail, and gives an error response for invalid data. Unfortunately, there are
21965 some SMTP clients that send syntactic junk. They can be accommodated by setting
21966 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
21967 if you want to do semantic checking.
21968 See also <option>helo_allow_chars</option> for a way of extending the permitted character
21969 set.
21970 </para>
21971 <para>
21972 <indexterm role="option">
21973 <primary>helo_allow_chars</primary>
21974 </indexterm>
21975 </para>
21976 <informaltable frame="all">
21977 <tgroup cols="4" colsep="0" rowsep="0">
21978 <colspec colwidth="8*" align="left"/>
21979 <colspec colwidth="5*" align="center"/>
21980 <colspec colwidth="5*" align="center"/>
21981 <colspec colwidth="6*" align="right"/>
21982 <tbody>
21983 <row>
21984 <entry><option>helo_allow_chars</option></entry>
21985 <entry>Use: <emphasis>main</emphasis></entry>
21986 <entry>Type: <emphasis>string</emphasis></entry>
21987 <entry>Default: <emphasis>unset</emphasis></entry>
21988 </row>
21989 </tbody>
21990 </tgroup>
21991 </informaltable>
21992 <para>
21993 <indexterm role="concept">
21994 <primary>HELO</primary>
21995 <secondary>underscores in</secondary>
21996 </indexterm>
21997 <indexterm role="concept">
21998 <primary>EHLO</primary>
21999 <secondary>underscores in</secondary>
22000 </indexterm>
22001 <indexterm role="concept">
22002 <primary>underscore in EHLO/HELO</primary>
22003 </indexterm>
22004 This option can be set to a string of rogue characters that are permitted in
22005 all EHLO and HELO names in addition to the standard letters, digits,
22006 hyphens, and dots. If you really must allow underscores, you can set
22007 </para>
22008 <literallayout class="monospaced">
22009 helo_allow_chars = _
22010 </literallayout>
22011 <para>
22012 Note that the value is one string, not a list.
22013 </para>
22014 <para>
22015 <indexterm role="option">
22016 <primary>helo_lookup_domains</primary>
22017 </indexterm>
22018 </para>
22019 <informaltable frame="all">
22020 <tgroup cols="4" colsep="0" rowsep="0">
22021 <colspec colwidth="8*" align="left"/>
22022 <colspec colwidth="5*" align="center"/>
22023 <colspec colwidth="5*" align="center"/>
22024 <colspec colwidth="6*" align="right"/>
22025 <tbody>
22026 <row>
22027 <entry><option>helo_lookup_domains</option></entry>
22028 <entry>Use: <emphasis>main</emphasis></entry>
22029 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22030 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
22031 </row>
22032 </tbody>
22033 </tgroup>
22034 </informaltable>
22035 <para>
22036 <indexterm role="concept">
22037 <primary>HELO</primary>
22038 <secondary>forcing reverse lookup</secondary>
22039 </indexterm>
22040 <indexterm role="concept">
22041 <primary>EHLO</primary>
22042 <secondary>forcing reverse lookup</secondary>
22043 </indexterm>
22044 If the domain given by a client in a HELO or EHLO command matches this
22045 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
22046 default forces a lookup if the client host gives the server&#x2019;s name or any of
22047 its IP addresses (in brackets), something that broken clients have been seen to
22048 do.
22049 </para>
22050 <para>
22051 <indexterm role="option">
22052 <primary>helo_try_verify_hosts</primary>
22053 </indexterm>
22054 </para>
22055 <informaltable frame="all">
22056 <tgroup cols="4" colsep="0" rowsep="0">
22057 <colspec colwidth="8*" align="left"/>
22058 <colspec colwidth="5*" align="center"/>
22059 <colspec colwidth="5*" align="center"/>
22060 <colspec colwidth="6*" align="right"/>
22061 <tbody>
22062 <row>
22063 <entry><option>helo_try_verify_hosts</option></entry>
22064 <entry>Use: <emphasis>main</emphasis></entry>
22065 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22066 <entry>Default: <emphasis>unset</emphasis></entry>
22067 </row>
22068 </tbody>
22069 </tgroup>
22070 </informaltable>
22071 <para>
22072 <indexterm role="concept">
22073 <primary>HELO verifying</primary>
22074 <secondary>optional</secondary>
22075 </indexterm>
22076 <indexterm role="concept">
22077 <primary>EHLO verifying</primary>
22078 <secondary>optional</secondary>
22079 </indexterm>
22080 By default, Exim just checks the syntax of HELO and EHLO commands (see
22081 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
22082 to do more extensive checking of the data supplied by these commands. The ACL
22083 condition <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is provided to make this possible.
22084 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
22085 to force the check to occur. From release 4.53 onwards, this is no longer
22086 necessary. If the check has not been done before <literal>verify</literal> <literal>=</literal> <literal>helo</literal> is
22087 encountered, it is done at that time. Consequently, this option is obsolete.
22088 Its specification is retained here for backwards compatibility.
22089 </para>
22090 <para>
22091 When an EHLO or HELO command is received, if the calling host matches
22092 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
22093 EHLO command either:
22094 </para>
22095 <itemizedlist>
22096 <listitem>
22097 <para>
22098 is an IP literal matching the calling address of the host, or
22099 </para>
22100 </listitem>
22101 <listitem>
22102 <para>
22103 <indexterm role="concept">
22104 <primary>DNS</primary>
22105 <secondary>reverse lookup</secondary>
22106 </indexterm>
22107 <indexterm role="concept">
22108 <primary>reverse DNS lookup</primary>
22109 </indexterm>
22110 matches the host name that Exim obtains by doing a reverse lookup of the
22111 calling host address, or
22112 </para>
22113 </listitem>
22114 <listitem>
22115 <para>
22116 when looked up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when
22117 available) yields the calling host address.
22118 </para>
22119 </listitem>
22120 </itemizedlist>
22121 <para>
22122 However, the EHLO or HELO command is not rejected if any of the checks
22123 fail. Processing continues, but the result of the check is remembered, and can
22124 be detected later in an ACL by the <literal>verify</literal> <literal>=</literal> <literal>helo</literal> condition.
22125 </para>
22126 <para>
22127 <indexterm role="option">
22128 <primary>helo_verify_hosts</primary>
22129 </indexterm>
22130 </para>
22131 <informaltable frame="all">
22132 <tgroup cols="4" colsep="0" rowsep="0">
22133 <colspec colwidth="8*" align="left"/>
22134 <colspec colwidth="5*" align="center"/>
22135 <colspec colwidth="5*" align="center"/>
22136 <colspec colwidth="6*" align="right"/>
22137 <tbody>
22138 <row>
22139 <entry><option>helo_verify_hosts</option></entry>
22140 <entry>Use: <emphasis>main</emphasis></entry>
22141 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22142 <entry>Default: <emphasis>unset</emphasis></entry>
22143 </row>
22144 </tbody>
22145 </tgroup>
22146 </informaltable>
22147 <para>
22148 <indexterm role="concept">
22149 <primary>HELO verifying</primary>
22150 <secondary>mandatory</secondary>
22151 </indexterm>
22152 <indexterm role="concept">
22153 <primary>EHLO verifying</primary>
22154 <secondary>mandatory</secondary>
22155 </indexterm>
22156 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
22157 backwards compatibility. For hosts that match this option, Exim checks the host
22158 name given in the HELO or EHLO in the same way as for
22159 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
22160 rejected with a 550 error, and entries are written to the main and reject logs.
22161 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
22162 error.
22163 </para>
22164 <para>
22165 <indexterm role="option">
22166 <primary>hold_domains</primary>
22167 </indexterm>
22168 </para>
22169 <informaltable frame="all">
22170 <tgroup cols="4" colsep="0" rowsep="0">
22171 <colspec colwidth="8*" align="left"/>
22172 <colspec colwidth="5*" align="center"/>
22173 <colspec colwidth="5*" align="center"/>
22174 <colspec colwidth="6*" align="right"/>
22175 <tbody>
22176 <row>
22177 <entry><option>hold_domains</option></entry>
22178 <entry>Use: <emphasis>main</emphasis></entry>
22179 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22180 <entry>Default: <emphasis>unset</emphasis></entry>
22181 </row>
22182 </tbody>
22183 </tgroup>
22184 </informaltable>
22185 <para>
22186 <indexterm role="concept">
22187 <primary>domain</primary>
22188 <secondary>delaying delivery</secondary>
22189 </indexterm>
22190 <indexterm role="concept">
22191 <primary>delivery</primary>
22192 <secondary>delaying certain domains</secondary>
22193 </indexterm>
22194 This option allows mail for particular domains to be held on the queue
22195 manually. The option is overridden if a message delivery is forced with the
22196 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
22197 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
22198 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
22199 it is deferred every time the message is looked at.
22200 </para>
22201 <para>
22202 This option is intended as a temporary operational measure for delaying the
22203 delivery of mail while some problem is being sorted out, or some new
22204 configuration tested. If you just want to delay the processing of some
22205 domains until a queue run occurs, you should use <option>queue_domains</option> or
22206 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
22207 </para>
22208 <para>
22209 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
22210 messages from the queue if they have been there longer than the longest retry
22211 time in any retry rule. If you want to hold messages for longer than the normal
22212 retry times, insert a dummy retry rule with a long retry time.
22213 </para>
22214 <para>
22215 <indexterm role="option">
22216 <primary>host_lookup</primary>
22217 </indexterm>
22218 </para>
22219 <informaltable frame="all">
22220 <tgroup cols="4" colsep="0" rowsep="0">
22221 <colspec colwidth="8*" align="left"/>
22222 <colspec colwidth="5*" align="center"/>
22223 <colspec colwidth="5*" align="center"/>
22224 <colspec colwidth="6*" align="right"/>
22225 <tbody>
22226 <row>
22227 <entry><option>host_lookup</option></entry>
22228 <entry>Use: <emphasis>main</emphasis></entry>
22229 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22230 <entry>Default: <emphasis>unset</emphasis></entry>
22231 </row>
22232 </tbody>
22233 </tgroup>
22234 </informaltable>
22235 <para>
22236 <indexterm role="concept">
22237 <primary>host name lookup</primary>
22238 <secondary>forcing</secondary>
22239 </indexterm>
22240 Exim does not look up the name of a calling host from its IP address unless it
22241 is required to compare against some host list, or the host matches
22242 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
22243 option (which normally contains IP addresses rather than host names). The
22244 default configuration file contains
22245 </para>
22246 <literallayout class="monospaced">
22247 host_lookup = *
22248 </literallayout>
22249 <para>
22250 which causes a lookup to happen for all hosts. If the expense of these lookups
22251 is felt to be too great, the setting can be changed or removed.
22252 </para>
22253 <para>
22254 After a successful reverse lookup, Exim does a forward lookup on the name it
22255 has obtained, to verify that it yields the IP address that it started with. If
22256 this check fails, Exim behaves as if the name lookup failed.
22257 </para>
22258 <para>
22259 <indexterm role="concept">
22260 <primary><varname>$host_lookup_failed</varname></primary>
22261 </indexterm>
22262 <indexterm role="concept">
22263 <primary><varname>$sender_host_name</varname></primary>
22264 </indexterm>
22265 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
22266 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
22267 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and <literal>verify</literal> <literal>=</literal>
22268 <literal>reverse_host_lookup</literal> in ACLs.
22269 </para>
22270 <para>
22271 <indexterm role="option">
22272 <primary>host_lookup_order</primary>
22273 </indexterm>
22274 </para>
22275 <informaltable frame="all">
22276 <tgroup cols="4" colsep="0" rowsep="0">
22277 <colspec colwidth="8*" align="left"/>
22278 <colspec colwidth="5*" align="center"/>
22279 <colspec colwidth="5*" align="center"/>
22280 <colspec colwidth="6*" align="right"/>
22281 <tbody>
22282 <row>
22283 <entry><option>host_lookup_order</option></entry>
22284 <entry>Use: <emphasis>main</emphasis></entry>
22285 <entry>Type: <emphasis>string list</emphasis></entry>
22286 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
22287 </row>
22288 </tbody>
22289 </tgroup>
22290 </informaltable>
22291 <para>
22292 This option specifies the order of different lookup methods when Exim is trying
22293 to find a host name from an IP address. The default is to do a DNS lookup
22294 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
22295 if that fails. You can change the order of these lookups, or omit one entirely,
22296 if you want.
22297 </para>
22298 <para>
22299 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
22300 multiple PTR records in the DNS and the IP address is not listed in
22301 <filename>/etc/hosts</filename>. Different operating systems give different results in this
22302 case. That is why the default tries a DNS lookup first.
22303 </para>
22304 <para>
22305 <indexterm role="option">
22306 <primary>host_reject_connection</primary>
22307 </indexterm>
22308 </para>
22309 <informaltable frame="all">
22310 <tgroup cols="4" colsep="0" rowsep="0">
22311 <colspec colwidth="8*" align="left"/>
22312 <colspec colwidth="5*" align="center"/>
22313 <colspec colwidth="5*" align="center"/>
22314 <colspec colwidth="6*" align="right"/>
22315 <tbody>
22316 <row>
22317 <entry><option>host_reject_connection</option></entry>
22318 <entry>Use: <emphasis>main</emphasis></entry>
22319 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22320 <entry>Default: <emphasis>unset</emphasis></entry>
22321 </row>
22322 </tbody>
22323 </tgroup>
22324 </informaltable>
22325 <para>
22326 <indexterm role="concept">
22327 <primary>host</primary>
22328 <secondary>rejecting connections from</secondary>
22329 </indexterm>
22330 If this option is set, incoming SMTP calls from the hosts listed are rejected
22331 as soon as the connection is made.
22332 This option is obsolete, and retained only for backward compatibility, because
22333 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
22334 connections immediately.
22335 </para>
22336 <para>
22337 The ability to give an immediate rejection (either by this option or using an
22338 ACL) is provided for use in unusual cases. Many hosts will just try again,
22339 sometimes without much delay. Normally, it is better to use an ACL to reject
22340 incoming messages at a later stage, such as after RCPT commands. See
22341 chapter <xref linkend="CHAPACL"/>.
22342 </para>
22343 <para>
22344 <indexterm role="option">
22345 <primary>hosts_connection_nolog</primary>
22346 </indexterm>
22347 </para>
22348 <informaltable frame="all">
22349 <tgroup cols="4" colsep="0" rowsep="0">
22350 <colspec colwidth="8*" align="left"/>
22351 <colspec colwidth="5*" align="center"/>
22352 <colspec colwidth="5*" align="center"/>
22353 <colspec colwidth="6*" align="right"/>
22354 <tbody>
22355 <row>
22356 <entry><option>hosts_connection_nolog</option></entry>
22357 <entry>Use: <emphasis>main</emphasis></entry>
22358 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22359 <entry>Default: <emphasis>unset</emphasis></entry>
22360 </row>
22361 </tbody>
22362 </tgroup>
22363 </informaltable>
22364 <para>
22365 <indexterm role="concept">
22366 <primary>host</primary>
22367 <secondary>not logging connections from</secondary>
22368 </indexterm>
22369 This option defines a list of hosts for which connection logging does not
22370 happen, even though the <option>smtp_connection</option> log selector is set. For example,
22371 you might want not to log SMTP connections from local processes, or from
22372 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
22373 the daemon; you should therefore strive to restrict its value to a short inline
22374 list of IP addresses and networks. To disable logging SMTP connections from
22375 local processes, you must create a host list with an empty item. For example:
22376 </para>
22377 <literallayout class="monospaced">
22378 hosts_connection_nolog = :
22379 </literallayout>
22380 <para>
22381 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
22382 </para>
22383 <para>
22384 <indexterm role="option">
22385 <primary>hosts_treat_as_local</primary>
22386 </indexterm>
22387 </para>
22388 <informaltable frame="all">
22389 <tgroup cols="4" colsep="0" rowsep="0">
22390 <colspec colwidth="8*" align="left"/>
22391 <colspec colwidth="5*" align="center"/>
22392 <colspec colwidth="5*" align="center"/>
22393 <colspec colwidth="6*" align="right"/>
22394 <tbody>
22395 <row>
22396 <entry><option>hosts_treat_as_local</option></entry>
22397 <entry>Use: <emphasis>main</emphasis></entry>
22398 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
22399 <entry>Default: <emphasis>unset</emphasis></entry>
22400 </row>
22401 </tbody>
22402 </tgroup>
22403 </informaltable>
22404 <para>
22405 <indexterm role="concept">
22406 <primary>local host</primary>
22407 <secondary>domains treated as</secondary>
22408 </indexterm>
22409 <indexterm role="concept">
22410 <primary>host</primary>
22411 <secondary>treated as local</secondary>
22412 </indexterm>
22413 If this option is set, any host names that match the domain list are treated as
22414 if they were the local host when Exim is scanning host lists obtained from MX
22415 records
22416 or other sources. Note that the value of this option is a domain list, not a
22417 host list, because it is always used to check host names, not IP addresses.
22418 </para>
22419 <para>
22420 This option also applies when Exim is matching the special items
22421 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
22422 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
22423 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
22424 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
22425 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
22426 interfaces and recognising the local host.
22427 </para>
22428 <para>
22429 <indexterm role="option">
22430 <primary>ignore_bounce_errors_after</primary>
22431 </indexterm>
22432 </para>
22433 <informaltable frame="all">
22434 <tgroup cols="4" colsep="0" rowsep="0">
22435 <colspec colwidth="8*" align="left"/>
22436 <colspec colwidth="5*" align="center"/>
22437 <colspec colwidth="5*" align="center"/>
22438 <colspec colwidth="6*" align="right"/>
22439 <tbody>
22440 <row>
22441 <entry><option>ignore_bounce_errors_after</option></entry>
22442 <entry>Use: <emphasis>main</emphasis></entry>
22443 <entry>Type: <emphasis>time</emphasis></entry>
22444 <entry>Default: <emphasis>10w</emphasis></entry>
22445 </row>
22446 </tbody>
22447 </tgroup>
22448 </informaltable>
22449 <para>
22450 <indexterm role="concept">
22451 <primary>bounce message</primary>
22452 <secondary>discarding</secondary>
22453 </indexterm>
22454 <indexterm role="concept">
22455 <primary>discarding bounce message</primary>
22456 </indexterm>
22457 This option affects the processing of bounce messages that cannot be delivered,
22458 that is, those that suffer a permanent delivery failure. (Bounce messages that
22459 suffer temporary delivery failures are of course retried in the usual way.)
22460 </para>
22461 <para>
22462 After a permanent delivery failure, bounce messages are frozen,
22463 because there is no sender to whom they can be returned. When a frozen bounce
22464 message has been on the queue for more than the given time, it is unfrozen at
22465 the next queue run, and a further delivery is attempted. If delivery fails
22466 again, the bounce message is discarded. This makes it possible to keep failed
22467 bounce messages around for a shorter time than the normal maximum retry time
22468 for frozen messages. For example,
22469 </para>
22470 <literallayout class="monospaced">
22471 ignore_bounce_errors_after = 12h
22472 </literallayout>
22473 <para>
22474 retries failed bounce message deliveries after 12 hours, discarding any further
22475 failures. If the value of this option is set to a zero time period, bounce
22476 failures are discarded immediately. Setting a very long time (as in the default
22477 value) has the effect of disabling this option. For ways of automatically
22478 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
22479 <option>timeout_frozen_after</option>.
22480 </para>
22481 <para>
22482 <indexterm role="option">
22483 <primary>ignore_fromline_hosts</primary>
22484 </indexterm>
22485 </para>
22486 <informaltable frame="all">
22487 <tgroup cols="4" colsep="0" rowsep="0">
22488 <colspec colwidth="8*" align="left"/>
22489 <colspec colwidth="5*" align="center"/>
22490 <colspec colwidth="5*" align="center"/>
22491 <colspec colwidth="6*" align="right"/>
22492 <tbody>
22493 <row>
22494 <entry><option>ignore_fromline_hosts</option></entry>
22495 <entry>Use: <emphasis>main</emphasis></entry>
22496 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
22497 <entry>Default: <emphasis>unset</emphasis></entry>
22498 </row>
22499 </tbody>
22500 </tgroup>
22501 </informaltable>
22502 <para>
22503 <indexterm role="concept">
22504 <primary><quote>From</quote> line</primary>
22505 </indexterm>
22506 <indexterm role="concept">
22507 <primary>UUCP</primary>
22508 <secondary><quote>From</quote> line</secondary>
22509 </indexterm>
22510 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
22511 the headers of a message. By default this is treated as the start of the
22512 message&#x2019;s body, which means that any following headers are not recognized as
22513 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
22514 match those hosts that insist on sending it. If the sender is actually a local
22515 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
22516 <option>ignore_fromline_local</option> must be set to achieve this effect.
22517 </para>
22518 <para>
22519 <indexterm role="option">
22520 <primary>ignore_fromline_local</primary>
22521 </indexterm>
22522 </para>
22523 <informaltable frame="all">
22524 <tgroup cols="4" colsep="0" rowsep="0">
22525 <colspec colwidth="8*" align="left"/>
22526 <colspec colwidth="5*" align="center"/>
22527 <colspec colwidth="5*" align="center"/>
22528 <colspec colwidth="6*" align="right"/>
22529 <tbody>
22530 <row>
22531 <entry><option>ignore_fromline_local</option></entry>
22532 <entry>Use: <emphasis>main</emphasis></entry>
22533 <entry>Type: <emphasis>boolean</emphasis></entry>
22534 <entry>Default: <emphasis>false</emphasis></entry>
22535 </row>
22536 </tbody>
22537 </tgroup>
22538 </informaltable>
22539 <para>
22540 See <option>ignore_fromline_hosts</option> above.
22541 </para>
22542 <para>
22543 <indexterm role="option">
22544 <primary>keep_malformed</primary>
22545 </indexterm>
22546 </para>
22547 <informaltable frame="all">
22548 <tgroup cols="4" colsep="0" rowsep="0">
22549 <colspec colwidth="8*" align="left"/>
22550 <colspec colwidth="5*" align="center"/>
22551 <colspec colwidth="5*" align="center"/>
22552 <colspec colwidth="6*" align="right"/>
22553 <tbody>
22554 <row>
22555 <entry><option>keep_malformed</option></entry>
22556 <entry>Use: <emphasis>main</emphasis></entry>
22557 <entry>Type: <emphasis>time</emphasis></entry>
22558 <entry>Default: <emphasis>4d</emphasis></entry>
22559 </row>
22560 </tbody>
22561 </tgroup>
22562 </informaltable>
22563 <para>
22564 This option specifies the length of time to keep messages whose spool files
22565 have been corrupted in some way. This should, of course, never happen. At the
22566 next attempt to deliver such a message, it gets removed. The incident is
22567 logged.
22568 </para>
22569 <para>
22570 <indexterm role="option">
22571 <primary>ldap_default_servers</primary>
22572 </indexterm>
22573 </para>
22574 <informaltable frame="all">
22575 <tgroup cols="4" colsep="0" rowsep="0">
22576 <colspec colwidth="8*" align="left"/>
22577 <colspec colwidth="5*" align="center"/>
22578 <colspec colwidth="5*" align="center"/>
22579 <colspec colwidth="6*" align="right"/>
22580 <tbody>
22581 <row>
22582 <entry><option>ldap_default_servers</option></entry>
22583 <entry>Use: <emphasis>main</emphasis></entry>
22584 <entry>Type: <emphasis>string list</emphasis></entry>
22585 <entry>Default: <emphasis>unset</emphasis></entry>
22586 </row>
22587 </tbody>
22588 </tgroup>
22589 </informaltable>
22590 <para>
22591 <indexterm role="concept">
22592 <primary>LDAP</primary>
22593 <secondary>default servers</secondary>
22594 </indexterm>
22595 This option provides a list of LDAP servers which are tried in turn when an
22596 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
22597 details of LDAP queries. This option is available only when Exim has been built
22598 with LDAP support.
22599 </para>
22600 <para>
22601 <indexterm role="option">
22602 <primary>ldap_version</primary>
22603 </indexterm>
22604 </para>
22605 <informaltable frame="all">
22606 <tgroup cols="4" colsep="0" rowsep="0">
22607 <colspec colwidth="8*" align="left"/>
22608 <colspec colwidth="5*" align="center"/>
22609 <colspec colwidth="5*" align="center"/>
22610 <colspec colwidth="6*" align="right"/>
22611 <tbody>
22612 <row>
22613 <entry><option>ldap_version</option></entry>
22614 <entry>Use: <emphasis>main</emphasis></entry>
22615 <entry>Type: <emphasis>integer</emphasis></entry>
22616 <entry>Default: <emphasis>unset</emphasis></entry>
22617 </row>
22618 </tbody>
22619 </tgroup>
22620 </informaltable>
22621 <para>
22622 <indexterm role="concept">
22623 <primary>LDAP protocol version</primary>
22624 <secondary>forcing</secondary>
22625 </indexterm>
22626 This option can be used to force Exim to set a specific protocol version for
22627 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
22628 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
22629 the LDAP headers; otherwise it is 2. This option is available only when Exim
22630 has been built with LDAP support.
22631 </para>
22632 <para>
22633 <indexterm role="option">
22634 <primary>local_from_check</primary>
22635 </indexterm>
22636 </para>
22637 <informaltable frame="all">
22638 <tgroup cols="4" colsep="0" rowsep="0">
22639 <colspec colwidth="8*" align="left"/>
22640 <colspec colwidth="5*" align="center"/>
22641 <colspec colwidth="5*" align="center"/>
22642 <colspec colwidth="6*" align="right"/>
22643 <tbody>
22644 <row>
22645 <entry><option>local_from_check</option></entry>
22646 <entry>Use: <emphasis>main</emphasis></entry>
22647 <entry>Type: <emphasis>boolean</emphasis></entry>
22648 <entry>Default: <emphasis>true</emphasis></entry>
22649 </row>
22650 </tbody>
22651 </tgroup>
22652 </informaltable>
22653 <para>
22654 <indexterm role="concept">
22655 <primary><emphasis>Sender:</emphasis> header line</primary>
22656 <secondary>disabling addition of</secondary>
22657 </indexterm>
22658 <indexterm role="concept">
22659 <primary><emphasis>From:</emphasis> header line</primary>
22660 <secondary>disabling checking of</secondary>
22661 </indexterm>
22662 When a message is submitted locally (that is, not over a TCP/IP connection) by
22663 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
22664 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
22665 the domain specified by <option>qualify_domain</option>.
22666 </para>
22667 <para>
22668 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
22669 locally submitted message is automatically qualified by Exim, unless the
22670 <option>-bnq</option> command line option is used.
22671 </para>
22672 <para>
22673 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
22674 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
22675 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
22676 and the default qualify domain.
22677 </para>
22678 <para>
22679 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
22680 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
22681 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
22682 <option>local_sender_retain</option> to be true.
22683 </para>
22684 <para>
22685 <indexterm role="concept">
22686 <primary>envelope sender</primary>
22687 </indexterm>
22688 These options affect only the header lines in the message. The envelope sender
22689 is still forced to be the login id at the qualify domain unless
22690 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
22691 </para>
22692 <para>
22693 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
22694 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
22695 has more details about <emphasis>Sender:</emphasis> processing.
22696 </para>
22697 <para>
22698 <indexterm role="option">
22699 <primary>local_from_prefix</primary>
22700 </indexterm>
22701 </para>
22702 <informaltable frame="all">
22703 <tgroup cols="4" colsep="0" rowsep="0">
22704 <colspec colwidth="8*" align="left"/>
22705 <colspec colwidth="5*" align="center"/>
22706 <colspec colwidth="5*" align="center"/>
22707 <colspec colwidth="6*" align="right"/>
22708 <tbody>
22709 <row>
22710 <entry><option>local_from_prefix</option></entry>
22711 <entry>Use: <emphasis>main</emphasis></entry>
22712 <entry>Type: <emphasis>string</emphasis></entry>
22713 <entry>Default: <emphasis>unset</emphasis></entry>
22714 </row>
22715 </tbody>
22716 </tgroup>
22717 </informaltable>
22718 <para>
22719 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
22720 matching the login id (see <option>local_from_check</option> above), it can be configured to
22721 ignore certain prefixes and suffixes in the local part of the address. This is
22722 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
22723 appropriate lists, in the same form as the <option>local_part_prefix</option> and
22724 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
22725 example, if
22726 </para>
22727 <literallayout class="monospaced">
22728 local_from_prefix = *-
22729 </literallayout>
22730 <para>
22731 is set, a <emphasis>From:</emphasis> line containing
22732 </para>
22733 <literallayout class="monospaced">
22734 From: anything-user@your.domain.example
22735 </literallayout>
22736 <para>
22737 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
22738 matches the actual sender address that is constructed from the login name and
22739 qualify domain.
22740 </para>
22741 <para>
22742 <indexterm role="option">
22743 <primary>local_from_suffix</primary>
22744 </indexterm>
22745 </para>
22746 <informaltable frame="all">
22747 <tgroup cols="4" colsep="0" rowsep="0">
22748 <colspec colwidth="8*" align="left"/>
22749 <colspec colwidth="5*" align="center"/>
22750 <colspec colwidth="5*" align="center"/>
22751 <colspec colwidth="6*" align="right"/>
22752 <tbody>
22753 <row>
22754 <entry><option>local_from_suffix</option></entry>
22755 <entry>Use: <emphasis>main</emphasis></entry>
22756 <entry>Type: <emphasis>string</emphasis></entry>
22757 <entry>Default: <emphasis>unset</emphasis></entry>
22758 </row>
22759 </tbody>
22760 </tgroup>
22761 </informaltable>
22762 <para>
22763 See <option>local_from_prefix</option> above.
22764 </para>
22765 <para>
22766 <indexterm role="option">
22767 <primary>local_interfaces</primary>
22768 </indexterm>
22769 </para>
22770 <informaltable frame="all">
22771 <tgroup cols="4" colsep="0" rowsep="0">
22772 <colspec colwidth="8*" align="left"/>
22773 <colspec colwidth="5*" align="center"/>
22774 <colspec colwidth="5*" align="center"/>
22775 <colspec colwidth="6*" align="right"/>
22776 <tbody>
22777 <row>
22778 <entry><option>local_interfaces</option></entry>
22779 <entry>Use: <emphasis>main</emphasis></entry>
22780 <entry>Type: <emphasis>string list</emphasis></entry>
22781 <entry>Default: <emphasis>see below</emphasis></entry>
22782 </row>
22783 </tbody>
22784 </tgroup>
22785 </informaltable>
22786 <para>
22787 This option controls which network interfaces are used by the daemon for
22788 listening; they are also used to identify the local host when routing. Chapter
22789 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
22790 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
22791 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
22792 <option>local_interfaces</option> is
22793 </para>
22794 <literallayout class="monospaced">
22795 local_interfaces = 0.0.0.0
22796 </literallayout>
22797 <para>
22798 when Exim is built without IPv6 support; otherwise it is
22799 </para>
22800 <literallayout class="monospaced">
22801 local_interfaces = &lt;; ::0 ; 0.0.0.0
22802 </literallayout>
22803 <para>
22804 <indexterm role="option">
22805 <primary>local_scan_timeout</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>local_scan_timeout</option></entry>
22817 <entry>Use: <emphasis>main</emphasis></entry>
22818 <entry>Type: <emphasis>time</emphasis></entry>
22819 <entry>Default: <emphasis>5m</emphasis></entry>
22820 </row>
22821 </tbody>
22822 </tgroup>
22823 </informaltable>
22824 <para>
22825 <indexterm role="concept">
22826 <primary>timeout</primary>
22827 <secondary>for <function>local_scan()</function> function</secondary>
22828 </indexterm>
22829 <indexterm role="concept">
22830 <primary><function>local_scan()</function> function</primary>
22831 <secondary>timeout</secondary>
22832 </indexterm>
22833 This timeout applies to the <function>local_scan()</function> function (see chapter
22834 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
22835 the incoming message is rejected with a temporary error if it is an SMTP
22836 message. For a non-SMTP message, the message is dropped and Exim ends with a
22837 non-zero code. The incident is logged on the main and reject logs.
22838 </para>
22839 <para>
22840 <indexterm role="option">
22841 <primary>local_sender_retain</primary>
22842 </indexterm>
22843 </para>
22844 <informaltable frame="all">
22845 <tgroup cols="4" colsep="0" rowsep="0">
22846 <colspec colwidth="8*" align="left"/>
22847 <colspec colwidth="5*" align="center"/>
22848 <colspec colwidth="5*" align="center"/>
22849 <colspec colwidth="6*" align="right"/>
22850 <tbody>
22851 <row>
22852 <entry><option>local_sender_retain</option></entry>
22853 <entry>Use: <emphasis>main</emphasis></entry>
22854 <entry>Type: <emphasis>boolean</emphasis></entry>
22855 <entry>Default: <emphasis>false</emphasis></entry>
22856 </row>
22857 </tbody>
22858 </tgroup>
22859 </informaltable>
22860 <para>
22861 <indexterm role="concept">
22862 <primary><emphasis>Sender:</emphasis> header line</primary>
22863 <secondary>retaining from local submission</secondary>
22864 </indexterm>
22865 When a message is submitted locally (that is, not over a TCP/IP connection) by
22866 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
22867 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
22868 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
22869 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
22870 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
22871 </para>
22872 <para>
22873 <indexterm role="option">
22874 <primary>localhost_number</primary>
22875 </indexterm>
22876 </para>
22877 <informaltable frame="all">
22878 <tgroup cols="4" colsep="0" rowsep="0">
22879 <colspec colwidth="8*" align="left"/>
22880 <colspec colwidth="5*" align="center"/>
22881 <colspec colwidth="5*" align="center"/>
22882 <colspec colwidth="6*" align="right"/>
22883 <tbody>
22884 <row>
22885 <entry><option>localhost_number</option></entry>
22886 <entry>Use: <emphasis>main</emphasis></entry>
22887 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
22888 <entry>Default: <emphasis>unset</emphasis></entry>
22889 </row>
22890 </tbody>
22891 </tgroup>
22892 </informaltable>
22893 <para>
22894 <indexterm role="concept">
22895 <primary>host</primary>
22896 <secondary>locally unique number for</secondary>
22897 </indexterm>
22898 <indexterm role="concept">
22899 <primary>message ids</primary>
22900 <secondary>with multiple hosts</secondary>
22901 </indexterm>
22902 <indexterm role="concept">
22903 <primary><varname>$localhost_number</varname></primary>
22904 </indexterm>
22905 Exim&#x2019;s message ids are normally unique only within the local host. If
22906 uniqueness among a set of hosts is required, each host must set a different
22907 value for the <option>localhost_number</option> option. The string is expanded immediately
22908 after reading the configuration file (so that a number can be computed from the
22909 host name, for example) and the result of the expansion must be a number in the
22910 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
22911 systems). This is available in subsequent string expansions via the variable
22912 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
22913 characters of the message id, instead of just being a fractional part of the
22914 time, are computed from the time and the local host number as described in
22915 section <xref linkend="SECTmessiden"/>.
22916 </para>
22917 <para>
22918 <indexterm role="option">
22919 <primary>log_file_path</primary>
22920 </indexterm>
22921 </para>
22922 <informaltable frame="all">
22923 <tgroup cols="4" colsep="0" rowsep="0">
22924 <colspec colwidth="8*" align="left"/>
22925 <colspec colwidth="5*" align="center"/>
22926 <colspec colwidth="5*" align="center"/>
22927 <colspec colwidth="6*" align="right"/>
22928 <tbody>
22929 <row>
22930 <entry><option>log_file_path</option></entry>
22931 <entry>Use: <emphasis>main</emphasis></entry>
22932 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
22933 <entry>Default: <emphasis>set at compile time</emphasis></entry>
22934 </row>
22935 </tbody>
22936 </tgroup>
22937 </informaltable>
22938 <para>
22939 <indexterm role="concept">
22940 <primary>log</primary>
22941 <secondary>file path for</secondary>
22942 </indexterm>
22943 This option sets the path which is used to determine the names of Exim&#x2019;s log
22944 files, or indicates that logging is to be to syslog, or both. It is expanded
22945 when Exim is entered, so it can, for example, contain a reference to the host
22946 name. If no specific path is set for the log files at compile or run time, they
22947 are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
22948 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
22949 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
22950 used. If this string is fixed at your installation (contains no expansion
22951 variables) it is recommended that you do not set this option in the
22952 configuration file, but instead supply the path using LOG_FILE_PATH in
22953 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
22954 early on &ndash; in particular, failure to read the configuration file.
22955 </para>
22956 <para>
22957 <indexterm role="option">
22958 <primary>log_selector</primary>
22959 </indexterm>
22960 </para>
22961 <informaltable frame="all">
22962 <tgroup cols="4" colsep="0" rowsep="0">
22963 <colspec colwidth="8*" align="left"/>
22964 <colspec colwidth="5*" align="center"/>
22965 <colspec colwidth="5*" align="center"/>
22966 <colspec colwidth="6*" align="right"/>
22967 <tbody>
22968 <row>
22969 <entry><option>log_selector</option></entry>
22970 <entry>Use: <emphasis>main</emphasis></entry>
22971 <entry>Type: <emphasis>string</emphasis></entry>
22972 <entry>Default: <emphasis>unset</emphasis></entry>
22973 </row>
22974 </tbody>
22975 </tgroup>
22976 </informaltable>
22977 <para>
22978 <indexterm role="concept">
22979 <primary>log</primary>
22980 <secondary>selectors</secondary>
22981 </indexterm>
22982 This option can be used to reduce or increase the number of things that Exim
22983 writes to its log files. Its argument is made up of names preceded by plus or
22984 minus characters. For example:
22985 </para>
22986 <literallayout class="monospaced">
22987 log_selector = +arguments -retry_defer
22988 </literallayout>
22989 <para>
22990 A list of possible names and what they control is given in the chapter on
22991 logging, in section <xref linkend="SECTlogselector"/>.
22992 </para>
22993 <para>
22994 <indexterm role="option">
22995 <primary>log_timezone</primary>
22996 </indexterm>
22997 </para>
22998 <informaltable frame="all">
22999 <tgroup cols="4" colsep="0" rowsep="0">
23000 <colspec colwidth="8*" align="left"/>
23001 <colspec colwidth="5*" align="center"/>
23002 <colspec colwidth="5*" align="center"/>
23003 <colspec colwidth="6*" align="right"/>
23004 <tbody>
23005 <row>
23006 <entry><option>log_timezone</option></entry>
23007 <entry>Use: <emphasis>main</emphasis></entry>
23008 <entry>Type: <emphasis>boolean</emphasis></entry>
23009 <entry>Default: <emphasis>false</emphasis></entry>
23010 </row>
23011 </tbody>
23012 </tgroup>
23013 </informaltable>
23014 <para>
23015 <indexterm role="concept">
23016 <primary>log</primary>
23017 <secondary>timezone for entries</secondary>
23018 </indexterm>
23019 <indexterm role="concept">
23020 <primary><varname>$tod_log</varname></primary>
23021 </indexterm>
23022 <indexterm role="concept">
23023 <primary><varname>$tod_zone</varname></primary>
23024 </indexterm>
23025 By default, the timestamps on log lines are in local time without the
23026 timezone. This means that if your timezone changes twice a year, the timestamps
23027 in log lines are ambiguous for an hour when the clocks go back. One way of
23028 avoiding this problem is to set the timezone to UTC. An alternative is to set
23029 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
23030 timestamps in log lines. Turning on this option can add quite a lot to the size
23031 of log files because each line is extended by 6 characters. Note that the
23032 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
23033 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
23034 </para>
23035 <para>
23036 <indexterm role="option">
23037 <primary>lookup_open_max</primary>
23038 </indexterm>
23039 </para>
23040 <informaltable frame="all">
23041 <tgroup cols="4" colsep="0" rowsep="0">
23042 <colspec colwidth="8*" align="left"/>
23043 <colspec colwidth="5*" align="center"/>
23044 <colspec colwidth="5*" align="center"/>
23045 <colspec colwidth="6*" align="right"/>
23046 <tbody>
23047 <row>
23048 <entry><option>lookup_open_max</option></entry>
23049 <entry>Use: <emphasis>main</emphasis></entry>
23050 <entry>Type: <emphasis>integer</emphasis></entry>
23051 <entry>Default: <emphasis>25</emphasis></entry>
23052 </row>
23053 </tbody>
23054 </tgroup>
23055 </informaltable>
23056 <para>
23057 <indexterm role="concept">
23058 <primary>too many open files</primary>
23059 </indexterm>
23060 <indexterm role="concept">
23061 <primary>open files</primary>
23062 <secondary>too many</secondary>
23063 </indexterm>
23064 <indexterm role="concept">
23065 <primary>file</primary>
23066 <secondary>too many open</secondary>
23067 </indexterm>
23068 <indexterm role="concept">
23069 <primary>lookup</primary>
23070 <secondary>maximum open files</secondary>
23071 </indexterm>
23072 <indexterm role="concept">
23073 <primary>limit</primary>
23074 <secondary>open files for lookups</secondary>
23075 </indexterm>
23076 This option limits the number of simultaneously open files for single-key
23077 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
23078 Exim normally keeps these files open during routing, because often the same
23079 file is required several times. If the limit is reached, Exim closes the least
23080 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
23081 actually opens two files for each logical DBM database, though it still counts
23082 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
23083 open files</quote> errors with NDBM, you need to reduce the value of
23084 <option>lookup_open_max</option>.
23085 </para>
23086 <para>
23087 <indexterm role="option">
23088 <primary>max_username_length</primary>
23089 </indexterm>
23090 </para>
23091 <informaltable frame="all">
23092 <tgroup cols="4" colsep="0" rowsep="0">
23093 <colspec colwidth="8*" align="left"/>
23094 <colspec colwidth="5*" align="center"/>
23095 <colspec colwidth="5*" align="center"/>
23096 <colspec colwidth="6*" align="right"/>
23097 <tbody>
23098 <row>
23099 <entry><option>max_username_length</option></entry>
23100 <entry>Use: <emphasis>main</emphasis></entry>
23101 <entry>Type: <emphasis>integer</emphasis></entry>
23102 <entry>Default: <emphasis>0</emphasis></entry>
23103 </row>
23104 </tbody>
23105 </tgroup>
23106 </informaltable>
23107 <para>
23108 <indexterm role="concept">
23109 <primary>length</primary>
23110 <secondary>of login name</secondary>
23111 </indexterm>
23112 <indexterm role="concept">
23113 <primary>user name</primary>
23114 <secondary>maximum length</secondary>
23115 </indexterm>
23116 <indexterm role="concept">
23117 <primary>limit</primary>
23118 <secondary>user name length</secondary>
23119 </indexterm>
23120 Some operating systems are broken in that they truncate long arguments to
23121 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
23122 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
23123 an argument that is longer behaves as if <function>getpwnam()</function> failed.
23124 </para>
23125 <para>
23126 <indexterm role="option">
23127 <primary>message_body_visible</primary>
23128 </indexterm>
23129 </para>
23130 <informaltable frame="all">
23131 <tgroup cols="4" colsep="0" rowsep="0">
23132 <colspec colwidth="8*" align="left"/>
23133 <colspec colwidth="5*" align="center"/>
23134 <colspec colwidth="5*" align="center"/>
23135 <colspec colwidth="6*" align="right"/>
23136 <tbody>
23137 <row>
23138 <entry><option>message_body_visible</option></entry>
23139 <entry>Use: <emphasis>main</emphasis></entry>
23140 <entry>Type: <emphasis>integer</emphasis></entry>
23141 <entry>Default: <emphasis>500</emphasis></entry>
23142 </row>
23143 </tbody>
23144 </tgroup>
23145 </informaltable>
23146 <para>
23147 <indexterm role="concept">
23148 <primary>body of message</primary>
23149 <secondary>visible size</secondary>
23150 </indexterm>
23151 <indexterm role="concept">
23152 <primary>message body</primary>
23153 <secondary>visible size</secondary>
23154 </indexterm>
23155 <indexterm role="concept">
23156 <primary><varname>$message_body</varname></primary>
23157 </indexterm>
23158 <indexterm role="concept">
23159 <primary><varname>$message_body_end</varname></primary>
23160 </indexterm>
23161 This option specifies how much of a message&#x2019;s body is to be included in the
23162 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
23163 </para>
23164 <para>
23165 <indexterm role="option">
23166 <primary>message_id_header_domain</primary>
23167 </indexterm>
23168 </para>
23169 <informaltable frame="all">
23170 <tgroup cols="4" colsep="0" rowsep="0">
23171 <colspec colwidth="8*" align="left"/>
23172 <colspec colwidth="5*" align="center"/>
23173 <colspec colwidth="5*" align="center"/>
23174 <colspec colwidth="6*" align="right"/>
23175 <tbody>
23176 <row>
23177 <entry><option>message_id_header_domain</option></entry>
23178 <entry>Use: <emphasis>main</emphasis></entry>
23179 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23180 <entry>Default: <emphasis>unset</emphasis></entry>
23181 </row>
23182 </tbody>
23183 </tgroup>
23184 </informaltable>
23185 <para>
23186 <indexterm role="concept">
23187 <primary><emphasis>Message-ID:</emphasis> header line</primary>
23188 </indexterm>
23189 If this option is set, the string is expanded and used as the right hand side
23190 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
23191 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
23192 means <quote>not received over TCP/IP.</quote>
23193 Otherwise, the primary host name is used.
23194 Only letters, digits, dot and hyphen are accepted; any other characters are
23195 replaced by hyphens. If the expansion is forced to fail, or if the result is an
23196 empty string, the option is ignored.
23197 </para>
23198 <para>
23199 <indexterm role="option">
23200 <primary>message_id_header_text</primary>
23201 </indexterm>
23202 </para>
23203 <informaltable frame="all">
23204 <tgroup cols="4" colsep="0" rowsep="0">
23205 <colspec colwidth="8*" align="left"/>
23206 <colspec colwidth="5*" align="center"/>
23207 <colspec colwidth="5*" align="center"/>
23208 <colspec colwidth="6*" align="right"/>
23209 <tbody>
23210 <row>
23211 <entry><option>message_id_header_text</option></entry>
23212 <entry>Use: <emphasis>main</emphasis></entry>
23213 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23214 <entry>Default: <emphasis>unset</emphasis></entry>
23215 </row>
23216 </tbody>
23217 </tgroup>
23218 </informaltable>
23219 <para>
23220 If this variable is set, the string is expanded and used to augment the text of
23221 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
23222 message does not have one. The text of this header is required by RFC 2822 to
23223 take the form of an address. By default, Exim uses its internal message id as
23224 the local part, and the primary host name as the domain. If this option is set,
23225 it is expanded, and provided the expansion is not forced to fail, and does not
23226 yield an empty string, the result is inserted into the header immediately
23227 before the @, separated from the internal message id by a dot. Any characters
23228 that are illegal in an address are automatically converted into hyphens. This
23229 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
23230 colons will become hyphens.
23231 </para>
23232 <para>
23233 <indexterm role="option">
23234 <primary>message_logs</primary>
23235 </indexterm>
23236 </para>
23237 <informaltable frame="all">
23238 <tgroup cols="4" colsep="0" rowsep="0">
23239 <colspec colwidth="8*" align="left"/>
23240 <colspec colwidth="5*" align="center"/>
23241 <colspec colwidth="5*" align="center"/>
23242 <colspec colwidth="6*" align="right"/>
23243 <tbody>
23244 <row>
23245 <entry><option>message_logs</option></entry>
23246 <entry>Use: <emphasis>main</emphasis></entry>
23247 <entry>Type: <emphasis>boolean</emphasis></entry>
23248 <entry>Default: <emphasis>true</emphasis></entry>
23249 </row>
23250 </tbody>
23251 </tgroup>
23252 </informaltable>
23253 <para>
23254 <indexterm role="concept">
23255 <primary>message log</primary>
23256 <secondary>disabling</secondary>
23257 </indexterm>
23258 <indexterm role="concept">
23259 <primary>log</primary>
23260 <secondary>message log; disabling</secondary>
23261 </indexterm>
23262 If this option is turned off, per-message log files are not created in the
23263 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
23264 Exim, by reducing the number of files involved in handling a message from a
23265 minimum of four (header spool file, body spool file, delivery journal, and
23266 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
23267 which is not affected by this option.
23268 </para>
23269 <para>
23270 <indexterm role="option">
23271 <primary>message_size_limit</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>message_size_limit</option></entry>
23283 <entry>Use: <emphasis>main</emphasis></entry>
23284 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23285 <entry>Default: <emphasis>50M</emphasis></entry>
23286 </row>
23287 </tbody>
23288 </tgroup>
23289 </informaltable>
23290 <para>
23291 <indexterm role="concept">
23292 <primary>message</primary>
23293 <secondary>size limit</secondary>
23294 </indexterm>
23295 <indexterm role="concept">
23296 <primary>limit</primary>
23297 <secondary>message size</secondary>
23298 </indexterm>
23299 <indexterm role="concept">
23300 <primary>size of message</primary>
23301 <secondary>limit</secondary>
23302 </indexterm>
23303 This option limits the maximum size of message that Exim will process. The
23304 value is expanded for each incoming
23305 connection so, for example, it can be made to depend on the IP address of the
23306 remote host for messages arriving via TCP/IP. <emphasis role="bold">Note</emphasis>: This limit cannot be
23307 made to depend on a message&#x2019;s sender or any other properties of an individual
23308 message, because it has to be advertised in the server&#x2019;s response to EHLO.
23309 String expansion failure causes a temporary error. A value of zero means no
23310 limit, but its use is not recommended. See also <option>bounce_return_size_limit</option>.
23311 </para>
23312 <para>
23313 Incoming SMTP messages are failed with a 552 error if the limit is
23314 exceeded; locally-generated messages either get a stderr message or a delivery
23315 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
23316 an oversized message is logged in both the main and the reject logs. See also
23317 the generic transport option <option>message_size_limit</option>, which limits the size of
23318 message that an individual transport can process.
23319 </para>
23320 <para>
23321 <indexterm role="option">
23322 <primary>move_frozen_messages</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>move_frozen_messages</option></entry>
23334 <entry>Use: <emphasis>main</emphasis></entry>
23335 <entry>Type: <emphasis>boolean</emphasis></entry>
23336 <entry>Default: <emphasis>false</emphasis></entry>
23337 </row>
23338 </tbody>
23339 </tgroup>
23340 </informaltable>
23341 <para>
23342 <indexterm role="concept">
23343 <primary>frozen messages</primary>
23344 <secondary>moving</secondary>
23345 </indexterm>
23346 This option, which is available only if Exim has been built with the setting
23347 </para>
23348 <literallayout class="monospaced">
23349 SUPPORT_MOVE_FROZEN_MESSAGES=yes
23350 </literallayout>
23351 <para>
23352 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
23353 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
23354 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
23355 standard utilities for handling such moved messages, and they do not show up in
23356 lists generated by <option>-bp</option> or by the Exim monitor.
23357 </para>
23358 <para>
23359 <indexterm role="option">
23360 <primary>mua_wrapper</primary>
23361 </indexterm>
23362 </para>
23363 <informaltable frame="all">
23364 <tgroup cols="4" colsep="0" rowsep="0">
23365 <colspec colwidth="8*" align="left"/>
23366 <colspec colwidth="5*" align="center"/>
23367 <colspec colwidth="5*" align="center"/>
23368 <colspec colwidth="6*" align="right"/>
23369 <tbody>
23370 <row>
23371 <entry><option>mua_wrapper</option></entry>
23372 <entry>Use: <emphasis>main</emphasis></entry>
23373 <entry>Type: <emphasis>boolean</emphasis></entry>
23374 <entry>Default: <emphasis>false</emphasis></entry>
23375 </row>
23376 </tbody>
23377 </tgroup>
23378 </informaltable>
23379 <para>
23380 Setting this option true causes Exim to run in a very restrictive mode in which
23381 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
23382 contains a full description of this facility.
23383 </para>
23384 <para>
23385 <indexterm role="option">
23386 <primary>mysql_servers</primary>
23387 </indexterm>
23388 </para>
23389 <informaltable frame="all">
23390 <tgroup cols="4" colsep="0" rowsep="0">
23391 <colspec colwidth="8*" align="left"/>
23392 <colspec colwidth="5*" align="center"/>
23393 <colspec colwidth="5*" align="center"/>
23394 <colspec colwidth="6*" align="right"/>
23395 <tbody>
23396 <row>
23397 <entry><option>mysql_servers</option></entry>
23398 <entry>Use: <emphasis>main</emphasis></entry>
23399 <entry>Type: <emphasis>string list</emphasis></entry>
23400 <entry>Default: <emphasis>unset</emphasis></entry>
23401 </row>
23402 </tbody>
23403 </tgroup>
23404 </informaltable>
23405 <para>
23406 <indexterm role="concept">
23407 <primary>MySQL</primary>
23408 <secondary>server list</secondary>
23409 </indexterm>
23410 This option provides a list of MySQL servers and associated connection data, to
23411 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECTsql"/>). The
23412 option is available only if Exim has been built with MySQL support.
23413 </para>
23414 <para>
23415 <indexterm role="option">
23416 <primary>never_users</primary>
23417 </indexterm>
23418 </para>
23419 <informaltable frame="all">
23420 <tgroup cols="4" colsep="0" rowsep="0">
23421 <colspec colwidth="8*" align="left"/>
23422 <colspec colwidth="5*" align="center"/>
23423 <colspec colwidth="5*" align="center"/>
23424 <colspec colwidth="6*" align="right"/>
23425 <tbody>
23426 <row>
23427 <entry><option>never_users</option></entry>
23428 <entry>Use: <emphasis>main</emphasis></entry>
23429 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
23430 <entry>Default: <emphasis>unset</emphasis></entry>
23431 </row>
23432 </tbody>
23433 </tgroup>
23434 </informaltable>
23435 <para>
23436 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
23437 message deliveries are normally run in processes that are setuid to the
23438 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
23439 It is usually desirable to prevent any deliveries from running as root, as a
23440 safety precaution.
23441 </para>
23442 <para>
23443 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
23444 list of users that must not be used for local deliveries. This list is fixed in
23445 the binary and cannot be overridden by the configuration file. By default, it
23446 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
23447 can be used to add more users to the fixed list.
23448 </para>
23449 <para>
23450 If a message is to be delivered as one of the users on the fixed list or the
23451 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
23452 example is
23453 </para>
23454 <literallayout class="monospaced">
23455 never_users = root:daemon:bin
23456 </literallayout>
23457 <para>
23458 Including root is redundant if it is also on the fixed list, but it does no
23459 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
23460 transport driver.
23461 </para>
23462 <para>
23463 <indexterm role="option">
23464 <primary>oracle_servers</primary>
23465 </indexterm>
23466 </para>
23467 <informaltable frame="all">
23468 <tgroup cols="4" colsep="0" rowsep="0">
23469 <colspec colwidth="8*" align="left"/>
23470 <colspec colwidth="5*" align="center"/>
23471 <colspec colwidth="5*" align="center"/>
23472 <colspec colwidth="6*" align="right"/>
23473 <tbody>
23474 <row>
23475 <entry><option>oracle_servers</option></entry>
23476 <entry>Use: <emphasis>main</emphasis></entry>
23477 <entry>Type: <emphasis>string list</emphasis></entry>
23478 <entry>Default: <emphasis>unset</emphasis></entry>
23479 </row>
23480 </tbody>
23481 </tgroup>
23482 </informaltable>
23483 <para>
23484 <indexterm role="concept">
23485 <primary>Oracle</primary>
23486 <secondary>server list</secondary>
23487 </indexterm>
23488 This option provides a list of Oracle servers and associated connection data,
23489 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECTsql"/>).
23490 The option is available only if Exim has been built with Oracle support.
23491 </para>
23492 <para>
23493 <indexterm role="option">
23494 <primary>percent_hack_domains</primary>
23495 </indexterm>
23496 </para>
23497 <informaltable frame="all">
23498 <tgroup cols="4" colsep="0" rowsep="0">
23499 <colspec colwidth="8*" align="left"/>
23500 <colspec colwidth="5*" align="center"/>
23501 <colspec colwidth="5*" align="center"/>
23502 <colspec colwidth="6*" align="right"/>
23503 <tbody>
23504 <row>
23505 <entry><option>percent_hack_domains</option></entry>
23506 <entry>Use: <emphasis>main</emphasis></entry>
23507 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23508 <entry>Default: <emphasis>unset</emphasis></entry>
23509 </row>
23510 </tbody>
23511 </tgroup>
23512 </informaltable>
23513 <para>
23514 <indexterm role="concept">
23515 <primary><quote>percent hack</quote></primary>
23516 </indexterm>
23517 <indexterm role="concept">
23518 <primary>source routing</primary>
23519 <secondary>in email address</secondary>
23520 </indexterm>
23521 <indexterm role="concept">
23522 <primary>address</primary>
23523 <secondary>source-routed</secondary>
23524 </indexterm>
23525 The <quote>percent hack</quote> is the convention whereby a local part containing a
23526 percent sign is re-interpreted as a new email address, with the percent
23527 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
23528 also applied to RFC 2822 addresses that begin with an @ character. If this
23529 option is set, Exim implements the percent facility for those domains listed,
23530 but no others. This happens before an incoming SMTP address is tested against
23531 an ACL.
23532 </para>
23533 <para>
23534 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
23535 trying to get round relaying restrictions. For this reason, it is best avoided
23536 if at all possible. Unfortunately, a number of less security-conscious MTAs
23537 implement it unconditionally. If you are running Exim on a gateway host, and
23538 routing mail through to internal MTAs without processing the local parts, it is
23539 a good idea to reject recipient addresses with percent characters in their
23540 local parts. Exim&#x2019;s default configuration does this.
23541 </para>
23542 <para>
23543 <indexterm role="option">
23544 <primary>perl_at_start</primary>
23545 </indexterm>
23546 </para>
23547 <informaltable frame="all">
23548 <tgroup cols="4" colsep="0" rowsep="0">
23549 <colspec colwidth="8*" align="left"/>
23550 <colspec colwidth="5*" align="center"/>
23551 <colspec colwidth="5*" align="center"/>
23552 <colspec colwidth="6*" align="right"/>
23553 <tbody>
23554 <row>
23555 <entry><option>perl_at_start</option></entry>
23556 <entry>Use: <emphasis>main</emphasis></entry>
23557 <entry>Type: <emphasis>boolean</emphasis></entry>
23558 <entry>Default: <emphasis>false</emphasis></entry>
23559 </row>
23560 </tbody>
23561 </tgroup>
23562 </informaltable>
23563 <para>
23564 This option is available only when Exim is built with an embedded Perl
23565 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23566 </para>
23567 <para>
23568 <indexterm role="option">
23569 <primary>perl_startup</primary>
23570 </indexterm>
23571 </para>
23572 <informaltable frame="all">
23573 <tgroup cols="4" colsep="0" rowsep="0">
23574 <colspec colwidth="8*" align="left"/>
23575 <colspec colwidth="5*" align="center"/>
23576 <colspec colwidth="5*" align="center"/>
23577 <colspec colwidth="6*" align="right"/>
23578 <tbody>
23579 <row>
23580 <entry><option>perl_startup</option></entry>
23581 <entry>Use: <emphasis>main</emphasis></entry>
23582 <entry>Type: <emphasis>string</emphasis></entry>
23583 <entry>Default: <emphasis>unset</emphasis></entry>
23584 </row>
23585 </tbody>
23586 </tgroup>
23587 </informaltable>
23588 <para>
23589 This option is available only when Exim is built with an embedded Perl
23590 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
23591 </para>
23592 <para>
23593 <indexterm role="option">
23594 <primary>pgsql_servers</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>pgsql_servers</option></entry>
23606 <entry>Use: <emphasis>main</emphasis></entry>
23607 <entry>Type: <emphasis>string list</emphasis></entry>
23608 <entry>Default: <emphasis>unset</emphasis></entry>
23609 </row>
23610 </tbody>
23611 </tgroup>
23612 </informaltable>
23613 <para>
23614 <indexterm role="concept">
23615 <primary>PostgreSQL lookup type</primary>
23616 <secondary>server list</secondary>
23617 </indexterm>
23618 This option provides a list of PostgreSQL servers and associated connection
23619 data, to be used in conjunction with <command>pgsql</command> lookups (see section
23620 <xref linkend="SECTsql"/>). The option is available only if Exim has been built with
23621 PostgreSQL support.
23622 </para>
23623 <para>
23624 <indexterm role="option">
23625 <primary>pid_file_path</primary>
23626 </indexterm>
23627 </para>
23628 <informaltable frame="all">
23629 <tgroup cols="4" colsep="0" rowsep="0">
23630 <colspec colwidth="8*" align="left"/>
23631 <colspec colwidth="5*" align="center"/>
23632 <colspec colwidth="5*" align="center"/>
23633 <colspec colwidth="6*" align="right"/>
23634 <tbody>
23635 <row>
23636 <entry><option>pid_file_path</option></entry>
23637 <entry>Use: <emphasis>main</emphasis></entry>
23638 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
23639 <entry>Default: <emphasis>set at compile time</emphasis></entry>
23640 </row>
23641 </tbody>
23642 </tgroup>
23643 </informaltable>
23644 <para>
23645 <indexterm role="concept">
23646 <primary>daemon</primary>
23647 <secondary>pid file path</secondary>
23648 </indexterm>
23649 <indexterm role="concept">
23650 <primary>pid file</primary>
23651 <secondary>path for</secondary>
23652 </indexterm>
23653 This option sets the name of the file to which the Exim daemon writes its
23654 process id. The string is expanded, so it can contain, for example, references
23655 to the host name:
23656 </para>
23657 <literallayout class="monospaced">
23658 pid_file_path = /var/log/$primary_hostname/exim.pid
23659 </literallayout>
23660 <para>
23661 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
23662 spool directory.
23663 The value set by the option can be overridden by the <option>-oP</option> command line
23664 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
23665 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
23666 </para>
23667 <para>
23668 <indexterm role="option">
23669 <primary>pipelining_advertise_hosts</primary>
23670 </indexterm>
23671 </para>
23672 <informaltable frame="all">
23673 <tgroup cols="4" colsep="0" rowsep="0">
23674 <colspec colwidth="8*" align="left"/>
23675 <colspec colwidth="5*" align="center"/>
23676 <colspec colwidth="5*" align="center"/>
23677 <colspec colwidth="6*" align="right"/>
23678 <tbody>
23679 <row>
23680 <entry><option>pipelining_advertise_hosts</option></entry>
23681 <entry>Use: <emphasis>main</emphasis></entry>
23682 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
23683 <entry>Default: <emphasis>*</emphasis></entry>
23684 </row>
23685 </tbody>
23686 </tgroup>
23687 </informaltable>
23688 <para>
23689 <indexterm role="concept">
23690 <primary>PIPELINING advertising</primary>
23691 <secondary>suppressing</secondary>
23692 </indexterm>
23693 This option can be used to suppress the advertisement of the SMTP
23694 PIPELINING extension to specific hosts. When PIPELINING is not
23695 advertised and <option>smtp_enforce_sync</option> is true, an Exim server enforces strict
23696 synchronization for each SMTP command and response.
23697 When PIPELINING is advertised, Exim assumes that clients will use it; <quote>out
23698 of order</quote> commands that are <quote>expected</quote> do not count as protocol errors (see
23699 <option>smtp_max_synprot_errors</option>).
23700 </para>
23701 <para>
23702 <indexterm role="option">
23703 <primary>preserve_message_logs</primary>
23704 </indexterm>
23705 </para>
23706 <informaltable frame="all">
23707 <tgroup cols="4" colsep="0" rowsep="0">
23708 <colspec colwidth="8*" align="left"/>
23709 <colspec colwidth="5*" align="center"/>
23710 <colspec colwidth="5*" align="center"/>
23711 <colspec colwidth="6*" align="right"/>
23712 <tbody>
23713 <row>
23714 <entry><option>preserve_message_logs</option></entry>
23715 <entry>Use: <emphasis>main</emphasis></entry>
23716 <entry>Type: <emphasis>boolean</emphasis></entry>
23717 <entry>Default: <emphasis>false</emphasis></entry>
23718 </row>
23719 </tbody>
23720 </tgroup>
23721 </informaltable>
23722 <para>
23723 <indexterm role="concept">
23724 <primary>message logs</primary>
23725 <secondary>preserving</secondary>
23726 </indexterm>
23727 If this option is set, message log files are not deleted when messages are
23728 completed. Instead, they are moved to a sub-directory of the spool directory
23729 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
23730 purposes. This is a dangerous option to set on systems with any appreciable
23731 volume of mail. Use with care!
23732 </para>
23733 <para>
23734 <indexterm role="option">
23735 <primary>primary_hostname</primary>
23736 </indexterm>
23737 </para>
23738 <informaltable frame="all">
23739 <tgroup cols="4" colsep="0" rowsep="0">
23740 <colspec colwidth="8*" align="left"/>
23741 <colspec colwidth="5*" align="center"/>
23742 <colspec colwidth="5*" align="center"/>
23743 <colspec colwidth="6*" align="right"/>
23744 <tbody>
23745 <row>
23746 <entry><option>primary_hostname</option></entry>
23747 <entry>Use: <emphasis>main</emphasis></entry>
23748 <entry>Type: <emphasis>string</emphasis></entry>
23749 <entry>Default: <emphasis>see below</emphasis></entry>
23750 </row>
23751 </tbody>
23752 </tgroup>
23753 </informaltable>
23754 <para>
23755 <indexterm role="concept">
23756 <primary>name</primary>
23757 <secondary>of local host</secondary>
23758 </indexterm>
23759 <indexterm role="concept">
23760 <primary>host</primary>
23761 <secondary>name of local</secondary>
23762 </indexterm>
23763 <indexterm role="concept">
23764 <primary>local host</primary>
23765 <secondary>name of</secondary>
23766 </indexterm>
23767 <indexterm role="concept">
23768 <primary><varname>$primary_hostname</varname></primary>
23769 </indexterm>
23770 This specifies the name of the current host. It is used in the default EHLO or
23771 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
23772 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
23773 The value is also used by default in some SMTP response messages from an Exim
23774 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
23775 </para>
23776 <para>
23777 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
23778 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
23779 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
23780 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
23781 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
23782 explicitly by this option, or defaulted.
23783 </para>
23784 <para>
23785 <indexterm role="option">
23786 <primary>print_topbitchars</primary>
23787 </indexterm>
23788 </para>
23789 <informaltable frame="all">
23790 <tgroup cols="4" colsep="0" rowsep="0">
23791 <colspec colwidth="8*" align="left"/>
23792 <colspec colwidth="5*" align="center"/>
23793 <colspec colwidth="5*" align="center"/>
23794 <colspec colwidth="6*" align="right"/>
23795 <tbody>
23796 <row>
23797 <entry><option>print_topbitchars</option></entry>
23798 <entry>Use: <emphasis>main</emphasis></entry>
23799 <entry>Type: <emphasis>boolean</emphasis></entry>
23800 <entry>Default: <emphasis>false</emphasis></entry>
23801 </row>
23802 </tbody>
23803 </tgroup>
23804 </informaltable>
23805 <para>
23806 <indexterm role="concept">
23807 <primary>printing characters</primary>
23808 </indexterm>
23809 <indexterm role="concept">
23810 <primary>8-bit characters</primary>
23811 </indexterm>
23812 By default, Exim considers only those characters whose codes lie in the range
23813 32&ndash;126 to be printing characters. In a number of circumstances (for example,
23814 when writing log entries) non-printing characters are converted into escape
23815 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
23816 is set, code values of 128 and above are also considered to be printing
23817 characters.
23818 </para>
23819 <para>
23820 This option also affects the header syntax checks performed by the
23821 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
23822 the user&#x2019;s full name when constructing From: and Sender: addresses (as
23823 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
23824 Exim to generate eight bit message headers that do not conform to the
23825 standards.
23826 </para>
23827 <para>
23828 <indexterm role="option">
23829 <primary>process_log_path</primary>
23830 </indexterm>
23831 </para>
23832 <informaltable frame="all">
23833 <tgroup cols="4" colsep="0" rowsep="0">
23834 <colspec colwidth="8*" align="left"/>
23835 <colspec colwidth="5*" align="center"/>
23836 <colspec colwidth="5*" align="center"/>
23837 <colspec colwidth="6*" align="right"/>
23838 <tbody>
23839 <row>
23840 <entry><option>process_log_path</option></entry>
23841 <entry>Use: <emphasis>main</emphasis></entry>
23842 <entry>Type: <emphasis>string</emphasis></entry>
23843 <entry>Default: <emphasis>unset</emphasis></entry>
23844 </row>
23845 </tbody>
23846 </tgroup>
23847 </informaltable>
23848 <para>
23849 <indexterm role="concept">
23850 <primary>process log path</primary>
23851 </indexterm>
23852 <indexterm role="concept">
23853 <primary>log</primary>
23854 <secondary>process log</secondary>
23855 </indexterm>
23856 <indexterm role="concept">
23857 <primary><emphasis>exiwhat</emphasis></primary>
23858 </indexterm>
23859 This option sets the name of the file to which an Exim process writes its
23860 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
23861 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
23862 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
23863 can be useful in environments where two different Exims are running, using
23864 different spool directories.
23865 </para>
23866 <para>
23867 <indexterm role="option">
23868 <primary>prod_requires_admin</primary>
23869 </indexterm>
23870 </para>
23871 <informaltable frame="all">
23872 <tgroup cols="4" colsep="0" rowsep="0">
23873 <colspec colwidth="8*" align="left"/>
23874 <colspec colwidth="5*" align="center"/>
23875 <colspec colwidth="5*" align="center"/>
23876 <colspec colwidth="6*" align="right"/>
23877 <tbody>
23878 <row>
23879 <entry><option>prod_requires_admin</option></entry>
23880 <entry>Use: <emphasis>main</emphasis></entry>
23881 <entry>Type: <emphasis>boolean</emphasis></entry>
23882 <entry>Default: <emphasis>true</emphasis></entry>
23883 </row>
23884 </tbody>
23885 </tgroup>
23886 </informaltable>
23887 <para>
23888 <indexterm role="concept">
23889 <primary><option>-M</option> option</primary>
23890 </indexterm>
23891 <indexterm role="concept">
23892 <primary><option>-R</option> option</primary>
23893 </indexterm>
23894 <indexterm role="concept">
23895 <primary><option>-q</option> option</primary>
23896 </indexterm>
23897 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
23898 admin user unless <option>prod_requires_admin</option> is set false. See also
23899 <option>queue_list_requires_admin</option>.
23900 </para>
23901 <para>
23902 <indexterm role="option">
23903 <primary>qualify_domain</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>qualify_domain</option></entry>
23915 <entry>Use: <emphasis>main</emphasis></entry>
23916 <entry>Type: <emphasis>string</emphasis></entry>
23917 <entry>Default: <emphasis>see below</emphasis></entry>
23918 </row>
23919 </tbody>
23920 </tgroup>
23921 </informaltable>
23922 <para>
23923 <indexterm role="concept">
23924 <primary>domain</primary>
23925 <secondary>for qualifying addresses</secondary>
23926 </indexterm>
23927 <indexterm role="concept">
23928 <primary>address</primary>
23929 <secondary>qualification</secondary>
23930 </indexterm>
23931 This option specifies the domain name that is added to any envelope sender
23932 addresses that do not have a domain qualification. It also applies to
23933 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
23934 are accepted by default only for locally-generated messages. Qualification is
23935 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
23936 locally-generated messages, unless the <option>-bnq</option> command line option is used.
23937 </para>
23938 <para>
23939 Messages from external sources must always contain fully qualified addresses,
23940 unless the sending host matches <option>sender_unqualified_hosts</option> or
23941 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
23942 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
23943 necessary. Internally, Exim always works with fully qualified envelope
23944 addresses. If <option>qualify_domain</option> is not set, it defaults to the
23945 <option>primary_hostname</option> value.
23946 </para>
23947 <para>
23948 <indexterm role="option">
23949 <primary>qualify_recipient</primary>
23950 </indexterm>
23951 </para>
23952 <informaltable frame="all">
23953 <tgroup cols="4" colsep="0" rowsep="0">
23954 <colspec colwidth="8*" align="left"/>
23955 <colspec colwidth="5*" align="center"/>
23956 <colspec colwidth="5*" align="center"/>
23957 <colspec colwidth="6*" align="right"/>
23958 <tbody>
23959 <row>
23960 <entry><option>qualify_recipient</option></entry>
23961 <entry>Use: <emphasis>main</emphasis></entry>
23962 <entry>Type: <emphasis>string</emphasis></entry>
23963 <entry>Default: <emphasis>see below</emphasis></entry>
23964 </row>
23965 </tbody>
23966 </tgroup>
23967 </informaltable>
23968 <para>
23969 This option allows you to specify a different domain for qualifying recipient
23970 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
23971 </para>
23972 <para>
23973 <indexterm role="option">
23974 <primary>queue_domains</primary>
23975 </indexterm>
23976 </para>
23977 <informaltable frame="all">
23978 <tgroup cols="4" colsep="0" rowsep="0">
23979 <colspec colwidth="8*" align="left"/>
23980 <colspec colwidth="5*" align="center"/>
23981 <colspec colwidth="5*" align="center"/>
23982 <colspec colwidth="6*" align="right"/>
23983 <tbody>
23984 <row>
23985 <entry><option>queue_domains</option></entry>
23986 <entry>Use: <emphasis>main</emphasis></entry>
23987 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
23988 <entry>Default: <emphasis>unset</emphasis></entry>
23989 </row>
23990 </tbody>
23991 </tgroup>
23992 </informaltable>
23993 <para>
23994 <indexterm role="concept">
23995 <primary>domain</primary>
23996 <secondary>specifying non-immediate delivery</secondary>
23997 </indexterm>
23998 <indexterm role="concept">
23999 <primary>queueing incoming messages</primary>
24000 </indexterm>
24001 <indexterm role="concept">
24002 <primary>message</primary>
24003 <secondary>queueing certain domains</secondary>
24004 </indexterm>
24005 This option lists domains for which immediate delivery is not required.
24006 A delivery process is started whenever a message is received, but only those
24007 domains that do not match are processed. All other deliveries wait until the
24008 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
24009 </para>
24010 <para>
24011 <indexterm role="option">
24012 <primary>queue_list_requires_admin</primary>
24013 </indexterm>
24014 </para>
24015 <informaltable frame="all">
24016 <tgroup cols="4" colsep="0" rowsep="0">
24017 <colspec colwidth="8*" align="left"/>
24018 <colspec colwidth="5*" align="center"/>
24019 <colspec colwidth="5*" align="center"/>
24020 <colspec colwidth="6*" align="right"/>
24021 <tbody>
24022 <row>
24023 <entry><option>queue_list_requires_admin</option></entry>
24024 <entry>Use: <emphasis>main</emphasis></entry>
24025 <entry>Type: <emphasis>boolean</emphasis></entry>
24026 <entry>Default: <emphasis>true</emphasis></entry>
24027 </row>
24028 </tbody>
24029 </tgroup>
24030 </informaltable>
24031 <para>
24032 <indexterm role="concept">
24033 <primary><option>-bp</option> option</primary>
24034 </indexterm>
24035 The <option>-bp</option> command-line option, which lists the messages that are on the
24036 queue, requires the caller to be an admin user unless
24037 <option>queue_list_requires_admin</option> is set false. See also <option>prod_requires_admin</option>.
24038 </para>
24039 <para>
24040 <indexterm role="option">
24041 <primary>queue_only</primary>
24042 </indexterm>
24043 </para>
24044 <informaltable frame="all">
24045 <tgroup cols="4" colsep="0" rowsep="0">
24046 <colspec colwidth="8*" align="left"/>
24047 <colspec colwidth="5*" align="center"/>
24048 <colspec colwidth="5*" align="center"/>
24049 <colspec colwidth="6*" align="right"/>
24050 <tbody>
24051 <row>
24052 <entry><option>queue_only</option></entry>
24053 <entry>Use: <emphasis>main</emphasis></entry>
24054 <entry>Type: <emphasis>boolean</emphasis></entry>
24055 <entry>Default: <emphasis>false</emphasis></entry>
24056 </row>
24057 </tbody>
24058 </tgroup>
24059 </informaltable>
24060 <para>
24061 <indexterm role="concept">
24062 <primary>queueing incoming messages</primary>
24063 </indexterm>
24064 <indexterm role="concept">
24065 <primary>message</primary>
24066 <secondary>queueing unconditionally</secondary>
24067 </indexterm>
24068 If <option>queue_only</option> is set, a delivery process is not automatically started
24069 whenever a message is received. Instead, the message waits on the queue for the
24070 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
24071 delivered immediately when certain conditions (such as heavy load) occur.
24072 </para>
24073 <para>
24074 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
24075 and <option>-odi</option> command line options override <option>queue_only</option> unless
24076 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
24077 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
24078 </para>
24079 <para>
24080 <indexterm role="option">
24081 <primary>queue_only_file</primary>
24082 </indexterm>
24083 </para>
24084 <informaltable frame="all">
24085 <tgroup cols="4" colsep="0" rowsep="0">
24086 <colspec colwidth="8*" align="left"/>
24087 <colspec colwidth="5*" align="center"/>
24088 <colspec colwidth="5*" align="center"/>
24089 <colspec colwidth="6*" align="right"/>
24090 <tbody>
24091 <row>
24092 <entry><option>queue_only_file</option></entry>
24093 <entry>Use: <emphasis>main</emphasis></entry>
24094 <entry>Type: <emphasis>string</emphasis></entry>
24095 <entry>Default: <emphasis>unset</emphasis></entry>
24096 </row>
24097 </tbody>
24098 </tgroup>
24099 </informaltable>
24100 <para>
24101 <indexterm role="concept">
24102 <primary>queueing incoming messages</primary>
24103 </indexterm>
24104 <indexterm role="concept">
24105 <primary>message</primary>
24106 <secondary>queueing by file existence</secondary>
24107 </indexterm>
24108 This option can be set to a colon-separated list of absolute path names, each
24109 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
24110 it tests for the existence of each listed path using a call to <function>stat()</function>. For
24111 each path that exists, the corresponding queuing option is set.
24112 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
24113 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
24114 </para>
24115 <literallayout class="monospaced">
24116 queue_only_file = smtp/some/file
24117 </literallayout>
24118 <para>
24119 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
24120 <filename>/some/file</filename> exists.
24121 </para>
24122 <para>
24123 <indexterm role="option">
24124 <primary>queue_only_load</primary>
24125 </indexterm>
24126 </para>
24127 <informaltable frame="all">
24128 <tgroup cols="4" colsep="0" rowsep="0">
24129 <colspec colwidth="8*" align="left"/>
24130 <colspec colwidth="5*" align="center"/>
24131 <colspec colwidth="5*" align="center"/>
24132 <colspec colwidth="6*" align="right"/>
24133 <tbody>
24134 <row>
24135 <entry><option>queue_only_load</option></entry>
24136 <entry>Use: <emphasis>main</emphasis></entry>
24137 <entry>Type: <emphasis>fixed-point</emphasis></entry>
24138 <entry>Default: <emphasis>unset</emphasis></entry>
24139 </row>
24140 </tbody>
24141 </tgroup>
24142 </informaltable>
24143 <para>
24144 <indexterm role="concept">
24145 <primary>load average</primary>
24146 </indexterm>
24147 <indexterm role="concept">
24148 <primary>queueing incoming messages</primary>
24149 </indexterm>
24150 <indexterm role="concept">
24151 <primary>message</primary>
24152 <secondary>queueing by load</secondary>
24153 </indexterm>
24154 If the system load average is higher than this value, incoming messages from
24155 all sources are queued, and no automatic deliveries are started. If this
24156 happens during local or remote SMTP input, all subsequent messages on the same
24157 connection are queued. Deliveries will subsequently be performed by queue
24158 runner processes. This option has no effect on ancient operating systems on
24159 which Exim cannot determine the load average. See also
24160 <option>deliver_queue_load_max</option> and <option>smtp_load_reserve</option>.
24161 </para>
24162 <para>
24163 <indexterm role="option">
24164 <primary>queue_only_override</primary>
24165 </indexterm>
24166 </para>
24167 <informaltable frame="all">
24168 <tgroup cols="4" colsep="0" rowsep="0">
24169 <colspec colwidth="8*" align="left"/>
24170 <colspec colwidth="5*" align="center"/>
24171 <colspec colwidth="5*" align="center"/>
24172 <colspec colwidth="6*" align="right"/>
24173 <tbody>
24174 <row>
24175 <entry><option>queue_only_override</option></entry>
24176 <entry>Use: <emphasis>main</emphasis></entry>
24177 <entry>Type: <emphasis>boolean</emphasis></entry>
24178 <entry>Default: <emphasis>true</emphasis></entry>
24179 </row>
24180 </tbody>
24181 </tgroup>
24182 </informaltable>
24183 <para>
24184 <indexterm role="concept">
24185 <primary>queueing incoming messages</primary>
24186 </indexterm>
24187 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
24188 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
24189 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
24190 to override; they are accepted, but ignored.
24191 </para>
24192 <para>
24193 <indexterm role="option">
24194 <primary>queue_run_in_order</primary>
24195 </indexterm>
24196 </para>
24197 <informaltable frame="all">
24198 <tgroup cols="4" colsep="0" rowsep="0">
24199 <colspec colwidth="8*" align="left"/>
24200 <colspec colwidth="5*" align="center"/>
24201 <colspec colwidth="5*" align="center"/>
24202 <colspec colwidth="6*" align="right"/>
24203 <tbody>
24204 <row>
24205 <entry><option>queue_run_in_order</option></entry>
24206 <entry>Use: <emphasis>main</emphasis></entry>
24207 <entry>Type: <emphasis>boolean</emphasis></entry>
24208 <entry>Default: <emphasis>false</emphasis></entry>
24209 </row>
24210 </tbody>
24211 </tgroup>
24212 </informaltable>
24213 <para>
24214 <indexterm role="concept">
24215 <primary>queue runner</primary>
24216 <secondary>processing messages in order</secondary>
24217 </indexterm>
24218 If this option is set, queue runs happen in order of message arrival instead of
24219 in an arbitrary order. For this to happen, a complete list of the entire queue
24220 must be set up before the deliveries start. When the queue is all held in a
24221 single directory (the default), a single list is created for both the ordered
24222 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
24223 single list is not created when <option>queue_run_in_order</option> is false. In this case,
24224 the sub-directories are processed one at a time (in a random order), and this
24225 avoids setting up one huge list for the whole queue. Thus, setting
24226 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
24227 when the queue is large, because of the extra work in setting up the single,
24228 large list. In most situations, <option>queue_run_in_order</option> should not be set.
24229 </para>
24230 <para>
24231 <indexterm role="option">
24232 <primary>queue_run_max</primary>
24233 </indexterm>
24234 </para>
24235 <informaltable frame="all">
24236 <tgroup cols="4" colsep="0" rowsep="0">
24237 <colspec colwidth="8*" align="left"/>
24238 <colspec colwidth="5*" align="center"/>
24239 <colspec colwidth="5*" align="center"/>
24240 <colspec colwidth="6*" align="right"/>
24241 <tbody>
24242 <row>
24243 <entry><option>queue_run_max</option></entry>
24244 <entry>Use: <emphasis>main</emphasis></entry>
24245 <entry>Type: <emphasis>integer</emphasis></entry>
24246 <entry>Default: <emphasis>5</emphasis></entry>
24247 </row>
24248 </tbody>
24249 </tgroup>
24250 </informaltable>
24251 <para>
24252 <indexterm role="concept">
24253 <primary>queue runner</primary>
24254 <secondary>maximum number of</secondary>
24255 </indexterm>
24256 This controls the maximum number of queue runner processes that an Exim daemon
24257 can run simultaneously. This does not mean that it starts them all at once,
24258 but rather that if the maximum number are still running when the time comes to
24259 start another one, it refrains from starting another one. This can happen with
24260 very large queues and/or very sluggish deliveries. This option does not,
24261 however, interlock with other processes, so additional queue runners can be
24262 started by other means, or by killing and restarting the daemon.
24263 </para>
24264 <para>
24265 Setting this option to zero does not suppress queue runs; rather, it disables
24266 the limit, allowing any number of simultaneous queue runner processes to be
24267 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
24268 the daemon&#x2019;s command line.
24269 </para>
24270 <para>
24271 <indexterm role="option">
24272 <primary>queue_smtp_domains</primary>
24273 </indexterm>
24274 </para>
24275 <informaltable frame="all">
24276 <tgroup cols="4" colsep="0" rowsep="0">
24277 <colspec colwidth="8*" align="left"/>
24278 <colspec colwidth="5*" align="center"/>
24279 <colspec colwidth="5*" align="center"/>
24280 <colspec colwidth="6*" align="right"/>
24281 <tbody>
24282 <row>
24283 <entry><option>queue_smtp_domains</option></entry>
24284 <entry>Use: <emphasis>main</emphasis></entry>
24285 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24286 <entry>Default: <emphasis>unset</emphasis></entry>
24287 </row>
24288 </tbody>
24289 </tgroup>
24290 </informaltable>
24291 <para>
24292 <indexterm role="concept">
24293 <primary>queueing incoming messages</primary>
24294 </indexterm>
24295 <indexterm role="concept">
24296 <primary>message</primary>
24297 <secondary>queueing remote deliveries</secondary>
24298 </indexterm>
24299 When this option is set, a delivery process is started whenever a message is
24300 received, routing is performed, and local deliveries take place.
24301 However, if any SMTP deliveries are required for domains that match
24302 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
24303 message waits on the queue for the next queue run. Since routing of the message
24304 has taken place, Exim knows to which remote hosts it must be delivered, and so
24305 when the queue run happens, multiple messages for the same host are delivered
24306 over a single SMTP connection. The <option>-odqs</option> command line option causes all
24307 SMTP deliveries to be queued in this way, and is equivalent to setting
24308 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
24309 <option>queue_domains</option>.
24310 </para>
24311 <para>
24312 <indexterm role="option">
24313 <primary>receive_timeout</primary>
24314 </indexterm>
24315 </para>
24316 <informaltable frame="all">
24317 <tgroup cols="4" colsep="0" rowsep="0">
24318 <colspec colwidth="8*" align="left"/>
24319 <colspec colwidth="5*" align="center"/>
24320 <colspec colwidth="5*" align="center"/>
24321 <colspec colwidth="6*" align="right"/>
24322 <tbody>
24323 <row>
24324 <entry><option>receive_timeout</option></entry>
24325 <entry>Use: <emphasis>main</emphasis></entry>
24326 <entry>Type: <emphasis>time</emphasis></entry>
24327 <entry>Default: <emphasis>0s</emphasis></entry>
24328 </row>
24329 </tbody>
24330 </tgroup>
24331 </informaltable>
24332 <para>
24333 <indexterm role="concept">
24334 <primary>timeout</primary>
24335 <secondary>for non-SMTP input</secondary>
24336 </indexterm>
24337 This option sets the timeout for accepting a non-SMTP message, that is, the
24338 maximum time that Exim waits when reading a message on the standard input. If
24339 the value is zero, it will wait for ever. This setting is overridden by the
24340 <option>-or</option> command line option. The timeout for incoming SMTP messages is
24341 controlled by <option>smtp_receive_timeout</option>.
24342 </para>
24343 <para>
24344 <indexterm role="option">
24345 <primary>received_header_text</primary>
24346 </indexterm>
24347 </para>
24348 <informaltable frame="all">
24349 <tgroup cols="4" colsep="0" rowsep="0">
24350 <colspec colwidth="8*" align="left"/>
24351 <colspec colwidth="5*" align="center"/>
24352 <colspec colwidth="5*" align="center"/>
24353 <colspec colwidth="6*" align="right"/>
24354 <tbody>
24355 <row>
24356 <entry><option>received_header_text</option></entry>
24357 <entry>Use: <emphasis>main</emphasis></entry>
24358 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24359 <entry>Default: <emphasis>see below</emphasis></entry>
24360 </row>
24361 </tbody>
24362 </tgroup>
24363 </informaltable>
24364 <para>
24365 <indexterm role="concept">
24366 <primary>customizing</primary>
24367 <secondary><emphasis>Received:</emphasis> header</secondary>
24368 </indexterm>
24369 <indexterm role="concept">
24370 <primary><emphasis>Received:</emphasis> header line</primary>
24371 <secondary>customizing</secondary>
24372 </indexterm>
24373 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
24374 added to each message, except for the timestamp, which is automatically added
24375 on at the end (preceded by a semicolon). The string is expanded each time it is
24376 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
24377 added to the message. Otherwise, the string should start with the text
24378 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
24379 header lines. The default setting is:
24380 </para>
24381 <literallayout class="monospaced">
24382 received_header_text = Received: \
24383   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
24384   {${if def:sender_ident \
24385   {from ${quote_local_part:$sender_ident} }}\
24386   ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
24387   by $primary_hostname \
24388   ${if def:received_protocol {with $received_protocol}} \
24389   ${if def:tls_cipher {($tls_cipher)\n\t}}\
24390   (Exim $version_number)\n\t\
24391   ${if def:sender_address \
24392   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
24393   id $message_exim_id\
24394   ${if def:received_for {\n\tfor $received_for}}
24395 </literallayout>
24396 <para>
24397 The reference to the TLS cipher is omitted when Exim is built without TLS
24398 support. The use of conditional expansions ensures that this works for both
24399 locally generated messages and messages received from remote hosts, giving
24400 header lines such as the following:
24401 </para>
24402 <literallayout class="monospaced">
24403 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
24404 by marley.carol.example with esmtp (Exim 4.00)
24405 (envelope-from &lt;bob@carol.example&gt;)
24406 id 16IOWa-00019l-00
24407 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
24408 Received: by scrooge.carol.example with local (Exim 4.00)
24409 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
24410 </literallayout>
24411 <para>
24412 Until the body of the message has been received, the timestamp is the time when
24413 the message started to be received. Once the body has arrived, and all policy
24414 checks have taken place, the timestamp is updated to the time at which the
24415 message was accepted.
24416 </para>
24417 <para>
24418 <indexterm role="option">
24419 <primary>received_headers_max</primary>
24420 </indexterm>
24421 </para>
24422 <informaltable frame="all">
24423 <tgroup cols="4" colsep="0" rowsep="0">
24424 <colspec colwidth="8*" align="left"/>
24425 <colspec colwidth="5*" align="center"/>
24426 <colspec colwidth="5*" align="center"/>
24427 <colspec colwidth="6*" align="right"/>
24428 <tbody>
24429 <row>
24430 <entry><option>received_headers_max</option></entry>
24431 <entry>Use: <emphasis>main</emphasis></entry>
24432 <entry>Type: <emphasis>integer</emphasis></entry>
24433 <entry>Default: <emphasis>30</emphasis></entry>
24434 </row>
24435 </tbody>
24436 </tgroup>
24437 </informaltable>
24438 <para>
24439 <indexterm role="concept">
24440 <primary>loop</primary>
24441 <secondary>prevention</secondary>
24442 </indexterm>
24443 <indexterm role="concept">
24444 <primary>mail loop prevention</primary>
24445 </indexterm>
24446 <indexterm role="concept">
24447 <primary><emphasis>Received:</emphasis> header line</primary>
24448 <secondary>counting</secondary>
24449 </indexterm>
24450 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
24451 counted, and if it is greater than this parameter, a mail loop is assumed to
24452 have occurred, the delivery is abandoned, and an error message is generated.
24453 This applies to both local and remote deliveries.
24454 </para>
24455 <para>
24456 <indexterm role="option">
24457 <primary>recipient_unqualified_hosts</primary>
24458 </indexterm>
24459 </para>
24460 <informaltable frame="all">
24461 <tgroup cols="4" colsep="0" rowsep="0">
24462 <colspec colwidth="8*" align="left"/>
24463 <colspec colwidth="5*" align="center"/>
24464 <colspec colwidth="5*" align="center"/>
24465 <colspec colwidth="6*" align="right"/>
24466 <tbody>
24467 <row>
24468 <entry><option>recipient_unqualified_hosts</option></entry>
24469 <entry>Use: <emphasis>main</emphasis></entry>
24470 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24471 <entry>Default: <emphasis>unset</emphasis></entry>
24472 </row>
24473 </tbody>
24474 </tgroup>
24475 </informaltable>
24476 <para>
24477 <indexterm role="concept">
24478 <primary>unqualified addresses</primary>
24479 </indexterm>
24480 <indexterm role="concept">
24481 <primary>host</primary>
24482 <secondary>unqualified addresses from</secondary>
24483 </indexterm>
24484 This option lists those hosts from which Exim is prepared to accept unqualified
24485 recipient addresses in message envelopes. The addresses are made fully
24486 qualified by the addition of the <option>qualify_recipient</option> value. This option also
24487 affects message header lines. Exim does not reject unqualified recipient
24488 addresses in headers, but it qualifies them only if the message came from a
24489 host that matches <option>recipient_unqualified_hosts</option>,
24490 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
24491 option was not set.
24492 </para>
24493 <para>
24494 <indexterm role="option">
24495 <primary>recipients_max</primary>
24496 </indexterm>
24497 </para>
24498 <informaltable frame="all">
24499 <tgroup cols="4" colsep="0" rowsep="0">
24500 <colspec colwidth="8*" align="left"/>
24501 <colspec colwidth="5*" align="center"/>
24502 <colspec colwidth="5*" align="center"/>
24503 <colspec colwidth="6*" align="right"/>
24504 <tbody>
24505 <row>
24506 <entry><option>recipients_max</option></entry>
24507 <entry>Use: <emphasis>main</emphasis></entry>
24508 <entry>Type: <emphasis>integer</emphasis></entry>
24509 <entry>Default: <emphasis>0</emphasis></entry>
24510 </row>
24511 </tbody>
24512 </tgroup>
24513 </informaltable>
24514 <para>
24515 <indexterm role="concept">
24516 <primary>limit</primary>
24517 <secondary>number of recipients</secondary>
24518 </indexterm>
24519 <indexterm role="concept">
24520 <primary>recipient</primary>
24521 <secondary>maximum number</secondary>
24522 </indexterm>
24523 If this option is set greater than zero, it specifies the maximum number of
24524 original recipients for any message. Additional recipients that are generated
24525 by aliasing or forwarding do not count. SMTP messages get a 452 response for
24526 all recipients over the limit; earlier recipients are delivered as normal.
24527 Non-SMTP messages with too many recipients are failed, and no deliveries are
24528 done.
24529 </para>
24530 <para>
24531 <indexterm role="concept">
24532 <primary>RCPT</primary>
24533 <secondary>maximum number of incoming</secondary>
24534 </indexterm>
24535 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
24536 RCPT commands in a single message.
24537 </para>
24538 <para>
24539 <indexterm role="option">
24540 <primary>recipients_max_reject</primary>
24541 </indexterm>
24542 </para>
24543 <informaltable frame="all">
24544 <tgroup cols="4" colsep="0" rowsep="0">
24545 <colspec colwidth="8*" align="left"/>
24546 <colspec colwidth="5*" align="center"/>
24547 <colspec colwidth="5*" align="center"/>
24548 <colspec colwidth="6*" align="right"/>
24549 <tbody>
24550 <row>
24551 <entry><option>recipients_max_reject</option></entry>
24552 <entry>Use: <emphasis>main</emphasis></entry>
24553 <entry>Type: <emphasis>boolean</emphasis></entry>
24554 <entry>Default: <emphasis>false</emphasis></entry>
24555 </row>
24556 </tbody>
24557 </tgroup>
24558 </informaltable>
24559 <para>
24560 If this option is set true, Exim rejects SMTP messages containing too many
24561 recipients by giving 552 errors to the surplus RCPT commands, and a 554
24562 error to the eventual DATA command. Otherwise (the default) it gives a 452
24563 error to the surplus RCPT commands and accepts the message on behalf of the
24564 initial set of recipients. The remote server should then re-send the message
24565 for the remaining recipients at a later time.
24566 </para>
24567 <para>
24568 <indexterm role="option">
24569 <primary>remote_max_parallel</primary>
24570 </indexterm>
24571 </para>
24572 <informaltable frame="all">
24573 <tgroup cols="4" colsep="0" rowsep="0">
24574 <colspec colwidth="8*" align="left"/>
24575 <colspec colwidth="5*" align="center"/>
24576 <colspec colwidth="5*" align="center"/>
24577 <colspec colwidth="6*" align="right"/>
24578 <tbody>
24579 <row>
24580 <entry><option>remote_max_parallel</option></entry>
24581 <entry>Use: <emphasis>main</emphasis></entry>
24582 <entry>Type: <emphasis>integer</emphasis></entry>
24583 <entry>Default: <emphasis>2</emphasis></entry>
24584 </row>
24585 </tbody>
24586 </tgroup>
24587 </informaltable>
24588 <para>
24589 <indexterm role="concept">
24590 <primary>delivery</primary>
24591 <secondary>parallelism for remote</secondary>
24592 </indexterm>
24593 This option controls parallel delivery of one message to a number of remote
24594 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
24595 does all the remote deliveries for a message one by one. Otherwise, if a single
24596 message has to be delivered to more than one remote host, or if several copies
24597 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
24598 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
24599 deliveries are required, the maximum number of processes are started, and as
24600 each one finishes, another is begun. The order of starting processes is the
24601 same as if sequential delivery were being done, and can be controlled by the
24602 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
24603 with debugging turned on, the debugging output from each delivery process is
24604 tagged with its process id.
24605 </para>
24606 <para>
24607 This option controls only the maximum number of parallel deliveries for one
24608 message in one Exim delivery process. Because Exim has no central queue
24609 manager, there is no way of controlling the total number of simultaneous
24610 deliveries if the configuration allows a delivery attempt as soon as a message
24611 is received.
24612 </para>
24613 <para>
24614 <indexterm role="concept">
24615 <primary>number of deliveries</primary>
24616 </indexterm>
24617 <indexterm role="concept">
24618 <primary>delivery</primary>
24619 <secondary>maximum number of</secondary>
24620 </indexterm>
24621 If you want to control the total number of deliveries on the system, you
24622 need to set the <option>queue_only</option> option. This ensures that all incoming messages
24623 are added to the queue without starting a delivery process. Then set up an Exim
24624 daemon to start queue runner processes at appropriate intervals (probably
24625 fairly often, for example, every minute), and limit the total number of queue
24626 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
24627 delivers only one message at a time, the maximum number of deliveries that can
24628 then take place at once is <option>queue_run_max</option> multiplied by
24629 <option>remote_max_parallel</option>.
24630 </para>
24631 <para>
24632 If it is purely remote deliveries you want to control, use
24633 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
24634 doing the SMTP routing before queuing, so that several messages for the same
24635 host will eventually get delivered down the same connection.
24636 </para>
24637 <para>
24638 <indexterm role="option">
24639 <primary>remote_sort_domains</primary>
24640 </indexterm>
24641 </para>
24642 <informaltable frame="all">
24643 <tgroup cols="4" colsep="0" rowsep="0">
24644 <colspec colwidth="8*" align="left"/>
24645 <colspec colwidth="5*" align="center"/>
24646 <colspec colwidth="5*" align="center"/>
24647 <colspec colwidth="6*" align="right"/>
24648 <tbody>
24649 <row>
24650 <entry><option>remote_sort_domains</option></entry>
24651 <entry>Use: <emphasis>main</emphasis></entry>
24652 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
24653 <entry>Default: <emphasis>unset</emphasis></entry>
24654 </row>
24655 </tbody>
24656 </tgroup>
24657 </informaltable>
24658 <para>
24659 <indexterm role="concept">
24660 <primary>sorting remote deliveries</primary>
24661 </indexterm>
24662 <indexterm role="concept">
24663 <primary>delivery</primary>
24664 <secondary>sorting remote</secondary>
24665 </indexterm>
24666 When there are a number of remote deliveries for a message, they are sorted by
24667 domain into the order given by this list. For example,
24668 </para>
24669 <literallayout class="monospaced">
24670 remote_sort_domains = *.cam.ac.uk:*.uk
24671 </literallayout>
24672 <para>
24673 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
24674 then to those in the <option>uk</option> domain, then to any others.
24675 </para>
24676 <para>
24677 <indexterm role="option">
24678 <primary>retry_data_expire</primary>
24679 </indexterm>
24680 </para>
24681 <informaltable frame="all">
24682 <tgroup cols="4" colsep="0" rowsep="0">
24683 <colspec colwidth="8*" align="left"/>
24684 <colspec colwidth="5*" align="center"/>
24685 <colspec colwidth="5*" align="center"/>
24686 <colspec colwidth="6*" align="right"/>
24687 <tbody>
24688 <row>
24689 <entry><option>retry_data_expire</option></entry>
24690 <entry>Use: <emphasis>main</emphasis></entry>
24691 <entry>Type: <emphasis>time</emphasis></entry>
24692 <entry>Default: <emphasis>7d</emphasis></entry>
24693 </row>
24694 </tbody>
24695 </tgroup>
24696 </informaltable>
24697 <para>
24698 <indexterm role="concept">
24699 <primary>hints database</primary>
24700 <secondary>data expiry</secondary>
24701 </indexterm>
24702 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
24703 database. Any older retry data is ignored. This means that, for example, once a
24704 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
24705 past failures.
24706 </para>
24707 <para>
24708 <indexterm role="option">
24709 <primary>retry_interval_max</primary>
24710 </indexterm>
24711 </para>
24712 <informaltable frame="all">
24713 <tgroup cols="4" colsep="0" rowsep="0">
24714 <colspec colwidth="8*" align="left"/>
24715 <colspec colwidth="5*" align="center"/>
24716 <colspec colwidth="5*" align="center"/>
24717 <colspec colwidth="6*" align="right"/>
24718 <tbody>
24719 <row>
24720 <entry><option>retry_interval_max</option></entry>
24721 <entry>Use: <emphasis>main</emphasis></entry>
24722 <entry>Type: <emphasis>time</emphasis></entry>
24723 <entry>Default: <emphasis>24h</emphasis></entry>
24724 </row>
24725 </tbody>
24726 </tgroup>
24727 </informaltable>
24728 <para>
24729 <indexterm role="concept">
24730 <primary>retry</primary>
24731 <secondary>limit on interval</secondary>
24732 </indexterm>
24733 <indexterm role="concept">
24734 <primary>limit</primary>
24735 <secondary>on retry interval</secondary>
24736 </indexterm>
24737 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
24738 intervals between delivery attempts for messages that cannot be delivered
24739 straight away. This option sets an overall limit to the length of time between
24740 retries. It cannot be set greater than 24 hours; any attempt to do so forces
24741 the default value.
24742 </para>
24743 <para>
24744 <indexterm role="option">
24745 <primary>return_path_remove</primary>
24746 </indexterm>
24747 </para>
24748 <informaltable frame="all">
24749 <tgroup cols="4" colsep="0" rowsep="0">
24750 <colspec colwidth="8*" align="left"/>
24751 <colspec colwidth="5*" align="center"/>
24752 <colspec colwidth="5*" align="center"/>
24753 <colspec colwidth="6*" align="right"/>
24754 <tbody>
24755 <row>
24756 <entry><option>return_path_remove</option></entry>
24757 <entry>Use: <emphasis>main</emphasis></entry>
24758 <entry>Type: <emphasis>boolean</emphasis></entry>
24759 <entry>Default: <emphasis>true</emphasis></entry>
24760 </row>
24761 </tbody>
24762 </tgroup>
24763 </informaltable>
24764 <para>
24765 <indexterm role="concept">
24766 <primary><emphasis>Return-path:</emphasis> header line</primary>
24767 <secondary>removing</secondary>
24768 </indexterm>
24769 RFC 2821, section 4.4, states that an SMTP server must insert a
24770 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
24771 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
24772 MAIL command. This description implies that this header should not be present
24773 in an incoming message. If <option>return_path_remove</option> is true, any existing
24774 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
24775 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
24776 the time of delivery. They are normally used only for final local deliveries.
24777 </para>
24778 <para>
24779 <indexterm role="option">
24780 <primary>return_size_limit</primary>
24781 </indexterm>
24782 </para>
24783 <informaltable frame="all">
24784 <tgroup cols="4" colsep="0" rowsep="0">
24785 <colspec colwidth="8*" align="left"/>
24786 <colspec colwidth="5*" align="center"/>
24787 <colspec colwidth="5*" align="center"/>
24788 <colspec colwidth="6*" align="right"/>
24789 <tbody>
24790 <row>
24791 <entry><option>return_size_limit</option></entry>
24792 <entry>Use: <emphasis>main</emphasis></entry>
24793 <entry>Type: <emphasis>integer</emphasis></entry>
24794 <entry>Default: <emphasis>100K</emphasis></entry>
24795 </row>
24796 </tbody>
24797 </tgroup>
24798 </informaltable>
24799 <para>
24800 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
24801 </para>
24802 <para>
24803 <indexterm role="option">
24804 <primary>rfc1413_hosts</primary>
24805 </indexterm>
24806 </para>
24807 <informaltable frame="all">
24808 <tgroup cols="4" colsep="0" rowsep="0">
24809 <colspec colwidth="8*" align="left"/>
24810 <colspec colwidth="5*" align="center"/>
24811 <colspec colwidth="5*" align="center"/>
24812 <colspec colwidth="6*" align="right"/>
24813 <tbody>
24814 <row>
24815 <entry><option>rfc1413_hosts</option></entry>
24816 <entry>Use: <emphasis>main</emphasis></entry>
24817 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24818 <entry>Default: <emphasis>*</emphasis></entry>
24819 </row>
24820 </tbody>
24821 </tgroup>
24822 </informaltable>
24823 <para>
24824 <indexterm role="concept">
24825 <primary>RFC 1413</primary>
24826 </indexterm>
24827 <indexterm role="concept">
24828 <primary>host</primary>
24829 <secondary>for RFC 1413 calls</secondary>
24830 </indexterm>
24831 RFC 1413 identification calls are made to any client host which matches an item
24832 in the list.
24833 </para>
24834 <para>
24835 <indexterm role="option">
24836 <primary>rfc1413_query_timeout</primary>
24837 </indexterm>
24838 </para>
24839 <informaltable frame="all">
24840 <tgroup cols="4" colsep="0" rowsep="0">
24841 <colspec colwidth="8*" align="left"/>
24842 <colspec colwidth="5*" align="center"/>
24843 <colspec colwidth="5*" align="center"/>
24844 <colspec colwidth="6*" align="right"/>
24845 <tbody>
24846 <row>
24847 <entry><option>rfc1413_query_timeout</option></entry>
24848 <entry>Use: <emphasis>main</emphasis></entry>
24849 <entry>Type: <emphasis>time</emphasis></entry>
24850 <entry>Default: <emphasis>5s</emphasis></entry>
24851 </row>
24852 </tbody>
24853 </tgroup>
24854 </informaltable>
24855 <para>
24856 <indexterm role="concept">
24857 <primary>RFC 1413</primary>
24858 <secondary>query timeout</secondary>
24859 </indexterm>
24860 <indexterm role="concept">
24861 <primary>timeout</primary>
24862 <secondary>for RFC 1413 call</secondary>
24863 </indexterm>
24864 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
24865 no RFC 1413 calls are ever made.
24866 </para>
24867 <para>
24868 <indexterm role="option">
24869 <primary>sender_unqualified_hosts</primary>
24870 </indexterm>
24871 </para>
24872 <informaltable frame="all">
24873 <tgroup cols="4" colsep="0" rowsep="0">
24874 <colspec colwidth="8*" align="left"/>
24875 <colspec colwidth="5*" align="center"/>
24876 <colspec colwidth="5*" align="center"/>
24877 <colspec colwidth="6*" align="right"/>
24878 <tbody>
24879 <row>
24880 <entry><option>sender_unqualified_hosts</option></entry>
24881 <entry>Use: <emphasis>main</emphasis></entry>
24882 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
24883 <entry>Default: <emphasis>unset</emphasis></entry>
24884 </row>
24885 </tbody>
24886 </tgroup>
24887 </informaltable>
24888 <para>
24889 <indexterm role="concept">
24890 <primary>unqualified addresses</primary>
24891 </indexterm>
24892 <indexterm role="concept">
24893 <primary>host</primary>
24894 <secondary>unqualified addresses from</secondary>
24895 </indexterm>
24896 This option lists those hosts from which Exim is prepared to accept unqualified
24897 sender addresses. The addresses are made fully qualified by the addition of
24898 <option>qualify_domain</option>. This option also affects message header lines. Exim does
24899 not reject unqualified addresses in headers that contain sender addresses, but
24900 it qualifies them only if the message came from a host that matches
24901 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
24902 using TCP/IP), and the <option>-bnq</option> option was not set.
24903 </para>
24904 <para>
24905 <indexterm role="option">
24906 <primary>smtp_accept_keepalive</primary>
24907 </indexterm>
24908 </para>
24909 <informaltable frame="all">
24910 <tgroup cols="4" colsep="0" rowsep="0">
24911 <colspec colwidth="8*" align="left"/>
24912 <colspec colwidth="5*" align="center"/>
24913 <colspec colwidth="5*" align="center"/>
24914 <colspec colwidth="6*" align="right"/>
24915 <tbody>
24916 <row>
24917 <entry><option>smtp_accept_keepalive</option></entry>
24918 <entry>Use: <emphasis>main</emphasis></entry>
24919 <entry>Type: <emphasis>boolean</emphasis></entry>
24920 <entry>Default: <emphasis>true</emphasis></entry>
24921 </row>
24922 </tbody>
24923 </tgroup>
24924 </informaltable>
24925 <para>
24926 <indexterm role="concept">
24927 <primary>keepalive</primary>
24928 <secondary>on incoming connection</secondary>
24929 </indexterm>
24930 This option controls the setting of the SO_KEEPALIVE option on incoming
24931 TCP/IP socket connections. When set, it causes the kernel to probe idle
24932 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
24933 other end of the connection should send an acknowledgement if the connection is
24934 still okay or a reset if the connection has been aborted. The reason for doing
24935 this is that it has the beneficial effect of freeing up certain types of
24936 connection that can get stuck when the remote host is disconnected without
24937 tidying up the TCP/IP call properly. The keepalive mechanism takes several
24938 hours to detect unreachable hosts.
24939 </para>
24940 <para>
24941 <indexterm role="option">
24942 <primary>smtp_accept_max</primary>
24943 </indexterm>
24944 </para>
24945 <informaltable frame="all">
24946 <tgroup cols="4" colsep="0" rowsep="0">
24947 <colspec colwidth="8*" align="left"/>
24948 <colspec colwidth="5*" align="center"/>
24949 <colspec colwidth="5*" align="center"/>
24950 <colspec colwidth="6*" align="right"/>
24951 <tbody>
24952 <row>
24953 <entry><option>smtp_accept_max</option></entry>
24954 <entry>Use: <emphasis>main</emphasis></entry>
24955 <entry>Type: <emphasis>integer</emphasis></entry>
24956 <entry>Default: <emphasis>20</emphasis></entry>
24957 </row>
24958 </tbody>
24959 </tgroup>
24960 </informaltable>
24961 <para>
24962 <indexterm role="concept">
24963 <primary>limit</primary>
24964 <secondary>incoming SMTP connections</secondary>
24965 </indexterm>
24966 <indexterm role="concept">
24967 <primary>SMTP</primary>
24968 <secondary>incoming connection count</secondary>
24969 </indexterm>
24970 <indexterm role="concept">
24971 <primary>inetd</primary>
24972 </indexterm>
24973 This option specifies the maximum number of simultaneous incoming SMTP calls
24974 that Exim will accept. It applies only to the listening daemon; there is no
24975 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
24976 value is set to zero, no limit is applied. However, it is required to be
24977 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
24978 set. See also <option>smtp_accept_reserve</option>.
24979 </para>
24980 <para>
24981 <indexterm role="option">
24982 <primary>smtp_accept_max_nonmail</primary>
24983 </indexterm>
24984 </para>
24985 <informaltable frame="all">
24986 <tgroup cols="4" colsep="0" rowsep="0">
24987 <colspec colwidth="8*" align="left"/>
24988 <colspec colwidth="5*" align="center"/>
24989 <colspec colwidth="5*" align="center"/>
24990 <colspec colwidth="6*" align="right"/>
24991 <tbody>
24992 <row>
24993 <entry><option>smtp_accept_max_nonmail</option></entry>
24994 <entry>Use: <emphasis>main</emphasis></entry>
24995 <entry>Type: <emphasis>integer</emphasis></entry>
24996 <entry>Default: <emphasis>10</emphasis></entry>
24997 </row>
24998 </tbody>
24999 </tgroup>
25000 </informaltable>
25001 <para>
25002 <indexterm role="concept">
25003 <primary>limit</primary>
25004 <secondary>non-mail SMTP commands</secondary>
25005 </indexterm>
25006 <indexterm role="concept">
25007 <primary>SMTP</primary>
25008 <secondary>limiting non-mail commands</secondary>
25009 </indexterm>
25010 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
25011 the connection if there are too many. This option defines <quote>too many</quote>. The
25012 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
25013 client looping sending EHLO, for example. The check is applied only if the
25014 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
25015 </para>
25016 <para>
25017 When a new message is expected, one occurrence of RSET is not counted. This
25018 allows a client to send one RSET between messages (this is not necessary,
25019 but some clients do it). Exim also allows one uncounted occurence of HELO
25020 or EHLO, and one occurrence of STARTTLS between messages. After
25021 starting up a TLS session, another EHLO is expected, and so it too is not
25022 counted. The first occurrence of AUTH in a connection, or immediately
25023 following STARTTLS is not counted. Otherwise, all commands other than
25024 MAIL, RCPT, DATA, and QUIT are counted.
25025 </para>
25026 <para>
25027 <indexterm role="option">
25028 <primary>smtp_accept_max_nonmail_hosts</primary>
25029 </indexterm>
25030 </para>
25031 <informaltable frame="all">
25032 <tgroup cols="4" colsep="0" rowsep="0">
25033 <colspec colwidth="8*" align="left"/>
25034 <colspec colwidth="5*" align="center"/>
25035 <colspec colwidth="5*" align="center"/>
25036 <colspec colwidth="6*" align="right"/>
25037 <tbody>
25038 <row>
25039 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
25040 <entry>Use: <emphasis>main</emphasis></entry>
25041 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25042 <entry>Default: <emphasis>*</emphasis></entry>
25043 </row>
25044 </tbody>
25045 </tgroup>
25046 </informaltable>
25047 <para>
25048 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
25049 check by setting this option. The default value makes it apply to all hosts. By
25050 changing the value, you can exclude any badly-behaved hosts that you have to
25051 live with.
25052 </para>
25053 <para>
25054 <indexterm role="option">
25055 <primary>smtp_accept_max_per_connection</primary>
25056 </indexterm>
25057 </para>
25058 <informaltable frame="all">
25059 <tgroup cols="4" colsep="0" rowsep="0">
25060 <colspec colwidth="8*" align="left"/>
25061 <colspec colwidth="5*" align="center"/>
25062 <colspec colwidth="5*" align="center"/>
25063 <colspec colwidth="6*" align="right"/>
25064 <tbody>
25065 <row>
25066 <entry><option>smtp_accept_max_per_connection</option></entry>
25067 <entry>Use: <emphasis>main</emphasis></entry>
25068 <entry>Type: <emphasis>integer</emphasis></entry>
25069 <entry>Default: <emphasis>1000</emphasis></entry>
25070 </row>
25071 </tbody>
25072 </tgroup>
25073 </informaltable>
25074 <para>
25075 <indexterm role="concept">
25076 <primary>SMTP incoming message count</primary>
25077 <secondary>limiting</secondary>
25078 </indexterm>
25079 <indexterm role="concept">
25080 <primary>limit</primary>
25081 <secondary>messages per SMTP connection</secondary>
25082 </indexterm>
25083 The value of this option limits the number of MAIL commands that Exim is
25084 prepared to accept over a single SMTP connection, whether or not each command
25085 results in the transfer of a message. After the limit is reached, a 421
25086 response is given to subsequent MAIL commands. This limit is a safety
25087 precaution against a client that goes mad (incidents of this type have been
25088 seen).
25089 </para>
25090 <para>
25091 <indexterm role="option">
25092 <primary>smtp_accept_max_per_host</primary>
25093 </indexterm>
25094 </para>
25095 <informaltable frame="all">
25096 <tgroup cols="4" colsep="0" rowsep="0">
25097 <colspec colwidth="8*" align="left"/>
25098 <colspec colwidth="5*" align="center"/>
25099 <colspec colwidth="5*" align="center"/>
25100 <colspec colwidth="6*" align="right"/>
25101 <tbody>
25102 <row>
25103 <entry><option>smtp_accept_max_per_host</option></entry>
25104 <entry>Use: <emphasis>main</emphasis></entry>
25105 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25106 <entry>Default: <emphasis>unset</emphasis></entry>
25107 </row>
25108 </tbody>
25109 </tgroup>
25110 </informaltable>
25111 <para>
25112 <indexterm role="concept">
25113 <primary>limit</primary>
25114 <secondary>SMTP connections from one host</secondary>
25115 </indexterm>
25116 <indexterm role="concept">
25117 <primary>host</primary>
25118 <secondary>limiting SMTP connections from</secondary>
25119 </indexterm>
25120 This option restricts the number of simultaneous IP connections from a single
25121 host (strictly, from a single IP address) to the Exim daemon. The option is
25122 expanded, to enable different limits to be applied to different hosts by
25123 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
25124 connection attempts from the same host are rejected with error code 421. The
25125 default value of zero imposes no limit. If this option is set, it is required
25126 that <option>smtp_accept_max</option> be non-zero.
25127 </para>
25128 <para>
25129 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
25130 constructions that take an appreciable amount of time. The expansion and test
25131 happen in the main daemon loop, in order to reject additional connections
25132 without forking additional processes (otherwise a denial-of-service attack
25133 could cause a vast number or processes to be created). While the daemon is
25134 doing this processing, it cannot accept any other incoming connections.
25135 </para>
25136 <para>
25137 <indexterm role="option">
25138 <primary>smtp_accept_queue</primary>
25139 </indexterm>
25140 </para>
25141 <informaltable frame="all">
25142 <tgroup cols="4" colsep="0" rowsep="0">
25143 <colspec colwidth="8*" align="left"/>
25144 <colspec colwidth="5*" align="center"/>
25145 <colspec colwidth="5*" align="center"/>
25146 <colspec colwidth="6*" align="right"/>
25147 <tbody>
25148 <row>
25149 <entry><option>smtp_accept_queue</option></entry>
25150 <entry>Use: <emphasis>main</emphasis></entry>
25151 <entry>Type: <emphasis>integer</emphasis></entry>
25152 <entry>Default: <emphasis>0</emphasis></entry>
25153 </row>
25154 </tbody>
25155 </tgroup>
25156 </informaltable>
25157 <para>
25158 <indexterm role="concept">
25159 <primary>SMTP</primary>
25160 <secondary>incoming connection count</secondary>
25161 </indexterm>
25162 <indexterm role="concept">
25163 <primary>queueing incoming messages</primary>
25164 </indexterm>
25165 <indexterm role="concept">
25166 <primary>message</primary>
25167 <secondary>queueing by SMTP connection count</secondary>
25168 </indexterm>
25169 If the number of simultaneous incoming SMTP calls handled via the listening
25170 daemon exceeds this value, messages received by SMTP are just placed on the
25171 queue; no delivery processes are started automatically. A value of zero implies
25172 no limit, and clearly any non-zero value is useful only if it is less than the
25173 <option>smtp_accept_max</option> value (unless that is zero). See also <option>queue_only</option>,
25174 <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the various <option>-od</option><emphasis>x</emphasis>
25175 command line options.
25176 </para>
25177 <para>
25178 <indexterm role="option">
25179 <primary>smtp_accept_queue_per_connection</primary>
25180 </indexterm>
25181 </para>
25182 <informaltable frame="all">
25183 <tgroup cols="4" colsep="0" rowsep="0">
25184 <colspec colwidth="8*" align="left"/>
25185 <colspec colwidth="5*" align="center"/>
25186 <colspec colwidth="5*" align="center"/>
25187 <colspec colwidth="6*" align="right"/>
25188 <tbody>
25189 <row>
25190 <entry><option>smtp_accept_queue_per_connection</option></entry>
25191 <entry>Use: <emphasis>main</emphasis></entry>
25192 <entry>Type: <emphasis>integer</emphasis></entry>
25193 <entry>Default: <emphasis>10</emphasis></entry>
25194 </row>
25195 </tbody>
25196 </tgroup>
25197 </informaltable>
25198 <para>
25199 <indexterm role="concept">
25200 <primary>queueing incoming messages</primary>
25201 </indexterm>
25202 <indexterm role="concept">
25203 <primary>message</primary>
25204 <secondary>queueing by message count</secondary>
25205 </indexterm>
25206 This option limits the number of delivery processes that Exim starts
25207 automatically when receiving messages via SMTP, whether via the daemon or by
25208 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
25209 and the number of messages received in a single SMTP session exceeds this
25210 number, subsequent messages are placed on the queue, but no delivery processes
25211 are started. This helps to limit the number of Exim processes when a server
25212 restarts after downtime and there is a lot of mail waiting for it on other
25213 systems. On large systems, the default should probably be increased, and on
25214 dial-in client systems it should probably be set to zero (that is, disabled).
25215 </para>
25216 <para>
25217 <indexterm role="option">
25218 <primary>smtp_accept_reserve</primary>
25219 </indexterm>
25220 </para>
25221 <informaltable frame="all">
25222 <tgroup cols="4" colsep="0" rowsep="0">
25223 <colspec colwidth="8*" align="left"/>
25224 <colspec colwidth="5*" align="center"/>
25225 <colspec colwidth="5*" align="center"/>
25226 <colspec colwidth="6*" align="right"/>
25227 <tbody>
25228 <row>
25229 <entry><option>smtp_accept_reserve</option></entry>
25230 <entry>Use: <emphasis>main</emphasis></entry>
25231 <entry>Type: <emphasis>integer</emphasis></entry>
25232 <entry>Default: <emphasis>0</emphasis></entry>
25233 </row>
25234 </tbody>
25235 </tgroup>
25236 </informaltable>
25237 <para>
25238 <indexterm role="concept">
25239 <primary>SMTP</primary>
25240 <secondary>incoming call count</secondary>
25241 </indexterm>
25242 <indexterm role="concept">
25243 <primary>host</primary>
25244 <secondary>reserved</secondary>
25245 </indexterm>
25246 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
25247 number of SMTP connections that are reserved for connections from the hosts
25248 that are specified in <option>smtp_reserve_hosts</option>. The value set in
25249 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
25250 restricted to this number of connections; the option specifies a minimum number
25251 of connection slots for them, not a maximum. It is a guarantee that that group
25252 of hosts can always get at least <option>smtp_accept_reserve</option> connections.
25253 </para>
25254 <para>
25255 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
25256 set to 5, once there are 45 active connections (from any hosts), new
25257 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>.
25258 See also <option>smtp_accept_max_per_host</option>.
25259 </para>
25260 <para>
25261 <indexterm role="option">
25262 <primary>smtp_active_hostname</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_active_hostname</option></entry>
25274 <entry>Use: <emphasis>main</emphasis></entry>
25275 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25276 <entry>Default: <emphasis>unset</emphasis></entry>
25277 </row>
25278 </tbody>
25279 </tgroup>
25280 </informaltable>
25281 <para>
25282 <indexterm role="concept">
25283 <primary>host</primary>
25284 <secondary>name in SMTP responses</secondary>
25285 </indexterm>
25286 <indexterm role="concept">
25287 <primary>SMTP</primary>
25288 <secondary>host name in responses</secondary>
25289 </indexterm>
25290 <indexterm role="concept">
25291 <primary><varname>$primary_hostname</varname></primary>
25292 </indexterm>
25293 This option is provided for multi-homed servers that want to masquerade as
25294 several different hosts. At the start of an SMTP connection, its value is
25295 expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
25296 responses. For example, it is used as domain name in the response to an
25297 incoming HELO or EHLO command.
25298 </para>
25299 <para>
25300 <indexterm role="concept">
25301 <primary><varname>$smtp_active_hostname</varname></primary>
25302 </indexterm>
25303 It is also used in HELO commands for callout verification. The active hostname
25304 is placed in the <varname>$smtp_active_hostname</varname> variable, which is saved with any
25305 messages that are received. It is therefore available for use in routers and
25306 transports when the message is later delivered.
25307 </para>
25308 <para>
25309 If this option is unset, or if its expansion is forced to fail, or if the
25310 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
25311 used. Other expansion failures cause a message to be written to the main and
25312 panic logs, and the SMTP command receives a temporary error. Typically, the
25313 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
25314 For example:
25315 </para>
25316 <literallayout class="monospaced">
25317 smtp_active_hostname = ${if eq{$interface_address}{10.0.0.1}\
25318   {cox.mydomain}{box.mydomain}}
25319 </literallayout>
25320 <para>
25321 <indexterm role="option">
25322 <primary>smtp_banner</primary>
25323 </indexterm>
25324 </para>
25325 <informaltable frame="all">
25326 <tgroup cols="4" colsep="0" rowsep="0">
25327 <colspec colwidth="8*" align="left"/>
25328 <colspec colwidth="5*" align="center"/>
25329 <colspec colwidth="5*" align="center"/>
25330 <colspec colwidth="6*" align="right"/>
25331 <tbody>
25332 <row>
25333 <entry><option>smtp_banner</option></entry>
25334 <entry>Use: <emphasis>main</emphasis></entry>
25335 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25336 <entry>Default: <emphasis>see below</emphasis></entry>
25337 </row>
25338 </tbody>
25339 </tgroup>
25340 </informaltable>
25341 <para>
25342 <indexterm role="concept">
25343 <primary>SMTP</primary>
25344 <secondary>welcome banner</secondary>
25345 </indexterm>
25346 <indexterm role="concept">
25347 <primary>banner for SMTP</primary>
25348 </indexterm>
25349 <indexterm role="concept">
25350 <primary>welcome banner for SMTP</primary>
25351 </indexterm>
25352 <indexterm role="concept">
25353 <primary>customizing</primary>
25354 <secondary>SMTP banner</secondary>
25355 </indexterm>
25356 This string, which is expanded every time it is used, is output as the initial
25357 positive response to an SMTP connection. The default setting is:
25358 </para>
25359 <literallayout class="monospaced">
25360 smtp_banner = $smtp_active_hostname ESMTP Exim \
25361   $version_number $tod_full
25362 </literallayout>
25363 <para>
25364 Failure to expand the string causes a panic error. If you want to create a
25365 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
25366 appropriate points, but not at the end. Note that the 220 code is not included
25367 in this string. Exim adds it automatically (several times in the case of a
25368 multiline response).
25369 </para>
25370 <para>
25371 <indexterm role="option">
25372 <primary>smtp_check_spool_space</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_check_spool_space</option></entry>
25384 <entry>Use: <emphasis>main</emphasis></entry>
25385 <entry>Type: <emphasis>boolean</emphasis></entry>
25386 <entry>Default: <emphasis>true</emphasis></entry>
25387 </row>
25388 </tbody>
25389 </tgroup>
25390 </informaltable>
25391 <para>
25392 <indexterm role="concept">
25393 <primary>checking disk space</primary>
25394 </indexterm>
25395 <indexterm role="concept">
25396 <primary>disk space</primary>
25397 <secondary>checking</secondary>
25398 </indexterm>
25399 <indexterm role="concept">
25400 <primary>spool directory</primary>
25401 <secondary>checking space</secondary>
25402 </indexterm>
25403 When this option is set, if an incoming SMTP session encounters the SIZE
25404 option on a MAIL command, it checks that there is enough space in the
25405 spool directory&#x2019;s partition to accept a message of that size, while still
25406 leaving free the amount specified by <option>check_spool_space</option> (even if that value
25407 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
25408 </para>
25409 <para>
25410 <indexterm role="option">
25411 <primary>smtp_connect_backlog</primary>
25412 </indexterm>
25413 </para>
25414 <informaltable frame="all">
25415 <tgroup cols="4" colsep="0" rowsep="0">
25416 <colspec colwidth="8*" align="left"/>
25417 <colspec colwidth="5*" align="center"/>
25418 <colspec colwidth="5*" align="center"/>
25419 <colspec colwidth="6*" align="right"/>
25420 <tbody>
25421 <row>
25422 <entry><option>smtp_connect_backlog</option></entry>
25423 <entry>Use: <emphasis>main</emphasis></entry>
25424 <entry>Type: <emphasis>integer</emphasis></entry>
25425 <entry>Default: <emphasis>20</emphasis></entry>
25426 </row>
25427 </tbody>
25428 </tgroup>
25429 </informaltable>
25430 <para>
25431 <indexterm role="concept">
25432 <primary>connection backlog</primary>
25433 </indexterm>
25434 <indexterm role="concept">
25435 <primary>SMTP</primary>
25436 <secondary>connection backlog</secondary>
25437 </indexterm>
25438 <indexterm role="concept">
25439 <primary>backlog of connections</primary>
25440 </indexterm>
25441 This option specifies a maximum number of waiting SMTP connections. Exim passes
25442 this value to the TCP/IP system when it sets up its listener. Once this number
25443 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
25444 attempts are refused at the TCP/IP level. At least, that is what the manuals
25445 say; in some circumstances such connection attempts have been observed to time
25446 out instead. For large systems it is probably a good idea to increase the
25447 value (to 50, say). It also gives some protection against denial-of-service
25448 attacks by SYN flooding.
25449 </para>
25450 <para>
25451 <indexterm role="option">
25452 <primary>smtp_enforce_sync</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_enforce_sync</option></entry>
25464 <entry>Use: <emphasis>main</emphasis></entry>
25465 <entry>Type: <emphasis>boolean</emphasis></entry>
25466 <entry>Default: <emphasis>true</emphasis></entry>
25467 </row>
25468 </tbody>
25469 </tgroup>
25470 </informaltable>
25471 <para>
25472 <indexterm role="concept">
25473 <primary>SMTP</primary>
25474 <secondary>synchronization checking</secondary>
25475 </indexterm>
25476 <indexterm role="concept">
25477 <primary>synchronization checking in SMTP</primary>
25478 </indexterm>
25479 The SMTP protocol specification requires the client to wait for a response from
25480 the server at certain points in the dialogue. Without PIPELINING these
25481 synchronization points are after every command; with PIPELINING they are
25482 fewer, but they still exist.
25483 </para>
25484 <para>
25485 Some spamming sites send out a complete set of SMTP commands without waiting
25486 for any response. Exim protects against this by rejecting a message if the
25487 client has sent further input when it should not have. The error response <quote>554
25488 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
25489 for this error cannot be perfect because of transmission delays (unexpected
25490 input may be on its way but not yet received when Exim checks). However, it
25491 does detect many instances.
25492 </para>
25493 <para>
25494 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
25495 If you want to disable the check selectively (for example, only for certain
25496 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
25497 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
25498 </para>
25499 <para>
25500 <indexterm role="option">
25501 <primary>smtp_etrn_command</primary>
25502 </indexterm>
25503 </para>
25504 <informaltable frame="all">
25505 <tgroup cols="4" colsep="0" rowsep="0">
25506 <colspec colwidth="8*" align="left"/>
25507 <colspec colwidth="5*" align="center"/>
25508 <colspec colwidth="5*" align="center"/>
25509 <colspec colwidth="6*" align="right"/>
25510 <tbody>
25511 <row>
25512 <entry><option>smtp_etrn_command</option></entry>
25513 <entry>Use: <emphasis>main</emphasis></entry>
25514 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25515 <entry>Default: <emphasis>unset</emphasis></entry>
25516 </row>
25517 </tbody>
25518 </tgroup>
25519 </informaltable>
25520 <para>
25521 <indexterm role="concept">
25522 <primary>ETRN</primary>
25523 <secondary>command to be run</secondary>
25524 </indexterm>
25525 <indexterm role="concept">
25526 <primary><varname>$domain</varname></primary>
25527 </indexterm>
25528 If this option is set, the given command is run whenever an SMTP ETRN
25529 command is received from a host that is permitted to issue such commands (see
25530 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
25531 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
25532 argument of the ETRN command, and no syntax checking is done on it. For
25533 example:
25534 </para>
25535 <literallayout class="monospaced">
25536 smtp_etrn_command = /etc/etrn_command $domain \
25537                     $sender_host_address
25538 </literallayout>
25539 <para>
25540 A new process is created to run the command, but Exim does not wait for it to
25541 complete. Consequently, its status cannot be checked. If the command cannot be
25542 run, a line is written to the panic log, but the ETRN caller still receives
25543 a 250 success response. Exim is normally running under its own uid when
25544 receiving SMTP, so it is not possible for it to change the uid before running
25545 the command.
25546 </para>
25547 <para>
25548 <indexterm role="option">
25549 <primary>smtp_etrn_serialize</primary>
25550 </indexterm>
25551 </para>
25552 <informaltable frame="all">
25553 <tgroup cols="4" colsep="0" rowsep="0">
25554 <colspec colwidth="8*" align="left"/>
25555 <colspec colwidth="5*" align="center"/>
25556 <colspec colwidth="5*" align="center"/>
25557 <colspec colwidth="6*" align="right"/>
25558 <tbody>
25559 <row>
25560 <entry><option>smtp_etrn_serialize</option></entry>
25561 <entry>Use: <emphasis>main</emphasis></entry>
25562 <entry>Type: <emphasis>boolean</emphasis></entry>
25563 <entry>Default: <emphasis>true</emphasis></entry>
25564 </row>
25565 </tbody>
25566 </tgroup>
25567 </informaltable>
25568 <para>
25569 <indexterm role="concept">
25570 <primary>ETRN</primary>
25571 <secondary>serializing</secondary>
25572 </indexterm>
25573 When this option is set, it prevents the simultaneous execution of more than
25574 one identical command as a result of ETRN in an SMTP connection. See
25575 section <xref linkend="SECTETRN"/> for details.
25576 </para>
25577 <para>
25578 <indexterm role="option">
25579 <primary>smtp_load_reserve</primary>
25580 </indexterm>
25581 </para>
25582 <informaltable frame="all">
25583 <tgroup cols="4" colsep="0" rowsep="0">
25584 <colspec colwidth="8*" align="left"/>
25585 <colspec colwidth="5*" align="center"/>
25586 <colspec colwidth="5*" align="center"/>
25587 <colspec colwidth="6*" align="right"/>
25588 <tbody>
25589 <row>
25590 <entry><option>smtp_load_reserve</option></entry>
25591 <entry>Use: <emphasis>main</emphasis></entry>
25592 <entry>Type: <emphasis>fixed-point</emphasis></entry>
25593 <entry>Default: <emphasis>unset</emphasis></entry>
25594 </row>
25595 </tbody>
25596 </tgroup>
25597 </informaltable>
25598 <para>
25599 <indexterm role="concept">
25600 <primary>load average</primary>
25601 </indexterm>
25602 If the system load average ever gets higher than this, incoming SMTP calls are
25603 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
25604 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
25605 the load is over the limit. The option has no effect on ancient operating
25606 systems on which Exim cannot determine the load average. See also
25607 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
25608 </para>
25609 <para>
25610 <indexterm role="option">
25611 <primary>smtp_max_synprot_errors</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_max_synprot_errors</option></entry>
25623 <entry>Use: <emphasis>main</emphasis></entry>
25624 <entry>Type: <emphasis>integer</emphasis></entry>
25625 <entry>Default: <emphasis>3</emphasis></entry>
25626 </row>
25627 </tbody>
25628 </tgroup>
25629 </informaltable>
25630 <para>
25631 <indexterm role="concept">
25632 <primary>SMTP</primary>
25633 <secondary>limiting syntax and protocol errors</secondary>
25634 </indexterm>
25635 <indexterm role="concept">
25636 <primary>limit</primary>
25637 <secondary>SMTP syntax and protocol errors</secondary>
25638 </indexterm>
25639 Exim rejects SMTP commands that contain syntax or protocol errors. In
25640 particular, a syntactically invalid email address, as in this command:
25641 </para>
25642 <literallayout class="monospaced">
25643 RCPT TO:&lt;abc xyz@a.b.c&gt;
25644 </literallayout>
25645 <para>
25646 causes immediate rejection of the command, before any other tests are done.
25647 (The ACL cannot be run if there is no valid address to set up for it.) An
25648 example of a protocol error is receiving RCPT before MAIL. If there are
25649 too many syntax or protocol errors in one SMTP session, the connection is
25650 dropped. The limit is set by this option.
25651 </para>
25652 <para>
25653 <indexterm role="concept">
25654 <primary>PIPELINING</primary>
25655 <secondary>expected errors</secondary>
25656 </indexterm>
25657 When the PIPELINING extension to SMTP is in use, some protocol errors are
25658 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
25659 Exim assumes that PIPELINING will be used if it advertises it (see
25660 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
25661 not count towards the limit.
25662 </para>
25663 <para>
25664 <indexterm role="option">
25665 <primary>smtp_max_unknown_commands</primary>
25666 </indexterm>
25667 </para>
25668 <informaltable frame="all">
25669 <tgroup cols="4" colsep="0" rowsep="0">
25670 <colspec colwidth="8*" align="left"/>
25671 <colspec colwidth="5*" align="center"/>
25672 <colspec colwidth="5*" align="center"/>
25673 <colspec colwidth="6*" align="right"/>
25674 <tbody>
25675 <row>
25676 <entry><option>smtp_max_unknown_commands</option></entry>
25677 <entry>Use: <emphasis>main</emphasis></entry>
25678 <entry>Type: <emphasis>integer</emphasis></entry>
25679 <entry>Default: <emphasis>3</emphasis></entry>
25680 </row>
25681 </tbody>
25682 </tgroup>
25683 </informaltable>
25684 <para>
25685 <indexterm role="concept">
25686 <primary>SMTP</primary>
25687 <secondary>limiting unknown commands</secondary>
25688 </indexterm>
25689 <indexterm role="concept">
25690 <primary>limit</primary>
25691 <secondary>unknown SMTP commands</secondary>
25692 </indexterm>
25693 If there are too many unrecognized commands in an incoming SMTP session, an
25694 Exim server drops the connection. This is a defence against some kinds of abuse
25695 that subvert web
25696 clients
25697 into making connections to SMTP ports; in these circumstances, a number of
25698 non-SMTP command lines are sent first.
25699 </para>
25700 <para>
25701 <indexterm role="option">
25702 <primary>smtp_ratelimit_hosts</primary>
25703 </indexterm>
25704 </para>
25705 <informaltable frame="all">
25706 <tgroup cols="4" colsep="0" rowsep="0">
25707 <colspec colwidth="8*" align="left"/>
25708 <colspec colwidth="5*" align="center"/>
25709 <colspec colwidth="5*" align="center"/>
25710 <colspec colwidth="6*" align="right"/>
25711 <tbody>
25712 <row>
25713 <entry><option>smtp_ratelimit_hosts</option></entry>
25714 <entry>Use: <emphasis>main</emphasis></entry>
25715 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25716 <entry>Default: <emphasis>unset</emphasis></entry>
25717 </row>
25718 </tbody>
25719 </tgroup>
25720 </informaltable>
25721 <para>
25722 <indexterm role="concept">
25723 <primary>SMTP</primary>
25724 <secondary>rate limiting</secondary>
25725 </indexterm>
25726 <indexterm role="concept">
25727 <primary>limit</primary>
25728 <secondary>rate of message arrival</secondary>
25729 </indexterm>
25730 <indexterm role="concept">
25731 <primary>RCPT</primary>
25732 <secondary>rate limiting</secondary>
25733 </indexterm>
25734 Some sites find it helpful to be able to limit the rate at which certain hosts
25735 can send them messages, and the rate at which an individual message can specify
25736 recipients.
25737 </para>
25738 <para>
25739 Exim has two rate-limiting facilities. This section describes the older
25740 facility, which can limit rates within a single connection. The newer
25741 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
25742 <xref linkend="SECTratelimiting"/> for details of the newer facility.
25743 </para>
25744 <para>
25745 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
25746 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
25747 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
25748 respectively. Each option, if set, must contain a set of four comma-separated
25749 values:
25750 </para>
25751 <itemizedlist>
25752 <listitem>
25753 <para>
25754 A threshold, before which there is no rate limiting.
25755 </para>
25756 </listitem>
25757 <listitem>
25758 <para>
25759 An initial time delay. Unlike other times in Exim, numbers with decimal
25760 fractional parts are allowed here.
25761 </para>
25762 </listitem>
25763 <listitem>
25764 <para>
25765 A factor by which to increase the delay each time.
25766 </para>
25767 </listitem>
25768 <listitem>
25769 <para>
25770 A maximum value for the delay. This should normally be less than 5 minutes,
25771 because after that time, the client is liable to timeout the SMTP command.
25772 </para>
25773 </listitem>
25774 </itemizedlist>
25775 <para>
25776 For example, these settings have been used successfully at the site which
25777 first suggested this feature, for controlling mail from their customers:
25778 </para>
25779 <literallayout class="monospaced">
25780 smtp_ratelimit_mail = 2,0.5s,1.05,4m
25781 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
25782 </literallayout>
25783 <para>
25784 The first setting specifies delays that are applied to MAIL commands after
25785 two have been received over a single connection. The initial delay is 0.5
25786 seconds, increasing by a factor of 1.05 each time. The second setting applies
25787 delays to RCPT commands when more than four occur in a single message.
25788 </para>
25789 <para>
25790 <indexterm role="option">
25791 <primary>smtp_ratelimit_mail</primary>
25792 </indexterm>
25793 </para>
25794 <informaltable frame="all">
25795 <tgroup cols="4" colsep="0" rowsep="0">
25796 <colspec colwidth="8*" align="left"/>
25797 <colspec colwidth="5*" align="center"/>
25798 <colspec colwidth="5*" align="center"/>
25799 <colspec colwidth="6*" align="right"/>
25800 <tbody>
25801 <row>
25802 <entry><option>smtp_ratelimit_mail</option></entry>
25803 <entry>Use: <emphasis>main</emphasis></entry>
25804 <entry>Type: <emphasis>string</emphasis></entry>
25805 <entry>Default: <emphasis>unset</emphasis></entry>
25806 </row>
25807 </tbody>
25808 </tgroup>
25809 </informaltable>
25810 <para>
25811 See <option>smtp_ratelimit_hosts</option> above.
25812 </para>
25813 <para>
25814 <indexterm role="option">
25815 <primary>smtp_ratelimit_rcpt</primary>
25816 </indexterm>
25817 </para>
25818 <informaltable frame="all">
25819 <tgroup cols="4" colsep="0" rowsep="0">
25820 <colspec colwidth="8*" align="left"/>
25821 <colspec colwidth="5*" align="center"/>
25822 <colspec colwidth="5*" align="center"/>
25823 <colspec colwidth="6*" align="right"/>
25824 <tbody>
25825 <row>
25826 <entry><option>smtp_ratelimit_rcpt</option></entry>
25827 <entry>Use: <emphasis>main</emphasis></entry>
25828 <entry>Type: <emphasis>string</emphasis></entry>
25829 <entry>Default: <emphasis>unset</emphasis></entry>
25830 </row>
25831 </tbody>
25832 </tgroup>
25833 </informaltable>
25834 <para>
25835 See <option>smtp_ratelimit_hosts</option> above.
25836 </para>
25837 <para>
25838 <indexterm role="option">
25839 <primary>smtp_receive_timeout</primary>
25840 </indexterm>
25841 </para>
25842 <informaltable frame="all">
25843 <tgroup cols="4" colsep="0" rowsep="0">
25844 <colspec colwidth="8*" align="left"/>
25845 <colspec colwidth="5*" align="center"/>
25846 <colspec colwidth="5*" align="center"/>
25847 <colspec colwidth="6*" align="right"/>
25848 <tbody>
25849 <row>
25850 <entry><option>smtp_receive_timeout</option></entry>
25851 <entry>Use: <emphasis>main</emphasis></entry>
25852 <entry>Type: <emphasis>time</emphasis></entry>
25853 <entry>Default: <emphasis>5m</emphasis></entry>
25854 </row>
25855 </tbody>
25856 </tgroup>
25857 </informaltable>
25858 <para>
25859 <indexterm role="concept">
25860 <primary>timeout</primary>
25861 <secondary>for SMTP input</secondary>
25862 </indexterm>
25863 <indexterm role="concept">
25864 <primary>SMTP timeout</primary>
25865 <secondary>input</secondary>
25866 </indexterm>
25867 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
25868 input, including batch SMTP. If a line of input (either an SMTP command or a
25869 data line) is not received within this time, the SMTP connection is dropped and
25870 the message is abandoned.
25871 A line is written to the log containing one of the following messages:
25872 </para>
25873 <literallayout class="monospaced">
25874 SMTP command timeout on connection from...
25875 SMTP data timeout on connection from...
25876 </literallayout>
25877 <para>
25878 The former means that Exim was expecting to read an SMTP command; the latter
25879 means that it was in the DATA phase, reading the contents of a message.
25880 </para>
25881 <para>
25882 <indexterm role="concept">
25883 <primary><option>-os</option> option</primary>
25884 </indexterm>
25885 The value set by this option can be overridden by the
25886 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
25887 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
25888 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
25889 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
25890 </para>
25891 <para>
25892 <indexterm role="option">
25893 <primary>smtp_reserve_hosts</primary>
25894 </indexterm>
25895 </para>
25896 <informaltable frame="all">
25897 <tgroup cols="4" colsep="0" rowsep="0">
25898 <colspec colwidth="8*" align="left"/>
25899 <colspec colwidth="5*" align="center"/>
25900 <colspec colwidth="5*" align="center"/>
25901 <colspec colwidth="6*" align="right"/>
25902 <tbody>
25903 <row>
25904 <entry><option>smtp_reserve_hosts</option></entry>
25905 <entry>Use: <emphasis>main</emphasis></entry>
25906 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25907 <entry>Default: <emphasis>unset</emphasis></entry>
25908 </row>
25909 </tbody>
25910 </tgroup>
25911 </informaltable>
25912 <para>
25913 This option defines hosts for which SMTP connections are reserved; see
25914 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
25915 </para>
25916 <para>
25917 <indexterm role="option">
25918 <primary>smtp_return_error_details</primary>
25919 </indexterm>
25920 </para>
25921 <informaltable frame="all">
25922 <tgroup cols="4" colsep="0" rowsep="0">
25923 <colspec colwidth="8*" align="left"/>
25924 <colspec colwidth="5*" align="center"/>
25925 <colspec colwidth="5*" align="center"/>
25926 <colspec colwidth="6*" align="right"/>
25927 <tbody>
25928 <row>
25929 <entry><option>smtp_return_error_details</option></entry>
25930 <entry>Use: <emphasis>main</emphasis></entry>
25931 <entry>Type: <emphasis>boolean</emphasis></entry>
25932 <entry>Default: <emphasis>false</emphasis></entry>
25933 </row>
25934 </tbody>
25935 </tgroup>
25936 </informaltable>
25937 <para>
25938 <indexterm role="concept">
25939 <primary>SMTP</primary>
25940 <secondary>details policy failures</secondary>
25941 </indexterm>
25942 <indexterm role="concept">
25943 <primary>policy control rejection</primary>
25944 <secondary>returning details</secondary>
25945 </indexterm>
25946 In the default state, Exim uses bland messages such as
25947 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
25948 reasons. Many sysadmins like this because it gives away little information
25949 to spammers. However, some other syadmins who are applying strict checking
25950 policies want to give out much fuller information about failures. Setting
25951 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
25952 example, instead of <quote>Administrative prohibition</quote>, it might give:
25953 </para>
25954 <literallayout class="monospaced">
25955 550-Rejected after DATA: '&gt;' missing at end of address:
25956 550 failing address in "From" header is: &lt;user@dom.ain
25957 </literallayout>
25958 <para>
25959 <indexterm role="option">
25960 <primary>spamd_address</primary>
25961 </indexterm>
25962 </para>
25963 <informaltable frame="all">
25964 <tgroup cols="4" colsep="0" rowsep="0">
25965 <colspec colwidth="8*" align="left"/>
25966 <colspec colwidth="5*" align="center"/>
25967 <colspec colwidth="5*" align="center"/>
25968 <colspec colwidth="6*" align="right"/>
25969 <tbody>
25970 <row>
25971 <entry><option>spamd_address</option></entry>
25972 <entry>Use: <emphasis>main</emphasis></entry>
25973 <entry>Type: <emphasis>string</emphasis></entry>
25974 <entry>Default: <emphasis>see below</emphasis></entry>
25975 </row>
25976 </tbody>
25977 </tgroup>
25978 </informaltable>
25979 <para>
25980 This option is available when Exim is compiled with the content-scanning
25981 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
25982 The default value is
25983 </para>
25984 <literallayout class="monospaced">
25985 127.0.0.1 783
25986 </literallayout>
25987 <para>
25988 See section <xref linkend="SECTscanspamass"/> for more details.
25989 </para>
25990 <para>
25991 <indexterm role="option">
25992 <primary>split_spool_directory</primary>
25993 </indexterm>
25994 </para>
25995 <informaltable frame="all">
25996 <tgroup cols="4" colsep="0" rowsep="0">
25997 <colspec colwidth="8*" align="left"/>
25998 <colspec colwidth="5*" align="center"/>
25999 <colspec colwidth="5*" align="center"/>
26000 <colspec colwidth="6*" align="right"/>
26001 <tbody>
26002 <row>
26003 <entry><option>split_spool_directory</option></entry>
26004 <entry>Use: <emphasis>main</emphasis></entry>
26005 <entry>Type: <emphasis>boolean</emphasis></entry>
26006 <entry>Default: <emphasis>false</emphasis></entry>
26007 </row>
26008 </tbody>
26009 </tgroup>
26010 </informaltable>
26011 <para>
26012 <indexterm role="concept">
26013 <primary>multiple spool directories</primary>
26014 </indexterm>
26015 <indexterm role="concept">
26016 <primary>spool directory</primary>
26017 <secondary>split</secondary>
26018 </indexterm>
26019 <indexterm role="concept">
26020 <primary>directories</primary>
26021 <secondary>multiple</secondary>
26022 </indexterm>
26023 If this option is set, it causes Exim to split its input directory into 62
26024 subdirectories, each with a single alphanumeric character as its name. The
26025 sixth character of the message id is used to allocate messages to
26026 subdirectories; this is the least significant base-62 digit of the time of
26027 arrival of the message.
26028 </para>
26029 <para>
26030 Splitting up the spool in this way may provide better performance on systems
26031 where there are long mail queues, by reducing the number of files in any one
26032 directory. The msglog directory is also split up in a similar way to the input
26033 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
26034 are still placed in the single directory <filename>msglog.OLD</filename>.
26035 </para>
26036 <para>
26037 It is not necessary to take any special action for existing messages when
26038 changing <option>split_spool_directory</option>. Exim notices messages that are in the
26039 <quote>wrong</quote> place, and continues to process them. If the option is turned off
26040 after a period of being on, the subdirectories will eventually empty and be
26041 automatically deleted.
26042 </para>
26043 <para>
26044 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
26045 changes. Instead of creating a list of all messages in the queue, and then
26046 trying to deliver each one in turn, it constructs a list of those in one
26047 sub-directory and tries to deliver them, before moving on to the next
26048 sub-directory. The sub-directories are processed in a random order. This
26049 spreads out the scanning of the input directories, and uses less memory. It is
26050 particularly beneficial when there are lots of messages on the queue. However,
26051 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
26052 entire queue has to be scanned and sorted before any deliveries can start.
26053 </para>
26054 <para>
26055 <indexterm role="option">
26056 <primary>spool_directory</primary>
26057 </indexterm>
26058 </para>
26059 <informaltable frame="all">
26060 <tgroup cols="4" colsep="0" rowsep="0">
26061 <colspec colwidth="8*" align="left"/>
26062 <colspec colwidth="5*" align="center"/>
26063 <colspec colwidth="5*" align="center"/>
26064 <colspec colwidth="6*" align="right"/>
26065 <tbody>
26066 <row>
26067 <entry><option>spool_directory</option></entry>
26068 <entry>Use: <emphasis>main</emphasis></entry>
26069 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26070 <entry>Default: <emphasis>set at compile time</emphasis></entry>
26071 </row>
26072 </tbody>
26073 </tgroup>
26074 </informaltable>
26075 <para>
26076 <indexterm role="concept">
26077 <primary>spool directory</primary>
26078 <secondary>path to</secondary>
26079 </indexterm>
26080 This defines the directory in which Exim keeps its spool, that is, the messages
26081 it is waiting to deliver. The default value is taken from the compile-time
26082 configuration setting, if there is one. If not, this option must be set. The
26083 string is expanded, so it can contain, for example, a reference to
26084 <varname>$primary_hostname</varname>.
26085 </para>
26086 <para>
26087 If the spool directory name is fixed on your installation, it is recommended
26088 that you set it at build time rather than from this option, particularly if the
26089 log files are being written to the spool directory (see <option>log_file_path</option>).
26090 Otherwise log files cannot be used for errors that are detected early on, such
26091 as failures in the configuration file.
26092 </para>
26093 <para>
26094 By using this option to override the compiled-in path, it is possible to run
26095 tests of Exim without using the standard spool.
26096 </para>
26097 <para>
26098 <indexterm role="option">
26099 <primary>sqlite_lock_timeout</primary>
26100 </indexterm>
26101 </para>
26102 <informaltable frame="all">
26103 <tgroup cols="4" colsep="0" rowsep="0">
26104 <colspec colwidth="8*" align="left"/>
26105 <colspec colwidth="5*" align="center"/>
26106 <colspec colwidth="5*" align="center"/>
26107 <colspec colwidth="6*" align="right"/>
26108 <tbody>
26109 <row>
26110 <entry><option>sqlite_lock_timeout</option></entry>
26111 <entry>Use: <emphasis>main</emphasis></entry>
26112 <entry>Type: <emphasis>time</emphasis></entry>
26113 <entry>Default: <emphasis>5s</emphasis></entry>
26114 </row>
26115 </tbody>
26116 </tgroup>
26117 </informaltable>
26118 <para>
26119 <indexterm role="concept">
26120 <primary>sqlite</primary>
26121 <secondary>lock timeout</secondary>
26122 </indexterm>
26123 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
26124 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
26125 </para>
26126 <para>
26127 <indexterm role="option">
26128 <primary>strip_excess_angle_brackets</primary>
26129 </indexterm>
26130 </para>
26131 <informaltable frame="all">
26132 <tgroup cols="4" colsep="0" rowsep="0">
26133 <colspec colwidth="8*" align="left"/>
26134 <colspec colwidth="5*" align="center"/>
26135 <colspec colwidth="5*" align="center"/>
26136 <colspec colwidth="6*" align="right"/>
26137 <tbody>
26138 <row>
26139 <entry><option>strip_excess_angle_brackets</option></entry>
26140 <entry>Use: <emphasis>main</emphasis></entry>
26141 <entry>Type: <emphasis>boolean</emphasis></entry>
26142 <entry>Default: <emphasis>false</emphasis></entry>
26143 </row>
26144 </tbody>
26145 </tgroup>
26146 </informaltable>
26147 <para>
26148 <indexterm role="concept">
26149 <primary>angle brackets</primary>
26150 <secondary>excess</secondary>
26151 </indexterm>
26152 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
26153 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
26154 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
26155 passed on to another MTA, the excess angle brackets are not passed on. If this
26156 option is not set, multiple pairs of angle brackets cause a syntax error.
26157 </para>
26158 <para>
26159 <indexterm role="option">
26160 <primary>strip_trailing_dot</primary>
26161 </indexterm>
26162 </para>
26163 <informaltable frame="all">
26164 <tgroup cols="4" colsep="0" rowsep="0">
26165 <colspec colwidth="8*" align="left"/>
26166 <colspec colwidth="5*" align="center"/>
26167 <colspec colwidth="5*" align="center"/>
26168 <colspec colwidth="6*" align="right"/>
26169 <tbody>
26170 <row>
26171 <entry><option>strip_trailing_dot</option></entry>
26172 <entry>Use: <emphasis>main</emphasis></entry>
26173 <entry>Type: <emphasis>boolean</emphasis></entry>
26174 <entry>Default: <emphasis>false</emphasis></entry>
26175 </row>
26176 </tbody>
26177 </tgroup>
26178 </informaltable>
26179 <para>
26180 <indexterm role="concept">
26181 <primary>trailing dot on domain</primary>
26182 </indexterm>
26183 <indexterm role="concept">
26184 <primary>dot</primary>
26185 <secondary>trailing on domain</secondary>
26186 </indexterm>
26187 If this option is set, a trailing dot at the end of a domain in an address is
26188 ignored. If this is in the envelope and the message is passed on to another
26189 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
26190 domain causes a syntax error.
26191 However, addresses in header lines are checked only when an ACL requests header
26192 syntax checking.
26193 </para>
26194 <para>
26195 <indexterm role="option">
26196 <primary>syslog_duplication</primary>
26197 </indexterm>
26198 </para>
26199 <informaltable frame="all">
26200 <tgroup cols="4" colsep="0" rowsep="0">
26201 <colspec colwidth="8*" align="left"/>
26202 <colspec colwidth="5*" align="center"/>
26203 <colspec colwidth="5*" align="center"/>
26204 <colspec colwidth="6*" align="right"/>
26205 <tbody>
26206 <row>
26207 <entry><option>syslog_duplication</option></entry>
26208 <entry>Use: <emphasis>main</emphasis></entry>
26209 <entry>Type: <emphasis>boolean</emphasis></entry>
26210 <entry>Default: <emphasis>true</emphasis></entry>
26211 </row>
26212 </tbody>
26213 </tgroup>
26214 </informaltable>
26215 <para>
26216 <indexterm role="concept">
26217 <primary>syslog</primary>
26218 <secondary>duplicate log lines; suppressing</secondary>
26219 </indexterm>
26220 When Exim is logging to syslog, it writes the log lines for its three
26221 separate logs at different syslog priorities so that they can in principle
26222 be separated on the logging hosts. Some installations do not require this
26223 separation, and in those cases, the duplication of certain log lines is a
26224 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
26225 particular log line is written to syslog. For lines that normally go to
26226 both the main log and the reject log, the reject log version (possibly
26227 containing message header lines) is written, at LOG_NOTICE priority.
26228 Lines that normally go to both the main and the panic log are written at
26229 the LOG_ALERT priority.
26230 </para>
26231 <para>
26232 <indexterm role="option">
26233 <primary>syslog_facility</primary>
26234 </indexterm>
26235 </para>
26236 <informaltable frame="all">
26237 <tgroup cols="4" colsep="0" rowsep="0">
26238 <colspec colwidth="8*" align="left"/>
26239 <colspec colwidth="5*" align="center"/>
26240 <colspec colwidth="5*" align="center"/>
26241 <colspec colwidth="6*" align="right"/>
26242 <tbody>
26243 <row>
26244 <entry><option>syslog_facility</option></entry>
26245 <entry>Use: <emphasis>main</emphasis></entry>
26246 <entry>Type: <emphasis>string</emphasis></entry>
26247 <entry>Default: <emphasis>unset</emphasis></entry>
26248 </row>
26249 </tbody>
26250 </tgroup>
26251 </informaltable>
26252 <para>
26253 <indexterm role="concept">
26254 <primary>syslog</primary>
26255 <secondary>facility; setting</secondary>
26256 </indexterm>
26257 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
26258 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
26259 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
26260 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
26261 details of Exim&#x2019;s logging.
26262 </para>
26263 <para>
26264 <indexterm role="option">
26265 <primary>syslog_processname</primary>
26266 </indexterm>
26267 </para>
26268 <informaltable frame="all">
26269 <tgroup cols="4" colsep="0" rowsep="0">
26270 <colspec colwidth="8*" align="left"/>
26271 <colspec colwidth="5*" align="center"/>
26272 <colspec colwidth="5*" align="center"/>
26273 <colspec colwidth="6*" align="right"/>
26274 <tbody>
26275 <row>
26276 <entry><option>syslog_processname</option></entry>
26277 <entry>Use: <emphasis>main</emphasis></entry>
26278 <entry>Type: <emphasis>string</emphasis></entry>
26279 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
26280 </row>
26281 </tbody>
26282 </tgroup>
26283 </informaltable>
26284 <para>
26285 <indexterm role="concept">
26286 <primary>syslog</primary>
26287 <secondary>process name; setting</secondary>
26288 </indexterm>
26289 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
26290 syslog. The value must be no longer than 32 characters. See chapter
26291 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
26292 </para>
26293 <para>
26294 <indexterm role="option">
26295 <primary>syslog_timestamp</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>syslog_timestamp</option></entry>
26307 <entry>Use: <emphasis>main</emphasis></entry>
26308 <entry>Type: <emphasis>boolean</emphasis></entry>
26309 <entry>Default: <emphasis>true</emphasis></entry>
26310 </row>
26311 </tbody>
26312 </tgroup>
26313 </informaltable>
26314 <para>
26315 <indexterm role="concept">
26316 <primary>syslog</primary>
26317 <secondary>timestamps</secondary>
26318 </indexterm>
26319 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
26320 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
26321 details of Exim&#x2019;s logging.
26322 </para>
26323 <para>
26324 <indexterm role="option">
26325 <primary>system_filter</primary>
26326 </indexterm>
26327 </para>
26328 <informaltable frame="all">
26329 <tgroup cols="4" colsep="0" rowsep="0">
26330 <colspec colwidth="8*" align="left"/>
26331 <colspec colwidth="5*" align="center"/>
26332 <colspec colwidth="5*" align="center"/>
26333 <colspec colwidth="6*" align="right"/>
26334 <tbody>
26335 <row>
26336 <entry><option>system_filter</option></entry>
26337 <entry>Use: <emphasis>main</emphasis></entry>
26338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26339 <entry>Default: <emphasis>unset</emphasis></entry>
26340 </row>
26341 </tbody>
26342 </tgroup>
26343 </informaltable>
26344 <para>
26345 <indexterm role="concept">
26346 <primary>filter</primary>
26347 <secondary>system filter</secondary>
26348 </indexterm>
26349 <indexterm role="concept">
26350 <primary>system filter</primary>
26351 <secondary>specifying</secondary>
26352 </indexterm>
26353 <indexterm role="concept">
26354 <primary>Sieve filter</primary>
26355 <secondary>not available for system filter</secondary>
26356 </indexterm>
26357 This option specifies an Exim filter file that is applied to all messages at
26358 the start of each delivery attempt, before any routing is done. System filters
26359 must be Exim filters; they cannot be Sieve filters. If the system filter
26360 generates any deliveries to files or pipes, or any new mail messages, the
26361 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
26362 which transports are to be used. Details of this facility are given in chapter
26363 <xref linkend="CHAPsystemfilter"/>.
26364 </para>
26365 <para>
26366 <indexterm role="option">
26367 <primary>system_filter_directory_transport</primary>
26368 </indexterm>
26369 </para>
26370 <informaltable frame="all">
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>system_filter_directory_transport</option></entry>
26379 <entry>Use: <emphasis>main</emphasis></entry>
26380 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26381 <entry>Default: <emphasis>unset</emphasis></entry>
26382 </row>
26383 </tbody>
26384 </tgroup>
26385 </informaltable>
26386 <para>
26387 <indexterm role="concept">
26388 <primary><varname>$address_file</varname></primary>
26389 </indexterm>
26390 This sets the name of the transport driver that is to be used when the
26391 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
26392 implying delivery of each message into a separate file in some directory.
26393 During the delivery, the variable <varname>$address_file</varname> contains the path name.
26394 </para>
26395 <para>
26396 <indexterm role="option">
26397 <primary>system_filter_file_transport</primary>
26398 </indexterm>
26399 </para>
26400 <informaltable frame="all">
26401 <tgroup cols="4" colsep="0" rowsep="0">
26402 <colspec colwidth="8*" align="left"/>
26403 <colspec colwidth="5*" align="center"/>
26404 <colspec colwidth="5*" align="center"/>
26405 <colspec colwidth="6*" align="right"/>
26406 <tbody>
26407 <row>
26408 <entry><option>system_filter_file_transport</option></entry>
26409 <entry>Use: <emphasis>main</emphasis></entry>
26410 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26411 <entry>Default: <emphasis>unset</emphasis></entry>
26412 </row>
26413 </tbody>
26414 </tgroup>
26415 </informaltable>
26416 <para>
26417 <indexterm role="concept">
26418 <primary>file</primary>
26419 <secondary>transport for system filter</secondary>
26420 </indexterm>
26421 This sets the name of the transport driver that is to be used when the <option>save</option>
26422 command in a system message filter specifies a path not ending in <quote>/</quote>. During
26423 the delivery, the variable <varname>$address_file</varname> contains the path name.
26424 </para>
26425 <para>
26426 <indexterm role="option">
26427 <primary>system_filter_group</primary>
26428 </indexterm>
26429 </para>
26430 <informaltable frame="all">
26431 <tgroup cols="4" colsep="0" rowsep="0">
26432 <colspec colwidth="8*" align="left"/>
26433 <colspec colwidth="5*" align="center"/>
26434 <colspec colwidth="5*" align="center"/>
26435 <colspec colwidth="6*" align="right"/>
26436 <tbody>
26437 <row>
26438 <entry><option>system_filter_group</option></entry>
26439 <entry>Use: <emphasis>main</emphasis></entry>
26440 <entry>Type: <emphasis>string</emphasis></entry>
26441 <entry>Default: <emphasis>unset</emphasis></entry>
26442 </row>
26443 </tbody>
26444 </tgroup>
26445 </informaltable>
26446 <para>
26447 <indexterm role="concept">
26448 <primary>gid (group id)</primary>
26449 <secondary>system filter</secondary>
26450 </indexterm>
26451 This option is used only when <option>system_filter_user</option> is also set. It sets the
26452 gid under which the system filter is run, overriding any gid that is associated
26453 with the user. The value may be numerical or symbolic.
26454 </para>
26455 <para>
26456 <indexterm role="option">
26457 <primary>system_filter_pipe_transport</primary>
26458 </indexterm>
26459 </para>
26460 <informaltable frame="all">
26461 <tgroup cols="4" colsep="0" rowsep="0">
26462 <colspec colwidth="8*" align="left"/>
26463 <colspec colwidth="5*" align="center"/>
26464 <colspec colwidth="5*" align="center"/>
26465 <colspec colwidth="6*" align="right"/>
26466 <tbody>
26467 <row>
26468 <entry><option>system_filter_pipe_transport</option></entry>
26469 <entry>Use: <emphasis>main</emphasis></entry>
26470 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26471 <entry>Default: <emphasis>unset</emphasis></entry>
26472 </row>
26473 </tbody>
26474 </tgroup>
26475 </informaltable>
26476 <para>
26477 <indexterm role="concept">
26478 <primary><command>pipe</command> transport</primary>
26479 <secondary>for system filter</secondary>
26480 </indexterm>
26481 <indexterm role="concept">
26482 <primary><varname>$address_pipe</varname></primary>
26483 </indexterm>
26484 This specifies the transport driver that is to be used when a <option>pipe</option> command
26485 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
26486 contains the pipe command.
26487 </para>
26488 <para>
26489 <indexterm role="option">
26490 <primary>system_filter_reply_transport</primary>
26491 </indexterm>
26492 </para>
26493 <informaltable frame="all">
26494 <tgroup cols="4" colsep="0" rowsep="0">
26495 <colspec colwidth="8*" align="left"/>
26496 <colspec colwidth="5*" align="center"/>
26497 <colspec colwidth="5*" align="center"/>
26498 <colspec colwidth="6*" align="right"/>
26499 <tbody>
26500 <row>
26501 <entry><option>system_filter_reply_transport</option></entry>
26502 <entry>Use: <emphasis>main</emphasis></entry>
26503 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26504 <entry>Default: <emphasis>unset</emphasis></entry>
26505 </row>
26506 </tbody>
26507 </tgroup>
26508 </informaltable>
26509 <para>
26510 <indexterm role="concept">
26511 <primary><command>autoreply</command> transport</primary>
26512 <secondary>for system filter</secondary>
26513 </indexterm>
26514 This specifies the transport driver that is to be used when a <option>mail</option> command
26515 is used in a system filter.
26516 </para>
26517 <para>
26518 <indexterm role="option">
26519 <primary>system_filter_user</primary>
26520 </indexterm>
26521 </para>
26522 <informaltable frame="all">
26523 <tgroup cols="4" colsep="0" rowsep="0">
26524 <colspec colwidth="8*" align="left"/>
26525 <colspec colwidth="5*" align="center"/>
26526 <colspec colwidth="5*" align="center"/>
26527 <colspec colwidth="6*" align="right"/>
26528 <tbody>
26529 <row>
26530 <entry><option>system_filter_user</option></entry>
26531 <entry>Use: <emphasis>main</emphasis></entry>
26532 <entry>Type: <emphasis>string</emphasis></entry>
26533 <entry>Default: <emphasis>unset</emphasis></entry>
26534 </row>
26535 </tbody>
26536 </tgroup>
26537 </informaltable>
26538 <para>
26539 <indexterm role="concept">
26540 <primary>uid (user id)</primary>
26541 <secondary>system filter</secondary>
26542 </indexterm>
26543 If this option is not set, the system filter is run in the main Exim delivery
26544 process, as root. When the option is set, the system filter runs in a separate
26545 process, as the given user. Unless the string consists entirely of digits, it
26546 is looked up in the password data. Failure to find the named user causes a
26547 configuration error. The gid is either taken from the password data, or
26548 specified by <option>system_filter_group</option>. When the uid is specified numerically,
26549 <option>system_filter_group</option> is required to be set.
26550 </para>
26551 <para>
26552 If the system filter generates any pipe, file, or reply deliveries, the uid
26553 under which the filter is run is used when transporting them, unless a
26554 transport option overrides. Normally you should set <option>system_filter_user</option> if
26555 your system filter generates these kinds of delivery.
26556 </para>
26557 <para>
26558 <indexterm role="option">
26559 <primary>tcp_nodelay</primary>
26560 </indexterm>
26561 </para>
26562 <informaltable frame="all">
26563 <tgroup cols="4" colsep="0" rowsep="0">
26564 <colspec colwidth="8*" align="left"/>
26565 <colspec colwidth="5*" align="center"/>
26566 <colspec colwidth="5*" align="center"/>
26567 <colspec colwidth="6*" align="right"/>
26568 <tbody>
26569 <row>
26570 <entry><option>tcp_nodelay</option></entry>
26571 <entry>Use: <emphasis>main</emphasis></entry>
26572 <entry>Type: <emphasis>boolean</emphasis></entry>
26573 <entry>Default: <emphasis>true</emphasis></entry>
26574 </row>
26575 </tbody>
26576 </tgroup>
26577 </informaltable>
26578 <para>
26579 <indexterm role="concept">
26580 <primary>daemon</primary>
26581 <secondary>TCP_NODELAY on sockets</secondary>
26582 </indexterm>
26583 <indexterm role="concept">
26584 <primary>Nagle algorithm</primary>
26585 </indexterm>
26586 <indexterm role="concept">
26587 <primary>TCP_NODELAY on listening sockets</primary>
26588 </indexterm>
26589 If this option is set false, it stops the Exim daemon setting the
26590 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
26591 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
26592 performance in interactive (character-by-character) situations. Turning it off
26593 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
26594 However, it appears that some broken clients cannot cope, and time out. Hence
26595 this option. It affects only those sockets that are set up for listening by the
26596 daemon. Sockets created by the smtp transport for delivering mail always set
26597 TCP_NODELAY.
26598 </para>
26599 <para>
26600 <indexterm role="option">
26601 <primary>timeout_frozen_after</primary>
26602 </indexterm>
26603 </para>
26604 <informaltable frame="all">
26605 <tgroup cols="4" colsep="0" rowsep="0">
26606 <colspec colwidth="8*" align="left"/>
26607 <colspec colwidth="5*" align="center"/>
26608 <colspec colwidth="5*" align="center"/>
26609 <colspec colwidth="6*" align="right"/>
26610 <tbody>
26611 <row>
26612 <entry><option>timeout_frozen_after</option></entry>
26613 <entry>Use: <emphasis>main</emphasis></entry>
26614 <entry>Type: <emphasis>time</emphasis></entry>
26615 <entry>Default: <emphasis>0s</emphasis></entry>
26616 </row>
26617 </tbody>
26618 </tgroup>
26619 </informaltable>
26620 <para>
26621 <indexterm role="concept">
26622 <primary>frozen messages</primary>
26623 <secondary>timing out</secondary>
26624 </indexterm>
26625 <indexterm role="concept">
26626 <primary>timeout</primary>
26627 <secondary>frozen messages</secondary>
26628 </indexterm>
26629 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
26630 message of any kind that has been on the queue for longer than the given
26631 time is automatically cancelled at the next queue run. If it is a bounce
26632 message, it is just discarded; otherwise, a bounce is sent to the sender, in a
26633 similar manner to cancellation by the <option>-Mg</option> command line option. If you want
26634 to timeout frozen bounce messages earlier than other kinds of frozen message,
26635 see <option>ignore_bounce_errors_after</option>.
26636 </para>
26637 <para>
26638 <indexterm role="option">
26639 <primary>timezone</primary>
26640 </indexterm>
26641 </para>
26642 <informaltable frame="all">
26643 <tgroup cols="4" colsep="0" rowsep="0">
26644 <colspec colwidth="8*" align="left"/>
26645 <colspec colwidth="5*" align="center"/>
26646 <colspec colwidth="5*" align="center"/>
26647 <colspec colwidth="6*" align="right"/>
26648 <tbody>
26649 <row>
26650 <entry><option>timezone</option></entry>
26651 <entry>Use: <emphasis>main</emphasis></entry>
26652 <entry>Type: <emphasis>string</emphasis></entry>
26653 <entry>Default: <emphasis>unset</emphasis></entry>
26654 </row>
26655 </tbody>
26656 </tgroup>
26657 </informaltable>
26658 <para>
26659 <indexterm role="concept">
26660 <primary>timezone</primary>
26661 <secondary>setting</secondary>
26662 </indexterm>
26663 The value of <option>timezone</option> is used to set the environment variable TZ while
26664 running Exim (if it is different on entry). This ensures that all timestamps
26665 created by Exim are in the required timezone. If you want all your timestamps
26666 to be in UTC (aka GMT) you should set
26667 </para>
26668 <literallayout class="monospaced">
26669 timezone = UTC
26670 </literallayout>
26671 <para>
26672 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
26673 or, if that is not set, from the value of the TZ environment variable when Exim
26674 is built. If <option>timezone</option> is set to the empty string, either at build or run
26675 time, any existing TZ variable is removed from the environment when Exim
26676 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
26677 unfortunately not all, operating systems.
26678 </para>
26679 <para>
26680 <indexterm role="option">
26681 <primary>tls_advertise_hosts</primary>
26682 </indexterm>
26683 </para>
26684 <informaltable frame="all">
26685 <tgroup cols="4" colsep="0" rowsep="0">
26686 <colspec colwidth="8*" align="left"/>
26687 <colspec colwidth="5*" align="center"/>
26688 <colspec colwidth="5*" align="center"/>
26689 <colspec colwidth="6*" align="right"/>
26690 <tbody>
26691 <row>
26692 <entry><option>tls_advertise_hosts</option></entry>
26693 <entry>Use: <emphasis>main</emphasis></entry>
26694 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26695 <entry>Default: <emphasis>unset</emphasis></entry>
26696 </row>
26697 </tbody>
26698 </tgroup>
26699 </informaltable>
26700 <para>
26701 <indexterm role="concept">
26702 <primary>TLS</primary>
26703 <secondary>advertising</secondary>
26704 </indexterm>
26705 <indexterm role="concept">
26706 <primary>encryption</primary>
26707 <secondary>on SMTP connection</secondary>
26708 </indexterm>
26709 <indexterm role="concept">
26710 <primary>SMTP</primary>
26711 <secondary>encrypted connection</secondary>
26712 </indexterm>
26713 When Exim is built with support for TLS encrypted connections, the availability
26714 of the STARTTLS command to set up an encrypted session is advertised in
26715 response to EHLO only to those client hosts that match this option. See
26716 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
26717 </para>
26718 <para>
26719 <indexterm role="option">
26720 <primary>tls_certificate</primary>
26721 </indexterm>
26722 </para>
26723 <informaltable frame="all">
26724 <tgroup cols="4" colsep="0" rowsep="0">
26725 <colspec colwidth="8*" align="left"/>
26726 <colspec colwidth="5*" align="center"/>
26727 <colspec colwidth="5*" align="center"/>
26728 <colspec colwidth="6*" align="right"/>
26729 <tbody>
26730 <row>
26731 <entry><option>tls_certificate</option></entry>
26732 <entry>Use: <emphasis>main</emphasis></entry>
26733 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26734 <entry>Default: <emphasis>unset</emphasis></entry>
26735 </row>
26736 </tbody>
26737 </tgroup>
26738 </informaltable>
26739 <para>
26740 <indexterm role="concept">
26741 <primary>TLS</primary>
26742 <secondary>server certificate; location of</secondary>
26743 </indexterm>
26744 <indexterm role="concept">
26745 <primary>certificate for server</primary>
26746 <secondary>location of</secondary>
26747 </indexterm>
26748 The value of this option is expanded, and must then be the absolute path to a
26749 file which contains the server&#x2019;s certificates. The server&#x2019;s private key is also
26750 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
26751 <xref linkend="CHAPTLS"/> for further details.
26752 </para>
26753 <para>
26754 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
26755 receiving incoming messages as a server. If you want to supply certificates for
26756 use when sending messages as a client, you must set the <option>tls_certificate</option>
26757 option in the relevant <command>smtp</command> transport.
26758 </para>
26759 <para>
26760 <indexterm role="option">
26761 <primary>tls_crl</primary>
26762 </indexterm>
26763 </para>
26764 <informaltable frame="all">
26765 <tgroup cols="4" colsep="0" rowsep="0">
26766 <colspec colwidth="8*" align="left"/>
26767 <colspec colwidth="5*" align="center"/>
26768 <colspec colwidth="5*" align="center"/>
26769 <colspec colwidth="6*" align="right"/>
26770 <tbody>
26771 <row>
26772 <entry><option>tls_crl</option></entry>
26773 <entry>Use: <emphasis>main</emphasis></entry>
26774 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26775 <entry>Default: <emphasis>unset</emphasis></entry>
26776 </row>
26777 </tbody>
26778 </tgroup>
26779 </informaltable>
26780 <para>
26781 <indexterm role="concept">
26782 <primary>TLS</primary>
26783 <secondary>server certificate revocation list</secondary>
26784 </indexterm>
26785 <indexterm role="concept">
26786 <primary>certificate</primary>
26787 <secondary>revocation list for server</secondary>
26788 </indexterm>
26789 This option specifies a certificate revocation list. The expanded value must
26790 be the name of a file that contains a CRL in PEM format.
26791 </para>
26792 <para>
26793 <indexterm role="option">
26794 <primary>tls_dhparam</primary>
26795 </indexterm>
26796 </para>
26797 <informaltable frame="all">
26798 <tgroup cols="4" colsep="0" rowsep="0">
26799 <colspec colwidth="8*" align="left"/>
26800 <colspec colwidth="5*" align="center"/>
26801 <colspec colwidth="5*" align="center"/>
26802 <colspec colwidth="6*" align="right"/>
26803 <tbody>
26804 <row>
26805 <entry><option>tls_dhparam</option></entry>
26806 <entry>Use: <emphasis>main</emphasis></entry>
26807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26808 <entry>Default: <emphasis>unset</emphasis></entry>
26809 </row>
26810 </tbody>
26811 </tgroup>
26812 </informaltable>
26813 <para>
26814 <indexterm role="concept">
26815 <primary>TLS</primary>
26816 <secondary>D-H parameters for server</secondary>
26817 </indexterm>
26818 The value of this option is expanded, and must then be the absolute path to
26819 a file which contains the server&#x2019;s DH parameter values.
26820 This is used only for OpenSSL. When Exim is linked with GnuTLS, this option is
26821 ignored. See section <xref linkend="SECTopenvsgnu"/> for further details.
26822 </para>
26823 <para>
26824 <indexterm role="option">
26825 <primary>tls_on_connect_ports</primary>
26826 </indexterm>
26827 </para>
26828 <informaltable frame="all">
26829 <tgroup cols="4" colsep="0" rowsep="0">
26830 <colspec colwidth="8*" align="left"/>
26831 <colspec colwidth="5*" align="center"/>
26832 <colspec colwidth="5*" align="center"/>
26833 <colspec colwidth="6*" align="right"/>
26834 <tbody>
26835 <row>
26836 <entry><option>tls_on_connect_ports</option></entry>
26837 <entry>Use: <emphasis>main</emphasis></entry>
26838 <entry>Type: <emphasis>string list</emphasis></entry>
26839 <entry>Default: <emphasis>unset</emphasis></entry>
26840 </row>
26841 </tbody>
26842 </tgroup>
26843 </informaltable>
26844 <para>
26845 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
26846 operate the obsolete SSMTP (SMTPS) protocol, where a TLS session is immediately
26847 set up without waiting for the client to issue a STARTTLS command. For
26848 further details, see section <xref linkend="SECTsupobssmt"/>.
26849 </para>
26850 <para>
26851 <indexterm role="option">
26852 <primary>tls_privatekey</primary>
26853 </indexterm>
26854 </para>
26855 <informaltable frame="all">
26856 <tgroup cols="4" colsep="0" rowsep="0">
26857 <colspec colwidth="8*" align="left"/>
26858 <colspec colwidth="5*" align="center"/>
26859 <colspec colwidth="5*" align="center"/>
26860 <colspec colwidth="6*" align="right"/>
26861 <tbody>
26862 <row>
26863 <entry><option>tls_privatekey</option></entry>
26864 <entry>Use: <emphasis>main</emphasis></entry>
26865 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26866 <entry>Default: <emphasis>unset</emphasis></entry>
26867 </row>
26868 </tbody>
26869 </tgroup>
26870 </informaltable>
26871 <para>
26872 <indexterm role="concept">
26873 <primary>TLS</primary>
26874 <secondary>server private key; location of</secondary>
26875 </indexterm>
26876 The value of this option is expanded, and must then be the absolute path to a
26877 file which contains the server&#x2019;s private key. If this option is unset, or if
26878 the expansion is forced to fail, or the result is an empty string, the private
26879 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
26880 <xref linkend="CHAPTLS"/> for further details.
26881 </para>
26882 <para>
26883 <indexterm role="option">
26884 <primary>tls_remember_esmtp</primary>
26885 </indexterm>
26886 </para>
26887 <informaltable frame="all">
26888 <tgroup cols="4" colsep="0" rowsep="0">
26889 <colspec colwidth="8*" align="left"/>
26890 <colspec colwidth="5*" align="center"/>
26891 <colspec colwidth="5*" align="center"/>
26892 <colspec colwidth="6*" align="right"/>
26893 <tbody>
26894 <row>
26895 <entry><option>tls_remember_esmtp</option></entry>
26896 <entry>Use: <emphasis>main</emphasis></entry>
26897 <entry>Type: <emphasis>boolean</emphasis></entry>
26898 <entry>Default: <emphasis>false</emphasis></entry>
26899 </row>
26900 </tbody>
26901 </tgroup>
26902 </informaltable>
26903 <para>
26904 <indexterm role="concept">
26905 <primary>TLS</primary>
26906 <secondary>esmtp state; remembering</secondary>
26907 </indexterm>
26908 <indexterm role="concept">
26909 <primary>TLS</primary>
26910 <secondary>broken clients</secondary>
26911 </indexterm>
26912 If this option is set true, Exim violates the RFCs by remembering that it is in
26913 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
26914 support for broken clients that fail to send a new EHLO after starting a
26915 TLS session.
26916 </para>
26917 <para>
26918 <indexterm role="option">
26919 <primary>tls_require_ciphers</primary>
26920 </indexterm>
26921 </para>
26922 <informaltable frame="all">
26923 <tgroup cols="4" colsep="0" rowsep="0">
26924 <colspec colwidth="8*" align="left"/>
26925 <colspec colwidth="5*" align="center"/>
26926 <colspec colwidth="5*" align="center"/>
26927 <colspec colwidth="6*" align="right"/>
26928 <tbody>
26929 <row>
26930 <entry><option>tls_require_ciphers</option></entry>
26931 <entry>Use: <emphasis>main</emphasis></entry>
26932 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26933 <entry>Default: <emphasis>unset</emphasis></entry>
26934 </row>
26935 </tbody>
26936 </tgroup>
26937 </informaltable>
26938 <para>
26939 <indexterm role="concept">
26940 <primary>TLS</primary>
26941 <secondary>requiring specific ciphers</secondary>
26942 </indexterm>
26943 <indexterm role="concept">
26944 <primary>cipher</primary>
26945 <secondary>requiring specific</secondary>
26946 </indexterm>
26947 This option controls which ciphers can be used for incoming TLS connections.
26948 The <command>smtp</command> transport has an option of the same name for controlling outgoing
26949 connections. This option is expanded for each connection, so can be varied for
26950 different clients if required. The value of this option must be a list of
26951 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
26952 in somewhat different ways. If GnuTLS is being used, the client controls the
26953 preference order of the available ciphers. Details are given in sections
26954 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
26955 </para>
26956 <para>
26957 <indexterm role="option">
26958 <primary>tls_try_verify_hosts</primary>
26959 </indexterm>
26960 </para>
26961 <informaltable frame="all">
26962 <tgroup cols="4" colsep="0" rowsep="0">
26963 <colspec colwidth="8*" align="left"/>
26964 <colspec colwidth="5*" align="center"/>
26965 <colspec colwidth="5*" align="center"/>
26966 <colspec colwidth="6*" align="right"/>
26967 <tbody>
26968 <row>
26969 <entry><option>tls_try_verify_hosts</option></entry>
26970 <entry>Use: <emphasis>main</emphasis></entry>
26971 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26972 <entry>Default: <emphasis>unset</emphasis></entry>
26973 </row>
26974 </tbody>
26975 </tgroup>
26976 </informaltable>
26977 <para>
26978 <indexterm role="concept">
26979 <primary>TLS</primary>
26980 <secondary>client certificate verification</secondary>
26981 </indexterm>
26982 <indexterm role="concept">
26983 <primary>certificate</primary>
26984 <secondary>verification of client</secondary>
26985 </indexterm>
26986 See <option>tls_verify_hosts</option> below.
26987 </para>
26988 <para>
26989 <indexterm role="option">
26990 <primary>tls_verify_certificates</primary>
26991 </indexterm>
26992 </para>
26993 <informaltable frame="all">
26994 <tgroup cols="4" colsep="0" rowsep="0">
26995 <colspec colwidth="8*" align="left"/>
26996 <colspec colwidth="5*" align="center"/>
26997 <colspec colwidth="5*" align="center"/>
26998 <colspec colwidth="6*" align="right"/>
26999 <tbody>
27000 <row>
27001 <entry><option>tls_verify_certificates</option></entry>
27002 <entry>Use: <emphasis>main</emphasis></entry>
27003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27004 <entry>Default: <emphasis>unset</emphasis></entry>
27005 </row>
27006 </tbody>
27007 </tgroup>
27008 </informaltable>
27009 <para>
27010 <indexterm role="concept">
27011 <primary>TLS</primary>
27012 <secondary>client certificate verification</secondary>
27013 </indexterm>
27014 <indexterm role="concept">
27015 <primary>certificate</primary>
27016 <secondary>verification of client</secondary>
27017 </indexterm>
27018 The value of this option is expanded, and must then be the absolute path to
27019 a file containing permitted certificates for clients that
27020 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>. Alternatively, if you
27021 are using OpenSSL, you can set <option>tls_verify_certificates</option> to the name of a
27022 directory containing certificate files. This does not work with GnuTLS; the
27023 option must be set to the name of a single file if you are using GnuTLS.
27024 </para>
27025 <para>
27026 <indexterm role="option">
27027 <primary>tls_verify_hosts</primary>
27028 </indexterm>
27029 </para>
27030 <informaltable frame="all">
27031 <tgroup cols="4" colsep="0" rowsep="0">
27032 <colspec colwidth="8*" align="left"/>
27033 <colspec colwidth="5*" align="center"/>
27034 <colspec colwidth="5*" align="center"/>
27035 <colspec colwidth="6*" align="right"/>
27036 <tbody>
27037 <row>
27038 <entry><option>tls_verify_hosts</option></entry>
27039 <entry>Use: <emphasis>main</emphasis></entry>
27040 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27041 <entry>Default: <emphasis>unset</emphasis></entry>
27042 </row>
27043 </tbody>
27044 </tgroup>
27045 </informaltable>
27046 <para>
27047 <indexterm role="concept">
27048 <primary>TLS</primary>
27049 <secondary>client certificate verification</secondary>
27050 </indexterm>
27051 <indexterm role="concept">
27052 <primary>certificate</primary>
27053 <secondary>verification of client</secondary>
27054 </indexterm>
27055 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
27056 certificates from clients.
27057 The expected certificates are defined by <option>tls_verify_certificates</option>, which
27058 must be set. A configuration error occurs if either <option>tls_verify_hosts</option> or
27059 <option>tls_try_verify_hosts</option> is set and <option>tls_verify_certificates</option> is not set.
27060 </para>
27061 <para>
27062 Any client that matches <option>tls_verify_hosts</option> is constrained by
27063 <option>tls_verify_certificates</option>. The client must present one of the listed
27064 certificates. If it does not, the connection is aborted.
27065 </para>
27066 <para>
27067 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
27068 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
27069 certificate and checks it against <option>tls_verify_certificates</option>, but does not
27070 abort the connection if there is no certificate or if it does not match. This
27071 state can be detected in an ACL, which makes it possible to implement policies
27072 such as <quote>accept for relay only if a verified certificate has been received,
27073 but accept for local delivery if encrypted, even without a verified
27074 certificate</quote>.
27075 </para>
27076 <para>
27077 Client hosts that match neither of these lists are not asked to present
27078 certificates.
27079 </para>
27080 <para>
27081 <indexterm role="option">
27082 <primary>trusted_groups</primary>
27083 </indexterm>
27084 </para>
27085 <informaltable frame="all">
27086 <tgroup cols="4" colsep="0" rowsep="0">
27087 <colspec colwidth="8*" align="left"/>
27088 <colspec colwidth="5*" align="center"/>
27089 <colspec colwidth="5*" align="center"/>
27090 <colspec colwidth="6*" align="right"/>
27091 <tbody>
27092 <row>
27093 <entry><option>trusted_groups</option></entry>
27094 <entry>Use: <emphasis>main</emphasis></entry>
27095 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27096 <entry>Default: <emphasis>unset</emphasis></entry>
27097 </row>
27098 </tbody>
27099 </tgroup>
27100 </informaltable>
27101 <para>
27102 <indexterm role="concept">
27103 <primary>trusted group</primary>
27104 </indexterm>
27105 <indexterm role="concept">
27106 <primary>group</primary>
27107 <secondary>trusted</secondary>
27108 </indexterm>
27109 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27110 option is set, any process that is running in one of the listed groups, or
27111 which has one of them as a supplementary group, is trusted. The groups can be
27112 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
27113 details of what trusted callers are permitted to do. If neither
27114 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
27115 are trusted.
27116 </para>
27117 <para>
27118 <indexterm role="option">
27119 <primary>trusted_users</primary>
27120 </indexterm>
27121 </para>
27122 <informaltable frame="all">
27123 <tgroup cols="4" colsep="0" rowsep="0">
27124 <colspec colwidth="8*" align="left"/>
27125 <colspec colwidth="5*" align="center"/>
27126 <colspec colwidth="5*" align="center"/>
27127 <colspec colwidth="6*" align="right"/>
27128 <tbody>
27129 <row>
27130 <entry><option>trusted_users</option></entry>
27131 <entry>Use: <emphasis>main</emphasis></entry>
27132 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27133 <entry>Default: <emphasis>unset</emphasis></entry>
27134 </row>
27135 </tbody>
27136 </tgroup>
27137 </informaltable>
27138 <para>
27139 <indexterm role="concept">
27140 <primary>trusted user</primary>
27141 </indexterm>
27142 <indexterm role="concept">
27143 <primary>user</primary>
27144 <secondary>trusted</secondary>
27145 </indexterm>
27146 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
27147 option is set, any process that is running as one of the listed users is
27148 trusted. The users can be specified numerically or by name. See section
27149 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
27150 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
27151 Exim user are trusted.
27152 </para>
27153 <para>
27154 <indexterm role="option">
27155 <primary>unknown_login</primary>
27156 </indexterm>
27157 </para>
27158 <informaltable frame="all">
27159 <tgroup cols="4" colsep="0" rowsep="0">
27160 <colspec colwidth="8*" align="left"/>
27161 <colspec colwidth="5*" align="center"/>
27162 <colspec colwidth="5*" align="center"/>
27163 <colspec colwidth="6*" align="right"/>
27164 <tbody>
27165 <row>
27166 <entry><option>unknown_login</option></entry>
27167 <entry>Use: <emphasis>main</emphasis></entry>
27168 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27169 <entry>Default: <emphasis>unset</emphasis></entry>
27170 </row>
27171 </tbody>
27172 </tgroup>
27173 </informaltable>
27174 <para>
27175 <indexterm role="concept">
27176 <primary>uid (user id)</primary>
27177 <secondary>unknown caller</secondary>
27178 </indexterm>
27179 <indexterm role="concept">
27180 <primary><varname>$caller_uid</varname></primary>
27181 </indexterm>
27182 This is a specialized feature for use in unusual configurations. By default, if
27183 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
27184 gives up. The <option>unknown_login</option> option can be used to set a login name to be
27185 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
27186 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
27187 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
27188 <option>-F</option> option.
27189 </para>
27190 <para>
27191 <indexterm role="option">
27192 <primary>unknown_username</primary>
27193 </indexterm>
27194 </para>
27195 <informaltable frame="all">
27196 <tgroup cols="4" colsep="0" rowsep="0">
27197 <colspec colwidth="8*" align="left"/>
27198 <colspec colwidth="5*" align="center"/>
27199 <colspec colwidth="5*" align="center"/>
27200 <colspec colwidth="6*" align="right"/>
27201 <tbody>
27202 <row>
27203 <entry><option>unknown_username</option></entry>
27204 <entry>Use: <emphasis>main</emphasis></entry>
27205 <entry>Type: <emphasis>string</emphasis></entry>
27206 <entry>Default: <emphasis>unset</emphasis></entry>
27207 </row>
27208 </tbody>
27209 </tgroup>
27210 </informaltable>
27211 <para>
27212 See <option>unknown_login</option>.
27213 </para>
27214 <para>
27215 <indexterm role="option">
27216 <primary>untrusted_set_sender</primary>
27217 </indexterm>
27218 </para>
27219 <informaltable frame="all">
27220 <tgroup cols="4" colsep="0" rowsep="0">
27221 <colspec colwidth="8*" align="left"/>
27222 <colspec colwidth="5*" align="center"/>
27223 <colspec colwidth="5*" align="center"/>
27224 <colspec colwidth="6*" align="right"/>
27225 <tbody>
27226 <row>
27227 <entry><option>untrusted_set_sender</option></entry>
27228 <entry>Use: <emphasis>main</emphasis></entry>
27229 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
27230 <entry>Default: <emphasis>unset</emphasis></entry>
27231 </row>
27232 </tbody>
27233 </tgroup>
27234 </informaltable>
27235 <para>
27236 <indexterm role="concept">
27237 <primary>trusted user</primary>
27238 </indexterm>
27239 <indexterm role="concept">
27240 <primary>sender</primary>
27241 <secondary>setting by untrusted user</secondary>
27242 </indexterm>
27243 <indexterm role="concept">
27244 <primary>untrusted user</primary>
27245 <secondary>setting sender</secondary>
27246 </indexterm>
27247 <indexterm role="concept">
27248 <primary>user</primary>
27249 <secondary>untrusted setting sender</secondary>
27250 </indexterm>
27251 <indexterm role="concept">
27252 <primary>envelope sender</primary>
27253 </indexterm>
27254 When an untrusted user submits a message to Exim using the standard input, Exim
27255 normally creates an envelope sender address from the user&#x2019;s login and the
27256 default qualification domain. Data from the <option>-f</option> option (for setting envelope
27257 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
27258 is used) is ignored.
27259 </para>
27260 <para>
27261 However, untrusted users are permitted to set an empty envelope sender address,
27262 to declare that a message should never generate any bounces. For example:
27263 </para>
27264 <literallayout class="monospaced">
27265 exim -f '&lt;&gt;' user@domain.example
27266 </literallayout>
27267 <para>
27268 <indexterm role="concept">
27269 <primary><varname>$sender_ident</varname></primary>
27270 </indexterm>
27271 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
27272 other envelope sender addresses in a controlled way. When it is set, untrusted
27273 users are allowed to set envelope sender addresses that match any of the
27274 patterns in the list. Like all address lists, the string is expanded. The
27275 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
27276 users to setting senders that start with their login ids
27277 followed by a hyphen
27278 by a setting like this:
27279 </para>
27280 <literallayout class="monospaced">
27281 untrusted_set_sender = ^$sender_ident-
27282 </literallayout>
27283 <para>
27284 If you want to allow untrusted users to set envelope sender addresses without
27285 restriction, you can use
27286 </para>
27287 <literallayout class="monospaced">
27288 untrusted_set_sender = *
27289 </literallayout>
27290 <para>
27291 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
27292 only to the setting of the envelope sender. It does not permit untrusted users
27293 to use the other options which trusted user can use to override message
27294 parameters. Furthermore, it does not stop Exim from removing an existing
27295 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
27296 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
27297 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
27298 described in section <xref linkend="SECTthesenhea"/>.
27299 </para>
27300 <para>
27301 The log line for a message&#x2019;s arrival shows the envelope sender following
27302 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
27303 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
27304 envelope sender address, the user&#x2019;s login is shown in parentheses after the
27305 sender address.
27306 </para>
27307 <para>
27308 <indexterm role="option">
27309 <primary>uucp_from_pattern</primary>
27310 </indexterm>
27311 </para>
27312 <informaltable frame="all">
27313 <tgroup cols="4" colsep="0" rowsep="0">
27314 <colspec colwidth="8*" align="left"/>
27315 <colspec colwidth="5*" align="center"/>
27316 <colspec colwidth="5*" align="center"/>
27317 <colspec colwidth="6*" align="right"/>
27318 <tbody>
27319 <row>
27320 <entry><option>uucp_from_pattern</option></entry>
27321 <entry>Use: <emphasis>main</emphasis></entry>
27322 <entry>Type: <emphasis>string</emphasis></entry>
27323 <entry>Default: <emphasis>see below</emphasis></entry>
27324 </row>
27325 </tbody>
27326 </tgroup>
27327 </informaltable>
27328 <para>
27329 <indexterm role="concept">
27330 <primary><quote>From</quote> line</primary>
27331 </indexterm>
27332 <indexterm role="concept">
27333 <primary>UUCP</primary>
27334 <secondary><quote>From</quote> line</secondary>
27335 </indexterm>
27336 Some applications that pass messages to an MTA via a command line interface use
27337 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
27338 particular, this is used by UUCP software. Exim recognizes such a line by means
27339 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
27340 matches, the sender address is constructed by expanding the contents of
27341 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
27342 default pattern recognizes lines in the following two forms:
27343 </para>
27344 <literallayout class="monospaced">
27345 From ph10 Fri Jan  5 12:35 GMT 1996
27346 From ph10 Fri, 7 Jan 97 14:00:00 GMT
27347 </literallayout>
27348 <para>
27349 The pattern can be seen by running
27350 </para>
27351 <literallayout class="monospaced">
27352 exim -bP uucp_from_pattern
27353 </literallayout>
27354 <para>
27355 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
27356 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
27357 regular expression by a parenthesized subpattern. The default value for
27358 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
27359 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
27360 <option>ignore_fromline_hosts</option>.
27361 </para>
27362 <para>
27363 <indexterm role="option">
27364 <primary>uucp_from_sender</primary>
27365 </indexterm>
27366 </para>
27367 <informaltable frame="all">
27368 <tgroup cols="4" colsep="0" rowsep="0">
27369 <colspec colwidth="8*" align="left"/>
27370 <colspec colwidth="5*" align="center"/>
27371 <colspec colwidth="5*" align="center"/>
27372 <colspec colwidth="6*" align="right"/>
27373 <tbody>
27374 <row>
27375 <entry><option>uucp_from_sender</option></entry>
27376 <entry>Use: <emphasis>main</emphasis></entry>
27377 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27378 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
27379 </row>
27380 </tbody>
27381 </tgroup>
27382 </informaltable>
27383 <para>
27384 See <option>uucp_from_pattern</option> above.
27385 </para>
27386 <para>
27387 <indexterm role="option">
27388 <primary>warn_message_file</primary>
27389 </indexterm>
27390 </para>
27391 <informaltable frame="all">
27392 <tgroup cols="4" colsep="0" rowsep="0">
27393 <colspec colwidth="8*" align="left"/>
27394 <colspec colwidth="5*" align="center"/>
27395 <colspec colwidth="5*" align="center"/>
27396 <colspec colwidth="6*" align="right"/>
27397 <tbody>
27398 <row>
27399 <entry><option>warn_message_file</option></entry>
27400 <entry>Use: <emphasis>main</emphasis></entry>
27401 <entry>Type: <emphasis>string</emphasis></entry>
27402 <entry>Default: <emphasis>unset</emphasis></entry>
27403 </row>
27404 </tbody>
27405 </tgroup>
27406 </informaltable>
27407 <para>
27408 <indexterm role="concept">
27409 <primary>warning of delay</primary>
27410 <secondary>customizing the message</secondary>
27411 </indexterm>
27412 <indexterm role="concept">
27413 <primary>customizing</primary>
27414 <secondary>warning message</secondary>
27415 </indexterm>
27416 This option defines a template file containing paragraphs of text to be used
27417 for constructing the warning message which is sent by Exim when a message has
27418 been on the queue for a specified amount of time, as specified by
27419 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
27420 <xref linkend="CHAPemsgcust"/>. See also <option>bounce_message_file</option>.
27421 </para>
27422 <para>
27423 <indexterm role="option">
27424 <primary>write_rejectlog</primary>
27425 </indexterm>
27426 </para>
27427 <informaltable frame="all">
27428 <tgroup cols="4" colsep="0" rowsep="0">
27429 <colspec colwidth="8*" align="left"/>
27430 <colspec colwidth="5*" align="center"/>
27431 <colspec colwidth="5*" align="center"/>
27432 <colspec colwidth="6*" align="right"/>
27433 <tbody>
27434 <row>
27435 <entry><option>write_rejectlog</option></entry>
27436 <entry>Use: <emphasis>main</emphasis></entry>
27437 <entry>Type: <emphasis>boolean</emphasis></entry>
27438 <entry>Default: <emphasis>true</emphasis></entry>
27439 </row>
27440 </tbody>
27441 </tgroup>
27442 </informaltable>
27443 <para>
27444 <indexterm role="concept">
27445 <primary>reject log</primary>
27446 <secondary>disabling</secondary>
27447 </indexterm>
27448 If this option is set false, Exim no longer writes anything to the reject log.
27449 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
27450 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
27451 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
27452 </para>
27453 </section>
27454 </chapter>
27455
27456 <chapter id="CHAProutergeneric">
27457 <title>Generic options for routers</title>
27458 <para>
27459 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
27460 <primary>options</primary>
27461 <secondary>generic; for routers</secondary>
27462 </indexterm>
27463 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
27464 <primary>generic options</primary>
27465 <secondary>router</secondary>
27466 </indexterm>
27467 This chapter describes the generic options that apply to all routers.
27468 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
27469 </para>
27470 <para>
27471 For a general description of how a router operates, see sections
27472 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
27473 which the preconditions are tested. The order of expansion of the options that
27474 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
27475 <option>headers_remove</option>, <option>transport</option>.
27476 </para>
27477 <para>
27478 <indexterm role="option">
27479 <primary>address_data</primary>
27480 </indexterm>
27481 </para>
27482 <informaltable frame="all">
27483 <tgroup cols="4" colsep="0" rowsep="0">
27484 <colspec colwidth="8*" align="left"/>
27485 <colspec colwidth="5*" align="center"/>
27486 <colspec colwidth="5*" align="center"/>
27487 <colspec colwidth="6*" align="right"/>
27488 <tbody>
27489 <row>
27490 <entry><option>address_data</option></entry>
27491 <entry>Use: <emphasis>routers</emphasis></entry>
27492 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27493 <entry>Default: <emphasis>unset</emphasis></entry>
27494 </row>
27495 </tbody>
27496 </tgroup>
27497 </informaltable>
27498 <para>
27499 <indexterm role="concept">
27500 <primary>router</primary>
27501 <secondary>data attached to address</secondary>
27502 </indexterm>
27503 The string is expanded just before the router is run, that is, after all the
27504 precondition tests have succeeded. If the expansion is forced to fail, the
27505 router declines, the value of <option>address_data</option> remains unchanged, and the
27506 <option>more</option> option controls what happens next. Other expansion failures cause
27507 delivery of the address to be deferred.
27508 </para>
27509 <para>
27510 <indexterm role="concept">
27511 <primary><varname>$address_data</varname></primary>
27512 </indexterm>
27513 When the expansion succeeds, the value is retained with the address, and can be
27514 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
27515 routers, and the eventual transport.
27516 </para>
27517 <para>
27518 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
27519 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
27520 in the filter. This is not normally a problem, because such data is usually
27521 either not confidential or it <quote>belongs</quote> to the current user, but if you do
27522 put confidential data into <varname>$address_data</varname> you need to remember this point.
27523 </para>
27524 <para>
27525 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
27526 with the address, though it can be changed by another <option>address_data</option> setting
27527 on a subsequent router. If a router generates child addresses, the value of
27528 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
27529 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
27530 </para>
27531 <para>
27532 The idea of <option>address_data</option> is that you can use it to look up a lot of data
27533 for the address once, and then pick out parts of the data later. For example,
27534 you could use a single LDAP lookup to return a string of the form
27535 </para>
27536 <literallayout class="monospaced">
27537 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
27538 </literallayout>
27539 <para>
27540 In the transport you could pick out the mailbox by a setting such as
27541 </para>
27542 <literallayout class="monospaced">
27543 file = ${extract{mailbox}{$address_data}}
27544 </literallayout>
27545 <para>
27546 This makes the configuration file less messy, and also reduces the number of
27547 lookups (though Exim does cache lookups).
27548 </para>
27549 <para>
27550 The <option>address_data</option> facility is also useful as a means of passing information
27551 from one router to another, and from a router to a transport. In addition, if
27552 </para>
27553 <para>
27554 <indexterm role="concept">
27555 <primary><varname>$sender_address_data</varname></primary>
27556 </indexterm>
27557 <indexterm role="concept">
27558 <primary><varname>$address_data</varname></primary>
27559 </indexterm>
27560 When <varname>$address_data</varname> is set by a router when verifying a recipient address
27561 from an ACL, it remains available for use in the rest of the ACL statement.
27562 After verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
27563 </para>
27564 <para>
27565 <indexterm role="option">
27566 <primary>address_test</primary>
27567 </indexterm>
27568 </para>
27569 <informaltable frame="all">
27570 <tgroup cols="4" colsep="0" rowsep="0">
27571 <colspec colwidth="8*" align="left"/>
27572 <colspec colwidth="5*" align="center"/>
27573 <colspec colwidth="5*" align="center"/>
27574 <colspec colwidth="6*" align="right"/>
27575 <tbody>
27576 <row>
27577 <entry><option>address_test</option></entry>
27578 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
27579 <entry>Type: <emphasis>boolean</emphasis></entry>
27580 <entry>Default: <emphasis>true</emphasis></entry>
27581 </row>
27582 </tbody>
27583 </tgroup>
27584 </informaltable>
27585 <para>
27586 <indexterm role="concept">
27587 <primary><option>-bt</option> option</primary>
27588 </indexterm>
27589 <indexterm role="concept">
27590 <primary>router</primary>
27591 <secondary>skipping when address testing</secondary>
27592 </indexterm>
27593 If this option is set false, the router is skipped when routing is being tested
27594 by means of the <option>-bt</option> command line option. This can be a convenience when
27595 your first router sends messages to an external scanner, because it saves you
27596 having to set the <quote>already scanned</quote> indicator when testing real address
27597 routing.
27598 </para>
27599 <para>
27600 <indexterm role="option">
27601 <primary>cannot_route_message</primary>
27602 </indexterm>
27603 </para>
27604 <informaltable frame="all">
27605 <tgroup cols="4" colsep="0" rowsep="0">
27606 <colspec colwidth="8*" align="left"/>
27607 <colspec colwidth="5*" align="center"/>
27608 <colspec colwidth="5*" align="center"/>
27609 <colspec colwidth="6*" align="right"/>
27610 <tbody>
27611 <row>
27612 <entry><option>cannot_route_message</option></entry>
27613 <entry>Use: <emphasis>routers</emphasis></entry>
27614 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27615 <entry>Default: <emphasis>unset</emphasis></entry>
27616 </row>
27617 </tbody>
27618 </tgroup>
27619 </informaltable>
27620 <para>
27621 <indexterm role="concept">
27622 <primary>router</primary>
27623 <secondary>customizing <quote>cannot route</quote> message</secondary>
27624 </indexterm>
27625 <indexterm role="concept">
27626 <primary>customizing</primary>
27627 <secondary><quote>cannot route</quote> message</secondary>
27628 </indexterm>
27629 This option specifies a text message that is used when an address cannot be
27630 routed because Exim has run out of routers. The default message is
27631 <quote>Unrouteable address</quote>. This option is useful only on routers that have
27632 <option>more</option> set false, or on the very last router in a configuration, because the
27633 value that is used is taken from the last router that is considered. This
27634 includes a router that is skipped because its preconditions are not met, as
27635 well as a router that declines. For example, using the default configuration,
27636 you could put:
27637 </para>
27638 <literallayout class="monospaced">
27639 cannot_route_message = Remote domain not found in DNS
27640 </literallayout>
27641 <para>
27642 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
27643 and
27644 </para>
27645 <literallayout class="monospaced">
27646 cannot_route_message = Unknown local user
27647 </literallayout>
27648 <para>
27649 on the final router that checks for local users. If string expansion fails for
27650 this option, the default message is used. Unless the expansion failure was
27651 explicitly forced, a message about the failure is written to the main and panic
27652 logs, in addition to the normal message about the routing failure.
27653 </para>
27654 <para>
27655 <indexterm role="option">
27656 <primary>caseful_local_part</primary>
27657 </indexterm>
27658 </para>
27659 <informaltable frame="all">
27660 <tgroup cols="4" colsep="0" rowsep="0">
27661 <colspec colwidth="8*" align="left"/>
27662 <colspec colwidth="5*" align="center"/>
27663 <colspec colwidth="5*" align="center"/>
27664 <colspec colwidth="6*" align="right"/>
27665 <tbody>
27666 <row>
27667 <entry><option>caseful_local_part</option></entry>
27668 <entry>Use: <emphasis>routers</emphasis></entry>
27669 <entry>Type: <emphasis>boolean</emphasis></entry>
27670 <entry>Default: <emphasis>false</emphasis></entry>
27671 </row>
27672 </tbody>
27673 </tgroup>
27674 </informaltable>
27675 <para>
27676 <indexterm role="concept">
27677 <primary>case of local parts</primary>
27678 </indexterm>
27679 <indexterm role="concept">
27680 <primary>router</primary>
27681 <secondary>case of local parts</secondary>
27682 </indexterm>
27683 By default, routers handle the local parts of addresses in a case-insensitive
27684 manner, though the actual case is preserved for transmission with the message.
27685 If you want the case of letters to be significant in a router, you must set
27686 this option true. For individual router options that contain address or local
27687 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
27688 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
27689 more details.
27690 </para>
27691 <para>
27692 <indexterm role="concept">
27693 <primary><varname>$local_part</varname></primary>
27694 </indexterm>
27695 <indexterm role="concept">
27696 <primary><varname>$original_local_part</varname></primary>
27697 </indexterm>
27698 <indexterm role="concept">
27699 <primary><varname>$parent_local_part</varname></primary>
27700 </indexterm>
27701 The value of the <varname>$local_part</varname> variable is forced to lower case while a
27702 router is running unless <option>caseful_local_part</option> is set. When a router assigns
27703 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
27704 is the same as it was in the router. Similarly, when a router generates child
27705 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
27706 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
27707 </para>
27708 <para>
27709 This option applies to the processing of an address by a router. When a
27710 recipient address is being processed in an ACL, there is a separate <option>control</option>
27711 modifier that can be used to specify case-sensitive processing within the ACL
27712 (see section <xref linkend="SECTcontrols"/>).
27713 </para>
27714 <para>
27715 <indexterm role="option">
27716 <primary>check_local_user</primary>
27717 </indexterm>
27718 </para>
27719 <informaltable frame="all">
27720 <tgroup cols="4" colsep="0" rowsep="0">
27721 <colspec colwidth="8*" align="left"/>
27722 <colspec colwidth="5*" align="center"/>
27723 <colspec colwidth="5*" align="center"/>
27724 <colspec colwidth="6*" align="right"/>
27725 <tbody>
27726 <row>
27727 <entry><option>check_local_user</option></entry>
27728 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
27729 <entry>Type: <emphasis>boolean</emphasis></entry>
27730 <entry>Default: <emphasis>false</emphasis></entry>
27731 </row>
27732 </tbody>
27733 </tgroup>
27734 </informaltable>
27735 <para>
27736 <indexterm role="concept">
27737 <primary>local user</primary>
27738 <secondary>checking in router</secondary>
27739 </indexterm>
27740 <indexterm role="concept">
27741 <primary>router</primary>
27742 <secondary>checking for local user</secondary>
27743 </indexterm>
27744 <indexterm role="concept">
27745 <primary><filename>/etc/passwd</filename></primary>
27746 </indexterm>
27747 <indexterm role="concept">
27748 <primary><varname>$home</varname></primary>
27749 </indexterm>
27750 When this option is true, Exim checks that the local part of the recipient
27751 address (with affixes removed if relevant) is the name of an account on the
27752 local system. The check is done by calling the <function>getpwnam()</function> function rather
27753 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
27754 holding password data (such as NIS) are supported. If the local part is a local
27755 user, <varname>$home</varname> is set from the password data, and can be tested in other
27756 preconditions that are evaluated after this one (the order of evaluation is
27757 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
27758 overridden by <option>router_home_directory</option>. If the local part is not a local user,
27759 the router is skipped.
27760 </para>
27761 <para>
27762 If you want to check that the local part is either the name of a local user
27763 or matches something else, you cannot combine <option>check_local_user</option> with a
27764 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
27765 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
27766 setting to achieve this. For example:
27767 </para>
27768 <literallayout class="monospaced">
27769 local_parts = passwd;$local_part : lsearch;/etc/other/users
27770 </literallayout>
27771 <para>
27772 Note, however, that the side effects of <option>check_local_user</option> (such as setting
27773 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
27774 <option>local_parts</option> (or any other) precondition.
27775 </para>
27776 <para>
27777 <indexterm role="option">
27778 <primary>condition</primary>
27779 </indexterm>
27780 </para>
27781 <informaltable frame="all">
27782 <tgroup cols="4" colsep="0" rowsep="0">
27783 <colspec colwidth="8*" align="left"/>
27784 <colspec colwidth="5*" align="center"/>
27785 <colspec colwidth="5*" align="center"/>
27786 <colspec colwidth="6*" align="right"/>
27787 <tbody>
27788 <row>
27789 <entry><option>condition</option></entry>
27790 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
27791 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27792 <entry>Default: <emphasis>unset</emphasis></entry>
27793 </row>
27794 </tbody>
27795 </tgroup>
27796 </informaltable>
27797 <para>
27798 <indexterm role="concept">
27799 <primary>router</primary>
27800 <secondary>customized precondition</secondary>
27801 </indexterm>
27802 This option specifies a general precondition test that has to succeed for the
27803 router to be called. The <option>condition</option> option is the last precondition to be
27804 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
27805 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
27806 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
27807 router is skipped, and the address is offered to the next one.
27808 </para>
27809 <para>
27810 If the result is any other value, the router is run (as this is the last
27811 precondition to be evaluated, all the other preconditions must be true).
27812 </para>
27813 <para>
27814 The <option>condition</option> option provides a means of applying custom conditions to the
27815 running of routers. Note that in the case of a simple conditional expansion,
27816 the default expansion values are exactly what is wanted. For example:
27817 </para>
27818 <literallayout class="monospaced">
27819 condition = ${if &gt;{$message_age}{600}}
27820 </literallayout>
27821 <para>
27822 Because of the default behaviour of the string expansion, this is equivalent to
27823 </para>
27824 <literallayout class="monospaced">
27825 condition = ${if &gt;{$message_age}{600}{true}{}}
27826 </literallayout>
27827 <para>
27828 If the expansion fails (other than forced failure) delivery is deferred. Some
27829 of the other precondition options are common special cases that could in fact
27830 be specified using <option>condition</option>.
27831 </para>
27832 <para>
27833 <indexterm role="option">
27834 <primary>debug_print</primary>
27835 </indexterm>
27836 </para>
27837 <informaltable frame="all">
27838 <tgroup cols="4" colsep="0" rowsep="0">
27839 <colspec colwidth="8*" align="left"/>
27840 <colspec colwidth="5*" align="center"/>
27841 <colspec colwidth="5*" align="center"/>
27842 <colspec colwidth="6*" align="right"/>
27843 <tbody>
27844 <row>
27845 <entry><option>debug_print</option></entry>
27846 <entry>Use: <emphasis>routers</emphasis></entry>
27847 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27848 <entry>Default: <emphasis>unset</emphasis></entry>
27849 </row>
27850 </tbody>
27851 </tgroup>
27852 </informaltable>
27853 <para>
27854 <indexterm role="concept">
27855 <primary>testing</primary>
27856 <secondary>variables in drivers</secondary>
27857 </indexterm>
27858 If this option is set and debugging is enabled (see the <option>-d</option> command line
27859 option), the string is expanded and included in the debugging output.
27860 If expansion of the string fails, the error message is written to the debugging
27861 output, and Exim carries on processing.
27862 This option is provided to help with checking out the values of variables and
27863 so on when debugging router configurations. For example, if a <option>condition</option>
27864 option appears not to be working, <option>debug_print</option> can be used to output the
27865 variables it references. The output happens after checks for <option>domains</option>,
27866 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
27867 are tested. A newline is added to the text if it does not end with one.
27868 </para>
27869 <para>
27870 <indexterm role="option">
27871 <primary>disable_logging</primary>
27872 </indexterm>
27873 </para>
27874 <informaltable frame="all">
27875 <tgroup cols="4" colsep="0" rowsep="0">
27876 <colspec colwidth="8*" align="left"/>
27877 <colspec colwidth="5*" align="center"/>
27878 <colspec colwidth="5*" align="center"/>
27879 <colspec colwidth="6*" align="right"/>
27880 <tbody>
27881 <row>
27882 <entry><option>disable_logging</option></entry>
27883 <entry>Use: <emphasis>routers</emphasis></entry>
27884 <entry>Type: <emphasis>boolean</emphasis></entry>
27885 <entry>Default: <emphasis>false</emphasis></entry>
27886 </row>
27887 </tbody>
27888 </tgroup>
27889 </informaltable>
27890 <para>
27891 If this option is set true, nothing is logged for any routing errors
27892 or for any deliveries caused by this router. You should not set this option
27893 unless you really, really know what you are doing. See also the generic
27894 transport option of the same name.
27895 </para>
27896 <para>
27897 <indexterm role="option">
27898 <primary>domains</primary>
27899 </indexterm>
27900 </para>
27901 <informaltable frame="all">
27902 <tgroup cols="4" colsep="0" rowsep="0">
27903 <colspec colwidth="8*" align="left"/>
27904 <colspec colwidth="5*" align="center"/>
27905 <colspec colwidth="5*" align="center"/>
27906 <colspec colwidth="6*" align="right"/>
27907 <tbody>
27908 <row>
27909 <entry><option>domains</option></entry>
27910 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
27911 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27912 <entry>Default: <emphasis>unset</emphasis></entry>
27913 </row>
27914 </tbody>
27915 </tgroup>
27916 </informaltable>
27917 <para>
27918 <indexterm role="concept">
27919 <primary>router</primary>
27920 <secondary>restricting to specific domains</secondary>
27921 </indexterm>
27922 <indexterm role="concept">
27923 <primary><varname>$domain_data</varname></primary>
27924 </indexterm>
27925 If this option is set, the router is skipped unless the current domain matches
27926 the list. If the match is achieved by means of a file lookup, the data that the
27927 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
27928 expansions of the driver&#x2019;s private options. See section <xref linkend="SECTrouprecon"/> for
27929 a list of the order in which preconditions are evaluated.
27930 </para>
27931 <para>
27932 <indexterm role="option">
27933 <primary>driver</primary>
27934 </indexterm>
27935 </para>
27936 <informaltable frame="all">
27937 <tgroup cols="4" colsep="0" rowsep="0">
27938 <colspec colwidth="8*" align="left"/>
27939 <colspec colwidth="5*" align="center"/>
27940 <colspec colwidth="5*" align="center"/>
27941 <colspec colwidth="6*" align="right"/>
27942 <tbody>
27943 <row>
27944 <entry><option>driver</option></entry>
27945 <entry>Use: <emphasis>routers</emphasis></entry>
27946 <entry>Type: <emphasis>string</emphasis></entry>
27947 <entry>Default: <emphasis>unset</emphasis></entry>
27948 </row>
27949 </tbody>
27950 </tgroup>
27951 </informaltable>
27952 <para>
27953 This option must always be set. It specifies which of the available routers is
27954 to be used.
27955 </para>
27956 <para>
27957 <indexterm role="option">
27958 <primary>errors_to</primary>
27959 </indexterm>
27960 </para>
27961 <informaltable frame="all">
27962 <tgroup cols="4" colsep="0" rowsep="0">
27963 <colspec colwidth="8*" align="left"/>
27964 <colspec colwidth="5*" align="center"/>
27965 <colspec colwidth="5*" align="center"/>
27966 <colspec colwidth="6*" align="right"/>
27967 <tbody>
27968 <row>
27969 <entry><option>errors_to</option></entry>
27970 <entry>Use: <emphasis>routers</emphasis></entry>
27971 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27972 <entry>Default: <emphasis>unset</emphasis></entry>
27973 </row>
27974 </tbody>
27975 </tgroup>
27976 </informaltable>
27977 <para>
27978 <indexterm role="concept">
27979 <primary>envelope sender</primary>
27980 </indexterm>
27981 <indexterm role="concept">
27982 <primary>router</primary>
27983 <secondary>changing address for errors</secondary>
27984 </indexterm>
27985 If a router successfully handles an address, it may assign the address to a
27986 transport for delivery or it may generate child addresses. In both cases, if
27987 there is a delivery problem during later processing, the resulting bounce
27988 message is sent to the address that results from expanding this string,
27989 provided that the address verifies successfully. The <option>errors_to</option> option is
27990 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
27991 </para>
27992 <para>
27993 The <option>errors_to</option> setting associated with an address can be overridden if it
27994 subsequently passes through other routers that have their own <option>errors_to</option>
27995 settings, or if the message is delivered by a transport with a <option>return_path</option>
27996 setting.
27997 </para>
27998 <para>
27999 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
28000 the expansion fails to verify, the errors address associated with the incoming
28001 address is used. At top level, this is the envelope sender. A non-forced
28002 expansion failure causes delivery to be deferred.
28003 </para>
28004 <para>
28005 If an address for which <option>errors_to</option> has been set ends up being delivered over
28006 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
28007 any bounces that are generated by other MTAs on the delivery route are also
28008 sent there. You can set <option>errors_to</option> to the empty string by either of these
28009 settings:
28010 </para>
28011 <literallayout class="monospaced">
28012 errors_to =
28013 errors_to = ""
28014 </literallayout>
28015 <para>
28016 An expansion item that yields an empty string has the same effect. If you do
28017 this, a locally detected delivery error for addresses processed by this router
28018 no longer gives rise to a bounce message; the error is discarded. If the
28019 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
28020 overridden by the <option>return_path</option> option on the transport.
28021 </para>
28022 <para>
28023 <indexterm role="concept">
28024 <primary><varname>$address_data</varname></primary>
28025 </indexterm>
28026 If for some reason you want to discard local errors, but use a non-empty
28027 MAIL command for remote delivery, you can preserve the original return
28028 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
28029 setting <option>return_path</option>.
28030 </para>
28031 <para>
28032 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
28033 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
28034 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
28035 </para>
28036 <para>
28037 <indexterm role="option">
28038 <primary>expn</primary>
28039 </indexterm>
28040 </para>
28041 <informaltable frame="all">
28042 <tgroup cols="4" colsep="0" rowsep="0">
28043 <colspec colwidth="8*" align="left"/>
28044 <colspec colwidth="5*" align="center"/>
28045 <colspec colwidth="5*" align="center"/>
28046 <colspec colwidth="6*" align="right"/>
28047 <tbody>
28048 <row>
28049 <entry><option>expn</option></entry>
28050 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28051 <entry>Type: <emphasis>boolean</emphasis></entry>
28052 <entry>Default: <emphasis>true</emphasis></entry>
28053 </row>
28054 </tbody>
28055 </tgroup>
28056 </informaltable>
28057 <para>
28058 <indexterm role="concept">
28059 <primary>address</primary>
28060 <secondary>testing</secondary>
28061 </indexterm>
28062 <indexterm role="concept">
28063 <primary>testing</primary>
28064 <secondary>addresses</secondary>
28065 </indexterm>
28066 <indexterm role="concept">
28067 <primary>EXPN</primary>
28068 <secondary>router skipping</secondary>
28069 </indexterm>
28070 <indexterm role="concept">
28071 <primary>router</primary>
28072 <secondary>skipping for EXPN</secondary>
28073 </indexterm>
28074 If this option is turned off, the router is skipped when testing an address
28075 as a result of processing an SMTP EXPN command. You might, for example,
28076 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
28077 on for the system alias file.
28078 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28079 are evaluated.
28080 </para>
28081 <para>
28082 The use of the SMTP EXPN command is controlled by an ACL (see chapter
28083 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
28084 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
28085 </para>
28086 <para>
28087 <indexterm role="option">
28088 <primary>fail_verify</primary>
28089 </indexterm>
28090 </para>
28091 <informaltable frame="all">
28092 <tgroup cols="4" colsep="0" rowsep="0">
28093 <colspec colwidth="8*" align="left"/>
28094 <colspec colwidth="5*" align="center"/>
28095 <colspec colwidth="5*" align="center"/>
28096 <colspec colwidth="6*" align="right"/>
28097 <tbody>
28098 <row>
28099 <entry><option>fail_verify</option></entry>
28100 <entry>Use: <emphasis>routers</emphasis></entry>
28101 <entry>Type: <emphasis>boolean</emphasis></entry>
28102 <entry>Default: <emphasis>false</emphasis></entry>
28103 </row>
28104 </tbody>
28105 </tgroup>
28106 </informaltable>
28107 <para>
28108 <indexterm role="concept">
28109 <primary>router</primary>
28110 <secondary>forcing verification failure</secondary>
28111 </indexterm>
28112 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
28113 <option>fail_verify_recipient</option> to the same value.
28114 </para>
28115 <para>
28116 <indexterm role="option">
28117 <primary>fail_verify_recipient</primary>
28118 </indexterm>
28119 </para>
28120 <informaltable frame="all">
28121 <tgroup cols="4" colsep="0" rowsep="0">
28122 <colspec colwidth="8*" align="left"/>
28123 <colspec colwidth="5*" align="center"/>
28124 <colspec colwidth="5*" align="center"/>
28125 <colspec colwidth="6*" align="right"/>
28126 <tbody>
28127 <row>
28128 <entry><option>fail_verify_recipient</option></entry>
28129 <entry>Use: <emphasis>routers</emphasis></entry>
28130 <entry>Type: <emphasis>boolean</emphasis></entry>
28131 <entry>Default: <emphasis>false</emphasis></entry>
28132 </row>
28133 </tbody>
28134 </tgroup>
28135 </informaltable>
28136 <para>
28137 If this option is true and an address is accepted by this router when
28138 verifying a recipient, verification fails.
28139 </para>
28140 <para>
28141 <indexterm role="option">
28142 <primary>fail_verify_sender</primary>
28143 </indexterm>
28144 </para>
28145 <informaltable frame="all">
28146 <tgroup cols="4" colsep="0" rowsep="0">
28147 <colspec colwidth="8*" align="left"/>
28148 <colspec colwidth="5*" align="center"/>
28149 <colspec colwidth="5*" align="center"/>
28150 <colspec colwidth="6*" align="right"/>
28151 <tbody>
28152 <row>
28153 <entry><option>fail_verify_sender</option></entry>
28154 <entry>Use: <emphasis>routers</emphasis></entry>
28155 <entry>Type: <emphasis>boolean</emphasis></entry>
28156 <entry>Default: <emphasis>false</emphasis></entry>
28157 </row>
28158 </tbody>
28159 </tgroup>
28160 </informaltable>
28161 <para>
28162 If this option is true and an address is accepted by this router when
28163 verifying a sender, verification fails.
28164 </para>
28165 <para>
28166 <indexterm role="option">
28167 <primary>fallback_hosts</primary>
28168 </indexterm>
28169 </para>
28170 <informaltable frame="all">
28171 <tgroup cols="4" colsep="0" rowsep="0">
28172 <colspec colwidth="8*" align="left"/>
28173 <colspec colwidth="5*" align="center"/>
28174 <colspec colwidth="5*" align="center"/>
28175 <colspec colwidth="6*" align="right"/>
28176 <tbody>
28177 <row>
28178 <entry><option>fallback_hosts</option></entry>
28179 <entry>Use: <emphasis>routers</emphasis></entry>
28180 <entry>Type: <emphasis>string list</emphasis></entry>
28181 <entry>Default: <emphasis>unset</emphasis></entry>
28182 </row>
28183 </tbody>
28184 </tgroup>
28185 </informaltable>
28186 <para>
28187 <indexterm role="concept">
28188 <primary>router</primary>
28189 <secondary>fallback hosts</secondary>
28190 </indexterm>
28191 <indexterm role="concept">
28192 <primary>fallback</primary>
28193 <secondary>hosts specified on router</secondary>
28194 </indexterm>
28195 String expansion is not applied to this option. The argument must be a
28196 colon-separated list of host names or IP addresses. The list separator can be
28197 changed (see section <xref linkend="SECTlistconstruct"/>), and a port can be specified with
28198 each name or address. In fact, the format of each item is exactly the same as
28199 defined for the list of hosts in a <command>manualroute</command> router (see section
28200 <xref linkend="SECTformatonehostitem"/>).
28201 </para>
28202 <para>
28203 If a router queues an address for a remote transport, this host list is
28204 associated with the address, and used instead of the transport&#x2019;s fallback host
28205 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
28206 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
28207 transport for further details.
28208 </para>
28209 <para>
28210 <indexterm role="option">
28211 <primary>group</primary>
28212 </indexterm>
28213 </para>
28214 <informaltable frame="all">
28215 <tgroup cols="4" colsep="0" rowsep="0">
28216 <colspec colwidth="8*" align="left"/>
28217 <colspec colwidth="5*" align="center"/>
28218 <colspec colwidth="5*" align="center"/>
28219 <colspec colwidth="6*" align="right"/>
28220 <tbody>
28221 <row>
28222 <entry><option>group</option></entry>
28223 <entry>Use: <emphasis>routers</emphasis></entry>
28224 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28225 <entry>Default: <emphasis>see below</emphasis></entry>
28226 </row>
28227 </tbody>
28228 </tgroup>
28229 </informaltable>
28230 <para>
28231 <indexterm role="concept">
28232 <primary>gid (group id)</primary>
28233 <secondary>local delivery</secondary>
28234 </indexterm>
28235 <indexterm role="concept">
28236 <primary>local transports</primary>
28237 <secondary>uid and gid</secondary>
28238 </indexterm>
28239 <indexterm role="concept">
28240 <primary>transport</primary>
28241 <secondary>local</secondary>
28242 </indexterm>
28243 <indexterm role="concept">
28244 <primary>router</primary>
28245 <secondary>setting group</secondary>
28246 </indexterm>
28247 When a router queues an address for a transport, and the transport does not
28248 specify a group, the group given here is used when running the delivery
28249 process.
28250 The group may be specified numerically or by name. If expansion fails, the
28251 error is logged and delivery is deferred.
28252 The default is unset, unless <option>check_local_user</option> is set, when the default
28253 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
28254 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28255 </para>
28256 <para>
28257 <indexterm role="option">
28258 <primary>headers_add</primary>
28259 </indexterm>
28260 </para>
28261 <informaltable frame="all">
28262 <tgroup cols="4" colsep="0" rowsep="0">
28263 <colspec colwidth="8*" align="left"/>
28264 <colspec colwidth="5*" align="center"/>
28265 <colspec colwidth="5*" align="center"/>
28266 <colspec colwidth="6*" align="right"/>
28267 <tbody>
28268 <row>
28269 <entry><option>headers_add</option></entry>
28270 <entry>Use: <emphasis>routers</emphasis></entry>
28271 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28272 <entry>Default: <emphasis>unset</emphasis></entry>
28273 </row>
28274 </tbody>
28275 </tgroup>
28276 </informaltable>
28277 <para>
28278 <indexterm role="concept">
28279 <primary>header lines</primary>
28280 <secondary>adding</secondary>
28281 </indexterm>
28282 <indexterm role="concept">
28283 <primary>router</primary>
28284 <secondary>adding header lines</secondary>
28285 </indexterm>
28286 This option specifies a string of text that is expanded at routing time, and
28287 associated with any addresses that are accepted by the router. However, this
28288 option has no effect when an address is just being verified. The way in which
28289 the text is used to add header lines at transport time is described in section
28290 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
28291 message is in the process of being transported. This means that references to
28292 header lines in string expansions in the transport&#x2019;s configuration do not
28293 <quote>see</quote> the added header lines.
28294 </para>
28295 <para>
28296 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
28297 <option>headers_remove</option> and <option>transport</option>. If the expanded string is empty, or if
28298 the expansion is forced to fail, the option has no effect. Other expansion
28299 failures are treated as configuration errors.
28300 </para>
28301 <para>
28302 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
28303 router that has the <option>one_time</option> option set.
28304 </para>
28305 <para>
28306 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28307 additions are deleted when the address is passed on to subsequent routers.
28308 </para>
28309 <para>
28310 <indexterm role="option">
28311 <primary>headers_remove</primary>
28312 </indexterm>
28313 </para>
28314 <informaltable frame="all">
28315 <tgroup cols="4" colsep="0" rowsep="0">
28316 <colspec colwidth="8*" align="left"/>
28317 <colspec colwidth="5*" align="center"/>
28318 <colspec colwidth="5*" align="center"/>
28319 <colspec colwidth="6*" align="right"/>
28320 <tbody>
28321 <row>
28322 <entry><option>headers_remove</option></entry>
28323 <entry>Use: <emphasis>routers</emphasis></entry>
28324 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28325 <entry>Default: <emphasis>unset</emphasis></entry>
28326 </row>
28327 </tbody>
28328 </tgroup>
28329 </informaltable>
28330 <para>
28331 <indexterm role="concept">
28332 <primary>header lines</primary>
28333 <secondary>removing</secondary>
28334 </indexterm>
28335 <indexterm role="concept">
28336 <primary>router</primary>
28337 <secondary>removing header lines</secondary>
28338 </indexterm>
28339 This option specifies a string of text that is expanded at routing time, and
28340 associated with any addresses that are accepted by the router. However, this
28341 option has no effect when an address is just being verified. The way in which
28342 the text is used to remove header lines at transport time is described in
28343 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
28344 the message is in the process of being transported. This means that references
28345 to header lines in string expansions in the transport&#x2019;s configuration still
28346 <quote>see</quote> the original header lines.
28347 </para>
28348 <para>
28349 The <option>headers_remove</option> option is expanded after <option>errors_to</option> and
28350 <option>headers_add</option>, but before <option>transport</option>. If the expansion is forced to fail,
28351 the option has no effect. Other expansion failures are treated as configuration
28352 errors.
28353 </para>
28354 <para>
28355 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
28356 router that has the <option>one_time</option> option set.
28357 </para>
28358 <para>
28359 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
28360 removal requests are deleted when the address is passed on to subsequent
28361 routers.
28362 </para>
28363 <para>
28364 <indexterm role="option">
28365 <primary>ignore_target_hosts</primary>
28366 </indexterm>
28367 </para>
28368 <informaltable frame="all">
28369 <tgroup cols="4" colsep="0" rowsep="0">
28370 <colspec colwidth="8*" align="left"/>
28371 <colspec colwidth="5*" align="center"/>
28372 <colspec colwidth="5*" align="center"/>
28373 <colspec colwidth="6*" align="right"/>
28374 <tbody>
28375 <row>
28376 <entry><option>ignore_target_hosts</option></entry>
28377 <entry>Use: <emphasis>routers</emphasis></entry>
28378 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28379 <entry>Default: <emphasis>unset</emphasis></entry>
28380 </row>
28381 </tbody>
28382 </tgroup>
28383 </informaltable>
28384 <para>
28385 <indexterm role="concept">
28386 <primary>IP address</primary>
28387 <secondary>discarding</secondary>
28388 </indexterm>
28389 <indexterm role="concept">
28390 <primary>router</primary>
28391 <secondary>discarding IP addresses</secondary>
28392 </indexterm>
28393 Although this option is a host list, it should normally contain IP address
28394 entries rather than names. If any host that is looked up by the router has an
28395 IP address that matches an item in this list, Exim behaves as if that IP
28396 address did not exist. This option allows you to cope with rogue DNS entries
28397 like
28398 </para>
28399 <literallayout class="monospaced">
28400 remote.domain.example.  A  127.0.0.1
28401 </literallayout>
28402 <para>
28403 by setting
28404 </para>
28405 <literallayout class="monospaced">
28406 ignore_target_hosts = 127.0.0.1
28407 </literallayout>
28408 <para>
28409 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
28410 discarded in this way, the router declines. In a conventional configuration, an
28411 attempt to mail to such a domain would normally provoke the <quote>unrouteable
28412 domain</quote> error, and an attempt to verify an address in the domain would fail.
28413 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
28414 router declines if presented with one of the listed addresses.
28415 </para>
28416 <para>
28417 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
28418 means of the first or the second of the following settings, respectively:
28419 </para>
28420 <literallayout class="monospaced">
28421 ignore_target_hosts = 0.0.0.0/0
28422 ignore_target_hosts = &lt;; 0::0/0
28423 </literallayout>
28424 <para>
28425 The pattern in the first line matches all IPv4 addresses, whereas the pattern
28426 in the second line matches all IPv6 addresses.
28427 </para>
28428 <para>
28429 This option may also be useful for ignoring link-local and site-local IPv6
28430 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
28431 is expanded before use as a list, it is possible to make it dependent on the
28432 domain that is being routed.
28433 </para>
28434 <para>
28435 <indexterm role="concept">
28436 <primary><varname>$host_address</varname></primary>
28437 </indexterm>
28438 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
28439 checked.
28440 </para>
28441 <para>
28442 <indexterm role="option">
28443 <primary>initgroups</primary>
28444 </indexterm>
28445 </para>
28446 <informaltable frame="all">
28447 <tgroup cols="4" colsep="0" rowsep="0">
28448 <colspec colwidth="8*" align="left"/>
28449 <colspec colwidth="5*" align="center"/>
28450 <colspec colwidth="5*" align="center"/>
28451 <colspec colwidth="6*" align="right"/>
28452 <tbody>
28453 <row>
28454 <entry><option>initgroups</option></entry>
28455 <entry>Use: <emphasis>routers</emphasis></entry>
28456 <entry>Type: <emphasis>boolean</emphasis></entry>
28457 <entry>Default: <emphasis>false</emphasis></entry>
28458 </row>
28459 </tbody>
28460 </tgroup>
28461 </informaltable>
28462 <para>
28463 <indexterm role="concept">
28464 <primary>additional groups</primary>
28465 </indexterm>
28466 <indexterm role="concept">
28467 <primary>groups</primary>
28468 <secondary>additional</secondary>
28469 </indexterm>
28470 <indexterm role="concept">
28471 <primary>local transports</primary>
28472 <secondary>uid and gid</secondary>
28473 </indexterm>
28474 <indexterm role="concept">
28475 <primary>transport</primary>
28476 <secondary>local</secondary>
28477 </indexterm>
28478 If the router queues an address for a transport, and this option is true, and
28479 the uid supplied by the router is not overridden by the transport, the
28480 <function>initgroups()</function> function is called when running the transport to ensure that
28481 any additional groups associated with the uid are set up. See also <option>group</option>
28482 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
28483 </para>
28484 <para>
28485 <indexterm role="option">
28486 <primary>local_part_prefix</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>local_part_prefix</option></entry>
28498 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28499 <entry>Type: <emphasis>string list</emphasis></entry>
28500 <entry>Default: <emphasis>unset</emphasis></entry>
28501 </row>
28502 </tbody>
28503 </tgroup>
28504 </informaltable>
28505 <para>
28506 <indexterm role="concept">
28507 <primary>router</primary>
28508 <secondary>prefix for local part</secondary>
28509 </indexterm>
28510 <indexterm role="concept">
28511 <primary>prefix</primary>
28512 <secondary>for local part; used in router</secondary>
28513 </indexterm>
28514 If this option is set, the router is skipped unless the local part starts with
28515 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
28516 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
28517 evaluated.
28518 </para>
28519 <para>
28520 The list is scanned from left to right, and the first prefix that matches is
28521 used. A limited form of wildcard is available; if the prefix begins with an
28522 asterisk, it matches the longest possible sequence of arbitrary characters at
28523 the start of the local part. An asterisk should therefore always be followed by
28524 some character that does not occur in normal local parts.
28525 <indexterm role="concept">
28526 <primary>multiple mailboxes</primary>
28527 </indexterm>
28528 <indexterm role="concept">
28529 <primary>mailbox</primary>
28530 <secondary>multiple</secondary>
28531 </indexterm>
28532 Wildcarding can be used to set up multiple user mailboxes, as described in
28533 section <xref linkend="SECTmulbox"/>.
28534 </para>
28535 <para>
28536 <indexterm role="concept">
28537 <primary><varname>$local_part</varname></primary>
28538 </indexterm>
28539 <indexterm role="concept">
28540 <primary><varname>$local_part_prefix</varname></primary>
28541 </indexterm>
28542 During the testing of the <option>local_parts</option> option, and while the router is
28543 running, the prefix is removed from the local part, and is available in the
28544 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
28545 the router accepts the address, this remains true during subsequent delivery by
28546 a transport. In particular, the local part that is transmitted in the RCPT
28547 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
28548 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
28549 the relevant transport.
28550 </para>
28551 <para>
28552 When an address is being verified, <option>local_part_prefix</option> affects only the
28553 behaviour of the router. If the callout feature of verification is in use, this
28554 means that the full address, including the prefix, will be used during the
28555 callout.
28556 </para>
28557 <para>
28558 The prefix facility is commonly used to handle local parts of the form
28559 <option>owner-something</option>. Another common use is to support local parts of the form
28560 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
28561 to tell a user their forwarding is broken &ndash; by placing a router like this one
28562 immediately before the router that handles <filename>.forward</filename> files:
28563 </para>
28564 <literallayout class="monospaced">
28565 real_localuser:
28566   driver = accept
28567   local_part_prefix = real-
28568   check_local_user
28569   transport = local_delivery
28570 </literallayout>
28571 <para>
28572 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
28573 both conditions must be met if not optional. Care must be taken if wildcards
28574 are used in both a prefix and a suffix on the same router. Different
28575 separator characters must be used to avoid ambiguity.
28576 </para>
28577 <para>
28578 <indexterm role="option">
28579 <primary>local_part_prefix_optional</primary>
28580 </indexterm>
28581 </para>
28582 <informaltable frame="all">
28583 <tgroup cols="4" colsep="0" rowsep="0">
28584 <colspec colwidth="8*" align="left"/>
28585 <colspec colwidth="5*" align="center"/>
28586 <colspec colwidth="5*" align="center"/>
28587 <colspec colwidth="6*" align="right"/>
28588 <tbody>
28589 <row>
28590 <entry><option>local_part_prefix_optional</option></entry>
28591 <entry>Use: <emphasis>routers</emphasis></entry>
28592 <entry>Type: <emphasis>boolean</emphasis></entry>
28593 <entry>Default: <emphasis>false</emphasis></entry>
28594 </row>
28595 </tbody>
28596 </tgroup>
28597 </informaltable>
28598 <para>
28599 See <option>local_part_prefix</option> above.
28600 </para>
28601 <para>
28602 <indexterm role="option">
28603 <primary>local_part_suffix</primary>
28604 </indexterm>
28605 </para>
28606 <informaltable frame="all">
28607 <tgroup cols="4" colsep="0" rowsep="0">
28608 <colspec colwidth="8*" align="left"/>
28609 <colspec colwidth="5*" align="center"/>
28610 <colspec colwidth="5*" align="center"/>
28611 <colspec colwidth="6*" align="right"/>
28612 <tbody>
28613 <row>
28614 <entry><option>local_part_suffix</option></entry>
28615 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28616 <entry>Type: <emphasis>string list</emphasis></entry>
28617 <entry>Default: <emphasis>unset</emphasis></entry>
28618 </row>
28619 </tbody>
28620 </tgroup>
28621 </informaltable>
28622 <para>
28623 <indexterm role="concept">
28624 <primary>router</primary>
28625 <secondary>suffix for local part</secondary>
28626 </indexterm>
28627 <indexterm role="concept">
28628 <primary>suffix for local part</primary>
28629 <secondary>used in router</secondary>
28630 </indexterm>
28631 This option operates in the same way as <option>local_part_prefix</option>, except that the
28632 local part must end (rather than start) with the given string, the
28633 <option>local_part_suffix_optional</option> option determines whether the suffix is
28634 mandatory, and the wildcard * character, if present, must be the last
28635 character of the suffix. This option facility is commonly used to handle local
28636 parts of the form <option>something-request</option> and multiple user mailboxes of the form
28637 <option>username-foo</option>.
28638 </para>
28639 <para>
28640 <indexterm role="option">
28641 <primary>local_part_suffix_optional</primary>
28642 </indexterm>
28643 </para>
28644 <informaltable frame="all">
28645 <tgroup cols="4" colsep="0" rowsep="0">
28646 <colspec colwidth="8*" align="left"/>
28647 <colspec colwidth="5*" align="center"/>
28648 <colspec colwidth="5*" align="center"/>
28649 <colspec colwidth="6*" align="right"/>
28650 <tbody>
28651 <row>
28652 <entry><option>local_part_suffix_optional</option></entry>
28653 <entry>Use: <emphasis>routers</emphasis></entry>
28654 <entry>Type: <emphasis>boolean</emphasis></entry>
28655 <entry>Default: <emphasis>false</emphasis></entry>
28656 </row>
28657 </tbody>
28658 </tgroup>
28659 </informaltable>
28660 <para>
28661 See <option>local_part_suffix</option> above.
28662 </para>
28663 <para>
28664 <indexterm role="option">
28665 <primary>local_parts</primary>
28666 </indexterm>
28667 </para>
28668 <informaltable frame="all">
28669 <tgroup cols="4" colsep="0" rowsep="0">
28670 <colspec colwidth="8*" align="left"/>
28671 <colspec colwidth="5*" align="center"/>
28672 <colspec colwidth="5*" align="center"/>
28673 <colspec colwidth="6*" align="right"/>
28674 <tbody>
28675 <row>
28676 <entry><option>local_parts</option></entry>
28677 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28678 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
28679 <entry>Default: <emphasis>unset</emphasis></entry>
28680 </row>
28681 </tbody>
28682 </tgroup>
28683 </informaltable>
28684 <para>
28685 <indexterm role="concept">
28686 <primary>router</primary>
28687 <secondary>restricting to specific local parts</secondary>
28688 </indexterm>
28689 <indexterm role="concept">
28690 <primary>local part</primary>
28691 <secondary>checking in router</secondary>
28692 </indexterm>
28693 The router is run only if the local part of the address matches the list.
28694 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
28695 are evaluated, and
28696 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
28697 string is expanded, it is possible to make it depend on the domain, for
28698 example:
28699 </para>
28700 <literallayout class="monospaced">
28701 local_parts = dbm;/usr/local/specials/$domain
28702 </literallayout>
28703 <para>
28704 <indexterm role="concept">
28705 <primary><varname>$local_part_data</varname></primary>
28706 </indexterm>
28707 If the match is achieved by a lookup, the data that the lookup returned
28708 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
28709 expansions of the router&#x2019;s private options. You might use this option, for
28710 example, if you have a large number of local virtual domains, and you want to
28711 send all postmaster mail to the same place without having to set up an alias in
28712 each virtual domain:
28713 </para>
28714 <literallayout class="monospaced">
28715 postmaster:
28716   driver = redirect
28717   local_parts = postmaster
28718   data = postmaster@real.domain.example
28719 </literallayout>
28720 <para>
28721 <indexterm role="option">
28722 <primary>log_as_local</primary>
28723 </indexterm>
28724 </para>
28725 <informaltable frame="all">
28726 <tgroup cols="4" colsep="0" rowsep="0">
28727 <colspec colwidth="8*" align="left"/>
28728 <colspec colwidth="5*" align="center"/>
28729 <colspec colwidth="5*" align="center"/>
28730 <colspec colwidth="6*" align="right"/>
28731 <tbody>
28732 <row>
28733 <entry><option>log_as_local</option></entry>
28734 <entry>Use: <emphasis>routers</emphasis></entry>
28735 <entry>Type: <emphasis>boolean</emphasis></entry>
28736 <entry>Default: <emphasis>see below</emphasis></entry>
28737 </row>
28738 </tbody>
28739 </tgroup>
28740 </informaltable>
28741 <para>
28742 <indexterm role="concept">
28743 <primary>log</primary>
28744 <secondary>delivery line</secondary>
28745 </indexterm>
28746 <indexterm role="concept">
28747 <primary>delivery</primary>
28748 <secondary>log line format</secondary>
28749 </indexterm>
28750 Exim has two logging styles for delivery, the idea being to make local
28751 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
28752 recipient address is given just as the local part, without a domain. The use of
28753 this style is controlled by this option. It defaults to true for the <command>accept</command>
28754 router, and false for all the others. This option applies only when a
28755 router assigns an address to a transport. It has no effect on routers that
28756 redirect addresses.
28757 </para>
28758 <para>
28759 <indexterm role="option">
28760 <primary>more</primary>
28761 </indexterm>
28762 </para>
28763 <informaltable frame="all">
28764 <tgroup cols="4" colsep="0" rowsep="0">
28765 <colspec colwidth="8*" align="left"/>
28766 <colspec colwidth="5*" align="center"/>
28767 <colspec colwidth="5*" align="center"/>
28768 <colspec colwidth="6*" align="right"/>
28769 <tbody>
28770 <row>
28771 <entry><option>more</option></entry>
28772 <entry>Use: <emphasis>routers</emphasis></entry>
28773 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
28774 <entry>Default: <emphasis>true</emphasis></entry>
28775 </row>
28776 </tbody>
28777 </tgroup>
28778 </informaltable>
28779 <para>
28780 The result of string expansion for this option must be a valid boolean value,
28781 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
28782 result causes an error, and delivery is deferred. If the expansion is forced to
28783 fail, the default value for the option (true) is used. Other failures cause
28784 delivery to be deferred.
28785 </para>
28786 <para>
28787 If this option is set false, and the router declines to handle the address, no
28788 further routers are tried, routing fails, and the address is bounced.
28789 <indexterm role="concept">
28790 <primary><option>self</option> option</primary>
28791 </indexterm>
28792 However, if the router explicitly passes an address to the following router by
28793 means of the setting
28794 </para>
28795 <literallayout class="monospaced">
28796 self = pass
28797 </literallayout>
28798 <para>
28799 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
28800 does not affect the behaviour if one of the precondition tests fails. In that
28801 case, the address is always passed to the next router.
28802 </para>
28803 <para>
28804 Note that <option>address_data</option> is not considered to be a precondition. If its
28805 expansion is forced to fail, the router declines, and the value of <option>more</option>
28806 controls what happens next.
28807 </para>
28808 <para>
28809 <indexterm role="option">
28810 <primary>pass_on_timeout</primary>
28811 </indexterm>
28812 </para>
28813 <informaltable frame="all">
28814 <tgroup cols="4" colsep="0" rowsep="0">
28815 <colspec colwidth="8*" align="left"/>
28816 <colspec colwidth="5*" align="center"/>
28817 <colspec colwidth="5*" align="center"/>
28818 <colspec colwidth="6*" align="right"/>
28819 <tbody>
28820 <row>
28821 <entry><option>pass_on_timeout</option></entry>
28822 <entry>Use: <emphasis>routers</emphasis></entry>
28823 <entry>Type: <emphasis>boolean</emphasis></entry>
28824 <entry>Default: <emphasis>false</emphasis></entry>
28825 </row>
28826 </tbody>
28827 </tgroup>
28828 </informaltable>
28829 <para>
28830 <indexterm role="concept">
28831 <primary>timeout</primary>
28832 <secondary>of router</secondary>
28833 </indexterm>
28834 <indexterm role="concept">
28835 <primary>router</primary>
28836 <secondary>timeout</secondary>
28837 </indexterm>
28838 If a router times out during a host lookup, it normally causes deferral of the
28839 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
28840 router, overriding <option>no_more</option>. This may be helpful for systems that are
28841 intermittently connected to the Internet, or those that want to pass to a smart
28842 host any messages that cannot immediately be delivered.
28843 </para>
28844 <para>
28845 There are occasional other temporary errors that can occur while doing DNS
28846 lookups. They are treated in the same way as a timeout, and this option
28847 applies to all of them.
28848 </para>
28849 <para>
28850 <indexterm role="option">
28851 <primary>pass_router</primary>
28852 </indexterm>
28853 </para>
28854 <informaltable frame="all">
28855 <tgroup cols="4" colsep="0" rowsep="0">
28856 <colspec colwidth="8*" align="left"/>
28857 <colspec colwidth="5*" align="center"/>
28858 <colspec colwidth="5*" align="center"/>
28859 <colspec colwidth="6*" align="right"/>
28860 <tbody>
28861 <row>
28862 <entry><option>pass_router</option></entry>
28863 <entry>Use: <emphasis>routers</emphasis></entry>
28864 <entry>Type: <emphasis>string</emphasis></entry>
28865 <entry>Default: <emphasis>unset</emphasis></entry>
28866 </row>
28867 </tbody>
28868 </tgroup>
28869 </informaltable>
28870 <para>
28871 <indexterm role="concept">
28872 <primary>router</primary>
28873 <secondary>go to after <quote>pass</quote></secondary>
28874 </indexterm>
28875 When a router returns <quote>pass</quote>, the address is normally handed on to the next
28876 router in sequence. This can be changed by setting <option>pass_router</option> to the name
28877 of another router. However (unlike <option>redirect_router</option>) the named router must
28878 be below the current router, to avoid loops. Note that this option applies only
28879 to the special case of <quote>pass</quote>. It does not apply when a router returns
28880 <quote>decline</quote>.
28881 </para>
28882 <para>
28883 <indexterm role="option">
28884 <primary>redirect_router</primary>
28885 </indexterm>
28886 </para>
28887 <informaltable frame="all">
28888 <tgroup cols="4" colsep="0" rowsep="0">
28889 <colspec colwidth="8*" align="left"/>
28890 <colspec colwidth="5*" align="center"/>
28891 <colspec colwidth="5*" align="center"/>
28892 <colspec colwidth="6*" align="right"/>
28893 <tbody>
28894 <row>
28895 <entry><option>redirect_router</option></entry>
28896 <entry>Use: <emphasis>routers</emphasis></entry>
28897 <entry>Type: <emphasis>string</emphasis></entry>
28898 <entry>Default: <emphasis>unset</emphasis></entry>
28899 </row>
28900 </tbody>
28901 </tgroup>
28902 </informaltable>
28903 <para>
28904 <indexterm role="concept">
28905 <primary>router</primary>
28906 <secondary>start at after redirection</secondary>
28907 </indexterm>
28908 Sometimes an administrator knows that it is pointless to reprocess addresses
28909 generated from alias or forward files with the same router again. For
28910 example, if an alias file translates real names into login ids there is no
28911 point searching the alias file a second time, especially if it is a large file.
28912 </para>
28913 <para>
28914 The <option>redirect_router</option> option can be set to the name of any router instance.
28915 It causes the routing of any generated addresses to start at the named router
28916 instead of at the first router. This option has no effect if the router in
28917 which it is set does not generate new addresses.
28918 </para>
28919 <para>
28920 <indexterm role="option">
28921 <primary>require_files</primary>
28922 </indexterm>
28923 </para>
28924 <informaltable frame="all">
28925 <tgroup cols="4" colsep="0" rowsep="0">
28926 <colspec colwidth="8*" align="left"/>
28927 <colspec colwidth="5*" align="center"/>
28928 <colspec colwidth="5*" align="center"/>
28929 <colspec colwidth="6*" align="right"/>
28930 <tbody>
28931 <row>
28932 <entry><option>require_files</option></entry>
28933 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
28934 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
28935 <entry>Default: <emphasis>unset</emphasis></entry>
28936 </row>
28937 </tbody>
28938 </tgroup>
28939 </informaltable>
28940 <para>
28941 <indexterm role="concept">
28942 <primary>file</primary>
28943 <secondary>requiring for router</secondary>
28944 </indexterm>
28945 <indexterm role="concept">
28946 <primary>router</primary>
28947 <secondary>requiring file existence</secondary>
28948 </indexterm>
28949 This option provides a general mechanism for predicating the running of a
28950 router on the existence or non-existence of certain files or directories.
28951 Before running a router, as one of its precondition tests, Exim works its way
28952 through the <option>require_files</option> list, expanding each item separately.
28953 </para>
28954 <para>
28955 Because the list is split before expansion, any colons in expansion items must
28956 be doubled, or the facility for using a different list separator must be used.
28957 If any expansion is forced to fail, the item is ignored. Other expansion
28958 failures cause routing of the address to be deferred.
28959 </para>
28960 <para>
28961 If any expanded string is empty, it is ignored. Otherwise, except as described
28962 below, each string must be a fully qualified file path, optionally preceded by
28963 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
28964 existence of the files or directories. The router is skipped if any paths not
28965 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
28966 </para>
28967 <para>
28968 <indexterm role="concept">
28969 <primary>NFS</primary>
28970 </indexterm>
28971 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
28972 the message is deferred. This can happen when NFS-mounted filesystems are
28973 unavailable.
28974 </para>
28975 <para>
28976 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
28977 options, so you cannot use it to check for the existence of a file in which to
28978 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
28979 full list of the order in which preconditions are evaluated.) However, as
28980 these options are all expanded, you can use the <option>exists</option> expansion condition
28981 to make such tests. The <option>require_files</option> option is intended for checking files
28982 that the router may be going to use internally, or which are needed by a
28983 transport (for example <filename>.procmailrc</filename>).
28984 </para>
28985 <para>
28986 During delivery, the <function>stat()</function> function is run as root, but there is a
28987 facility for some checking of the accessibility of a file by another user.
28988 This is not a proper permissions check, but just a <quote>rough</quote> check that
28989 operates as follows:
28990 </para>
28991 <para>
28992 If an item in a <option>require_files</option> list does not contain any forward slash
28993 characters, it is taken to be the user (and optional group, separated by a
28994 comma) to be checked for subsequent files in the list. If no group is specified
28995 but the user is specified symbolically, the gid associated with the uid is
28996 used. For example:
28997 </para>
28998 <literallayout class="monospaced">
28999 require_files = mail:/some/file
29000 require_files = $local_part:$home/.procmailrc
29001 </literallayout>
29002 <para>
29003 If a user or group name in a <option>require_files</option> list does not exist, the
29004 <option>require_files</option> condition fails.
29005 </para>
29006 <para>
29007 Exim performs the check by scanning along the components of the file path, and
29008 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
29009 directories, and <quote>r</quote> access on the final file. Note that this means that file
29010 access control lists, if the operating system has them, are ignored.
29011 </para>
29012 <para>
29013 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
29014 incoming SMTP message, Exim is not running as root, but under its own uid. This
29015 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
29016 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
29017 user is not permitted to read one of the directories on the file&#x2019;s path.
29018 </para>
29019 <para>
29020 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
29021 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
29022 without root access. In this case, if a check for access by a particular user
29023 is requested, Exim creates a subprocess that runs as that user, and tries the
29024 check again in that process.
29025 </para>
29026 <para>
29027 The default action for handling an unresolved EACCES is to consider it to
29028 be caused by a configuration error, and routing is deferred because the
29029 existence or non-existence of the file cannot be determined. However, in some
29030 circumstances it may be desirable to treat this condition as if the file did
29031 not exist. If the file name (or the exclamation mark that precedes the file
29032 name for non-existence) is preceded by a plus sign, the EACCES error is treated
29033 as if the file did not exist. For example:
29034 </para>
29035 <literallayout class="monospaced">
29036 require_files = +/some/file
29037 </literallayout>
29038 <para>
29039 If the router is not an essential part of verification (for example, it
29040 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
29041 option false so that the router is skipped when verifying.
29042 </para>
29043 <para>
29044 <indexterm role="option">
29045 <primary>retry_use_local_part</primary>
29046 </indexterm>
29047 </para>
29048 <informaltable frame="all">
29049 <tgroup cols="4" colsep="0" rowsep="0">
29050 <colspec colwidth="8*" align="left"/>
29051 <colspec colwidth="5*" align="center"/>
29052 <colspec colwidth="5*" align="center"/>
29053 <colspec colwidth="6*" align="right"/>
29054 <tbody>
29055 <row>
29056 <entry><option>retry_use_local_part</option></entry>
29057 <entry>Use: <emphasis>routers</emphasis></entry>
29058 <entry>Type: <emphasis>boolean</emphasis></entry>
29059 <entry>Default: <emphasis>see below</emphasis></entry>
29060 </row>
29061 </tbody>
29062 </tgroup>
29063 </informaltable>
29064 <para>
29065 <indexterm role="concept">
29066 <primary>hints database</primary>
29067 <secondary>retry keys</secondary>
29068 </indexterm>
29069 <indexterm role="concept">
29070 <primary>local part</primary>
29071 <secondary>in retry keys</secondary>
29072 </indexterm>
29073 When a delivery suffers a temporary routing failure, a retry record is created
29074 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
29075 domain, the key for the retry record should not involve the local part, but for
29076 other addresses, both the domain and the local part should be included.
29077 Usually, remote routing is of the former kind, and local routing is of the
29078 latter kind.
29079 </para>
29080 <para>
29081 This option controls whether the local part is used to form the key for retry
29082 hints for addresses that suffer temporary errors while being handled by this
29083 router. The default value is true for any router that has <option>check_local_user</option>
29084 set, and false otherwise. Note that this option does not apply to hints keys
29085 for transport delays; they are controlled by a generic transport option of the
29086 same name.
29087 </para>
29088 <para>
29089 The setting of <option>retry_use_local_part</option> applies only to the router on which it
29090 appears. If the router generates child addresses, they are routed
29091 independently; this setting does not become attached to them.
29092 </para>
29093 <para>
29094 <indexterm role="option">
29095 <primary>router_home_directory</primary>
29096 </indexterm>
29097 </para>
29098 <informaltable frame="all">
29099 <tgroup cols="4" colsep="0" rowsep="0">
29100 <colspec colwidth="8*" align="left"/>
29101 <colspec colwidth="5*" align="center"/>
29102 <colspec colwidth="5*" align="center"/>
29103 <colspec colwidth="6*" align="right"/>
29104 <tbody>
29105 <row>
29106 <entry><option>router_home_directory</option></entry>
29107 <entry>Use: <emphasis>routers</emphasis></entry>
29108 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29109 <entry>Default: <emphasis>unset</emphasis></entry>
29110 </row>
29111 </tbody>
29112 </tgroup>
29113 </informaltable>
29114 <para>
29115 <indexterm role="concept">
29116 <primary>router</primary>
29117 <secondary>home directory for</secondary>
29118 </indexterm>
29119 <indexterm role="concept">
29120 <primary>home directory</primary>
29121 <secondary>for router</secondary>
29122 </indexterm>
29123 <indexterm role="concept">
29124 <primary><varname>$home</varname></primary>
29125 </indexterm>
29126 This option sets a home directory for use while the router is running. (Compare
29127 <option>transport_home_directory</option>, which sets a home directory for later
29128 transporting.) In particular, if used on a <command>redirect</command> router, this option
29129 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
29130 forced expansion failure causes the option to be ignored &ndash; other failures
29131 cause the router to defer.
29132 </para>
29133 <para>
29134 Expansion of <option>router_home_directory</option> happens immediately after the
29135 <option>check_local_user</option> test (if configured), before any further expansions take
29136 place.
29137 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29138 are evaluated.)
29139 While the router is running, <option>router_home_directory</option> overrides the value of
29140 <varname>$home</varname> that came from <option>check_local_user</option>.
29141 </para>
29142 <para>
29143 When a router accepts an address and assigns it to a local transport (including
29144 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
29145 delivery), the home directory setting for the transport is taken from the first
29146 of these values that is set:
29147 </para>
29148 <itemizedlist>
29149 <listitem>
29150 <para>
29151 The <option>home_directory</option> option on the transport;
29152 </para>
29153 </listitem>
29154 <listitem>
29155 <para>
29156 The <option>transport_home_directory</option> option on the router;
29157 </para>
29158 </listitem>
29159 <listitem>
29160 <para>
29161 The password data if <option>check_local_user</option> is set on the router;
29162 </para>
29163 </listitem>
29164 <listitem>
29165 <para>
29166 The <option>router_home_directory</option> option on the router.
29167 </para>
29168 </listitem>
29169 </itemizedlist>
29170 <para>
29171 In other words, <option>router_home_directory</option> overrides the password data for the
29172 router, but not for the transport.
29173 </para>
29174 <para>
29175 <indexterm role="option">
29176 <primary>self</primary>
29177 </indexterm>
29178 </para>
29179 <informaltable frame="all">
29180 <tgroup cols="4" colsep="0" rowsep="0">
29181 <colspec colwidth="8*" align="left"/>
29182 <colspec colwidth="5*" align="center"/>
29183 <colspec colwidth="5*" align="center"/>
29184 <colspec colwidth="6*" align="right"/>
29185 <tbody>
29186 <row>
29187 <entry><option>self</option></entry>
29188 <entry>Use: <emphasis>routers</emphasis></entry>
29189 <entry>Type: <emphasis>string</emphasis></entry>
29190 <entry>Default: <emphasis>freeze</emphasis></entry>
29191 </row>
29192 </tbody>
29193 </tgroup>
29194 </informaltable>
29195 <para>
29196 <indexterm role="concept">
29197 <primary>MX record</primary>
29198 <secondary>pointing to local host</secondary>
29199 </indexterm>
29200 <indexterm role="concept">
29201 <primary>local host</primary>
29202 <secondary>MX pointing to</secondary>
29203 </indexterm>
29204 This option applies to those routers that use a recipient address to find a
29205 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
29206 and <command>manualroute</command> routers.
29207 Certain configurations of the <command>queryprogram</command> router can also specify a list
29208 of remote hosts.
29209 Usually such routers are configured to send the message to a remote host via an
29210 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
29211 host on the list turns out to be the local host.
29212 The way in which Exim checks for the local host is described in section
29213 <xref linkend="SECTreclocipadd"/>.
29214 </para>
29215 <para>
29216 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
29217 example, the router should be configured not to process this domain), or an
29218 error in the DNS (for example, the MX should not point to this host). For this
29219 reason, the default action is to log the incident, defer the address, and
29220 freeze the message. The following alternatives are provided for use in special
29221 cases:
29222 </para>
29223 <variablelist>
29224 <varlistentry>
29225 <term><option>defer</option></term>
29226 <listitem>
29227 <para>
29228 Delivery of the message is tried again later, but the message is not frozen.
29229 </para>
29230 </listitem></varlistentry>
29231 <varlistentry>
29232 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
29233 <listitem>
29234 <para>
29235 The domain is changed to the given domain, and the address is passed back to
29236 be reprocessed by the routers. No rewriting of headers takes place. This
29237 behaviour is essentially a redirection.
29238 </para>
29239 </listitem></varlistentry>
29240 <varlistentry>
29241 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
29242 <listitem>
29243 <para>
29244 The domain is changed to the given domain, and the address is passed back to be
29245 reprocessed by the routers. Any headers that contain the original domain are
29246 rewritten.
29247 </para>
29248 </listitem></varlistentry>
29249 <varlistentry>
29250 <term><option>pass</option></term>
29251 <listitem>
29252 <para>
29253 <indexterm role="concept">
29254 <primary><option>more</option> option</primary>
29255 </indexterm>
29256 <indexterm role="concept">
29257 <primary><varname>$self_hostname</varname></primary>
29258 </indexterm>
29259 The router passes the address to the next router, or to the router named in the
29260 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
29261 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
29262 name of the local host that the router encountered. This can be used to
29263 distinguish between different cases for hosts with multiple names. The
29264 combination
29265 </para>
29266 <literallayout class="monospaced">
29267 self = pass
29268 no_more
29269 </literallayout>
29270 <para>
29271 ensures that only those addresses that routed to the local host are passed on.
29272 Without <option>no_more</option>, addresses that were declined for other reasons would also
29273 be passed to the next router.
29274 </para>
29275 </listitem></varlistentry>
29276 <varlistentry>
29277 <term><option>fail</option></term>
29278 <listitem>
29279 <para>
29280 Delivery fails and an error report is generated.
29281 </para>
29282 </listitem></varlistentry>
29283 <varlistentry>
29284 <term><option>send</option></term>
29285 <listitem>
29286 <para>
29287 <indexterm role="concept">
29288 <primary>local host</primary>
29289 <secondary>sending to</secondary>
29290 </indexterm>
29291 The anomaly is ignored and the address is queued for the transport. This
29292 setting should be used with extreme caution. For an <command>smtp</command> transport, it
29293 makes sense only in cases where the program that is listening on the SMTP port
29294 is not this version of Exim. That is, it must be some other MTA, or Exim with a
29295 different configuration file that handles the domain in another way.
29296 </para>
29297 </listitem></varlistentry>
29298 </variablelist>
29299 <para>
29300 <indexterm role="option">
29301 <primary>senders</primary>
29302 </indexterm>
29303 </para>
29304 <informaltable frame="all">
29305 <tgroup cols="4" colsep="0" rowsep="0">
29306 <colspec colwidth="8*" align="left"/>
29307 <colspec colwidth="5*" align="center"/>
29308 <colspec colwidth="5*" align="center"/>
29309 <colspec colwidth="6*" align="right"/>
29310 <tbody>
29311 <row>
29312 <entry><option>senders</option></entry>
29313 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29314 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
29315 <entry>Default: <emphasis>unset</emphasis></entry>
29316 </row>
29317 </tbody>
29318 </tgroup>
29319 </informaltable>
29320 <para>
29321 <indexterm role="concept">
29322 <primary>router</primary>
29323 <secondary>checking senders</secondary>
29324 </indexterm>
29325 If this option is set, the router is skipped unless the message&#x2019;s sender
29326 address matches something on the list.
29327 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29328 are evaluated.
29329 </para>
29330 <para>
29331 There are issues concerning verification when the running of routers is
29332 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
29333 setting, it sets the sender to the null string. When using the <option>-bt</option> option
29334 to check a configuration file, it is necessary also to use the <option>-f</option> option to
29335 set an appropriate sender. For incoming mail, the sender is unset when
29336 verifying the sender, but is available when verifying any recipients. If the
29337 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
29338 matters.
29339 </para>
29340 <para>
29341 <indexterm role="option">
29342 <primary>translate_ip_address</primary>
29343 </indexterm>
29344 </para>
29345 <informaltable frame="all">
29346 <tgroup cols="4" colsep="0" rowsep="0">
29347 <colspec colwidth="8*" align="left"/>
29348 <colspec colwidth="5*" align="center"/>
29349 <colspec colwidth="5*" align="center"/>
29350 <colspec colwidth="6*" align="right"/>
29351 <tbody>
29352 <row>
29353 <entry><option>translate_ip_address</option></entry>
29354 <entry>Use: <emphasis>routers</emphasis></entry>
29355 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29356 <entry>Default: <emphasis>unset</emphasis></entry>
29357 </row>
29358 </tbody>
29359 </tgroup>
29360 </informaltable>
29361 <para>
29362 <indexterm role="concept">
29363 <primary>IP address</primary>
29364 <secondary>translating</secondary>
29365 </indexterm>
29366 <indexterm role="concept">
29367 <primary>packet radio</primary>
29368 </indexterm>
29369 <indexterm role="concept">
29370 <primary>router</primary>
29371 <secondary>IP address translation</secondary>
29372 </indexterm>
29373 There exist some rare networking situations (for example, packet radio) where
29374 it is helpful to be able to translate IP addresses generated by normal routing
29375 mechanisms into other IP addresses, thus performing a kind of manual IP
29376 routing. This should be done only if the normal IP routing of the TCP/IP stack
29377 is inadequate or broken. Because this is an extremely uncommon requirement, the
29378 code to support this option is not included in the Exim binary unless
29379 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
29380 </para>
29381 <para>
29382 <indexterm role="concept">
29383 <primary><varname>$host_address</varname></primary>
29384 </indexterm>
29385 The <option>translate_ip_address</option> string is expanded for every IP address generated
29386 by the router, with the generated address set in <varname>$host_address</varname>. If the
29387 expansion is forced to fail, no action is taken.
29388 For any other expansion error, delivery of the message is deferred.
29389 If the result of the expansion is an IP address, that replaces the original
29390 address; otherwise the result is assumed to be a host name &ndash; this is looked
29391 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
29392 produce one or more replacement IP addresses. For example, to subvert all IP
29393 addresses in some specific networks, this could be added to a router:
29394 </para>
29395 <literallayout class="monospaced">
29396 translate_ip_address = \
29397   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
29398     {$value}fail}}
29399 </literallayout>
29400 <para>
29401 The file would contain lines like
29402 </para>
29403 <literallayout class="monospaced">
29404 10.2.3.128/26    some.host
29405 10.8.4.34/26     10.44.8.15
29406 </literallayout>
29407 <para>
29408 You should not make use of this facility unless you really understand what you
29409 are doing.
29410 </para>
29411 <para>
29412 <indexterm role="option">
29413 <primary>transport</primary>
29414 </indexterm>
29415 </para>
29416 <informaltable frame="all">
29417 <tgroup cols="4" colsep="0" rowsep="0">
29418 <colspec colwidth="8*" align="left"/>
29419 <colspec colwidth="5*" align="center"/>
29420 <colspec colwidth="5*" align="center"/>
29421 <colspec colwidth="6*" align="right"/>
29422 <tbody>
29423 <row>
29424 <entry><option>transport</option></entry>
29425 <entry>Use: <emphasis>routers</emphasis></entry>
29426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29427 <entry>Default: <emphasis>unset</emphasis></entry>
29428 </row>
29429 </tbody>
29430 </tgroup>
29431 </informaltable>
29432 <para>
29433 This option specifies the transport to be used when a router accepts an address
29434 and sets it up for delivery. A transport is never needed if a router is used
29435 only for verification. The value of the option is expanded at routing time,
29436 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
29437 and result must be the name of one of the configured transports. If it is not,
29438 delivery is deferred.
29439 </para>
29440 <para>
29441 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
29442 have some private options that set up transports for pipe and file deliveries
29443 (see chapter <xref linkend="CHAPredirect"/>).
29444 </para>
29445 <para>
29446 <indexterm role="option">
29447 <primary>transport_current_directory</primary>
29448 </indexterm>
29449 </para>
29450 <informaltable frame="all">
29451 <tgroup cols="4" colsep="0" rowsep="0">
29452 <colspec colwidth="8*" align="left"/>
29453 <colspec colwidth="5*" align="center"/>
29454 <colspec colwidth="5*" align="center"/>
29455 <colspec colwidth="6*" align="right"/>
29456 <tbody>
29457 <row>
29458 <entry><option>transport_current_directory</option></entry>
29459 <entry>Use: <emphasis>routers</emphasis></entry>
29460 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29461 <entry>Default: <emphasis>unset</emphasis></entry>
29462 </row>
29463 </tbody>
29464 </tgroup>
29465 </informaltable>
29466 <para>
29467 <indexterm role="concept">
29468 <primary>current directory for local transport</primary>
29469 </indexterm>
29470 This option associates a current directory with any address that is routed
29471 to a local transport. This can happen either because a transport is
29472 explicitly configured for the router, or because it generates a delivery to a
29473 file or a pipe. During the delivery process (that is, at transport time), this
29474 option string is expanded and is set as the current directory, unless
29475 overridden by a setting on the transport.
29476 If the expansion fails for any reason, including forced failure, an error is
29477 logged, and delivery is deferred.
29478 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
29479 environment.
29480 </para>
29481 <para>
29482 <indexterm role="option">
29483 <primary>transport_home_directory</primary>
29484 </indexterm>
29485 </para>
29486 <informaltable frame="all">
29487 <tgroup cols="4" colsep="0" rowsep="0">
29488 <colspec colwidth="8*" align="left"/>
29489 <colspec colwidth="5*" align="center"/>
29490 <colspec colwidth="5*" align="center"/>
29491 <colspec colwidth="6*" align="right"/>
29492 <tbody>
29493 <row>
29494 <entry><option>transport_home_directory</option></entry>
29495 <entry>Use: <emphasis>routers</emphasis></entry>
29496 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29497 <entry>Default: <emphasis>see below</emphasis></entry>
29498 </row>
29499 </tbody>
29500 </tgroup>
29501 </informaltable>
29502 <para>
29503 <indexterm role="concept">
29504 <primary>home directory</primary>
29505 <secondary>for local transport</secondary>
29506 </indexterm>
29507 This option associates a home directory with any address that is routed to a
29508 local transport. This can happen either because a transport is explicitly
29509 configured for the router, or because it generates a delivery to a file or a
29510 pipe. During the delivery process (that is, at transport time), the option
29511 string is expanded and is set as the home directory, unless overridden by a
29512 setting of <option>home_directory</option> on the transport.
29513 If the expansion fails for any reason, including forced failure, an error is
29514 logged, and delivery is deferred.
29515 </para>
29516 <para>
29517 If the transport does not specify a home directory, and
29518 <option>transport_home_directory</option> is not set for the router, the home directory for
29519 the tranport is taken from the password data if <option>check_local_user</option> is set for
29520 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
29521 is set; if not, no home directory is set for the transport.
29522 </para>
29523 <para>
29524 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
29525 environment.
29526 </para>
29527 <para>
29528 <indexterm role="option">
29529 <primary>unseen</primary>
29530 </indexterm>
29531 </para>
29532 <informaltable frame="all">
29533 <tgroup cols="4" colsep="0" rowsep="0">
29534 <colspec colwidth="8*" align="left"/>
29535 <colspec colwidth="5*" align="center"/>
29536 <colspec colwidth="5*" align="center"/>
29537 <colspec colwidth="6*" align="right"/>
29538 <tbody>
29539 <row>
29540 <entry><option>unseen</option></entry>
29541 <entry>Use: <emphasis>routers</emphasis></entry>
29542 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
29543 <entry>Default: <emphasis>false</emphasis></entry>
29544 </row>
29545 </tbody>
29546 </tgroup>
29547 </informaltable>
29548 <para>
29549 <indexterm role="concept">
29550 <primary>router</primary>
29551 <secondary>carrying on after success</secondary>
29552 </indexterm>
29553 The result of string expansion for this option must be a valid boolean value,
29554 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
29555 result causes an error, and delivery is deferred. If the expansion is forced to
29556 fail, the default value for the option (false) is used. Other failures cause
29557 delivery to be deferred.
29558 </para>
29559 <para>
29560 When this option is set true, routing does not cease if the router accepts the
29561 address. Instead, a copy of the incoming address is passed to the next router,
29562 overriding a false setting of <option>more</option>. There is little point in setting
29563 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
29564 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
29565 sometimes true and sometimes false).
29566 </para>
29567 <para>
29568 <indexterm role="concept">
29569 <primary>copy of message (<option>unseen</option> option)</primary>
29570 </indexterm>
29571 The <option>unseen</option> option can be used to cause copies of messages to be delivered
29572 to some other destination, while also carrying out a normal delivery. In
29573 effect, the current address is made into a <quote>parent</quote> that has two children &ndash;
29574 one that is delivered as specified by this router, and a clone that goes on to
29575 be routed further. For this reason, <option>unseen</option> may not be combined with the
29576 <option>one_time</option> option in a <command>redirect</command> router.
29577 </para>
29578 <para>
29579 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
29580 this router or by previous routers affect the <quote>unseen</quote> copy of the message
29581 only. The clone that continues to be processed by further routers starts with
29582 no added headers and none specified for removal. However, any data that was set
29583 by the <option>address_data</option> option in the current or previous routers is passed on.
29584 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
29585 qualifier in filter files.
29586 </para>
29587 <para>
29588 <indexterm role="option">
29589 <primary>user</primary>
29590 </indexterm>
29591 </para>
29592 <informaltable frame="all">
29593 <tgroup cols="4" colsep="0" rowsep="0">
29594 <colspec colwidth="8*" align="left"/>
29595 <colspec colwidth="5*" align="center"/>
29596 <colspec colwidth="5*" align="center"/>
29597 <colspec colwidth="6*" align="right"/>
29598 <tbody>
29599 <row>
29600 <entry><option>user</option></entry>
29601 <entry>Use: <emphasis>routers</emphasis></entry>
29602 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29603 <entry>Default: <emphasis>see below</emphasis></entry>
29604 </row>
29605 </tbody>
29606 </tgroup>
29607 </informaltable>
29608 <para>
29609 <indexterm role="concept">
29610 <primary>uid (user id)</primary>
29611 <secondary>local delivery</secondary>
29612 </indexterm>
29613 <indexterm role="concept">
29614 <primary>local transports</primary>
29615 <secondary>uid and gid</secondary>
29616 </indexterm>
29617 <indexterm role="concept">
29618 <primary>transport</primary>
29619 <secondary>local</secondary>
29620 </indexterm>
29621 <indexterm role="concept">
29622 <primary>router</primary>
29623 <secondary>user for filter processing</secondary>
29624 </indexterm>
29625 <indexterm role="concept">
29626 <primary>filter</primary>
29627 <secondary>user for processing</secondary>
29628 </indexterm>
29629 When a router queues an address for a transport, and the transport does not
29630 specify a user, the user given here is used when running the delivery process.
29631 The user may be specified numerically or by name. If expansion fails, the
29632 error is logged and delivery is deferred.
29633 This user is also used by the <command>redirect</command> router when running a filter file.
29634 The default is unset, except when <option>check_local_user</option> is set. In this case,
29635 the default is taken from the password information. If the user is specified as
29636 a name, and <option>group</option> is not set, the group associated with the user is used.
29637 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
29638 <xref linkend="CHAPenvironment"/>.
29639 </para>
29640 <para>
29641 <indexterm role="option">
29642 <primary>verify</primary>
29643 </indexterm>
29644 </para>
29645 <informaltable frame="all">
29646 <tgroup cols="4" colsep="0" rowsep="0">
29647 <colspec colwidth="8*" align="left"/>
29648 <colspec colwidth="5*" align="center"/>
29649 <colspec colwidth="5*" align="center"/>
29650 <colspec colwidth="6*" align="right"/>
29651 <tbody>
29652 <row>
29653 <entry><option>verify</option></entry>
29654 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29655 <entry>Type: <emphasis>boolean</emphasis></entry>
29656 <entry>Default: <emphasis>true</emphasis></entry>
29657 </row>
29658 </tbody>
29659 </tgroup>
29660 </informaltable>
29661 <para>
29662 Setting this option has the effect of setting <option>verify_sender</option> and
29663 <option>verify_recipient</option> to the same value.
29664 </para>
29665 <para>
29666 <indexterm role="option">
29667 <primary>verify_only</primary>
29668 </indexterm>
29669 </para>
29670 <informaltable frame="all">
29671 <tgroup cols="4" colsep="0" rowsep="0">
29672 <colspec colwidth="8*" align="left"/>
29673 <colspec colwidth="5*" align="center"/>
29674 <colspec colwidth="5*" align="center"/>
29675 <colspec colwidth="6*" align="right"/>
29676 <tbody>
29677 <row>
29678 <entry><option>verify_only</option></entry>
29679 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29680 <entry>Type: <emphasis>boolean</emphasis></entry>
29681 <entry>Default: <emphasis>false</emphasis></entry>
29682 </row>
29683 </tbody>
29684 </tgroup>
29685 </informaltable>
29686 <para>
29687 <indexterm role="concept">
29688 <primary>EXPN</primary>
29689 <secondary>with <option>verify_only</option></secondary>
29690 </indexterm>
29691 <indexterm role="concept">
29692 <primary><option>-bv</option> option</primary>
29693 </indexterm>
29694 <indexterm role="concept">
29695 <primary>router</primary>
29696 <secondary>used only when verifying</secondary>
29697 </indexterm>
29698 If this option is set, the router is used only when verifying an address or
29699 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
29700 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
29701 restricted to verifying only senders or recipients by means of
29702 <option>verify_sender</option> and <option>verify_recipient</option>.
29703 </para>
29704 <para>
29705 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
29706 SMTP message, Exim is not running as root, but under its own uid. If the router
29707 accesses any files, you need to make sure that they are accessible to the Exim
29708 user or group.
29709 </para>
29710 <para>
29711 <indexterm role="option">
29712 <primary>verify_recipient</primary>
29713 </indexterm>
29714 </para>
29715 <informaltable frame="all">
29716 <tgroup cols="4" colsep="0" rowsep="0">
29717 <colspec colwidth="8*" align="left"/>
29718 <colspec colwidth="5*" align="center"/>
29719 <colspec colwidth="5*" align="center"/>
29720 <colspec colwidth="6*" align="right"/>
29721 <tbody>
29722 <row>
29723 <entry><option>verify_recipient</option></entry>
29724 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29725 <entry>Type: <emphasis>boolean</emphasis></entry>
29726 <entry>Default: <emphasis>true</emphasis></entry>
29727 </row>
29728 </tbody>
29729 </tgroup>
29730 </informaltable>
29731 <para>
29732 If this option is false, the router is skipped when verifying recipient
29733 addresses
29734 or testing recipient verification using <option>-bv</option>.
29735 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29736 are evaluated.
29737 </para>
29738 <para>
29739 <indexterm role="option">
29740 <primary>verify_sender</primary>
29741 </indexterm>
29742 </para>
29743 <informaltable frame="all">
29744 <tgroup cols="4" colsep="0" rowsep="0">
29745 <colspec colwidth="8*" align="left"/>
29746 <colspec colwidth="5*" align="center"/>
29747 <colspec colwidth="5*" align="center"/>
29748 <colspec colwidth="6*" align="right"/>
29749 <tbody>
29750 <row>
29751 <entry><option>verify_sender</option></entry>
29752 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
29753 <entry>Type: <emphasis>boolean</emphasis></entry>
29754 <entry>Default: <emphasis>true</emphasis></entry>
29755 </row>
29756 </tbody>
29757 </tgroup>
29758 </informaltable>
29759 <para>
29760 If this option is false, the router is skipped when verifying sender addresses
29761 or testing sender verification using <option>-bvs</option>.
29762 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
29763 are evaluated.
29764 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
29765 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
29766 </para>
29767 </chapter>
29768
29769 <chapter>
29770 <title>The accept router</title>
29771 <para>
29772 <indexterm role="concept">
29773 <primary><command>accept</command> router</primary>
29774 </indexterm>
29775 <indexterm role="concept">
29776 <primary>routers</primary>
29777 <secondary><command>accept</command></secondary>
29778 </indexterm>
29779 The <command>accept</command> router has no private options of its own. Unless it is being
29780 used purely for verification (see <option>verify_only</option>) a transport is required to
29781 be defined by the generic <option>transport</option> option. If the preconditions that are
29782 specified by generic options are met, the router accepts the address and queues
29783 it for the given transport. The most common use of this router is for setting
29784 up deliveries to local mailboxes. For example:
29785 </para>
29786 <literallayout class="monospaced">
29787 localusers:
29788   driver = accept
29789   domains = mydomain.example
29790   check_local_user
29791   transport = local_delivery
29792 </literallayout>
29793 <para>
29794 The <option>domains</option> condition in this example checks the domain of the address, and
29795 <option>check_local_user</option> checks that the local part is the login of a local user.
29796 When both preconditions are met, the <command>accept</command> router runs, and queues the
29797 address for the <command>local_delivery</command> transport.
29798 </para>
29799 </chapter>
29800
29801 <chapter id="CHAPdnslookup">
29802 <title>The dnslookup router</title>
29803 <para>
29804 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
29805 <primary><command>dnslookup</command> router</primary>
29806 </indexterm>
29807 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
29808 <primary>routers</primary>
29809 <secondary><command>dnslookup</command></secondary>
29810 </indexterm>
29811 The <command>dnslookup</command> router looks up the hosts that handle mail for the
29812 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
29813 unless <option>verify_only</option> is set.
29814 </para>
29815 <para>
29816 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
29817 SRV records. If none are found, or if SRV support is not configured,
29818 MX records are looked up. If no MX records exist, address records are sought.
29819 However, <option>mx_domains</option> can be set to disable the direct use of address
29820 records.
29821 </para>
29822 <para>
29823 MX records of equal priority are sorted by Exim into a random order. Exim then
29824 looks for address records for the host names obtained from MX or SRV records.
29825 When a host has more than one IP address, they are sorted into a random order,
29826 except that IPv6 addresses are always sorted before IPv4 addresses. If all the
29827 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
29828 generic option, the router declines.
29829 </para>
29830 <para>
29831 Unless they have the highest priority (lowest MX value), MX records that point
29832 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
29833 are discarded, together with any other MX records of equal or lower priority.
29834 </para>
29835 <para>
29836 <indexterm role="concept">
29837 <primary>MX record</primary>
29838 <secondary>pointing to local host</secondary>
29839 </indexterm>
29840 <indexterm role="concept">
29841 <primary>local host</primary>
29842 <secondary>MX pointing to</secondary>
29843 </indexterm>
29844 <indexterm role="concept">
29845 <primary><option>self</option> option</primary>
29846 <secondary>in <command>dnslookup</command> router</secondary>
29847 </indexterm>
29848 If the host pointed to by the highest priority MX record, or looked up as an
29849 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
29850 happens is controlled by the generic <option>self</option> option.
29851 </para>
29852 <section id="SECTprowitdnsloo">
29853 <title>Problems with DNS lookups</title>
29854 <para>
29855 There have been problems with DNS servers when SRV records are looked up.
29856 Some mis-behaving servers return a DNS error or timeout when a non-existent
29857 SRV record is sought. Similar problems have in the past been reported for
29858 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
29859 problem, but it is heavy-handed because it is a global option.
29860 </para>
29861 <para>
29862 For this reason, there are two options, <option>srv_fail_domains</option> and
29863 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
29864 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
29865 an attempt to look up an SRV or MX record causes one of these results, and the
29866 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
29867 such record</quote>. In the case of an SRV lookup, this means that the router
29868 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
29869 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
29870 case routing fails.
29871 </para>
29872 </section>
29873 <section>
29874 <title>Private options for dnslookup</title>
29875 <para>
29876 <indexterm role="concept">
29877 <primary>options</primary>
29878 <secondary><command>dnslookup</command> router</secondary>
29879 </indexterm>
29880 The private options for the <command>dnslookup</command> router are as follows:
29881 </para>
29882 <para>
29883 <indexterm role="option">
29884 <primary>check_secondary_mx</primary>
29885 </indexterm>
29886 </para>
29887 <informaltable frame="all">
29888 <tgroup cols="4" colsep="0" rowsep="0">
29889 <colspec colwidth="8*" align="left"/>
29890 <colspec colwidth="5*" align="center"/>
29891 <colspec colwidth="5*" align="center"/>
29892 <colspec colwidth="6*" align="right"/>
29893 <tbody>
29894 <row>
29895 <entry><option>check_secondary_mx</option></entry>
29896 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29897 <entry>Type: <emphasis>boolean</emphasis></entry>
29898 <entry>Default: <emphasis>false</emphasis></entry>
29899 </row>
29900 </tbody>
29901 </tgroup>
29902 </informaltable>
29903 <para>
29904 <indexterm role="concept">
29905 <primary>MX record</primary>
29906 <secondary>checking for secondary</secondary>
29907 </indexterm>
29908 If this option is set, the router declines unless the local host is found in
29909 (and removed from) the list of hosts obtained by MX lookup. This can be used to
29910 process domains for which the local host is a secondary mail exchanger
29911 differently to other domains. The way in which Exim decides whether a host is
29912 the local host is described in section <xref linkend="SECTreclocipadd"/>.
29913 </para>
29914 <para>
29915 <indexterm role="option">
29916 <primary>check_srv</primary>
29917 </indexterm>
29918 </para>
29919 <informaltable frame="all">
29920 <tgroup cols="4" colsep="0" rowsep="0">
29921 <colspec colwidth="8*" align="left"/>
29922 <colspec colwidth="5*" align="center"/>
29923 <colspec colwidth="5*" align="center"/>
29924 <colspec colwidth="6*" align="right"/>
29925 <tbody>
29926 <row>
29927 <entry><option>check_srv</option></entry>
29928 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29929 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29930 <entry>Default: <emphasis>unset</emphasis></entry>
29931 </row>
29932 </tbody>
29933 </tgroup>
29934 </informaltable>
29935 <para>
29936 <indexterm role="concept">
29937 <primary>SRV record</primary>
29938 <secondary>enabling use of</secondary>
29939 </indexterm>
29940 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
29941 addition to MX and address records. The support is disabled by default. To
29942 enable SRV support, set the <option>check_srv</option> option to the name of the service
29943 required. For example,
29944 </para>
29945 <literallayout class="monospaced">
29946 check_srv = smtp
29947 </literallayout>
29948 <para>
29949 looks for SRV records that refer to the normal smtp service. The option is
29950 expanded, so the service name can vary from message to message or address
29951 to address. This might be helpful if SRV records are being used for a
29952 submission service. If the expansion is forced to fail, the <option>check_srv</option>
29953 option is ignored, and the router proceeds to look for MX records in the
29954 normal way.
29955 </para>
29956 <para>
29957 When the expansion succeeds, the router searches first for SRV records for
29958 the given service (it assumes TCP protocol). A single SRV record with a
29959 host name that consists of just a single dot indicates <quote>no such service for
29960 this domain</quote>; if this is encountered, the router declines. If other kinds of
29961 SRV record are found, they are used to construct a host list for delivery
29962 according to the rules of RFC 2782. MX records are not sought in this case.
29963 </para>
29964 <para>
29965 When no SRV records are found, MX records (and address records) are sought in
29966 the traditional way. In other words, SRV records take precedence over MX
29967 records, just as MX records take precedence over address records. Note that
29968 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
29969 defined it. It is apparently believed that MX records are sufficient for email
29970 and that SRV records should not be used for this purpose. However, SRV records
29971 have an additional <quote>weight</quote> feature which some people might find useful when
29972 trying to split an SMTP load between hosts of different power.
29973 </para>
29974 <para>
29975 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
29976 when there is a DNS lookup error.
29977 </para>
29978 <para>
29979 <indexterm role="option">
29980 <primary>mx_domains</primary>
29981 </indexterm>
29982 </para>
29983 <informaltable frame="all">
29984 <tgroup cols="4" colsep="0" rowsep="0">
29985 <colspec colwidth="8*" align="left"/>
29986 <colspec colwidth="5*" align="center"/>
29987 <colspec colwidth="5*" align="center"/>
29988 <colspec colwidth="6*" align="right"/>
29989 <tbody>
29990 <row>
29991 <entry><option>mx_domains</option></entry>
29992 <entry>Use: <emphasis>dnslookup</emphasis></entry>
29993 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
29994 <entry>Default: <emphasis>unset</emphasis></entry>
29995 </row>
29996 </tbody>
29997 </tgroup>
29998 </informaltable>
29999 <para>
30000 <indexterm role="concept">
30001 <primary>MX record</primary>
30002 <secondary>required to exist</secondary>
30003 </indexterm>
30004 <indexterm role="concept">
30005 <primary>SRV record</primary>
30006 <secondary>required to exist</secondary>
30007 </indexterm>
30008 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
30009 record in order to be recognised. (The name of this option could be improved.)
30010 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
30011 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
30012 setting:
30013 </para>
30014 <literallayout class="monospaced">
30015 mx_domains = ! *.discworld.fict.example : *.fict.example
30016 </literallayout>
30017 <para>
30018 This specifies that messages addressed to a domain that matches the list but
30019 has no MX record should be bounced immediately instead of being routed using
30020 the address record.
30021 </para>
30022 <para>
30023 <indexterm role="option">
30024 <primary>mx_fail_domains</primary>
30025 </indexterm>
30026 </para>
30027 <informaltable frame="all">
30028 <tgroup cols="4" colsep="0" rowsep="0">
30029 <colspec colwidth="8*" align="left"/>
30030 <colspec colwidth="5*" align="center"/>
30031 <colspec colwidth="5*" align="center"/>
30032 <colspec colwidth="6*" align="right"/>
30033 <tbody>
30034 <row>
30035 <entry><option>mx_fail_domains</option></entry>
30036 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30037 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30038 <entry>Default: <emphasis>unset</emphasis></entry>
30039 </row>
30040 </tbody>
30041 </tgroup>
30042 </informaltable>
30043 <para>
30044 If the DNS lookup for MX records for one of the domains in this list causes a
30045 DNS lookup error, Exim behaves as if no MX records were found. See section
30046 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30047 </para>
30048 <para>
30049 <indexterm role="option">
30050 <primary>qualify_single</primary>
30051 </indexterm>
30052 </para>
30053 <informaltable frame="all">
30054 <tgroup cols="4" colsep="0" rowsep="0">
30055 <colspec colwidth="8*" align="left"/>
30056 <colspec colwidth="5*" align="center"/>
30057 <colspec colwidth="5*" align="center"/>
30058 <colspec colwidth="6*" align="right"/>
30059 <tbody>
30060 <row>
30061 <entry><option>qualify_single</option></entry>
30062 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30063 <entry>Type: <emphasis>boolean</emphasis></entry>
30064 <entry>Default: <emphasis>true</emphasis></entry>
30065 </row>
30066 </tbody>
30067 </tgroup>
30068 </informaltable>
30069 <para>
30070 <indexterm role="concept">
30071 <primary>DNS</primary>
30072 <secondary>resolver options</secondary>
30073 </indexterm>
30074 <indexterm role="concept">
30075 <primary>DNS</primary>
30076 <secondary>qualifying single-component names</secondary>
30077 </indexterm>
30078 When this option is true, the resolver option RES_DEFNAMES is set for DNS
30079 lookups. Typically, but not standardly, this causes the resolver to qualify
30080 single-component names with the default domain. For example, on a machine
30081 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
30082 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
30083 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
30084 <emphasis>resolv.conf</emphasis>.
30085 </para>
30086 <para>
30087 <indexterm role="option">
30088 <primary>rewrite_headers</primary>
30089 </indexterm>
30090 </para>
30091 <informaltable frame="all">
30092 <tgroup cols="4" colsep="0" rowsep="0">
30093 <colspec colwidth="8*" align="left"/>
30094 <colspec colwidth="5*" align="center"/>
30095 <colspec colwidth="5*" align="center"/>
30096 <colspec colwidth="6*" align="right"/>
30097 <tbody>
30098 <row>
30099 <entry><option>rewrite_headers</option></entry>
30100 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30101 <entry>Type: <emphasis>boolean</emphasis></entry>
30102 <entry>Default: <emphasis>true</emphasis></entry>
30103 </row>
30104 </tbody>
30105 </tgroup>
30106 </informaltable>
30107 <para>
30108 <indexterm role="concept">
30109 <primary>rewriting</primary>
30110 <secondary>header lines</secondary>
30111 </indexterm>
30112 <indexterm role="concept">
30113 <primary>header lines</primary>
30114 <secondary>rewriting</secondary>
30115 </indexterm>
30116 If the domain name in the address that is being processed is not fully
30117 qualified, it may be expanded to its full form by a DNS lookup. For example, if
30118 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
30119 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
30120 occur as a result of setting the <option>widen_domains</option> option. If
30121 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
30122 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
30123 header lines of the message are rewritten with the full domain name.
30124 </para>
30125 <para>
30126 This option should be turned off only when it is known that no message is
30127 ever going to be sent outside an environment where the abbreviation makes
30128 sense.
30129 </para>
30130 <para>
30131 When an MX record is looked up in the DNS and matches a wildcard record, name
30132 servers normally return a record containing the name that has been looked up,
30133 making it impossible to detect whether a wildcard was present or not. However,
30134 some name servers have recently been seen to return the wildcard entry. If the
30135 name returned by a DNS lookup begins with an asterisk, it is not used for
30136 header rewriting.
30137 </para>
30138 <para>
30139 <indexterm role="option">
30140 <primary>same_domain_copy_routing</primary>
30141 </indexterm>
30142 </para>
30143 <informaltable frame="all">
30144 <tgroup cols="4" colsep="0" rowsep="0">
30145 <colspec colwidth="8*" align="left"/>
30146 <colspec colwidth="5*" align="center"/>
30147 <colspec colwidth="5*" align="center"/>
30148 <colspec colwidth="6*" align="right"/>
30149 <tbody>
30150 <row>
30151 <entry><option>same_domain_copy_routing</option></entry>
30152 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30153 <entry>Type: <emphasis>boolean</emphasis></entry>
30154 <entry>Default: <emphasis>false</emphasis></entry>
30155 </row>
30156 </tbody>
30157 </tgroup>
30158 </informaltable>
30159 <para>
30160 <indexterm role="concept">
30161 <primary>address</primary>
30162 <secondary>copying routing</secondary>
30163 </indexterm>
30164 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
30165 to the same list of hosts. However, this cannot be presumed, because the router
30166 options and preconditions may refer to the local part of the address. By
30167 default, therefore, Exim routes each address in a message independently. DNS
30168 servers run caches, so repeated DNS lookups are not normally expensive, and in
30169 any case, personal messages rarely have more than a few recipients.
30170 </para>
30171 <para>
30172 If you are running mailing lists with large numbers of subscribers at the same
30173 domain, and you are using a <command>dnslookup</command> router which is independent of the
30174 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30175 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
30176 routes an address to a remote transport, any other unrouted addresses in the
30177 message that have the same domain are automatically given the same routing
30178 without processing them independently,
30179 provided the following conditions are met:
30180 </para>
30181 <itemizedlist>
30182 <listitem>
30183 <para>
30184 No router that processed the address specified <option>headers_add</option> or
30185 <option>headers_remove</option>.
30186 </para>
30187 </listitem>
30188 <listitem>
30189 <para>
30190 The router did not change the address in any way, for example, by <quote>widening</quote>
30191 the domain.
30192 </para>
30193 </listitem>
30194 </itemizedlist>
30195 <para>
30196 <indexterm role="option">
30197 <primary>search_parents</primary>
30198 </indexterm>
30199 </para>
30200 <informaltable frame="all">
30201 <tgroup cols="4" colsep="0" rowsep="0">
30202 <colspec colwidth="8*" align="left"/>
30203 <colspec colwidth="5*" align="center"/>
30204 <colspec colwidth="5*" align="center"/>
30205 <colspec colwidth="6*" align="right"/>
30206 <tbody>
30207 <row>
30208 <entry><option>search_parents</option></entry>
30209 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30210 <entry>Type: <emphasis>boolean</emphasis></entry>
30211 <entry>Default: <emphasis>false</emphasis></entry>
30212 </row>
30213 </tbody>
30214 </tgroup>
30215 </informaltable>
30216 <para>
30217 <indexterm role="concept">
30218 <primary>DNS</primary>
30219 <secondary>resolver options</secondary>
30220 </indexterm>
30221 When this option is true, the resolver option RES_DNSRCH is set for DNS
30222 lookups. This is different from the <option>qualify_single</option> option in that it
30223 applies to domains containing dots. Typically, but not standardly, it causes
30224 the resolver to search for the name in the current domain and in parent
30225 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
30226 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
30227 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
30228 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
30229 </para>
30230 <para>
30231 Setting this option true can cause problems in domains that have a wildcard MX
30232 record, because any domain that does not have its own MX record matches the
30233 local wildcard.
30234 </para>
30235 <para>
30236 <indexterm role="option">
30237 <primary>srv_fail_domains</primary>
30238 </indexterm>
30239 </para>
30240 <informaltable frame="all">
30241 <tgroup cols="4" colsep="0" rowsep="0">
30242 <colspec colwidth="8*" align="left"/>
30243 <colspec colwidth="5*" align="center"/>
30244 <colspec colwidth="5*" align="center"/>
30245 <colspec colwidth="6*" align="right"/>
30246 <tbody>
30247 <row>
30248 <entry><option>srv_fail_domains</option></entry>
30249 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30250 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30251 <entry>Default: <emphasis>unset</emphasis></entry>
30252 </row>
30253 </tbody>
30254 </tgroup>
30255 </informaltable>
30256 <para>
30257 If the DNS lookup for SRV records for one of the domains in this list causes a
30258 DNS lookup error, Exim behaves as if no SRV records were found. See section
30259 <xref linkend="SECTprowitdnsloo"/> for more discussion.
30260 </para>
30261 <para>
30262 <indexterm role="option">
30263 <primary>widen_domains</primary>
30264 </indexterm>
30265 </para>
30266 <informaltable frame="all">
30267 <tgroup cols="4" colsep="0" rowsep="0">
30268 <colspec colwidth="8*" align="left"/>
30269 <colspec colwidth="5*" align="center"/>
30270 <colspec colwidth="5*" align="center"/>
30271 <colspec colwidth="6*" align="right"/>
30272 <tbody>
30273 <row>
30274 <entry><option>widen_domains</option></entry>
30275 <entry>Use: <emphasis>dnslookup</emphasis></entry>
30276 <entry>Type: <emphasis>string list</emphasis></entry>
30277 <entry>Default: <emphasis>unset</emphasis></entry>
30278 </row>
30279 </tbody>
30280 </tgroup>
30281 </informaltable>
30282 <para>
30283 <indexterm role="concept">
30284 <primary>domain</primary>
30285 <secondary>partial; widening</secondary>
30286 </indexterm>
30287 If a DNS lookup fails and this option is set, each of its strings in turn is
30288 added onto the end of the domain, and the lookup is tried again. For example,
30289 if
30290 </para>
30291 <literallayout class="monospaced">
30292 widen_domains = fict.example:ref.example
30293 </literallayout>
30294 <para>
30295 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
30296 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
30297 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
30298 and <option>search_parents</option> options can cause some widening to be undertaken inside
30299 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
30300 when verifying, unless <option>rewrite_headers</option> is false (not the default).
30301 </para>
30302 </section>
30303 <section>
30304 <title>Effect of qualify_single and search_parents</title>
30305 <para>
30306 When a domain from an envelope recipient is changed by the resolver as a result
30307 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
30308 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
30309 is set false. Exim then re-routes the address, using the full domain.
30310 </para>
30311 <para>
30312 These two options affect only the DNS lookup that takes place inside the router
30313 for the domain of the address that is being routed. They do not affect lookups
30314 such as that implied by
30315 </para>
30316 <literallayout class="monospaced">
30317 domains = @mx_any
30318 </literallayout>
30319 <para>
30320 that may happen while processing a router precondition before the router is
30321 entered. No widening ever takes place for these lookups.
30322 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
30323 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
30324 </para>
30325 </section>
30326 </chapter>
30327
30328 <chapter>
30329 <title>The ipliteral router</title>
30330 <para>
30331 <indexterm role="concept">
30332 <primary><command>ipliteral</command> router</primary>
30333 </indexterm>
30334 <indexterm role="concept">
30335 <primary>domain literal</primary>
30336 <secondary>routing</secondary>
30337 </indexterm>
30338 <indexterm role="concept">
30339 <primary>routers</primary>
30340 <secondary><command>ipliteral</command></secondary>
30341 </indexterm>
30342 This router has no private options. Unless it is being used purely for
30343 verification (see <option>verify_only</option>) a transport is required to be defined by the
30344 generic <option>transport</option> option. The router accepts the address if its domain part
30345 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
30346 router handles the address
30347 </para>
30348 <literallayout class="monospaced">
30349 root@[192.168.1.1]
30350 </literallayout>
30351 <para>
30352 by setting up delivery to the host with that IP address. IPv4 domain literals
30353 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
30354 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
30355 </para>
30356 <literallayout class="monospaced">
30357 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
30358 </literallayout>
30359 <para>
30360 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
30361 grounds that sooner or later somebody will try it.
30362 </para>
30363 <para>
30364 <indexterm role="concept">
30365 <primary><option>self</option> option</primary>
30366 <secondary>in <command>ipliteral</command> router</secondary>
30367 </indexterm>
30368 If the IP address matches something in <option>ignore_target_hosts</option>, the router
30369 declines. If an IP literal turns out to refer to the local host, the generic
30370 <option>self</option> option determines what happens.
30371 </para>
30372 <para>
30373 The RFCs require support for domain literals; however, their use is
30374 controversial in today&#x2019;s Internet. If you want to use this router, you must
30375 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
30376 Exim will not recognize the domain literal syntax in addresses.
30377 </para>
30378 </chapter>
30379
30380 <chapter>
30381 <title>The iplookup router</title>
30382 <para>
30383 <indexterm role="concept">
30384 <primary><command>iplookup</command> router</primary>
30385 </indexterm>
30386 <indexterm role="concept">
30387 <primary>routers</primary>
30388 <secondary><command>iplookup</command></secondary>
30389 </indexterm>
30390 The <command>iplookup</command> router was written to fulfil a specific requirement in
30391 Cambridge University (which in fact no longer exists). For this reason, it is
30392 not included in the binary of Exim by default. If you want to include it, you
30393 must set
30394 </para>
30395 <literallayout class="monospaced">
30396 ROUTER_IPLOOKUP=yes
30397 </literallayout>
30398 <para>
30399 in your <filename>Local/Makefile</filename> configuration file.
30400 </para>
30401 <para>
30402 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
30403 connection to one or more specific hosts. The host can then return the same or
30404 a different address &ndash; in effect rewriting the recipient address in the
30405 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
30406 this process fails, the address can be passed on to other routers, or delivery
30407 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
30408 must not be specified for it.
30409 </para>
30410 <para>
30411 <indexterm role="concept">
30412 <primary>options</primary>
30413 <secondary><command>iplookup</command> router</secondary>
30414 </indexterm>
30415 <indexterm role="option">
30416 <primary>hosts</primary>
30417 </indexterm>
30418 </para>
30419 <informaltable frame="all">
30420 <tgroup cols="4" colsep="0" rowsep="0">
30421 <colspec colwidth="8*" align="left"/>
30422 <colspec colwidth="5*" align="center"/>
30423 <colspec colwidth="5*" align="center"/>
30424 <colspec colwidth="6*" align="right"/>
30425 <tbody>
30426 <row>
30427 <entry><option>hosts</option></entry>
30428 <entry>Use: <emphasis>iplookup</emphasis></entry>
30429 <entry>Type: <emphasis>string</emphasis></entry>
30430 <entry>Default: <emphasis>unset</emphasis></entry>
30431 </row>
30432 </tbody>
30433 </tgroup>
30434 </informaltable>
30435 <para>
30436 This option must be supplied. Its value is a colon-separated list of host
30437 names. The hosts are looked up using <function>gethostbyname()</function>
30438 (or <function>getipnodebyname()</function> when available)
30439 and are tried in order until one responds to the query. If none respond, what
30440 happens is controlled by <option>optional</option>.
30441 </para>
30442 <para>
30443 <indexterm role="option">
30444 <primary>optional</primary>
30445 </indexterm>
30446 </para>
30447 <informaltable frame="all">
30448 <tgroup cols="4" colsep="0" rowsep="0">
30449 <colspec colwidth="8*" align="left"/>
30450 <colspec colwidth="5*" align="center"/>
30451 <colspec colwidth="5*" align="center"/>
30452 <colspec colwidth="6*" align="right"/>
30453 <tbody>
30454 <row>
30455 <entry><option>optional</option></entry>
30456 <entry>Use: <emphasis>iplookup</emphasis></entry>
30457 <entry>Type: <emphasis>boolean</emphasis></entry>
30458 <entry>Default: <emphasis>false</emphasis></entry>
30459 </row>
30460 </tbody>
30461 </tgroup>
30462 </informaltable>
30463 <para>
30464 If <option>optional</option> is true, if no response is obtained from any host, the address
30465 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
30466 delivery to the address is deferred.
30467 </para>
30468 <para>
30469 <indexterm role="option">
30470 <primary>port</primary>
30471 </indexterm>
30472 </para>
30473 <informaltable frame="all">
30474 <tgroup cols="4" colsep="0" rowsep="0">
30475 <colspec colwidth="8*" align="left"/>
30476 <colspec colwidth="5*" align="center"/>
30477 <colspec colwidth="5*" align="center"/>
30478 <colspec colwidth="6*" align="right"/>
30479 <tbody>
30480 <row>
30481 <entry><option>port</option></entry>
30482 <entry>Use: <emphasis>iplookup</emphasis></entry>
30483 <entry>Type: <emphasis>integer</emphasis></entry>
30484 <entry>Default: <emphasis>0</emphasis></entry>
30485 </row>
30486 </tbody>
30487 </tgroup>
30488 </informaltable>
30489 <para>
30490 <indexterm role="concept">
30491 <primary>port</primary>
30492 <secondary><command>iplookup</command> router</secondary>
30493 </indexterm>
30494 This option must be supplied. It specifies the port number for the TCP or UDP
30495 call.
30496 </para>
30497 <para>
30498 <indexterm role="option">
30499 <primary>protocol</primary>
30500 </indexterm>
30501 </para>
30502 <informaltable frame="all">
30503 <tgroup cols="4" colsep="0" rowsep="0">
30504 <colspec colwidth="8*" align="left"/>
30505 <colspec colwidth="5*" align="center"/>
30506 <colspec colwidth="5*" align="center"/>
30507 <colspec colwidth="6*" align="right"/>
30508 <tbody>
30509 <row>
30510 <entry><option>protocol</option></entry>
30511 <entry>Use: <emphasis>iplookup</emphasis></entry>
30512 <entry>Type: <emphasis>string</emphasis></entry>
30513 <entry>Default: <emphasis>udp</emphasis></entry>
30514 </row>
30515 </tbody>
30516 </tgroup>
30517 </informaltable>
30518 <para>
30519 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
30520 protocols is to be used.
30521 </para>
30522 <para>
30523 <indexterm role="option">
30524 <primary>query</primary>
30525 </indexterm>
30526 </para>
30527 <informaltable frame="all">
30528 <tgroup cols="4" colsep="0" rowsep="0">
30529 <colspec colwidth="8*" align="left"/>
30530 <colspec colwidth="5*" align="center"/>
30531 <colspec colwidth="5*" align="center"/>
30532 <colspec colwidth="6*" align="right"/>
30533 <tbody>
30534 <row>
30535 <entry><option>query</option></entry>
30536 <entry>Use: <emphasis>iplookup</emphasis></entry>
30537 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30538 <entry>Default: <emphasis><literal>$local_part@$domain $local_part@$domain</literal></emphasis></entry>
30539 </row>
30540 </tbody>
30541 </tgroup>
30542 </informaltable>
30543 <para>
30544 This defines the content of the query that is sent to the remote hosts. The
30545 repetition serves as a way of checking that a response is to the correct query
30546 in the default case (see <option>response_pattern</option> below).
30547 </para>
30548 <para>
30549 <indexterm role="option">
30550 <primary>reroute</primary>
30551 </indexterm>
30552 </para>
30553 <informaltable frame="all">
30554 <tgroup cols="4" colsep="0" rowsep="0">
30555 <colspec colwidth="8*" align="left"/>
30556 <colspec colwidth="5*" align="center"/>
30557 <colspec colwidth="5*" align="center"/>
30558 <colspec colwidth="6*" align="right"/>
30559 <tbody>
30560 <row>
30561 <entry><option>reroute</option></entry>
30562 <entry>Use: <emphasis>iplookup</emphasis></entry>
30563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30564 <entry>Default: <emphasis>unset</emphasis></entry>
30565 </row>
30566 </tbody>
30567 </tgroup>
30568 </informaltable>
30569 <para>
30570 If this option is not set, the rerouted address is precisely the byte string
30571 returned by the remote host, up to the first white space, if any. If set, the
30572 string is expanded to form the rerouted address. It can include parts matched
30573 in the response by <option>response_pattern</option> by means of numeric variables such as
30574 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
30575 whether or not a pattern is in use. In all cases, the rerouted address must end
30576 up in the form <emphasis>local_part@domain</emphasis>.
30577 </para>
30578 <para>
30579 <indexterm role="option">
30580 <primary>response_pattern</primary>
30581 </indexterm>
30582 </para>
30583 <informaltable frame="all">
30584 <tgroup cols="4" colsep="0" rowsep="0">
30585 <colspec colwidth="8*" align="left"/>
30586 <colspec colwidth="5*" align="center"/>
30587 <colspec colwidth="5*" align="center"/>
30588 <colspec colwidth="6*" align="right"/>
30589 <tbody>
30590 <row>
30591 <entry><option>response_pattern</option></entry>
30592 <entry>Use: <emphasis>iplookup</emphasis></entry>
30593 <entry>Type: <emphasis>string</emphasis></entry>
30594 <entry>Default: <emphasis>unset</emphasis></entry>
30595 </row>
30596 </tbody>
30597 </tgroup>
30598 </informaltable>
30599 <para>
30600 This option can be set to a regular expression that is applied to the string
30601 returned from the remote host. If the pattern does not match the response, the
30602 router declines. If <option>response_pattern</option> is not set, no checking of the
30603 response is done, unless the query was defaulted, in which case there is a
30604 check that the text returned after the first white space is the original
30605 address. This checks that the answer that has been received is in response to
30606 the correct question. For example, if the response is just a new domain, the
30607 following could be used:
30608 </para>
30609 <literallayout class="monospaced">
30610 response_pattern = ^([^@]+)$
30611 reroute = $local_part@$1
30612 </literallayout>
30613 <para>
30614 <indexterm role="option">
30615 <primary>timeout</primary>
30616 </indexterm>
30617 </para>
30618 <informaltable frame="all">
30619 <tgroup cols="4" colsep="0" rowsep="0">
30620 <colspec colwidth="8*" align="left"/>
30621 <colspec colwidth="5*" align="center"/>
30622 <colspec colwidth="5*" align="center"/>
30623 <colspec colwidth="6*" align="right"/>
30624 <tbody>
30625 <row>
30626 <entry><option>timeout</option></entry>
30627 <entry>Use: <emphasis>iplookup</emphasis></entry>
30628 <entry>Type: <emphasis>time</emphasis></entry>
30629 <entry>Default: <emphasis>5s</emphasis></entry>
30630 </row>
30631 </tbody>
30632 </tgroup>
30633 </informaltable>
30634 <para>
30635 This specifies the amount of time to wait for a response from the remote
30636 machine. The same timeout is used for the <function>connect()</function> function for a TCP
30637 call. It does not apply to UDP.
30638 </para>
30639 </chapter>
30640
30641 <chapter>
30642 <title>The manualroute router</title>
30643 <para>
30644 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
30645 <primary><command>manualroute</command> router</primary>
30646 </indexterm>
30647 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
30648 <primary>routers</primary>
30649 <secondary><command>manualroute</command></secondary>
30650 </indexterm>
30651 <indexterm role="concept">
30652 <primary>domain</primary>
30653 <secondary>manually routing</secondary>
30654 </indexterm>
30655 The <command>manualroute</command> router is so-called because it provides a way of manually
30656 routing an address according to its domain. It is mainly used when you want to
30657 route addresses to remote hosts according to your own rules, bypassing the
30658 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
30659 route to local transports, a facility that may be useful if you want to save
30660 messages for dial-in hosts in local files.
30661 </para>
30662 <para>
30663 The <command>manualroute</command> router compares a list of domain patterns with the domain
30664 it is trying to route. If there is no match, the router declines. Each pattern
30665 has associated with it a list of hosts and some other optional data, which may
30666 include a transport. The combination of a pattern and its data is called a
30667 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
30668 generic <option>transport</option> option must specify a transport, unless the router is
30669 being used purely for verification (see <option>verify_only</option>).
30670 </para>
30671 <para>
30672 <indexterm role="concept">
30673 <primary><varname>$host</varname></primary>
30674 </indexterm>
30675 In the case of verification, matching the domain pattern is sufficient for the
30676 router to accept the address. When actually routing an address for delivery,
30677 an address that matches a domain pattern is queued for the associated
30678 transport. If the transport is not a local one, a host list must be associated
30679 with the pattern; IP addresses are looked up for the hosts, and these are
30680 passed to the transport along with the mail address. For local transports, a
30681 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
30682 text string.
30683 </para>
30684 <para>
30685 The list of routing rules can be provided as an inline string in
30686 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
30687 or database by setting <option>route_data</option>. Only one of these settings may appear in
30688 any one instance of <command>manualroute</command>. The format of routing rules is described
30689 below, following the list of private options.
30690 </para>
30691 <section id="SECTprioptman">
30692 <title>Private options for manualroute</title>
30693 <para>
30694 <indexterm role="concept">
30695 <primary>options</primary>
30696 <secondary><command>manualroute</command> router</secondary>
30697 </indexterm>
30698 The private options for the <command>manualroute</command> router are as follows:
30699 </para>
30700 <para>
30701 <indexterm role="option">
30702 <primary>host_find_failed</primary>
30703 </indexterm>
30704 </para>
30705 <informaltable frame="all">
30706 <tgroup cols="4" colsep="0" rowsep="0">
30707 <colspec colwidth="8*" align="left"/>
30708 <colspec colwidth="5*" align="center"/>
30709 <colspec colwidth="5*" align="center"/>
30710 <colspec colwidth="6*" align="right"/>
30711 <tbody>
30712 <row>
30713 <entry><option>host_find_failed</option></entry>
30714 <entry>Use: <emphasis>manualroute</emphasis></entry>
30715 <entry>Type: <emphasis>string</emphasis></entry>
30716 <entry>Default: <emphasis>freeze</emphasis></entry>
30717 </row>
30718 </tbody>
30719 </tgroup>
30720 </informaltable>
30721 <para>
30722 This option controls what happens when <command>manualroute</command> tries to find an IP
30723 address for a host, and the host does not exist. The option can be set to one
30724 of
30725 </para>
30726 <literallayout class="monospaced">
30727 decline
30728 defer
30729 fail
30730 freeze
30731 pass
30732 </literallayout>
30733 <para>
30734 The default assumes that this state is a serious configuration error. The
30735 difference between <quote>pass</quote> and <quote>decline</quote> is that the former forces the
30736 address to be passed to the next router (or the router defined by
30737 <option>pass_router</option>),
30738 <indexterm role="concept">
30739 <primary><option>more</option> option</primary>
30740 </indexterm>
30741 overriding <option>no_more</option>, whereas the latter passes the address to the next
30742 router only if <option>more</option> is true.
30743 </para>
30744 <para>
30745 This option applies only to a definite <quote>does not exist</quote> state; if a host
30746 lookup gets a temporary error, delivery is deferred unless the generic
30747 <option>pass_on_timeout</option> option is set.
30748 </para>
30749 <para>
30750 <indexterm role="option">
30751 <primary>hosts_randomize</primary>
30752 </indexterm>
30753 </para>
30754 <informaltable frame="all">
30755 <tgroup cols="4" colsep="0" rowsep="0">
30756 <colspec colwidth="8*" align="left"/>
30757 <colspec colwidth="5*" align="center"/>
30758 <colspec colwidth="5*" align="center"/>
30759 <colspec colwidth="6*" align="right"/>
30760 <tbody>
30761 <row>
30762 <entry><option>hosts_randomize</option></entry>
30763 <entry>Use: <emphasis>manualroute</emphasis></entry>
30764 <entry>Type: <emphasis>boolean</emphasis></entry>
30765 <entry>Default: <emphasis>false</emphasis></entry>
30766 </row>
30767 </tbody>
30768 </tgroup>
30769 </informaltable>
30770 <para>
30771 <indexterm role="concept">
30772 <primary>randomized host list</primary>
30773 </indexterm>
30774 <indexterm role="concept">
30775 <primary>host</primary>
30776 <secondary>list of; randomized</secondary>
30777 </indexterm>
30778 If this option is set, the order of the items in a host list in a routing rule
30779 is randomized each time the list is used, unless an option in the routing rule
30780 overrides (see below). Randomizing the order of a host list can be used to do
30781 crude load sharing. However, if more than one mail address is routed by the
30782 same router to the same host list, the host lists are considered to be the same
30783 (even though they may be randomized into different orders) for the purpose of
30784 deciding whether to batch the deliveries into a single SMTP transaction.
30785 </para>
30786 <para>
30787 When <option>hosts_randomize</option> is true, a host list may be split
30788 into groups whose order is separately randomized. This makes it possible to
30789 set up MX-like behaviour. The boundaries between groups are indicated by an
30790 item that is just <literal>+</literal> in the host list. For example:
30791 </para>
30792 <literallayout class="monospaced">
30793 route_list = * host1:host2:host3:+:host4:host5
30794 </literallayout>
30795 <para>
30796 The order of the first three hosts and the order of the last two hosts is
30797 randomized for each use, but the first three always end up before the last two.
30798 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
30799 randomized host list is passed to an <command>smtp</command> transport that also has
30800 <option>hosts_randomize set</option>, the list is not re-randomized.
30801 </para>
30802 <para>
30803 <indexterm role="option">
30804 <primary>route_data</primary>
30805 </indexterm>
30806 </para>
30807 <informaltable frame="all">
30808 <tgroup cols="4" colsep="0" rowsep="0">
30809 <colspec colwidth="8*" align="left"/>
30810 <colspec colwidth="5*" align="center"/>
30811 <colspec colwidth="5*" align="center"/>
30812 <colspec colwidth="6*" align="right"/>
30813 <tbody>
30814 <row>
30815 <entry><option>route_data</option></entry>
30816 <entry>Use: <emphasis>manualroute</emphasis></entry>
30817 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30818 <entry>Default: <emphasis>unset</emphasis></entry>
30819 </row>
30820 </tbody>
30821 </tgroup>
30822 </informaltable>
30823 <para>
30824 If this option is set, it must expand to yield the data part of a routing rule.
30825 Typically, the expansion string includes a lookup based on the domain. For
30826 example:
30827 </para>
30828 <literallayout class="monospaced">
30829 route_data = ${lookup{$domain}dbm{/etc/routes}}
30830 </literallayout>
30831 <para>
30832 If the expansion is forced to fail, or the result is an empty string, the
30833 router declines. Other kinds of expansion failure cause delivery to be
30834 deferred.
30835 </para>
30836 <para>
30837 <indexterm role="option">
30838 <primary>route_list</primary>
30839 </indexterm>
30840 </para>
30841 <informaltable frame="all">
30842 <tgroup cols="4" colsep="0" rowsep="0">
30843 <colspec colwidth="8*" align="left"/>
30844 <colspec colwidth="5*" align="center"/>
30845 <colspec colwidth="5*" align="center"/>
30846 <colspec colwidth="6*" align="right"/>
30847 <tbody>
30848 <row>
30849 <entry><option>route_list</option></entry>
30850 <entry>Use: <emphasis>manualroute</emphasis></entry>
30851 <entry>Type: <emphasis> </emphasis></entry>
30852 <entry>Default: <emphasis>string</emphasis></entry>
30853 </row>
30854 </tbody>
30855 </tgroup>
30856 </informaltable>
30857 <para>
30858 This string is a list of routing rules, in the form defined below. Note that,
30859 unlike most string lists, the items are separated by semicolons. This is so
30860 that they may contain colon-separated host lists.
30861 </para>
30862 <para>
30863 <indexterm role="option">
30864 <primary>same_domain_copy_routing</primary>
30865 </indexterm>
30866 </para>
30867 <informaltable frame="all">
30868 <tgroup cols="4" colsep="0" rowsep="0">
30869 <colspec colwidth="8*" align="left"/>
30870 <colspec colwidth="5*" align="center"/>
30871 <colspec colwidth="5*" align="center"/>
30872 <colspec colwidth="6*" align="right"/>
30873 <tbody>
30874 <row>
30875 <entry><option>same_domain_copy_routing</option></entry>
30876 <entry>Use: <emphasis>manualroute</emphasis></entry>
30877 <entry>Type: <emphasis>boolean</emphasis></entry>
30878 <entry>Default: <emphasis>false</emphasis></entry>
30879 </row>
30880 </tbody>
30881 </tgroup>
30882 </informaltable>
30883 <para>
30884 <indexterm role="concept">
30885 <primary>address</primary>
30886 <secondary>copying routing</secondary>
30887 </indexterm>
30888 Addresses with the same domain are normally routed by the <command>manualroute</command>
30889 router to the same list of hosts. However, this cannot be presumed, because the
30890 router options and preconditions may refer to the local part of the address. By
30891 default, therefore, Exim routes each address in a message independently. DNS
30892 servers run caches, so repeated DNS lookups are not normally expensive, and in
30893 any case, personal messages rarely have more than a few recipients.
30894 </para>
30895 <para>
30896 If you are running mailing lists with large numbers of subscribers at the same
30897 domain, and you are using a <command>manualroute</command> router which is independent of the
30898 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
30899 lookups for identical domains in one message. In this case, when
30900 <command>manualroute</command> routes an address to a remote transport, any other unrouted
30901 addresses in the message that have the same domain are automatically given the
30902 same routing without processing them independently. However, this is only done
30903 if <option>headers_add</option> and <option>headers_remove</option> are unset.
30904 </para>
30905 </section>
30906 <section>
30907 <title>Routing rules in route_list</title>
30908 <para>
30909 The value of <option>route_list</option> is a string consisting of a sequence of routing
30910 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
30911 entered as two semicolons. Alternatively, the list separator can be changed as
30912 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
30913 Empty rules are ignored. The format of each rule is
30914 </para>
30915 <literallayout>
30916 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
30917 </literallayout>
30918 <para>
30919 The following example contains two rules, each with a simple domain pattern and
30920 no options:
30921 </para>
30922 <literallayout class="monospaced">
30923 route_list = \
30924   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
30925   thes.ref.example  mail-3.ref.example:mail-4.ref.example
30926 </literallayout>
30927 <para>
30928 The three parts of a rule are separated by white space. The pattern and the
30929 list of hosts can be enclosed in quotes if necessary, and if they are, the
30930 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
30931 single domain pattern, which is the only mandatory item in the rule. The
30932 pattern is in the same format as one item in a domain list (see section
30933 <xref linkend="SECTdomainlist"/>),
30934 except that it may not be the name of an interpolated file.
30935 That is, it may be wildcarded, or a regular expression, or a file or database
30936 lookup (with semicolons doubled, because of the use of semicolon as a separator
30937 in a <option>route_list</option>).
30938 </para>
30939 <para>
30940 The rules in <option>route_list</option> are searched in order until one of the patterns
30941 matches the domain that is being routed. The list of hosts and then options are
30942 then used as described below. If there is no match, the router declines. When
30943 <option>route_list</option> is set, <option>route_data</option> must not be set.
30944 </para>
30945 </section>
30946 <section>
30947 <title>Routing rules in route_data</title>
30948 <para>
30949 The use of <option>route_list</option> is convenient when there are only a small number of
30950 routing rules. For larger numbers, it is easier to use a file or database to
30951 hold the routing information, and use the <option>route_data</option> option instead.
30952 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
30953 Most commonly, <option>route_data</option> is set as a string that contains an
30954 expansion lookup. For example, suppose we place two routing rules in a file
30955 like this:
30956 </para>
30957 <literallayout class="monospaced">
30958 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
30959 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
30960 </literallayout>
30961 <para>
30962 This data can be accessed by setting
30963 </para>
30964 <literallayout class="monospaced">
30965 route_data = ${lookup{$domain}lsearch{/the/file/name}}
30966 </literallayout>
30967 <para>
30968 Failure of the lookup results in an empty string, causing the router to
30969 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
30970 requirement is that the result of expanding the string is a list of hosts,
30971 possibly followed by options, separated by white space. The list of hosts must
30972 be enclosed in quotes if it contains white space.
30973 </para>
30974 </section>
30975 <section>
30976 <title>Format of the list of hosts</title>
30977 <para>
30978 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
30979 always separately expanded before use. If the expansion fails, the router
30980 declines. The result of the expansion must be a colon-separated list of names
30981 and/or IP addresses, optionally also including ports. The format of each item
30982 in the list is described in the next section. The list separator can be changed
30983 as described in section <xref linkend="SECTlistconstruct"/>.
30984 </para>
30985 <para>
30986 If the list of hosts was obtained from a <option>route_list</option> item, the following
30987 variables are set during its expansion:
30988 </para>
30989 <itemizedlist>
30990 <listitem>
30991 <para>
30992 <indexterm role="concept">
30993 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
30994 <secondary>in <command>manualroute</command> router</secondary>
30995 </indexterm>
30996 If the domain was matched against a regular expression, the numeric variables
30997 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
30998 </para>
30999 <literallayout class="monospaced">
31000 route_list = ^domain(\d+)   host-$1.text.example
31001 </literallayout>
31002 </listitem>
31003 <listitem>
31004 <para>
31005 <varname>$0</varname> is always set to the entire domain.
31006 </para>
31007 </listitem>
31008 <listitem>
31009 <para>
31010 <varname>$1</varname> is also set when partial matching is done in a file lookup.
31011 </para>
31012 </listitem>
31013 <listitem>
31014 <para>
31015 <indexterm role="concept">
31016 <primary><varname>$value</varname></primary>
31017 </indexterm>
31018 If the pattern that matched the domain was a lookup item, the data that was
31019 looked up is available in the expansion variable <varname>$value</varname>. For example:
31020 </para>
31021 <literallayout class="monospaced">
31022 route_list = lsearch;;/some/file.routes  $value
31023 </literallayout>
31024 </listitem>
31025 </itemizedlist>
31026 <para>
31027 Note the doubling of the semicolon in the pattern that is necessary because
31028 semicolon is the default route list separator.
31029 </para>
31030 </section>
31031 <section id="SECTformatonehostitem">
31032 <title>Format of one host item</title>
31033 <para>
31034 Each item in the list of hosts is either a host name or an IP address,
31035 optionally with an attached port number. When no port is given, an IP address
31036 is not enclosed in brackets. When a port is specified, it overrides the port
31037 specification on the transport. The port is separated from the name or address
31038 by a colon. This leads to some complications:
31039 </para>
31040 <itemizedlist>
31041 <listitem>
31042 <para>
31043 Because colon is the default separator for the list of hosts, either
31044 the colon that specifies a port must be doubled, or the list separator must
31045 be changed. The following two examples have the same effect:
31046 </para>
31047 <literallayout class="monospaced">
31048 route_list = * "host1.tld::1225 : host2.tld::1226"
31049 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
31050 </literallayout>
31051 </listitem>
31052 <listitem>
31053 <para>
31054 When IPv6 addresses are involved, it gets worse, because they contain
31055 colons of their own. To make this case easier, it is permitted to
31056 enclose an IP address (either v4 or v6) in square brackets if a port
31057 number follows. For example:
31058 </para>
31059 <literallayout class="monospaced">
31060 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
31061 </literallayout>
31062 </listitem>
31063 </itemizedlist>
31064 </section>
31065 <section id="SECThostshowused">
31066 <title>How the list of hosts is used</title>
31067 <para>
31068 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
31069 the hosts is tried, in the order specified, when carrying out the SMTP
31070 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
31071 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
31072 transport.
31073 </para>
31074 <para>
31075 Hosts may be listed by name or by IP address. An unadorned name in the list of
31076 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
31077 interpreted as an indirection to a sublist of hosts obtained by looking up MX
31078 records in the DNS. For example:
31079 </para>
31080 <literallayout class="monospaced">
31081 route_list = *  x.y.z:p.q.r/MX:e.f.g
31082 </literallayout>
31083 <para>
31084 If this feature is used with a port specifier, the port must come last. For
31085 example:
31086 </para>
31087 <literallayout class="monospaced">
31088 route_list = *  dom1.tld/mx::1225
31089 </literallayout>
31090 <para>
31091 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
31092 randomized before any lookups are done. Exim then scans the list; for any name
31093 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
31094 be an interface on the local host and the item is not the first in the list,
31095 Exim discards it and any subsequent items. If it is the first item, what
31096 happens is controlled by the
31097 <indexterm role="concept">
31098 <primary><option>self</option> option</primary>
31099 <secondary>in <command>manualroute</command> router</secondary>
31100 </indexterm>
31101 <option>self</option> option of the router.
31102 </para>
31103 <para>
31104 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
31105 hosts obtained by looking up MX records for the name. This is always a DNS
31106 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
31107 below) are not relevant here. The order of these hosts is determined by the
31108 preference values in the MX records, according to the usual rules. Because
31109 randomizing happens before the MX lookup, it does not affect the order that is
31110 defined by MX preferences.
31111 </para>
31112 <para>
31113 If the local host is present in the sublist obtained from MX records, but is
31114 not the most preferred host in that list, it and any equally or less
31115 preferred hosts are removed before the sublist is inserted into the main list.
31116 </para>
31117 <para>
31118 If the local host is the most preferred host in the MX list, what happens
31119 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
31120 is not the first item (that is, there are previous hosts in the main list),
31121 Exim discards this name and any subsequent items in the main list.
31122 </para>
31123 <para>
31124 If the MX item is first in the list of hosts, and the local host is the
31125 most preferred host, what happens is controlled by the <option>self</option> option of the
31126 router.
31127 </para>
31128 <para>
31129 DNS failures when lookup up the MX records are treated in the same way as DNS
31130 failures when looking up IP addresses: <option>pass_on_timeout</option> and
31131 <option>host_find_failed</option> are used when relevant.
31132 </para>
31133 <para>
31134 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
31135 whether obtained from an MX lookup or not.
31136 </para>
31137 </section>
31138 <section id="SECThowoptused">
31139 <title>How the options are used</title>
31140 <para>
31141 The options are a sequence of words; in practice no more than three are ever
31142 present. One of the words can be the name of a transport; this overrides the
31143 <option>transport</option> option on the router for this particular routing rule only. The
31144 other words (if present) control randomization of the list of hosts on a
31145 per-rule basis, and how the IP addresses of the hosts are to be found when
31146 routing to a remote transport. These options are as follows:
31147 </para>
31148 <itemizedlist>
31149 <listitem>
31150 <para>
31151 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
31152 setting of <option>hosts_randomize</option> for this routing rule only.
31153 </para>
31154 </listitem>
31155 <listitem>
31156 <para>
31157 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
31158 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
31159 </para>
31160 </listitem>
31161 <listitem>
31162 <para>
31163 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
31164 find IP addresses. This function may ultimately cause a DNS lookup, but it may
31165 also look in <filename>/etc/hosts</filename> or other sources of information.
31166 </para>
31167 </listitem>
31168 <listitem>
31169 <para>
31170 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
31171 no address records are found. If there is a temporary DNS error (such as a
31172 timeout), delivery is deferred.
31173 </para>
31174 </listitem>
31175 </itemizedlist>
31176 <para>
31177 For example:
31178 </para>
31179 <literallayout class="monospaced">
31180 route_list = domain1  host1:host2:host3  randomize bydns;\
31181              domain2  host4:host5
31182 </literallayout>
31183 <para>
31184 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
31185 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
31186 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
31187 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
31188 call.
31189 </para>
31190 <para>
31191 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
31192 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
31193 instead of TRY_AGAIN. That is why the default action is to try a DNS
31194 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
31195 function called.
31196 </para>
31197 <para>
31198 If no IP address for a host can be found, what happens is controlled by the
31199 <option>host_find_failed</option> option.
31200 </para>
31201 <para>
31202 <indexterm role="concept">
31203 <primary><varname>$host</varname></primary>
31204 </indexterm>
31205 When an address is routed to a local transport, IP addresses are not looked up.
31206 The host list is passed to the transport in the <varname>$host</varname> variable.
31207 </para>
31208 </section>
31209 <section>
31210 <title>Manualroute examples</title>
31211 <para>
31212 In some of the examples that follow, the presence of the <option>remote_smtp</option>
31213 transport, as defined in the default configuration file, is assumed:
31214 </para>
31215 <itemizedlist>
31216 <listitem>
31217 <para>
31218 <indexterm role="concept">
31219 <primary>smart host</primary>
31220 <secondary>example router</secondary>
31221 </indexterm>
31222 The <command>manualroute</command> router can be used to forward all external mail to a
31223 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
31224 named domain list that contains your local domains, for example:
31225 </para>
31226 <literallayout class="monospaced">
31227 domainlist local_domains = my.domain.example
31228 </literallayout>
31229 <para>
31230 You can arrange for all other domains to be routed to a smart host by making
31231 your first router something like this:
31232 </para>
31233 <literallayout class="monospaced">
31234 smart_route:
31235   driver = manualroute
31236   domains = !+local_domains
31237   transport = remote_smtp
31238   route_list = * smarthost.ref.example
31239 </literallayout>
31240 <para>
31241 This causes all non-local addresses to be sent to the single host
31242 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
31243 they are tried in order
31244 (but you can use <option>hosts_randomize</option> to vary the order each time).
31245 Another way of configuring the same thing is this:
31246 </para>
31247 <literallayout class="monospaced">
31248 smart_route:
31249   driver = manualroute
31250   transport = remote_smtp
31251   route_list = !+local_domains  smarthost.ref.example
31252 </literallayout>
31253 <para>
31254 There is no difference in behaviour between these two routers as they stand.
31255 However, they behave differently if <option>no_more</option> is added to them. In the first
31256 example, the router is skipped if the domain does not match the <option>domains</option>
31257 precondition; the following router is always tried. If the router runs, it
31258 always matches the domain and so can never decline. Therefore, <option>no_more</option>
31259 would have no effect. In the second case, the router is never skipped; it
31260 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
31261 <option>no_more</option> would prevent subsequent routers from running.
31262 </para>
31263 </listitem>
31264 <listitem>
31265 <para>
31266 <indexterm role="concept">
31267 <primary>mail hub example</primary>
31268 </indexterm>
31269 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
31270 records in the DNS and delivers it via its own private routing mechanism. Often
31271 the final destinations are behind a firewall, with the mail hub being the one
31272 machine that can connect to machines both inside and outside the firewall. The
31273 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
31274 to the correct hosts. For a small number of domains, the routing can be inline,
31275 using the <option>route_list</option> option, but for a larger number a file or database
31276 lookup is easier to manage.
31277 </para>
31278 <para>
31279 If the domain names are in fact the names of the machines to which the mail is
31280 to be sent by the mail hub, the configuration can be quite simple. For
31281 example:
31282 </para>
31283 <literallayout class="monospaced">
31284 hub_route:
31285   driver = manualroute
31286   transport = remote_smtp
31287   route_list = *.rhodes.tvs.example  $domain
31288 </literallayout>
31289 <para>
31290 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
31291 whose names are the same as the mail domains. A similar approach can be taken
31292 if the host name can be obtained from the domain name by a string manipulation
31293 that the expansion facilities can handle. Otherwise, a lookup based on the
31294 domain can be used to find the host:
31295 </para>
31296 <literallayout class="monospaced">
31297 through_firewall:
31298   driver = manualroute
31299   transport = remote_smtp
31300   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
31301 </literallayout>
31302 <para>
31303 The result of the lookup must be the name or IP address of the host (or
31304 hosts) to which the address is to be routed. If the lookup fails, the route
31305 data is empty, causing the router to decline. The address then passes to the
31306 next router.
31307 </para>
31308 </listitem>
31309 <listitem>
31310 <para>
31311 <indexterm role="concept">
31312 <primary>batched SMTP output example</primary>
31313 </indexterm>
31314 <indexterm role="concept">
31315 <primary>SMTP</primary>
31316 <secondary>batched outgoing; example</secondary>
31317 </indexterm>
31318 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
31319 SMTP format for onward transportation by some other means. This is one way of
31320 storing mail for a dial-up host when it is not connected. The route list entry
31321 can be as simple as a single domain name in a configuration like this:
31322 </para>
31323 <literallayout class="monospaced">
31324 save_in_file:
31325   driver = manualroute
31326   transport = batchsmtp_appendfile
31327   route_list = saved.domain.example
31328 </literallayout>
31329 <para>
31330 though often a pattern is used to pick up more than one domain. If there are
31331 several domains or groups of domains with different transport requirements,
31332 different transports can be listed in the routing information:
31333 </para>
31334 <literallayout class="monospaced">
31335 save_in_file:
31336   driver = manualroute
31337   route_list = \
31338     *.saved.domain1.example  $domain  batch_appendfile; \
31339     *.saved.domain2.example  \
31340       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
31341       batch_pipe
31342 </literallayout>
31343 <para>
31344 <indexterm role="concept">
31345 <primary><varname>$domain</varname></primary>
31346 </indexterm>
31347 <indexterm role="concept">
31348 <primary><varname>$host</varname></primary>
31349 </indexterm>
31350 The first of these just passes the domain in the <varname>$host</varname> variable, which
31351 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
31352 file lookup to find a value to pass, causing the router to decline to handle
31353 the address if the lookup fails.
31354 </para>
31355 </listitem>
31356 <listitem>
31357 <para>
31358 <indexterm role="concept">
31359 <primary>UUCP</primary>
31360 <secondary>example of router for</secondary>
31361 </indexterm>
31362 Routing mail directly to UUCP software is a specific case of the use of
31363 <command>manualroute</command> in a gateway to another mail environment. This is an example of
31364 one way it can be done:
31365 </para>
31366 <literallayout class="monospaced">
31367 # Transport
31368 uucp:
31369   driver = pipe
31370   user = nobody
31371   command = /usr/local/bin/uux -r - \
31372     ${substr_-5:$host}!rmail ${local_part}
31373   return_fail_output = true
31374
31375 # Router
31376 uucphost:
31377   transport = uucp
31378   driver = manualroute
31379   route_data = \
31380     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
31381 </literallayout>
31382 <para>
31383 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
31384 </para>
31385 <literallayout class="monospaced">
31386 darksite.ethereal.example:           darksite.UUCP
31387 </literallayout>
31388 <para>
31389 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
31390 makes clear the distinction between the domain name
31391 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
31392 </para>
31393 </listitem>
31394 </itemizedlist>
31395 <para>
31396 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
31397 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
31398 </para>
31399 </section>
31400 </chapter>
31401
31402 <chapter id="CHAPdriverlast">
31403 <title>The queryprogram router</title>
31404 <para>
31405 <indexterm role="concept" id="IIDquerou1" class="startofrange">
31406 <primary><command>queryprogram</command> router</primary>
31407 </indexterm>
31408 <indexterm role="concept" id="IIDquerou2" class="startofrange">
31409 <primary>routers</primary>
31410 <secondary><command>queryprogram</command></secondary>
31411 </indexterm>
31412 <indexterm role="concept">
31413 <primary>routing</primary>
31414 <secondary>by external program</secondary>
31415 </indexterm>
31416 The <command>queryprogram</command> router routes an address by running an external command
31417 and acting on its output. This is an expensive way to route, and is intended
31418 mainly for use in lightly-loaded systems, or for performing experiments.
31419 However, if it is possible to use the precondition options (<option>domains</option>,
31420 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
31421 be used in special cases, even on a busy host. There are the following private
31422 options:
31423 <indexterm role="concept">
31424 <primary>options</primary>
31425 <secondary><command>queryprogram</command> router</secondary>
31426 </indexterm>
31427 </para>
31428 <para>
31429 <indexterm role="option">
31430 <primary>command</primary>
31431 </indexterm>
31432 </para>
31433 <informaltable frame="all">
31434 <tgroup cols="4" colsep="0" rowsep="0">
31435 <colspec colwidth="8*" align="left"/>
31436 <colspec colwidth="5*" align="center"/>
31437 <colspec colwidth="5*" align="center"/>
31438 <colspec colwidth="6*" align="right"/>
31439 <tbody>
31440 <row>
31441 <entry><option>command</option></entry>
31442 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31443 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31444 <entry>Default: <emphasis>unset</emphasis></entry>
31445 </row>
31446 </tbody>
31447 </tgroup>
31448 </informaltable>
31449 <para>
31450 This option must be set. It specifies the command that is to be run. The
31451 command is split up into a command name and arguments, and then each is
31452 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
31453 <xref linkend="CHAPpipetransport"/>).
31454 </para>
31455 <para>
31456 <indexterm role="option">
31457 <primary>command_group</primary>
31458 </indexterm>
31459 </para>
31460 <informaltable frame="all">
31461 <tgroup cols="4" colsep="0" rowsep="0">
31462 <colspec colwidth="8*" align="left"/>
31463 <colspec colwidth="5*" align="center"/>
31464 <colspec colwidth="5*" align="center"/>
31465 <colspec colwidth="6*" align="right"/>
31466 <tbody>
31467 <row>
31468 <entry><option>command_group</option></entry>
31469 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31470 <entry>Type: <emphasis>string</emphasis></entry>
31471 <entry>Default: <emphasis>unset</emphasis></entry>
31472 </row>
31473 </tbody>
31474 </tgroup>
31475 </informaltable>
31476 <para>
31477 <indexterm role="concept">
31478 <primary>gid (group id)</primary>
31479 <secondary>in <command>queryprogram</command> router</secondary>
31480 </indexterm>
31481 This option specifies a gid to be set when running the command while routing an
31482 address for deliver. It must be set if <option>command_user</option> specifies a numerical
31483 uid. If it begins with a digit, it is interpreted as the numerical value of the
31484 gid. Otherwise it is looked up using <function>getgrnam()</function>.
31485 </para>
31486 <para>
31487 <indexterm role="option">
31488 <primary>command_user</primary>
31489 </indexterm>
31490 </para>
31491 <informaltable frame="all">
31492 <tgroup cols="4" colsep="0" rowsep="0">
31493 <colspec colwidth="8*" align="left"/>
31494 <colspec colwidth="5*" align="center"/>
31495 <colspec colwidth="5*" align="center"/>
31496 <colspec colwidth="6*" align="right"/>
31497 <tbody>
31498 <row>
31499 <entry><option>command_user</option></entry>
31500 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31501 <entry>Type: <emphasis>string</emphasis></entry>
31502 <entry>Default: <emphasis>unset</emphasis></entry>
31503 </row>
31504 </tbody>
31505 </tgroup>
31506 </informaltable>
31507 <para>
31508 <indexterm role="concept">
31509 <primary>uid (user id)</primary>
31510 <secondary>for <command>queryprogram</command></secondary>
31511 </indexterm>
31512 This option must be set. It specifies the uid which is set when running the
31513 command while routing an address for delivery. If the value begins with a digit,
31514 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
31515 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
31516 not set, a value for the gid also.
31517 </para>
31518 <para>
31519 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
31520 root, which it does during a normal delivery in a conventional configuration.
31521 However, when an address is being verified during message reception, Exim is
31522 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
31523 is called from a non-root process, Exim cannot change uid or gid before running
31524 the command. In this circumstance the command runs under the current uid and
31525 gid.
31526 </para>
31527 <para>
31528 <indexterm role="option">
31529 <primary>current_directory</primary>
31530 </indexterm>
31531 </para>
31532 <informaltable frame="all">
31533 <tgroup cols="4" colsep="0" rowsep="0">
31534 <colspec colwidth="8*" align="left"/>
31535 <colspec colwidth="5*" align="center"/>
31536 <colspec colwidth="5*" align="center"/>
31537 <colspec colwidth="6*" align="right"/>
31538 <tbody>
31539 <row>
31540 <entry><option>current_directory</option></entry>
31541 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31542 <entry>Type: <emphasis>string</emphasis></entry>
31543 <entry>Default: <emphasis>/</emphasis></entry>
31544 </row>
31545 </tbody>
31546 </tgroup>
31547 </informaltable>
31548 <para>
31549 This option specifies an absolute path which is made the current directory
31550 before running the command.
31551 </para>
31552 <para>
31553 <indexterm role="option">
31554 <primary>timeout</primary>
31555 </indexterm>
31556 </para>
31557 <informaltable frame="all">
31558 <tgroup cols="4" colsep="0" rowsep="0">
31559 <colspec colwidth="8*" align="left"/>
31560 <colspec colwidth="5*" align="center"/>
31561 <colspec colwidth="5*" align="center"/>
31562 <colspec colwidth="6*" align="right"/>
31563 <tbody>
31564 <row>
31565 <entry><option>timeout</option></entry>
31566 <entry>Use: <emphasis>queryprogram</emphasis></entry>
31567 <entry>Type: <emphasis>time</emphasis></entry>
31568 <entry>Default: <emphasis>1h</emphasis></entry>
31569 </row>
31570 </tbody>
31571 </tgroup>
31572 </informaltable>
31573 <para>
31574 If the command does not complete within the timeout period, its process group
31575 is killed and the message is frozen. A value of zero time specifies no
31576 timeout.
31577 </para>
31578 <para>
31579 The standard output of the command is connected to a pipe, which is read when
31580 the command terminates. It should consist of a single line of output,
31581 containing up to five fields, separated by white space. The maximum length of
31582 the line is 1023 characters. Longer lines are silently truncated. The first
31583 field is one of the following words (case-insensitive):
31584 </para>
31585 <itemizedlist>
31586 <listitem>
31587 <para>
31588 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
31589 below).
31590 </para>
31591 </listitem>
31592 <listitem>
31593 <para>
31594 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
31595 <option>no_more</option> is set.
31596 </para>
31597 </listitem>
31598 <listitem>
31599 <para>
31600 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
31601 subsequent text on the line is an error message. If the router is run as part
31602 of address verification during an incoming SMTP message, the message is
31603 included in the SMTP response.
31604 </para>
31605 </listitem>
31606 <listitem>
31607 <para>
31608 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
31609 subsequent text on the line is an error message which is logged. It is not
31610 included in any SMTP response.
31611 </para>
31612 </listitem>
31613 <listitem>
31614 <para>
31615 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
31616 </para>
31617 </listitem>
31618 <listitem>
31619 <para>
31620 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
31621 <option>pass_router</option>), overriding <option>no_more</option>.
31622 </para>
31623 </listitem>
31624 <listitem>
31625 <para>
31626 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
31627 new addresses, which are routed independently, starting with the first router,
31628 or the router specified by <option>redirect_router</option>, if set.
31629 </para>
31630 </listitem>
31631 </itemizedlist>
31632 <para>
31633 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
31634 number of keyed data values, as follows (split into two lines here, to fit on
31635 the page):
31636 </para>
31637 <literallayout class="monospaced">
31638 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
31639 LOOKUP=byname|bydns DATA=&lt;text&gt;
31640 </literallayout>
31641 <para>
31642 The data items can be given in any order, and all are optional. If no transport
31643 is included, the transport specified by the generic <option>transport</option> option is
31644 used. The list of hosts and the lookup type are needed only if the transport is
31645 an <command>smtp</command> transport that does not itself supply a list of hosts.
31646 </para>
31647 <para>
31648 The format of the list of hosts is the same as for the <command>manualroute</command> router.
31649 As well as host names and IP addresses with optional port numbers, as described
31650 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
31651 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
31652 (see section <xref linkend="SECThostshowused"/>).
31653 </para>
31654 <para>
31655 If the lookup type is not specified, Exim behaves as follows when trying to
31656 find an IP address for each host: First, a DNS lookup is done. If this yields
31657 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
31658 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
31659 result of the lookup is the result of that call.
31660 </para>
31661 <para>
31662 <indexterm role="concept">
31663 <primary><varname>$address_data</varname></primary>
31664 </indexterm>
31665 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
31666 variable. For example, this return line
31667 </para>
31668 <literallayout class="monospaced">
31669 accept hosts=x1.y.example:x2.y.example data="rule1"
31670 </literallayout>
31671 <para>
31672 routes the address to the default transport, passing a list of two hosts. When
31673 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
31674 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
31675 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
31676 </para>
31677 </chapter>
31678
31679 <chapter id="CHAPredirect">
31680 <title>The redirect router</title>
31681 <para>
31682 <indexterm role="concept" id="IIDredrou1" class="startofrange">
31683 <primary><command>redirect</command> router</primary>
31684 </indexterm>
31685 <indexterm role="concept" id="IIDredrou2" class="startofrange">
31686 <primary>routers</primary>
31687 <secondary><command>redirect</command></secondary>
31688 </indexterm>
31689 <indexterm role="concept">
31690 <primary>alias file</primary>
31691 <secondary>in a <command>redirect</command> router</secondary>
31692 </indexterm>
31693 <indexterm role="concept">
31694 <primary>address redirection</primary>
31695 <secondary><command>redirect</command> router</secondary>
31696 </indexterm>
31697 The <command>redirect</command> router handles several kinds of address redirection. Its most
31698 common uses are for resolving local part aliases from a central alias file
31699 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
31700 files, but it has many other potential uses. The incoming address can be
31701 redirected in several different ways:
31702 </para>
31703 <itemizedlist>
31704 <listitem>
31705 <para>
31706 It can be replaced by one or more new addresses which are themselves routed
31707 independently.
31708 </para>
31709 </listitem>
31710 <listitem>
31711 <para>
31712 It can be routed to be delivered to a given file or directory.
31713 </para>
31714 </listitem>
31715 <listitem>
31716 <para>
31717 It can be routed to be delivered to a specified pipe command.
31718 </para>
31719 </listitem>
31720 <listitem>
31721 <para>
31722 It can cause an automatic reply to be generated.
31723 </para>
31724 </listitem>
31725 <listitem>
31726 <para>
31727 It can be forced to fail, with a custom error message.
31728 </para>
31729 </listitem>
31730 <listitem>
31731 <para>
31732 It can be temporarily deferred.
31733 </para>
31734 </listitem>
31735 <listitem>
31736 <para>
31737 It can be discarded.
31738 </para>
31739 </listitem>
31740 </itemizedlist>
31741 <para>
31742 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
31743 However, there are some private options which define transports for delivery to
31744 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
31745 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
31746 </para>
31747 <section>
31748 <title>Redirection data</title>
31749 <para>
31750 The router operates by interpreting a text string which it obtains either by
31751 expanding the contents of the <option>data</option> option, or by reading the entire
31752 contents of a file whose name is given in the <option>file</option> option. These two
31753 options are mutually exclusive. The first is commonly used for handling system
31754 aliases, in a configuration like this:
31755 </para>
31756 <literallayout class="monospaced">
31757 system_aliases:
31758   driver = redirect
31759   data = ${lookup{$local_part}lsearch{/etc/aliases}}
31760 </literallayout>
31761 <para>
31762 If the lookup fails, the expanded string in this example is empty. When the
31763 expansion of <option>data</option> results in an empty string, the router declines. A forced
31764 expansion failure also causes the router to decline; other expansion failures
31765 cause delivery to be deferred.
31766 </para>
31767 <para>
31768 A configuration using <option>file</option> is commonly used for handling users&#x2019;
31769 <filename>.forward</filename> files, like this:
31770 </para>
31771 <literallayout class="monospaced">
31772 userforward:
31773   driver = redirect
31774   check_local_user
31775   file = $home/.forward
31776   no_verify
31777 </literallayout>
31778 <para>
31779 If the file does not exist, or causes no action to be taken (for example, it is
31780 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
31781 is not the case when the file contains syntactically valid items that happen to
31782 yield empty addresses, for example, items containing only RFC 2822 address
31783 comments.
31784 </para>
31785 </section>
31786 <section>
31787 <title>Forward files and address verification</title>
31788 <para>
31789 <indexterm role="concept">
31790 <primary>address redirection</primary>
31791 <secondary>while verifying</secondary>
31792 </indexterm>
31793 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
31794 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
31795 </para>
31796 <itemizedlist>
31797 <listitem>
31798 <para>
31799 When Exim is receiving an incoming SMTP message from a remote host, it is
31800 running under the Exim uid, not as root. Exim is unable to change uid to read
31801 the file as the user, and it may not be able to read it as the Exim user. So in
31802 practice the router may not be able to operate.
31803 </para>
31804 </listitem>
31805 <listitem>
31806 <para>
31807 However, even when the router can operate, the existence of a <filename>.forward</filename> file
31808 is unimportant when verifying an address. What should be checked is whether the
31809 local part is a valid user name or not. Cutting out the redirection processing
31810 saves some resources.
31811 </para>
31812 </listitem>
31813 </itemizedlist>
31814 </section>
31815 <section>
31816 <title>Interpreting redirection data</title>
31817 <para>
31818 <indexterm role="concept">
31819 <primary>Sieve filter</primary>
31820 <secondary>specifying in redirection data</secondary>
31821 </indexterm>
31822 <indexterm role="concept">
31823 <primary>filter</primary>
31824 <secondary>specifying in redirection data</secondary>
31825 </indexterm>
31826 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
31827 can be interpreted in two different ways:
31828 </para>
31829 <itemizedlist>
31830 <listitem>
31831 <para>
31832 If the <option>allow_filter</option> option is set true, and the data begins with the text
31833 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
31834 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
31835 respectively. Details of the syntax and semantics of filter files are described
31836 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
31837 document is intended for use by end users.
31838 </para>
31839 </listitem>
31840 <listitem>
31841 <para>
31842 Otherwise, the data must be a comma-separated list of redirection items, as
31843 described in the next section.
31844 </para>
31845 </listitem>
31846 </itemizedlist>
31847 <para>
31848 When a message is redirected to a file (a <quote>mail folder</quote>), the file name given
31849 in a non-filter redirection list must always be an absolute path. A filter may
31850 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
31851 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
31852 for the <command>appendfile</command> transport.
31853 </para>
31854 </section>
31855 <section id="SECTitenonfilred">
31856 <title>Items in a non-filter redirection list</title>
31857 <para>
31858 <indexterm role="concept">
31859 <primary>address redirection</primary>
31860 <secondary>non-filter list items</secondary>
31861 </indexterm>
31862 When the redirection data is not an Exim or Sieve filter, for example, if it
31863 comes from a conventional alias or forward file, it consists of a list of
31864 addresses, file names, pipe commands, or certain special items (see section
31865 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
31866 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
31867 depending on their default values. The items in the list are separated by
31868 commas or newlines.
31869 If a comma is required in an item, the entire item must be enclosed in double
31870 quotes.
31871 </para>
31872 <para>
31873 Lines starting with a # character are comments, and are ignored, and # may
31874 also appear following a comma, in which case everything between the # and the
31875 next newline character is ignored.
31876 </para>
31877 <para>
31878 If an item is entirely enclosed in double quotes, these are removed. Otherwise
31879 double quotes are retained because some forms of mail address require their use
31880 (but never to enclose the entire address). In the following description,
31881 <quote>item</quote> refers to what remains after any surrounding double quotes have been
31882 removed.
31883 </para>
31884 <para>
31885 <indexterm role="concept">
31886 <primary><varname>$local_part</varname></primary>
31887 </indexterm>
31888 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
31889 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
31890 of the <option>quote_local_part</option> expansion operator, in case the local part contains
31891 special characters. For example, to redirect all mail for the domain
31892 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
31893 setting:
31894 </para>
31895 <literallayout class="monospaced">
31896 data = ${quote_local_part:$local_part}@newdomain.example
31897 </literallayout>
31898 </section>
31899 <section id="SECTredlocmai">
31900 <title>Redirecting to a local mailbox</title>
31901 <para>
31902 <indexterm role="concept">
31903 <primary>routing</primary>
31904 <secondary>loops in</secondary>
31905 </indexterm>
31906 <indexterm role="concept">
31907 <primary>loop while routing</primary>
31908 <secondary>avoidance of</secondary>
31909 </indexterm>
31910 <indexterm role="concept">
31911 <primary>address redirection</primary>
31912 <secondary>to local mailbox</secondary>
31913 </indexterm>
31914 A redirection item may safely be the same as the address currently under
31915 consideration. This does not cause a routing loop, because a router is
31916 automatically skipped if any ancestor of the address that is being processed
31917 is the same as the current address and was processed by the current router.
31918 Such an address is therefore passed to the following routers, so it is handled
31919 as if there were no redirection. When making this loop-avoidance test, the
31920 complete local part, including any prefix or suffix, is used.
31921 </para>
31922 <para>
31923 <indexterm role="concept">
31924 <primary>address redirection</primary>
31925 <secondary>local part without domain</secondary>
31926 </indexterm>
31927 Specifying the same local part without a domain is a common usage in personal
31928 filter files when the user wants to have messages delivered to the local
31929 mailbox and also forwarded elsewhere. For example, the user whose login is
31930 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
31931 </para>
31932 <literallayout class="monospaced">
31933 cleo, cleopatra@egypt.example
31934 </literallayout>
31935 <para>
31936 <indexterm role="concept">
31937 <primary>backslash in alias file</primary>
31938 </indexterm>
31939 <indexterm role="concept">
31940 <primary>alias file</primary>
31941 <secondary>backslash in</secondary>
31942 </indexterm>
31943 For compatibility with other MTAs, such unqualified local parts may be
31944 preceeded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
31945 it does make a difference if more than one domain is being handled
31946 synonymously.
31947 </para>
31948 <para>
31949 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
31950 2822 address that does not include a domain, the item is qualified using the
31951 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
31952 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
31953 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
31954 </para>
31955 <para>
31956 Care must be taken if there are alias names for local users.
31957 Consider an MTA handling a single local domain where the system alias file
31958 contains:
31959 </para>
31960 <literallayout class="monospaced">
31961 Sam.Reman: spqr
31962 </literallayout>
31963 <para>
31964 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
31965 messages in the local mailbox, and also forward copies elsewhere. He creates
31966 this forward file:
31967 </para>
31968 <literallayout class="monospaced">
31969 Sam.Reman, spqr@reme.elsewhere.example
31970 </literallayout>
31971 <para>
31972 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
31973 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
31974 second time round, because it has previously routed it,
31975 and the following routers presumably cannot handle the alias. The forward file
31976 should really contain
31977 </para>
31978 <literallayout class="monospaced">
31979 spqr, spqr@reme.elsewhere.example
31980 </literallayout>
31981 <para>
31982 but because this is such a common error, the <option>check_ancestor</option> option (see
31983 below) exists to provide a way to get round it. This is normally set on a
31984 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
31985 </para>
31986 </section>
31987 <section id="SECTspecitredli">
31988 <title>Special items in redirection lists</title>
31989 <para>
31990 In addition to addresses, the following types of item may appear in redirection
31991 lists (that is, in non-filter redirection data):
31992 </para>
31993 <itemizedlist>
31994 <listitem>
31995 <para>
31996 <indexterm role="concept">
31997 <primary>pipe</primary>
31998 <secondary>in redirection list</secondary>
31999 </indexterm>
32000 <indexterm role="concept">
32001 <primary>address redirection</primary>
32002 <secondary>to pipe</secondary>
32003 </indexterm>
32004 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
32005 as a valid RFC 2822 address that includes a domain. A transport for running the
32006 command must be specified by the <option>pipe_transport</option> option.
32007 Normally, either the router or the transport specifies a user and a group under
32008 which to run the delivery. The default is to use the Exim user and group.
32009 </para>
32010 <para>
32011 Single or double quotes can be used for enclosing the individual arguments of
32012 the pipe command; no interpretation of escapes is done for single quotes. If
32013 the command contains a comma character, it is necessary to put the whole item
32014 in double quotes, for example:
32015 </para>
32016 <literallayout class="monospaced">
32017 "|/some/command ready,steady,go"
32018 </literallayout>
32019 <para>
32020 since items in redirection lists are terminated by commas. Do not, however,
32021 quote just the command. An item such as
32022 </para>
32023 <literallayout class="monospaced">
32024 |"/some/command ready,steady,go"
32025 </literallayout>
32026 <para>
32027 is interpreted as a pipe with a rather strange command name, and no arguments.
32028 </para>
32029 </listitem>
32030 <listitem>
32031 <para>
32032 <indexterm role="concept">
32033 <primary>file</primary>
32034 <secondary>in redirection list</secondary>
32035 </indexterm>
32036 <indexterm role="concept">
32037 <primary>address redirection</primary>
32038 <secondary>to file</secondary>
32039 </indexterm>
32040 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
32041 parse as a valid RFC 2822 address that includes a domain. For example,
32042 </para>
32043 <literallayout class="monospaced">
32044 /home/world/minbari
32045 </literallayout>
32046 <para>
32047 is treated as a file name, but
32048 </para>
32049 <literallayout class="monospaced">
32050 /s=molari/o=babylon/@x400gate.way
32051 </literallayout>
32052 <para>
32053 is treated as an address. For a file name, a transport must be specified using
32054 the <option>file_transport</option> option. However, if the generated path name ends with a
32055 forward slash character, it is interpreted as a directory name rather than a
32056 file name, and <option>directory_transport</option> is used instead.
32057 </para>
32058 <para>
32059 Normally, either the router or the transport specifies a user and a group under
32060 which to run the delivery. The default is to use the Exim user and group.
32061 </para>
32062 <para>
32063 <indexterm role="concept">
32064 <primary><filename>/dev/null</filename></primary>
32065 </indexterm>
32066 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
32067 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
32068 instead of a transport name. In this case the user and group are not used.
32069 </para>
32070 </listitem>
32071 <listitem>
32072 <para>
32073 <indexterm role="concept">
32074 <primary>included address list</primary>
32075 </indexterm>
32076 <indexterm role="concept">
32077 <primary>address redirection</primary>
32078 <secondary>included external list</secondary>
32079 </indexterm>
32080 If an item is of the form
32081 </para>
32082 <literallayout class="monospaced">
32083 :include:&lt;path name&gt;
32084 </literallayout>
32085 <para>
32086 a list of further items is taken from the given file and included at that
32087 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
32088 out-of-line addition to the list. The items in the included list are separated
32089 by commas or newlines and are not subject to expansion. If this is the first
32090 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
32091 the alias name. This example is incorrect:
32092 </para>
32093 <literallayout class="monospaced">
32094 list1    :include:/opt/lists/list1
32095 </literallayout>
32096 <para>
32097 It must be given as
32098 </para>
32099 <literallayout class="monospaced">
32100 list1:   :include:/opt/lists/list1
32101 </literallayout>
32102 </listitem>
32103 <listitem>
32104 <para>
32105 <indexterm role="concept">
32106 <primary>address redirection</primary>
32107 <secondary>to black hole</secondary>
32108 </indexterm>
32109 Sometimes you want to throw away mail to a particular local part. Making the
32110 <option>data</option> option expand to an empty string does not work, because that causes
32111 the router to decline. Instead, the alias item
32112 <indexterm role="concept">
32113 <primary>black hole</primary>
32114 </indexterm>
32115 <indexterm role="concept">
32116 <primary>abandoning mail</primary>
32117 </indexterm>
32118 </para>
32119 <literallayout class="monospaced">
32120 :blackhole:
32121 </literallayout>
32122 <para>
32123 can be used. It does what its name implies. No delivery is done, and no error
32124 message is generated. This has the same effect as specifing <filename>/dev/null</filename>, but
32125 can be independently disabled.
32126 </para>
32127 <para>
32128 <emphasis role="bold">Warning</emphasis>: If <literal>:blackhole:</literal> appears anywhere in a redirection list, no
32129 delivery is done for the original local part, even if other redirection items
32130 are present. If you are generating a multi-item list (for example, by reading a
32131 database) and need the ability to provide a no-op item, you must use
32132 <filename>/dev/null</filename>.
32133 </para>
32134 </listitem>
32135 <listitem>
32136 <para>
32137 <indexterm role="concept">
32138 <primary>delivery</primary>
32139 <secondary>forcing failure</secondary>
32140 </indexterm>
32141 <indexterm role="concept">
32142 <primary>delivery</primary>
32143 <secondary>forcing deferral</secondary>
32144 </indexterm>
32145 <indexterm role="concept">
32146 <primary>failing delivery</primary>
32147 <secondary>forcing</secondary>
32148 </indexterm>
32149 <indexterm role="concept">
32150 <primary>deferred delivery</primary>
32151 <secondary>forcing</secondary>
32152 </indexterm>
32153 <indexterm role="concept">
32154 <primary>customizing</primary>
32155 <secondary>failure message</secondary>
32156 </indexterm>
32157 An attempt to deliver a particular address can be deferred or forced to fail by
32158 redirection items of the form
32159 </para>
32160 <literallayout class="monospaced">
32161 :defer:
32162 :fail:
32163 </literallayout>
32164 <para>
32165 respectively. When a redirection list contains such an item, it applies to the
32166 entire redirection; any other items in the list are ignored (<emphasis>:blackhole:</emphasis> is
32167 different). Any text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error
32168 text associated with the failure. For example, an alias file might contain:
32169 </para>
32170 <literallayout class="monospaced">
32171 X.Employee:  :fail: Gone away, no forwarding address
32172 </literallayout>
32173 <para revisionflag="changed">
32174 In the case of an address that is being verified from an ACL or as the subject
32175 of a
32176 <indexterm role="concept">
32177 <primary>VRFY error text</primary>
32178 <secondary>display of</secondary>
32179 </indexterm>
32180 VRFY command, the text is included in the SMTP error response by
32181 default.
32182 <indexterm role="concept">
32183 <primary>EXPN error text</primary>
32184 <secondary>display of</secondary>
32185 </indexterm>
32186 The text is not included in the response to an EXPN command. In non-SMTP cases
32187 the text is included in the error message that Exim generates.
32188 </para>
32189 <para revisionflag="changed">
32190 <indexterm role="concept">
32191 <primary>SMTP</primary>
32192 <secondary>error codes</secondary>
32193 </indexterm>
32194 By default, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
32195 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
32196 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
32197 followed by a space, and the very first digit is the same as the default error
32198 code, the code from the message is used instead. If the very first digit is
32199 incorrect, a panic error is logged, and the default code is used. You can
32200 suppress the use of the supplied code in a redirect router by setting the
32201 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
32202 ignored.
32203 </para>
32204 <para revisionflag="changed">
32205 <indexterm role="concept">
32206 <primary><varname>$acl_verify_message</varname></primary>
32207 </indexterm>
32208 In an ACL, an explicitly provided message overrides the default, but the
32209 default message is available in the variable <varname>$acl_verify_message</varname> and can
32210 therefore be included in a custom message if this is desired.
32211 </para>
32212 <para>
32213 Normally the error text is the rest of the redirection list &ndash; a comma does
32214 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
32215 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
32216 as part of the continuation process, but they may exist in other kinds of
32217 lookup and in <emphasis>:include:</emphasis> files.
32218 </para>
32219 <para>
32220 During routing for message delivery (as opposed to verification), a redirection
32221 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
32222 whereas <emphasis>:defer:</emphasis> causes the message to remain on the queue so that a
32223 subsequent delivery attempt can happen at a later time. If an address is
32224 deferred for too long, it will ultimately fail, because the normal retry
32225 rules still apply.
32226 </para>
32227 </listitem>
32228 <listitem>
32229 <para>
32230 <indexterm role="concept">
32231 <primary>alias file</primary>
32232 <secondary>exception to default</secondary>
32233 </indexterm>
32234 Sometimes it is useful to use a single-key search type with a default (see
32235 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
32236 for exceptions to the default. These can be handled by aliasing them to
32237 </para>
32238 <literallayout class="monospaced">
32239 :unknown:
32240 </literallayout>
32241 <para>
32242 This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command> router to
32243 decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which results in
32244 an empty redirection list has the same effect.
32245 </para>
32246 </listitem>
32247 </itemizedlist>
32248 </section>
32249 <section>
32250 <title>Duplicate addresses</title>
32251 <para>
32252 <indexterm role="concept">
32253 <primary>duplicate addresses</primary>
32254 </indexterm>
32255 <indexterm role="concept">
32256 <primary>address duplicate</primary>
32257 <secondary>discarding</secondary>
32258 </indexterm>
32259 <indexterm role="concept">
32260 <primary>pipe</primary>
32261 <secondary>duplicated</secondary>
32262 </indexterm>
32263 Exim removes duplicate addresses from the list to which it is delivering, so as
32264 to deliver just one copy to each address. This does not apply to deliveries
32265 routed to pipes by different immediate parent addresses, but an indirect
32266 aliasing scheme of the type
32267 </para>
32268 <literallayout class="monospaced">
32269 pipe:       |/some/command $local_part
32270 localpart1: pipe
32271 localpart2: pipe
32272 </literallayout>
32273 <para>
32274 does not work with a message that is addressed to both local parts, because
32275 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
32276 discarded as being the same as a previously handled address. However, a scheme
32277 such as
32278 </para>
32279 <literallayout class="monospaced">
32280 localpart1: |/some/command $local_part
32281 localpart2: |/some/command $local_part
32282 </literallayout>
32283 <para>
32284 does result in two different pipe deliveries, because the immediate parents of
32285 the pipes are distinct.
32286 </para>
32287 </section>
32288 <section>
32289 <title>Repeated redirection expansion</title>
32290 <para>
32291 <indexterm role="concept">
32292 <primary>repeated redirection expansion</primary>
32293 </indexterm>
32294 <indexterm role="concept">
32295 <primary>address redirection</primary>
32296 <secondary>repeated for each delivery attempt</secondary>
32297 </indexterm>
32298 When a message cannot be delivered to all of its recipients immediately,
32299 leading to two or more delivery attempts, redirection expansion is carried out
32300 afresh each time for those addresses whose children were not all previously
32301 delivered. If redirection is being used as a mailing list, this can lead to new
32302 members of the list receiving copies of old messages. The <option>one_time</option> option
32303 can be used to avoid this.
32304 </para>
32305 </section>
32306 <section>
32307 <title>Errors in redirection lists</title>
32308 <para>
32309 <indexterm role="concept">
32310 <primary>address redirection</primary>
32311 <secondary>errors</secondary>
32312 </indexterm>
32313 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
32314 error is skipped, and an entry is written to the main log. This may be useful
32315 for mailing lists that are automatically managed. Otherwise, if an error is
32316 detected while generating the list of new addresses, the original address is
32317 deferred. See also <option>syntax_errors_to</option>.
32318 </para>
32319 </section>
32320 <section>
32321 <title>Private options for the redirect router</title>
32322 <para>
32323 <indexterm role="concept">
32324 <primary>options</primary>
32325 <secondary><command>redirect</command> router</secondary>
32326 </indexterm>
32327 The private options for the <command>redirect</command> router are as follows:
32328 </para>
32329 <para>
32330 <indexterm role="option">
32331 <primary>allow_defer</primary>
32332 </indexterm>
32333 </para>
32334 <informaltable frame="all">
32335 <tgroup cols="4" colsep="0" rowsep="0">
32336 <colspec colwidth="8*" align="left"/>
32337 <colspec colwidth="5*" align="center"/>
32338 <colspec colwidth="5*" align="center"/>
32339 <colspec colwidth="6*" align="right"/>
32340 <tbody>
32341 <row>
32342 <entry><option>allow_defer</option></entry>
32343 <entry>Use: <emphasis>redirect</emphasis></entry>
32344 <entry>Type: <emphasis>boolean</emphasis></entry>
32345 <entry>Default: <emphasis>false</emphasis></entry>
32346 </row>
32347 </tbody>
32348 </tgroup>
32349 </informaltable>
32350 <para>
32351 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
32352 data, or the <option>defer</option> command in an Exim filter file.
32353 </para>
32354 <para>
32355 <indexterm role="option">
32356 <primary>allow_fail</primary>
32357 </indexterm>
32358 </para>
32359 <informaltable frame="all">
32360 <tgroup cols="4" colsep="0" rowsep="0">
32361 <colspec colwidth="8*" align="left"/>
32362 <colspec colwidth="5*" align="center"/>
32363 <colspec colwidth="5*" align="center"/>
32364 <colspec colwidth="6*" align="right"/>
32365 <tbody>
32366 <row>
32367 <entry><option>allow_fail</option></entry>
32368 <entry>Use: <emphasis>redirect</emphasis></entry>
32369 <entry>Type: <emphasis>boolean</emphasis></entry>
32370 <entry>Default: <emphasis>false</emphasis></entry>
32371 </row>
32372 </tbody>
32373 </tgroup>
32374 </informaltable>
32375 <para>
32376 <indexterm role="concept">
32377 <primary>failing delivery</primary>
32378 <secondary>from filter</secondary>
32379 </indexterm>
32380 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
32381 and the <option>fail</option> command may be used in an Exim filter file.
32382 </para>
32383 <para>
32384 <indexterm role="option">
32385 <primary>allow_filter</primary>
32386 </indexterm>
32387 </para>
32388 <informaltable frame="all">
32389 <tgroup cols="4" colsep="0" rowsep="0">
32390 <colspec colwidth="8*" align="left"/>
32391 <colspec colwidth="5*" align="center"/>
32392 <colspec colwidth="5*" align="center"/>
32393 <colspec colwidth="6*" align="right"/>
32394 <tbody>
32395 <row>
32396 <entry><option>allow_filter</option></entry>
32397 <entry>Use: <emphasis>redirect</emphasis></entry>
32398 <entry>Type: <emphasis>boolean</emphasis></entry>
32399 <entry>Default: <emphasis>false</emphasis></entry>
32400 </row>
32401 </tbody>
32402 </tgroup>
32403 </informaltable>
32404 <para>
32405 <indexterm role="concept">
32406 <primary>filter</primary>
32407 <secondary>enabling use of</secondary>
32408 </indexterm>
32409 <indexterm role="concept">
32410 <primary>Sieve filter</primary>
32411 <secondary>enabling use of</secondary>
32412 </indexterm>
32413 Setting this option allows Exim to interpret redirection data that starts with
32414 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
32415 are some features of Exim filter files that some administrators may wish to
32416 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
32417 </para>
32418 <para>
32419 It is also possible to lock out Exim filters or Sieve filters while allowing
32420 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
32421 </para>
32422 <para>
32423 The filter is run using the uid and gid set by the generic <option>user</option> and
32424 <option>group</option> options. These take their defaults from the password data if
32425 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
32426 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
32427 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
32428 </para>
32429 <para>
32430 <indexterm role="option">
32431 <primary>allow_freeze</primary>
32432 </indexterm>
32433 </para>
32434 <informaltable frame="all">
32435 <tgroup cols="4" colsep="0" rowsep="0">
32436 <colspec colwidth="8*" align="left"/>
32437 <colspec colwidth="5*" align="center"/>
32438 <colspec colwidth="5*" align="center"/>
32439 <colspec colwidth="6*" align="right"/>
32440 <tbody>
32441 <row>
32442 <entry><option>allow_freeze</option></entry>
32443 <entry>Use: <emphasis>redirect</emphasis></entry>
32444 <entry>Type: <emphasis>boolean</emphasis></entry>
32445 <entry>Default: <emphasis>false</emphasis></entry>
32446 </row>
32447 </tbody>
32448 </tgroup>
32449 </informaltable>
32450 <para>
32451 <indexterm role="concept">
32452 <primary>freezing messages</primary>
32453 <secondary>allowing in filter</secondary>
32454 </indexterm>
32455 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
32456 This command is more normally encountered in system filters, and is disabled by
32457 default for redirection filters because it isn&#x2019;t something you usually want to
32458 let ordinary users do.
32459 </para>
32460 <para>
32461 <indexterm role="option">
32462 <primary>check_ancestor</primary>
32463 </indexterm>
32464 </para>
32465 <informaltable frame="all">
32466 <tgroup cols="4" colsep="0" rowsep="0">
32467 <colspec colwidth="8*" align="left"/>
32468 <colspec colwidth="5*" align="center"/>
32469 <colspec colwidth="5*" align="center"/>
32470 <colspec colwidth="6*" align="right"/>
32471 <tbody>
32472 <row>
32473 <entry><option>check_ancestor</option></entry>
32474 <entry>Use: <emphasis>redirect</emphasis></entry>
32475 <entry>Type: <emphasis>boolean</emphasis></entry>
32476 <entry>Default: <emphasis>false</emphasis></entry>
32477 </row>
32478 </tbody>
32479 </tgroup>
32480 </informaltable>
32481 <para>
32482 This option is concerned with handling generated addresses that are the same
32483 as some address in the list of redirection ancestors of the current address.
32484 Although it is turned off by default in the code, it is set in the default
32485 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
32486 for this use of the <command>redirect</command> router.
32487 </para>
32488 <para>
32489 When <option>check_ancestor</option> is set, if a generated address (including the domain)
32490 is the same as any ancestor of the current address, it is replaced by a copy of
32491 the current address. This helps in the case where local part A is aliased to B,
32492 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
32493 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
32494 <filename>&nbsp;jb/.forward</filename> contains:
32495 </para>
32496 <literallayout class="monospaced">
32497 \Joe.Bloggs, &lt;other item(s)&gt;
32498 </literallayout>
32499 <para>
32500 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
32501 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
32502 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
32503 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
32504 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
32505 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
32506 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
32507 original address. See also the <option>repeat_use</option> option below.
32508 </para>
32509 <para>
32510 <indexterm role="option">
32511 <primary>check_group</primary>
32512 </indexterm>
32513 </para>
32514 <informaltable frame="all">
32515 <tgroup cols="4" colsep="0" rowsep="0">
32516 <colspec colwidth="8*" align="left"/>
32517 <colspec colwidth="5*" align="center"/>
32518 <colspec colwidth="5*" align="center"/>
32519 <colspec colwidth="6*" align="right"/>
32520 <tbody>
32521 <row>
32522 <entry><option>check_group</option></entry>
32523 <entry>Use: <emphasis>redirect</emphasis></entry>
32524 <entry>Type: <emphasis>boolean</emphasis></entry>
32525 <entry>Default: <emphasis>see below</emphasis></entry>
32526 </row>
32527 </tbody>
32528 </tgroup>
32529 </informaltable>
32530 <para>
32531 When the <option>file</option> option is used, the group owner of the file is checked only
32532 when this option is set. The permitted groups are those listed in the
32533 <option>owngroups</option> option, together with the user&#x2019;s default group if
32534 <option>check_local_user</option> is set. If the file has the wrong group, routing is
32535 deferred. The default setting for this option is true if <option>check_local_user</option>
32536 is set and the <option>modemask</option> option permits the group write bit, or if the
32537 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
32538 </para>
32539 <para>
32540 <indexterm role="option">
32541 <primary>check_owner</primary>
32542 </indexterm>
32543 </para>
32544 <informaltable frame="all">
32545 <tgroup cols="4" colsep="0" rowsep="0">
32546 <colspec colwidth="8*" align="left"/>
32547 <colspec colwidth="5*" align="center"/>
32548 <colspec colwidth="5*" align="center"/>
32549 <colspec colwidth="6*" align="right"/>
32550 <tbody>
32551 <row>
32552 <entry><option>check_owner</option></entry>
32553 <entry>Use: <emphasis>redirect</emphasis></entry>
32554 <entry>Type: <emphasis>boolean</emphasis></entry>
32555 <entry>Default: <emphasis>see below</emphasis></entry>
32556 </row>
32557 </tbody>
32558 </tgroup>
32559 </informaltable>
32560 <para>
32561 When the <option>file</option> option is used, the owner of the file is checked only when
32562 this option is set. If <option>check_local_user</option> is set, the local user is
32563 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
32564 option. The default value for this option is true if <option>check_local_user</option> or
32565 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
32566 </para>
32567 <para>
32568 <indexterm role="option">
32569 <primary>data</primary>
32570 </indexterm>
32571 </para>
32572 <informaltable frame="all">
32573 <tgroup cols="4" colsep="0" rowsep="0">
32574 <colspec colwidth="8*" align="left"/>
32575 <colspec colwidth="5*" align="center"/>
32576 <colspec colwidth="5*" align="center"/>
32577 <colspec colwidth="6*" align="right"/>
32578 <tbody>
32579 <row>
32580 <entry><option>data</option></entry>
32581 <entry>Use: <emphasis>redirect</emphasis></entry>
32582 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32583 <entry>Default: <emphasis>unset</emphasis></entry>
32584 </row>
32585 </tbody>
32586 </tgroup>
32587 </informaltable>
32588 <para>
32589 This option is mutually exclusive with <option>file</option>. One or other of them must be
32590 set, but not both. The contents of <option>data</option> are expanded, and then used as the
32591 list of forwarding items, or as a set of filtering instructions. If the
32592 expansion is forced to fail, or the result is an empty string or a string that
32593 has no effect (consists entirely of comments), the router declines.
32594 </para>
32595 <para>
32596 When filtering instructions are used, the string must begin with <quote>#Exim
32597 filter</quote>, and all comments in the string, including this initial one, must be
32598 terminated with newline characters. For example:
32599 </para>
32600 <literallayout class="monospaced">
32601 data = #Exim filter\n\
32602        if $h_to: contains Exim then save $home/mail/exim endif
32603 </literallayout>
32604 <para>
32605 If you are reading the data from a database where newlines cannot be included,
32606 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
32607 choice into a newline.
32608 </para>
32609 <para>
32610 <indexterm role="option">
32611 <primary>directory_transport</primary>
32612 </indexterm>
32613 </para>
32614 <informaltable frame="all">
32615 <tgroup cols="4" colsep="0" rowsep="0">
32616 <colspec colwidth="8*" align="left"/>
32617 <colspec colwidth="5*" align="center"/>
32618 <colspec colwidth="5*" align="center"/>
32619 <colspec colwidth="6*" align="right"/>
32620 <tbody>
32621 <row>
32622 <entry><option>directory_transport</option></entry>
32623 <entry>Use: <emphasis>redirect</emphasis></entry>
32624 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32625 <entry>Default: <emphasis>unset</emphasis></entry>
32626 </row>
32627 </tbody>
32628 </tgroup>
32629 </informaltable>
32630 <para>
32631 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
32632 ending with a slash is specified as a new <quote>address</quote>. The transport used is
32633 specified by this option, which, after expansion, must be the name of a
32634 configured transport. This should normally be an <command>appendfile</command> transport.
32635 </para>
32636 <para>
32637 <indexterm role="option">
32638 <primary>file</primary>
32639 </indexterm>
32640 </para>
32641 <informaltable frame="all">
32642 <tgroup cols="4" colsep="0" rowsep="0">
32643 <colspec colwidth="8*" align="left"/>
32644 <colspec colwidth="5*" align="center"/>
32645 <colspec colwidth="5*" align="center"/>
32646 <colspec colwidth="6*" align="right"/>
32647 <tbody>
32648 <row>
32649 <entry><option>file</option></entry>
32650 <entry>Use: <emphasis>redirect</emphasis></entry>
32651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32652 <entry>Default: <emphasis>unset</emphasis></entry>
32653 </row>
32654 </tbody>
32655 </tgroup>
32656 </informaltable>
32657 <para>
32658 This option specifies the name of a file that contains the redirection data. It
32659 is mutually exclusive with the <option>data</option> option. The string is expanded before
32660 use; if the expansion is forced to fail, the router declines. Other expansion
32661 failures cause delivery to be deferred. The result of a successful expansion
32662 must be an absolute path. The entire file is read and used as the redirection
32663 data. If the data is an empty string or a string that has no effect (consists
32664 entirely of comments), the router declines.
32665 </para>
32666 <para>
32667 <indexterm role="concept">
32668 <primary>NFS</primary>
32669 <secondary>checking for file existence</secondary>
32670 </indexterm>
32671 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
32672 runs a check on the containing directory,
32673 unless <option>ignore_enotdir</option> is true (see below).
32674 If the directory does not appear to exist, delivery is deferred. This can
32675 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
32676 is a mount problem. If the containing directory does exist, but the file does
32677 not, the router declines.
32678 </para>
32679 <para>
32680 <indexterm role="option">
32681 <primary>file_transport</primary>
32682 </indexterm>
32683 </para>
32684 <informaltable frame="all">
32685 <tgroup cols="4" colsep="0" rowsep="0">
32686 <colspec colwidth="8*" align="left"/>
32687 <colspec colwidth="5*" align="center"/>
32688 <colspec colwidth="5*" align="center"/>
32689 <colspec colwidth="6*" align="right"/>
32690 <tbody>
32691 <row>
32692 <entry><option>file_transport</option></entry>
32693 <entry>Use: <emphasis>redirect</emphasis></entry>
32694 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32695 <entry>Default: <emphasis>unset</emphasis></entry>
32696 </row>
32697 </tbody>
32698 </tgroup>
32699 </informaltable>
32700 <para>
32701 <indexterm role="concept">
32702 <primary><varname>$address_file</varname></primary>
32703 </indexterm>
32704 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
32705 ending in a slash is specified as a new <quote>address</quote>. The transport used is
32706 specified by this option, which, after expansion, must be the name of a
32707 configured transport. This should normally be an <command>appendfile</command> transport. When
32708 it is running, the file name is in <varname>$address_file</varname>.
32709 </para>
32710 <para revisionflag="changed">
32711 <indexterm role="option">
32712 <primary>filter_prepend_home</primary>
32713 </indexterm>
32714 </para>
32715 <informaltable frame="all" revisionflag="changed">
32716 <tgroup cols="4" colsep="0" rowsep="0">
32717 <colspec colwidth="8*" align="left"/>
32718 <colspec colwidth="5*" align="center"/>
32719 <colspec colwidth="5*" align="center"/>
32720 <colspec colwidth="6*" align="right"/>
32721 <tbody>
32722 <row>
32723 <entry><option>filter_prepend_home</option></entry>
32724 <entry>Use: <emphasis>redirect</emphasis></entry>
32725 <entry>Type: <emphasis>boolean</emphasis></entry>
32726 <entry>Default: <emphasis>true</emphasis></entry>
32727 </row>
32728 </tbody>
32729 </tgroup>
32730 </informaltable>
32731 <para revisionflag="changed">
32732 When this option is true, if a <command>save</command> command in an Exim filter specifies a
32733 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
32734 relative path. If this option is set false, this action does not happen. The
32735 relative path is then passed to the transport unmodified.
32736 </para>
32737 <para>
32738 <indexterm role="option">
32739 <primary>forbid_blackhole</primary>
32740 </indexterm>
32741 </para>
32742 <informaltable frame="all">
32743 <tgroup cols="4" colsep="0" rowsep="0">
32744 <colspec colwidth="8*" align="left"/>
32745 <colspec colwidth="5*" align="center"/>
32746 <colspec colwidth="5*" align="center"/>
32747 <colspec colwidth="6*" align="right"/>
32748 <tbody>
32749 <row>
32750 <entry><option>forbid_blackhole</option></entry>
32751 <entry>Use: <emphasis>redirect</emphasis></entry>
32752 <entry>Type: <emphasis>boolean</emphasis></entry>
32753 <entry>Default: <emphasis>false</emphasis></entry>
32754 </row>
32755 </tbody>
32756 </tgroup>
32757 </informaltable>
32758 <para>
32759 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
32760 redirection list.
32761 </para>
32762 <para>
32763 <indexterm role="option">
32764 <primary>forbid_exim_filter</primary>
32765 </indexterm>
32766 </para>
32767 <informaltable frame="all">
32768 <tgroup cols="4" colsep="0" rowsep="0">
32769 <colspec colwidth="8*" align="left"/>
32770 <colspec colwidth="5*" align="center"/>
32771 <colspec colwidth="5*" align="center"/>
32772 <colspec colwidth="6*" align="right"/>
32773 <tbody>
32774 <row>
32775 <entry><option>forbid_exim_filter</option></entry>
32776 <entry>Use: <emphasis>redirect</emphasis></entry>
32777 <entry>Type: <emphasis>boolean</emphasis></entry>
32778 <entry>Default: <emphasis>false</emphasis></entry>
32779 </row>
32780 </tbody>
32781 </tgroup>
32782 </informaltable>
32783 <para>
32784 If this option is set true, only Sieve filters are permitted when
32785 <option>allow_filter</option> is true.
32786 </para>
32787 <para>
32788 <indexterm role="option">
32789 <primary>forbid_file</primary>
32790 </indexterm>
32791 </para>
32792 <informaltable frame="all">
32793 <tgroup cols="4" colsep="0" rowsep="0">
32794 <colspec colwidth="8*" align="left"/>
32795 <colspec colwidth="5*" align="center"/>
32796 <colspec colwidth="5*" align="center"/>
32797 <colspec colwidth="6*" align="right"/>
32798 <tbody>
32799 <row>
32800 <entry><option>forbid_file</option></entry>
32801 <entry>Use: <emphasis>redirect</emphasis></entry>
32802 <entry>Type: <emphasis>boolean</emphasis></entry>
32803 <entry>Default: <emphasis>false</emphasis></entry>
32804 </row>
32805 </tbody>
32806 </tgroup>
32807 </informaltable>
32808 <para>
32809 <indexterm role="concept">
32810 <primary>delivery</primary>
32811 <secondary>to file; forbidding</secondary>
32812 </indexterm>
32813 <indexterm role="concept">
32814 <primary>Sieve filter</primary>
32815 <secondary>forbidding delivery to a file</secondary>
32816 </indexterm>
32817 <indexterm role="concept">
32818 <primary>Sieve filter</primary>
32819 <secondary><quote>keep</quote> facility; disabling</secondary>
32820 </indexterm>
32821 If this option is true, this router may not generate a new address that
32822 specifies delivery to a local file or directory, either from a filter or from a
32823 conventional forward file. This option is forced to be true if <option>one_time</option> is
32824 set. It applies to Sieve filters as well as to Exim filters, but if true, it
32825 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
32826 </para>
32827 <para>
32828 <indexterm role="option">
32829 <primary>forbid_filter_dlfunc</primary>
32830 </indexterm>
32831 </para>
32832 <informaltable frame="all">
32833 <tgroup cols="4" colsep="0" rowsep="0">
32834 <colspec colwidth="8*" align="left"/>
32835 <colspec colwidth="5*" align="center"/>
32836 <colspec colwidth="5*" align="center"/>
32837 <colspec colwidth="6*" align="right"/>
32838 <tbody>
32839 <row>
32840 <entry><option>forbid_filter_dlfunc</option></entry>
32841 <entry>Use: <emphasis>redirect</emphasis></entry>
32842 <entry>Type: <emphasis>boolean</emphasis></entry>
32843 <entry>Default: <emphasis>false</emphasis></entry>
32844 </row>
32845 </tbody>
32846 </tgroup>
32847 </informaltable>
32848 <para>
32849 <indexterm role="concept">
32850 <primary>filter</primary>
32851 <secondary>locking out certain features</secondary>
32852 </indexterm>
32853 If this option is true, string expansions in Exim filters are not allowed to
32854 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
32855 functions.
32856 </para>
32857 <para>
32858 <indexterm role="option">
32859 <primary>forbid_filter_existstest</primary>
32860 </indexterm>
32861 </para>
32862 <informaltable frame="all">
32863 <tgroup cols="4" colsep="0" rowsep="0">
32864 <colspec colwidth="8*" align="left"/>
32865 <colspec colwidth="5*" align="center"/>
32866 <colspec colwidth="5*" align="center"/>
32867 <colspec colwidth="6*" align="right"/>
32868 <tbody>
32869 <row>
32870 <entry><option>forbid_filter_existstest</option></entry>
32871 <entry>Use: <emphasis>redirect</emphasis></entry>
32872 <entry>Type: <emphasis>boolean</emphasis></entry>
32873 <entry>Default: <emphasis>false</emphasis></entry>
32874 </row>
32875 </tbody>
32876 </tgroup>
32877 </informaltable>
32878 <para>
32879 <indexterm role="concept">
32880 <primary>expansion</primary>
32881 <secondary>statting a file</secondary>
32882 </indexterm>
32883 If this option is true, string expansions in Exim filters are not allowed to
32884 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
32885 </para>
32886 <para>
32887 <indexterm role="option">
32888 <primary>forbid_filter_logwrite</primary>
32889 </indexterm>
32890 </para>
32891 <informaltable frame="all">
32892 <tgroup cols="4" colsep="0" rowsep="0">
32893 <colspec colwidth="8*" align="left"/>
32894 <colspec colwidth="5*" align="center"/>
32895 <colspec colwidth="5*" align="center"/>
32896 <colspec colwidth="6*" align="right"/>
32897 <tbody>
32898 <row>
32899 <entry><option>forbid_filter_logwrite</option></entry>
32900 <entry>Use: <emphasis>redirect</emphasis></entry>
32901 <entry>Type: <emphasis>boolean</emphasis></entry>
32902 <entry>Default: <emphasis>false</emphasis></entry>
32903 </row>
32904 </tbody>
32905 </tgroup>
32906 </informaltable>
32907 <para>
32908 If this option is true, use of the logging facility in Exim filters is not
32909 permitted. Logging is in any case available only if the filter is being run
32910 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
32911 <filename>.forward</filename> files).
32912 </para>
32913 <para>
32914 <indexterm role="option">
32915 <primary>forbid_filter_lookup</primary>
32916 </indexterm>
32917 </para>
32918 <informaltable frame="all">
32919 <tgroup cols="4" colsep="0" rowsep="0">
32920 <colspec colwidth="8*" align="left"/>
32921 <colspec colwidth="5*" align="center"/>
32922 <colspec colwidth="5*" align="center"/>
32923 <colspec colwidth="6*" align="right"/>
32924 <tbody>
32925 <row>
32926 <entry><option>forbid_filter_lookup</option></entry>
32927 <entry>Use: <emphasis>redirect</emphasis></entry>
32928 <entry>Type: <emphasis>boolean</emphasis></entry>
32929 <entry>Default: <emphasis>false</emphasis></entry>
32930 </row>
32931 </tbody>
32932 </tgroup>
32933 </informaltable>
32934 <para>
32935 If this option is true, string expansions in Exim filter files are not allowed
32936 to make use of <option>lookup</option> items.
32937 </para>
32938 <para>
32939 <indexterm role="option">
32940 <primary>forbid_filter_perl</primary>
32941 </indexterm>
32942 </para>
32943 <informaltable frame="all">
32944 <tgroup cols="4" colsep="0" rowsep="0">
32945 <colspec colwidth="8*" align="left"/>
32946 <colspec colwidth="5*" align="center"/>
32947 <colspec colwidth="5*" align="center"/>
32948 <colspec colwidth="6*" align="right"/>
32949 <tbody>
32950 <row>
32951 <entry><option>forbid_filter_perl</option></entry>
32952 <entry>Use: <emphasis>redirect</emphasis></entry>
32953 <entry>Type: <emphasis>boolean</emphasis></entry>
32954 <entry>Default: <emphasis>false</emphasis></entry>
32955 </row>
32956 </tbody>
32957 </tgroup>
32958 </informaltable>
32959 <para>
32960 This option has an effect only if Exim is built with embedded Perl support. If
32961 it is true, string expansions in Exim filter files are not allowed to make use
32962 of the embedded Perl support.
32963 </para>
32964 <para>
32965 <indexterm role="option">
32966 <primary>forbid_filter_readfile</primary>
32967 </indexterm>
32968 </para>
32969 <informaltable frame="all">
32970 <tgroup cols="4" colsep="0" rowsep="0">
32971 <colspec colwidth="8*" align="left"/>
32972 <colspec colwidth="5*" align="center"/>
32973 <colspec colwidth="5*" align="center"/>
32974 <colspec colwidth="6*" align="right"/>
32975 <tbody>
32976 <row>
32977 <entry><option>forbid_filter_readfile</option></entry>
32978 <entry>Use: <emphasis>redirect</emphasis></entry>
32979 <entry>Type: <emphasis>boolean</emphasis></entry>
32980 <entry>Default: <emphasis>false</emphasis></entry>
32981 </row>
32982 </tbody>
32983 </tgroup>
32984 </informaltable>
32985 <para>
32986 If this option is true, string expansions in Exim filter files are not allowed
32987 to make use of <option>readfile</option> items.
32988 </para>
32989 <para>
32990 <indexterm role="option">
32991 <primary>forbid_filter_readsocket</primary>
32992 </indexterm>
32993 </para>
32994 <informaltable frame="all">
32995 <tgroup cols="4" colsep="0" rowsep="0">
32996 <colspec colwidth="8*" align="left"/>
32997 <colspec colwidth="5*" align="center"/>
32998 <colspec colwidth="5*" align="center"/>
32999 <colspec colwidth="6*" align="right"/>
33000 <tbody>
33001 <row>
33002 <entry><option>forbid_filter_readsocket</option></entry>
33003 <entry>Use: <emphasis>redirect</emphasis></entry>
33004 <entry>Type: <emphasis>boolean</emphasis></entry>
33005 <entry>Default: <emphasis>false</emphasis></entry>
33006 </row>
33007 </tbody>
33008 </tgroup>
33009 </informaltable>
33010 <para>
33011 If this option is true, string expansions in Exim filter files are not allowed
33012 to make use of <option>readsocket</option> items.
33013 </para>
33014 <para>
33015 <indexterm role="option">
33016 <primary>forbid_filter_reply</primary>
33017 </indexterm>
33018 </para>
33019 <informaltable frame="all">
33020 <tgroup cols="4" colsep="0" rowsep="0">
33021 <colspec colwidth="8*" align="left"/>
33022 <colspec colwidth="5*" align="center"/>
33023 <colspec colwidth="5*" align="center"/>
33024 <colspec colwidth="6*" align="right"/>
33025 <tbody>
33026 <row>
33027 <entry><option>forbid_filter_reply</option></entry>
33028 <entry>Use: <emphasis>redirect</emphasis></entry>
33029 <entry>Type: <emphasis>boolean</emphasis></entry>
33030 <entry>Default: <emphasis>false</emphasis></entry>
33031 </row>
33032 </tbody>
33033 </tgroup>
33034 </informaltable>
33035 <para>
33036 If this option is true, this router may not generate an automatic reply
33037 message. Automatic replies can be generated only from Exim or Sieve filter
33038 files, not from traditional forward files. This option is forced to be true if
33039 <option>one_time</option> is set.
33040 </para>
33041 <para>
33042 <indexterm role="option">
33043 <primary>forbid_filter_run</primary>
33044 </indexterm>
33045 </para>
33046 <informaltable frame="all">
33047 <tgroup cols="4" colsep="0" rowsep="0">
33048 <colspec colwidth="8*" align="left"/>
33049 <colspec colwidth="5*" align="center"/>
33050 <colspec colwidth="5*" align="center"/>
33051 <colspec colwidth="6*" align="right"/>
33052 <tbody>
33053 <row>
33054 <entry><option>forbid_filter_run</option></entry>
33055 <entry>Use: <emphasis>redirect</emphasis></entry>
33056 <entry>Type: <emphasis>boolean</emphasis></entry>
33057 <entry>Default: <emphasis>false</emphasis></entry>
33058 </row>
33059 </tbody>
33060 </tgroup>
33061 </informaltable>
33062 <para>
33063 If this option is true, string expansions in Exim filter files are not allowed
33064 to make use of <option>run</option> items.
33065 </para>
33066 <para>
33067 <indexterm role="option">
33068 <primary>forbid_include</primary>
33069 </indexterm>
33070 </para>
33071 <informaltable frame="all">
33072 <tgroup cols="4" colsep="0" rowsep="0">
33073 <colspec colwidth="8*" align="left"/>
33074 <colspec colwidth="5*" align="center"/>
33075 <colspec colwidth="5*" align="center"/>
33076 <colspec colwidth="6*" align="right"/>
33077 <tbody>
33078 <row>
33079 <entry><option>forbid_include</option></entry>
33080 <entry>Use: <emphasis>redirect</emphasis></entry>
33081 <entry>Type: <emphasis>boolean</emphasis></entry>
33082 <entry>Default: <emphasis>false</emphasis></entry>
33083 </row>
33084 </tbody>
33085 </tgroup>
33086 </informaltable>
33087 <para>
33088 If this option is true, items of the form
33089 </para>
33090 <literallayout class="monospaced">
33091 :include:&lt;path name&gt;
33092 </literallayout>
33093 <para>
33094 are not permitted in non-filter redirection lists.
33095 </para>
33096 <para>
33097 <indexterm role="option">
33098 <primary>forbid_pipe</primary>
33099 </indexterm>
33100 </para>
33101 <informaltable frame="all">
33102 <tgroup cols="4" colsep="0" rowsep="0">
33103 <colspec colwidth="8*" align="left"/>
33104 <colspec colwidth="5*" align="center"/>
33105 <colspec colwidth="5*" align="center"/>
33106 <colspec colwidth="6*" align="right"/>
33107 <tbody>
33108 <row>
33109 <entry><option>forbid_pipe</option></entry>
33110 <entry>Use: <emphasis>redirect</emphasis></entry>
33111 <entry>Type: <emphasis>boolean</emphasis></entry>
33112 <entry>Default: <emphasis>false</emphasis></entry>
33113 </row>
33114 </tbody>
33115 </tgroup>
33116 </informaltable>
33117 <para>
33118 <indexterm role="concept">
33119 <primary>delivery</primary>
33120 <secondary>to pipe; forbidding</secondary>
33121 </indexterm>
33122 If this option is true, this router may not generate a new address which
33123 specifies delivery to a pipe, either from an Exim filter or from a conventional
33124 forward file. This option is forced to be true if <option>one_time</option> is set.
33125 </para>
33126 <para>
33127 <indexterm role="option">
33128 <primary>forbid_sieve_filter</primary>
33129 </indexterm>
33130 </para>
33131 <informaltable frame="all">
33132 <tgroup cols="4" colsep="0" rowsep="0">
33133 <colspec colwidth="8*" align="left"/>
33134 <colspec colwidth="5*" align="center"/>
33135 <colspec colwidth="5*" align="center"/>
33136 <colspec colwidth="6*" align="right"/>
33137 <tbody>
33138 <row>
33139 <entry><option>forbid_sieve_filter</option></entry>
33140 <entry>Use: <emphasis>redirect</emphasis></entry>
33141 <entry>Type: <emphasis>boolean</emphasis></entry>
33142 <entry>Default: <emphasis>false</emphasis></entry>
33143 </row>
33144 </tbody>
33145 </tgroup>
33146 </informaltable>
33147 <para>
33148 If this option is set true, only Exim filters are permitted when
33149 <option>allow_filter</option> is true.
33150 </para>
33151 <para revisionflag="changed">
33152 <indexterm role="concept">
33153 <primary>SMTP</primary>
33154 <secondary>error codes</secondary>
33155 </indexterm>
33156 <indexterm role="option">
33157 <primary>forbid_smtp_code</primary>
33158 </indexterm>
33159 </para>
33160 <informaltable frame="all" revisionflag="changed">
33161 <tgroup cols="4" colsep="0" rowsep="0">
33162 <colspec colwidth="8*" align="left"/>
33163 <colspec colwidth="5*" align="center"/>
33164 <colspec colwidth="5*" align="center"/>
33165 <colspec colwidth="6*" align="right"/>
33166 <tbody>
33167 <row>
33168 <entry><option>forbid_smtp_code</option></entry>
33169 <entry>Use: <emphasis>redirect</emphasis></entry>
33170 <entry>Type: <emphasis>boolean</emphasis></entry>
33171 <entry>Default: <emphasis>false</emphasis></entry>
33172 </row>
33173 </tbody>
33174 </tgroup>
33175 </informaltable>
33176 <para revisionflag="changed">
33177 If this option is set true, any SMTP error codes that are present at the start
33178 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
33179 the default codes (451 and 550, respectively) are always used.
33180 </para>
33181 <para>
33182 <indexterm role="option">
33183 <primary>hide_child_in_errmsg</primary>
33184 </indexterm>
33185 </para>
33186 <informaltable frame="all">
33187 <tgroup cols="4" colsep="0" rowsep="0">
33188 <colspec colwidth="8*" align="left"/>
33189 <colspec colwidth="5*" align="center"/>
33190 <colspec colwidth="5*" align="center"/>
33191 <colspec colwidth="6*" align="right"/>
33192 <tbody>
33193 <row>
33194 <entry><option>hide_child_in_errmsg</option></entry>
33195 <entry>Use: <emphasis>redirect</emphasis></entry>
33196 <entry>Type: <emphasis>boolean</emphasis></entry>
33197 <entry>Default: <emphasis>false</emphasis></entry>
33198 </row>
33199 </tbody>
33200 </tgroup>
33201 </informaltable>
33202 <para>
33203 <indexterm role="concept">
33204 <primary>bounce message</primary>
33205 <secondary>redirection details; suppressing</secondary>
33206 </indexterm>
33207 If this option is true, it prevents Exim from quoting a child address if it
33208 generates a bounce or delay message for it. Instead it says <quote>an address
33209 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
33210 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
33211 bounce may well quote the generated address.
33212 </para>
33213 <para>
33214 <indexterm role="option">
33215 <primary>ignore_eacces</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>ignore_eacces</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 <indexterm role="concept">
33236 <primary>EACCES</primary>
33237 </indexterm>
33238 If this option is set and an attempt to open a redirection file yields the
33239 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
33240 file did not exist.
33241 </para>
33242 <para>
33243 <indexterm role="option">
33244 <primary>ignore_enotdir</primary>
33245 </indexterm>
33246 </para>
33247 <informaltable frame="all">
33248 <tgroup cols="4" colsep="0" rowsep="0">
33249 <colspec colwidth="8*" align="left"/>
33250 <colspec colwidth="5*" align="center"/>
33251 <colspec colwidth="5*" align="center"/>
33252 <colspec colwidth="6*" align="right"/>
33253 <tbody>
33254 <row>
33255 <entry><option>ignore_enotdir</option></entry>
33256 <entry>Use: <emphasis>redirect</emphasis></entry>
33257 <entry>Type: <emphasis>boolean</emphasis></entry>
33258 <entry>Default: <emphasis>false</emphasis></entry>
33259 </row>
33260 </tbody>
33261 </tgroup>
33262 </informaltable>
33263 <para>
33264 <indexterm role="concept">
33265 <primary>ENOTDIR</primary>
33266 </indexterm>
33267 If this option is set and an attempt to open a redirection file yields the
33268 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
33269 router behaves as if the file did not exist.
33270 </para>
33271 <para>
33272 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
33273 router that has the <option>file</option> option set discovers that the file does not exist
33274 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
33275 against unmounted NFS directories. If the parent can not be statted, delivery
33276 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
33277 is set, because that option tells Exim to ignore <quote>something on the path is not
33278 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
33279 that some operating systems give ENOENT where others give ENOTDIR.
33280 </para>
33281 <para>
33282 <indexterm role="option">
33283 <primary>include_directory</primary>
33284 </indexterm>
33285 </para>
33286 <informaltable frame="all">
33287 <tgroup cols="4" colsep="0" rowsep="0">
33288 <colspec colwidth="8*" align="left"/>
33289 <colspec colwidth="5*" align="center"/>
33290 <colspec colwidth="5*" align="center"/>
33291 <colspec colwidth="6*" align="right"/>
33292 <tbody>
33293 <row>
33294 <entry><option>include_directory</option></entry>
33295 <entry>Use: <emphasis>redirect</emphasis></entry>
33296 <entry>Type: <emphasis>string</emphasis></entry>
33297 <entry>Default: <emphasis>unset</emphasis></entry>
33298 </row>
33299 </tbody>
33300 </tgroup>
33301 </informaltable>
33302 <para>
33303 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
33304 redirection list must start with this directory.
33305 </para>
33306 <para>
33307 <indexterm role="option">
33308 <primary>modemask</primary>
33309 </indexterm>
33310 </para>
33311 <informaltable frame="all">
33312 <tgroup cols="4" colsep="0" rowsep="0">
33313 <colspec colwidth="8*" align="left"/>
33314 <colspec colwidth="5*" align="center"/>
33315 <colspec colwidth="5*" align="center"/>
33316 <colspec colwidth="6*" align="right"/>
33317 <tbody>
33318 <row>
33319 <entry><option>modemask</option></entry>
33320 <entry>Use: <emphasis>redirect</emphasis></entry>
33321 <entry>Type: <emphasis>octal integer</emphasis></entry>
33322 <entry>Default: <emphasis>022</emphasis></entry>
33323 </row>
33324 </tbody>
33325 </tgroup>
33326 </informaltable>
33327 <para>
33328 This specifies mode bits which must not be set for a file specified by the
33329 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
33330 </para>
33331 <para>
33332 <indexterm role="option">
33333 <primary>one_time</primary>
33334 </indexterm>
33335 </para>
33336 <informaltable frame="all">
33337 <tgroup cols="4" colsep="0" rowsep="0">
33338 <colspec colwidth="8*" align="left"/>
33339 <colspec colwidth="5*" align="center"/>
33340 <colspec colwidth="5*" align="center"/>
33341 <colspec colwidth="6*" align="right"/>
33342 <tbody>
33343 <row>
33344 <entry><option>one_time</option></entry>
33345 <entry>Use: <emphasis>redirect</emphasis></entry>
33346 <entry>Type: <emphasis>boolean</emphasis></entry>
33347 <entry>Default: <emphasis>false</emphasis></entry>
33348 </row>
33349 </tbody>
33350 </tgroup>
33351 </informaltable>
33352 <para>
33353 <indexterm role="concept">
33354 <primary>one-time aliasing/forwarding expansion</primary>
33355 </indexterm>
33356 <indexterm role="concept">
33357 <primary>alias file</primary>
33358 <secondary>one-time expansion</secondary>
33359 </indexterm>
33360 <indexterm role="concept">
33361 <primary>forward file</primary>
33362 <secondary>one-time expansion</secondary>
33363 </indexterm>
33364 <indexterm role="concept">
33365 <primary>mailing lists</primary>
33366 <secondary>one-time expansion</secondary>
33367 </indexterm>
33368 <indexterm role="concept">
33369 <primary>address redirection</primary>
33370 <secondary>one-time expansion</secondary>
33371 </indexterm>
33372 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
33373 files each time it tries to deliver a message causes a problem when one or more
33374 of the generated addresses fails be delivered at the first attempt. The problem
33375 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
33376 but of what happens when the redirection list changes during the time that the
33377 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
33378 lists, where new subscribers might receive copies of messages that were posted
33379 before they subscribed.
33380 </para>
33381 <para>
33382 If <option>one_time</option> is set and any addresses generated by the router fail to
33383 deliver at the first attempt, the failing addresses are added to the message as
33384 <quote>top level</quote> addresses, and the parent address that generated them is marked
33385 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
33386 attempt.
33387 </para>
33388 <para>
33389 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
33390 router would be lost if delivery did not succeed at the first attempt. For this
33391 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
33392 permitted when <option>one_time</option> is set.
33393 </para>
33394 <para>
33395 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
33396 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
33397 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
33398 </para>
33399 <para>
33400 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
33401 <option>one_time</option>.
33402 </para>
33403 <para>
33404 The original top-level address is remembered with each of the generated
33405 addresses, and is output in any log messages. However, any intermediate parent
33406 addresses are not recorded. This makes a difference to the log only if
33407 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
33408 typically be used for mailing lists, where there is normally just one level of
33409 expansion.
33410 </para>
33411 <para>
33412 <indexterm role="option">
33413 <primary>owners</primary>
33414 </indexterm>
33415 </para>
33416 <informaltable frame="all">
33417 <tgroup cols="4" colsep="0" rowsep="0">
33418 <colspec colwidth="8*" align="left"/>
33419 <colspec colwidth="5*" align="center"/>
33420 <colspec colwidth="5*" align="center"/>
33421 <colspec colwidth="6*" align="right"/>
33422 <tbody>
33423 <row>
33424 <entry><option>owners</option></entry>
33425 <entry>Use: <emphasis>redirect</emphasis></entry>
33426 <entry>Type: <emphasis>string list</emphasis></entry>
33427 <entry>Default: <emphasis>unset</emphasis></entry>
33428 </row>
33429 </tbody>
33430 </tgroup>
33431 </informaltable>
33432 <para>
33433 <indexterm role="concept">
33434 <primary>ownership</primary>
33435 <secondary>alias file</secondary>
33436 </indexterm>
33437 <indexterm role="concept">
33438 <primary>ownership</primary>
33439 <secondary>forward file</secondary>
33440 </indexterm>
33441 <indexterm role="concept">
33442 <primary>alias file</primary>
33443 <secondary>ownership</secondary>
33444 </indexterm>
33445 <indexterm role="concept">
33446 <primary>forward file</primary>
33447 <secondary>ownership</secondary>
33448 </indexterm>
33449 This specifies a list of permitted owners for the file specified by <option>file</option>.
33450 This list is in addition to the local user when <option>check_local_user</option> is set.
33451 See <option>check_owner</option> above.
33452 </para>
33453 <para>
33454 <indexterm role="option">
33455 <primary>owngroups</primary>
33456 </indexterm>
33457 </para>
33458 <informaltable frame="all">
33459 <tgroup cols="4" colsep="0" rowsep="0">
33460 <colspec colwidth="8*" align="left"/>
33461 <colspec colwidth="5*" align="center"/>
33462 <colspec colwidth="5*" align="center"/>
33463 <colspec colwidth="6*" align="right"/>
33464 <tbody>
33465 <row>
33466 <entry><option>owngroups</option></entry>
33467 <entry>Use: <emphasis>redirect</emphasis></entry>
33468 <entry>Type: <emphasis>string list</emphasis></entry>
33469 <entry>Default: <emphasis>unset</emphasis></entry>
33470 </row>
33471 </tbody>
33472 </tgroup>
33473 </informaltable>
33474 <para>
33475 This specifies a list of permitted groups for the file specified by <option>file</option>.
33476 The list is in addition to the local user&#x2019;s primary group when
33477 <option>check_local_user</option> is set. See <option>check_group</option> above.
33478 </para>
33479 <para>
33480 <indexterm role="option">
33481 <primary>pipe_transport</primary>
33482 </indexterm>
33483 </para>
33484 <informaltable frame="all">
33485 <tgroup cols="4" colsep="0" rowsep="0">
33486 <colspec colwidth="8*" align="left"/>
33487 <colspec colwidth="5*" align="center"/>
33488 <colspec colwidth="5*" align="center"/>
33489 <colspec colwidth="6*" align="right"/>
33490 <tbody>
33491 <row>
33492 <entry><option>pipe_transport</option></entry>
33493 <entry>Use: <emphasis>redirect</emphasis></entry>
33494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33495 <entry>Default: <emphasis>unset</emphasis></entry>
33496 </row>
33497 </tbody>
33498 </tgroup>
33499 </informaltable>
33500 <para>
33501 <indexterm role="concept">
33502 <primary><varname>$address_pipe</varname></primary>
33503 </indexterm>
33504 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
33505 starting with a vertical bar character is specified as a new <quote>address</quote>. The
33506 transport used is specified by this option, which, after expansion, must be the
33507 name of a configured transport. This should normally be a <command>pipe</command> transport.
33508 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
33509 </para>
33510 <para>
33511 <indexterm role="option">
33512 <primary>qualify_domain</primary>
33513 </indexterm>
33514 </para>
33515 <informaltable frame="all">
33516 <tgroup cols="4" colsep="0" rowsep="0">
33517 <colspec colwidth="8*" align="left"/>
33518 <colspec colwidth="5*" align="center"/>
33519 <colspec colwidth="5*" align="center"/>
33520 <colspec colwidth="6*" align="right"/>
33521 <tbody>
33522 <row>
33523 <entry><option>qualify_domain</option></entry>
33524 <entry>Use: <emphasis>redirect</emphasis></entry>
33525 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33526 <entry>Default: <emphasis>unset</emphasis></entry>
33527 </row>
33528 </tbody>
33529 </tgroup>
33530 </informaltable>
33531 <para>
33532 <indexterm role="concept">
33533 <primary><varname>$qualify_recipient</varname></primary>
33534 </indexterm>
33535 If this option is set, and an unqualified address (one without a domain) is
33536 generated, and that address would normally be qualified by the global setting
33537 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
33538 expanding this string. If the expansion fails, the router declines. If you want
33539 to revert to the default, you can have the expansion generate
33540 <varname>$qualify_recipient</varname>.
33541 </para>
33542 <para>
33543 This option applies to all unqualified addresses generated by Exim filters,
33544 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
33545 not preceded by a backslash. Sieve filters cannot generate unqualified
33546 addresses.
33547 </para>
33548 <para>
33549 <indexterm role="option">
33550 <primary>qualify_preserve_domain</primary>
33551 </indexterm>
33552 </para>
33553 <informaltable frame="all">
33554 <tgroup cols="4" colsep="0" rowsep="0">
33555 <colspec colwidth="8*" align="left"/>
33556 <colspec colwidth="5*" align="center"/>
33557 <colspec colwidth="5*" align="center"/>
33558 <colspec colwidth="6*" align="right"/>
33559 <tbody>
33560 <row>
33561 <entry><option>qualify_preserve_domain</option></entry>
33562 <entry>Use: <emphasis>redirect</emphasis></entry>
33563 <entry>Type: <emphasis>boolean</emphasis></entry>
33564 <entry>Default: <emphasis>false</emphasis></entry>
33565 </row>
33566 </tbody>
33567 </tgroup>
33568 </informaltable>
33569 <para>
33570 <indexterm role="concept">
33571 <primary>domain</primary>
33572 <secondary>in redirection; preserving</secondary>
33573 </indexterm>
33574 <indexterm role="concept">
33575 <primary>preserving domain in redirection</primary>
33576 </indexterm>
33577 <indexterm role="concept">
33578 <primary>address redirection</primary>
33579 <secondary>domain; preserving</secondary>
33580 </indexterm>
33581 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
33582 set (a configuration error occurs if it is). If an unqualified address (one
33583 without a domain) is generated, it is qualified with the domain of the parent
33584 address (the immediately preceding ancestor) instead of the global
33585 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
33586 this applies whether or not the address is preceded by a backslash.
33587 </para>
33588 <para>
33589 <indexterm role="option">
33590 <primary>repeat_use</primary>
33591 </indexterm>
33592 </para>
33593 <informaltable frame="all">
33594 <tgroup cols="4" colsep="0" rowsep="0">
33595 <colspec colwidth="8*" align="left"/>
33596 <colspec colwidth="5*" align="center"/>
33597 <colspec colwidth="5*" align="center"/>
33598 <colspec colwidth="6*" align="right"/>
33599 <tbody>
33600 <row>
33601 <entry><option>repeat_use</option></entry>
33602 <entry>Use: <emphasis>redirect</emphasis></entry>
33603 <entry>Type: <emphasis>boolean</emphasis></entry>
33604 <entry>Default: <emphasis>true</emphasis></entry>
33605 </row>
33606 </tbody>
33607 </tgroup>
33608 </informaltable>
33609 <para>
33610 If this option is set false, the router is skipped for a child address that has
33611 any ancestor that was routed by this router. This test happens before any of
33612 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
33613 only when the ancestor is the same as the current address. See also
33614 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
33615 </para>
33616 <para>
33617 <indexterm role="option">
33618 <primary>reply_transport</primary>
33619 </indexterm>
33620 </para>
33621 <informaltable frame="all">
33622 <tgroup cols="4" colsep="0" rowsep="0">
33623 <colspec colwidth="8*" align="left"/>
33624 <colspec colwidth="5*" align="center"/>
33625 <colspec colwidth="5*" align="center"/>
33626 <colspec colwidth="6*" align="right"/>
33627 <tbody>
33628 <row>
33629 <entry><option>reply_transport</option></entry>
33630 <entry>Use: <emphasis>redirect</emphasis></entry>
33631 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33632 <entry>Default: <emphasis>unset</emphasis></entry>
33633 </row>
33634 </tbody>
33635 </tgroup>
33636 </informaltable>
33637 <para>
33638 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
33639 <option>vacation</option> command is used in a filter file. The transport used is specified
33640 by this option, which, after expansion, must be the name of a configured
33641 transport. This should normally be an <command>autoreply</command> transport. Other transports
33642 are unlikely to do anything sensible or useful.
33643 </para>
33644 <para>
33645 <indexterm role="option">
33646 <primary>rewrite</primary>
33647 </indexterm>
33648 </para>
33649 <informaltable frame="all">
33650 <tgroup cols="4" colsep="0" rowsep="0">
33651 <colspec colwidth="8*" align="left"/>
33652 <colspec colwidth="5*" align="center"/>
33653 <colspec colwidth="5*" align="center"/>
33654 <colspec colwidth="6*" align="right"/>
33655 <tbody>
33656 <row>
33657 <entry><option>rewrite</option></entry>
33658 <entry>Use: <emphasis>redirect</emphasis></entry>
33659 <entry>Type: <emphasis>boolean</emphasis></entry>
33660 <entry>Default: <emphasis>true</emphasis></entry>
33661 </row>
33662 </tbody>
33663 </tgroup>
33664 </informaltable>
33665 <para>
33666 <indexterm role="concept">
33667 <primary>address redirection</primary>
33668 <secondary>disabling rewriting</secondary>
33669 </indexterm>
33670 If this option is set false, addresses generated by the router are not
33671 subject to address rewriting. Otherwise, they are treated like new addresses
33672 and are rewritten according to the global rewriting rules.
33673 </para>
33674 <para>
33675 <indexterm role="option">
33676 <primary>sieve_subaddress</primary>
33677 </indexterm>
33678 </para>
33679 <informaltable frame="all">
33680 <tgroup cols="4" colsep="0" rowsep="0">
33681 <colspec colwidth="8*" align="left"/>
33682 <colspec colwidth="5*" align="center"/>
33683 <colspec colwidth="5*" align="center"/>
33684 <colspec colwidth="6*" align="right"/>
33685 <tbody>
33686 <row>
33687 <entry><option>sieve_subaddress</option></entry>
33688 <entry>Use: <emphasis>redirect</emphasis></entry>
33689 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33690 <entry>Default: <emphasis>unset</emphasis></entry>
33691 </row>
33692 </tbody>
33693 </tgroup>
33694 </informaltable>
33695 <para>
33696 The value of this option is passed to a Sieve filter to specify the
33697 :subaddress part of an address.
33698 </para>
33699 <para>
33700 <indexterm role="option">
33701 <primary>sieve_useraddress</primary>
33702 </indexterm>
33703 </para>
33704 <informaltable frame="all">
33705 <tgroup cols="4" colsep="0" rowsep="0">
33706 <colspec colwidth="8*" align="left"/>
33707 <colspec colwidth="5*" align="center"/>
33708 <colspec colwidth="5*" align="center"/>
33709 <colspec colwidth="6*" align="right"/>
33710 <tbody>
33711 <row>
33712 <entry><option>sieve_useraddress</option></entry>
33713 <entry>Use: <emphasis>redirect</emphasis></entry>
33714 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33715 <entry>Default: <emphasis>unset</emphasis></entry>
33716 </row>
33717 </tbody>
33718 </tgroup>
33719 </informaltable>
33720 <para>
33721 The value of this option is passed to a Sieve filter to specify the :user part
33722 of an address. However, if it is unset, the entire original local part
33723 (including any prefix or suffix) is used for :user.
33724 </para>
33725 <para>
33726 <indexterm role="option">
33727 <primary>sieve_vacation_directory</primary>
33728 </indexterm>
33729 </para>
33730 <informaltable frame="all">
33731 <tgroup cols="4" colsep="0" rowsep="0">
33732 <colspec colwidth="8*" align="left"/>
33733 <colspec colwidth="5*" align="center"/>
33734 <colspec colwidth="5*" align="center"/>
33735 <colspec colwidth="6*" align="right"/>
33736 <tbody>
33737 <row>
33738 <entry><option>sieve_vacation_directory</option></entry>
33739 <entry>Use: <emphasis>redirect</emphasis></entry>
33740 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33741 <entry>Default: <emphasis>unset</emphasis></entry>
33742 </row>
33743 </tbody>
33744 </tgroup>
33745 </informaltable>
33746 <para>
33747 <indexterm role="concept">
33748 <primary>Sieve filter</primary>
33749 <secondary>vacation directory</secondary>
33750 </indexterm>
33751 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
33752 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
33753 (do not put anything else in that directory), and ensure that the
33754 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
33755 needs their own directory; Exim will create it if necessary.
33756 </para>
33757 <para>
33758 <indexterm role="option">
33759 <primary>skip_syntax_errors</primary>
33760 </indexterm>
33761 </para>
33762 <informaltable frame="all">
33763 <tgroup cols="4" colsep="0" rowsep="0">
33764 <colspec colwidth="8*" align="left"/>
33765 <colspec colwidth="5*" align="center"/>
33766 <colspec colwidth="5*" align="center"/>
33767 <colspec colwidth="6*" align="right"/>
33768 <tbody>
33769 <row>
33770 <entry><option>skip_syntax_errors</option></entry>
33771 <entry>Use: <emphasis>redirect</emphasis></entry>
33772 <entry>Type: <emphasis>boolean</emphasis></entry>
33773 <entry>Default: <emphasis>false</emphasis></entry>
33774 </row>
33775 </tbody>
33776 </tgroup>
33777 </informaltable>
33778 <para>
33779 <indexterm role="concept">
33780 <primary>forward file</primary>
33781 <secondary>broken</secondary>
33782 </indexterm>
33783 <indexterm role="concept">
33784 <primary>address redirection</primary>
33785 <secondary>broken files</secondary>
33786 </indexterm>
33787 <indexterm role="concept">
33788 <primary>alias file</primary>
33789 <secondary>broken</secondary>
33790 </indexterm>
33791 <indexterm role="concept">
33792 <primary>broken alias or forward files</primary>
33793 </indexterm>
33794 <indexterm role="concept">
33795 <primary>ignoring faulty addresses</primary>
33796 </indexterm>
33797 <indexterm role="concept">
33798 <primary>skipping faulty addresses</primary>
33799 </indexterm>
33800 <indexterm role="concept">
33801 <primary>error</primary>
33802 <secondary>skipping bad syntax</secondary>
33803 </indexterm>
33804 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
33805 non-filter redirection data are skipped, and each failing address is logged. If
33806 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
33807 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
33808 are expanded and placed at the head of the error message generated by
33809 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
33810 be the same address as the generic <option>errors_to</option> option. The
33811 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
33812 </para>
33813 <para>
33814 If all the addresses in a redirection list are skipped because of syntax
33815 errors, the router declines to handle the original address, and it is passed to
33816 the following routers.
33817 </para>
33818 <para>
33819 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
33820 error in the filter causes filtering to be abandoned without any action being
33821 taken. The incident is logged, and the router declines to handle the address,
33822 so it is passed to the following routers.
33823 </para>
33824 <para>
33825 <indexterm role="concept">
33826 <primary>Sieve filter</primary>
33827 <secondary>syntax errors in</secondary>
33828 </indexterm>
33829 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
33830 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
33831 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
33832 </para>
33833 <para>
33834 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
33835 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
33836 option, used with an address that does not get redirected, can be used to
33837 notify users of these errors, by means of a router like this:
33838 </para>
33839 <literallayout class="monospaced">
33840 userforward:
33841   driver = redirect
33842   allow_filter
33843   check_local_user
33844   file = $home/.forward
33845   file_transport = address_file
33846   pipe_transport = address_pipe
33847   reply_transport = address_reply
33848   no_verify
33849   skip_syntax_errors
33850   syntax_errors_to = real-$local_part@$domain
33851   syntax_errors_text = \
33852    This is an automatically generated message. An error has\n\
33853    been found in your .forward file. Details of the error are\n\
33854    reported below. While this error persists, you will receive\n\
33855    a copy of this message for every message that is addressed\n\
33856    to you. If your .forward file is a filter file, or if it is\n\
33857    a non-filter file containing no valid forwarding addresses,\n\
33858    a copy of each incoming message will be put in your normal\n\
33859    mailbox. If a non-filter file contains at least one valid\n\
33860    forwarding address, forwarding to the valid addresses will\n\
33861    happen, and those will be the only deliveries that occur.
33862 </literallayout>
33863 <para>
33864 You also need a router to ensure that local addresses that are prefixed by
33865 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
33866 put this immediately before the <command>userforward</command> router:
33867 </para>
33868 <literallayout class="monospaced">
33869 real_localuser:
33870   driver = accept
33871   check_local_user
33872   local_part_prefix = real-
33873   transport = local_delivery
33874 </literallayout>
33875 <para>
33876 <indexterm role="option">
33877 <primary>syntax_errors_text</primary>
33878 </indexterm>
33879 </para>
33880 <informaltable frame="all">
33881 <tgroup cols="4" colsep="0" rowsep="0">
33882 <colspec colwidth="8*" align="left"/>
33883 <colspec colwidth="5*" align="center"/>
33884 <colspec colwidth="5*" align="center"/>
33885 <colspec colwidth="6*" align="right"/>
33886 <tbody>
33887 <row>
33888 <entry><option>syntax_errors_text</option></entry>
33889 <entry>Use: <emphasis>redirect</emphasis></entry>
33890 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33891 <entry>Default: <emphasis>unset</emphasis></entry>
33892 </row>
33893 </tbody>
33894 </tgroup>
33895 </informaltable>
33896 <para>
33897 See <option>skip_syntax_errors</option> above.
33898 </para>
33899 <para>
33900 <indexterm role="option">
33901 <primary>syntax_errors_to</primary>
33902 </indexterm>
33903 </para>
33904 <informaltable frame="all">
33905 <tgroup cols="4" colsep="0" rowsep="0">
33906 <colspec colwidth="8*" align="left"/>
33907 <colspec colwidth="5*" align="center"/>
33908 <colspec colwidth="5*" align="center"/>
33909 <colspec colwidth="6*" align="right"/>
33910 <tbody>
33911 <row>
33912 <entry><option>syntax_errors_to</option></entry>
33913 <entry>Use: <emphasis>redirect</emphasis></entry>
33914 <entry>Type: <emphasis>string</emphasis></entry>
33915 <entry>Default: <emphasis>unset</emphasis></entry>
33916 </row>
33917 </tbody>
33918 </tgroup>
33919 </informaltable>
33920 <para>
33921 See <option>skip_syntax_errors</option> above.
33922 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
33923 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
33924 </para>
33925 </section>
33926 </chapter>
33927
33928 <chapter id="CHAPenvironment">
33929 <title>Environment for running local transports</title>
33930 <titleabbrev>Environment for local transports</titleabbrev>
33931 <para>
33932 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
33933 <primary>local transports</primary>
33934 <secondary>environment for</secondary>
33935 </indexterm>
33936 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
33937 <primary>environment for local transports</primary>
33938 </indexterm>
33939 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
33940 <primary>transport</primary>
33941 <secondary>local; environment for</secondary>
33942 </indexterm>
33943 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
33944 transport can be thought of as similar to a pipe.) Exim always runs transports
33945 in subprocesses, under specified uids and gids. Typical deliveries to local
33946 mailboxes run under the uid and gid of the local user.
33947 </para>
33948 <para>
33949 Exim also sets a specific current directory while running the transport; for
33950 some transports a home directory setting is also relevant. The <command>pipe</command>
33951 transport is the only one that sets up environment variables; see section
33952 <xref linkend="SECTpipeenv"/> for details.
33953 </para>
33954 <para>
33955 The values used for the uid, gid, and the directories may come from several
33956 different places. In many cases, the router that handles the address associates
33957 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
33958 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
33959 configuration, and these override anything that comes from the router.
33960 </para>
33961 <section>
33962 <title>Concurrent deliveries</title>
33963 <para>
33964 <indexterm role="concept">
33965 <primary>concurrent deliveries</primary>
33966 </indexterm>
33967 <indexterm role="concept">
33968 <primary>simultaneous deliveries</primary>
33969 </indexterm>
33970 If two different messages for the same local recpient arrive more or less
33971 simultaneously, the two delivery processes are likely to run concurrently. When
33972 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
33973 rules to stop concurrent processes from writing to the same file at the same
33974 time.
33975 </para>
33976 <para>
33977 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
33978 locking that is needed. Here is a silly example:
33979 </para>
33980 <literallayout class="monospaced">
33981 my_transport:
33982   driver = pipe
33983   command = /bin/sh -c 'cat &gt;&gt;/some/file'
33984 </literallayout>
33985 <para>
33986 This is supposed to write the message at the end of the file. However, if two
33987 messages arrive at the same time, the file will be scrambled. You can use the
33988 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
33989 file using the same algorithm that Exim itself uses.
33990 </para>
33991 </section>
33992 <section id="SECTenvuidgid">
33993 <title>Uids and gids</title>
33994 <para>
33995 <indexterm role="concept">
33996 <primary>local transports</primary>
33997 <secondary>uid and gid</secondary>
33998 </indexterm>
33999 <indexterm role="concept">
34000 <primary>transport</primary>
34001 <secondary>local; uid and gid</secondary>
34002 </indexterm>
34003 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
34004 overrides any group that the router set in the address, even if <option>user</option> is not
34005 set for the transport. This makes it possible, for example, to run local mail
34006 delivery under the uid of the recipient (set by the router), but in a special
34007 group (set by the transport). For example:
34008 </para>
34009 <literallayout class="monospaced">
34010 # Routers ...
34011 # User/group are set by check_local_user in this router
34012 local_users:
34013   driver = accept
34014   check_local_user
34015   transport = group_delivery
34016
34017 # Transports ...
34018 # This transport overrides the group
34019 group_delivery:
34020   driver = appendfile
34021   file = /var/spool/mail/$local_part
34022   group = mail
34023 </literallayout>
34024 <para>
34025 If <option>user</option> is set for a transport, its value overrides what is set in the
34026 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
34027 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
34028 set.
34029 </para>
34030 <para>
34031 <indexterm role="concept">
34032 <primary><option>initgroups</option> option</primary>
34033 </indexterm>
34034 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
34035 function is called for the groups associated with that uid if the
34036 <option>initgroups</option> option is set for the transport. When the uid is not specified
34037 by the transport, but is associated with the address by a router, the option
34038 for calling <function>initgroups()</function> is taken from the router configuration.
34039 </para>
34040 <para>
34041 <indexterm role="concept">
34042 <primary><command>pipe</command> transport</primary>
34043 <secondary>uid for</secondary>
34044 </indexterm>
34045 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
34046 is set and <option>user</option> is not set, the uid of the process that called Exim to
34047 receive the message is used, and if <option>group</option> is not set, the corresponding
34048 original gid is also used.
34049 </para>
34050 <para>
34051 This is the detailed preference order for obtaining a gid; the first of the
34052 following that is set is used:
34053 </para>
34054 <itemizedlist>
34055 <listitem>
34056 <para>
34057 A <option>group</option> setting of the transport;
34058 </para>
34059 </listitem>
34060 <listitem>
34061 <para>
34062 A <option>group</option> setting of the router;
34063 </para>
34064 </listitem>
34065 <listitem>
34066 <para>
34067 A gid associated with a user setting of the router, either as a result of
34068 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
34069 </para>
34070 </listitem>
34071 <listitem>
34072 <para>
34073 The group associated with a non-numeric <option>user</option> setting of the transport;
34074 </para>
34075 </listitem>
34076 <listitem>
34077 <para>
34078 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
34079 the uid is the creator&#x2019;s uid;
34080 </para>
34081 </listitem>
34082 <listitem>
34083 <para>
34084 The Exim gid if the Exim uid is being used as a default.
34085 </para>
34086 </listitem>
34087 </itemizedlist>
34088 <para>
34089 If, for example, the user is specified numerically on the router and there are
34090 no group settings, no gid is available. In this situation, an error occurs.
34091 This is different for the uid, for which there always is an ultimate default.
34092 The first of the following that is set is used:
34093 </para>
34094 <itemizedlist>
34095 <listitem>
34096 <para>
34097 A <option>user</option> setting of the transport;
34098 </para>
34099 </listitem>
34100 <listitem>
34101 <para>
34102 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
34103 </para>
34104 </listitem>
34105 <listitem>
34106 <para>
34107 A <option>user</option> setting of the router;
34108 </para>
34109 </listitem>
34110 <listitem>
34111 <para>
34112 A <option>check_local_user</option> setting of the router;
34113 </para>
34114 </listitem>
34115 <listitem>
34116 <para>
34117 The Exim uid.
34118 </para>
34119 </listitem>
34120 </itemizedlist>
34121 <para>
34122 Of course, an error will still occur if the uid that is chosen is on the
34123 <option>never_users</option> list.
34124 </para>
34125 </section>
34126 <section>
34127 <title>Current and home directories</title>
34128 <para>
34129 <indexterm role="concept">
34130 <primary>current directory for local transport</primary>
34131 </indexterm>
34132 <indexterm role="concept">
34133 <primary>home directory</primary>
34134 <secondary>for local transport</secondary>
34135 </indexterm>
34136 <indexterm role="concept">
34137 <primary>transport</primary>
34138 <secondary>local; home directory for</secondary>
34139 </indexterm>
34140 <indexterm role="concept">
34141 <primary>transport</primary>
34142 <secondary>local; current directory for</secondary>
34143 </indexterm>
34144 Routers may set current and home directories for local transports by means of
34145 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
34146 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
34147 are set, they override the router&#x2019;s values. In detail, the home directory
34148 for a local transport is taken from the first of these values that is set:
34149 </para>
34150 <itemizedlist>
34151 <listitem>
34152 <para>
34153 The <option>home_directory</option> option on the transport;
34154 </para>
34155 </listitem>
34156 <listitem>
34157 <para>
34158 The <option>transport_home_directory</option> option on the router;
34159 </para>
34160 </listitem>
34161 <listitem>
34162 <para>
34163 The password data if <option>check_local_user</option> is set on the router;
34164 </para>
34165 </listitem>
34166 <listitem>
34167 <para>
34168 The <option>router_home_directory</option> option on the router.
34169 </para>
34170 </listitem>
34171 </itemizedlist>
34172 <para>
34173 The current directory is taken from the first of these values that is set:
34174 </para>
34175 <itemizedlist>
34176 <listitem>
34177 <para>
34178 The <option>current_directory</option> option on the transport;
34179 </para>
34180 </listitem>
34181 <listitem>
34182 <para>
34183 The <option>transport_current_directory</option> option on the router.
34184 </para>
34185 </listitem>
34186 </itemizedlist>
34187 <para>
34188 If neither the router nor the transport sets a current directory, Exim uses the
34189 value of the home directory, if it is set. Otherwise it sets the current
34190 directory to <filename>/</filename> before running a local transport.
34191 </para>
34192 </section>
34193 <section>
34194 <title>Expansion variables derived from the address</title>
34195 <para>
34196 <indexterm role="concept">
34197 <primary><varname>$domain</varname></primary>
34198 </indexterm>
34199 <indexterm role="concept">
34200 <primary><varname>$local_part</varname></primary>
34201 </indexterm>
34202 <indexterm role="concept">
34203 <primary><varname>$original_domain</varname></primary>
34204 </indexterm>
34205 Normally a local delivery is handling a single address, and in that case the
34206 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
34207 deliveries. However, in some circumstances more than one address may be handled
34208 at once (for example, while writing batch SMTP for onward transmission by some
34209 other means). In this case, the variables associated with the local part are
34210 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
34211 and <varname>$original_domain</varname> is never set.
34212 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
34213 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
34214 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
34215 </para>
34216 </section>
34217 </chapter>
34218
34219 <chapter id="CHAPtransportgeneric">
34220 <title>Generic options for transports</title>
34221 <para>
34222 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
34223 <primary>generic options</primary>
34224 <secondary>transport</secondary>
34225 </indexterm>
34226 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
34227 <primary>options</primary>
34228 <secondary>generic; for transports</secondary>
34229 </indexterm>
34230 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
34231 <primary>transport</primary>
34232 <secondary>generic options for</secondary>
34233 </indexterm>
34234 The following generic options apply to all transports:
34235 </para>
34236 <para>
34237 <indexterm role="option">
34238 <primary>body_only</primary>
34239 </indexterm>
34240 </para>
34241 <informaltable frame="all">
34242 <tgroup cols="4" colsep="0" rowsep="0">
34243 <colspec colwidth="8*" align="left"/>
34244 <colspec colwidth="5*" align="center"/>
34245 <colspec colwidth="5*" align="center"/>
34246 <colspec colwidth="6*" align="right"/>
34247 <tbody>
34248 <row>
34249 <entry><option>body_only</option></entry>
34250 <entry>Use: <emphasis>transports</emphasis></entry>
34251 <entry>Type: <emphasis>boolean</emphasis></entry>
34252 <entry>Default: <emphasis>false</emphasis></entry>
34253 </row>
34254 </tbody>
34255 </tgroup>
34256 </informaltable>
34257 <para>
34258 <indexterm role="concept">
34259 <primary>transport</primary>
34260 <secondary>body only</secondary>
34261 </indexterm>
34262 <indexterm role="concept">
34263 <primary>message</primary>
34264 <secondary>transporting body only</secondary>
34265 </indexterm>
34266 <indexterm role="concept">
34267 <primary>body of message</primary>
34268 <secondary>transporting</secondary>
34269 </indexterm>
34270 If this option is set, the message&#x2019;s headers are not transported. It is
34271 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
34272 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
34273 <option>message_suffix</option> should be checked, because this option does not
34274 automatically suppress them.
34275 </para>
34276 <para>
34277 <indexterm role="option">
34278 <primary>current_directory</primary>
34279 </indexterm>
34280 </para>
34281 <informaltable frame="all">
34282 <tgroup cols="4" colsep="0" rowsep="0">
34283 <colspec colwidth="8*" align="left"/>
34284 <colspec colwidth="5*" align="center"/>
34285 <colspec colwidth="5*" align="center"/>
34286 <colspec colwidth="6*" align="right"/>
34287 <tbody>
34288 <row>
34289 <entry><option>current_directory</option></entry>
34290 <entry>Use: <emphasis>transports</emphasis></entry>
34291 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34292 <entry>Default: <emphasis>unset</emphasis></entry>
34293 </row>
34294 </tbody>
34295 </tgroup>
34296 </informaltable>
34297 <para>
34298 <indexterm role="concept">
34299 <primary>transport</primary>
34300 <secondary>current directory for</secondary>
34301 </indexterm>
34302 This specifies the current directory that is to be set while running the
34303 transport, overriding any value that may have been set by the router.
34304 If the expansion fails for any reason, including forced failure, an error is
34305 logged, and delivery is deferred.
34306 </para>
34307 <para>
34308 <indexterm role="option">
34309 <primary>disable_logging</primary>
34310 </indexterm>
34311 </para>
34312 <informaltable frame="all">
34313 <tgroup cols="4" colsep="0" rowsep="0">
34314 <colspec colwidth="8*" align="left"/>
34315 <colspec colwidth="5*" align="center"/>
34316 <colspec colwidth="5*" align="center"/>
34317 <colspec colwidth="6*" align="right"/>
34318 <tbody>
34319 <row>
34320 <entry><option>disable_logging</option></entry>
34321 <entry>Use: <emphasis>transports</emphasis></entry>
34322 <entry>Type: <emphasis>boolean</emphasis></entry>
34323 <entry>Default: <emphasis>false</emphasis></entry>
34324 </row>
34325 </tbody>
34326 </tgroup>
34327 </informaltable>
34328 <para>
34329 If this option is set true, nothing is logged for any
34330 deliveries by the transport or for any
34331 transport errors. You should not set this option unless you really, really know
34332 what you are doing.
34333 </para>
34334 <para>
34335 <indexterm role="option">
34336 <primary>debug_print</primary>
34337 </indexterm>
34338 </para>
34339 <informaltable frame="all">
34340 <tgroup cols="4" colsep="0" rowsep="0">
34341 <colspec colwidth="8*" align="left"/>
34342 <colspec colwidth="5*" align="center"/>
34343 <colspec colwidth="5*" align="center"/>
34344 <colspec colwidth="6*" align="right"/>
34345 <tbody>
34346 <row>
34347 <entry><option>debug_print</option></entry>
34348 <entry>Use: <emphasis>transports</emphasis></entry>
34349 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34350 <entry>Default: <emphasis>unset</emphasis></entry>
34351 </row>
34352 </tbody>
34353 </tgroup>
34354 </informaltable>
34355 <para>
34356 <indexterm role="concept">
34357 <primary>testing</primary>
34358 <secondary>variables in drivers</secondary>
34359 </indexterm>
34360 If this option is set and debugging is enabled (see the <option>-d</option> command line
34361 option), the string is expanded and included in the debugging output when the
34362 transport is run.
34363 If expansion of the string fails, the error message is written to the debugging
34364 output, and Exim carries on processing.
34365 This facility is provided to help with checking out the values of variables and
34366 so on when debugging driver configurations. For example, if a <option>headers_add</option>
34367 option is not working properly, <option>debug_print</option> could be used to output the
34368 variables it references. A newline is added to the text if it does not end with
34369 one.
34370 </para>
34371 <para>
34372 <indexterm role="option">
34373 <primary>delivery_date_add</primary>
34374 </indexterm>
34375 </para>
34376 <informaltable frame="all">
34377 <tgroup cols="4" colsep="0" rowsep="0">
34378 <colspec colwidth="8*" align="left"/>
34379 <colspec colwidth="5*" align="center"/>
34380 <colspec colwidth="5*" align="center"/>
34381 <colspec colwidth="6*" align="right"/>
34382 <tbody>
34383 <row>
34384 <entry><option>delivery_date_add</option></entry>
34385 <entry>Use: <emphasis>transports</emphasis></entry>
34386 <entry>Type: <emphasis>boolean</emphasis></entry>
34387 <entry>Default: <emphasis>false</emphasis></entry>
34388 </row>
34389 </tbody>
34390 </tgroup>
34391 </informaltable>
34392 <para>
34393 <indexterm role="concept">
34394 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
34395 </indexterm>
34396 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
34397 This gives the actual time the delivery was made. As this is not a standard
34398 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
34399 requests its removal from incoming messages, so that delivered messages can
34400 safely be resent to other recipients.
34401 </para>
34402 <para>
34403 <indexterm role="option">
34404 <primary>driver</primary>
34405 </indexterm>
34406 </para>
34407 <informaltable frame="all">
34408 <tgroup cols="4" colsep="0" rowsep="0">
34409 <colspec colwidth="8*" align="left"/>
34410 <colspec colwidth="5*" align="center"/>
34411 <colspec colwidth="5*" align="center"/>
34412 <colspec colwidth="6*" align="right"/>
34413 <tbody>
34414 <row>
34415 <entry><option>driver</option></entry>
34416 <entry>Use: <emphasis>transports</emphasis></entry>
34417 <entry>Type: <emphasis>string</emphasis></entry>
34418 <entry>Default: <emphasis>unset</emphasis></entry>
34419 </row>
34420 </tbody>
34421 </tgroup>
34422 </informaltable>
34423 <para>
34424 This specifies which of the available transport drivers is to be used.
34425 There is no default, and this option must be set for every transport.
34426 </para>
34427 <para>
34428 <indexterm role="option">
34429 <primary>envelope_to_add</primary>
34430 </indexterm>
34431 </para>
34432 <informaltable frame="all">
34433 <tgroup cols="4" colsep="0" rowsep="0">
34434 <colspec colwidth="8*" align="left"/>
34435 <colspec colwidth="5*" align="center"/>
34436 <colspec colwidth="5*" align="center"/>
34437 <colspec colwidth="6*" align="right"/>
34438 <tbody>
34439 <row>
34440 <entry><option>envelope_to_add</option></entry>
34441 <entry>Use: <emphasis>transports</emphasis></entry>
34442 <entry>Type: <emphasis>boolean</emphasis></entry>
34443 <entry>Default: <emphasis>false</emphasis></entry>
34444 </row>
34445 </tbody>
34446 </tgroup>
34447 </informaltable>
34448 <para>
34449 <indexterm role="concept">
34450 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
34451 </indexterm>
34452 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
34453 This gives the original address(es) in the incoming envelope that caused this
34454 delivery to happen. More than one address may be present if the transport is
34455 configured to handle several addresses at once, or if more than one original
34456 address was redirected to the same final address. As this is not a standard
34457 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
34458 its removal from incoming messages, so that delivered messages can safely be
34459 resent to other recipients.
34460 </para>
34461 <para>
34462 <indexterm role="option">
34463 <primary>group</primary>
34464 </indexterm>
34465 </para>
34466 <informaltable frame="all">
34467 <tgroup cols="4" colsep="0" rowsep="0">
34468 <colspec colwidth="8*" align="left"/>
34469 <colspec colwidth="5*" align="center"/>
34470 <colspec colwidth="5*" align="center"/>
34471 <colspec colwidth="6*" align="right"/>
34472 <tbody>
34473 <row>
34474 <entry><option>group</option></entry>
34475 <entry>Use: <emphasis>transports</emphasis></entry>
34476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34477 <entry>Default: <emphasis>Exim group</emphasis></entry>
34478 </row>
34479 </tbody>
34480 </tgroup>
34481 </informaltable>
34482 <para>
34483 <indexterm role="concept">
34484 <primary>transport</primary>
34485 <secondary>group; specifying</secondary>
34486 </indexterm>
34487 This option specifies a gid for running the transport process, overriding any
34488 value that the router supplies, and also overriding any value associated with
34489 <option>user</option> (see below).
34490 </para>
34491 <para>
34492 <indexterm role="option">
34493 <primary>headers_add</primary>
34494 </indexterm>
34495 </para>
34496 <informaltable frame="all">
34497 <tgroup cols="4" colsep="0" rowsep="0">
34498 <colspec colwidth="8*" align="left"/>
34499 <colspec colwidth="5*" align="center"/>
34500 <colspec colwidth="5*" align="center"/>
34501 <colspec colwidth="6*" align="right"/>
34502 <tbody>
34503 <row>
34504 <entry><option>headers_add</option></entry>
34505 <entry>Use: <emphasis>transports</emphasis></entry>
34506 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34507 <entry>Default: <emphasis>unset</emphasis></entry>
34508 </row>
34509 </tbody>
34510 </tgroup>
34511 </informaltable>
34512 <para>
34513 <indexterm role="concept">
34514 <primary>header lines</primary>
34515 <secondary>adding in transport</secondary>
34516 </indexterm>
34517 <indexterm role="concept">
34518 <primary>transport</primary>
34519 <secondary>header lines; adding</secondary>
34520 </indexterm>
34521 This option specifies a string of text that is expanded and added to the header
34522 portion of a message as it is transported, as described in section
34523 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
34524 routers. If the result of the expansion is an empty string, or if the expansion
34525 is forced to fail, no action is taken. Other expansion failures are treated as
34526 errors and cause the delivery to be deferred.
34527 </para>
34528 <para>
34529 <indexterm role="option">
34530 <primary>headers_only</primary>
34531 </indexterm>
34532 </para>
34533 <informaltable frame="all">
34534 <tgroup cols="4" colsep="0" rowsep="0">
34535 <colspec colwidth="8*" align="left"/>
34536 <colspec colwidth="5*" align="center"/>
34537 <colspec colwidth="5*" align="center"/>
34538 <colspec colwidth="6*" align="right"/>
34539 <tbody>
34540 <row>
34541 <entry><option>headers_only</option></entry>
34542 <entry>Use: <emphasis>transports</emphasis></entry>
34543 <entry>Type: <emphasis>boolean</emphasis></entry>
34544 <entry>Default: <emphasis>false</emphasis></entry>
34545 </row>
34546 </tbody>
34547 </tgroup>
34548 </informaltable>
34549 <para>
34550 <indexterm role="concept">
34551 <primary>transport</primary>
34552 <secondary>header lines only</secondary>
34553 </indexterm>
34554 <indexterm role="concept">
34555 <primary>message</primary>
34556 <secondary>transporting headers only</secondary>
34557 </indexterm>
34558 <indexterm role="concept">
34559 <primary>header lines</primary>
34560 <secondary>transporting</secondary>
34561 </indexterm>
34562 If this option is set, the message&#x2019;s body is not transported. It is mutually
34563 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
34564 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
34565 checked, since this option does not automatically suppress them.
34566 </para>
34567 <para>
34568 <indexterm role="option">
34569 <primary>headers_remove</primary>
34570 </indexterm>
34571 </para>
34572 <informaltable frame="all">
34573 <tgroup cols="4" colsep="0" rowsep="0">
34574 <colspec colwidth="8*" align="left"/>
34575 <colspec colwidth="5*" align="center"/>
34576 <colspec colwidth="5*" align="center"/>
34577 <colspec colwidth="6*" align="right"/>
34578 <tbody>
34579 <row>
34580 <entry><option>headers_remove</option></entry>
34581 <entry>Use: <emphasis>transports</emphasis></entry>
34582 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34583 <entry>Default: <emphasis>unset</emphasis></entry>
34584 </row>
34585 </tbody>
34586 </tgroup>
34587 </informaltable>
34588 <para>
34589 <indexterm role="concept">
34590 <primary>header lines</primary>
34591 <secondary>removing</secondary>
34592 </indexterm>
34593 <indexterm role="concept">
34594 <primary>transport</primary>
34595 <secondary>header lines; removing</secondary>
34596 </indexterm>
34597 This option specifies a string that is expanded into a list of header names;
34598 these headers are omitted from the message as it is transported, as described
34599 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
34600 routers. If the result of the expansion is an empty string, or if the expansion
34601 is forced to fail, no action is taken. Other expansion failures are treated as
34602 errors and cause the delivery to be deferred.
34603 </para>
34604 <para>
34605 <indexterm role="option">
34606 <primary>headers_rewrite</primary>
34607 </indexterm>
34608 </para>
34609 <informaltable frame="all">
34610 <tgroup cols="4" colsep="0" rowsep="0">
34611 <colspec colwidth="8*" align="left"/>
34612 <colspec colwidth="5*" align="center"/>
34613 <colspec colwidth="5*" align="center"/>
34614 <colspec colwidth="6*" align="right"/>
34615 <tbody>
34616 <row>
34617 <entry><option>headers_rewrite</option></entry>
34618 <entry>Use: <emphasis>transports</emphasis></entry>
34619 <entry>Type: <emphasis>string</emphasis></entry>
34620 <entry>Default: <emphasis>unset</emphasis></entry>
34621 </row>
34622 </tbody>
34623 </tgroup>
34624 </informaltable>
34625 <para>
34626 <indexterm role="concept">
34627 <primary>transport</primary>
34628 <secondary>header lines; rewriting</secondary>
34629 </indexterm>
34630 <indexterm role="concept">
34631 <primary>rewriting</primary>
34632 <secondary>at transport time</secondary>
34633 </indexterm>
34634 This option allows addresses in header lines to be rewritten at transport time,
34635 that is, as the message is being copied to its destination. The contents of the
34636 option are a colon-separated list of rewriting rules. Each rule is in exactly
34637 the same form as one of the general rewriting rules that are applied when a
34638 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
34639 example,
34640 </para>
34641 <literallayout class="monospaced">
34642 headers_rewrite = a@b c@d f : \
34643                   x@y w@z
34644 </literallayout>
34645 <para>
34646 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
34647 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
34648 header lines just before they are written out at transport time, so they affect
34649 only those copies of the message that pass through the transport. However, only
34650 the message&#x2019;s original header lines, and any that were added by a system
34651 filter, are rewritten. If a router or transport adds header lines, they are not
34652 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
34653 envelope. You can change the return path using <option>return_path</option>, but you cannot
34654 change envelope recipients at this time.
34655 </para>
34656 <para>
34657 <indexterm role="option">
34658 <primary>home_directory</primary>
34659 </indexterm>
34660 </para>
34661 <informaltable frame="all">
34662 <tgroup cols="4" colsep="0" rowsep="0">
34663 <colspec colwidth="8*" align="left"/>
34664 <colspec colwidth="5*" align="center"/>
34665 <colspec colwidth="5*" align="center"/>
34666 <colspec colwidth="6*" align="right"/>
34667 <tbody>
34668 <row>
34669 <entry><option>home_directory</option></entry>
34670 <entry>Use: <emphasis>transports</emphasis></entry>
34671 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34672 <entry>Default: <emphasis>unset</emphasis></entry>
34673 </row>
34674 </tbody>
34675 </tgroup>
34676 </informaltable>
34677 <para>
34678 <indexterm role="concept">
34679 <primary>transport</primary>
34680 <secondary>home directory for</secondary>
34681 </indexterm>
34682 <indexterm role="concept">
34683 <primary><varname>$home</varname></primary>
34684 </indexterm>
34685 This option specifies a home directory setting for a local transport,
34686 overriding any value that may be set by the router. The home directory is
34687 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
34688 used as the current directory if no current directory is set by the
34689 <option>current_directory</option> option on the transport or the
34690 <option>transport_current_directory</option> option on the router. If the expansion fails
34691 for any reason, including forced failure, an error is logged, and delivery is
34692 deferred.
34693 </para>
34694 <para>
34695 <indexterm role="option">
34696 <primary>initgroups</primary>
34697 </indexterm>
34698 </para>
34699 <informaltable frame="all">
34700 <tgroup cols="4" colsep="0" rowsep="0">
34701 <colspec colwidth="8*" align="left"/>
34702 <colspec colwidth="5*" align="center"/>
34703 <colspec colwidth="5*" align="center"/>
34704 <colspec colwidth="6*" align="right"/>
34705 <tbody>
34706 <row>
34707 <entry><option>initgroups</option></entry>
34708 <entry>Use: <emphasis>transports</emphasis></entry>
34709 <entry>Type: <emphasis>boolean</emphasis></entry>
34710 <entry>Default: <emphasis>false</emphasis></entry>
34711 </row>
34712 </tbody>
34713 </tgroup>
34714 </informaltable>
34715 <para>
34716 <indexterm role="concept">
34717 <primary>additional groups</primary>
34718 </indexterm>
34719 <indexterm role="concept">
34720 <primary>groups</primary>
34721 <secondary>additional</secondary>
34722 </indexterm>
34723 <indexterm role="concept">
34724 <primary>transport</primary>
34725 <secondary>group; additional</secondary>
34726 </indexterm>
34727 If this option is true and the uid for the delivery process is provided by the
34728 transport, the <function>initgroups()</function> function is called when running the transport
34729 to ensure that any additional groups associated with the uid are set up.
34730 </para>
34731 <para>
34732 <indexterm role="option">
34733 <primary>message_size_limit</primary>
34734 </indexterm>
34735 </para>
34736 <informaltable frame="all">
34737 <tgroup cols="4" colsep="0" rowsep="0">
34738 <colspec colwidth="8*" align="left"/>
34739 <colspec colwidth="5*" align="center"/>
34740 <colspec colwidth="5*" align="center"/>
34741 <colspec colwidth="6*" align="right"/>
34742 <tbody>
34743 <row>
34744 <entry><option>message_size_limit</option></entry>
34745 <entry>Use: <emphasis>transports</emphasis></entry>
34746 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34747 <entry>Default: <emphasis>0</emphasis></entry>
34748 </row>
34749 </tbody>
34750 </tgroup>
34751 </informaltable>
34752 <para>
34753 <indexterm role="concept">
34754 <primary>limit</primary>
34755 <secondary>message size per transport</secondary>
34756 </indexterm>
34757 <indexterm role="concept">
34758 <primary>size of message</primary>
34759 <secondary>limit</secondary>
34760 </indexterm>
34761 <indexterm role="concept">
34762 <primary>transport</primary>
34763 <secondary>message size; limiting</secondary>
34764 </indexterm>
34765 This option controls the size of messages passed through the transport. It is
34766 expanded before use; the result of the expansion must be a sequence of digits,
34767 optionally followed by K or M.
34768 If the expansion fails for any reason, including forced failure, or if the
34769 result is not of the required form, delivery is deferred.
34770 If the value is greater than zero and the size of a message exceeds this
34771 limit, the address is failed. If there is any chance that the resulting bounce
34772 message could be routed to the same transport, you should ensure that
34773 <option>return_size_limit</option> is less than the transport&#x2019;s <option>message_size_limit</option>, as
34774 otherwise the bounce message will fail to get delivered.
34775 </para>
34776 <para>
34777 <indexterm role="option">
34778 <primary>rcpt_include_affixes</primary>
34779 </indexterm>
34780 </para>
34781 <informaltable frame="all">
34782 <tgroup cols="4" colsep="0" rowsep="0">
34783 <colspec colwidth="8*" align="left"/>
34784 <colspec colwidth="5*" align="center"/>
34785 <colspec colwidth="5*" align="center"/>
34786 <colspec colwidth="6*" align="right"/>
34787 <tbody>
34788 <row>
34789 <entry><option>rcpt_include_affixes</option></entry>
34790 <entry>Use: <emphasis>transports</emphasis></entry>
34791 <entry>Type: <emphasis>boolean</emphasis></entry>
34792 <entry>Default: <emphasis>false</emphasis></entry>
34793 </row>
34794 </tbody>
34795 </tgroup>
34796 </informaltable>
34797 <para>
34798 <indexterm role="concept">
34799 <primary>prefix</primary>
34800 <secondary>for local part; including in envelope</secondary>
34801 </indexterm>
34802 <indexterm role="concept">
34803 <primary>suffix</primary>
34804 <secondary>for local part; including in envelope</secondary>
34805 </indexterm>
34806 <indexterm role="concept">
34807 <primary>local part</primary>
34808 <secondary>prefix</secondary>
34809 </indexterm>
34810 <indexterm role="concept">
34811 <primary>local part</primary>
34812 <secondary>suffix</secondary>
34813 </indexterm>
34814 When this option is false (the default), and an address that has had any
34815 affixes (prefixes or suffixes) removed from the local part is delivered by any
34816 form of SMTP or LMTP, the affixes are not included. For example, if a router
34817 that contains
34818 </para>
34819 <literallayout class="monospaced">
34820 local_part_prefix = *-
34821 </literallayout>
34822 <para>
34823 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
34824 is delivered with
34825 </para>
34826 <literallayout class="monospaced">
34827 RCPT TO:&lt;xyz@some.domain&gt;
34828 </literallayout>
34829 <para>
34830 This is also the case when an ACL-time callout is being used to verify a
34831 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
34832 whole local part is included in the RCPT command. This option applies to BSMTP
34833 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
34834 <command>lmtp</command> and <command>smtp</command> transports.
34835 </para>
34836 <para>
34837 <indexterm role="option">
34838 <primary>retry_use_local_part</primary>
34839 </indexterm>
34840 </para>
34841 <informaltable frame="all">
34842 <tgroup cols="4" colsep="0" rowsep="0">
34843 <colspec colwidth="8*" align="left"/>
34844 <colspec colwidth="5*" align="center"/>
34845 <colspec colwidth="5*" align="center"/>
34846 <colspec colwidth="6*" align="right"/>
34847 <tbody>
34848 <row>
34849 <entry><option>retry_use_local_part</option></entry>
34850 <entry>Use: <emphasis>transports</emphasis></entry>
34851 <entry>Type: <emphasis>boolean</emphasis></entry>
34852 <entry>Default: <emphasis>see below</emphasis></entry>
34853 </row>
34854 </tbody>
34855 </tgroup>
34856 </informaltable>
34857 <para>
34858 <indexterm role="concept">
34859 <primary>hints database</primary>
34860 <secondary>retry keys</secondary>
34861 </indexterm>
34862 When a delivery suffers a temporary failure, a retry record is created
34863 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
34864 is based on the name and/or IP address of the failing remote host. For local
34865 deliveries, the key is normally the entire address, including both the local
34866 part and the domain. This is suitable for most common cases of local delivery
34867 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
34868 deliveries to that mailbox, not to the whole domain.
34869 </para>
34870 <para>
34871 However, in some special cases you may want to treat a temporary local delivery
34872 as a failure associated with the domain, and not with a particular local part.
34873 (For example, if you are storing all mail for some domain in files.) You can do
34874 this by setting <option>retry_use_local_part</option> false.
34875 </para>
34876 <para>
34877 For all the local transports, its default value is true. For remote transports,
34878 the default value is false for tidiness, but changing the value has no effect
34879 on a remote transport in the current implementation.
34880 </para>
34881 <para>
34882 <indexterm role="option">
34883 <primary>return_path</primary>
34884 </indexterm>
34885 </para>
34886 <informaltable frame="all">
34887 <tgroup cols="4" colsep="0" rowsep="0">
34888 <colspec colwidth="8*" align="left"/>
34889 <colspec colwidth="5*" align="center"/>
34890 <colspec colwidth="5*" align="center"/>
34891 <colspec colwidth="6*" align="right"/>
34892 <tbody>
34893 <row>
34894 <entry><option>return_path</option></entry>
34895 <entry>Use: <emphasis>transports</emphasis></entry>
34896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34897 <entry>Default: <emphasis>unset</emphasis></entry>
34898 </row>
34899 </tbody>
34900 </tgroup>
34901 </informaltable>
34902 <para>
34903 <indexterm role="concept">
34904 <primary>envelope sender</primary>
34905 </indexterm>
34906 <indexterm role="concept">
34907 <primary>transport</primary>
34908 <secondary>return path; changing</secondary>
34909 </indexterm>
34910 <indexterm role="concept">
34911 <primary>return path</primary>
34912 <secondary>changing in transport</secondary>
34913 </indexterm>
34914 If this option is set, the string is expanded at transport time and replaces
34915 the existing return path (envelope sender) value in the copy of the message
34916 that is being delivered. An empty return path is permitted. This feature is
34917 designed for remote deliveries, where the value of this option is used in the
34918 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
34919 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
34920 header line, if one is added to the message (see the next option).
34921 </para>
34922 <para revisionflag="changed">
34923 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
34924 <option>return_path_on_delivery</option> to the log selector.
34925 </para>
34926 <para>
34927 <indexterm role="concept">
34928 <primary><varname>$return_path</varname></primary>
34929 </indexterm>
34930 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
34931 either the message&#x2019;s envelope sender, or an address set by the
34932 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
34933 replacement occurs; if it fails for another reason, delivery is deferred. This
34934 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
34935 section <xref linkend="SECTverp"/>.
34936 </para>
34937 <para>
34938 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
34939 remote server rejects a message at SMTP time, the bounce message is not sent to
34940 the value of this option. It is sent to the previously set errors address.
34941 This defaults to the incoming sender address, but can be changed by setting
34942 <option>errors_to</option> in a router.
34943 </para>
34944 <para>
34945 <indexterm role="option">
34946 <primary>return_path_add</primary>
34947 </indexterm>
34948 </para>
34949 <informaltable frame="all">
34950 <tgroup cols="4" colsep="0" rowsep="0">
34951 <colspec colwidth="8*" align="left"/>
34952 <colspec colwidth="5*" align="center"/>
34953 <colspec colwidth="5*" align="center"/>
34954 <colspec colwidth="6*" align="right"/>
34955 <tbody>
34956 <row>
34957 <entry><option>return_path_add</option></entry>
34958 <entry>Use: <emphasis>transports</emphasis></entry>
34959 <entry>Type: <emphasis>boolean</emphasis></entry>
34960 <entry>Default: <emphasis>false</emphasis></entry>
34961 </row>
34962 </tbody>
34963 </tgroup>
34964 </informaltable>
34965 <para>
34966 <indexterm role="concept">
34967 <primary><emphasis>Return-path:</emphasis> header line</primary>
34968 </indexterm>
34969 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
34970 Although the return path is normally available in the prefix line of BSD
34971 mailboxes, this is commonly not displayed by MUAs, and so the user does not
34972 have easy access to it.
34973 </para>
34974 <para>
34975 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
34976 the delivery SMTP server makes the final delivery</quote>. This implies that this
34977 header should not be present in incoming messages. Exim has a configuration
34978 option, <option>return_path_remove</option>, which requests removal of this header from
34979 incoming messages, so that delivered messages can safely be resent to other
34980 recipients.
34981 </para>
34982 <para>
34983 <indexterm role="option">
34984 <primary>shadow_condition</primary>
34985 </indexterm>
34986 </para>
34987 <informaltable frame="all">
34988 <tgroup cols="4" colsep="0" rowsep="0">
34989 <colspec colwidth="8*" align="left"/>
34990 <colspec colwidth="5*" align="center"/>
34991 <colspec colwidth="5*" align="center"/>
34992 <colspec colwidth="6*" align="right"/>
34993 <tbody>
34994 <row>
34995 <entry><option>shadow_condition</option></entry>
34996 <entry>Use: <emphasis>transports</emphasis></entry>
34997 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34998 <entry>Default: <emphasis>unset</emphasis></entry>
34999 </row>
35000 </tbody>
35001 </tgroup>
35002 </informaltable>
35003 <para>
35004 See <option>shadow_transport</option> below.
35005 </para>
35006 <para>
35007 <indexterm role="option">
35008 <primary>shadow_transport</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>shadow_transport</option></entry>
35020 <entry>Use: <emphasis>transports</emphasis></entry>
35021 <entry>Type: <emphasis>string</emphasis></entry>
35022 <entry>Default: <emphasis>unset</emphasis></entry>
35023 </row>
35024 </tbody>
35025 </tgroup>
35026 </informaltable>
35027 <para>
35028 <indexterm role="concept">
35029 <primary>shadow transport</primary>
35030 </indexterm>
35031 <indexterm role="concept">
35032 <primary>transport</primary>
35033 <secondary>shadow</secondary>
35034 </indexterm>
35035 A local transport may set the <option>shadow_transport</option> option to the name of
35036 another local transport. Shadow remote transports are not supported.
35037 </para>
35038 <para>
35039 Whenever a delivery to the main transport succeeds, and either
35040 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
35041 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
35042 passed to the shadow transport, with the same delivery address or addresses. If
35043 expansion fails, no action is taken except that non-forced expansion failures
35044 cause a log line to be written.
35045 </para>
35046 <para>
35047 The result of the shadow transport is discarded and does not affect the
35048 subsequent processing of the message. Only a single level of shadowing is
35049 provided; the <option>shadow_transport</option> option is ignored on any transport when it
35050 is running as a shadow. Options concerned with output from pipes are also
35051 ignored. The log line for the successful delivery has an item added on the end,
35052 of the form
35053 </para>
35054 <literallayout class="monospaced">
35055 ST=&lt;shadow transport name&gt;
35056 </literallayout>
35057 <para>
35058 If the shadow transport did not succeed, the error message is put in
35059 parentheses afterwards. Shadow transports can be used for a number of different
35060 purposes, including keeping more detailed log information than Exim normally
35061 provides, and implementing automatic acknowledgement policies based on message
35062 headers that some sites insist on.
35063 </para>
35064 <para>
35065 <indexterm role="option">
35066 <primary>transport_filter</primary>
35067 </indexterm>
35068 </para>
35069 <informaltable frame="all">
35070 <tgroup cols="4" colsep="0" rowsep="0">
35071 <colspec colwidth="8*" align="left"/>
35072 <colspec colwidth="5*" align="center"/>
35073 <colspec colwidth="5*" align="center"/>
35074 <colspec colwidth="6*" align="right"/>
35075 <tbody>
35076 <row>
35077 <entry><option>transport_filter</option></entry>
35078 <entry>Use: <emphasis>transports</emphasis></entry>
35079 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35080 <entry>Default: <emphasis>unset</emphasis></entry>
35081 </row>
35082 </tbody>
35083 </tgroup>
35084 </informaltable>
35085 <para>
35086 <indexterm role="concept">
35087 <primary>transport</primary>
35088 <secondary>filter</secondary>
35089 </indexterm>
35090 <indexterm role="concept">
35091 <primary>filter</primary>
35092 <secondary>transport filter</secondary>
35093 </indexterm>
35094 This option sets up a filtering (in the Unix shell sense) process for messages
35095 at transport time. It should not be confused with mail filtering as set up by
35096 individual users or via a system filter.
35097 </para>
35098 <para>
35099 When the message is about to be written out, the command specified by
35100 <option>transport_filter</option> is started up in a separate, parallel process, and
35101 the entire message, including the header lines, is passed to it on its standard
35102 input (this in fact is done from a third process, to avoid deadlock). The
35103 command must be specified as an absolute path.
35104 </para>
35105 <para>
35106 The lines of the message that are written to the transport filter are
35107 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
35108 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
35109 lines beginning with a dot, and also before any processing implied by the
35110 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
35111 <command>pipe</command> transports.
35112 </para>
35113 <para>
35114 The standard error for the filter process is set to the same destination as its
35115 standard output; this is read and written to the message&#x2019;s ultimate
35116 destination. The process that writes the message to the filter, the
35117 filter itself, and the original process that reads the result and delivers it
35118 are all run in parallel, like a shell pipeline.
35119 </para>
35120 <para>
35121 The filter can perform any transformations it likes, but of course should take
35122 care not to break RFC 2822 syntax. A demonstration Perl script is provided in
35123 <filename>util/transport-filter.pl</filename>; this makes a few arbitrary modifications just to
35124 show the possibilities. Exim does not check the result, except to test for a
35125 final newline when SMTP is in use. All messages transmitted over SMTP must end
35126 with a newline, so Exim supplies one if it is missing.
35127 </para>
35128 <para>
35129 <indexterm role="concept">
35130 <primary>content scanning</primary>
35131 <secondary>per user</secondary>
35132 </indexterm>
35133 A transport filter can be used to provide content-scanning on a per-user basis
35134 at delivery time if the only required effect of the scan is to modify the
35135 message. For example, a content scan could insert a new header line containing
35136 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
35137 not possible to discard a message at this stage.
35138 </para>
35139 <para>
35140 <indexterm role="concept">
35141 <primary>SMTP</primary>
35142 <secondary>SIZE</secondary>
35143 </indexterm>
35144 A problem might arise if the filter increases the size of a message that is
35145 being sent down an SMTP connection. If the receiving SMTP server has indicated
35146 support for the SIZE parameter, Exim will have sent the size of the message
35147 at the start of the SMTP session. If what is actually sent is substantially
35148 more, the server might reject the message. This can be worked round by setting
35149 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
35150 additions to the message, or to disable the use of SIZE altogether.
35151 </para>
35152 <para>
35153 <indexterm role="concept">
35154 <primary><varname>$pipe_addresses</varname></primary>
35155 </indexterm>
35156 The value of the <option>transport_filter</option> option is the command string for starting
35157 the filter, which is run directly from Exim, not under a shell. The string is
35158 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
35159 Exim breaks it up into arguments and then expands each argument separately (see
35160 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
35161 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
35162 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
35163 an ideal name for this feature here, but as it was already implemented for the
35164 <command>pipe</command> transport, it seemed sensible not to change it.)
35165 </para>
35166 <para>
35167 <indexterm role="concept">
35168 <primary><varname>$host</varname></primary>
35169 </indexterm>
35170 <indexterm role="concept">
35171 <primary><varname>$host_address</varname></primary>
35172 </indexterm>
35173 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
35174 transport is a remote one. They contain the name and IP address of the host to
35175 which the message is being sent. For example:
35176 </para>
35177 <literallayout class="monospaced">
35178 transport_filter = /some/directory/transport-filter.pl \
35179   $host $host_address $sender_address $pipe_addresses
35180 </literallayout>
35181 <para>
35182 Two problems arise if you want to use more complicated expansion items to
35183 generate transport filter commands, both of which due to the fact that the
35184 command is split up <emphasis>before</emphasis> expansion.
35185 </para>
35186 <itemizedlist>
35187 <listitem>
35188 <para>
35189 If an expansion item contains white space, you must quote it, so that it is all
35190 part of the same command item. If the entire option setting is one such
35191 expansion item, you have to take care what kind of quoting you use. For
35192 example:
35193 </para>
35194 <literallayout class="monospaced">
35195 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
35196 </literallayout>
35197 <para>
35198 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
35199 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
35200 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
35201 the single quotes were missing, the line would be split into two items,
35202 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
35203 Exim tried to expand the first one.
35204 </para>
35205 </listitem>
35206 <listitem>
35207 <para>
35208 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
35209 expansion cannot generate multiple arguments, or a command name followed by
35210 arguments. Consider this example:
35211 </para>
35212 <literallayout class="monospaced">
35213 transport_filter = ${lookup{$host}lsearch{/some/file}\
35214                     {$value}{/bin/cat}}
35215 </literallayout>
35216 <para>
35217 The result of the lookup is interpreted as the name of the command, even
35218 if it contains white space. The simplest way round this is to use a shell:
35219 </para>
35220 <literallayout class="monospaced">
35221 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/some/file}\
35222                                {$value}{/bin/cat}}
35223 </literallayout>
35224 </listitem>
35225 </itemizedlist>
35226 <para>
35227 The filter process is run under the same uid and gid as the normal delivery.
35228 For remote deliveries this is the Exim uid/gid by default. The command should
35229 normally yield a zero return code. Transport filters are not supposed to fail.
35230 A non-zero code is taken to mean that the transport filter encountered some
35231 serious problem. Delivery of the message is deferred; the message remains on
35232 the queue and is tried again later. It is not possible to cause a message to be
35233 bounced from a transport filter.
35234 </para>
35235 <para>
35236 If a transport filter is set on an autoreply transport, the original message is
35237 passed through the filter as it is being copied into the newly generated
35238 message, which happens if the <option>return_message</option> option is set.
35239 </para>
35240 <para>
35241 <indexterm role="option">
35242 <primary>transport_filter_timeout</primary>
35243 </indexterm>
35244 </para>
35245 <informaltable frame="all">
35246 <tgroup cols="4" colsep="0" rowsep="0">
35247 <colspec colwidth="8*" align="left"/>
35248 <colspec colwidth="5*" align="center"/>
35249 <colspec colwidth="5*" align="center"/>
35250 <colspec colwidth="6*" align="right"/>
35251 <tbody>
35252 <row>
35253 <entry><option>transport_filter_timeout</option></entry>
35254 <entry>Use: <emphasis>transports</emphasis></entry>
35255 <entry>Type: <emphasis>time</emphasis></entry>
35256 <entry>Default: <emphasis>5m</emphasis></entry>
35257 </row>
35258 </tbody>
35259 </tgroup>
35260 </informaltable>
35261 <para>
35262 <indexterm role="concept">
35263 <primary>transport filter</primary>
35264 <secondary>timeout</secondary>
35265 </indexterm>
35266 When Exim is reading the output of a transport filter, it a applies a timeout
35267 that can be set by this option. Exceeding the timeout is normally treated as a
35268 temporary delivery failure. However, if a transport filter is used with a
35269 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
35270 way as a timeout in the pipe command itself. By default, a timeout is a hard
35271 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
35272 becomes a temporary error.
35273 </para>
35274 <para>
35275 <indexterm role="option">
35276 <primary>user</primary>
35277 </indexterm>
35278 </para>
35279 <informaltable frame="all">
35280 <tgroup cols="4" colsep="0" rowsep="0">
35281 <colspec colwidth="8*" align="left"/>
35282 <colspec colwidth="5*" align="center"/>
35283 <colspec colwidth="5*" align="center"/>
35284 <colspec colwidth="6*" align="right"/>
35285 <tbody>
35286 <row>
35287 <entry><option>user</option></entry>
35288 <entry>Use: <emphasis>transports</emphasis></entry>
35289 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35290 <entry>Default: <emphasis>Exim user</emphasis></entry>
35291 </row>
35292 </tbody>
35293 </tgroup>
35294 </informaltable>
35295 <para>
35296 <indexterm role="concept">
35297 <primary>uid (user id)</primary>
35298 <secondary>local delivery</secondary>
35299 </indexterm>
35300 <indexterm role="concept">
35301 <primary>transport user</primary>
35302 <secondary>specifying</secondary>
35303 </indexterm>
35304 This option specifies the user under whose uid the delivery process is to be
35305 run, overriding any uid that may have been set by the router. If the user is
35306 given as a name, the uid is looked up from the password data, and the
35307 associated group is taken as the value of the gid to be used if the <option>group</option>
35308 option is not set.
35309 </para>
35310 <para>
35311 For deliveries that use local transports, a user and group are normally
35312 specified explicitly or implicitly (for example, as a result of
35313 <option>check_local_user</option>) by the router or transport.
35314 </para>
35315 <para>
35316 <indexterm role="concept">
35317 <primary>hints database</primary>
35318 <secondary>access by remote transport</secondary>
35319 </indexterm>
35320 For remote transports, you should leave this option unset unless you really are
35321 sure you know what you are doing. When a remote transport is running, it needs
35322 to be able to access Exim&#x2019;s hints databases, because each host may have its own
35323 retry data.
35324 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
35325 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
35326 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
35327 </para>
35328 </chapter>
35329
35330 <chapter id="CHAPbatching">
35331 <title>Address batching in local transports</title>
35332 <titleabbrev>Address batching</titleabbrev>
35333 <para>
35334 <indexterm role="concept">
35335 <primary>transport</primary>
35336 <secondary>local; address batching in</secondary>
35337 </indexterm>
35338 The only remote transport (<command>smtp</command>) is normally configured to handle more than
35339 one address at a time, so that when several addresses are routed to the same
35340 remote host, just one copy of the message is sent. Local transports, however,
35341 normally handle one address at a time. That is, a separate instance of the
35342 transport is run for each address that is routed to the transport. A separate
35343 copy of the message is delivered each time.
35344 </para>
35345 <para>
35346 <indexterm role="concept">
35347 <primary>batched local delivery</primary>
35348 </indexterm>
35349 <indexterm role="concept">
35350 <primary><option>batch_max</option></primary>
35351 </indexterm>
35352 <indexterm role="concept">
35353 <primary><option>batch_id</option></primary>
35354 </indexterm>
35355 In special cases, it may be desirable to handle several addresses at once in a
35356 local transport, for example:
35357 </para>
35358 <itemizedlist>
35359 <listitem>
35360 <para>
35361 In an <command>appendfile</command> transport, when storing messages in files for later
35362 delivery by some other means, a single copy of the message with multiple
35363 recipients saves space.
35364 </para>
35365 </listitem>
35366 <listitem>
35367 <para>
35368 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
35369 a single copy saves time, and is the normal way LMTP is expected to work.
35370 </para>
35371 </listitem>
35372 <listitem>
35373 <para>
35374 In a <command>pipe</command> transport, when passing the message
35375 to a scanner program or
35376 to some other delivery mechanism such as UUCP, multiple recipients may be
35377 acceptable.
35378 </para>
35379 </listitem>
35380 </itemizedlist>
35381 <para>
35382 These three local transports all have the same options for controlling multiple
35383 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
35384 repeating the information for each transport, these options are described here.
35385 </para>
35386 <para>
35387 The <option>batch_max</option> option specifies the maximum number of addresses that can be
35388 delivered together in a single run of the transport. Its default value is one
35389 (no batching). When more than one address is routed to a transport that has a
35390 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
35391 (that is, in a single run of the transport with multiple recipients), subject
35392 to certain conditions:
35393 </para>
35394 <itemizedlist>
35395 <listitem>
35396 <para>
35397 <indexterm role="concept">
35398 <primary><varname>$local_part</varname></primary>
35399 </indexterm>
35400 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
35401 batching is possible.
35402 </para>
35403 </listitem>
35404 <listitem>
35405 <para>
35406 <indexterm role="concept">
35407 <primary><varname>$domain</varname></primary>
35408 </indexterm>
35409 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
35410 addresses with the same domain are batched.
35411 </para>
35412 </listitem>
35413 <listitem>
35414 <para>
35415 <indexterm role="concept">
35416 <primary>customizing</primary>
35417 <secondary>batching condition</secondary>
35418 </indexterm>
35419 If <option>batch_id</option> is set, it is expanded for each address, and only those
35420 addresses with the same expanded value are batched. This allows you to specify
35421 customized batching conditions. Failure of the expansion for any reason,
35422 including forced failure, disables batching, but it does not stop the delivery
35423 from taking place.
35424 </para>
35425 </listitem>
35426 <listitem>
35427 <para>
35428 Batched addresses must also have the same errors address (where to send
35429 delivery errors), the same header additions and removals, the same user and
35430 group for the transport, and if a host list is present, the first host must
35431 be the same.
35432 </para>
35433 </listitem>
35434 </itemizedlist>
35435 <para>
35436 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
35437 both when the file or pipe command is specified in the transport, and when it
35438 is specified by a <command>redirect</command> router, but all the batched addresses must of
35439 course be routed to the same file or pipe command. These two transports have an
35440 option called <option>use_bsmtp</option>, which causes them to deliver the message in
35441 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
35442 <option>check_string</option> and <option>escape_string</option> options are forced to the values
35443 </para>
35444 <literallayout class="monospaced">
35445 check_string = "."
35446 escape_string = ".."
35447 </literallayout>
35448 <para>
35449 when batched SMTP is in use. A full description of the batch SMTP mechanism is
35450 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
35451 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
35452 </para>
35453 <para>
35454 <indexterm role="concept">
35455 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
35456 </indexterm>
35457 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
35458 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
35459 that are being processed together. If you are using a batching <command>appendfile</command>
35460 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
35461 addresses is to set the <option>envelope_to_add</option> option.
35462 </para>
35463 <para>
35464 <indexterm role="concept">
35465 <primary><command>pipe</command> transport</primary>
35466 <secondary>with multiple addresses</secondary>
35467 </indexterm>
35468 <indexterm role="concept">
35469 <primary><varname>$pipe_addresses</varname></primary>
35470 </indexterm>
35471 If you are using a <command>pipe</command> transport without BSMTP, and setting the
35472 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
35473 the command. This is not a true variable; it is a bit of magic that causes each
35474 of the recipient addresses to be inserted into the command as a separate
35475 argument. This provides a way of accessing all the addresses that are being
35476 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
35477 are specififed by a <command>redirect</command> router.
35478 </para>
35479 </chapter>
35480
35481 <chapter id="CHAPappendfile">
35482 <title>The appendfile transport</title>
35483 <para>
35484 <indexterm role="concept" id="IIDapptra1" class="startofrange">
35485 <primary><command>appendfile</command> transport</primary>
35486 </indexterm>
35487 <indexterm role="concept" id="IIDapptra2" class="startofrange">
35488 <primary>transports</primary>
35489 <secondary><command>appendfile</command></secondary>
35490 </indexterm>
35491 <indexterm role="concept">
35492 <primary>directory creation</primary>
35493 </indexterm>
35494 <indexterm role="concept">
35495 <primary>creating directories</primary>
35496 </indexterm>
35497 The <command>appendfile</command> transport delivers a message by appending it to an existing
35498 file, or by creating an entirely new file in a specified directory. Single
35499 files to which messages are appended can be in the traditional Unix mailbox
35500 format, or optionally in the MBX format supported by the Pine MUA and
35501 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
35502 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
35503 to give added protection against failures that happen part-way through the
35504 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
35505 supported. For all file formats, Exim attempts to create as many levels of
35506 directory as necessary, provided that <option>create_directory</option> is set.
35507 </para>
35508 <para>
35509 The code for the optional formats is not included in the Exim binary by
35510 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
35511 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
35512 included.
35513 </para>
35514 <para>
35515 <indexterm role="concept">
35516 <primary>quota</primary>
35517 <secondary>system</secondary>
35518 </indexterm>
35519 Exim recognises system quota errors, and generates an appropriate message. Exim
35520 also supports its own quota control within the transport, for use when the
35521 system facility is unavailable or cannot be used for some reason.
35522 </para>
35523 <para>
35524 If there is an error while appending to a file (for example, quota exceeded or
35525 partition filled), Exim attempts to reset the file&#x2019;s length and last
35526 modification time back to what they were before. If there is an error while
35527 creating an entirely new file, the new file is removed.
35528 </para>
35529 <para>
35530 Before appending to a file, a number of security checks are made, and the
35531 file is locked. A detailed description is given below, after the list of
35532 private options.
35533 </para>
35534 <para>
35535 The <command>appendfile</command> transport is most commonly used for local deliveries to
35536 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
35537 putting messages into files for remote delivery by some means other than Exim.
35538 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
35539 option).
35540 </para>
35541 <section id="SECTfildiropt">
35542 <title>The file and directory options</title>
35543 <para>
35544 The <option>file</option> option specifies a single file, to which the message is appended;
35545 the <option>directory</option> option specifies a directory, in which a new file containing
35546 the message is created. Only one of these two options can be set, and for
35547 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
35548 </para>
35549 <para>
35550 <indexterm role="concept">
35551 <primary><varname>$address_file</varname></primary>
35552 </indexterm>
35553 <indexterm role="concept">
35554 <primary><varname>$local_part</varname></primary>
35555 </indexterm>
35556 However, <command>appendfile</command> is also used for delivering messages to files or
35557 directories whose names (or parts of names) are obtained from alias,
35558 forwarding, or filtering operations (for example, a <option>save</option> command in a
35559 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
35560 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
35561 name (or partial name) of the file or directory generated by the redirection
35562 operation. There are two cases:
35563 </para>
35564 <itemizedlist>
35565 <listitem>
35566 <para>
35567 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
35568 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
35569 common case when users with local accounts use filtering to sort mail into
35570 different folders. See for example, the <command>address_file</command> transport in the
35571 default configuration. If the path ends with a slash, it is assumed to be the
35572 name of a directory. A delivery to a directory can also be forced by setting
35573 <option>maildir_format</option> or <option>mailstore_format</option>.
35574 </para>
35575 </listitem>
35576 <listitem>
35577 <para>
35578 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
35579 used to determine the file or directory name for the delivery. Normally, the
35580 contents of <varname>$address_file</varname> are used in some way in the string expansion.
35581 </para>
35582 </listitem>
35583 </itemizedlist>
35584 <para>
35585 <indexterm role="concept">
35586 <primary>Sieve filter</primary>
35587 <secondary>configuring <command>appendfile</command></secondary>
35588 </indexterm>
35589 <indexterm role="concept">
35590 <primary>Sieve filter</primary>
35591 <secondary>relative mailbox path handling</secondary>
35592 </indexterm>
35593 As an example of the second case, consider an environment where users do not
35594 have home directories. They may be permitted to use Exim filter commands of the
35595 form:
35596 </para>
35597 <literallayout class="monospaced">
35598 save folder23
35599 </literallayout>
35600 <para>
35601 or Sieve filter commands of the form:
35602 </para>
35603 <literallayout class="monospaced">
35604 require "fileinto";
35605 fileinto "folder23";
35606 </literallayout>
35607 <para>
35608 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
35609 must transform the relative path into an appropriate absolute file name. In the
35610 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
35611 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
35612 way of handling this requirement:
35613 </para>
35614 <literallayout class="monospaced">
35615 file = ${if eq{$address_file}{inbox} \
35616             {/var/mail/$local_part} \
35617             {${if eq{${substr_0_1:$address_file}}{/} \
35618                   {$address_file} \
35619                   {$home/mail/$address_file} \
35620             }} \
35621        }
35622 </literallayout>
35623 <para>
35624 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
35625 location, absolute paths are used without change, and other folders are in the
35626 <filename>mail</filename> directory within the home directory.
35627 </para>
35628 <para>
35629 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
35630 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
35631 the router. In particular, this is the case if <option>check_local_user</option> is set. If
35632 you want to prevent this happening at routing time, you can set
35633 <option>router_home_directory</option> empty. This forces the router to pass the relative
35634 path to the transport.
35635 </para>
35636 <para>
35637 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
35638 the <option>file</option> or <option>directory</option> option is still used if it is set.
35639 </para>
35640 </section>
35641 <section>
35642 <title>Private options for appendfile</title>
35643 <para>
35644 <indexterm role="concept">
35645 <primary>options</primary>
35646 <secondary><command>appendfile</command> transport</secondary>
35647 </indexterm>
35648 </para>
35649 <para>
35650 <indexterm role="option">
35651 <primary>allow_fifo</primary>
35652 </indexterm>
35653 </para>
35654 <informaltable frame="all">
35655 <tgroup cols="4" colsep="0" rowsep="0">
35656 <colspec colwidth="8*" align="left"/>
35657 <colspec colwidth="5*" align="center"/>
35658 <colspec colwidth="5*" align="center"/>
35659 <colspec colwidth="6*" align="right"/>
35660 <tbody>
35661 <row>
35662 <entry><option>allow_fifo</option></entry>
35663 <entry>Use: <emphasis>appendfile</emphasis></entry>
35664 <entry>Type: <emphasis>boolean</emphasis></entry>
35665 <entry>Default: <emphasis>false</emphasis></entry>
35666 </row>
35667 </tbody>
35668 </tgroup>
35669 </informaltable>
35670 <para>
35671 <indexterm role="concept">
35672 <primary>fifo (named pipe)</primary>
35673 </indexterm>
35674 <indexterm role="concept">
35675 <primary>named pipe (fifo)</primary>
35676 </indexterm>
35677 <indexterm role="concept">
35678 <primary>pipe</primary>
35679 <secondary>named (fifo)</secondary>
35680 </indexterm>
35681 Setting this option permits delivery to named pipes (FIFOs) as well as to
35682 regular files. If no process is reading the named pipe at delivery time, the
35683 delivery is deferred.
35684 </para>
35685 <para>
35686 <indexterm role="option">
35687 <primary>allow_symlink</primary>
35688 </indexterm>
35689 </para>
35690 <informaltable frame="all">
35691 <tgroup cols="4" colsep="0" rowsep="0">
35692 <colspec colwidth="8*" align="left"/>
35693 <colspec colwidth="5*" align="center"/>
35694 <colspec colwidth="5*" align="center"/>
35695 <colspec colwidth="6*" align="right"/>
35696 <tbody>
35697 <row>
35698 <entry><option>allow_symlink</option></entry>
35699 <entry>Use: <emphasis>appendfile</emphasis></entry>
35700 <entry>Type: <emphasis>boolean</emphasis></entry>
35701 <entry>Default: <emphasis>false</emphasis></entry>
35702 </row>
35703 </tbody>
35704 </tgroup>
35705 </informaltable>
35706 <para>
35707 <indexterm role="concept">
35708 <primary>symbolic link</primary>
35709 <secondary>to mailbox</secondary>
35710 </indexterm>
35711 <indexterm role="concept">
35712 <primary>mailbox</primary>
35713 <secondary>symbolic link</secondary>
35714 </indexterm>
35715 By default, <command>appendfile</command> will not deliver if the path name for the file is
35716 that of a symbolic link. Setting this option relaxes that constraint, but there
35717 are security issues involved in the use of symbolic links. Be sure you know
35718 what you are doing if you set this. Details of exactly what this option affects
35719 are included in the discussion which follows this list of options.
35720 </para>
35721 <para>
35722 <indexterm role="option">
35723 <primary>batch_id</primary>
35724 </indexterm>
35725 </para>
35726 <informaltable frame="all">
35727 <tgroup cols="4" colsep="0" rowsep="0">
35728 <colspec colwidth="8*" align="left"/>
35729 <colspec colwidth="5*" align="center"/>
35730 <colspec colwidth="5*" align="center"/>
35731 <colspec colwidth="6*" align="right"/>
35732 <tbody>
35733 <row>
35734 <entry><option>batch_id</option></entry>
35735 <entry>Use: <emphasis>appendfile</emphasis></entry>
35736 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35737 <entry>Default: <emphasis>unset</emphasis></entry>
35738 </row>
35739 </tbody>
35740 </tgroup>
35741 </informaltable>
35742 <para>
35743 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35744 However, batching is automatically disabled for <command>appendfile</command> deliveries that
35745 happen as a result of forwarding or aliasing or other redirection directly to a
35746 file.
35747 </para>
35748 <para>
35749 <indexterm role="option">
35750 <primary>batch_max</primary>
35751 </indexterm>
35752 </para>
35753 <informaltable frame="all">
35754 <tgroup cols="4" colsep="0" rowsep="0">
35755 <colspec colwidth="8*" align="left"/>
35756 <colspec colwidth="5*" align="center"/>
35757 <colspec colwidth="5*" align="center"/>
35758 <colspec colwidth="6*" align="right"/>
35759 <tbody>
35760 <row>
35761 <entry><option>batch_max</option></entry>
35762 <entry>Use: <emphasis>appendfile</emphasis></entry>
35763 <entry>Type: <emphasis>integer</emphasis></entry>
35764 <entry>Default: <emphasis>1</emphasis></entry>
35765 </row>
35766 </tbody>
35767 </tgroup>
35768 </informaltable>
35769 <para>
35770 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
35771 </para>
35772 <para>
35773 <indexterm role="option">
35774 <primary>check_group</primary>
35775 </indexterm>
35776 </para>
35777 <informaltable frame="all">
35778 <tgroup cols="4" colsep="0" rowsep="0">
35779 <colspec colwidth="8*" align="left"/>
35780 <colspec colwidth="5*" align="center"/>
35781 <colspec colwidth="5*" align="center"/>
35782 <colspec colwidth="6*" align="right"/>
35783 <tbody>
35784 <row>
35785 <entry><option>check_group</option></entry>
35786 <entry>Use: <emphasis>appendfile</emphasis></entry>
35787 <entry>Type: <emphasis>boolean</emphasis></entry>
35788 <entry>Default: <emphasis>false</emphasis></entry>
35789 </row>
35790 </tbody>
35791 </tgroup>
35792 </informaltable>
35793 <para>
35794 When this option is set, the group owner of the file defined by the <option>file</option>
35795 option is checked to see that it is the same as the group under which the
35796 delivery process is running. The default setting is false because the default
35797 file mode is 0600, which means that the group is irrelevant.
35798 </para>
35799 <para>
35800 <indexterm role="option">
35801 <primary>check_owner</primary>
35802 </indexterm>
35803 </para>
35804 <informaltable frame="all">
35805 <tgroup cols="4" colsep="0" rowsep="0">
35806 <colspec colwidth="8*" align="left"/>
35807 <colspec colwidth="5*" align="center"/>
35808 <colspec colwidth="5*" align="center"/>
35809 <colspec colwidth="6*" align="right"/>
35810 <tbody>
35811 <row>
35812 <entry><option>check_owner</option></entry>
35813 <entry>Use: <emphasis>appendfile</emphasis></entry>
35814 <entry>Type: <emphasis>boolean</emphasis></entry>
35815 <entry>Default: <emphasis>true</emphasis></entry>
35816 </row>
35817 </tbody>
35818 </tgroup>
35819 </informaltable>
35820 <para>
35821 When this option is set, the owner of the file defined by the <option>file</option> option
35822 is checked to ensure that it is the same as the user under which the delivery
35823 process is running.
35824 </para>
35825 <para>
35826 <indexterm role="option">
35827 <primary>check_string</primary>
35828 </indexterm>
35829 </para>
35830 <informaltable frame="all">
35831 <tgroup cols="4" colsep="0" rowsep="0">
35832 <colspec colwidth="8*" align="left"/>
35833 <colspec colwidth="5*" align="center"/>
35834 <colspec colwidth="5*" align="center"/>
35835 <colspec colwidth="6*" align="right"/>
35836 <tbody>
35837 <row>
35838 <entry><option>check_string</option></entry>
35839 <entry>Use: <emphasis>appendfile</emphasis></entry>
35840 <entry>Type: <emphasis>string</emphasis></entry>
35841 <entry>Default: <emphasis>see below</emphasis></entry>
35842 </row>
35843 </tbody>
35844 </tgroup>
35845 </informaltable>
35846 <para>
35847 <indexterm role="concept">
35848 <primary><quote>From</quote> line</primary>
35849 </indexterm>
35850 As <command>appendfile</command> writes the message, the start of each line is tested for
35851 matching <option>check_string</option>, and if it does, the initial matching characters are
35852 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
35853 a literal string, not a regular expression, and the case of any letters it
35854 contains is significant.
35855 </para>
35856 <para>
35857 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
35858 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
35859 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
35860 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
35861 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
35862 </para>
35863 <para>
35864 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
35865 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
35866 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
35867 if another format is used. For example, to deliver to mailboxes in MMDF format:
35868 <indexterm role="concept">
35869 <primary>MMDF format mailbox</primary>
35870 </indexterm>
35871 <indexterm role="concept">
35872 <primary>mailbox</primary>
35873 <secondary>MMDF format</secondary>
35874 </indexterm>
35875 </para>
35876 <literallayout class="monospaced">
35877 check_string = "\1\1\1\1\n"
35878 escape_string = "\1\1\1\1 \n"
35879 message_prefix = "\1\1\1\1\n"
35880 message_suffix = "\1\1\1\1\n"
35881 </literallayout>
35882 <para>
35883 <indexterm role="option">
35884 <primary>create_directory</primary>
35885 </indexterm>
35886 </para>
35887 <informaltable frame="all">
35888 <tgroup cols="4" colsep="0" rowsep="0">
35889 <colspec colwidth="8*" align="left"/>
35890 <colspec colwidth="5*" align="center"/>
35891 <colspec colwidth="5*" align="center"/>
35892 <colspec colwidth="6*" align="right"/>
35893 <tbody>
35894 <row>
35895 <entry><option>create_directory</option></entry>
35896 <entry>Use: <emphasis>appendfile</emphasis></entry>
35897 <entry>Type: <emphasis>boolean</emphasis></entry>
35898 <entry>Default: <emphasis>true</emphasis></entry>
35899 </row>
35900 </tbody>
35901 </tgroup>
35902 </informaltable>
35903 <para>
35904 <indexterm role="concept">
35905 <primary>directory creation</primary>
35906 </indexterm>
35907 When this option is true, Exim attempts to create any missing superior
35908 directories for the file that it is about to write. A created directory&#x2019;s mode
35909 is given by the <option>directory_mode</option> option.
35910 </para>
35911 <para>
35912 The group ownership of a newly created directory is highly dependent on the
35913 operating system (and possibly the file system) that is being used. For
35914 example, in Solaris, if the parent directory has the setgid bit set, its group
35915 is propagated to the child; if not, the currently set group is used. However,
35916 in FreeBSD, the parent&#x2019;s group is always used.
35917 </para>
35918 <para>
35919 <indexterm role="option">
35920 <primary>create_file</primary>
35921 </indexterm>
35922 </para>
35923 <informaltable frame="all">
35924 <tgroup cols="4" colsep="0" rowsep="0">
35925 <colspec colwidth="8*" align="left"/>
35926 <colspec colwidth="5*" align="center"/>
35927 <colspec colwidth="5*" align="center"/>
35928 <colspec colwidth="6*" align="right"/>
35929 <tbody>
35930 <row>
35931 <entry><option>create_file</option></entry>
35932 <entry>Use: <emphasis>appendfile</emphasis></entry>
35933 <entry>Type: <emphasis>string</emphasis></entry>
35934 <entry>Default: <emphasis>anywhere</emphasis></entry>
35935 </row>
35936 </tbody>
35937 </tgroup>
35938 </informaltable>
35939 <para>
35940 This option constrains the location of files and directories that are created
35941 by this transport. It applies to files defined by the <option>file</option> option and
35942 directories defined by the <option>directory</option> option. In the case of maildir
35943 delivery, it applies to the top level directory, not the maildir directories
35944 beneath.
35945 </para>
35946 <para>
35947 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
35948 <quote>belowhome</quote>. In the second and third cases, a home directory must have been
35949 set for the transport. This option is not useful when an explicit file name is
35950 given for normal mailbox deliveries. It is intended for the case when file
35951 names are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
35952 by an <command>appendfile</command> transport called <option>address_file</option>. See also
35953 <option>file_must_exist</option>.
35954 </para>
35955 <para>
35956 <indexterm role="option">
35957 <primary>directory</primary>
35958 </indexterm>
35959 </para>
35960 <informaltable frame="all">
35961 <tgroup cols="4" colsep="0" rowsep="0">
35962 <colspec colwidth="8*" align="left"/>
35963 <colspec colwidth="5*" align="center"/>
35964 <colspec colwidth="5*" align="center"/>
35965 <colspec colwidth="6*" align="right"/>
35966 <tbody>
35967 <row>
35968 <entry><option>directory</option></entry>
35969 <entry>Use: <emphasis>appendfile</emphasis></entry>
35970 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35971 <entry>Default: <emphasis>unset</emphasis></entry>
35972 </row>
35973 </tbody>
35974 </tgroup>
35975 </informaltable>
35976 <para>
35977 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
35978 or <option>directory</option> must be set, unless the delivery is the direct result of a
35979 redirection (see section <xref linkend="SECTfildiropt"/>).
35980 </para>
35981 <para>
35982 When <option>directory</option> is set, the string is expanded, and the message is delivered
35983 into a new file or files in or below the given directory, instead of being
35984 appended to a single mailbox file. A number of different formats are provided
35985 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
35986 <xref linkend="SECTopdir"/> for further details of this form of delivery.
35987 </para>
35988 <para>
35989 <indexterm role="option">
35990 <primary>directory_file</primary>
35991 </indexterm>
35992 </para>
35993 <informaltable frame="all">
35994 <tgroup cols="4" colsep="0" rowsep="0">
35995 <colspec colwidth="8*" align="left"/>
35996 <colspec colwidth="5*" align="center"/>
35997 <colspec colwidth="5*" align="center"/>
35998 <colspec colwidth="6*" align="right"/>
35999 <tbody>
36000 <row>
36001 <entry><option>directory_file</option></entry>
36002 <entry>Use: <emphasis>appendfile</emphasis></entry>
36003 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36004 <entry>Default: <emphasis><literal>q${base62:$tod_epoch}-$inode</literal></emphasis></entry>
36005 </row>
36006 </tbody>
36007 </tgroup>
36008 </informaltable>
36009 <para>
36010 <indexterm role="concept">
36011 <primary>base62</primary>
36012 </indexterm>
36013 <indexterm role="concept">
36014 <primary><varname>$inode</varname></primary>
36015 </indexterm>
36016 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
36017 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
36018 whose name is obtained by expanding this string. The default value generates a
36019 unique name from the current time, in base 62 form, and the inode of the file.
36020 The variable <varname>$inode</varname> is available only when expanding this option.
36021 </para>
36022 <para>
36023 <indexterm role="option">
36024 <primary>directory_mode</primary>
36025 </indexterm>
36026 </para>
36027 <informaltable frame="all">
36028 <tgroup cols="4" colsep="0" rowsep="0">
36029 <colspec colwidth="8*" align="left"/>
36030 <colspec colwidth="5*" align="center"/>
36031 <colspec colwidth="5*" align="center"/>
36032 <colspec colwidth="6*" align="right"/>
36033 <tbody>
36034 <row>
36035 <entry><option>directory_mode</option></entry>
36036 <entry>Use: <emphasis>appendfile</emphasis></entry>
36037 <entry>Type: <emphasis>octal integer</emphasis></entry>
36038 <entry>Default: <emphasis>0700</emphasis></entry>
36039 </row>
36040 </tbody>
36041 </tgroup>
36042 </informaltable>
36043 <para>
36044 If <command>appendfile</command> creates any directories as a result of the
36045 <option>create_directory</option> option, their mode is specified by this option.
36046 </para>
36047 <para>
36048 <indexterm role="option">
36049 <primary>escape_string</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>escape_string</option></entry>
36061 <entry>Use: <emphasis>appendfile</emphasis></entry>
36062 <entry>Type: <emphasis>string</emphasis></entry>
36063 <entry>Default: <emphasis>see description</emphasis></entry>
36064 </row>
36065 </tbody>
36066 </tgroup>
36067 </informaltable>
36068 <para>
36069 See <option>check_string</option> above.
36070 </para>
36071 <para>
36072 <indexterm role="option">
36073 <primary>file</primary>
36074 </indexterm>
36075 </para>
36076 <informaltable frame="all">
36077 <tgroup cols="4" colsep="0" rowsep="0">
36078 <colspec colwidth="8*" align="left"/>
36079 <colspec colwidth="5*" align="center"/>
36080 <colspec colwidth="5*" align="center"/>
36081 <colspec colwidth="6*" align="right"/>
36082 <tbody>
36083 <row>
36084 <entry><option>file</option></entry>
36085 <entry>Use: <emphasis>appendfile</emphasis></entry>
36086 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36087 <entry>Default: <emphasis>unset</emphasis></entry>
36088 </row>
36089 </tbody>
36090 </tgroup>
36091 </informaltable>
36092 <para>
36093 This option is mutually exclusive with the <option>directory</option> option, but one of
36094 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
36095 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
36096 specifies a single file, to which the message is appended. One or more of
36097 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
36098 <option>file</option>.
36099 </para>
36100 <para>
36101 <indexterm role="concept">
36102 <primary>NFS</primary>
36103 <secondary>lock file</secondary>
36104 </indexterm>
36105 <indexterm role="concept">
36106 <primary>locking files</primary>
36107 </indexterm>
36108 <indexterm role="concept">
36109 <primary>lock files</primary>
36110 </indexterm>
36111 If you are using more than one host to deliver over NFS into the same
36112 mailboxes, you should always use lock files.
36113 </para>
36114 <para>
36115 The string value is expanded for each delivery, and must yield an absolute
36116 path. The most common settings of this option are variations on one of these
36117 examples:
36118 </para>
36119 <literallayout class="monospaced">
36120 file = /var/spool/mail/$local_part
36121 file = /home/$local_part/inbox
36122 file = $home/inbox
36123 </literallayout>
36124 <para>
36125 <indexterm role="concept">
36126 <primary><quote>sticky</quote> bit</primary>
36127 </indexterm>
36128 In the first example, all deliveries are done into the same directory. If Exim
36129 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
36130 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
36131 deliveries to be possible, or alternatively the <option>group</option> option can be used to
36132 run the delivery under a group id which has write access to the directory.
36133 </para>
36134 <para>
36135 <indexterm role="option">
36136 <primary>file_format</primary>
36137 </indexterm>
36138 </para>
36139 <informaltable frame="all">
36140 <tgroup cols="4" colsep="0" rowsep="0">
36141 <colspec colwidth="8*" align="left"/>
36142 <colspec colwidth="5*" align="center"/>
36143 <colspec colwidth="5*" align="center"/>
36144 <colspec colwidth="6*" align="right"/>
36145 <tbody>
36146 <row>
36147 <entry><option>file_format</option></entry>
36148 <entry>Use: <emphasis>appendfile</emphasis></entry>
36149 <entry>Type: <emphasis>string</emphasis></entry>
36150 <entry>Default: <emphasis>unset</emphasis></entry>
36151 </row>
36152 </tbody>
36153 </tgroup>
36154 </informaltable>
36155 <para>
36156 <indexterm role="concept">
36157 <primary>file</primary>
36158 <secondary>mailbox; checking existing format</secondary>
36159 </indexterm>
36160 This option requests the transport to check the format of an existing file
36161 before adding to it. The check consists of matching a specific string at the
36162 start of the file. The value of the option consists of an even number of
36163 colon-separated strings. The first of each pair is the test string, and the
36164 second is the name of a transport. If the transport associated with a matched
36165 string is not the current transport, control is passed over to the other
36166 transport. For example, suppose the standard <command>local_delivery</command> transport has
36167 this added to it:
36168 </para>
36169 <literallayout class="monospaced">
36170 file_format = "From       : local_delivery :\
36171                \1\1\1\1\n : local_mmdf_delivery"
36172 </literallayout>
36173 <para>
36174 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
36175 a mailbox begins with four binary ones followed by a newline, control is passed
36176 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
36177 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
36178 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
36179 match any string, or if the transport named for a given string is not defined,
36180 delivery is deferred.
36181 </para>
36182 <para>
36183 <indexterm role="option">
36184 <primary>file_must_exist</primary>
36185 </indexterm>
36186 </para>
36187 <informaltable frame="all">
36188 <tgroup cols="4" colsep="0" rowsep="0">
36189 <colspec colwidth="8*" align="left"/>
36190 <colspec colwidth="5*" align="center"/>
36191 <colspec colwidth="5*" align="center"/>
36192 <colspec colwidth="6*" align="right"/>
36193 <tbody>
36194 <row>
36195 <entry><option>file_must_exist</option></entry>
36196 <entry>Use: <emphasis>appendfile</emphasis></entry>
36197 <entry>Type: <emphasis>boolean</emphasis></entry>
36198 <entry>Default: <emphasis>false</emphasis></entry>
36199 </row>
36200 </tbody>
36201 </tgroup>
36202 </informaltable>
36203 <para revisionflag="changed">
36204 If this option is true, the file specified by the <option>file</option> option must exist.
36205 A temporary error occurs if it does not, causing delivery to be deferred.
36206 If this option is false, the file is created if it does not exist.
36207 </para>
36208 <para>
36209 <indexterm role="option">
36210 <primary>lock_fcntl_timeout</primary>
36211 </indexterm>
36212 </para>
36213 <informaltable frame="all">
36214 <tgroup cols="4" colsep="0" rowsep="0">
36215 <colspec colwidth="8*" align="left"/>
36216 <colspec colwidth="5*" align="center"/>
36217 <colspec colwidth="5*" align="center"/>
36218 <colspec colwidth="6*" align="right"/>
36219 <tbody>
36220 <row>
36221 <entry><option>lock_fcntl_timeout</option></entry>
36222 <entry>Use: <emphasis>appendfile</emphasis></entry>
36223 <entry>Type: <emphasis>time</emphasis></entry>
36224 <entry>Default: <emphasis>0s</emphasis></entry>
36225 </row>
36226 </tbody>
36227 </tgroup>
36228 </informaltable>
36229 <para>
36230 <indexterm role="concept">
36231 <primary>timeout</primary>
36232 <secondary>mailbox locking</secondary>
36233 </indexterm>
36234 <indexterm role="concept">
36235 <primary>mailbox locking</primary>
36236 <secondary>blocking and non-blocking</secondary>
36237 </indexterm>
36238 <indexterm role="concept">
36239 <primary>locking files</primary>
36240 </indexterm>
36241 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
36242 when locking an open mailbox file. If the call fails, the delivery process
36243 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
36244 Non-blocking calls are used so that the file is not kept open during the wait
36245 for the lock; the reason for this is to make it as safe as possible for
36246 deliveries over NFS in the case when processes might be accessing an NFS
36247 mailbox without using a lock file. This should not be done, but
36248 misunderstandings and hence misconfigurations are not unknown.
36249 </para>
36250 <para>
36251 On a busy system, however, the performance of a non-blocking lock approach is
36252 not as good as using a blocking lock with a timeout. In this case, the waiting
36253 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
36254 and can proceed as soon as the previous lock holder releases it.
36255 </para>
36256 <para>
36257 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
36258 timeout, are used. There may still be some retrying: the maximum number of
36259 retries is
36260 </para>
36261 <literallayout class="monospaced">
36262 (lock_retries * lock_interval) / lock_fcntl_timeout
36263 </literallayout>
36264 <para>
36265 rounded up to the next whole number. In other words, the total time during
36266 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
36267 <option>lock_fcntl_timeout</option> is set very large.
36268 </para>
36269 <para>
36270 You should consider setting this option if you are getting a lot of delayed
36271 local deliveries because of errors of the form
36272 </para>
36273 <literallayout class="monospaced">
36274 failed to lock mailbox /some/file (fcntl)
36275 </literallayout>
36276 <para>
36277 <indexterm role="option">
36278 <primary>lock_flock_timeout</primary>
36279 </indexterm>
36280 </para>
36281 <informaltable frame="all">
36282 <tgroup cols="4" colsep="0" rowsep="0">
36283 <colspec colwidth="8*" align="left"/>
36284 <colspec colwidth="5*" align="center"/>
36285 <colspec colwidth="5*" align="center"/>
36286 <colspec colwidth="6*" align="right"/>
36287 <tbody>
36288 <row>
36289 <entry><option>lock_flock_timeout</option></entry>
36290 <entry>Use: <emphasis>appendfile</emphasis></entry>
36291 <entry>Type: <emphasis>time</emphasis></entry>
36292 <entry>Default: <emphasis>0s</emphasis></entry>
36293 </row>
36294 </tbody>
36295 </tgroup>
36296 </informaltable>
36297 <para>
36298 This timeout applies to file locking when using <function>flock()</function> (see
36299 <option>use_flock</option>); the timeout operates in a similar manner to
36300 <option>lock_fcntl_timeout</option>.
36301 </para>
36302 <para>
36303 <indexterm role="option">
36304 <primary>lock_interval</primary>
36305 </indexterm>
36306 </para>
36307 <informaltable frame="all">
36308 <tgroup cols="4" colsep="0" rowsep="0">
36309 <colspec colwidth="8*" align="left"/>
36310 <colspec colwidth="5*" align="center"/>
36311 <colspec colwidth="5*" align="center"/>
36312 <colspec colwidth="6*" align="right"/>
36313 <tbody>
36314 <row>
36315 <entry><option>lock_interval</option></entry>
36316 <entry>Use: <emphasis>appendfile</emphasis></entry>
36317 <entry>Type: <emphasis>time</emphasis></entry>
36318 <entry>Default: <emphasis>3s</emphasis></entry>
36319 </row>
36320 </tbody>
36321 </tgroup>
36322 </informaltable>
36323 <para>
36324 This specifies the time to wait between attempts to lock the file. See below
36325 for details of locking.
36326 </para>
36327 <para>
36328 <indexterm role="option">
36329 <primary>lock_retries</primary>
36330 </indexterm>
36331 </para>
36332 <informaltable frame="all">
36333 <tgroup cols="4" colsep="0" rowsep="0">
36334 <colspec colwidth="8*" align="left"/>
36335 <colspec colwidth="5*" align="center"/>
36336 <colspec colwidth="5*" align="center"/>
36337 <colspec colwidth="6*" align="right"/>
36338 <tbody>
36339 <row>
36340 <entry><option>lock_retries</option></entry>
36341 <entry>Use: <emphasis>appendfile</emphasis></entry>
36342 <entry>Type: <emphasis>integer</emphasis></entry>
36343 <entry>Default: <emphasis>10</emphasis></entry>
36344 </row>
36345 </tbody>
36346 </tgroup>
36347 </informaltable>
36348 <para>
36349 This specifies the maximum number of attempts to lock the file. A value of zero
36350 is treated as 1. See below for details of locking.
36351 </para>
36352 <para>
36353 <indexterm role="option">
36354 <primary>lockfile_mode</primary>
36355 </indexterm>
36356 </para>
36357 <informaltable frame="all">
36358 <tgroup cols="4" colsep="0" rowsep="0">
36359 <colspec colwidth="8*" align="left"/>
36360 <colspec colwidth="5*" align="center"/>
36361 <colspec colwidth="5*" align="center"/>
36362 <colspec colwidth="6*" align="right"/>
36363 <tbody>
36364 <row>
36365 <entry><option>lockfile_mode</option></entry>
36366 <entry>Use: <emphasis>appendfile</emphasis></entry>
36367 <entry>Type: <emphasis>octal integer</emphasis></entry>
36368 <entry>Default: <emphasis>0600</emphasis></entry>
36369 </row>
36370 </tbody>
36371 </tgroup>
36372 </informaltable>
36373 <para>
36374 This specifies the mode of the created lock file, when a lock file is being
36375 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
36376 </para>
36377 <para>
36378 <indexterm role="option">
36379 <primary>lockfile_timeout</primary>
36380 </indexterm>
36381 </para>
36382 <informaltable frame="all">
36383 <tgroup cols="4" colsep="0" rowsep="0">
36384 <colspec colwidth="8*" align="left"/>
36385 <colspec colwidth="5*" align="center"/>
36386 <colspec colwidth="5*" align="center"/>
36387 <colspec colwidth="6*" align="right"/>
36388 <tbody>
36389 <row>
36390 <entry><option>lockfile_timeout</option></entry>
36391 <entry>Use: <emphasis>appendfile</emphasis></entry>
36392 <entry>Type: <emphasis>time</emphasis></entry>
36393 <entry>Default: <emphasis>30m</emphasis></entry>
36394 </row>
36395 </tbody>
36396 </tgroup>
36397 </informaltable>
36398 <para>
36399 <indexterm role="concept">
36400 <primary>timeout</primary>
36401 <secondary>mailbox locking</secondary>
36402 </indexterm>
36403 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
36404 exists and is older than this value, it is assumed to have been left behind by
36405 accident, and Exim attempts to remove it.
36406 </para>
36407 <para>
36408 <indexterm role="option">
36409 <primary>mailbox_filecount</primary>
36410 </indexterm>
36411 </para>
36412 <informaltable frame="all">
36413 <tgroup cols="4" colsep="0" rowsep="0">
36414 <colspec colwidth="8*" align="left"/>
36415 <colspec colwidth="5*" align="center"/>
36416 <colspec colwidth="5*" align="center"/>
36417 <colspec colwidth="6*" align="right"/>
36418 <tbody>
36419 <row>
36420 <entry><option>mailbox_filecount</option></entry>
36421 <entry>Use: <emphasis>appendfile</emphasis></entry>
36422 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36423 <entry>Default: <emphasis>unset</emphasis></entry>
36424 </row>
36425 </tbody>
36426 </tgroup>
36427 </informaltable>
36428 <para>
36429 <indexterm role="concept">
36430 <primary>mailbox</primary>
36431 <secondary>specifying size of</secondary>
36432 </indexterm>
36433 <indexterm role="concept">
36434 <primary>size</primary>
36435 <secondary>of mailbox</secondary>
36436 </indexterm>
36437 If this option is set, it is expanded, and the result is taken as the current
36438 number of files in the mailbox. It must be a decimal number, optionally
36439 followed by K or M. This provides a way of obtaining this information from an
36440 external source that maintains the data.
36441 </para>
36442 <para>
36443 <indexterm role="option">
36444 <primary>mailbox_size</primary>
36445 </indexterm>
36446 </para>
36447 <informaltable frame="all">
36448 <tgroup cols="4" colsep="0" rowsep="0">
36449 <colspec colwidth="8*" align="left"/>
36450 <colspec colwidth="5*" align="center"/>
36451 <colspec colwidth="5*" align="center"/>
36452 <colspec colwidth="6*" align="right"/>
36453 <tbody>
36454 <row>
36455 <entry><option>mailbox_size</option></entry>
36456 <entry>Use: <emphasis>appendfile</emphasis></entry>
36457 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36458 <entry>Default: <emphasis>unset</emphasis></entry>
36459 </row>
36460 </tbody>
36461 </tgroup>
36462 </informaltable>
36463 <para>
36464 <indexterm role="concept">
36465 <primary>mailbox</primary>
36466 <secondary>specifying size of</secondary>
36467 </indexterm>
36468 <indexterm role="concept">
36469 <primary>size</primary>
36470 <secondary>of mailbox</secondary>
36471 </indexterm>
36472 If this option is set, it is expanded, and the result is taken as the current
36473 size the mailbox. It must be a decimal number, optionally followed by K or M.
36474 This provides a way of obtaining this information from an external source that
36475 maintains the data. This is likely to be helpful for maildir deliveries where
36476 it is computationally expensive to compute the size of a mailbox.
36477 </para>
36478 <para>
36479 <indexterm role="option">
36480 <primary>maildir_format</primary>
36481 </indexterm>
36482 </para>
36483 <informaltable frame="all">
36484 <tgroup cols="4" colsep="0" rowsep="0">
36485 <colspec colwidth="8*" align="left"/>
36486 <colspec colwidth="5*" align="center"/>
36487 <colspec colwidth="5*" align="center"/>
36488 <colspec colwidth="6*" align="right"/>
36489 <tbody>
36490 <row>
36491 <entry><option>maildir_format</option></entry>
36492 <entry>Use: <emphasis>appendfile</emphasis></entry>
36493 <entry>Type: <emphasis>boolean</emphasis></entry>
36494 <entry>Default: <emphasis>false</emphasis></entry>
36495 </row>
36496 </tbody>
36497 </tgroup>
36498 </informaltable>
36499 <para>
36500 <indexterm role="concept">
36501 <primary>maildir format</primary>
36502 <secondary>specifying</secondary>
36503 </indexterm>
36504 If this option is set with the <option>directory</option> option, the delivery is into a new
36505 file, in the <quote>maildir</quote> format that is used by other mail software. When the
36506 transport is activated directly from a <command>redirect</command> router (for example, the
36507 <command>address_file</command> transport in the default configuration), setting
36508 <option>maildir_format</option> causes the path received from the router to be treated as a
36509 directory, whether or not it ends with <literal>/</literal>. This option is available only if
36510 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
36511 <xref linkend="SECTmaildirdelivery"/> below for further details.
36512 </para>
36513 <para>
36514 <indexterm role="option">
36515 <primary>maildir_quota_directory_regex</primary>
36516 </indexterm>
36517 </para>
36518 <informaltable frame="all">
36519 <tgroup cols="4" colsep="0" rowsep="0">
36520 <colspec colwidth="8*" align="left"/>
36521 <colspec colwidth="5*" align="center"/>
36522 <colspec colwidth="5*" align="center"/>
36523 <colspec colwidth="6*" align="right"/>
36524 <tbody>
36525 <row>
36526 <entry><option>maildir_quota_directory_regex</option></entry>
36527 <entry>Use: <emphasis>appendfile</emphasis></entry>
36528 <entry>Type: <emphasis>string</emphasis></entry>
36529 <entry>Default: <emphasis>See below</emphasis></entry>
36530 </row>
36531 </tbody>
36532 </tgroup>
36533 </informaltable>
36534 <para>
36535 <indexterm role="concept">
36536 <primary>maildir format</primary>
36537 <secondary>quota; directories included in</secondary>
36538 </indexterm>
36539 <indexterm role="concept">
36540 <primary>quota</primary>
36541 <secondary>maildir; directories included in</secondary>
36542 </indexterm>
36543 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
36544 a regular expression for specifying directories, relative to the quota
36545 directory (see <option>quota_directory</option>), that should be included in the quota
36546 calculation. The default value is:
36547 </para>
36548 <literallayout class="monospaced">
36549 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
36550 </literallayout>
36551 <para>
36552 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
36553 (directories whose names begin with a dot). If you want to exclude the
36554 <filename>Trash</filename>
36555 folder from the count (as some sites do), you need to change this setting to
36556 </para>
36557 <literallayout class="monospaced">
36558 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
36559 </literallayout>
36560 <para>
36561 This uses a negative lookahead in the regular expression to exclude the
36562 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
36563 calculations, quota processing is bypassed for any messages that are delivered
36564 directly into that directory.
36565 </para>
36566 <para>
36567 <indexterm role="option">
36568 <primary>maildir_retries</primary>
36569 </indexterm>
36570 </para>
36571 <informaltable frame="all">
36572 <tgroup cols="4" colsep="0" rowsep="0">
36573 <colspec colwidth="8*" align="left"/>
36574 <colspec colwidth="5*" align="center"/>
36575 <colspec colwidth="5*" align="center"/>
36576 <colspec colwidth="6*" align="right"/>
36577 <tbody>
36578 <row>
36579 <entry><option>maildir_retries</option></entry>
36580 <entry>Use: <emphasis>appendfile</emphasis></entry>
36581 <entry>Type: <emphasis>integer</emphasis></entry>
36582 <entry>Default: <emphasis>10</emphasis></entry>
36583 </row>
36584 </tbody>
36585 </tgroup>
36586 </informaltable>
36587 <para>
36588 This option specifies the number of times to retry when writing a file in
36589 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
36590 </para>
36591 <para>
36592 <indexterm role="option">
36593 <primary>maildir_tag</primary>
36594 </indexterm>
36595 </para>
36596 <informaltable frame="all">
36597 <tgroup cols="4" colsep="0" rowsep="0">
36598 <colspec colwidth="8*" align="left"/>
36599 <colspec colwidth="5*" align="center"/>
36600 <colspec colwidth="5*" align="center"/>
36601 <colspec colwidth="6*" align="right"/>
36602 <tbody>
36603 <row>
36604 <entry><option>maildir_tag</option></entry>
36605 <entry>Use: <emphasis>appendfile</emphasis></entry>
36606 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36607 <entry>Default: <emphasis>unset</emphasis></entry>
36608 </row>
36609 </tbody>
36610 </tgroup>
36611 </informaltable>
36612 <para>
36613 This option applies only to deliveries in maildir format, and is described in
36614 section <xref linkend="SECTmaildirdelivery"/> below.
36615 </para>
36616 <para>
36617 <indexterm role="option">
36618 <primary>maildir_use_size_file</primary>
36619 </indexterm>
36620 </para>
36621 <informaltable frame="all">
36622 <tgroup cols="4" colsep="0" rowsep="0">
36623 <colspec colwidth="8*" align="left"/>
36624 <colspec colwidth="5*" align="center"/>
36625 <colspec colwidth="5*" align="center"/>
36626 <colspec colwidth="6*" align="right"/>
36627 <tbody>
36628 <row>
36629 <entry><option>maildir_use_size_file</option></entry>
36630 <entry>Use: <emphasis>appendfile</emphasis></entry>
36631 <entry>Type: <emphasis>boolean</emphasis></entry>
36632 <entry>Default: <emphasis>false</emphasis></entry>
36633 </row>
36634 </tbody>
36635 </tgroup>
36636 </informaltable>
36637 <para>
36638 <indexterm role="concept">
36639 <primary>maildir format</primary>
36640 <secondary><filename>maildirsize</filename> file</secondary>
36641 </indexterm>
36642 Setting this option true enables support for <filename>maildirsize</filename> files. Exim
36643 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
36644 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
36645 value is zero. See <option>maildir_quota_directory_regex</option> above and section
36646 <xref linkend="SECTmaildirdelivery"/> below for further details.
36647 </para>
36648 <para>
36649 <indexterm role="option">
36650 <primary>maildirfolder_create_regex</primary>
36651 </indexterm>
36652 </para>
36653 <informaltable frame="all">
36654 <tgroup cols="4" colsep="0" rowsep="0">
36655 <colspec colwidth="8*" align="left"/>
36656 <colspec colwidth="5*" align="center"/>
36657 <colspec colwidth="5*" align="center"/>
36658 <colspec colwidth="6*" align="right"/>
36659 <tbody>
36660 <row>
36661 <entry><option>maildirfolder_create_regex</option></entry>
36662 <entry>Use: <emphasis>appendfile</emphasis></entry>
36663 <entry>Type: <emphasis>string</emphasis></entry>
36664 <entry>Default: <emphasis>unset</emphasis></entry>
36665 </row>
36666 </tbody>
36667 </tgroup>
36668 </informaltable>
36669 <para>
36670 <indexterm role="concept">
36671 <primary>maildir format</primary>
36672 <secondary><filename>maildirfolder</filename> file</secondary>
36673 </indexterm>
36674 <indexterm role="concept">
36675 <primary><filename>maildirfolder</filename>, creating</primary>
36676 </indexterm>
36677 The value of this option is a regular expression. If it is unset, it has no
36678 effect. Otherwise, before a maildir delivery takes place place, the pattern is
36679 matched against the name of the maildir directory, that is, the directory
36680 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
36681 delivery. If there is a match, Exim checks for the existence of a file called
36682 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
36683 See section <xref linkend="SECTmaildirdelivery"/> for more details.
36684 </para>
36685 <para>
36686 <indexterm role="option">
36687 <primary>mailstore_format</primary>
36688 </indexterm>
36689 </para>
36690 <informaltable frame="all">
36691 <tgroup cols="4" colsep="0" rowsep="0">
36692 <colspec colwidth="8*" align="left"/>
36693 <colspec colwidth="5*" align="center"/>
36694 <colspec colwidth="5*" align="center"/>
36695 <colspec colwidth="6*" align="right"/>
36696 <tbody>
36697 <row>
36698 <entry><option>mailstore_format</option></entry>
36699 <entry>Use: <emphasis>appendfile</emphasis></entry>
36700 <entry>Type: <emphasis>boolean</emphasis></entry>
36701 <entry>Default: <emphasis>false</emphasis></entry>
36702 </row>
36703 </tbody>
36704 </tgroup>
36705 </informaltable>
36706 <para>
36707 <indexterm role="concept">
36708 <primary>mailstore format</primary>
36709 <secondary>specifying</secondary>
36710 </indexterm>
36711 If this option is set with the <option>directory</option> option, the delivery is into two
36712 new files in  <quote>mailstore</quote> format. The option is available only if
36713 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
36714 below for further details.
36715 </para>
36716 <para>
36717 <indexterm role="option">
36718 <primary>mailstore_prefix</primary>
36719 </indexterm>
36720 </para>
36721 <informaltable frame="all">
36722 <tgroup cols="4" colsep="0" rowsep="0">
36723 <colspec colwidth="8*" align="left"/>
36724 <colspec colwidth="5*" align="center"/>
36725 <colspec colwidth="5*" align="center"/>
36726 <colspec colwidth="6*" align="right"/>
36727 <tbody>
36728 <row>
36729 <entry><option>mailstore_prefix</option></entry>
36730 <entry>Use: <emphasis>appendfile</emphasis></entry>
36731 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36732 <entry>Default: <emphasis>unset</emphasis></entry>
36733 </row>
36734 </tbody>
36735 </tgroup>
36736 </informaltable>
36737 <para>
36738 This option applies only to deliveries in mailstore format, and is described in
36739 section <xref linkend="SECTopdir"/> below.
36740 </para>
36741 <para>
36742 <indexterm role="option">
36743 <primary>mailstore_suffix</primary>
36744 </indexterm>
36745 </para>
36746 <informaltable frame="all">
36747 <tgroup cols="4" colsep="0" rowsep="0">
36748 <colspec colwidth="8*" align="left"/>
36749 <colspec colwidth="5*" align="center"/>
36750 <colspec colwidth="5*" align="center"/>
36751 <colspec colwidth="6*" align="right"/>
36752 <tbody>
36753 <row>
36754 <entry><option>mailstore_suffix</option></entry>
36755 <entry>Use: <emphasis>appendfile</emphasis></entry>
36756 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36757 <entry>Default: <emphasis>unset</emphasis></entry>
36758 </row>
36759 </tbody>
36760 </tgroup>
36761 </informaltable>
36762 <para>
36763 This option applies only to deliveries in mailstore format, and is described in
36764 section <xref linkend="SECTopdir"/> below.
36765 </para>
36766 <para>
36767 <indexterm role="option">
36768 <primary>mbx_format</primary>
36769 </indexterm>
36770 </para>
36771 <informaltable frame="all">
36772 <tgroup cols="4" colsep="0" rowsep="0">
36773 <colspec colwidth="8*" align="left"/>
36774 <colspec colwidth="5*" align="center"/>
36775 <colspec colwidth="5*" align="center"/>
36776 <colspec colwidth="6*" align="right"/>
36777 <tbody>
36778 <row>
36779 <entry><option>mbx_format</option></entry>
36780 <entry>Use: <emphasis>appendfile</emphasis></entry>
36781 <entry>Type: <emphasis>boolean</emphasis></entry>
36782 <entry>Default: <emphasis>false</emphasis></entry>
36783 </row>
36784 </tbody>
36785 </tgroup>
36786 </informaltable>
36787 <para>
36788 <indexterm role="concept">
36789 <primary>locking files</primary>
36790 </indexterm>
36791 <indexterm role="concept">
36792 <primary>file</primary>
36793 <secondary>locking</secondary>
36794 </indexterm>
36795 <indexterm role="concept">
36796 <primary>file</primary>
36797 <secondary>MBX format</secondary>
36798 </indexterm>
36799 <indexterm role="concept">
36800 <primary>MBX format</primary>
36801 <secondary>specifying</secondary>
36802 </indexterm>
36803 This option is available only if Exim has been compiled with SUPPORT_MBX
36804 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
36805 the message is appended to the mailbox file in MBX format instead of
36806 traditional Unix format. This format is supported by Pine4 and its associated
36807 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
36808 </para>
36809 <para>
36810 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
36811 automatically changed by the use of <option>mbx_format</option>. They should normally be set
36812 empty when using MBX format, so this option almost always appears in this
36813 combination:
36814 </para>
36815 <literallayout class="monospaced">
36816 mbx_format = true
36817 message_prefix =
36818 message_suffix =
36819 </literallayout>
36820 <para>
36821 If none of the locking options are mentioned in the configuration,
36822 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
36823 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
36824 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
36825 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
36826 should not be used if any program that does not use this form of locking is
36827 going to access the mailbox, nor should it be used if the mailbox file is NFS
36828 mounted, because it works only when the mailbox is accessed from a single host.
36829 </para>
36830 <para>
36831 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
36832 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
36833 (this means for the whole of a Pine or IMAP session), Exim will not be able to
36834 append messages to it.
36835 </para>
36836 <para>
36837 <indexterm role="option">
36838 <primary>message_prefix</primary>
36839 </indexterm>
36840 </para>
36841 <informaltable frame="all">
36842 <tgroup cols="4" colsep="0" rowsep="0">
36843 <colspec colwidth="8*" align="left"/>
36844 <colspec colwidth="5*" align="center"/>
36845 <colspec colwidth="5*" align="center"/>
36846 <colspec colwidth="6*" align="right"/>
36847 <tbody>
36848 <row>
36849 <entry><option>message_prefix</option></entry>
36850 <entry>Use: <emphasis>appendfile</emphasis></entry>
36851 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36852 <entry>Default: <emphasis>see below</emphasis></entry>
36853 </row>
36854 </tbody>
36855 </tgroup>
36856 </informaltable>
36857 <para>
36858 <indexterm role="concept">
36859 <primary><quote>From</quote> line</primary>
36860 </indexterm>
36861 The string specified here is expanded and output at the start of every message.
36862 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36863 in which case it is:
36864 </para>
36865 <literallayout class="monospaced">
36866 message_prefix = "From ${if def:return_path{$return_path}\
36867   {MAILER-DAEMON}} $tod_bsdinbox\n"
36868 </literallayout>
36869 <para>
36870 <indexterm role="option">
36871 <primary>message_suffix</primary>
36872 </indexterm>
36873 </para>
36874 <informaltable frame="all">
36875 <tgroup cols="4" colsep="0" rowsep="0">
36876 <colspec colwidth="8*" align="left"/>
36877 <colspec colwidth="5*" align="center"/>
36878 <colspec colwidth="5*" align="center"/>
36879 <colspec colwidth="6*" align="right"/>
36880 <tbody>
36881 <row>
36882 <entry><option>message_suffix</option></entry>
36883 <entry>Use: <emphasis>appendfile</emphasis></entry>
36884 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36885 <entry>Default: <emphasis>see below</emphasis></entry>
36886 </row>
36887 </tbody>
36888 </tgroup>
36889 </informaltable>
36890 <para>
36891 The string specified here is expanded and output at the end of every message.
36892 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
36893 in which case it is a single newline character. The suffix can be suppressed by
36894 setting
36895 </para>
36896 <literallayout class="monospaced">
36897 message_suffix =
36898 </literallayout>
36899 <para>
36900 <indexterm role="option">
36901 <primary>mode</primary>
36902 </indexterm>
36903 </para>
36904 <informaltable frame="all">
36905 <tgroup cols="4" colsep="0" rowsep="0">
36906 <colspec colwidth="8*" align="left"/>
36907 <colspec colwidth="5*" align="center"/>
36908 <colspec colwidth="5*" align="center"/>
36909 <colspec colwidth="6*" align="right"/>
36910 <tbody>
36911 <row>
36912 <entry><option>mode</option></entry>
36913 <entry>Use: <emphasis>appendfile</emphasis></entry>
36914 <entry>Type: <emphasis>octal integer</emphasis></entry>
36915 <entry>Default: <emphasis>0600</emphasis></entry>
36916 </row>
36917 </tbody>
36918 </tgroup>
36919 </informaltable>
36920 <para>
36921 If the output file is created, it is given this mode. If it already exists and
36922 has wider permissions, they are reduced to this mode. If it has narrower
36923 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
36924 if the delivery is the result of a <option>save</option> command in a filter file specifing
36925 a particular mode, the mode of the output file is always forced to take that
36926 value, and this option is ignored.
36927 </para>
36928 <para>
36929 <indexterm role="option">
36930 <primary>mode_fail_narrower</primary>
36931 </indexterm>
36932 </para>
36933 <informaltable frame="all">
36934 <tgroup cols="4" colsep="0" rowsep="0">
36935 <colspec colwidth="8*" align="left"/>
36936 <colspec colwidth="5*" align="center"/>
36937 <colspec colwidth="5*" align="center"/>
36938 <colspec colwidth="6*" align="right"/>
36939 <tbody>
36940 <row>
36941 <entry><option>mode_fail_narrower</option></entry>
36942 <entry>Use: <emphasis>appendfile</emphasis></entry>
36943 <entry>Type: <emphasis>boolean</emphasis></entry>
36944 <entry>Default: <emphasis>true</emphasis></entry>
36945 </row>
36946 </tbody>
36947 </tgroup>
36948 </informaltable>
36949 <para>
36950 This option applies in the case when an existing mailbox file has a narrower
36951 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
36952 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
36953 continues with the delivery attempt, using the existing mode of the file.
36954 </para>
36955 <para>
36956 <indexterm role="option">
36957 <primary>notify_comsat</primary>
36958 </indexterm>
36959 </para>
36960 <informaltable frame="all">
36961 <tgroup cols="4" colsep="0" rowsep="0">
36962 <colspec colwidth="8*" align="left"/>
36963 <colspec colwidth="5*" align="center"/>
36964 <colspec colwidth="5*" align="center"/>
36965 <colspec colwidth="6*" align="right"/>
36966 <tbody>
36967 <row>
36968 <entry><option>notify_comsat</option></entry>
36969 <entry>Use: <emphasis>appendfile</emphasis></entry>
36970 <entry>Type: <emphasis>boolean</emphasis></entry>
36971 <entry>Default: <emphasis>false</emphasis></entry>
36972 </row>
36973 </tbody>
36974 </tgroup>
36975 </informaltable>
36976 <para>
36977 If this option is true, the <emphasis>comsat</emphasis> daemon is notified after every
36978 successful delivery to a user mailbox. This is the daemon that notifies logged
36979 on users about incoming mail.
36980 </para>
36981 <para>
36982 <indexterm role="option">
36983 <primary>quota</primary>
36984 </indexterm>
36985 </para>
36986 <informaltable frame="all">
36987 <tgroup cols="4" colsep="0" rowsep="0">
36988 <colspec colwidth="8*" align="left"/>
36989 <colspec colwidth="5*" align="center"/>
36990 <colspec colwidth="5*" align="center"/>
36991 <colspec colwidth="6*" align="right"/>
36992 <tbody>
36993 <row>
36994 <entry><option>quota</option></entry>
36995 <entry>Use: <emphasis>appendfile</emphasis></entry>
36996 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36997 <entry>Default: <emphasis>unset</emphasis></entry>
36998 </row>
36999 </tbody>
37000 </tgroup>
37001 </informaltable>
37002 <para>
37003 <indexterm role="concept">
37004 <primary>quota</primary>
37005 <secondary>imposed by Exim</secondary>
37006 </indexterm>
37007 This option imposes a limit on the size of the file to which Exim is appending,
37008 or to the total space used in the directory tree when the <option>directory</option> option
37009 is set. In the latter case, computation of the space used is expensive, because
37010 all the files in the directory (and any sub-directories) have to be
37011 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
37012 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
37013 have no shell access to their mailboxes).
37014 </para>
37015 <para>
37016 As there is no interlock against two simultaneous deliveries into a
37017 multi-file mailbox, it is possible for the quota to be overrun in this case.
37018 For single-file mailboxes, of course, an interlock is a necessity.
37019 </para>
37020 <para>
37021 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
37022 may be a lot less than the actual amount of disk space allocated to the file.
37023 If the sizes of a number of files are being added up, the rounding effect can
37024 become quite noticeable, especially on systems that have large block sizes.
37025 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
37026 the obvious value which users understand most easily.
37027 </para>
37028 <para>
37029 The value of the option is expanded, and must then be a numerical value
37030 (decimal point allowed), optionally followed by one of the letters K, M, or G,
37031 for kilobytes, megabytes, or gigabytes. If Exim is running on a system with
37032 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
37033 be handled.
37034 </para>
37035 <para>
37036 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
37037 </para>
37038 <para>
37039 The expansion happens while Exim is running as root, before it changes uid for
37040 the delivery. This means that files that are inaccessible to the end user can
37041 be used to hold quota values that are looked up in the expansion. When delivery
37042 fails because this quota is exceeded, the handling of the error is as for
37043 system quota failures.
37044 </para>
37045 <para>
37046 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
37047 mailbox to the specified maximum size, though the value is not accurate to the
37048 last byte, owing to separator lines and additional headers that may get added
37049 during message delivery. When a mailbox is nearly full, large messages may get
37050 refused even though small ones are accepted, because the size of the current
37051 message is added to the quota when the check is made. This behaviour can be
37052 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
37053 for exceeding the quota does not include the current message. Thus, deliveries
37054 continue until the quota has been exceeded; thereafter, no further messages are
37055 delivered. See also <option>quota_warn_threshold</option>.
37056 </para>
37057 <para>
37058 <indexterm role="option">
37059 <primary>quota_directory</primary>
37060 </indexterm>
37061 </para>
37062 <informaltable frame="all">
37063 <tgroup cols="4" colsep="0" rowsep="0">
37064 <colspec colwidth="8*" align="left"/>
37065 <colspec colwidth="5*" align="center"/>
37066 <colspec colwidth="5*" align="center"/>
37067 <colspec colwidth="6*" align="right"/>
37068 <tbody>
37069 <row>
37070 <entry><option>quota_directory</option></entry>
37071 <entry>Use: <emphasis>appendfile</emphasis></entry>
37072 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37073 <entry>Default: <emphasis>unset</emphasis></entry>
37074 </row>
37075 </tbody>
37076 </tgroup>
37077 </informaltable>
37078 <para>
37079 This option defines the directory to check for quota purposes when delivering
37080 into individual files. The default is the delivery directory, or, if a file
37081 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
37082 delivery directory.
37083 </para>
37084 <para>
37085 <indexterm role="option">
37086 <primary>quota_filecount</primary>
37087 </indexterm>
37088 </para>
37089 <informaltable frame="all">
37090 <tgroup cols="4" colsep="0" rowsep="0">
37091 <colspec colwidth="8*" align="left"/>
37092 <colspec colwidth="5*" align="center"/>
37093 <colspec colwidth="5*" align="center"/>
37094 <colspec colwidth="6*" align="right"/>
37095 <tbody>
37096 <row>
37097 <entry><option>quota_filecount</option></entry>
37098 <entry>Use: <emphasis>appendfile</emphasis></entry>
37099 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37100 <entry>Default: <emphasis>0</emphasis></entry>
37101 </row>
37102 </tbody>
37103 </tgroup>
37104 </informaltable>
37105 <para>
37106 This option applies when the <option>directory</option> option is set. It limits the total
37107 number of files in the directory (compare the inode limit in system quotas). It
37108 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
37109 failure causes delivery to be deferred. A value of zero is interpreted as
37110 <quote>no quota</quote>.
37111 </para>
37112 <para>
37113 <indexterm role="option">
37114 <primary>quota_is_inclusive</primary>
37115 </indexterm>
37116 </para>
37117 <informaltable frame="all">
37118 <tgroup cols="4" colsep="0" rowsep="0">
37119 <colspec colwidth="8*" align="left"/>
37120 <colspec colwidth="5*" align="center"/>
37121 <colspec colwidth="5*" align="center"/>
37122 <colspec colwidth="6*" align="right"/>
37123 <tbody>
37124 <row>
37125 <entry><option>quota_is_inclusive</option></entry>
37126 <entry>Use: <emphasis>appendfile</emphasis></entry>
37127 <entry>Type: <emphasis>boolean</emphasis></entry>
37128 <entry>Default: <emphasis>true</emphasis></entry>
37129 </row>
37130 </tbody>
37131 </tgroup>
37132 </informaltable>
37133 <para>
37134 See <option>quota</option> above.
37135 </para>
37136 <para>
37137 <indexterm role="option">
37138 <primary>quota_size_regex</primary>
37139 </indexterm>
37140 </para>
37141 <informaltable frame="all">
37142 <tgroup cols="4" colsep="0" rowsep="0">
37143 <colspec colwidth="8*" align="left"/>
37144 <colspec colwidth="5*" align="center"/>
37145 <colspec colwidth="5*" align="center"/>
37146 <colspec colwidth="6*" align="right"/>
37147 <tbody>
37148 <row>
37149 <entry><option>quota_size_regex</option></entry>
37150 <entry>Use: <emphasis>appendfile</emphasis></entry>
37151 <entry>Type: <emphasis>string</emphasis></entry>
37152 <entry>Default: <emphasis>unset</emphasis></entry>
37153 </row>
37154 </tbody>
37155 </tgroup>
37156 </informaltable>
37157 <para>
37158 This option applies when one of the delivery modes that writes a separate file
37159 for each message is being used. When Exim wants to find the size of one of
37160 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
37161 If this is set to a regular expression that matches the file name, and it
37162 captures one string, that string is interpreted as a representation of the
37163 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
37164 </para>
37165 <para>
37166 This feature is useful only when users have no shell access to their mailboxes
37167 &ndash; otherwise they could defeat the quota simply by renaming the files. This
37168 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
37169 the file length to the file name. For example:
37170 </para>
37171 <literallayout class="monospaced">
37172 maildir_tag = ,S=$message_size
37173 quota_size_regex = ,S=(\d+)
37174 </literallayout>
37175 <para>
37176 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
37177 number of lines in the message.
37178 </para>
37179 <para>
37180 The regular expression should not assume that the length is at the end of the
37181 file name (even though <option>maildir_tag</option> puts it there) because maildir MUAs
37182 sometimes add other information onto the ends of message file names.
37183 </para>
37184 <para>
37185 <indexterm role="option">
37186 <primary>quota_warn_message</primary>
37187 </indexterm>
37188 </para>
37189 <informaltable frame="all">
37190 <tgroup cols="4" colsep="0" rowsep="0">
37191 <colspec colwidth="8*" align="left"/>
37192 <colspec colwidth="5*" align="center"/>
37193 <colspec colwidth="5*" align="center"/>
37194 <colspec colwidth="6*" align="right"/>
37195 <tbody>
37196 <row>
37197 <entry><option>quota_warn_message</option></entry>
37198 <entry>Use: <emphasis>appendfile</emphasis></entry>
37199 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37200 <entry>Default: <emphasis>see below</emphasis></entry>
37201 </row>
37202 </tbody>
37203 </tgroup>
37204 </informaltable>
37205 <para>
37206 See below for the use of this option. If it is not set when
37207 <option>quota_warn_threshold</option> is set, it defaults to
37208 </para>
37209 <literallayout class="monospaced">
37210 quota_warn_message = "\
37211   To: $local_part@$domain\n\
37212   Subject: Your mailbox\n\n\
37213   This message is automatically created \
37214   by mail delivery software.\n\n\
37215   The size of your mailbox has exceeded \
37216   a warning threshold that is\n\
37217   set by the system administrator.\n"
37218 </literallayout>
37219 <para>
37220 <indexterm role="option">
37221 <primary>quota_warn_threshold</primary>
37222 </indexterm>
37223 </para>
37224 <informaltable frame="all">
37225 <tgroup cols="4" colsep="0" rowsep="0">
37226 <colspec colwidth="8*" align="left"/>
37227 <colspec colwidth="5*" align="center"/>
37228 <colspec colwidth="5*" align="center"/>
37229 <colspec colwidth="6*" align="right"/>
37230 <tbody>
37231 <row>
37232 <entry><option>quota_warn_threshold</option></entry>
37233 <entry>Use: <emphasis>appendfile</emphasis></entry>
37234 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37235 <entry>Default: <emphasis>0</emphasis></entry>
37236 </row>
37237 </tbody>
37238 </tgroup>
37239 </informaltable>
37240 <para>
37241 <indexterm role="concept">
37242 <primary>quota</primary>
37243 <secondary>warning threshold</secondary>
37244 </indexterm>
37245 <indexterm role="concept">
37246 <primary>mailbox</primary>
37247 <secondary>size warning</secondary>
37248 </indexterm>
37249 <indexterm role="concept">
37250 <primary>size</primary>
37251 <secondary>of mailbox</secondary>
37252 </indexterm>
37253 This option is expanded in the same way as <option>quota</option> (see above). If the
37254 resulting value is greater than zero, and delivery of the message causes the
37255 size of the file or total space in the directory tree to cross the given
37256 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
37257 may be specified as a percentage of it by following the value with a percent
37258 sign. For example:
37259 </para>
37260 <literallayout class="monospaced">
37261 quota = 10M
37262 quota_warn_threshold = 75%
37263 </literallayout>
37264 <para>
37265 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
37266 percent sign is ignored.
37267 </para>
37268 <para>
37269 The warning message itself is specified by the <option>quota_warn_message</option> option,
37270 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
37271 warning message. These do not necessarily have to include the recipient(s) of
37272 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
37273 can include any other header lines that you want. If you do not include a
37274 <emphasis>From:</emphasis> line, the default is:
37275 </para>
37276 <literallayout class="monospaced">
37277 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
37278 </literallayout>
37279 <para>
37280 <indexterm role="option">
37281 <primary><option>errors_reply_to</option></primary>
37282 </indexterm>
37283 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
37284 option.
37285 </para>
37286 <para>
37287 The <option>quota</option> option does not have to be set in order to use this option; they
37288 are independent of one another except when the threshold is specified as a
37289 percentage.
37290 </para>
37291 <para>
37292 <indexterm role="option">
37293 <primary>use_bsmtp</primary>
37294 </indexterm>
37295 </para>
37296 <informaltable frame="all">
37297 <tgroup cols="4" colsep="0" rowsep="0">
37298 <colspec colwidth="8*" align="left"/>
37299 <colspec colwidth="5*" align="center"/>
37300 <colspec colwidth="5*" align="center"/>
37301 <colspec colwidth="6*" align="right"/>
37302 <tbody>
37303 <row>
37304 <entry><option>use_bsmtp</option></entry>
37305 <entry>Use: <emphasis>appendfile</emphasis></entry>
37306 <entry>Type: <emphasis>boolean</emphasis></entry>
37307 <entry>Default: <emphasis>false</emphasis></entry>
37308 </row>
37309 </tbody>
37310 </tgroup>
37311 </informaltable>
37312 <para>
37313 <indexterm role="concept">
37314 <primary>envelope sender</primary>
37315 </indexterm>
37316 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
37317 format, with the envelope sender and recipient(s) included as SMTP commands. If
37318 you want to include a leading HELO command with such messages, you can do
37319 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
37320 for details of batch SMTP.
37321 </para>
37322 <para>
37323 <indexterm role="option">
37324 <primary>use_crlf</primary>
37325 </indexterm>
37326 </para>
37327 <informaltable frame="all">
37328 <tgroup cols="4" colsep="0" rowsep="0">
37329 <colspec colwidth="8*" align="left"/>
37330 <colspec colwidth="5*" align="center"/>
37331 <colspec colwidth="5*" align="center"/>
37332 <colspec colwidth="6*" align="right"/>
37333 <tbody>
37334 <row>
37335 <entry><option>use_crlf</option></entry>
37336 <entry>Use: <emphasis>appendfile</emphasis></entry>
37337 <entry>Type: <emphasis>boolean</emphasis></entry>
37338 <entry>Default: <emphasis>false</emphasis></entry>
37339 </row>
37340 </tbody>
37341 </tgroup>
37342 </informaltable>
37343 <para>
37344 <indexterm role="concept">
37345 <primary>carriage return</primary>
37346 </indexterm>
37347 <indexterm role="concept">
37348 <primary>linefeed</primary>
37349 </indexterm>
37350 This option causes lines to be terminated with the two-character CRLF sequence
37351 (carriage return, linefeed) instead of just a linefeed character. In the case
37352 of batched SMTP, the byte sequence written to the file is then an exact image
37353 of what would be sent down a real SMTP connection.
37354 </para>
37355 <para>
37356 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
37357 written verbatim, so must contain their own carriage return characters if these
37358 are needed. In cases where these options have non-empty defaults, the values
37359 end with a single linefeed, so they must be changed to end with <literal>\r\n</literal> if
37360 <option>use_crlf</option> is set.
37361 </para>
37362 <para>
37363 <indexterm role="option">
37364 <primary>use_fcntl_lock</primary>
37365 </indexterm>
37366 </para>
37367 <informaltable frame="all">
37368 <tgroup cols="4" colsep="0" rowsep="0">
37369 <colspec colwidth="8*" align="left"/>
37370 <colspec colwidth="5*" align="center"/>
37371 <colspec colwidth="5*" align="center"/>
37372 <colspec colwidth="6*" align="right"/>
37373 <tbody>
37374 <row>
37375 <entry><option>use_fcntl_lock</option></entry>
37376 <entry>Use: <emphasis>appendfile</emphasis></entry>
37377 <entry>Type: <emphasis>boolean</emphasis></entry>
37378 <entry>Default: <emphasis>see below</emphasis></entry>
37379 </row>
37380 </tbody>
37381 </tgroup>
37382 </informaltable>
37383 <para>
37384 This option controls the use of the <function>fcntl()</function> function to lock a file for
37385 exclusive use when a message is being appended. It is set by default unless
37386 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
37387 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
37388 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
37389 </para>
37390 <para>
37391 <indexterm role="option">
37392 <primary>use_flock_lock</primary>
37393 </indexterm>
37394 </para>
37395 <informaltable frame="all">
37396 <tgroup cols="4" colsep="0" rowsep="0">
37397 <colspec colwidth="8*" align="left"/>
37398 <colspec colwidth="5*" align="center"/>
37399 <colspec colwidth="5*" align="center"/>
37400 <colspec colwidth="6*" align="right"/>
37401 <tbody>
37402 <row>
37403 <entry><option>use_flock_lock</option></entry>
37404 <entry>Use: <emphasis>appendfile</emphasis></entry>
37405 <entry>Type: <emphasis>boolean</emphasis></entry>
37406 <entry>Default: <emphasis>false</emphasis></entry>
37407 </row>
37408 </tbody>
37409 </tgroup>
37410 </informaltable>
37411 <para>
37412 This option is provided to support the use of <function>flock()</function> for file locking, for
37413 the few situations where it is needed. Most modern operating systems support
37414 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
37415 each other. Exim uses <function>fcntl()</function> locking by default.
37416 </para>
37417 <para>
37418 This option is required only if you are using an operating system where
37419 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
37420 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
37421 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
37422 </para>
37423 <para>
37424 <indexterm role="concept">
37425 <primary>Solaris</primary>
37426 <secondary><function>flock()</function> support</secondary>
37427 </indexterm>
37428 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
37429 have it (and some, I think, provide a not quite right version built on top of
37430 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
37431 the ability to use it, and any attempt to do so will cause a configuration
37432 error.
37433 </para>
37434 <para>
37435 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
37436 is just being mapped onto <function>fcntl()</function> by the OS).
37437 </para>
37438 <para>
37439 <indexterm role="option">
37440 <primary>use_lockfile</primary>
37441 </indexterm>
37442 </para>
37443 <informaltable frame="all">
37444 <tgroup cols="4" colsep="0" rowsep="0">
37445 <colspec colwidth="8*" align="left"/>
37446 <colspec colwidth="5*" align="center"/>
37447 <colspec colwidth="5*" align="center"/>
37448 <colspec colwidth="6*" align="right"/>
37449 <tbody>
37450 <row>
37451 <entry><option>use_lockfile</option></entry>
37452 <entry>Use: <emphasis>appendfile</emphasis></entry>
37453 <entry>Type: <emphasis>boolean</emphasis></entry>
37454 <entry>Default: <emphasis>see below</emphasis></entry>
37455 </row>
37456 </tbody>
37457 </tgroup>
37458 </informaltable>
37459 <para>
37460 If this option is turned off, Exim does not attempt to create a lock file when
37461 appending to a mailbox file. In this situation, the only locking is by
37462 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
37463 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
37464 <function>fcntl()</function> rather than a lock file, and even then only when you are not
37465 delivering over NFS from more than one host.
37466 </para>
37467 <para>
37468 <indexterm role="concept">
37469 <primary>NFS</primary>
37470 <secondary>lock file</secondary>
37471 </indexterm>
37472 In order to append to an NFS file safely from more than one host, it is
37473 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
37474 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
37475 file corruption.
37476 </para>
37477 <para>
37478 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
37479 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
37480 except when <option>mbx_format</option> is set.
37481 </para>
37482 <para>
37483 <indexterm role="option">
37484 <primary>use_mbx_lock</primary>
37485 </indexterm>
37486 </para>
37487 <informaltable frame="all">
37488 <tgroup cols="4" colsep="0" rowsep="0">
37489 <colspec colwidth="8*" align="left"/>
37490 <colspec colwidth="5*" align="center"/>
37491 <colspec colwidth="5*" align="center"/>
37492 <colspec colwidth="6*" align="right"/>
37493 <tbody>
37494 <row>
37495 <entry><option>use_mbx_lock</option></entry>
37496 <entry>Use: <emphasis>appendfile</emphasis></entry>
37497 <entry>Type: <emphasis>boolean</emphasis></entry>
37498 <entry>Default: <emphasis>see below</emphasis></entry>
37499 </row>
37500 </tbody>
37501 </tgroup>
37502 </informaltable>
37503 <para>
37504 This option is available only if Exim has been compiled with SUPPORT_MBX
37505 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
37506 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
37507 of the locking options are mentioned in the configuration. The locking rules
37508 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
37509 the IMAP4 and POP daemons that come with it (see the discussion below). The
37510 rules allow for shared access to the mailbox. However, this kind of locking
37511 does not work when the mailbox is NFS mounted.
37512 </para>
37513 <para>
37514 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
37515 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
37516 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
37517 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
37518 </para>
37519 </section>
37520 <section id="SECTopappend">
37521 <title>Operational details for appending</title>
37522 <para>
37523 <indexterm role="concept">
37524 <primary>appending to a file</primary>
37525 </indexterm>
37526 <indexterm role="concept">
37527 <primary>file</primary>
37528 <secondary>appending</secondary>
37529 </indexterm>
37530 Before appending to a file, the following preparations are made:
37531 </para>
37532 <itemizedlist>
37533 <listitem>
37534 <para>
37535 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
37536 return is given.
37537 </para>
37538 </listitem>
37539 <listitem>
37540 <para>
37541 <indexterm role="concept">
37542 <primary>directory creation</primary>
37543 </indexterm>
37544 If any directories on the file&#x2019;s path are missing, Exim creates them if the
37545 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
37546 <option>directory_mode</option> option.
37547 </para>
37548 </listitem>
37549 <listitem>
37550 <para>
37551 If <option>file_format</option> is set, the format of an existing file is checked. If this
37552 indicates that a different transport should be used, control is passed to that
37553 transport.
37554 </para>
37555 </listitem>
37556 <listitem>
37557 <para>
37558 <indexterm role="concept">
37559 <primary>file</primary>
37560 <secondary>locking</secondary>
37561 </indexterm>
37562 <indexterm role="concept">
37563 <primary>locking files</primary>
37564 </indexterm>
37565 <indexterm role="concept">
37566 <primary>NFS</primary>
37567 <secondary>lock file</secondary>
37568 </indexterm>
37569 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
37570 reliably over NFS, as follows:
37571 </para>
37572 <orderedlist numeration="arabic">
37573 <listitem>
37574 <para>
37575 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
37576 current time, primary host name, and process id added, by opening for writing
37577 as a new file. If this fails with an access error, delivery is deferred.
37578 </para>
37579 </listitem>
37580 <listitem>
37581 <para>
37582 Close the hitching post file, and hard link it to the lock file name.
37583 </para>
37584 </listitem>
37585 <listitem>
37586 <para>
37587 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
37588 Unlink the hitching post name.
37589 </para>
37590 </listitem>
37591 <listitem>
37592 <para>
37593 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
37594 then unlink hitching post name. If the number of links is exactly two, creation
37595 of the lock file succeeded but something (for example, an NFS server crash and
37596 restart) caused this fact not to be communicated to the <function>link()</function> call.
37597 </para>
37598 </listitem>
37599 <listitem>
37600 <para>
37601 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
37602 up to <option>lock_retries</option> times. However, since any program that writes to a
37603 mailbox should complete its task very quickly, it is reasonable to time out old
37604 lock files that are normally the result of user agent and system crashes. If an
37605 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
37606 it before trying again.
37607 </para>
37608 </listitem>
37609 </orderedlist>
37610 </listitem>
37611 <listitem>
37612 <para>
37613 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
37614 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
37615 than non-existence, delivery is deferred.
37616 </para>
37617 </listitem>
37618 <listitem>
37619 <para>
37620 <indexterm role="concept">
37621 <primary>symbolic link</primary>
37622 <secondary>to mailbox</secondary>
37623 </indexterm>
37624 <indexterm role="concept">
37625 <primary>mailbox</primary>
37626 <secondary>symbolic link</secondary>
37627 </indexterm>
37628 If the file does exist and is a symbolic link, delivery is deferred, unless the
37629 <option>allow_symlink</option> option is set, in which case the ownership of the link is
37630 checked, and then <function>stat()</function> is called to find out about the real file, which
37631 is then subjected to the checks below. The check on the top-level link
37632 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
37633 directory, though allowing symbolic links in this case is definitely not a good
37634 idea. If there is a chain of symbolic links, the intermediate ones are not
37635 checked.
37636 </para>
37637 </listitem>
37638 <listitem>
37639 <para>
37640 If the file already exists but is not a regular file, or if the file&#x2019;s owner
37641 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
37642 different from the user and group under which the delivery is running,
37643 delivery is deferred.
37644 </para>
37645 </listitem>
37646 <listitem>
37647 <para>
37648 If the file&#x2019;s permissions are more generous than specified, they are reduced.
37649 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
37650 is set false, in which case the delivery is tried using the existing
37651 permissions.
37652 </para>
37653 </listitem>
37654 <listitem>
37655 <para>
37656 The file&#x2019;s inode number is saved, and the file is then opened for appending.
37657 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
37658 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
37659 </para>
37660 </listitem>
37661 <listitem>
37662 <para>
37663 If the file is opened successfully, check that the inode number hasn&#x2019;t
37664 changed, that it is still a regular file, and that the owner and permissions
37665 have not changed. If anything is wrong, defer delivery and freeze the message.
37666 </para>
37667 </listitem>
37668 <listitem>
37669 <para>
37670 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
37671 option is set. Otherwise, check that the file is being created in a permitted
37672 directory if the <option>create_file</option> option is set (deferring on failure), and then
37673 open for writing as a new file, with the O_EXCL and O_CREAT options,
37674 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
37675 set). In this case, which can happen if the link points to a non-existent file,
37676 the file is opened for writing using O_CREAT but not O_EXCL, because
37677 that prevents link following.
37678 </para>
37679 </listitem>
37680 <listitem>
37681 <para>
37682 <indexterm role="concept">
37683 <primary>loop</primary>
37684 <secondary>while file testing</secondary>
37685 </indexterm>
37686 If opening fails because the file exists, obey the tests given above for
37687 existing files. However, to avoid looping in a situation where the file is
37688 being continuously created and destroyed, the exists/not-exists loop is broken
37689 after 10 repetitions, and the message is then frozen.
37690 </para>
37691 </listitem>
37692 <listitem>
37693 <para>
37694 If opening fails with any other error, defer delivery.
37695 </para>
37696 </listitem>
37697 <listitem>
37698 <para>
37699 <indexterm role="concept">
37700 <primary>file</primary>
37701 <secondary>locking</secondary>
37702 </indexterm>
37703 <indexterm role="concept">
37704 <primary>locking files</primary>
37705 </indexterm>
37706 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
37707 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
37708 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
37709 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
37710 file, and an exclusive lock on the file whose name is
37711 </para>
37712 <literallayout class="monospaced">
37713 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
37714 </literallayout>
37715 <para>
37716 using the device and inode numbers of the open mailbox file, in accordance with
37717 the MBX locking rules. This file is created with a mode that is specified by
37718 the <option>lockfile_mode</option> option.
37719 </para>
37720 <para>
37721 If Exim fails to lock the file, there are two possible courses of action,
37722 depending on the value of the locking timeout. This is obtained from
37723 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
37724 </para>
37725 <para>
37726 If the timeout value is zero, the file is closed, Exim waits for
37727 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
37728 to lock it again. This happens up to <option>lock_retries</option> times, after which the
37729 delivery is deferred.
37730 </para>
37731 <para>
37732 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
37733 <function>flock()</function> are used (with the given timeout), so there has already been some
37734 waiting involved by the time locking fails. Nevertheless, Exim does not give up
37735 immediately. It retries up to
37736 </para>
37737 <literallayout class="monospaced">
37738 (lock_retries * lock_interval) / &lt;timeout&gt;
37739 </literallayout>
37740 <para>
37741 times (rounded up).
37742 </para>
37743 </listitem>
37744 </itemizedlist>
37745 <para>
37746 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
37747 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
37748 </para>
37749 </section>
37750 <section id="SECTopdir">
37751 <title>Operational details for delivery to a new file</title>
37752 <para>
37753 <indexterm role="concept">
37754 <primary>delivery</primary>
37755 <secondary>to single file</secondary>
37756 </indexterm>
37757 <indexterm role="concept">
37758 <primary><quote>From</quote> line</primary>
37759 </indexterm>
37760 When the <option>directory</option> option is set instead of <option>file</option>, each message is
37761 delivered into a newly-created file or set of files. When <command>appendfile</command> is
37762 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
37763 <option>directory</option> is normally set, because the path for delivery is supplied by the
37764 router. (See for example, the <command>address_file</command> transport in the default
37765 configuration.) In this case, delivery is to a new file if either the path name
37766 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
37767 </para>
37768 <para>
37769 No locking is required while writing the message to a new file, so the various
37770 locking options of the transport are ignored. The <quote>From</quote> line that by default
37771 separates messages in a single file is not normally needed, nor is the escaping
37772 of message lines that start with <quote>From</quote>, and there is no need to ensure a
37773 newline at the end of each message. Consequently, the default values for
37774 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
37775 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
37776 </para>
37777 <para>
37778 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
37779 the files in the delivery directory by default. However, you can specify a
37780 different directory by setting <option>quota_directory</option>. Also, for maildir
37781 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
37782 </para>
37783 <para>
37784 <indexterm role="concept">
37785 <primary>maildir format</primary>
37786 </indexterm>
37787 <indexterm role="concept">
37788 <primary>mailstore format</primary>
37789 </indexterm>
37790 There are three different ways in which delivery to individual files can be
37791 done, controlled by the settings of the <option>maildir_format</option> and
37792 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
37793 formats is not included in the binary unless SUPPORT_MAILDIR or
37794 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
37795 </para>
37796 <para>
37797 <indexterm role="concept">
37798 <primary>directory creation</primary>
37799 </indexterm>
37800 In all three cases an attempt is made to create the directory and any necessary
37801 sub-directories if they do not exist, provided that the <option>create_directory</option>
37802 option is set (the default). The location of a created directory can be
37803 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
37804 the <option>directory_mode</option> option. If creation fails, or if the
37805 <option>create_directory</option> option is not set when creation is required, delivery is
37806 deferred.
37807 </para>
37808 </section>
37809 <section id="SECTmaildirdelivery">
37810 <title>Maildir delivery</title>
37811 <para>
37812 <indexterm role="concept">
37813 <primary>maildir format</primary>
37814 <secondary>description of</secondary>
37815 </indexterm>
37816 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
37817 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
37818 directory that is defined by the <option>directory</option> option (the <quote>delivery
37819 directory</quote>). If the delivery is successful, the file is renamed into the
37820 <filename>new</filename> subdirectory.
37821 </para>
37822 <para>
37823 In the file name, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
37824 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
37825 Exim checks that the time-of-day clock has moved on by at least one microsecond
37826 before terminating the delivery process. This guarantees uniqueness for the
37827 file name. However, as a precaution, Exim calls <function>stat()</function> for the file before
37828 opening it. If any response other than ENOENT (does not exist) is given,
37829 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
37830 </para>
37831 <para>
37832 Before Exim carries out a maildir delivery, it ensures that subdirectories
37833 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
37834 do not exist, Exim tries to create them and any superior directories in their
37835 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
37836 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
37837 contains matches the delivery directory, Exim also ensures that a file called
37838 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
37839 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
37840 </para>
37841 <para>
37842 These features make it possible to use Exim to create all the necessary files
37843 and directories in a maildir mailbox, including subdirectories for maildir++
37844 folders. Consider this example:
37845 </para>
37846 <literallayout class="monospaced">
37847 maildir_format = true
37848 directory = /var/mail/$local_part\
37849            ${if eq{$local_part_suffix}{}{}\
37850            {/.${substr_1:$local_part_suffix}}}
37851 maildirfolder_create_regex = /\.[^/]+$
37852 </literallayout>
37853 <para>
37854 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
37855 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
37856 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
37857 not match this name, so Exim will not look for or create the file
37858 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
37859 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
37860 </para>
37861 <para>
37862 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
37863 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
37864 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
37865 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
37866 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
37867 </para>
37868 <para>
37869 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
37870 not inadvertently match the toplevel maildir directory, because a
37871 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
37872 </para>
37873 <para>
37874 <indexterm role="concept">
37875 <primary>quota</primary>
37876 <secondary>in maildir delivery</secondary>
37877 </indexterm>
37878 <indexterm role="concept">
37879 <primary>maildir++</primary>
37880 </indexterm>
37881 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
37882 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
37883 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
37884 Exim assumes the directory is a maildir++ folder directory, which is one level
37885 down from the user&#x2019;s top level mailbox directory. This causes it to start at
37886 the parent directory instead of the current directory when calculating the
37887 amount of space used.
37888 </para>
37889 <para>
37890 One problem with delivering into a multi-file mailbox is that it is
37891 computationally expensive to compute the size of the mailbox for quota
37892 checking. Various approaches have been taken to reduce the amount of work
37893 needed. The next two sections describe two of them. A third alternative is to
37894 use some external process for maintaining the size data, and use the expansion
37895 of the <option>mailbox_size</option> option as a way of importing it into Exim.
37896 </para>
37897 </section>
37898 <section>
37899 <title>Using tags to record message sizes</title>
37900 <para>
37901 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
37902 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
37903 tag is added to its name. However, if adding the tag takes the length of the
37904 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
37905 the tag is dropped and the maildir file is created with no tag.
37906 </para>
37907 <para>
37908 <indexterm role="concept">
37909 <primary><varname>$message_size</varname></primary>
37910 </indexterm>
37911 Tags can be used to encode the size of files in their names; see
37912 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
37913 happens after the message has been written. The value of the <varname>$message_size</varname>
37914 variable is set to the number of bytes actually written. If the expansion is
37915 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
37916 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
37917 Non-printing characters in the string are ignored; if the resulting string is
37918 empty, it is ignored. If it starts with an alphanumeric character, a leading
37919 colon is inserted.
37920 </para>
37921 </section>
37922 <section>
37923 <title>Using a maildirsize file</title>
37924 <para>
37925 <indexterm role="concept">
37926 <primary>quota</primary>
37927 <secondary>in maildir delivery</secondary>
37928 </indexterm>
37929 <indexterm role="concept">
37930 <primary>maildir format</primary>
37931 <secondary><filename>maildirsize</filename> file</secondary>
37932 </indexterm>
37933 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
37934 storing quota and message size information in a file called <filename>maildirsize</filename>
37935 within the toplevel maildir directory. If this file does not exist, Exim
37936 creates it, setting the quota from the <option>quota</option> option of the transport. If
37937 the maildir directory itself does not exist, it is created before any attempt
37938 to write a <filename>maildirsize</filename> file.
37939 </para>
37940 <para>
37941 The <filename>maildirsize</filename> file is used to hold information about the sizes of
37942 messages in the maildir, thus speeding up quota calculations. The quota value
37943 in the file is just a cache; if the quota is changed in the transport, the new
37944 value overrides the cached value when the next message is delivered. The cache
37945 is maintained for the benefit of other programs that access the maildir and
37946 need to know the quota.
37947 </para>
37948 <para>
37949 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
37950 file is maintained (with a zero quota setting), but no quota is imposed.
37951 </para>
37952 <para>
37953 A regular expression is available for controlling which directories in the
37954 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
37955 See the description of the <option>maildir_quota_directory_regex</option> option above for
37956 details.
37957 </para>
37958 </section>
37959 <section>
37960 <title>Mailstore delivery</title>
37961 <para>
37962 <indexterm role="concept">
37963 <primary>mailstore format</primary>
37964 <secondary>description of</secondary>
37965 </indexterm>
37966 If the <option>mailstore_format</option> option is true, each message is written as two
37967 files in the given directory. A unique base name is constructed from the
37968 message id and the current delivery process, and the files that are written use
37969 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
37970 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
37971 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
37972 </para>
37973 <para>
37974 During delivery, the envelope is first written to a file with the suffix
37975 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
37976 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
37977 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
37978 file before accessing either of them. An alternative approach is to wait for
37979 the absence of a <filename>.tmp</filename> file.
37980 </para>
37981 <para>
37982 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
37983 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
37984 the sender address on one line, then all the recipient addresses, one per line.
37985 There can be more than one recipient only if the <option>batch_max</option> option is set
37986 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
37987 appended to the file, followed by a newline if it does not end with one.
37988 </para>
37989 <para>
37990 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
37991 failure, it is ignored. Other expansion errors are treated as serious
37992 configuration errors, and delivery is deferred. The variable
37993 <varname>$mailstore_basename</varname> is available for use during these expansions.
37994 </para>
37995 </section>
37996 <section>
37997 <title>Non-special new file delivery</title>
37998 <para>
37999 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
38000 file is created directly in the named directory. For example, when delivering
38001 messages into files in batched SMTP format for later delivery to some host (see
38002 section <xref linkend="SECTbatchSMTP"/>), a setting such as
38003 </para>
38004 <literallayout class="monospaced">
38005 directory = /var/bsmtp/$host
38006 </literallayout>
38007 <para>
38008 might be used. A message is written to a file with a temporary name, which is
38009 then renamed when the delivery is complete. The final name is obtained by
38010 expanding the contents of the <option>directory_file</option> option.
38011 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
38012 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
38013 </para>
38014 </section>
38015 </chapter>
38016
38017 <chapter>
38018 <title>The autoreply transport</title>
38019 <para>
38020 <indexterm role="concept" id="IIDauttra1" class="startofrange">
38021 <primary>transports</primary>
38022 <secondary><command>autoreply</command></secondary>
38023 </indexterm>
38024 <indexterm role="concept" id="IIDauttra2" class="startofrange">
38025 <primary><command>autoreply</command> transport</primary>
38026 </indexterm>
38027 The <command>autoreply</command> transport is not a true transport in that it does not cause
38028 the message to be transmitted. Instead, it generates a new mail message as an
38029 automatic reply to the incoming message. <emphasis>References:</emphasis> and
38030 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
38031 to the rules in RFCs 2822 and 3834, respectively.
38032 </para>
38033 <para>
38034 If the router that passes the message to this transport does not have the
38035 <option>unseen</option> option set, the original message (for the current recipient) is not
38036 delivered anywhere. However, when the <option>unseen</option> option is set on the router
38037 that passes the message to this transport, routing of the address continues, so
38038 another router can set up a normal message delivery.
38039 </para>
38040 <para>
38041 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
38042 <quote>vacation</quote> message being the standard example. However, it can also be run
38043 directly from a router like any other transport. To reduce the possibility of
38044 message cascades, messages created by the <command>autoreply</command> transport always have
38045 empty envelope sender addresses, like bounce messages.
38046 </para>
38047 <para>
38048 The parameters of the message to be sent can be specified in the configuration
38049 by options described below. However, these are used only when the address
38050 passed to the transport does not contain its own reply information. When the
38051 transport is run as a consequence of a
38052 <option>mail</option>
38053 or <option>vacation</option> command in a filter file, the parameters of the message are
38054 supplied by the filter, and passed with the address. The transport&#x2019;s options
38055 that define the message are then ignored (so they are not usually set in this
38056 case). The message is specified entirely by the filter or by the transport; it
38057 is never built from a mixture of options. However, the <option>file_optional</option>,
38058 <option>mode</option>, and <option>return_message</option> options apply in all cases.
38059 </para>
38060 <para>
38061 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
38062 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
38063 gid of the user, and with appropriate current and home directories (see chapter
38064 <xref linkend="CHAPenvironment"/>).
38065 </para>
38066 <para>
38067 There is a subtle difference between routing a message to a <command>pipe</command> transport
38068 that generates some text to be returned to the sender, and routing it to an
38069 <command>autoreply</command> transport. This difference is noticeable only if more than one
38070 address from the same message is so handled. In the case of a pipe, the
38071 separate outputs from the different addresses are gathered up and returned to
38072 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
38073 message is generated for each address that is passed to it.
38074 </para>
38075 <para>
38076 Non-printing characters are not permitted in the header lines generated for the
38077 message that <command>autoreply</command> creates, with the exception of newlines that are
38078 immediately followed by white space. If any non-printing characters are found,
38079 the transport defers.
38080 Whether characters with the top bit set count as printing characters or not is
38081 controlled by the <option>print_topbitchars</option> global option.
38082 </para>
38083 <para>
38084 If any of the generic options for manipulating headers (for example,
38085 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
38086 of the original message that is included in the generated message when
38087 <option>return_message</option> is set. They do not apply to the generated message itself.
38088 </para>
38089 <para>
38090 <indexterm role="concept">
38091 <primary><varname>$sender_address</varname></primary>
38092 </indexterm>
38093 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
38094 the message, indicating that there were no recipients, it does not treat this
38095 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
38096 is empty (because the incoming message is a bounce message) do not cause
38097 problems. They are just discarded.
38098 </para>
38099 <section>
38100 <title>Private options for autoreply</title>
38101 <para>
38102 <indexterm role="concept">
38103 <primary>options</primary>
38104 <secondary><command>autoreply</command> transport</secondary>
38105 </indexterm>
38106 </para>
38107 <para>
38108 <indexterm role="option">
38109 <primary>bcc</primary>
38110 </indexterm>
38111 </para>
38112 <informaltable frame="all">
38113 <tgroup cols="4" colsep="0" rowsep="0">
38114 <colspec colwidth="8*" align="left"/>
38115 <colspec colwidth="5*" align="center"/>
38116 <colspec colwidth="5*" align="center"/>
38117 <colspec colwidth="6*" align="right"/>
38118 <tbody>
38119 <row>
38120 <entry><option>bcc</option></entry>
38121 <entry>Use: <emphasis>autoreply</emphasis></entry>
38122 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38123 <entry>Default: <emphasis>unset</emphasis></entry>
38124 </row>
38125 </tbody>
38126 </tgroup>
38127 </informaltable>
38128 <para>
38129 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
38130 message when the message is specified by the transport.
38131 </para>
38132 <para>
38133 <indexterm role="option">
38134 <primary>cc</primary>
38135 </indexterm>
38136 </para>
38137 <informaltable frame="all">
38138 <tgroup cols="4" colsep="0" rowsep="0">
38139 <colspec colwidth="8*" align="left"/>
38140 <colspec colwidth="5*" align="center"/>
38141 <colspec colwidth="5*" align="center"/>
38142 <colspec colwidth="6*" align="right"/>
38143 <tbody>
38144 <row>
38145 <entry><option>cc</option></entry>
38146 <entry>Use: <emphasis>autoreply</emphasis></entry>
38147 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38148 <entry>Default: <emphasis>unset</emphasis></entry>
38149 </row>
38150 </tbody>
38151 </tgroup>
38152 </informaltable>
38153 <para>
38154 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
38155 when the message is specified by the transport.
38156 </para>
38157 <para>
38158 <indexterm role="option">
38159 <primary>file</primary>
38160 </indexterm>
38161 </para>
38162 <informaltable frame="all">
38163 <tgroup cols="4" colsep="0" rowsep="0">
38164 <colspec colwidth="8*" align="left"/>
38165 <colspec colwidth="5*" align="center"/>
38166 <colspec colwidth="5*" align="center"/>
38167 <colspec colwidth="6*" align="right"/>
38168 <tbody>
38169 <row>
38170 <entry><option>file</option></entry>
38171 <entry>Use: <emphasis>autoreply</emphasis></entry>
38172 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38173 <entry>Default: <emphasis>unset</emphasis></entry>
38174 </row>
38175 </tbody>
38176 </tgroup>
38177 </informaltable>
38178 <para>
38179 The contents of the file are sent as the body of the message when the message
38180 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
38181 string comes first.
38182 </para>
38183 <para>
38184 <indexterm role="option">
38185 <primary>file_expand</primary>
38186 </indexterm>
38187 </para>
38188 <informaltable frame="all">
38189 <tgroup cols="4" colsep="0" rowsep="0">
38190 <colspec colwidth="8*" align="left"/>
38191 <colspec colwidth="5*" align="center"/>
38192 <colspec colwidth="5*" align="center"/>
38193 <colspec colwidth="6*" align="right"/>
38194 <tbody>
38195 <row>
38196 <entry><option>file_expand</option></entry>
38197 <entry>Use: <emphasis>autoreply</emphasis></entry>
38198 <entry>Type: <emphasis>boolean</emphasis></entry>
38199 <entry>Default: <emphasis>false</emphasis></entry>
38200 </row>
38201 </tbody>
38202 </tgroup>
38203 </informaltable>
38204 <para>
38205 If this is set, the contents of the file named by the <option>file</option> option are
38206 subjected to string expansion as they are added to the message.
38207 </para>
38208 <para>
38209 <indexterm role="option">
38210 <primary>file_optional</primary>
38211 </indexterm>
38212 </para>
38213 <informaltable frame="all">
38214 <tgroup cols="4" colsep="0" rowsep="0">
38215 <colspec colwidth="8*" align="left"/>
38216 <colspec colwidth="5*" align="center"/>
38217 <colspec colwidth="5*" align="center"/>
38218 <colspec colwidth="6*" align="right"/>
38219 <tbody>
38220 <row>
38221 <entry><option>file_optional</option></entry>
38222 <entry>Use: <emphasis>autoreply</emphasis></entry>
38223 <entry>Type: <emphasis>boolean</emphasis></entry>
38224 <entry>Default: <emphasis>false</emphasis></entry>
38225 </row>
38226 </tbody>
38227 </tgroup>
38228 </informaltable>
38229 <para>
38230 If this option is true, no error is generated if the file named by the <option>file</option>
38231 option or passed with the address does not exist or cannot be read.
38232 </para>
38233 <para>
38234 <indexterm role="option">
38235 <primary>from</primary>
38236 </indexterm>
38237 </para>
38238 <informaltable frame="all">
38239 <tgroup cols="4" colsep="0" rowsep="0">
38240 <colspec colwidth="8*" align="left"/>
38241 <colspec colwidth="5*" align="center"/>
38242 <colspec colwidth="5*" align="center"/>
38243 <colspec colwidth="6*" align="right"/>
38244 <tbody>
38245 <row>
38246 <entry><option>from</option></entry>
38247 <entry>Use: <emphasis>autoreply</emphasis></entry>
38248 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38249 <entry>Default: <emphasis>unset</emphasis></entry>
38250 </row>
38251 </tbody>
38252 </tgroup>
38253 </informaltable>
38254 <para>
38255 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
38256 specified by the transport.
38257 </para>
38258 <para>
38259 <indexterm role="option">
38260 <primary>headers</primary>
38261 </indexterm>
38262 </para>
38263 <informaltable frame="all">
38264 <tgroup cols="4" colsep="0" rowsep="0">
38265 <colspec colwidth="8*" align="left"/>
38266 <colspec colwidth="5*" align="center"/>
38267 <colspec colwidth="5*" align="center"/>
38268 <colspec colwidth="6*" align="right"/>
38269 <tbody>
38270 <row>
38271 <entry><option>headers</option></entry>
38272 <entry>Use: <emphasis>autoreply</emphasis></entry>
38273 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38274 <entry>Default: <emphasis>unset</emphasis></entry>
38275 </row>
38276 </tbody>
38277 </tgroup>
38278 </informaltable>
38279 <para>
38280 This specifies additional RFC 2822 headers that are to be added to the message
38281 when the message is specified by the transport. Several can be given by using
38282 <quote>\n</quote> to separate them. There is no check on the format.
38283 </para>
38284 <para>
38285 <indexterm role="option">
38286 <primary>log</primary>
38287 </indexterm>
38288 </para>
38289 <informaltable frame="all">
38290 <tgroup cols="4" colsep="0" rowsep="0">
38291 <colspec colwidth="8*" align="left"/>
38292 <colspec colwidth="5*" align="center"/>
38293 <colspec colwidth="5*" align="center"/>
38294 <colspec colwidth="6*" align="right"/>
38295 <tbody>
38296 <row>
38297 <entry><option>log</option></entry>
38298 <entry>Use: <emphasis>autoreply</emphasis></entry>
38299 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38300 <entry>Default: <emphasis>unset</emphasis></entry>
38301 </row>
38302 </tbody>
38303 </tgroup>
38304 </informaltable>
38305 <para>
38306 This option names a file in which a record of every message sent is logged when
38307 the message is specified by the transport.
38308 </para>
38309 <para>
38310 <indexterm role="option">
38311 <primary>mode</primary>
38312 </indexterm>
38313 </para>
38314 <informaltable frame="all">
38315 <tgroup cols="4" colsep="0" rowsep="0">
38316 <colspec colwidth="8*" align="left"/>
38317 <colspec colwidth="5*" align="center"/>
38318 <colspec colwidth="5*" align="center"/>
38319 <colspec colwidth="6*" align="right"/>
38320 <tbody>
38321 <row>
38322 <entry><option>mode</option></entry>
38323 <entry>Use: <emphasis>autoreply</emphasis></entry>
38324 <entry>Type: <emphasis>octal integer</emphasis></entry>
38325 <entry>Default: <emphasis>0600</emphasis></entry>
38326 </row>
38327 </tbody>
38328 </tgroup>
38329 </informaltable>
38330 <para>
38331 If either the log file or the <quote>once</quote> file has to be created, this mode is
38332 used.
38333 </para>
38334 <para>
38335 <indexterm role="option">
38336 <primary>never_mail</primary>
38337 </indexterm>
38338 </para>
38339 <informaltable frame="all">
38340 <tgroup cols="4" colsep="0" rowsep="0">
38341 <colspec colwidth="8*" align="left"/>
38342 <colspec colwidth="5*" align="center"/>
38343 <colspec colwidth="5*" align="center"/>
38344 <colspec colwidth="6*" align="right"/>
38345 <tbody>
38346 <row>
38347 <entry><option>never_mail</option></entry>
38348 <entry>Use: <emphasis>autoreply</emphasis></entry>
38349 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
38350 <entry>Default: <emphasis>unset</emphasis></entry>
38351 </row>
38352 </tbody>
38353 </tgroup>
38354 </informaltable>
38355 <para>
38356 If any run of the transport creates a message with a recipient that matches any
38357 item in the list, that recipient is quietly discarded. If all recipients are
38358 discarded, no message is created. This applies both when the recipients are
38359 generated by a filter and when they are specified in the transport.
38360 </para>
38361 <para>
38362 <indexterm role="option">
38363 <primary>once</primary>
38364 </indexterm>
38365 </para>
38366 <informaltable frame="all">
38367 <tgroup cols="4" colsep="0" rowsep="0">
38368 <colspec colwidth="8*" align="left"/>
38369 <colspec colwidth="5*" align="center"/>
38370 <colspec colwidth="5*" align="center"/>
38371 <colspec colwidth="6*" align="right"/>
38372 <tbody>
38373 <row>
38374 <entry><option>once</option></entry>
38375 <entry>Use: <emphasis>autoreply</emphasis></entry>
38376 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38377 <entry>Default: <emphasis>unset</emphasis></entry>
38378 </row>
38379 </tbody>
38380 </tgroup>
38381 </informaltable>
38382 <para>
38383 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
38384 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
38385 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
38386 </para>
38387 <para>
38388 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
38389 By default, if <option>once</option> is set to a non-empty file name, the message
38390 is not sent if a potential recipient is already listed in the database.
38391 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
38392 message is sent if that much time has elapsed since a message was last sent to
38393 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
38394 prevents a message from being sent a second time &ndash; in this case, zero means
38395 infinity.
38396 </para>
38397 <para>
38398 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
38399 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
38400 greater than zero, it changes the way Exim implements the <option>once</option> option.
38401 Instead of using a DBM file to record every recipient it sends to, it uses a
38402 regular file, whose size will never get larger than the given value.
38403 </para>
38404 <para>
38405 In the file, Exim keeps a linear list of recipient addresses and the times at
38406 which they were sent messages. If the file is full when a new address needs to
38407 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
38408 means that a given recipient may receive multiple messages, but at
38409 unpredictable intervals that depend on the rate of turnover of addresses in the
38410 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
38411 </para>
38412 <para>
38413 <indexterm role="option">
38414 <primary>once_file_size</primary>
38415 </indexterm>
38416 </para>
38417 <informaltable frame="all">
38418 <tgroup cols="4" colsep="0" rowsep="0">
38419 <colspec colwidth="8*" align="left"/>
38420 <colspec colwidth="5*" align="center"/>
38421 <colspec colwidth="5*" align="center"/>
38422 <colspec colwidth="6*" align="right"/>
38423 <tbody>
38424 <row>
38425 <entry><option>once_file_size</option></entry>
38426 <entry>Use: <emphasis>autoreply</emphasis></entry>
38427 <entry>Type: <emphasis>integer</emphasis></entry>
38428 <entry>Default: <emphasis>0</emphasis></entry>
38429 </row>
38430 </tbody>
38431 </tgroup>
38432 </informaltable>
38433 <para>
38434 See <option>once</option> above.
38435 </para>
38436 <para>
38437 <indexterm role="option">
38438 <primary>once_repeat</primary>
38439 </indexterm>
38440 </para>
38441 <informaltable frame="all">
38442 <tgroup cols="4" colsep="0" rowsep="0">
38443 <colspec colwidth="8*" align="left"/>
38444 <colspec colwidth="5*" align="center"/>
38445 <colspec colwidth="5*" align="center"/>
38446 <colspec colwidth="6*" align="right"/>
38447 <tbody>
38448 <row>
38449 <entry><option>once_repeat</option></entry>
38450 <entry>Use: <emphasis>autoreply</emphasis></entry>
38451 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
38452 <entry>Default: <emphasis>0s</emphasis></entry>
38453 </row>
38454 </tbody>
38455 </tgroup>
38456 </informaltable>
38457 <para>
38458 See <option>once</option> above.
38459 After expansion, the value of this option must be a valid time value.
38460 </para>
38461 <para>
38462 <indexterm role="option">
38463 <primary>reply_to</primary>
38464 </indexterm>
38465 </para>
38466 <informaltable frame="all">
38467 <tgroup cols="4" colsep="0" rowsep="0">
38468 <colspec colwidth="8*" align="left"/>
38469 <colspec colwidth="5*" align="center"/>
38470 <colspec colwidth="5*" align="center"/>
38471 <colspec colwidth="6*" align="right"/>
38472 <tbody>
38473 <row>
38474 <entry><option>reply_to</option></entry>
38475 <entry>Use: <emphasis>autoreply</emphasis></entry>
38476 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38477 <entry>Default: <emphasis>unset</emphasis></entry>
38478 </row>
38479 </tbody>
38480 </tgroup>
38481 </informaltable>
38482 <para>
38483 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
38484 specified by the transport.
38485 </para>
38486 <para>
38487 <indexterm role="option">
38488 <primary>return_message</primary>
38489 </indexterm>
38490 </para>
38491 <informaltable frame="all">
38492 <tgroup cols="4" colsep="0" rowsep="0">
38493 <colspec colwidth="8*" align="left"/>
38494 <colspec colwidth="5*" align="center"/>
38495 <colspec colwidth="5*" align="center"/>
38496 <colspec colwidth="6*" align="right"/>
38497 <tbody>
38498 <row>
38499 <entry><option>return_message</option></entry>
38500 <entry>Use: <emphasis>autoreply</emphasis></entry>
38501 <entry>Type: <emphasis>boolean</emphasis></entry>
38502 <entry>Default: <emphasis>false</emphasis></entry>
38503 </row>
38504 </tbody>
38505 </tgroup>
38506 </informaltable>
38507 <para>
38508 If this is set, a copy of the original message is returned with the new
38509 message, subject to the maximum size set in the <option>return_size_limit</option> global
38510 configuration option.
38511 </para>
38512 <para>
38513 <indexterm role="option">
38514 <primary>subject</primary>
38515 </indexterm>
38516 </para>
38517 <informaltable frame="all">
38518 <tgroup cols="4" colsep="0" rowsep="0">
38519 <colspec colwidth="8*" align="left"/>
38520 <colspec colwidth="5*" align="center"/>
38521 <colspec colwidth="5*" align="center"/>
38522 <colspec colwidth="6*" align="right"/>
38523 <tbody>
38524 <row>
38525 <entry><option>subject</option></entry>
38526 <entry>Use: <emphasis>autoreply</emphasis></entry>
38527 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38528 <entry>Default: <emphasis>unset</emphasis></entry>
38529 </row>
38530 </tbody>
38531 </tgroup>
38532 </informaltable>
38533 <para>
38534 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
38535 specified by the transport. It is tempting to quote the original subject in
38536 automatic responses. For example:
38537 </para>
38538 <literallayout class="monospaced">
38539 subject = Re: $h_subject:
38540 </literallayout>
38541 <para>
38542 There is a danger in doing this, however. It may allow a third party to
38543 subscribe your users to an opt-in mailing list, provided that the list accepts
38544 bounce messages as subscription confirmations. Well-managed lists require a
38545 non-bounce message to confirm a subscription, so the danger is relatively
38546 small.
38547 </para>
38548 <para>
38549 <indexterm role="option">
38550 <primary>text</primary>
38551 </indexterm>
38552 </para>
38553 <informaltable frame="all">
38554 <tgroup cols="4" colsep="0" rowsep="0">
38555 <colspec colwidth="8*" align="left"/>
38556 <colspec colwidth="5*" align="center"/>
38557 <colspec colwidth="5*" align="center"/>
38558 <colspec colwidth="6*" align="right"/>
38559 <tbody>
38560 <row>
38561 <entry><option>text</option></entry>
38562 <entry>Use: <emphasis>autoreply</emphasis></entry>
38563 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38564 <entry>Default: <emphasis>unset</emphasis></entry>
38565 </row>
38566 </tbody>
38567 </tgroup>
38568 </informaltable>
38569 <para>
38570 This specifies a single string to be used as the body of the message when the
38571 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
38572 the text comes first.
38573 </para>
38574 <para>
38575 <indexterm role="option">
38576 <primary>to</primary>
38577 </indexterm>
38578 </para>
38579 <informaltable frame="all">
38580 <tgroup cols="4" colsep="0" rowsep="0">
38581 <colspec colwidth="8*" align="left"/>
38582 <colspec colwidth="5*" align="center"/>
38583 <colspec colwidth="5*" align="center"/>
38584 <colspec colwidth="6*" align="right"/>
38585 <tbody>
38586 <row>
38587 <entry><option>to</option></entry>
38588 <entry>Use: <emphasis>autoreply</emphasis></entry>
38589 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38590 <entry>Default: <emphasis>unset</emphasis></entry>
38591 </row>
38592 </tbody>
38593 </tgroup>
38594 </informaltable>
38595 <para>
38596 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
38597 when the message is specified by the transport.
38598 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
38599 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
38600 </para>
38601 </section>
38602 </chapter>
38603
38604 <chapter id="CHAPLMTP">
38605 <title>The lmtp transport</title>
38606 <para>
38607 <indexterm role="concept">
38608 <primary>transports</primary>
38609 <secondary><command>lmtp</command></secondary>
38610 </indexterm>
38611 <indexterm role="concept">
38612 <primary><command>lmtp</command> transport</primary>
38613 </indexterm>
38614 <indexterm role="concept">
38615 <primary>LMTP</primary>
38616 <secondary>over a pipe</secondary>
38617 </indexterm>
38618 <indexterm role="concept">
38619 <primary>LMTP</primary>
38620 <secondary>over a socket</secondary>
38621 </indexterm>
38622 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
38623 specified command
38624 or by interacting with a Unix domain socket.
38625 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
38626 transports. Exim also has support for using LMTP over TCP/IP; this is
38627 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
38628 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
38629 has it commented out. You need to ensure that
38630 </para>
38631 <literallayout class="monospaced">
38632 TRANSPORT_LMTP=yes
38633 </literallayout>
38634 <para>
38635 <indexterm role="concept">
38636 <primary>options</primary>
38637 <secondary><command>lmtp</command> transport</secondary>
38638 </indexterm>
38639 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
38640 included in the Exim binary. The private options of the <command>lmtp</command> transport are
38641 as follows:
38642 </para>
38643 <para>
38644 <indexterm role="option">
38645 <primary>batch_id</primary>
38646 </indexterm>
38647 </para>
38648 <informaltable frame="all">
38649 <tgroup cols="4" colsep="0" rowsep="0">
38650 <colspec colwidth="8*" align="left"/>
38651 <colspec colwidth="5*" align="center"/>
38652 <colspec colwidth="5*" align="center"/>
38653 <colspec colwidth="6*" align="right"/>
38654 <tbody>
38655 <row>
38656 <entry><option>batch_id</option></entry>
38657 <entry>Use: <emphasis>lmtp</emphasis></entry>
38658 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38659 <entry>Default: <emphasis>unset</emphasis></entry>
38660 </row>
38661 </tbody>
38662 </tgroup>
38663 </informaltable>
38664 <para>
38665 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
38666 </para>
38667 <para>
38668 <indexterm role="option">
38669 <primary>batch_max</primary>
38670 </indexterm>
38671 </para>
38672 <informaltable frame="all">
38673 <tgroup cols="4" colsep="0" rowsep="0">
38674 <colspec colwidth="8*" align="left"/>
38675 <colspec colwidth="5*" align="center"/>
38676 <colspec colwidth="5*" align="center"/>
38677 <colspec colwidth="6*" align="right"/>
38678 <tbody>
38679 <row>
38680 <entry><option>batch_max</option></entry>
38681 <entry>Use: <emphasis>lmtp</emphasis></entry>
38682 <entry>Type: <emphasis>integer</emphasis></entry>
38683 <entry>Default: <emphasis>1</emphasis></entry>
38684 </row>
38685 </tbody>
38686 </tgroup>
38687 </informaltable>
38688 <para>
38689 This limits the number of addresses that can be handled in a single delivery.
38690 Most LMTP servers can handle several addresses at once, so it is normally a
38691 good idea to increase this value. See the description of local delivery
38692 batching in chapter <xref linkend="CHAPbatching"/>.
38693 </para>
38694 <para>
38695 <indexterm role="option">
38696 <primary>command</primary>
38697 </indexterm>
38698 </para>
38699 <informaltable frame="all">
38700 <tgroup cols="4" colsep="0" rowsep="0">
38701 <colspec colwidth="8*" align="left"/>
38702 <colspec colwidth="5*" align="center"/>
38703 <colspec colwidth="5*" align="center"/>
38704 <colspec colwidth="6*" align="right"/>
38705 <tbody>
38706 <row>
38707 <entry><option>command</option></entry>
38708 <entry>Use: <emphasis>lmtp</emphasis></entry>
38709 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38710 <entry>Default: <emphasis>unset</emphasis></entry>
38711 </row>
38712 </tbody>
38713 </tgroup>
38714 </informaltable>
38715 <para>
38716 This option must be set if <option>socket</option> is not set. The string is a command which
38717 is run in a separate process. It is split up into a command name and list of
38718 arguments, each of which is separately expanded (so expansion cannot change the
38719 number of arguments). The command is run directly, not via a shell. The message
38720 is passed to the new process using the standard input and output to operate the
38721 LMTP protocol.
38722 </para>
38723 <para>
38724 <indexterm role="option">
38725 <primary>ignore_quota</primary>
38726 </indexterm>
38727 </para>
38728 <informaltable frame="all">
38729 <tgroup cols="4" colsep="0" rowsep="0">
38730 <colspec colwidth="8*" align="left"/>
38731 <colspec colwidth="5*" align="center"/>
38732 <colspec colwidth="5*" align="center"/>
38733 <colspec colwidth="6*" align="right"/>
38734 <tbody>
38735 <row>
38736 <entry><option>ignore_quota</option></entry>
38737 <entry>Use: <emphasis>lmtp</emphasis></entry>
38738 <entry>Type: <emphasis>boolean</emphasis></entry>
38739 <entry>Default: <emphasis>false</emphasis></entry>
38740 </row>
38741 </tbody>
38742 </tgroup>
38743 </informaltable>
38744 <para>
38745 <indexterm role="concept">
38746 <primary>LMTP</primary>
38747 <secondary>ignoring quota errors</secondary>
38748 </indexterm>
38749 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
38750 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
38751 in its response to the LHLO command.
38752 </para>
38753 <para>
38754 <indexterm role="option">
38755 <primary>socket</primary>
38756 </indexterm>
38757 </para>
38758 <informaltable frame="all">
38759 <tgroup cols="4" colsep="0" rowsep="0">
38760 <colspec colwidth="8*" align="left"/>
38761 <colspec colwidth="5*" align="center"/>
38762 <colspec colwidth="5*" align="center"/>
38763 <colspec colwidth="6*" align="right"/>
38764 <tbody>
38765 <row>
38766 <entry><option>socket</option></entry>
38767 <entry>Use: <emphasis>lmtp</emphasis></entry>
38768 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38769 <entry>Default: <emphasis>unset</emphasis></entry>
38770 </row>
38771 </tbody>
38772 </tgroup>
38773 </informaltable>
38774 <para>
38775 This option must be set if <option>command</option> is not set. The result of expansion must
38776 be the name of a Unix domain socket. The transport connects to the socket and
38777 delivers the message to it using the LMTP protocol.
38778 </para>
38779 <para>
38780 <indexterm role="option">
38781 <primary>timeout</primary>
38782 </indexterm>
38783 </para>
38784 <informaltable frame="all">
38785 <tgroup cols="4" colsep="0" rowsep="0">
38786 <colspec colwidth="8*" align="left"/>
38787 <colspec colwidth="5*" align="center"/>
38788 <colspec colwidth="5*" align="center"/>
38789 <colspec colwidth="6*" align="right"/>
38790 <tbody>
38791 <row>
38792 <entry><option>timeout</option></entry>
38793 <entry>Use: <emphasis>lmtp</emphasis></entry>
38794 <entry>Type: <emphasis>time</emphasis></entry>
38795 <entry>Default: <emphasis>5m</emphasis></entry>
38796 </row>
38797 </tbody>
38798 </tgroup>
38799 </informaltable>
38800 <para>
38801 The transport is aborted if the created process
38802 or Unix domain socket
38803 does not respond to LMTP commands or message input within this timeout.
38804 </para>
38805 <para>
38806 Here is an example of a typical LMTP transport:
38807 </para>
38808 <literallayout class="monospaced">
38809 lmtp:
38810   driver = lmtp
38811   command = /some/local/lmtp/delivery/program
38812   batch_max = 20
38813   user = exim
38814 </literallayout>
38815 <para>
38816 This delivers up to 20 addresses at a time, in a mixture of domains if
38817 necessary, running as the user <emphasis>exim</emphasis>.
38818 </para>
38819 </chapter>
38820
38821 <chapter id="CHAPpipetransport">
38822 <title>The pipe transport</title>
38823 <para>
38824 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
38825 <primary>transports</primary>
38826 <secondary><command>pipe</command></secondary>
38827 </indexterm>
38828 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
38829 <primary><command>pipe</command> transport</primary>
38830 </indexterm>
38831 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
38832 running in another process. One example is the use of <command>pipe</command> as a
38833 pseudo-remote transport for passing messages to some other delivery mechanism
38834 (such as UUCP). Another is the use by individual users to automatically process
38835 their incoming messages. The <command>pipe</command> transport can be used in one of the
38836 following ways:
38837 </para>
38838 <itemizedlist>
38839 <listitem>
38840 <para>
38841 <indexterm role="concept">
38842 <primary><varname>$local_part</varname></primary>
38843 </indexterm>
38844 A router routes one address to a transport in the normal way, and the
38845 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
38846 contains the local part of the address (as usual), and the command that is run
38847 is specified by the <option>command</option> option on the transport.
38848 </para>
38849 </listitem>
38850 <listitem>
38851 <para>
38852 <indexterm role="concept">
38853 <primary><varname>$pipe_addresses</varname></primary>
38854 </indexterm>
38855 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
38856 transport can handle more than one address in a single run. In this case, when
38857 more than one address is routed to the transport, <varname>$local_part</varname> is not set
38858 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
38859 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
38860 that are routed to the transport.
38861 </para>
38862 </listitem>
38863 <listitem>
38864 <para>
38865 <indexterm role="concept">
38866 <primary><varname>$address_pipe</varname></primary>
38867 </indexterm>
38868 A router redirects an address directly to a pipe command (for example, from an
38869 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
38870 pipe command, and the <option>command</option> option on the transport is ignored. If only
38871 one address is being transported (<option>batch_max</option> is not greater than one, or
38872 only one address was redirected to this pipe command), <varname>$local_part</varname> contains
38873 the local part that was redirected.
38874 </para>
38875 </listitem>
38876 </itemizedlist>
38877 <para>
38878 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
38879 deliver messages over pipes using the LMTP interactive protocol. This is
38880 implemented by the <command>lmtp</command> transport.
38881 </para>
38882 <para>
38883 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
38884 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
38885 other cases, the uid and gid have to be specified explicitly, either on the
38886 transport or on the router that handles the address. Current and <quote>home</quote>
38887 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
38888 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
38889 for a discussion of local delivery batching.
38890 </para>
38891 <section>
38892 <title>Concurrent delivery</title>
38893 <para>
38894 If two messages arrive at almost the same time, and both are routed to a pipe
38895 delivery, the two pipe transports may be run concurrently. You must ensure that
38896 any pipe commands you set up are robust against this happening. If the commands
38897 write to a file, the <option>exim_lock</option> utility might be of use.
38898 </para>
38899 </section>
38900 <section>
38901 <title>Returned status and data</title>
38902 <para>
38903 <indexterm role="concept">
38904 <primary><command>pipe</command> transport</primary>
38905 <secondary>returned data</secondary>
38906 </indexterm>
38907 If the command exits with a non-zero return code, the delivery is deemed to
38908 have failed, unless either the <option>ignore_status</option> option is set (in which case
38909 the return code is treated as zero), or the return code is one of those listed
38910 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
38911 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
38912 logged, but are not included in the bounce message, which merely contains
38913 <quote>local delivery failed</quote>.
38914 </para>
38915 <para>
38916 If the return code is greater than 128 and the command being run is a shell
38917 script, it normally means that the script was terminated by a signal whose
38918 value is the return code minus 128.
38919 </para>
38920 <para>
38921 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
38922 return code is set to 127. This is the value that a shell returns if it is
38923 asked to run a non-existent command. The wording for the log line suggests that
38924 a non-existent command may be the problem.
38925 </para>
38926 <para>
38927 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
38928 set and the command produces any output on its standard output or standard
38929 error streams, the command is considered to have failed, even if it gave a zero
38930 return code or if <option>ignore_status</option> is set. The output from the command is
38931 included as part of the bounce message. The <option>return_fail_output</option> option is
38932 similar, except that output is returned only when the command exits with a
38933 failure return code, that is, a value other than zero or a code that matches
38934 <option>temp_errors</option>.
38935 </para>
38936 </section>
38937 <section id="SECThowcommandrun">
38938 <title>How the command is run</title>
38939 <para>
38940 <indexterm role="concept">
38941 <primary><command>pipe</command> transport</primary>
38942 <secondary>path for command</secondary>
38943 </indexterm>
38944 The command line is (by default) broken down into a command name and arguments
38945 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
38946 <option>restrict_to_path</option> options can be used to restrict the commands that may be
38947 run.
38948 </para>
38949 <para>
38950 <indexterm role="concept">
38951 <primary>quoting</primary>
38952 <secondary>in pipe command</secondary>
38953 </indexterm>
38954 Unquoted arguments are delimited by white space. If an argument appears in
38955 double quotes, backslash is interpreted as an escape character in the usual
38956 way. If an argument appears in single quotes, no escaping is done.
38957 </para>
38958 <para>
38959 String expansion is applied to the command line except when it comes from a
38960 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
38961 expansion is applied to each argument in turn rather than to the whole line.
38962 For this reason, any string expansion item that contains white space must be
38963 quoted so as to be contained within a single argument. A setting such as
38964 </para>
38965 <literallayout class="monospaced">
38966 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
38967 </literallayout>
38968 <para>
38969 will not work, because the expansion item gets split between several
38970 arguments. You have to write
38971 </para>
38972 <literallayout class="monospaced">
38973 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
38974 </literallayout>
38975 <para>
38976 to ensure that it is all in one argument. The expansion is done in this way,
38977 argument by argument, so that the number of arguments cannot be changed as a
38978 result of expansion, and quotes or backslashes in inserted variables do not
38979 interact with external quoting. However, this leads to problems if you want to
38980 generate multiple arguments (or the command name plus arguments) from a single
38981 expansion. In this situation, the simplest solution is to use a shell. For
38982 example:
38983 </para>
38984 <literallayout class="monospaced">
38985 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
38986 </literallayout>
38987 <para>
38988 <indexterm role="concept">
38989 <primary>transport</primary>
38990 <secondary>filter</secondary>
38991 </indexterm>
38992 <indexterm role="concept">
38993 <primary>filter</primary>
38994 <secondary>transport filter</secondary>
38995 </indexterm>
38996 <indexterm role="concept">
38997 <primary><varname>$pipe_addresses</varname></primary>
38998 </indexterm>
38999 Special handling takes place when an argument consists of precisely the text
39000 <literal>$pipe_addresses</literal>. This is not a general expansion variable; the only
39001 place this string is recognized is when it appears as an argument for a pipe or
39002 transport filter command. It causes each address that is being handled to be
39003 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
39004 avoids any problems with spaces or shell metacharacters, and is of use when a
39005 <command>pipe</command> transport is handling groups of addresses in a batch.
39006 </para>
39007 <para>
39008 After splitting up into arguments and expansion, the resulting command is run
39009 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
39010 message that is being delivered is supplied on the standard input, and the
39011 standard output and standard error are both connected to a single pipe that is
39012 read by Exim. The <option>max_output</option> option controls how much output the command
39013 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
39014 control what is done with it.
39015 </para>
39016 <para>
39017 Not running the command under a shell (by default) lessens the security risks
39018 in cases when a command from a user&#x2019;s filter file is built out of data that was
39019 taken from an incoming message. If a shell is required, it can of course be
39020 explicitly specified as the command to be run. However, there are circumstances
39021 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
39022 under a shell and cannot easily be modified. To allow for these cases, there is
39023 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
39024 works. Instead of breaking up the command line as just described, it expands it
39025 as a single string and passes the result to <filename>/bin/sh</filename>. The
39026 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
39027 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
39028 </para>
39029 </section>
39030 <section id="SECTpipeenv">
39031 <title>Environment variables</title>
39032 <para>
39033 <indexterm role="concept">
39034 <primary><command>pipe</command> transport</primary>
39035 <secondary>environment for command</secondary>
39036 </indexterm>
39037 <indexterm role="concept">
39038 <primary>environment for pipe transport</primary>
39039 </indexterm>
39040 The environment variables listed below are set up when the command is invoked.
39041 This list is a compromise for maximum compatibility with other MTAs. Note that
39042 the <option>environment</option> option can be used to add additional variables to this
39043 environment.
39044 </para>
39045 <literallayout>
39046 <literal>DOMAIN            </literal>   the domain of the address
39047 <literal>HOME              </literal>   the home directory, if set
39048 <literal>HOST              </literal>   the host name when called from a router (see below)
39049 <literal>LOCAL_PART        </literal>   see below
39050 <literal>LOCAL_PART_PREFIX </literal>   see below
39051 <literal>LOCAL_PART_SUFFIX </literal>   see below
39052 <literal>LOGNAME           </literal>   see below
39053 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
39054 <literal>PATH              </literal>   as specified by the <option>path</option> option below
39055 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
39056 <literal>RECIPIENT         </literal>   the complete recipient address
39057 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
39058 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
39059 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
39060 <literal>USER              </literal>   see below
39061 </literallayout>
39062 <para>
39063 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
39064 router, LOCAL_PART is set to the local part of the address. When it is
39065 called as a result of a forward or alias expansion, LOCAL_PART is set to
39066 the local part of the address that was expanded. In both cases, any affixes are
39067 removed from the local part, and made available in LOCAL_PART_PREFIX and
39068 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
39069 same value as LOCAL_PART for compatibility with other MTAs.
39070 </para>
39071 <para>
39072 <indexterm role="concept">
39073 <primary>HOST</primary>
39074 </indexterm>
39075 HOST is set only when a <command>pipe</command> transport is called from a router that
39076 associates hosts with an address, typically when using <command>pipe</command> as a
39077 pseudo-remote transport. HOST is set to the first host name specified by
39078 the router.
39079 </para>
39080 <para>
39081 <indexterm role="concept">
39082 <primary>HOME</primary>
39083 </indexterm>
39084 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
39085 for the HOME environment variable. Otherwise, a home directory may be set
39086 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
39087 user&#x2019;s home directory if <option>check_local_user</option> is set.
39088 </para>
39089 </section>
39090 <section>
39091 <title>Private options for pipe</title>
39092 <para>
39093 <indexterm role="concept">
39094 <primary>options</primary>
39095 <secondary><command>pipe</command> transport</secondary>
39096 </indexterm>
39097 </para>
39098 <para>
39099 <indexterm role="option">
39100 <primary>allow_commands</primary>
39101 </indexterm>
39102 </para>
39103 <informaltable frame="all">
39104 <tgroup cols="4" colsep="0" rowsep="0">
39105 <colspec colwidth="8*" align="left"/>
39106 <colspec colwidth="5*" align="center"/>
39107 <colspec colwidth="5*" align="center"/>
39108 <colspec colwidth="6*" align="right"/>
39109 <tbody>
39110 <row>
39111 <entry><option>allow_commands</option></entry>
39112 <entry>Use: <emphasis>pipe</emphasis></entry>
39113 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
39114 <entry>Default: <emphasis>unset</emphasis></entry>
39115 </row>
39116 </tbody>
39117 </tgroup>
39118 </informaltable>
39119 <para>
39120 <indexterm role="concept">
39121 <primary><command>pipe</command> transport</primary>
39122 <secondary>permitted commands</secondary>
39123 </indexterm>
39124 The string is expanded, and is then interpreted as a colon-separated list of
39125 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
39126 permitted are those in the <option>allow_commands</option> list. They need not be absolute
39127 paths; the <option>path</option> option is still used for relative paths. If
39128 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
39129 in the <option>allow_commands</option> list, or a name without any slashes that is found on
39130 the path. In other words, if neither <option>allow_commands</option> nor
39131 <option>restrict_to_path</option> is set, there is no restriction on the command, but
39132 otherwise only commands that are permitted by one or the other are allowed. For
39133 example, if
39134 </para>
39135 <literallayout class="monospaced">
39136 allow_commands = /usr/bin/vacation
39137 </literallayout>
39138 <para>
39139 and <option>restrict_to_path</option> is not set, the only permitted command is
39140 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
39141 <option>use_shell</option> is set.
39142 </para>
39143 <para>
39144 <indexterm role="option">
39145 <primary>batch_id</primary>
39146 </indexterm>
39147 </para>
39148 <informaltable frame="all">
39149 <tgroup cols="4" colsep="0" rowsep="0">
39150 <colspec colwidth="8*" align="left"/>
39151 <colspec colwidth="5*" align="center"/>
39152 <colspec colwidth="5*" align="center"/>
39153 <colspec colwidth="6*" align="right"/>
39154 <tbody>
39155 <row>
39156 <entry><option>batch_id</option></entry>
39157 <entry>Use: <emphasis>pipe</emphasis></entry>
39158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39159 <entry>Default: <emphasis>unset</emphasis></entry>
39160 </row>
39161 </tbody>
39162 </tgroup>
39163 </informaltable>
39164 <para>
39165 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39166 </para>
39167 <para>
39168 <indexterm role="option">
39169 <primary>batch_max</primary>
39170 </indexterm>
39171 </para>
39172 <informaltable frame="all">
39173 <tgroup cols="4" colsep="0" rowsep="0">
39174 <colspec colwidth="8*" align="left"/>
39175 <colspec colwidth="5*" align="center"/>
39176 <colspec colwidth="5*" align="center"/>
39177 <colspec colwidth="6*" align="right"/>
39178 <tbody>
39179 <row>
39180 <entry><option>batch_max</option></entry>
39181 <entry>Use: <emphasis>pipe</emphasis></entry>
39182 <entry>Type: <emphasis>integer</emphasis></entry>
39183 <entry>Default: <emphasis>1</emphasis></entry>
39184 </row>
39185 </tbody>
39186 </tgroup>
39187 </informaltable>
39188 <para>
39189 This limits the number of addresses that can be handled in a single delivery.
39190 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
39191 </para>
39192 <para>
39193 <indexterm role="option">
39194 <primary>check_string</primary>
39195 </indexterm>
39196 </para>
39197 <informaltable frame="all">
39198 <tgroup cols="4" colsep="0" rowsep="0">
39199 <colspec colwidth="8*" align="left"/>
39200 <colspec colwidth="5*" align="center"/>
39201 <colspec colwidth="5*" align="center"/>
39202 <colspec colwidth="6*" align="right"/>
39203 <tbody>
39204 <row>
39205 <entry><option>check_string</option></entry>
39206 <entry>Use: <emphasis>pipe</emphasis></entry>
39207 <entry>Type: <emphasis>string</emphasis></entry>
39208 <entry>Default: <emphasis>unset</emphasis></entry>
39209 </row>
39210 </tbody>
39211 </tgroup>
39212 </informaltable>
39213 <para>
39214 As <command>pipe</command> writes the message, the start of each line is tested for matching
39215 <option>check_string</option>, and if it does, the initial matching characters are replaced
39216 by the contents of <option>escape_string</option>, provided both are set. The value of
39217 <option>check_string</option> is a literal string, not a regular expression, and the case of
39218 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
39219 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
39220 the SMTP escaping protocol. Any settings made in the configuration file are
39221 ignored.
39222 </para>
39223 <para>
39224 <indexterm role="option">
39225 <primary>command</primary>
39226 </indexterm>
39227 </para>
39228 <informaltable frame="all">
39229 <tgroup cols="4" colsep="0" rowsep="0">
39230 <colspec colwidth="8*" align="left"/>
39231 <colspec colwidth="5*" align="center"/>
39232 <colspec colwidth="5*" align="center"/>
39233 <colspec colwidth="6*" align="right"/>
39234 <tbody>
39235 <row>
39236 <entry><option>command</option></entry>
39237 <entry>Use: <emphasis>pipe</emphasis></entry>
39238 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39239 <entry>Default: <emphasis>unset</emphasis></entry>
39240 </row>
39241 </tbody>
39242 </tgroup>
39243 </informaltable>
39244 <para>
39245 This option need not be set when <command>pipe</command> is being used to deliver to pipes
39246 obtained directly from address redirections. In other cases, the option must be
39247 set, to provide a command to be run. It need not yield an absolute path (see
39248 the <option>path</option> option below). The command is split up into separate arguments by
39249 Exim, and each argument is separately expanded, as described in section
39250 <xref linkend="SECThowcommandrun"/> above.
39251 </para>
39252 <para>
39253 <indexterm role="option">
39254 <primary>environment</primary>
39255 </indexterm>
39256 </para>
39257 <informaltable frame="all">
39258 <tgroup cols="4" colsep="0" rowsep="0">
39259 <colspec colwidth="8*" align="left"/>
39260 <colspec colwidth="5*" align="center"/>
39261 <colspec colwidth="5*" align="center"/>
39262 <colspec colwidth="6*" align="right"/>
39263 <tbody>
39264 <row>
39265 <entry><option>environment</option></entry>
39266 <entry>Use: <emphasis>pipe</emphasis></entry>
39267 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39268 <entry>Default: <emphasis>unset</emphasis></entry>
39269 </row>
39270 </tbody>
39271 </tgroup>
39272 </informaltable>
39273 <para>
39274 <indexterm role="concept">
39275 <primary><command>pipe</command> transport</primary>
39276 <secondary>environment for command</secondary>
39277 </indexterm>
39278 <indexterm role="concept">
39279 <primary>environment for <command>pipe</command> transport</primary>
39280 </indexterm>
39281 This option is used to add additional variables to the environment in which the
39282 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
39283 a string which is expanded, and then interpreted as a colon-separated list of
39284 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
39285 </para>
39286 <para>
39287 <indexterm role="option">
39288 <primary>escape_string</primary>
39289 </indexterm>
39290 </para>
39291 <informaltable frame="all">
39292 <tgroup cols="4" colsep="0" rowsep="0">
39293 <colspec colwidth="8*" align="left"/>
39294 <colspec colwidth="5*" align="center"/>
39295 <colspec colwidth="5*" align="center"/>
39296 <colspec colwidth="6*" align="right"/>
39297 <tbody>
39298 <row>
39299 <entry><option>escape_string</option></entry>
39300 <entry>Use: <emphasis>pipe</emphasis></entry>
39301 <entry>Type: <emphasis>string</emphasis></entry>
39302 <entry>Default: <emphasis>unset</emphasis></entry>
39303 </row>
39304 </tbody>
39305 </tgroup>
39306 </informaltable>
39307 <para>
39308 See <option>check_string</option> above.
39309 </para>
39310 <para>
39311 <indexterm role="option">
39312 <primary>freeze_exec_fail</primary>
39313 </indexterm>
39314 </para>
39315 <informaltable frame="all">
39316 <tgroup cols="4" colsep="0" rowsep="0">
39317 <colspec colwidth="8*" align="left"/>
39318 <colspec colwidth="5*" align="center"/>
39319 <colspec colwidth="5*" align="center"/>
39320 <colspec colwidth="6*" align="right"/>
39321 <tbody>
39322 <row>
39323 <entry><option>freeze_exec_fail</option></entry>
39324 <entry>Use: <emphasis>pipe</emphasis></entry>
39325 <entry>Type: <emphasis>boolean</emphasis></entry>
39326 <entry>Default: <emphasis>false</emphasis></entry>
39327 </row>
39328 </tbody>
39329 </tgroup>
39330 </informaltable>
39331 <para>
39332 <indexterm role="concept">
39333 <primary>exec failure</primary>
39334 </indexterm>
39335 <indexterm role="concept">
39336 <primary>failure of exec</primary>
39337 </indexterm>
39338 <indexterm role="concept">
39339 <primary><command>pipe</command> transport</primary>
39340 <secondary>failure of exec</secondary>
39341 </indexterm>
39342 Failure to exec the command in a pipe transport is by default treated like
39343 any other failure while running the command. However, if <option>freeze_exec_fail</option>
39344 is set, failure to exec is treated specially, and causes the message to be
39345 frozen, whatever the setting of <option>ignore_status</option>.
39346 </para>
39347 <para>
39348 <indexterm role="option">
39349 <primary>ignore_status</primary>
39350 </indexterm>
39351 </para>
39352 <informaltable frame="all">
39353 <tgroup cols="4" colsep="0" rowsep="0">
39354 <colspec colwidth="8*" align="left"/>
39355 <colspec colwidth="5*" align="center"/>
39356 <colspec colwidth="5*" align="center"/>
39357 <colspec colwidth="6*" align="right"/>
39358 <tbody>
39359 <row>
39360 <entry><option>ignore_status</option></entry>
39361 <entry>Use: <emphasis>pipe</emphasis></entry>
39362 <entry>Type: <emphasis>boolean</emphasis></entry>
39363 <entry>Default: <emphasis>false</emphasis></entry>
39364 </row>
39365 </tbody>
39366 </tgroup>
39367 </informaltable>
39368 <para>
39369 If this option is true, the status returned by the subprocess that is set up to
39370 run the command is ignored, and Exim behaves as if zero had been returned.
39371 Otherwise, a non-zero status or termination by signal causes an error return
39372 from the transport unless the status value is one of those listed in
39373 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
39374 </para>
39375 <para>
39376 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
39377 See the <option>timeout_defer</option> option for how timeouts are handled.
39378 </para>
39379 <para>
39380 <indexterm role="option">
39381 <primary>log_defer_output</primary>
39382 </indexterm>
39383 </para>
39384 <informaltable frame="all">
39385 <tgroup cols="4" colsep="0" rowsep="0">
39386 <colspec colwidth="8*" align="left"/>
39387 <colspec colwidth="5*" align="center"/>
39388 <colspec colwidth="5*" align="center"/>
39389 <colspec colwidth="6*" align="right"/>
39390 <tbody>
39391 <row>
39392 <entry><option>log_defer_output</option></entry>
39393 <entry>Use: <emphasis>pipe</emphasis></entry>
39394 <entry>Type: <emphasis>boolean</emphasis></entry>
39395 <entry>Default: <emphasis>false</emphasis></entry>
39396 </row>
39397 </tbody>
39398 </tgroup>
39399 </informaltable>
39400 <para>
39401 <indexterm role="concept">
39402 <primary><command>pipe</command> transport</primary>
39403 <secondary>logging output</secondary>
39404 </indexterm>
39405 If this option is set, and the status returned by the command is
39406 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
39407 and any output was produced, the first line of it is written to the main log.
39408 </para>
39409 <para>
39410 <indexterm role="option">
39411 <primary>log_fail_output</primary>
39412 </indexterm>
39413 </para>
39414 <informaltable frame="all">
39415 <tgroup cols="4" colsep="0" rowsep="0">
39416 <colspec colwidth="8*" align="left"/>
39417 <colspec colwidth="5*" align="center"/>
39418 <colspec colwidth="5*" align="center"/>
39419 <colspec colwidth="6*" align="right"/>
39420 <tbody>
39421 <row>
39422 <entry><option>log_fail_output</option></entry>
39423 <entry>Use: <emphasis>pipe</emphasis></entry>
39424 <entry>Type: <emphasis>boolean</emphasis></entry>
39425 <entry>Default: <emphasis>false</emphasis></entry>
39426 </row>
39427 </tbody>
39428 </tgroup>
39429 </informaltable>
39430 <para>
39431 If this option is set, and the command returns any output, and also ends with a
39432 return code that is neither zero nor one of the return codes listed in
39433 <option>temp_errors</option> (that is, the delivery failed), the first line of output is
39434 written to the main log. This option and <option>log_output</option> are mutually exclusive.
39435 Only one of them may be set.
39436 </para>
39437 <para>
39438 <indexterm role="option">
39439 <primary>log_output</primary>
39440 </indexterm>
39441 </para>
39442 <informaltable frame="all">
39443 <tgroup cols="4" colsep="0" rowsep="0">
39444 <colspec colwidth="8*" align="left"/>
39445 <colspec colwidth="5*" align="center"/>
39446 <colspec colwidth="5*" align="center"/>
39447 <colspec colwidth="6*" align="right"/>
39448 <tbody>
39449 <row>
39450 <entry><option>log_output</option></entry>
39451 <entry>Use: <emphasis>pipe</emphasis></entry>
39452 <entry>Type: <emphasis>boolean</emphasis></entry>
39453 <entry>Default: <emphasis>false</emphasis></entry>
39454 </row>
39455 </tbody>
39456 </tgroup>
39457 </informaltable>
39458 <para>
39459 If this option is set and the command returns any output, the first line of
39460 output is written to the main log, whatever the return code. This option and
39461 <option>log_fail_output</option> are mutually exclusive. Only one of them may be set.
39462 </para>
39463 <para>
39464 <indexterm role="option">
39465 <primary>max_output</primary>
39466 </indexterm>
39467 </para>
39468 <informaltable frame="all">
39469 <tgroup cols="4" colsep="0" rowsep="0">
39470 <colspec colwidth="8*" align="left"/>
39471 <colspec colwidth="5*" align="center"/>
39472 <colspec colwidth="5*" align="center"/>
39473 <colspec colwidth="6*" align="right"/>
39474 <tbody>
39475 <row>
39476 <entry><option>max_output</option></entry>
39477 <entry>Use: <emphasis>pipe</emphasis></entry>
39478 <entry>Type: <emphasis>integer</emphasis></entry>
39479 <entry>Default: <emphasis>20K</emphasis></entry>
39480 </row>
39481 </tbody>
39482 </tgroup>
39483 </informaltable>
39484 <para>
39485 This specifies the maximum amount of output that the command may produce on its
39486 standard output and standard error file combined. If the limit is exceeded, the
39487 process running the command is killed. This is intended as a safety measure to
39488 catch runaway processes. The limit is applied independently of the settings of
39489 the options that control what is done with such output (for example,
39490 <option>return_output</option>). Because of buffering effects, the amount of output may
39491 exceed the limit by a small amount before Exim notices.
39492 </para>
39493 <para>
39494 <indexterm role="option">
39495 <primary>message_prefix</primary>
39496 </indexterm>
39497 </para>
39498 <informaltable frame="all">
39499 <tgroup cols="4" colsep="0" rowsep="0">
39500 <colspec colwidth="8*" align="left"/>
39501 <colspec colwidth="5*" align="center"/>
39502 <colspec colwidth="5*" align="center"/>
39503 <colspec colwidth="6*" align="right"/>
39504 <tbody>
39505 <row>
39506 <entry><option>message_prefix</option></entry>
39507 <entry>Use: <emphasis>pipe</emphasis></entry>
39508 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39509 <entry>Default: <emphasis>see below</emphasis></entry>
39510 </row>
39511 </tbody>
39512 </tgroup>
39513 </informaltable>
39514 <para>
39515 The string specified here is expanded and output at the start of every message.
39516 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
39517 </para>
39518 <literallayout class="monospaced">
39519 message_prefix = \
39520   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
39521   ${tod_bsdinbox}\n
39522 </literallayout>
39523 <para>
39524 <indexterm role="concept">
39525 <primary>Cyrus</primary>
39526 </indexterm>
39527 <indexterm role="concept">
39528 <primary><option>tmail</option></primary>
39529 </indexterm>
39530 <indexterm role="concept">
39531 <primary><quote>From</quote> line</primary>
39532 </indexterm>
39533 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
39534 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
39535 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
39536 setting
39537 </para>
39538 <literallayout class="monospaced">
39539 message_prefix =
39540 </literallayout>
39541 <para>
39542 <indexterm role="option">
39543 <primary>message_suffix</primary>
39544 </indexterm>
39545 </para>
39546 <informaltable frame="all">
39547 <tgroup cols="4" colsep="0" rowsep="0">
39548 <colspec colwidth="8*" align="left"/>
39549 <colspec colwidth="5*" align="center"/>
39550 <colspec colwidth="5*" align="center"/>
39551 <colspec colwidth="6*" align="right"/>
39552 <tbody>
39553 <row>
39554 <entry><option>message_suffix</option></entry>
39555 <entry>Use: <emphasis>pipe</emphasis></entry>
39556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39557 <entry>Default: <emphasis>see below</emphasis></entry>
39558 </row>
39559 </tbody>
39560 </tgroup>
39561 </informaltable>
39562 <para>
39563 The string specified here is expanded and output at the end of every message.
39564 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
39565 The suffix can be suppressed by setting
39566 </para>
39567 <literallayout class="monospaced">
39568 message_suffix =
39569 </literallayout>
39570 <para>
39571 <indexterm role="option">
39572 <primary>path</primary>
39573 </indexterm>
39574 </para>
39575 <informaltable frame="all">
39576 <tgroup cols="4" colsep="0" rowsep="0">
39577 <colspec colwidth="8*" align="left"/>
39578 <colspec colwidth="5*" align="center"/>
39579 <colspec colwidth="5*" align="center"/>
39580 <colspec colwidth="6*" align="right"/>
39581 <tbody>
39582 <row>
39583 <entry><option>path</option></entry>
39584 <entry>Use: <emphasis>pipe</emphasis></entry>
39585 <entry>Type: <emphasis>string</emphasis></entry>
39586 <entry>Default: <emphasis><literal>/bin:/usr/bin</literal></emphasis></entry>
39587 </row>
39588 </tbody>
39589 </tgroup>
39590 </informaltable>
39591 <para>
39592 This option specifies the string that is set up in the PATH environment
39593 variable of the subprocess. If the <option>command</option> option does not yield an
39594 absolute path name, the command is sought in the PATH directories, in the usual
39595 way. <emphasis role="bold">Warning</emphasis>: This does not apply to a command specified as a transport
39596 filter.
39597 </para>
39598 <para>
39599 <indexterm role="option">
39600 <primary>pipe_as_creator</primary>
39601 </indexterm>
39602 </para>
39603 <informaltable frame="all">
39604 <tgroup cols="4" colsep="0" rowsep="0">
39605 <colspec colwidth="8*" align="left"/>
39606 <colspec colwidth="5*" align="center"/>
39607 <colspec colwidth="5*" align="center"/>
39608 <colspec colwidth="6*" align="right"/>
39609 <tbody>
39610 <row>
39611 <entry><option>pipe_as_creator</option></entry>
39612 <entry>Use: <emphasis>pipe</emphasis></entry>
39613 <entry>Type: <emphasis>boolean</emphasis></entry>
39614 <entry>Default: <emphasis>false</emphasis></entry>
39615 </row>
39616 </tbody>
39617 </tgroup>
39618 </informaltable>
39619 <para>
39620 <indexterm role="concept">
39621 <primary>uid (user id)</primary>
39622 <secondary>local delivery</secondary>
39623 </indexterm>
39624 If the generic <option>user</option> option is not set and this option is true, the delivery
39625 process is run under the uid that was in force when Exim was originally called
39626 to accept the message. If the group id is not otherwise set (via the generic
39627 <option>group</option> option), the gid that was in force when Exim was originally called to
39628 accept the message is used.
39629 </para>
39630 <para>
39631 <indexterm role="option">
39632 <primary>restrict_to_path</primary>
39633 </indexterm>
39634 </para>
39635 <informaltable frame="all">
39636 <tgroup cols="4" colsep="0" rowsep="0">
39637 <colspec colwidth="8*" align="left"/>
39638 <colspec colwidth="5*" align="center"/>
39639 <colspec colwidth="5*" align="center"/>
39640 <colspec colwidth="6*" align="right"/>
39641 <tbody>
39642 <row>
39643 <entry><option>restrict_to_path</option></entry>
39644 <entry>Use: <emphasis>pipe</emphasis></entry>
39645 <entry>Type: <emphasis>boolean</emphasis></entry>
39646 <entry>Default: <emphasis>false</emphasis></entry>
39647 </row>
39648 </tbody>
39649 </tgroup>
39650 </informaltable>
39651 <para>
39652 When this option is set, any command name not listed in <option>allow_commands</option> must
39653 contain no slashes. The command is searched for only in the directories listed
39654 in the <option>path</option> option. This option is intended for use in the case when a pipe
39655 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
39656 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
39657 </para>
39658 <para>
39659 <indexterm role="option">
39660 <primary>return_fail_output</primary>
39661 </indexterm>
39662 </para>
39663 <informaltable frame="all">
39664 <tgroup cols="4" colsep="0" rowsep="0">
39665 <colspec colwidth="8*" align="left"/>
39666 <colspec colwidth="5*" align="center"/>
39667 <colspec colwidth="5*" align="center"/>
39668 <colspec colwidth="6*" align="right"/>
39669 <tbody>
39670 <row>
39671 <entry><option>return_fail_output</option></entry>
39672 <entry>Use: <emphasis>pipe</emphasis></entry>
39673 <entry>Type: <emphasis>boolean</emphasis></entry>
39674 <entry>Default: <emphasis>false</emphasis></entry>
39675 </row>
39676 </tbody>
39677 </tgroup>
39678 </informaltable>
39679 <para>
39680 If this option is true, and the command produced any output and ended with a
39681 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
39682 is, the delivery failed), the output is returned in the bounce message.
39683 However, if the message has a null sender (that is, it is itself a bounce
39684 message), output from the command is discarded. This option and
39685 <option>return_output</option> are mutually exclusive. Only one of them may be set.
39686 </para>
39687 <para>
39688 <indexterm role="option">
39689 <primary>return_output</primary>
39690 </indexterm>
39691 </para>
39692 <informaltable frame="all">
39693 <tgroup cols="4" colsep="0" rowsep="0">
39694 <colspec colwidth="8*" align="left"/>
39695 <colspec colwidth="5*" align="center"/>
39696 <colspec colwidth="5*" align="center"/>
39697 <colspec colwidth="6*" align="right"/>
39698 <tbody>
39699 <row>
39700 <entry><option>return_output</option></entry>
39701 <entry>Use: <emphasis>pipe</emphasis></entry>
39702 <entry>Type: <emphasis>boolean</emphasis></entry>
39703 <entry>Default: <emphasis>false</emphasis></entry>
39704 </row>
39705 </tbody>
39706 </tgroup>
39707 </informaltable>
39708 <para>
39709 If this option is true, and the command produced any output, the delivery is
39710 deemed to have failed whatever the return code from the command, and the output
39711 is returned in the bounce message. Otherwise, the output is just discarded.
39712 However, if the message has a null sender (that is, it is a bounce message),
39713 output from the command is always discarded, whatever the setting of this
39714 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
39715 of them may be set.
39716 </para>
39717 <para>
39718 <indexterm role="option">
39719 <primary>temp_errors</primary>
39720 </indexterm>
39721 </para>
39722 <informaltable frame="all">
39723 <tgroup cols="4" colsep="0" rowsep="0">
39724 <colspec colwidth="8*" align="left"/>
39725 <colspec colwidth="5*" align="center"/>
39726 <colspec colwidth="5*" align="center"/>
39727 <colspec colwidth="6*" align="right"/>
39728 <tbody>
39729 <row>
39730 <entry><option>temp_errors</option></entry>
39731 <entry>Use: <emphasis>pipe</emphasis></entry>
39732 <entry>Type: <emphasis>string list</emphasis></entry>
39733 <entry>Default: <emphasis>see below</emphasis></entry>
39734 </row>
39735 </tbody>
39736 </tgroup>
39737 </informaltable>
39738 <para>
39739 <indexterm role="concept">
39740 <primary><command>pipe</command> transport</primary>
39741 <secondary>temporary failure</secondary>
39742 </indexterm>
39743 This option contains either a colon-separated list of numbers, or a single
39744 asterisk. If <option>ignore_status</option> is false
39745 and <option>return_output</option> is not set,
39746 and the command exits with a non-zero return code, the failure is treated as
39747 temporary and the delivery is deferred if the return code matches one of the
39748 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
39749 codes are treated as permanent errors. The default setting contains the codes
39750 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
39751 compiled on a system that does not define these macros, it assumes values of 75
39752 and 73, respectively.
39753 </para>
39754 <para>
39755 <indexterm role="option">
39756 <primary>timeout</primary>
39757 </indexterm>
39758 </para>
39759 <informaltable frame="all">
39760 <tgroup cols="4" colsep="0" rowsep="0">
39761 <colspec colwidth="8*" align="left"/>
39762 <colspec colwidth="5*" align="center"/>
39763 <colspec colwidth="5*" align="center"/>
39764 <colspec colwidth="6*" align="right"/>
39765 <tbody>
39766 <row>
39767 <entry><option>timeout</option></entry>
39768 <entry>Use: <emphasis>pipe</emphasis></entry>
39769 <entry>Type: <emphasis>time</emphasis></entry>
39770 <entry>Default: <emphasis>1h</emphasis></entry>
39771 </row>
39772 </tbody>
39773 </tgroup>
39774 </informaltable>
39775 <para>
39776 If the command fails to complete within this time, it is killed. This normally
39777 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
39778 specifies no timeout. In order to ensure that any subprocesses created by the
39779 command are also killed, Exim makes the initial process a process group leader,
39780 and kills the whole process group on a timeout. However, this can be defeated
39781 if one of the processes starts a new process group.
39782 </para>
39783 <para>
39784 <indexterm role="option">
39785 <primary>timeout_defer</primary>
39786 </indexterm>
39787 </para>
39788 <informaltable frame="all">
39789 <tgroup cols="4" colsep="0" rowsep="0">
39790 <colspec colwidth="8*" align="left"/>
39791 <colspec colwidth="5*" align="center"/>
39792 <colspec colwidth="5*" align="center"/>
39793 <colspec colwidth="6*" align="right"/>
39794 <tbody>
39795 <row>
39796 <entry><option>timeout_defer</option></entry>
39797 <entry>Use: <emphasis>pipe</emphasis></entry>
39798 <entry>Type: <emphasis>boolean</emphasis></entry>
39799 <entry>Default: <emphasis>false</emphasis></entry>
39800 </row>
39801 </tbody>
39802 </tgroup>
39803 </informaltable>
39804 <para>
39805 A timeout in a <command>pipe</command> transport, either in the command that the transport
39806 runs, or in a transport filter that is associated with it, is by default
39807 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
39808 is set true, both kinds of timeout become temporary errors, causing the
39809 delivery to be deferred.
39810 </para>
39811 <para>
39812 <indexterm role="option">
39813 <primary>umask</primary>
39814 </indexterm>
39815 </para>
39816 <informaltable frame="all">
39817 <tgroup cols="4" colsep="0" rowsep="0">
39818 <colspec colwidth="8*" align="left"/>
39819 <colspec colwidth="5*" align="center"/>
39820 <colspec colwidth="5*" align="center"/>
39821 <colspec colwidth="6*" align="right"/>
39822 <tbody>
39823 <row>
39824 <entry><option>umask</option></entry>
39825 <entry>Use: <emphasis>pipe</emphasis></entry>
39826 <entry>Type: <emphasis>octal integer</emphasis></entry>
39827 <entry>Default: <emphasis>022</emphasis></entry>
39828 </row>
39829 </tbody>
39830 </tgroup>
39831 </informaltable>
39832 <para>
39833 This specifies the umask setting for the subprocess that runs the command.
39834 </para>
39835 <para>
39836 <indexterm role="option">
39837 <primary>use_bsmtp</primary>
39838 </indexterm>
39839 </para>
39840 <informaltable frame="all">
39841 <tgroup cols="4" colsep="0" rowsep="0">
39842 <colspec colwidth="8*" align="left"/>
39843 <colspec colwidth="5*" align="center"/>
39844 <colspec colwidth="5*" align="center"/>
39845 <colspec colwidth="6*" align="right"/>
39846 <tbody>
39847 <row>
39848 <entry><option>use_bsmtp</option></entry>
39849 <entry>Use: <emphasis>pipe</emphasis></entry>
39850 <entry>Type: <emphasis>boolean</emphasis></entry>
39851 <entry>Default: <emphasis>false</emphasis></entry>
39852 </row>
39853 </tbody>
39854 </tgroup>
39855 </informaltable>
39856 <para>
39857 <indexterm role="concept">
39858 <primary>envelope sender</primary>
39859 </indexterm>
39860 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
39861 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
39862 commands. If you want to include a leading HELO command with such messages,
39863 you can do so by setting the <option>message_prefix</option> option. See section
39864 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
39865 </para>
39866 <para>
39867 <indexterm role="option">
39868 <primary>use_classresources</primary>
39869 </indexterm>
39870 </para>
39871 <informaltable frame="all">
39872 <tgroup cols="4" colsep="0" rowsep="0">
39873 <colspec colwidth="8*" align="left"/>
39874 <colspec colwidth="5*" align="center"/>
39875 <colspec colwidth="5*" align="center"/>
39876 <colspec colwidth="6*" align="right"/>
39877 <tbody>
39878 <row>
39879 <entry><option>use_classresources</option></entry>
39880 <entry>Use: <emphasis>pipe</emphasis></entry>
39881 <entry>Type: <emphasis>boolean</emphasis></entry>
39882 <entry>Default: <emphasis>false</emphasis></entry>
39883 </row>
39884 </tbody>
39885 </tgroup>
39886 </informaltable>
39887 <para>
39888 <indexterm role="concept">
39889 <primary>class resources (BSD)</primary>
39890 </indexterm>
39891 This option is available only when Exim is running on FreeBSD, NetBSD, or
39892 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
39893 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
39894 limits for the uid under which the pipe is to run are obtained from the login
39895 class database.
39896 </para>
39897 <para>
39898 <indexterm role="option">
39899 <primary>use_crlf</primary>
39900 </indexterm>
39901 </para>
39902 <informaltable frame="all">
39903 <tgroup cols="4" colsep="0" rowsep="0">
39904 <colspec colwidth="8*" align="left"/>
39905 <colspec colwidth="5*" align="center"/>
39906 <colspec colwidth="5*" align="center"/>
39907 <colspec colwidth="6*" align="right"/>
39908 <tbody>
39909 <row>
39910 <entry><option>use_crlf</option></entry>
39911 <entry>Use: <emphasis>pipe</emphasis></entry>
39912 <entry>Type: <emphasis>boolean</emphasis></entry>
39913 <entry>Default: <emphasis>false</emphasis></entry>
39914 </row>
39915 </tbody>
39916 </tgroup>
39917 </informaltable>
39918 <para>
39919 <indexterm role="concept">
39920 <primary>carriage return</primary>
39921 </indexterm>
39922 <indexterm role="concept">
39923 <primary>linefeed</primary>
39924 </indexterm>
39925 This option causes lines to be terminated with the two-character CRLF sequence
39926 (carriage return, linefeed) instead of just a linefeed character. In the case
39927 of batched SMTP, the byte sequence written to the pipe is then an exact image
39928 of what would be sent down a real SMTP connection.
39929 </para>
39930 <para>
39931 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
39932 written verbatim, so must contain their own carriage return characters if these
39933 are needed. Since the default values for both <option>message_prefix</option> and
39934 <option>message_suffix</option> end with a single linefeed, their values must be changed to
39935 end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
39936 </para>
39937 <para>
39938 <indexterm role="option">
39939 <primary>use_shell</primary>
39940 </indexterm>
39941 </para>
39942 <informaltable frame="all">
39943 <tgroup cols="4" colsep="0" rowsep="0">
39944 <colspec colwidth="8*" align="left"/>
39945 <colspec colwidth="5*" align="center"/>
39946 <colspec colwidth="5*" align="center"/>
39947 <colspec colwidth="6*" align="right"/>
39948 <tbody>
39949 <row>
39950 <entry><option>use_shell</option></entry>
39951 <entry>Use: <emphasis>pipe</emphasis></entry>
39952 <entry>Type: <emphasis>boolean</emphasis></entry>
39953 <entry>Default: <emphasis>false</emphasis></entry>
39954 </row>
39955 </tbody>
39956 </tgroup>
39957 </informaltable>
39958 <para>
39959 <indexterm role="concept">
39960 <primary><varname>$pipe_addresses</varname></primary>
39961 </indexterm>
39962 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
39963 instead of being run directly from the transport, as described in section
39964 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
39965 where the command is expected to be run under a shell and cannot easily be
39966 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
39967 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
39968 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
39969 its <option>-c</option> option.
39970 </para>
39971 </section>
39972 <section>
39973 <title>Using an external local delivery agent</title>
39974 <para>
39975 <indexterm role="concept">
39976 <primary>local delivery</primary>
39977 <secondary>using an external agent</secondary>
39978 </indexterm>
39979 <indexterm role="concept">
39980 <primary><emphasis>procmail</emphasis></primary>
39981 </indexterm>
39982 <indexterm role="concept">
39983 <primary>external local delivery</primary>
39984 </indexterm>
39985 <indexterm role="concept">
39986 <primary>delivery</primary>
39987 <secondary><emphasis>procmail</emphasis></secondary>
39988 </indexterm>
39989 <indexterm role="concept">
39990 <primary>delivery</primary>
39991 <secondary>by external agent</secondary>
39992 </indexterm>
39993 The <command>pipe</command> transport can be used to pass all messages that require local
39994 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
39995 this, care must be taken to ensure that the pipe is run under an appropriate
39996 uid and gid. In some configurations one wants this to be a uid that is trusted
39997 by the delivery agent to supply the correct sender of the message. It may be
39998 necessary to recompile or reconfigure the delivery agent so that it trusts an
39999 appropriate user. The following is an example transport and router
40000 configuration for <option>procmail</option>:
40001 </para>
40002 <literallayout class="monospaced">
40003 # transport
40004 procmail_pipe:
40005   driver = pipe
40006   command = /usr/local/bin/procmail -d $local_part
40007   return_path_add
40008   delivery_date_add
40009   envelope_to_add
40010   check_string = "From "
40011   escape_string = "&gt;From "
40012   user = $local_part
40013   group = mail
40014
40015 # router
40016 procmail:
40017   driver = accept
40018   check_local_user
40019   transport = procmail_pipe
40020 </literallayout>
40021 <para>
40022 In this example, the pipe is run as the local user, but with the group set to
40023 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
40024 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
40025 user to supply a correct sender address. If you do not specify either a
40026 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
40027 home directory is the user&#x2019;s home directory by default.
40028 </para>
40029 <para>
40030 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
40031 </para>
40032 <literallayout class="monospaced">
40033 IFS=" "
40034 </literallayout>
40035 <para>
40036 as shown in some <option>procmail</option> documentation, because Exim does not by default
40037 use a shell to run pipe commands.
40038 </para>
40039 <para>
40040 <indexterm role="concept">
40041 <primary>Cyrus</primary>
40042 </indexterm>
40043 The next example shows a transport and a router for a system where local
40044 deliveries are handled by the Cyrus IMAP server.
40045 </para>
40046 <literallayout class="monospaced">
40047 # transport
40048 local_delivery_cyrus:
40049   driver = pipe
40050   command = /usr/cyrus/bin/deliver \
40051             -m ${substr_1:$local_part_suffix} -- $local_part
40052   user = cyrus
40053   group = mail
40054   return_output
40055   log_output
40056   message_prefix =
40057   message_suffix =
40058
40059 # router
40060 local_user_cyrus:
40061   driver = accept
40062   check_local_user
40063   local_part_suffix = .*
40064   transport = local_delivery_cyrus
40065 </literallayout>
40066 <para>
40067 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
40068 <option>return_output</option> to cause any text written by Cyrus to be returned to the
40069 sender.
40070 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
40071 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
40072 </para>
40073 </section>
40074 </chapter>
40075
40076 <chapter id="CHAPsmtptrans">
40077 <title>The smtp transport</title>
40078 <para>
40079 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
40080 <primary>transports</primary>
40081 <secondary><command>smtp</command></secondary>
40082 </indexterm>
40083 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
40084 <primary><command>smtp</command> transport</primary>
40085 </indexterm>
40086 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
40087 or LMTP protocol. The list of hosts to try can either be taken from the address
40088 that is being processed (having been set up by the router), or specified
40089 explicitly for the transport. Timeout and retry processing (see chapter
40090 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
40091 </para>
40092 <section>
40093 <title>Multiple messages on a single connection</title>
40094 <para>
40095 The sending of multiple messages over a single TCP/IP connection can arise in
40096 two ways:
40097 </para>
40098 <itemizedlist>
40099 <listitem>
40100 <para>
40101 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
40102 routed to the same host, more than one copy of the message has to be sent to
40103 that host. In this situation, multiple copies may be sent in a single run of
40104 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
40105 does when it has too many addresses to send in one message also depends on the
40106 value of the global <option>remote_max_parallel</option> option. Details are given in
40107 section <xref linkend="SECToutSMTPTCP"/>.)
40108 </para>
40109 </listitem>
40110 <listitem>
40111 <para>
40112 <indexterm role="concept">
40113 <primary>hints database</primary>
40114 <secondary>remembering routing</secondary>
40115 </indexterm>
40116 When a message has been successfully delivered over a TCP/IP connection, Exim
40117 looks in its hints database to see if there are any other messages awaiting a
40118 connection to the same host. If there are, a new delivery process is started
40119 for one of them, and the current TCP/IP connection is passed on to it. The new
40120 process may in turn send multiple copies and possibly create yet another
40121 process.
40122 </para>
40123 </listitem>
40124 </itemizedlist>
40125 <para>
40126 For each copy sent over the same TCP/IP connection, a sequence counter is
40127 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
40128 no further messages are sent over that connection.
40129 </para>
40130 </section>
40131 <section>
40132 <title>Use of the $host variable</title>
40133 <para>
40134 <indexterm role="concept">
40135 <primary><varname>$host</varname></primary>
40136 </indexterm>
40137 <indexterm role="concept">
40138 <primary><varname>$host_address</varname></primary>
40139 </indexterm>
40140 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
40141 <varname>$host_address</varname> are the name and IP address of the first host on the host list
40142 passed by the router. However, when the transport is about to connect to a
40143 specific host, and while it is connected to that host, <varname>$host</varname> and
40144 <varname>$host_address</varname> are set to the values for that host. These are the values
40145 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
40146 <option>serialize_hosts</option>, and the various TLS options are expanded.
40147 </para>
40148 </section>
40149 <section>
40150 <title>Private options for smtp</title>
40151 <para>
40152 <indexterm role="concept">
40153 <primary>options</primary>
40154 <secondary><command>smtp</command> transport</secondary>
40155 </indexterm>
40156 The private options of the <command>smtp</command> transport are as follows:
40157 </para>
40158 <para>
40159 <indexterm role="option">
40160 <primary>allow_localhost</primary>
40161 </indexterm>
40162 </para>
40163 <informaltable frame="all">
40164 <tgroup cols="4" colsep="0" rowsep="0">
40165 <colspec colwidth="8*" align="left"/>
40166 <colspec colwidth="5*" align="center"/>
40167 <colspec colwidth="5*" align="center"/>
40168 <colspec colwidth="6*" align="right"/>
40169 <tbody>
40170 <row>
40171 <entry><option>allow_localhost</option></entry>
40172 <entry>Use: <emphasis>smtp</emphasis></entry>
40173 <entry>Type: <emphasis>boolean</emphasis></entry>
40174 <entry>Default: <emphasis>false</emphasis></entry>
40175 </row>
40176 </tbody>
40177 </tgroup>
40178 </informaltable>
40179 <para>
40180 <indexterm role="concept">
40181 <primary>local host</primary>
40182 <secondary>sending to</secondary>
40183 </indexterm>
40184 <indexterm role="concept">
40185 <primary>fallback</primary>
40186 <secondary>hosts specified on transport</secondary>
40187 </indexterm>
40188 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
40189 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
40190 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
40191 the delivery anyway. This should be used only in special cases when the
40192 configuration ensures that no looping will result (for example, a differently
40193 configured Exim is listening on the port to which the message is sent).
40194 </para>
40195 <para>
40196 <indexterm role="option">
40197 <primary>authenticated_sender</primary>
40198 </indexterm>
40199 </para>
40200 <informaltable frame="all">
40201 <tgroup cols="4" colsep="0" rowsep="0">
40202 <colspec colwidth="8*" align="left"/>
40203 <colspec colwidth="5*" align="center"/>
40204 <colspec colwidth="5*" align="center"/>
40205 <colspec colwidth="6*" align="right"/>
40206 <tbody>
40207 <row>
40208 <entry><option>authenticated_sender</option></entry>
40209 <entry>Use: <emphasis>smtp</emphasis></entry>
40210 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40211 <entry>Default: <emphasis>unset</emphasis></entry>
40212 </row>
40213 </tbody>
40214 </tgroup>
40215 </informaltable>
40216 <para>
40217 <indexterm role="concept">
40218 <primary>Cyrus</primary>
40219 </indexterm>
40220 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
40221 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
40222 overriding any existing authenticated sender value. If the string expansion is
40223 forced to fail, the option is ignored. Other expansion failures cause delivery
40224 to be deferred. If the result of expansion is an empty string, that is also
40225 ignored.
40226 </para>
40227 <para>
40228 If the SMTP session is not authenticated, the expansion of
40229 <option>authenticated_sender</option> still happens (and can cause the delivery to be
40230 deferred if it fails), but no AUTH= item is added to MAIL commands
40231 unless <option>authenticated_sender_force</option> is true.
40232 </para>
40233 <para>
40234 This option allows you to use the <command>smtp</command> transport in LMTP mode to
40235 deliver mail to Cyrus IMAP and provide the proper local part as the
40236 <quote>authenticated sender</quote>, via a setting such as:
40237 </para>
40238 <literallayout class="monospaced">
40239 authenticated_sender = $local_part
40240 </literallayout>
40241 <para>
40242 This removes the need for IMAP subfolders to be assigned special ACLs to
40243 allow direct delivery to those subfolders.
40244 </para>
40245 <para>
40246 Because of expected uses such as that just described for Cyrus (when no
40247 domain is involved), there is no checking on the syntax of the provided
40248 value.
40249 </para>
40250 <para>
40251 <indexterm role="option">
40252 <primary>authenticated_sender_force</primary>
40253 </indexterm>
40254 </para>
40255 <informaltable frame="all">
40256 <tgroup cols="4" colsep="0" rowsep="0">
40257 <colspec colwidth="8*" align="left"/>
40258 <colspec colwidth="5*" align="center"/>
40259 <colspec colwidth="5*" align="center"/>
40260 <colspec colwidth="6*" align="right"/>
40261 <tbody>
40262 <row>
40263 <entry><option>authenticated_sender_force</option></entry>
40264 <entry>Use: <emphasis>smtp</emphasis></entry>
40265 <entry>Type: <emphasis>boolean</emphasis></entry>
40266 <entry>Default: <emphasis>false</emphasis></entry>
40267 </row>
40268 </tbody>
40269 </tgroup>
40270 </informaltable>
40271 <para>
40272 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
40273 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
40274 authenticated as a client.
40275 </para>
40276 <para>
40277 <indexterm role="option">
40278 <primary>command_timeout</primary>
40279 </indexterm>
40280 </para>
40281 <informaltable frame="all">
40282 <tgroup cols="4" colsep="0" rowsep="0">
40283 <colspec colwidth="8*" align="left"/>
40284 <colspec colwidth="5*" align="center"/>
40285 <colspec colwidth="5*" align="center"/>
40286 <colspec colwidth="6*" align="right"/>
40287 <tbody>
40288 <row>
40289 <entry><option>command_timeout</option></entry>
40290 <entry>Use: <emphasis>smtp</emphasis></entry>
40291 <entry>Type: <emphasis>time</emphasis></entry>
40292 <entry>Default: <emphasis>5m</emphasis></entry>
40293 </row>
40294 </tbody>
40295 </tgroup>
40296 </informaltable>
40297 <para>
40298 This sets a timeout for receiving a response to an SMTP command that has been
40299 sent out. It is also used when waiting for the initial banner line from the
40300 remote host. Its value must not be zero.
40301 </para>
40302 <para>
40303 <indexterm role="option">
40304 <primary>connect_timeout</primary>
40305 </indexterm>
40306 </para>
40307 <informaltable frame="all">
40308 <tgroup cols="4" colsep="0" rowsep="0">
40309 <colspec colwidth="8*" align="left"/>
40310 <colspec colwidth="5*" align="center"/>
40311 <colspec colwidth="5*" align="center"/>
40312 <colspec colwidth="6*" align="right"/>
40313 <tbody>
40314 <row>
40315 <entry><option>connect_timeout</option></entry>
40316 <entry>Use: <emphasis>smtp</emphasis></entry>
40317 <entry>Type: <emphasis>time</emphasis></entry>
40318 <entry>Default: <emphasis>5m</emphasis></entry>
40319 </row>
40320 </tbody>
40321 </tgroup>
40322 </informaltable>
40323 <para>
40324 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
40325 to a remote host. A setting of zero allows the system timeout (typically
40326 several minutes) to act. To have any effect, the value of this option must be
40327 less than the system timeout. However, it has been observed that on some
40328 systems there is no system timeout, which is why the default value for this
40329 option is 5 minutes, a value recommended by RFC 1123.
40330 </para>
40331 <para>
40332 <indexterm role="option">
40333 <primary>connection_max_messages</primary>
40334 </indexterm>
40335 </para>
40336 <informaltable frame="all">
40337 <tgroup cols="4" colsep="0" rowsep="0">
40338 <colspec colwidth="8*" align="left"/>
40339 <colspec colwidth="5*" align="center"/>
40340 <colspec colwidth="5*" align="center"/>
40341 <colspec colwidth="6*" align="right"/>
40342 <tbody>
40343 <row>
40344 <entry><option>connection_max_messages</option></entry>
40345 <entry>Use: <emphasis>smtp</emphasis></entry>
40346 <entry>Type: <emphasis>integer</emphasis></entry>
40347 <entry>Default: <emphasis>500</emphasis></entry>
40348 </row>
40349 </tbody>
40350 </tgroup>
40351 </informaltable>
40352 <para>
40353 <indexterm role="concept">
40354 <primary>SMTP</primary>
40355 <secondary>passed connection</secondary>
40356 </indexterm>
40357 <indexterm role="concept">
40358 <primary>SMTP</primary>
40359 <secondary>multiple deliveries</secondary>
40360 </indexterm>
40361 <indexterm role="concept">
40362 <primary>multiple SMTP deliveries</primary>
40363 </indexterm>
40364 This controls the maximum number of separate message deliveries that are sent
40365 over a single TCP/IP connection. If the value is zero, there is no limit.
40366 For testing purposes, this value can be overridden by the <option>-oB</option> command line
40367 option.
40368 </para>
40369 <para>
40370 <indexterm role="option">
40371 <primary>data_timeout</primary>
40372 </indexterm>
40373 </para>
40374 <informaltable frame="all">
40375 <tgroup cols="4" colsep="0" rowsep="0">
40376 <colspec colwidth="8*" align="left"/>
40377 <colspec colwidth="5*" align="center"/>
40378 <colspec colwidth="5*" align="center"/>
40379 <colspec colwidth="6*" align="right"/>
40380 <tbody>
40381 <row>
40382 <entry><option>data_timeout</option></entry>
40383 <entry>Use: <emphasis>smtp</emphasis></entry>
40384 <entry>Type: <emphasis>time</emphasis></entry>
40385 <entry>Default: <emphasis>5m</emphasis></entry>
40386 </row>
40387 </tbody>
40388 </tgroup>
40389 </informaltable>
40390 <para>
40391 This sets a timeout for the transmission of each block in the data portion of
40392 the message. As a result, the overall timeout for a message depends on the size
40393 of the message. Its value must not be zero. See also <option>final_timeout</option>.
40394 </para>
40395 <para>
40396 <indexterm role="option">
40397 <primary>delay_after_cutoff</primary>
40398 </indexterm>
40399 </para>
40400 <informaltable frame="all">
40401 <tgroup cols="4" colsep="0" rowsep="0">
40402 <colspec colwidth="8*" align="left"/>
40403 <colspec colwidth="5*" align="center"/>
40404 <colspec colwidth="5*" align="center"/>
40405 <colspec colwidth="6*" align="right"/>
40406 <tbody>
40407 <row>
40408 <entry><option>delay_after_cutoff</option></entry>
40409 <entry>Use: <emphasis>smtp</emphasis></entry>
40410 <entry>Type: <emphasis>boolean</emphasis></entry>
40411 <entry>Default: <emphasis>true</emphasis></entry>
40412 </row>
40413 </tbody>
40414 </tgroup>
40415 </informaltable>
40416 <para>
40417 This option controls what happens when all remote IP addresses for a given
40418 domain have been inaccessible for so long that they have passed their retry
40419 cutoff times.
40420 </para>
40421 <para>
40422 In the default state, if the next retry time has not been reached for any of
40423 them, the address is bounced without trying any deliveries. In other words,
40424 Exim delays retrying an IP address after the final cutoff time until a new
40425 retry time is reached, and can therefore bounce an address without ever trying
40426 a delivery, when machines have been down for a long time. Some people are
40427 unhappy at this prospect, so...
40428 </para>
40429 <para>
40430 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
40431 addresses are past their final cutoff time, Exim tries to deliver to those
40432 IP addresses that have not been tried since the message arrived. If there are
40433 none, of if they all fail, the address is bounced. In other words, it does not
40434 delay when a new message arrives, but immediately tries those expired IP
40435 addresses that haven&#x2019;t been tried since the message arrived. If there is a
40436 continuous stream of messages for the dead hosts, unsetting
40437 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
40438 to them.
40439 </para>
40440 <para>
40441 <indexterm role="option">
40442 <primary>dns_qualify_single</primary>
40443 </indexterm>
40444 </para>
40445 <informaltable frame="all">
40446 <tgroup cols="4" colsep="0" rowsep="0">
40447 <colspec colwidth="8*" align="left"/>
40448 <colspec colwidth="5*" align="center"/>
40449 <colspec colwidth="5*" align="center"/>
40450 <colspec colwidth="6*" align="right"/>
40451 <tbody>
40452 <row>
40453 <entry><option>dns_qualify_single</option></entry>
40454 <entry>Use: <emphasis>smtp</emphasis></entry>
40455 <entry>Type: <emphasis>boolean</emphasis></entry>
40456 <entry>Default: <emphasis>true</emphasis></entry>
40457 </row>
40458 </tbody>
40459 </tgroup>
40460 </informaltable>
40461 <para>
40462 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
40463 and the <option>gethostbyname</option> option is false,
40464 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
40465 in chapter <xref linkend="CHAPdnslookup"/> for more details.
40466 </para>
40467 <para>
40468 <indexterm role="option">
40469 <primary>dns_search_parents</primary>
40470 </indexterm>
40471 </para>
40472 <informaltable frame="all">
40473 <tgroup cols="4" colsep="0" rowsep="0">
40474 <colspec colwidth="8*" align="left"/>
40475 <colspec colwidth="5*" align="center"/>
40476 <colspec colwidth="5*" align="center"/>
40477 <colspec colwidth="6*" align="right"/>
40478 <tbody>
40479 <row>
40480 <entry><option>dns_search_parents</option></entry>
40481 <entry>Use: <emphasis>smtp</emphasis></entry>
40482 <entry>Type: <emphasis>boolean</emphasis></entry>
40483 <entry>Default: <emphasis>false</emphasis></entry>
40484 </row>
40485 </tbody>
40486 </tgroup>
40487 </informaltable>
40488 <para>
40489 <indexterm role="concept">
40490 <primary><option>search_parents</option></primary>
40491 </indexterm>
40492 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
40493 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
40494 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
40495 details.
40496 </para>
40497 <para>
40498 <indexterm role="option">
40499 <primary>fallback_hosts</primary>
40500 </indexterm>
40501 </para>
40502 <informaltable frame="all">
40503 <tgroup cols="4" colsep="0" rowsep="0">
40504 <colspec colwidth="8*" align="left"/>
40505 <colspec colwidth="5*" align="center"/>
40506 <colspec colwidth="5*" align="center"/>
40507 <colspec colwidth="6*" align="right"/>
40508 <tbody>
40509 <row>
40510 <entry><option>fallback_hosts</option></entry>
40511 <entry>Use: <emphasis>smtp</emphasis></entry>
40512 <entry>Type: <emphasis>string list</emphasis></entry>
40513 <entry>Default: <emphasis>unset</emphasis></entry>
40514 </row>
40515 </tbody>
40516 </tgroup>
40517 </informaltable>
40518 <para>
40519 <indexterm role="concept">
40520 <primary>fallback</primary>
40521 <secondary>hosts specified on transport</secondary>
40522 </indexterm>
40523 String expansion is not applied to this option. The argument must be a
40524 colon-separated list of host names or IP addresses, optionally also including
40525 port numbers, though the separator can be changed, as described in section
40526 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40527 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40528 in section <xref linkend="SECTformatonehostitem"/>.
40529 </para>
40530 <para>
40531 Fallback hosts can also be specified on routers, which associate them with the
40532 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
40533 <option>fallback_hosts</option> specified on the transport is used only if the address does
40534 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
40535 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
40536 However, <option>hosts_randomize</option> does apply to fallback host lists.
40537 </para>
40538 <para>
40539 If Exim is unable to deliver to any of the hosts for a particular address, and
40540 the errors are not permanent rejections, the address is put on a separate
40541 transport queue with its host list replaced by the fallback hosts, unless the
40542 address was routed via MX records and the current host was in the original MX
40543 list. In that situation, the fallback host list is not used.
40544 </para>
40545 <para>
40546 Once normal deliveries are complete, the fallback queue is delivered by
40547 re-running the same transports with the new host lists. If several failing
40548 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
40549 copy of the message is sent.
40550 </para>
40551 <para>
40552 The resolution of the host names on the fallback list is controlled by the
40553 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
40554 both to cases when the host list comes with the address and when it is taken
40555 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
40556 fails</quote> facility.
40557 </para>
40558 <para>
40559 <indexterm role="option">
40560 <primary>final_timeout</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>final_timeout</option></entry>
40572 <entry>Use: <emphasis>smtp</emphasis></entry>
40573 <entry>Type: <emphasis>time</emphasis></entry>
40574 <entry>Default: <emphasis>10m</emphasis></entry>
40575 </row>
40576 </tbody>
40577 </tgroup>
40578 </informaltable>
40579 <para>
40580 This is the timeout that applies while waiting for the response to the final
40581 line containing just <quote>.</quote> that terminates a message. Its value must not be
40582 zero.
40583 </para>
40584 <para>
40585 <indexterm role="option">
40586 <primary>gethostbyname</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>gethostbyname</option></entry>
40598 <entry>Use: <emphasis>smtp</emphasis></entry>
40599 <entry>Type: <emphasis>boolean</emphasis></entry>
40600 <entry>Default: <emphasis>false</emphasis></entry>
40601 </row>
40602 </tbody>
40603 </tgroup>
40604 </informaltable>
40605 <para>
40606 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
40607 being used, names are looked up using <function>gethostbyname()</function>
40608 (or <function>getipnodebyname()</function> when available)
40609 instead of using the DNS. Of course, that function may in fact use the DNS, but
40610 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
40611 </para>
40612 <para>
40613 <indexterm role="option">
40614 <primary>helo_data</primary>
40615 </indexterm>
40616 </para>
40617 <informaltable frame="all">
40618 <tgroup cols="4" colsep="0" rowsep="0">
40619 <colspec colwidth="8*" align="left"/>
40620 <colspec colwidth="5*" align="center"/>
40621 <colspec colwidth="5*" align="center"/>
40622 <colspec colwidth="6*" align="right"/>
40623 <tbody>
40624 <row>
40625 <entry><option>helo_data</option></entry>
40626 <entry>Use: <emphasis>smtp</emphasis></entry>
40627 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40628 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
40629 </row>
40630 </tbody>
40631 </tgroup>
40632 </informaltable>
40633 <para>
40634 <indexterm role="concept">
40635 <primary>HELO argument</primary>
40636 <secondary>setting</secondary>
40637 </indexterm>
40638 <indexterm role="concept">
40639 <primary>EHLO argument</primary>
40640 <secondary>setting</secondary>
40641 </indexterm>
40642 <indexterm role="concept">
40643 <primary>LHLO argument</primary>
40644 <secondary>setting</secondary>
40645 </indexterm>
40646 The value of this option is expanded, and used as the argument for the EHLO,
40647 HELO, or LHLO command that starts the outgoing SMTP or LMTP session. The
40648 variables <varname>$host</varname> and <varname>$host_address</varname> are set to the identity of the remote
40649 host, and can be used to generate different values for different servers.
40650 </para>
40651 <para>
40652 <indexterm role="option">
40653 <primary>hosts</primary>
40654 </indexterm>
40655 </para>
40656 <informaltable frame="all">
40657 <tgroup cols="4" colsep="0" rowsep="0">
40658 <colspec colwidth="8*" align="left"/>
40659 <colspec colwidth="5*" align="center"/>
40660 <colspec colwidth="5*" align="center"/>
40661 <colspec colwidth="6*" align="right"/>
40662 <tbody>
40663 <row>
40664 <entry><option>hosts</option></entry>
40665 <entry>Use: <emphasis>smtp</emphasis></entry>
40666 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
40667 <entry>Default: <emphasis>unset</emphasis></entry>
40668 </row>
40669 </tbody>
40670 </tgroup>
40671 </informaltable>
40672 <para>
40673 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
40674 finds the hosts by looking up the address domain in the DNS, or by
40675 <command>manualroute</command>, which has lists of hosts in its configuration. However,
40676 email addresses can be passed to the <command>smtp</command> transport by any router, and not
40677 all of them can provide an associated list of hosts.
40678 </para>
40679 <para>
40680 The <option>hosts</option> option specifies a list of hosts to be used if the address being
40681 processed does not have any hosts associated with it. The hosts specified by
40682 <option>hosts</option> are also used, whether or not the address has its own hosts, if
40683 <option>hosts_override</option> is set.
40684 </para>
40685 <para>
40686 The string is first expanded, before being interpreted as a colon-separated
40687 list of host names or IP addresses, possibly including port numbers. The
40688 separator may be changed to something other than colon, as described in section
40689 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
40690 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
40691 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
40692 of the <command>manualroute</command> router is not available here.
40693 </para>
40694 <para>
40695 If the expansion fails, delivery is deferred. Unless the failure was caused by
40696 the inability to complete a lookup, the error is logged to the panic log as
40697 well as the main log. Host names are looked up either by searching directly for
40698 address records in the DNS or by calling <function>gethostbyname()</function> (or
40699 <function>getipnodebyname()</function> when available), depending on the setting of the
40700 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
40701 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
40702 address are used.
40703 </para>
40704 <para>
40705 During delivery, the hosts are tried in order, subject to their retry status,
40706 unless <option>hosts_randomize</option> is set.
40707 </para>
40708 <para>
40709 <indexterm role="option">
40710 <primary>hosts_avoid_esmtp</primary>
40711 </indexterm>
40712 </para>
40713 <informaltable frame="all">
40714 <tgroup cols="4" colsep="0" rowsep="0">
40715 <colspec colwidth="8*" align="left"/>
40716 <colspec colwidth="5*" align="center"/>
40717 <colspec colwidth="5*" align="center"/>
40718 <colspec colwidth="6*" align="right"/>
40719 <tbody>
40720 <row>
40721 <entry><option>hosts_avoid_esmtp</option></entry>
40722 <entry>Use: <emphasis>smtp</emphasis></entry>
40723 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
40724 <entry>Default: <emphasis>unset</emphasis></entry>
40725 </row>
40726 </tbody>
40727 </tgroup>
40728 </informaltable>
40729 <para>
40730 <indexterm role="concept">
40731 <primary>ESMTP</primary>
40732 <secondary>avoiding use of</secondary>
40733 </indexterm>
40734 <indexterm role="concept">
40735 <primary>HELO</primary>
40736 <secondary>forcing use of</secondary>
40737 </indexterm>
40738 <indexterm role="concept">
40739 <primary>EHLO</primary>
40740 <secondary>avoiding use of</secondary>
40741 </indexterm>
40742 <indexterm role="concept">
40743 <primary>PIPELINING</primary>
40744 <secondary>avoiding the use of</secondary>
40745 </indexterm>
40746 This option is for use with broken hosts that announce ESMTP facilities (for
40747 example, PIPELINING) and then fail to implement them properly. When a host
40748 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
40749 start of the SMTP session. This means that it cannot use any of the ESMTP
40750 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
40751 </para>
40752 <para>
40753 <indexterm role="option">
40754 <primary>hosts_avoid_tls</primary>
40755 </indexterm>
40756 </para>
40757 <informaltable frame="all">
40758 <tgroup cols="4" colsep="0" rowsep="0">
40759 <colspec colwidth="8*" align="left"/>
40760 <colspec colwidth="5*" align="center"/>
40761 <colspec colwidth="5*" align="center"/>
40762 <colspec colwidth="6*" align="right"/>
40763 <tbody>
40764 <row>
40765 <entry><option>hosts_avoid_tls</option></entry>
40766 <entry>Use: <emphasis>smtp</emphasis></entry>
40767 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
40768 <entry>Default: <emphasis>unset</emphasis></entry>
40769 </row>
40770 </tbody>
40771 </tgroup>
40772 </informaltable>
40773 <para>
40774 <indexterm role="concept">
40775 <primary>TLS</primary>
40776 <secondary>avoiding for certain hosts</secondary>
40777 </indexterm>
40778 Exim will not try to start a TLS session when delivering to any host that
40779 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
40780 </para>
40781 <para>
40782 <indexterm role="option">
40783 <primary>hosts_max_try</primary>
40784 </indexterm>
40785 </para>
40786 <informaltable frame="all">
40787 <tgroup cols="4" colsep="0" rowsep="0">
40788 <colspec colwidth="8*" align="left"/>
40789 <colspec colwidth="5*" align="center"/>
40790 <colspec colwidth="5*" align="center"/>
40791 <colspec colwidth="6*" align="right"/>
40792 <tbody>
40793 <row>
40794 <entry><option>hosts_max_try</option></entry>
40795 <entry>Use: <emphasis>smtp</emphasis></entry>
40796 <entry>Type: <emphasis>integer</emphasis></entry>
40797 <entry>Default: <emphasis>5</emphasis></entry>
40798 </row>
40799 </tbody>
40800 </tgroup>
40801 </informaltable>
40802 <para>
40803 <indexterm role="concept">
40804 <primary>host</primary>
40805 <secondary>maximum number to try</secondary>
40806 </indexterm>
40807 <indexterm role="concept">
40808 <primary>limit</primary>
40809 <secondary>number of hosts tried</secondary>
40810 </indexterm>
40811 <indexterm role="concept">
40812 <primary>limit</primary>
40813 <secondary>number of MX tried</secondary>
40814 </indexterm>
40815 <indexterm role="concept">
40816 <primary>MX record</primary>
40817 <secondary>maximum tried</secondary>
40818 </indexterm>
40819 This option limits the number of IP addresses that are tried for any one
40820 delivery in cases where there are temporary delivery errors. Section
40821 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
40822 </para>
40823 <para>
40824 <indexterm role="option">
40825 <primary>hosts_max_try_hardlimit</primary>
40826 </indexterm>
40827 </para>
40828 <informaltable frame="all">
40829 <tgroup cols="4" colsep="0" rowsep="0">
40830 <colspec colwidth="8*" align="left"/>
40831 <colspec colwidth="5*" align="center"/>
40832 <colspec colwidth="5*" align="center"/>
40833 <colspec colwidth="6*" align="right"/>
40834 <tbody>
40835 <row>
40836 <entry><option>hosts_max_try_hardlimit</option></entry>
40837 <entry>Use: <emphasis>smtp</emphasis></entry>
40838 <entry>Type: <emphasis>integer</emphasis></entry>
40839 <entry>Default: <emphasis>50</emphasis></entry>
40840 </row>
40841 </tbody>
40842 </tgroup>
40843 </informaltable>
40844 <para>
40845 This is an additional check on the maximum number of IP addresses that Exim
40846 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
40847 why it exists.
40848 </para>
40849 <para>
40850 <indexterm role="option">
40851 <primary>hosts_nopass_tls</primary>
40852 </indexterm>
40853 </para>
40854 <informaltable frame="all">
40855 <tgroup cols="4" colsep="0" rowsep="0">
40856 <colspec colwidth="8*" align="left"/>
40857 <colspec colwidth="5*" align="center"/>
40858 <colspec colwidth="5*" align="center"/>
40859 <colspec colwidth="6*" align="right"/>
40860 <tbody>
40861 <row>
40862 <entry><option>hosts_nopass_tls</option></entry>
40863 <entry>Use: <emphasis>smtp</emphasis></entry>
40864 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
40865 <entry>Default: <emphasis>unset</emphasis></entry>
40866 </row>
40867 </tbody>
40868 </tgroup>
40869 </informaltable>
40870 <para>
40871 <indexterm role="concept">
40872 <primary>TLS</primary>
40873 <secondary>passing connection</secondary>
40874 </indexterm>
40875 <indexterm role="concept">
40876 <primary>multiple SMTP deliveries</primary>
40877 </indexterm>
40878 <indexterm role="concept">
40879 <primary>TLS</primary>
40880 <secondary>multiple message deliveries</secondary>
40881 </indexterm>
40882 For any host that matches this list, a connection on which a TLS session has
40883 been started will not be passed to a new delivery process for sending another
40884 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
40885 explanation of when this might be needed.
40886 </para>
40887 <para>
40888 <indexterm role="option">
40889 <primary>hosts_override</primary>
40890 </indexterm>
40891 </para>
40892 <informaltable frame="all">
40893 <tgroup cols="4" colsep="0" rowsep="0">
40894 <colspec colwidth="8*" align="left"/>
40895 <colspec colwidth="5*" align="center"/>
40896 <colspec colwidth="5*" align="center"/>
40897 <colspec colwidth="6*" align="right"/>
40898 <tbody>
40899 <row>
40900 <entry><option>hosts_override</option></entry>
40901 <entry>Use: <emphasis>smtp</emphasis></entry>
40902 <entry>Type: <emphasis>boolean</emphasis></entry>
40903 <entry>Default: <emphasis>false</emphasis></entry>
40904 </row>
40905 </tbody>
40906 </tgroup>
40907 </informaltable>
40908 <para>
40909 If this option is set and the <option>hosts</option> option is also set, any hosts that are
40910 attached to the address are ignored, and instead the hosts specified by the
40911 <option>hosts</option> option are always used. This option does not apply to
40912 <option>fallback_hosts</option>.
40913 </para>
40914 <para>
40915 <indexterm role="option">
40916 <primary>hosts_randomize</primary>
40917 </indexterm>
40918 </para>
40919 <informaltable frame="all">
40920 <tgroup cols="4" colsep="0" rowsep="0">
40921 <colspec colwidth="8*" align="left"/>
40922 <colspec colwidth="5*" align="center"/>
40923 <colspec colwidth="5*" align="center"/>
40924 <colspec colwidth="6*" align="right"/>
40925 <tbody>
40926 <row>
40927 <entry><option>hosts_randomize</option></entry>
40928 <entry>Use: <emphasis>smtp</emphasis></entry>
40929 <entry>Type: <emphasis>boolean</emphasis></entry>
40930 <entry>Default: <emphasis>false</emphasis></entry>
40931 </row>
40932 </tbody>
40933 </tgroup>
40934 </informaltable>
40935 <para>
40936 <indexterm role="concept">
40937 <primary>randomized host list</primary>
40938 </indexterm>
40939 <indexterm role="concept">
40940 <primary>host</primary>
40941 <secondary>list of; randomized</secondary>
40942 </indexterm>
40943 <indexterm role="concept">
40944 <primary>fallback</primary>
40945 <secondary>randomized hosts</secondary>
40946 </indexterm>
40947 If this option is set, and either the list of hosts is taken from the
40948 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
40949 were not obtained from MX records (this includes fallback hosts from the
40950 router), and were not randomizied by the router, the order of trying the hosts
40951 is randomized each time the transport runs. Randomizing the order of a host
40952 list can be used to do crude load sharing.
40953 </para>
40954 <para>
40955 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
40956 order is separately randomized. This makes it possible to set up MX-like
40957 behaviour. The boundaries between groups are indicated by an item that is just
40958 <literal>+</literal> in the host list. For example:
40959 </para>
40960 <literallayout class="monospaced">
40961 hosts = host1:host2:host3:+:host4:host5
40962 </literallayout>
40963 <para>
40964 The order of the first three hosts and the order of the last two hosts is
40965 randomized for each use, but the first three always end up before the last two.
40966 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
40967 </para>
40968 <para>
40969 <indexterm role="option">
40970 <primary>hosts_require_auth</primary>
40971 </indexterm>
40972 </para>
40973 <informaltable frame="all">
40974 <tgroup cols="4" colsep="0" rowsep="0">
40975 <colspec colwidth="8*" align="left"/>
40976 <colspec colwidth="5*" align="center"/>
40977 <colspec colwidth="5*" align="center"/>
40978 <colspec colwidth="6*" align="right"/>
40979 <tbody>
40980 <row>
40981 <entry><option>hosts_require_auth</option></entry>
40982 <entry>Use: <emphasis>smtp</emphasis></entry>
40983 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
40984 <entry>Default: <emphasis>unset</emphasis></entry>
40985 </row>
40986 </tbody>
40987 </tgroup>
40988 </informaltable>
40989 <para>
40990 <indexterm role="concept">
40991 <primary>authentication</primary>
40992 <secondary>required by client</secondary>
40993 </indexterm>
40994 This option provides a list of servers for which authentication must succeed
40995 before Exim will try to transfer a message. If authentication fails for
40996 servers which are not in this list, Exim tries to send unauthenticated. If
40997 authentication fails for one of these servers, delivery is deferred. This
40998 temporary error is detectable in the retry rules, so it can be turned into a
40999 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
41000 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41001 </para>
41002 <para>
41003 <indexterm role="option">
41004 <primary>hosts_require_tls</primary>
41005 </indexterm>
41006 </para>
41007 <informaltable frame="all">
41008 <tgroup cols="4" colsep="0" rowsep="0">
41009 <colspec colwidth="8*" align="left"/>
41010 <colspec colwidth="5*" align="center"/>
41011 <colspec colwidth="5*" align="center"/>
41012 <colspec colwidth="6*" align="right"/>
41013 <tbody>
41014 <row>
41015 <entry><option>hosts_require_tls</option></entry>
41016 <entry>Use: <emphasis>smtp</emphasis></entry>
41017 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41018 <entry>Default: <emphasis>unset</emphasis></entry>
41019 </row>
41020 </tbody>
41021 </tgroup>
41022 </informaltable>
41023 <para>
41024 <indexterm role="concept">
41025 <primary>TLS</primary>
41026 <secondary>requiring for certain servers</secondary>
41027 </indexterm>
41028 Exim will insist on using a TLS session when delivering to any host that
41029 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41030 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
41031 incoming messages, use an appropriate ACL.
41032 </para>
41033 <para>
41034 <indexterm role="option">
41035 <primary>hosts_try_auth</primary>
41036 </indexterm>
41037 </para>
41038 <informaltable frame="all">
41039 <tgroup cols="4" colsep="0" rowsep="0">
41040 <colspec colwidth="8*" align="left"/>
41041 <colspec colwidth="5*" align="center"/>
41042 <colspec colwidth="5*" align="center"/>
41043 <colspec colwidth="6*" align="right"/>
41044 <tbody>
41045 <row>
41046 <entry><option>hosts_try_auth</option></entry>
41047 <entry>Use: <emphasis>smtp</emphasis></entry>
41048 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41049 <entry>Default: <emphasis>unset</emphasis></entry>
41050 </row>
41051 </tbody>
41052 </tgroup>
41053 </informaltable>
41054 <para>
41055 <indexterm role="concept">
41056 <primary>authentication</primary>
41057 <secondary>optional in client</secondary>
41058 </indexterm>
41059 This option provides a list of servers to which, provided they announce
41060 authentication support, Exim will attempt to authenticate as a client when it
41061 connects. If authentication fails, Exim will try to transfer the message
41062 unauthenticated. See also <option>hosts_require_auth</option>, and chapter
41063 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
41064 </para>
41065 <para>
41066 <indexterm role="option">
41067 <primary>interface</primary>
41068 </indexterm>
41069 </para>
41070 <informaltable frame="all">
41071 <tgroup cols="4" colsep="0" rowsep="0">
41072 <colspec colwidth="8*" align="left"/>
41073 <colspec colwidth="5*" align="center"/>
41074 <colspec colwidth="5*" align="center"/>
41075 <colspec colwidth="6*" align="right"/>
41076 <tbody>
41077 <row>
41078 <entry><option>interface</option></entry>
41079 <entry>Use: <emphasis>smtp</emphasis></entry>
41080 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
41081 <entry>Default: <emphasis>unset</emphasis></entry>
41082 </row>
41083 </tbody>
41084 </tgroup>
41085 </informaltable>
41086 <para>
41087 <indexterm role="concept">
41088 <primary>bind IP address</primary>
41089 </indexterm>
41090 <indexterm role="concept">
41091 <primary>IP address</primary>
41092 <secondary>binding</secondary>
41093 </indexterm>
41094 <indexterm role="concept">
41095 <primary><varname>$host</varname></primary>
41096 </indexterm>
41097 <indexterm role="concept">
41098 <primary><varname>$host_address</varname></primary>
41099 </indexterm>
41100 This option specifies which interface to bind to when making an outgoing SMTP
41101 call. The variables <varname>$host</varname> and <varname>$host_address</varname> refer to the host to which a
41102 connection is about to be made during the expansion of the string. Forced
41103 expansion failure, or an empty string result causes the option to be ignored.
41104 Otherwise, after expansion,
41105 the string must be a list of IP addresses, colon-separated by default, but the
41106 separator can be changed in the usual way.
41107 For example:
41108 </para>
41109 <literallayout class="monospaced">
41110 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
41111 </literallayout>
41112 <para>
41113 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
41114 connection. If none of them are the correct type, the option is ignored. If
41115 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
41116 interface to use if the host has more than one.
41117 </para>
41118 <para>
41119 <indexterm role="option">
41120 <primary>keepalive</primary>
41121 </indexterm>
41122 </para>
41123 <informaltable frame="all">
41124 <tgroup cols="4" colsep="0" rowsep="0">
41125 <colspec colwidth="8*" align="left"/>
41126 <colspec colwidth="5*" align="center"/>
41127 <colspec colwidth="5*" align="center"/>
41128 <colspec colwidth="6*" align="right"/>
41129 <tbody>
41130 <row>
41131 <entry><option>keepalive</option></entry>
41132 <entry>Use: <emphasis>smtp</emphasis></entry>
41133 <entry>Type: <emphasis>boolean</emphasis></entry>
41134 <entry>Default: <emphasis>true</emphasis></entry>
41135 </row>
41136 </tbody>
41137 </tgroup>
41138 </informaltable>
41139 <para>
41140 <indexterm role="concept">
41141 <primary>keepalive</primary>
41142 <secondary>on outgoing connection</secondary>
41143 </indexterm>
41144 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
41145 connections. When set, it causes the kernel to probe idle connections
41146 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
41147 of the connection should send a acknowledgement if the connection is still okay
41148 or a reset if the connection has been aborted. The reason for doing this is
41149 that it has the beneficial effect of freeing up certain types of connection
41150 that can get stuck when the remote host is disconnected without tidying up the
41151 TCP/IP call properly. The keepalive mechanism takes several hours to detect
41152 unreachable hosts.
41153 </para>
41154 <para>
41155 <indexterm role="option">
41156 <primary>lmtp_ignore_quota</primary>
41157 </indexterm>
41158 </para>
41159 <informaltable frame="all">
41160 <tgroup cols="4" colsep="0" rowsep="0">
41161 <colspec colwidth="8*" align="left"/>
41162 <colspec colwidth="5*" align="center"/>
41163 <colspec colwidth="5*" align="center"/>
41164 <colspec colwidth="6*" align="right"/>
41165 <tbody>
41166 <row>
41167 <entry><option>lmtp_ignore_quota</option></entry>
41168 <entry>Use: <emphasis>smtp</emphasis></entry>
41169 <entry>Type: <emphasis>boolean</emphasis></entry>
41170 <entry>Default: <emphasis>false</emphasis></entry>
41171 </row>
41172 </tbody>
41173 </tgroup>
41174 </informaltable>
41175 <para>
41176 <indexterm role="concept">
41177 <primary>LMTP</primary>
41178 <secondary>ignoring quota errors</secondary>
41179 </indexterm>
41180 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
41181 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
41182 has advertised support for IGNOREQUOTA in its response to the LHLO command.
41183 </para>
41184 <para>
41185 <indexterm role="option">
41186 <primary>max_rcpt</primary>
41187 </indexterm>
41188 </para>
41189 <informaltable frame="all">
41190 <tgroup cols="4" colsep="0" rowsep="0">
41191 <colspec colwidth="8*" align="left"/>
41192 <colspec colwidth="5*" align="center"/>
41193 <colspec colwidth="5*" align="center"/>
41194 <colspec colwidth="6*" align="right"/>
41195 <tbody>
41196 <row>
41197 <entry><option>max_rcpt</option></entry>
41198 <entry>Use: <emphasis>smtp</emphasis></entry>
41199 <entry>Type: <emphasis>integer</emphasis></entry>
41200 <entry>Default: <emphasis>100</emphasis></entry>
41201 </row>
41202 </tbody>
41203 </tgroup>
41204 </informaltable>
41205 <para>
41206 <indexterm role="concept">
41207 <primary>RCPT</primary>
41208 <secondary>maximum number of outgoing</secondary>
41209 </indexterm>
41210 This option limits the number of RCPT commands that are sent in a single
41211 SMTP message transaction. Each set of addresses is treated independently, and
41212 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
41213 permits this.
41214 </para>
41215 <para>
41216 <indexterm role="option">
41217 <primary>multi_domain</primary>
41218 </indexterm>
41219 </para>
41220 <informaltable frame="all">
41221 <tgroup cols="4" colsep="0" rowsep="0">
41222 <colspec colwidth="8*" align="left"/>
41223 <colspec colwidth="5*" align="center"/>
41224 <colspec colwidth="5*" align="center"/>
41225 <colspec colwidth="6*" align="right"/>
41226 <tbody>
41227 <row>
41228 <entry><option>multi_domain</option></entry>
41229 <entry>Use: <emphasis>smtp</emphasis></entry>
41230 <entry>Type: <emphasis>boolean</emphasis></entry>
41231 <entry>Default: <emphasis>true</emphasis></entry>
41232 </row>
41233 </tbody>
41234 </tgroup>
41235 </informaltable>
41236 <para>
41237 <indexterm role="concept">
41238 <primary><varname>$domain</varname></primary>
41239 </indexterm>
41240 When this option is set, the <command>smtp</command> transport can handle a number of
41241 addresses containing a mixture of different domains provided they all resolve
41242 to the same list of hosts. Turning the option off restricts the transport to
41243 handling only one domain at a time. This is useful if you want to use
41244 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
41245 is a single domain involved in a remote delivery.
41246 </para>
41247 <para>
41248 <indexterm role="option">
41249 <primary>port</primary>
41250 </indexterm>
41251 </para>
41252 <informaltable frame="all">
41253 <tgroup cols="4" colsep="0" rowsep="0">
41254 <colspec colwidth="8*" align="left"/>
41255 <colspec colwidth="5*" align="center"/>
41256 <colspec colwidth="5*" align="center"/>
41257 <colspec colwidth="6*" align="right"/>
41258 <tbody>
41259 <row>
41260 <entry><option>port</option></entry>
41261 <entry>Use: <emphasis>smtp</emphasis></entry>
41262 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41263 <entry>Default: <emphasis>see below</emphasis></entry>
41264 </row>
41265 </tbody>
41266 </tgroup>
41267 </informaltable>
41268 <para>
41269 <indexterm role="concept">
41270 <primary>port</primary>
41271 <secondary>sending TCP/IP</secondary>
41272 </indexterm>
41273 <indexterm role="concept">
41274 <primary>TCP/IP</primary>
41275 <secondary>setting outgoing port</secondary>
41276 </indexterm>
41277 This option specifies the TCP/IP port on the server to which Exim connects. If
41278 it begins with a digit it is taken as a port number; otherwise it is looked up
41279 using <function>getservbyname()</function>. The default value is normally <quote>smtp</quote>, but if
41280 <option>protocol</option> is set to <quote>lmtp</quote>, the default is <quote>lmtp</quote>.
41281 If the expansion fails, or if a port number cannot be found, delivery is
41282 deferred.
41283 </para>
41284 <para>
41285 <indexterm role="option">
41286 <primary>protocol</primary>
41287 </indexterm>
41288 </para>
41289 <informaltable frame="all">
41290 <tgroup cols="4" colsep="0" rowsep="0">
41291 <colspec colwidth="8*" align="left"/>
41292 <colspec colwidth="5*" align="center"/>
41293 <colspec colwidth="5*" align="center"/>
41294 <colspec colwidth="6*" align="right"/>
41295 <tbody>
41296 <row>
41297 <entry><option>protocol</option></entry>
41298 <entry>Use: <emphasis>smtp</emphasis></entry>
41299 <entry>Type: <emphasis>string</emphasis></entry>
41300 <entry>Default: <emphasis>smtp</emphasis></entry>
41301 </row>
41302 </tbody>
41303 </tgroup>
41304 </informaltable>
41305 <para>
41306 <indexterm role="concept">
41307 <primary>LMTP</primary>
41308 <secondary>over TCP/IP</secondary>
41309 </indexterm>
41310 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
41311 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
41312 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
41313 deliveries into closed message stores. Exim also has support for running LMTP
41314 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
41315 </para>
41316 <para>
41317 <indexterm role="option">
41318 <primary>retry_include_ip_address</primary>
41319 </indexterm>
41320 </para>
41321 <informaltable frame="all">
41322 <tgroup cols="4" colsep="0" rowsep="0">
41323 <colspec colwidth="8*" align="left"/>
41324 <colspec colwidth="5*" align="center"/>
41325 <colspec colwidth="5*" align="center"/>
41326 <colspec colwidth="6*" align="right"/>
41327 <tbody>
41328 <row>
41329 <entry><option>retry_include_ip_address</option></entry>
41330 <entry>Use: <emphasis>smtp</emphasis></entry>
41331 <entry>Type: <emphasis>boolean</emphasis></entry>
41332 <entry>Default: <emphasis>true</emphasis></entry>
41333 </row>
41334 </tbody>
41335 </tgroup>
41336 </informaltable>
41337 <para>
41338 Exim normally includes both the host name and the IP address in the key it
41339 constructs for indexing retry data after a temporary delivery failure. This
41340 means that when one of several IP addresses for a host is failing, it gets
41341 tried periodically (controlled by the retry rules), but use of the other IP
41342 addresses is not affected.
41343 </para>
41344 <para>
41345 However, in some dialup environments hosts are assigned a different IP address
41346 each time they connect. In this situation the use of the IP address as part of
41347 the retry key leads to undesirable behaviour. Setting this option false causes
41348 Exim to use only the host name. This should normally be done on a separate
41349 instance of the <command>smtp</command> transport, set up specially to handle the dialup
41350 hosts.
41351 </para>
41352 <para>
41353 <indexterm role="option">
41354 <primary>serialize_hosts</primary>
41355 </indexterm>
41356 </para>
41357 <informaltable frame="all">
41358 <tgroup cols="4" colsep="0" rowsep="0">
41359 <colspec colwidth="8*" align="left"/>
41360 <colspec colwidth="5*" align="center"/>
41361 <colspec colwidth="5*" align="center"/>
41362 <colspec colwidth="6*" align="right"/>
41363 <tbody>
41364 <row>
41365 <entry><option>serialize_hosts</option></entry>
41366 <entry>Use: <emphasis>smtp</emphasis></entry>
41367 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
41368 <entry>Default: <emphasis>unset</emphasis></entry>
41369 </row>
41370 </tbody>
41371 </tgroup>
41372 </informaltable>
41373 <para>
41374 <indexterm role="concept">
41375 <primary>serializing connections</primary>
41376 </indexterm>
41377 <indexterm role="concept">
41378 <primary>host</primary>
41379 <secondary>serializing connections</secondary>
41380 </indexterm>
41381 Because Exim operates in a distributed manner, if several messages for the same
41382 host arrive at around the same time, more than one simultaneous connection to
41383 the remote host can occur. This is not usually a problem except when there is a
41384 slow link between the hosts. In that situation it may be helpful to restrict
41385 Exim to one connection at a time. This can be done by setting
41386 <option>serialize_hosts</option> to match the relevant hosts.
41387 </para>
41388 <para>
41389 <indexterm role="concept">
41390 <primary>hints database</primary>
41391 <secondary>serializing deliveries to a host</secondary>
41392 </indexterm>
41393 Exim implements serialization by means of a hints database in which a record is
41394 written whenever a process connects to one of the restricted hosts. The record
41395 is deleted when the connection is completed. Obviously there is scope for
41396 records to get left lying around if there is a system or program crash. To
41397 guard against this, Exim ignores any records that are more than six hours old.
41398 </para>
41399 <para>
41400 If you set up this kind of serialization, you should also arrange to delete the
41401 relevant hints database whenever your system reboots. The names of the files
41402 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
41403 may be one or two files, depending on the type of DBM in use. The same files
41404 are used for ETRN serialization.
41405 </para>
41406 <para>
41407 <indexterm role="option">
41408 <primary>size_addition</primary>
41409 </indexterm>
41410 </para>
41411 <informaltable frame="all">
41412 <tgroup cols="4" colsep="0" rowsep="0">
41413 <colspec colwidth="8*" align="left"/>
41414 <colspec colwidth="5*" align="center"/>
41415 <colspec colwidth="5*" align="center"/>
41416 <colspec colwidth="6*" align="right"/>
41417 <tbody>
41418 <row>
41419 <entry><option>size_addition</option></entry>
41420 <entry>Use: <emphasis>smtp</emphasis></entry>
41421 <entry>Type: <emphasis>integer</emphasis></entry>
41422 <entry>Default: <emphasis>1024</emphasis></entry>
41423 </row>
41424 </tbody>
41425 </tgroup>
41426 </informaltable>
41427 <para>
41428 <indexterm role="concept">
41429 <primary>SMTP</primary>
41430 <secondary>SIZE</secondary>
41431 </indexterm>
41432 <indexterm role="concept">
41433 <primary>message</primary>
41434 <secondary>size issue for transport filter</secondary>
41435 </indexterm>
41436 <indexterm role="concept">
41437 <primary>size</primary>
41438 <secondary>of message</secondary>
41439 </indexterm>
41440 <indexterm role="concept">
41441 <primary>transport</primary>
41442 <secondary>filter</secondary>
41443 </indexterm>
41444 <indexterm role="concept">
41445 <primary>filter</primary>
41446 <secondary>transport filter</secondary>
41447 </indexterm>
41448 If a remote SMTP server indicates that it supports the SIZE option of the
41449 MAIL command, Exim uses this to pass over the message size at the start of
41450 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
41451 sends, to allow for headers and other text that may be added during delivery by
41452 configuration options or in a transport filter. It may be necessary to increase
41453 this if a lot of text is added to messages.
41454 </para>
41455 <para>
41456 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
41457 the use of the SIZE option altogether.
41458 </para>
41459 <para>
41460 <indexterm role="option">
41461 <primary>tls_certificate</primary>
41462 </indexterm>
41463 </para>
41464 <informaltable frame="all">
41465 <tgroup cols="4" colsep="0" rowsep="0">
41466 <colspec colwidth="8*" align="left"/>
41467 <colspec colwidth="5*" align="center"/>
41468 <colspec colwidth="5*" align="center"/>
41469 <colspec colwidth="6*" align="right"/>
41470 <tbody>
41471 <row>
41472 <entry><option>tls_certificate</option></entry>
41473 <entry>Use: <emphasis>smtp</emphasis></entry>
41474 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41475 <entry>Default: <emphasis>unset</emphasis></entry>
41476 </row>
41477 </tbody>
41478 </tgroup>
41479 </informaltable>
41480 <para>
41481 <indexterm role="concept">
41482 <primary>TLS client certificate</primary>
41483 <secondary>location of</secondary>
41484 </indexterm>
41485 <indexterm role="concept">
41486 <primary>certificate for client</primary>
41487 <secondary>location of</secondary>
41488 </indexterm>
41489 <indexterm role="concept">
41490 <primary><varname>$host</varname></primary>
41491 </indexterm>
41492 <indexterm role="concept">
41493 <primary><varname>$host_address</varname></primary>
41494 </indexterm>
41495 The value of this option must be the absolute path to a file which contains the
41496 client&#x2019;s certificate, for possible use when sending a message over an encrypted
41497 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
41498 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
41499 details of TLS.
41500 </para>
41501 <para>
41502 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
41503 certificate when sending messages as a client. The global option of the same
41504 name specifies the certificate for Exim as a server; it is not automatically
41505 assumed that the same certificate should be used when Exim is operating as a
41506 client.
41507 </para>
41508 <para>
41509 <indexterm role="option">
41510 <primary>tls_crl</primary>
41511 </indexterm>
41512 </para>
41513 <informaltable frame="all">
41514 <tgroup cols="4" colsep="0" rowsep="0">
41515 <colspec colwidth="8*" align="left"/>
41516 <colspec colwidth="5*" align="center"/>
41517 <colspec colwidth="5*" align="center"/>
41518 <colspec colwidth="6*" align="right"/>
41519 <tbody>
41520 <row>
41521 <entry><option>tls_crl</option></entry>
41522 <entry>Use: <emphasis>smtp</emphasis></entry>
41523 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41524 <entry>Default: <emphasis>unset</emphasis></entry>
41525 </row>
41526 </tbody>
41527 </tgroup>
41528 </informaltable>
41529 <para>
41530 <indexterm role="concept">
41531 <primary>TLS</primary>
41532 <secondary>client certificate revocation list</secondary>
41533 </indexterm>
41534 <indexterm role="concept">
41535 <primary>certificate</primary>
41536 <secondary>revocation list for client</secondary>
41537 </indexterm>
41538 This option specifies a certificate revocation list. The expanded value must
41539 be the name of a file that contains a CRL in PEM format.
41540 </para>
41541 <para>
41542 <indexterm role="option">
41543 <primary>tls_privatekey</primary>
41544 </indexterm>
41545 </para>
41546 <informaltable frame="all">
41547 <tgroup cols="4" colsep="0" rowsep="0">
41548 <colspec colwidth="8*" align="left"/>
41549 <colspec colwidth="5*" align="center"/>
41550 <colspec colwidth="5*" align="center"/>
41551 <colspec colwidth="6*" align="right"/>
41552 <tbody>
41553 <row>
41554 <entry><option>tls_privatekey</option></entry>
41555 <entry>Use: <emphasis>smtp</emphasis></entry>
41556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41557 <entry>Default: <emphasis>unset</emphasis></entry>
41558 </row>
41559 </tbody>
41560 </tgroup>
41561 </informaltable>
41562 <para>
41563 <indexterm role="concept">
41564 <primary>TLS client private key</primary>
41565 <secondary>location of</secondary>
41566 </indexterm>
41567 <indexterm role="concept">
41568 <primary><varname>$host</varname></primary>
41569 </indexterm>
41570 <indexterm role="concept">
41571 <primary><varname>$host_address</varname></primary>
41572 </indexterm>
41573 The value of this option must be the absolute path to a file which contains the
41574 client&#x2019;s private key. This is used when sending a message over an encrypted
41575 connection using a client certificate. The values of <varname>$host</varname> and
41576 <varname>$host_address</varname> are set to the name and address of the server during the
41577 expansion. If this option is unset, or the expansion is forced to fail, or the
41578 result is an empty string, the private key is assumed to be in the same file as
41579 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41580 </para>
41581 <para>
41582 <indexterm role="option">
41583 <primary>tls_require_ciphers</primary>
41584 </indexterm>
41585 </para>
41586 <informaltable frame="all">
41587 <tgroup cols="4" colsep="0" rowsep="0">
41588 <colspec colwidth="8*" align="left"/>
41589 <colspec colwidth="5*" align="center"/>
41590 <colspec colwidth="5*" align="center"/>
41591 <colspec colwidth="6*" align="right"/>
41592 <tbody>
41593 <row>
41594 <entry><option>tls_require_ciphers</option></entry>
41595 <entry>Use: <emphasis>smtp</emphasis></entry>
41596 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41597 <entry>Default: <emphasis>unset</emphasis></entry>
41598 </row>
41599 </tbody>
41600 </tgroup>
41601 </informaltable>
41602 <para>
41603 <indexterm role="concept">
41604 <primary>TLS</primary>
41605 <secondary>requiring specific ciphers</secondary>
41606 </indexterm>
41607 <indexterm role="concept">
41608 <primary>cipher</primary>
41609 <secondary>requiring specific</secondary>
41610 </indexterm>
41611 <indexterm role="concept">
41612 <primary><varname>$host</varname></primary>
41613 </indexterm>
41614 <indexterm role="concept">
41615 <primary><varname>$host_address</varname></primary>
41616 </indexterm>
41617 The value of this option must be a list of permitted cipher suites, for use
41618 when setting up an outgoing encrypted connection. (There is a global option of
41619 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
41620 <varname>$host_address</varname> are set to the name and address of the server during the
41621 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
41622 is used in different ways by OpenSSL and GnuTLS (see sections
41623 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
41624 ciphers is a preference order.
41625 </para>
41626 <para>
41627 <indexterm role="option">
41628 <primary>tls_tempfail_tryclear</primary>
41629 </indexterm>
41630 </para>
41631 <informaltable frame="all">
41632 <tgroup cols="4" colsep="0" rowsep="0">
41633 <colspec colwidth="8*" align="left"/>
41634 <colspec colwidth="5*" align="center"/>
41635 <colspec colwidth="5*" align="center"/>
41636 <colspec colwidth="6*" align="right"/>
41637 <tbody>
41638 <row>
41639 <entry><option>tls_tempfail_tryclear</option></entry>
41640 <entry>Use: <emphasis>smtp</emphasis></entry>
41641 <entry>Type: <emphasis>boolean</emphasis></entry>
41642 <entry>Default: <emphasis>true</emphasis></entry>
41643 </row>
41644 </tbody>
41645 </tgroup>
41646 </informaltable>
41647 <para>
41648 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
41649 setting up a TLS session, this option determines whether or not Exim should try
41650 to deliver the message unencrypted. If it is set false, delivery to the
41651 current host is deferred; if there are other hosts, they are tried. If this
41652 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
41653 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
41654 TLS negotiation fails, Exim closes the current connection (because it is in an
41655 unknown state), opens a new one to the same host, and then tries the delivery
41656 in clear.
41657 </para>
41658 <para>
41659 <indexterm role="option">
41660 <primary>tls_verify_certificates</primary>
41661 </indexterm>
41662 </para>
41663 <informaltable frame="all">
41664 <tgroup cols="4" colsep="0" rowsep="0">
41665 <colspec colwidth="8*" align="left"/>
41666 <colspec colwidth="5*" align="center"/>
41667 <colspec colwidth="5*" align="center"/>
41668 <colspec colwidth="6*" align="right"/>
41669 <tbody>
41670 <row>
41671 <entry><option>tls_verify_certificates</option></entry>
41672 <entry>Use: <emphasis>smtp</emphasis></entry>
41673 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41674 <entry>Default: <emphasis>unset</emphasis></entry>
41675 </row>
41676 </tbody>
41677 </tgroup>
41678 </informaltable>
41679 <para>
41680 <indexterm role="concept">
41681 <primary>TLS</primary>
41682 <secondary>server certificate verification</secondary>
41683 </indexterm>
41684 <indexterm role="concept">
41685 <primary>certificate</primary>
41686 <secondary>verification of server</secondary>
41687 </indexterm>
41688 <indexterm role="concept">
41689 <primary><varname>$host</varname></primary>
41690 </indexterm>
41691 <indexterm role="concept">
41692 <primary><varname>$host_address</varname></primary>
41693 </indexterm>
41694 The value of this option must be the absolute path to a file containing
41695 permitted server certificates, for use when setting up an encrypted connection.
41696 Alternatively, if you are using OpenSSL, you can set
41697 <option>tls_verify_certificates</option> to the name of a directory containing certificate
41698 files. This does not work with GnuTLS; the option must be set to the name of a
41699 single file if you are using GnuTLS. The values of <varname>$host</varname> and
41700 <varname>$host_address</varname> are set to the name and address of the server during the
41701 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
41702 </para>
41703 </section>
41704 <section id="SECTvalhosmax">
41705 <title>How the limits for the number of hosts to try are used</title>
41706 <para>
41707 <indexterm role="concept">
41708 <primary>host</primary>
41709 <secondary>maximum number to try</secondary>
41710 </indexterm>
41711 <indexterm role="concept">
41712 <primary>limit</primary>
41713 <secondary>hosts; maximum number tried</secondary>
41714 </indexterm>
41715 There are two options that are concerned with the number of hosts that are
41716 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
41717 <option>hosts_max_try_hardlimit</option>.
41718 </para>
41719 <para>
41720 The <option>hosts_max_try</option> option limits the number of hosts that are tried
41721 for a single delivery. However, despite the term <quote>host</quote> in its name, the
41722 option actually applies to each IP address independently. In other words, a
41723 multihomed host is treated as several independent hosts, just as it is for
41724 retrying.
41725 </para>
41726 <para>
41727 Many of the larger ISPs have multiple MX records which often point to
41728 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
41729 created as a result of routing one of these domains.
41730 </para>
41731 <para>
41732 Trying every single IP address on such a long list does not seem sensible; if
41733 several at the top of the list fail, it is reasonable to assume there is some
41734 problem that is likely to affect all of them. Roughly speaking, the value of
41735 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
41736 delivery. However, the logic cannot be quite that simple.
41737 </para>
41738 <para>
41739 Firstly, IP addresses that are skipped because their retry times have not
41740 arrived do not count, and in addition, addresses that are past their retry
41741 limits are also not counted, even when they are tried. This means that when
41742 some IP addresses are past their retry limits, more than the value of
41743 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
41744 that all IP addresses are considered before timing out an email address (but
41745 see below for an exception).
41746 </para>
41747 <para>
41748 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
41749 list to see if there is a subsequent host with a different (higher valued) MX.
41750 If there is, that host is considered next, and the current IP address is used
41751 but not counted. This behaviour helps in the case of a domain with a retry rule
41752 that hardly ever delays any hosts, as is now explained:
41753 </para>
41754 <para>
41755 Consider the case of a long list of hosts with one MX value, and a few with a
41756 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
41757 hosts at the top of the list are tried at first. With the default retry rule,
41758 which specifies increasing retry times, the higher MX hosts are eventually
41759 tried when those at the top of the list are skipped because they have not
41760 reached their retry times.
41761 </para>
41762 <para>
41763 However, it is common practice to put a fixed short retry time on domains for
41764 large ISPs, on the grounds that their servers are rarely down for very long.
41765 Unfortunately, these are exactly the domains that tend to resolve to long lists
41766 of hosts. The short retry time means that the lowest MX hosts are tried every
41767 time. The attempts may be in a different order because of random sorting, but
41768 without the special MX check, the higher MX hosts would never be tried until
41769 all the lower MX hosts had timed out (which might be several days), because
41770 there are always some lower MX hosts that have reached their retry times. With
41771 the special check, Exim considers at least one IP address from each MX value at
41772 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
41773 reached.
41774 </para>
41775 <para>
41776 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
41777 particular, Exim normally eventually tries all the IP addresses before timing
41778 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
41779 reasonable thing to do. Recently, however, some lunatic DNS configurations have
41780 been set up with hundreds of IP addresses for some domains. It can
41781 take a very long time indeed for an address to time out in these cases.
41782 </para>
41783 <para>
41784 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
41785 Exim never tries more than this number of IP addresses; if it hits this limit
41786 and they are all timed out, the email address is bounced, even though not all
41787 possible IP addresses have been tried.
41788 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
41789 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
41790 </para>
41791 </section>
41792 </chapter>
41793
41794 <chapter id="CHAPrewrite">
41795 <title>Address rewriting</title>
41796 <para>
41797 <indexterm role="concept" id="IIDaddrew" class="startofrange">
41798 <primary>rewriting</primary>
41799 <secondary>addresses</secondary>
41800 </indexterm>
41801 There are some circumstances in which Exim automatically rewrites domains in
41802 addresses. The two most common are when an address is given without a domain
41803 (referred to as an <quote>unqualified address</quote>) or when an address contains an
41804 abbreviated domain that is expanded by DNS lookup.
41805 </para>
41806 <para>
41807 Unqualified envelope addresses are accepted only for locally submitted
41808 messages, or for messages that are received from hosts matching
41809 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
41810 appropriate. Unqualified addresses in header lines are qualified if they are in
41811 locally submitted messages, or messages from hosts that are permitted to send
41812 unqualified envelope addresses. Otherwise, unqualified addresses in header
41813 lines are neither qualified nor rewritten.
41814 </para>
41815 <para>
41816 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
41817 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
41818 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
41819 do this. The new RFCs do not contain this suggestion.
41820 </para>
41821 <section>
41822 <title>Explicitly configured address rewriting</title>
41823 <para>
41824 This chapter describes the rewriting rules that can be used in the
41825 main rewrite section of the configuration file, and also in the generic
41826 <option>headers_rewrite</option> option that can be set on any transport.
41827 </para>
41828 <para>
41829 Some people believe that configured address rewriting is a Mortal Sin.
41830 Others believe that life is not possible without it. Exim provides the
41831 facility; you do not have to use it.
41832 </para>
41833 <para>
41834 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
41835 configuration file are applied to addresses in incoming messages, both envelope
41836 addresses and addresses in header lines. Each rule specifies the types of
41837 address to which it applies.
41838 </para>
41839 <para revisionflag="changed">
41840 Whether or not addresses in header lines are rewritten depends on the origin of
41841 the headers and the type of rewriting. Global rewriting, that is, rewriting
41842 rules from the rewrite section of the configuration file, is applied only to
41843 those headers that were received with the message. Header lines that are added
41844 by ACLs or by a system filter or by individual routers or transports (which
41845 are specific to individual recipient addresses) are not rewritten by the global
41846 rules.
41847 </para>
41848 <para revisionflag="changed">
41849 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
41850 applies all headers except those added by routers and transports. That is, as
41851 well as the headers that were received with the message, it also applies to
41852 headers that were added by an ACL or a system filter.
41853 </para>
41854 <para>
41855 In general, rewriting addresses from your own system or domain has some
41856 legitimacy. Rewriting other addresses should be done only with great care and
41857 in special circumstances. The author of Exim believes that rewriting should be
41858 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
41859 Although it can sometimes be used as a routing tool, this is very strongly
41860 discouraged.
41861 </para>
41862 <para>
41863 There are two commonly encountered circumstances where rewriting is used, as
41864 illustrated by these examples:
41865 </para>
41866 <itemizedlist>
41867 <listitem>
41868 <para>
41869 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
41870 exchange mail with each other behind a firewall, but there is only a single
41871 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
41872 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
41873 </para>
41874 </listitem>
41875 <listitem>
41876 <para>
41877 A host rewrites the local parts of its own users so that, for example,
41878 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
41879 </para>
41880 </listitem>
41881 </itemizedlist>
41882 </section>
41883 <section>
41884 <title>When does rewriting happen?</title>
41885 <para>
41886 <indexterm role="concept">
41887 <primary>rewriting</primary>
41888 <secondary>timing of</secondary>
41889 </indexterm>
41890 <indexterm role="concept">
41891 <primary>access control lists (ACLs)</primary>
41892 <secondary>rewriting addresses in</secondary>
41893 </indexterm>
41894 Configured address rewriting can take place at several different stages of a
41895 message&#x2019;s processing.
41896 </para>
41897 <para>
41898 <indexterm role="concept">
41899 <primary><varname>$sender_address</varname></primary>
41900 </indexterm>
41901 At the start of an ACL for MAIL, the sender address may have been rewritten
41902 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
41903 ordinary rewrite rules have yet been applied. If, however, the sender address
41904 is verified in the ACL, it is rewritten before verification, and remains
41905 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
41906 rewritten address. This also applies if sender verification happens in a
41907 RCPT ACL. Otherwise, when the sender address is not verified, it is
41908 rewritten as soon as a message&#x2019;s header lines have been received.
41909 </para>
41910 <para>
41911 <indexterm role="concept">
41912 <primary><varname>$domain</varname></primary>
41913 </indexterm>
41914 <indexterm role="concept">
41915 <primary><varname>$local_part</varname></primary>
41916 </indexterm>
41917 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
41918 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
41919 rewrite rules have yet been applied to it. However, the behaviour is different
41920 from the sender address when a recipient is verified. The address is rewritten
41921 for the verification, but the rewriting is not remembered at this stage. The
41922 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
41923 as they were before (that is, they contain the unrewritten &ndash; except for
41924 SMTP-time rewriting &ndash; address).
41925 </para>
41926 <para>
41927 As soon as a message&#x2019;s header lines have been received, all the envelope
41928 recipient addresses are permanently rewritten, and rewriting is also applied to
41929 the addresses in the header lines (if configured). This happens before adding
41930 any header lines that were specified in MAIL or RCPT ACLs, and
41931 <indexterm role="concept">
41932 <primary><function>local_scan()</function> function</primary>
41933 <secondary>address rewriting; timing of</secondary>
41934 </indexterm>
41935 before the DATA ACL and <function>local_scan()</function> functions are run.
41936 </para>
41937 <para>
41938 When an address is being routed, either for delivery or for verification,
41939 rewriting is applied immediately to child addresses that are generated by
41940 redirection, unless <option>no_rewrite</option> is set on the router.
41941 </para>
41942 <para>
41943 <indexterm role="concept">
41944 <primary>envelope sender</primary>
41945 <secondary>rewriting at transport time</secondary>
41946 </indexterm>
41947 <indexterm role="concept">
41948 <primary>rewriting</primary>
41949 <secondary>at transport time</secondary>
41950 </indexterm>
41951 <indexterm role="concept">
41952 <primary>header lines</primary>
41953 <secondary>rewriting at transport time</secondary>
41954 </indexterm>
41955 At transport time, additional rewriting of addresses in header lines can be
41956 specified by setting the generic <option>headers_rewrite</option> option on a transport.
41957 This option contains rules that are identical in form to those in the rewrite
41958 section of the configuration file. They are applied to the original message
41959 header lines and any that were added by ACLs or a system filter. They are not
41960 applied to header lines that are added by routers or the transport.
41961 </para>
41962 <para>
41963 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
41964 transport option. However, it is not possible to rewrite envelope recipients at
41965 transport time.
41966 </para>
41967 </section>
41968 <section>
41969 <title>Testing the rewriting rules that apply on input</title>
41970 <para>
41971 <indexterm role="concept">
41972 <primary>rewriting</primary>
41973 <secondary>testing</secondary>
41974 </indexterm>
41975 <indexterm role="concept">
41976 <primary>testing</primary>
41977 <secondary>rewriting</secondary>
41978 </indexterm>
41979 Exim&#x2019;s input rewriting configuration appears in a part of the run time
41980 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
41981 <option>-brw</option> command line option. This takes an address (which can be a full RFC
41982 2822 address) as its argument. The output is a list of how the address would be
41983 transformed by the rewriting rules for each of the different places it might
41984 appear in an incoming message, that is, for each different header and for the
41985 envelope sender and recipient fields. For example,
41986 </para>
41987 <literallayout class="monospaced">
41988 exim -brw ph10@exim.workshop.example
41989 </literallayout>
41990 <para>
41991 might produce the output
41992 </para>
41993 <literallayout class="monospaced">
41994 sender: Philip.Hazel@exim.workshop.example
41995 from: Philip.Hazel@exim.workshop.example
41996 to: ph10@exim.workshop.example
41997 cc: ph10@exim.workshop.example
41998 bcc: ph10@exim.workshop.example
41999 reply-to: Philip.Hazel@exim.workshop.example
42000 env-from: Philip.Hazel@exim.workshop.example
42001 env-to: ph10@exim.workshop.example
42002 </literallayout>
42003 <para>
42004 which shows that rewriting has been set up for that address when used in any of
42005 the source fields, but not when it appears as a recipient address. At the
42006 present time, there is no equivalent way of testing rewriting rules that are
42007 set for a particular transport.
42008 </para>
42009 </section>
42010 <section>
42011 <title>Rewriting rules</title>
42012 <para>
42013 <indexterm role="concept">
42014 <primary>rewriting</primary>
42015 <secondary>rules</secondary>
42016 </indexterm>
42017 The rewrite section of the configuration file consists of lines of rewriting
42018 rules in the form
42019 </para>
42020 <literallayout>
42021 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
42022 </literallayout>
42023 <para>
42024 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
42025 transport option are given as a colon-separated list. Each item in the list
42026 takes the same form as a line in the main rewriting configuration (except that
42027 any colons must be doubled, of course).
42028 </para>
42029 <para>
42030 The formats of source patterns and replacement strings are described below.
42031 Each is terminated by white space, unless enclosed in double quotes, in which
42032 case normal quoting conventions apply inside the quotes. The flags are single
42033 characters which may appear in any order. Spaces and tabs between them are
42034 ignored.
42035 </para>
42036 <para>
42037 For each address that could potentially be rewritten, the rules are scanned in
42038 order, and replacements for the address from earlier rules can themselves be
42039 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
42040 </para>
42041 <para>
42042 The order in which addresses are rewritten is undefined, may change between
42043 releases, and must not be relied on, with one exception: when a message is
42044 received, the envelope sender is always rewritten first, before any header
42045 lines are rewritten. For example, the replacement string for a rewrite of an
42046 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
42047 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
42048 that the envelope sender has already been rewritten.
42049 </para>
42050 <para>
42051 <indexterm role="concept">
42052 <primary><varname>$domain</varname></primary>
42053 </indexterm>
42054 <indexterm role="concept">
42055 <primary><varname>$local_part</varname></primary>
42056 </indexterm>
42057 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
42058 string to refer to the address that is being rewritten. Note that lookup-driven
42059 rewriting can be done by a rule of the form
42060 </para>
42061 <literallayout class="monospaced">
42062 *@*   ${lookup ...
42063 </literallayout>
42064 <para>
42065 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
42066 refer to the address that is being rewritten.
42067 </para>
42068 </section>
42069 <section>
42070 <title>Rewriting patterns</title>
42071 <para>
42072 <indexterm role="concept">
42073 <primary>rewriting</primary>
42074 <secondary>patterns</secondary>
42075 </indexterm>
42076 <indexterm role="concept">
42077 <primary>address list</primary>
42078 <secondary>in a rewriting pattern</secondary>
42079 </indexterm>
42080 The source pattern in a rewriting rule is any item which may appear in an
42081 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
42082 single-item address list, which means that it is expanded before being tested
42083 against the address. As always, if you use a regular expression as a pattern,
42084 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
42085 facility to suppress string expansion within the regular expression.
42086 </para>
42087 <para>
42088 Domains in patterns should be given in lower case. Local parts in patterns are
42089 case-sensitive. If you want to do case-insensitive matching of local parts, you
42090 can use a regular expression that starts with <literal>^(?i)</literal>.
42091 </para>
42092 <para>
42093 <indexterm role="concept">
42094 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
42095 <secondary>in rewriting rules</secondary>
42096 </indexterm>
42097 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
42098 depending on the type of match which occurred. These can be used in the
42099 replacement string to insert portions of the incoming address. <varname>$0</varname> always
42100 refers to the complete incoming address. When a regular expression is used, the
42101 numerical variables are set from its capturing subexpressions. For other types
42102 of pattern they are set as follows:
42103 </para>
42104 <itemizedlist>
42105 <listitem>
42106 <para>
42107 If a local part or domain starts with an asterisk, the numerical variables
42108 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
42109 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
42110 pattern
42111 </para>
42112 <literallayout class="monospaced">
42113 *queen@*.fict.example
42114 </literallayout>
42115 <para>
42116 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
42117 </para>
42118 <literallayout class="monospaced">
42119 $0 = hearts-queen@wonderland.fict.example
42120 $1 = hearts-
42121 $2 = wonderland
42122 </literallayout>
42123 <para>
42124 Note that if the local part does not start with an asterisk, but the domain
42125 does, it is <varname>$1</varname> that contains the wild part of the domain.
42126 </para>
42127 </listitem>
42128 <listitem>
42129 <para>
42130 If the domain part of the pattern is a partial lookup, the wild and fixed parts
42131 of the domain are placed in the next available numerical variables. Suppose,
42132 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
42133 rewriting rule of the form
42134 </para>
42135 <literallayout>
42136 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
42137 </literallayout>
42138 <para>
42139 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
42140 </para>
42141 <literallayout class="monospaced">
42142 $1 = foo
42143 $2 = bar
42144 $3 = baz.example
42145 </literallayout>
42146 <para>
42147 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
42148 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
42149 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
42150 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
42151 whole domain. For non-partial domain lookups, no numerical variables are set.
42152 </para>
42153 </listitem>
42154 </itemizedlist>
42155 </section>
42156 <section>
42157 <title>Rewriting replacements</title>
42158 <para>
42159 <indexterm role="concept">
42160 <primary>rewriting</primary>
42161 <secondary>replacements</secondary>
42162 </indexterm>
42163 If the replacement string for a rule is a single asterisk, addresses that
42164 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
42165 rewriting rules are scanned. For example,
42166 </para>
42167 <literallayout class="monospaced">
42168 hatta@lookingglass.fict.example  *  f
42169 </literallayout>
42170 <para>
42171 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
42172 <emphasis>From:</emphasis> headers.
42173 </para>
42174 <para>
42175 <indexterm role="concept">
42176 <primary><varname>$domain</varname></primary>
42177 </indexterm>
42178 <indexterm role="concept">
42179 <primary><varname>$local_part</varname></primary>
42180 </indexterm>
42181 If the replacement string is not a single asterisk, it is expanded, and must
42182 yield a fully qualified address. Within the expansion, the variables
42183 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
42184 Any letters they contain retain their original case &ndash; they are not lower
42185 cased. The numerical variables are set up according to the type of pattern that
42186 matched the address, as described above. If the expansion is forced to fail by
42187 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
42188 current rule is abandoned, but subsequent rules may take effect. Any other
42189 expansion failure causes the entire rewriting operation to be abandoned, and an
42190 entry written to the panic log.
42191 </para>
42192 </section>
42193 <section>
42194 <title>Rewriting flags</title>
42195 <para>
42196 There are three different kinds of flag that may appear on rewriting rules:
42197 </para>
42198 <itemizedlist>
42199 <listitem>
42200 <para>
42201 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
42202 c, f, h, r, s, t.
42203 </para>
42204 </listitem>
42205 <listitem>
42206 <para>
42207 A flag that specifies rewriting at SMTP time: S.
42208 </para>
42209 </listitem>
42210 <listitem>
42211 <para>
42212 Flags that control the rewriting process: Q, q, R, w.
42213 </para>
42214 </listitem>
42215 </itemizedlist>
42216 <para>
42217 For rules that are part of the <option>headers_rewrite</option> generic transport option,
42218 E, F, T, and S are not permitted.
42219 </para>
42220 </section>
42221 <section>
42222 <title>Flags specifying which headers and envelope addresses to rewrite</title>
42223 <para>
42224 <indexterm role="concept">
42225 <primary>rewriting</primary>
42226 <secondary>flags</secondary>
42227 </indexterm>
42228 If none of the following flag letters, nor the <quote>S</quote> flag (see section
42229 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
42230 and to both the sender and recipient fields of the envelope, whereas a
42231 transport-time rewriting rule just applies to all headers. Otherwise, the
42232 rewriting rule is skipped unless the relevant addresses are being processed.
42233 </para>
42234 <literallayout>
42235 <literal>E</literal>       rewrite all envelope fields
42236 <literal>F</literal>       rewrite the envelope From field
42237 <literal>T</literal>       rewrite the envelope To field
42238 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
42239 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
42240 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
42241 <literal>h</literal>       rewrite all headers
42242 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
42243 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
42244 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
42245 </literallayout>
42246 <para>
42247 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
42248 restrict this to special known cases in your own domains.
42249 </para>
42250 </section>
42251 <section id="SECTrewriteS">
42252 <title>The SMTP-time rewriting flag</title>
42253 <para>
42254 <indexterm role="concept">
42255 <primary>SMTP</primary>
42256 <secondary>rewriting malformed addresses</secondary>
42257 </indexterm>
42258 <indexterm role="concept">
42259 <primary>RCPT</primary>
42260 <secondary>rewriting argument of</secondary>
42261 </indexterm>
42262 <indexterm role="concept">
42263 <primary>MAIL</primary>
42264 <secondary>rewriting argument of</secondary>
42265 </indexterm>
42266 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
42267 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
42268 before any other processing; even before syntax checking. The pattern is
42269 required to be a regular expression, and it is matched against the whole of the
42270 data for the command, including any surrounding angle brackets.
42271 </para>
42272 <para>
42273 <indexterm role="concept">
42274 <primary><varname>$domain</varname></primary>
42275 </indexterm>
42276 <indexterm role="concept">
42277 <primary><varname>$local_part</varname></primary>
42278 </indexterm>
42279 This form of rewrite rule allows for the handling of addresses that are not
42280 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
42281 input). Because the input is not required to be a syntactically valid address,
42282 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
42283 expansion of the replacement string. The result of rewriting replaces the
42284 original address in the MAIL or RCPT command.
42285 </para>
42286 </section>
42287 <section>
42288 <title>Flags controlling the rewriting process</title>
42289 <para>
42290 There are four flags which control the way the rewriting process works. These
42291 take effect only when a rule is invoked, that is, when the address is of the
42292 correct type (matches the flags) and matches the pattern:
42293 </para>
42294 <itemizedlist>
42295 <listitem>
42296 <para>
42297 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
42298 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
42299 absence of <quote>Q</quote> the rewritten address must always include a domain.
42300 </para>
42301 </listitem>
42302 <listitem>
42303 <para>
42304 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
42305 even if no rewriting actually takes place because of a <quote>fail</quote> in the
42306 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
42307 (does not match the flags) or does not match the pattern.
42308 </para>
42309 </listitem>
42310 <listitem>
42311 <para>
42312 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
42313 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
42314 rewriting once it fails to match (after at least one successful rewrite).
42315 </para>
42316 </listitem>
42317 <listitem>
42318 <para>
42319 <indexterm role="concept">
42320 <primary>rewriting</primary>
42321 <secondary>whole addresses</secondary>
42322 </indexterm>
42323 When an address in a header is rewritten, the rewriting normally applies only
42324 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
42325 left unchanged. For example, rewriting might change
42326 </para>
42327 <literallayout class="monospaced">
42328 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
42329 </literallayout>
42330 <para>
42331 into
42332 </para>
42333 <literallayout class="monospaced">
42334 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
42335 </literallayout>
42336 <para>
42337 <indexterm role="concept">
42338 <primary>RFC 2047</primary>
42339 </indexterm>
42340 Sometimes there is a need to replace the whole address item, and this can be
42341 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
42342 causes an address in a header line to be rewritten, the entire address is
42343 replaced, not just the working part. The replacement must be a complete RFC
42344 2822 address, including the angle brackets if necessary. If text outside angle
42345 brackets contains a character whose value is greater than 126 or less than 32
42346 (except for tab), the text is encoded according to RFC 2047. The character set
42347 is taken from <option>headers_charset</option>, which defaults to ISO-8859-1.
42348 </para>
42349 <para>
42350 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
42351 rewritten, all but the working part of the replacement address is discarded.
42352 </para>
42353 </listitem>
42354 </itemizedlist>
42355 </section>
42356 <section>
42357 <title>Rewriting examples</title>
42358 <para>
42359 Here is an example of the two common rewriting paradigms:
42360 </para>
42361 <literallayout class="monospaced">
42362 *@*.hitch.fict.example  $1@hitch.fict.example
42363 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
42364                      {$value}fail}@hitch.fict.example bctfrF
42365 </literallayout>
42366 <para>
42367 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
42368 the string expansion to fail if the lookup does not succeed. In this context it
42369 has the effect of leaving the original address unchanged, but Exim goes on to
42370 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
42371 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
42372 explicitly, which would cause the rewritten address to be the same as before,
42373 at the cost of a small bit of processing. Not supplying either of these is an
42374 error, since the rewritten address would then contain no local part.
42375 </para>
42376 <para>
42377 The first example above replaces the domain with a superior, more general
42378 domain. This may not be desirable for certain local parts. If the rule
42379 </para>
42380 <literallayout class="monospaced">
42381 root@*.hitch.fict.example  *
42382 </literallayout>
42383 <para>
42384 were inserted before the first rule, rewriting would be suppressed for the
42385 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
42386 </para>
42387 <para>
42388 Rewriting can be made conditional on a number of tests, by making use of
42389 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
42390 messages that originate outside the local host:
42391 </para>
42392 <literallayout class="monospaced">
42393 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
42394                          {$1@hitch.fict.example}fail}"
42395 </literallayout>
42396 <para>
42397 The replacement string is quoted in this example because it contains white
42398 space.
42399 </para>
42400 <para>
42401 <indexterm role="concept">
42402 <primary>rewriting</primary>
42403 <secondary>bang paths</secondary>
42404 </indexterm>
42405 <indexterm role="concept">
42406 <primary>bang paths</primary>
42407 <secondary>rewriting</secondary>
42408 </indexterm>
42409 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
42410 an address it treats it as an unqualified local part which it qualifies with
42411 the local qualification domain (if the source of the message is local or if the
42412 remote host is permitted to send unqualified addresses). Rewriting can
42413 sometimes be used to handle simple bang paths with a fixed number of
42414 components. For example, the rule
42415 </para>
42416 <literallayout class="monospaced">
42417 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
42418 </literallayout>
42419 <para>
42420 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
42421 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
42422 a global rewriting rule for envelope addresses. It can provide a backdoor
42423 method for using your system as a relay, because the incoming addresses appear
42424 to be local. If the bang path addresses are received via SMTP, it is safer to
42425 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
42426 can be done on the rewritten addresses.
42427 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
42428 </para>
42429 </section>
42430 </chapter>
42431
42432 <chapter id="CHAPretry">
42433 <title>Retry configuration</title>
42434 <para>
42435 <indexterm role="concept" id="IIDretconf1" class="startofrange">
42436 <primary>retry configuration</primary>
42437 <secondary>description of</secondary>
42438 </indexterm>
42439 <indexterm role="concept" id="IIDregconf2" class="startofrange">
42440 <primary>configuration file</primary>
42441 <secondary>retry section</secondary>
42442 </indexterm>
42443 The <quote>retry</quote> section of the run time configuration file contains a list of
42444 retry rules that control how often Exim tries to deliver messages that cannot
42445 be delivered at the first attempt. If there are no retry rules, temporary
42446 errors are treated as permanent. The <option>-brt</option> command line option can be used
42447 to test which retry rule will be used for a given address, domain and error.
42448 </para>
42449 <para>
42450 The most common cause of retries is temporary failure to deliver to a remote
42451 host because the host is down, or inaccessible because of a network problem.
42452 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
42453 address) basis, not on a per-message basis. Thus, if one message has recently
42454 been delayed, delivery of a new message to the same host is not immediately
42455 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
42456 log selector is set, the message
42457 <indexterm role="concept">
42458 <primary>retry</primary>
42459 <secondary>time not reached</secondary>
42460 </indexterm>
42461 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
42462 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
42463 the handling of errors during remote deliveries.
42464 </para>
42465 <para>
42466 Retry processing applies to routing as well as to delivering, except as covered
42467 in the next paragraph. The retry rules do not distinguish between these
42468 actions. It is not possible, for example, to specify different behaviour for
42469 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
42470 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
42471 added complication, so did not implement it. However, although they share the
42472 same retry rule, the actual retry times for routing and transporting a given
42473 domain are maintained independently.
42474 </para>
42475 <para>
42476 When a delivery is not part of a queue run (typically an immediate delivery on
42477 receipt of a message), the routers are always run, and local deliveries are
42478 always attempted, even if retry times are set for them. This makes for better
42479 behaviour if one particular message is causing problems (for example, causing
42480 quota overflow, or provoking an error in a filter file). If such a delivery
42481 suffers a temporary failure, the retry data is updated as normal, and
42482 subsequent delivery attempts from queue runs occur only when the retry time for
42483 the local address is reached.
42484 </para>
42485 <section revisionflag="changed">
42486 <title>Changing retry rules</title>
42487 <para revisionflag="changed">
42488 If you change the retry rules in your configuration, you should consider
42489 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
42490 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
42491 always safe; that is why they are called <quote>hints</quote>.
42492 </para>
42493 <para revisionflag="changed">
42494 The hints retry data contains suggested retry times based on the previous
42495 rules. In the case of a long-running problem with a remote host, it might
42496 record the fact that the host has timed out. If your new rules increase the
42497 timeout time for such a host, you should definitely remove the old retry data
42498 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
42499 messages that it should now be retaining.
42500 </para>
42501 </section>
42502 <section>
42503 <title>Format of retry rules</title>
42504 <para>
42505 <indexterm role="concept">
42506 <primary>retry</primary>
42507 <secondary>rules</secondary>
42508 </indexterm>
42509 Each retry rule occupies one line and consists of three or four parts,
42510 separated by white space: a pattern, an error name, an optional list of sender
42511 addresses, and a list of retry parameters. The pattern and sender lists must be
42512 enclosed in double quotes if they contain white space. The rules are searched
42513 in order until one is found where the pattern, error name, and sender list (if
42514 present) match the failing host or address, the error that occurred, and the
42515 message&#x2019;s sender, respectively.
42516 </para>
42517 <para>
42518 The pattern is any single item that may appear in an address list (see section
42519 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
42520 which means that it is expanded before being tested against the address that
42521 has been delayed. <phrase revisionflag="changed">A negated address list item is permitted.</phrase> Address
42522 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
42523 which makes it possible for many retry rules to start with just a domain. For
42524 example,
42525 </para>
42526 <literallayout class="monospaced">
42527 lookingglass.fict.example        *  F,24h,30m;
42528 </literallayout>
42529 <para>
42530 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
42531 whereas
42532 </para>
42533 <literallayout class="monospaced">
42534 alice@lookingglass.fict.example  *  F,24h,30m;
42535 </literallayout>
42536 <para>
42537 applies only to temporary failures involving the local part <option>alice</option>.
42538 In practice, almost all rules start with a domain name pattern without a local
42539 part.
42540 </para>
42541 <para>
42542 <indexterm role="concept">
42543 <primary>regular expressions</primary>
42544 <secondary>in retry rules</secondary>
42545 </indexterm>
42546 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a routing rule pattern, it
42547 must match a complete address, not just a domain, because that is how regular
42548 expressions work in address lists.
42549 </para>
42550 <literallayout>
42551 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
42552 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
42553 </literallayout>
42554 </section>
42555 <section>
42556 <title>Choosing which retry rule to use for address errors</title>
42557 <para>
42558 When Exim is looking for a retry rule after a routing attempt has failed (for
42559 example, after a DNS timeout), each line in the retry configuration is tested
42560 against the complete address only if <option>retry_use_local_part</option> is set for the
42561 router. Otherwise, only the domain is used, except when matching against a
42562 regular expression, when the local part of the address is replaced with <quote>*</quote>.
42563 A domain on its own can match a domain pattern, or a pattern that starts with
42564 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
42565 <option>check_local_user</option> is true, and false for other routers.
42566 </para>
42567 <para>
42568 Similarly, when Exim is looking for a retry rule after a local delivery has
42569 failed (for example, after a mailbox full error), each line in the retry
42570 configuration is tested against the complete address only if
42571 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
42572 local transports).
42573 </para>
42574 <para>
42575 However, when Exim is looking for a retry rule after a remote delivery attempt
42576 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
42577 whole address is always used as the key when searching the retry rules. The
42578 rule that is found is used to create a retry time for the failing address.
42579 </para>
42580 </section>
42581 <section>
42582 <title>Choosing which retry rule to use for host and message errors</title>
42583 <para>
42584 For a temporary error that is not related to an individual address (for
42585 example, a connection timeout), each line in the retry configuration is checked
42586 twice. First, the name of the remote host is used as a domain name (preceded by
42587 <quote>*@</quote> when matching a regular expression). If this does not match the line,
42588 the domain from the email address is tried in a similar fashion. For example,
42589 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
42590 </para>
42591 <literallayout class="monospaced">
42592 a.b.c.example  MX  5  x.y.z.example
42593                MX  6  p.q.r.example
42594                MX  7  m.n.o.example
42595 </literallayout>
42596 <para>
42597 and the retry rules are
42598 </para>
42599 <literallayout class="monospaced">
42600 p.q.r.example    *      F,24h,30m;
42601 a.b.c.example    *      F,4d,45m;
42602 </literallayout>
42603 <para>
42604 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
42605 first rule matches neither the host nor the domain, so Exim looks at the second
42606 rule. This does not match the host, but it does match the domain, so it is used
42607 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
42608 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
42609 first retry rule is used, because it matches the host.
42610 </para>
42611 <para>
42612 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
42613 first rule to determine retry times, but for all the other hosts for the domain
42614 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
42615 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
42616 </para>
42617 <para>
42618 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
42619 However, if a message is routed directly to an IP address without the use of a
42620 host name, for example, if a <command>manualroute</command> router contains a setting such as:
42621 </para>
42622 <literallayout class="monospaced">
42623 route_list = *.a.example  192.168.34.23
42624 </literallayout>
42625 <para>
42626 then the <quote>host name</quote> that is used when searching for a retry rule is the
42627 textual form of the IP address.
42628 </para>
42629 </section>
42630 <section>
42631 <title>Retry rules for specific errors</title>
42632 <para>
42633 <indexterm role="concept">
42634 <primary>retry</primary>
42635 <secondary>specific errors; specifying</secondary>
42636 </indexterm>
42637 The second field in a retry rule is the name of a particular error, or an
42638 asterisk, which matches any error. The errors that can be tested for are:
42639 </para>
42640 <variablelist>
42641 <varlistentry>
42642 <term><option>auth_failed</option></term>
42643 <listitem>
42644 <para>
42645 Authentication failed when trying to send to a host in the
42646 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
42647 </para>
42648 </listitem></varlistentry>
42649 <varlistentry>
42650 <term><option>data_4xx</option></term>
42651 <listitem>
42652 <para>
42653 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
42654 after the command, or after sending the message&#x2019;s data.
42655 </para>
42656 </listitem></varlistentry>
42657 <varlistentry>
42658 <term><option>mail_4xx</option></term>
42659 <listitem>
42660 <para>
42661 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
42662 </para>
42663 </listitem></varlistentry>
42664 <varlistentry>
42665 <term><option>rcpt_4xx</option></term>
42666 <listitem>
42667 <para>
42668 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
42669 </para>
42670 </listitem></varlistentry>
42671 </variablelist>
42672 <para>
42673 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
42674 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
42675 recognize 452 errors given to RCPT commands for addresses in a certain domain,
42676 and have retries every ten minutes with a one-hour timeout, you could set up a
42677 retry rule of this form:
42678 </para>
42679 <literallayout class="monospaced">
42680 the.domain.name  rcpt_452   F,1h,10m
42681 </literallayout>
42682 <para>
42683 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
42684 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
42685 </para>
42686 <variablelist>
42687 <varlistentry>
42688 <term><option>lost_connection</option></term>
42689 <listitem>
42690 <para>
42691 A server unexpectedly closed the SMTP connection. There may, of course,
42692 legitimate reasons for this (host died, network died), but if it repeats a lot
42693 for the same host, it indicates something odd.
42694 </para>
42695 </listitem></varlistentry>
42696 <varlistentry>
42697 <term><option>refused_MX</option></term>
42698 <listitem>
42699 <para>
42700 A connection to a host obtained from an MX record was refused.
42701 </para>
42702 </listitem></varlistentry>
42703 <varlistentry>
42704 <term><option>refused_A</option></term>
42705 <listitem>
42706 <para>
42707 A connection to a host not obtained from an MX record was refused.
42708 </para>
42709 </listitem></varlistentry>
42710 <varlistentry>
42711 <term><option>refused</option></term>
42712 <listitem>
42713 <para>
42714 A connection was refused.
42715 </para>
42716 </listitem></varlistentry>
42717 <varlistentry>
42718 <term><option>timeout_connect_MX</option></term>
42719 <listitem>
42720 <para>
42721 A connection attempt to a host obtained from an MX record timed out.
42722 </para>
42723 </listitem></varlistentry>
42724 <varlistentry>
42725 <term><option>timeout_connect_A</option></term>
42726 <listitem>
42727 <para>
42728 A connection attempt to a host not obtained from an MX record timed out.
42729 </para>
42730 </listitem></varlistentry>
42731 <varlistentry>
42732 <term><option>timeout_connect</option></term>
42733 <listitem>
42734 <para>
42735 A connection attempt timed out.
42736 </para>
42737 </listitem></varlistentry>
42738 <varlistentry>
42739 <term><option>timeout_MX</option></term>
42740 <listitem>
42741 <para>
42742 There was a timeout while connecting or during an SMTP session with a host
42743 obtained from an MX record.
42744 </para>
42745 </listitem></varlistentry>
42746 <varlistentry>
42747 <term><option>timeout_A</option></term>
42748 <listitem>
42749 <para>
42750 There was a timeout while connecting or during an SMTP session with a host not
42751 obtained from an MX record.
42752 </para>
42753 </listitem></varlistentry>
42754 <varlistentry>
42755 <term><option>timeout</option></term>
42756 <listitem>
42757 <para>
42758 There was a timeout while connecting or during an SMTP session.
42759 </para>
42760 </listitem></varlistentry>
42761 <varlistentry>
42762 <term><option>tls_required</option></term>
42763 <listitem>
42764 <para>
42765 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
42766 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
42767 to STARTTLS, or there was a problem setting up the TLS connection.
42768 </para>
42769 </listitem></varlistentry>
42770 <varlistentry>
42771 <term><option>quota</option></term>
42772 <listitem>
42773 <para>
42774 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42775 transport.
42776 </para>
42777 </listitem></varlistentry>
42778 <varlistentry>
42779 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
42780 <listitem>
42781 <para>
42782 <indexterm role="concept">
42783 <primary>quota</primary>
42784 <secondary>error testing in retry rule</secondary>
42785 </indexterm>
42786 <indexterm role="concept">
42787 <primary>retry</primary>
42788 <secondary>quota error testing</secondary>
42789 </indexterm>
42790 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
42791 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
42792 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
42793 for four days.
42794 </para>
42795 </listitem></varlistentry>
42796 </variablelist>
42797 <para>
42798 <indexterm role="concept">
42799 <primary>mailbox</primary>
42800 <secondary>time of last read</secondary>
42801 </indexterm>
42802 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
42803 timeouts when the mailbox is full and is not being read by its owner. Ideally,
42804 it should be based on the last time that the user accessed the mailbox.
42805 However, it is not always possible to determine this. Exim uses the following
42806 heuristic rules:
42807 </para>
42808 <itemizedlist>
42809 <listitem>
42810 <para>
42811 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
42812 used. As no new messages are being delivered (because the mailbox is over
42813 quota), Exim does not access the file, so this is the time of last user access.
42814 </para>
42815 </listitem>
42816 <listitem>
42817 <para>
42818 <indexterm role="concept">
42819 <primary>maildir format</primary>
42820 <secondary>time of last read</secondary>
42821 </indexterm>
42822 For a maildir delivery, the time of last modification of the <filename>new</filename>
42823 subdirectory is used. As the mailbox is over quota, no new files are created in
42824 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
42825 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
42826 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
42827 time that is used is therefore the last time that the user read a new message.
42828 </para>
42829 </listitem>
42830 <listitem>
42831 <para>
42832 For other kinds of multi-file mailbox, the time of last access cannot be
42833 obtained, so a retry rule that uses this type of error field is never matched.
42834 </para>
42835 </listitem>
42836 </itemizedlist>
42837 <para>
42838 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
42839 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
42840 when a local delivery is deferred because a partition is full (the ENOSPC
42841 error).
42842 </para>
42843 </section>
42844 <section>
42845 <title>Retry rules for specified senders</title>
42846 <para>
42847 <indexterm role="concept">
42848 <primary>retry</primary>
42849 <secondary>rules; sender-specific</secondary>
42850 </indexterm>
42851 You can specify retry rules that apply only when the failing message has a
42852 specific sender. In particular, this can be used to define retry rules that
42853 apply only to bounce messages. The third item in a retry rule can be of this
42854 form:
42855 </para>
42856 <literallayout>
42857 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
42858 </literallayout>
42859 <para>
42860 The retry timings themselves are then the fourth item. For example:
42861 </para>
42862 <literallayout class="monospaced">
42863 *   rcpt_4xx   senders=:   F,1h,30m
42864 </literallayout>
42865 <para>
42866 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
42867 host. If the address list contains white space, it must be enclosed in quotes.
42868 For example:
42869 </para>
42870 <literallayout class="monospaced">
42871 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
42872 </literallayout>
42873 <para>
42874 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
42875 (which do not depend on the recipient). The reason is that the sender is used
42876 only to match the retry rule. Once the rule has been found for a host error,
42877 its contents are used to set a retry time for the host, and this will apply to
42878 all messages, not just those with specific senders.
42879 </para>
42880 <para>
42881 When testing retry rules using <option>-brt</option>, you can supply a sender using the
42882 <option>-f</option> command line option, like this:
42883 </para>
42884 <literallayout class="monospaced">
42885 exim -f "" -brt user@dom.ain
42886 </literallayout>
42887 <para>
42888 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
42889 list is never matched.
42890 </para>
42891 </section>
42892 <section>
42893 <title>Retry parameters</title>
42894 <para>
42895 <indexterm role="concept">
42896 <primary>retry</primary>
42897 <secondary>parameters in rules</secondary>
42898 </indexterm>
42899 The third (or fourth, if a senders list is present) field in a retry rule is a
42900 sequence of retry parameter sets, separated by semicolons. Each set consists of
42901 </para>
42902 <literallayout>
42903 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
42904 </literallayout>
42905 <para>
42906 The letter identifies the algorithm for computing a new retry time; the cutoff
42907 time is the time beyond which this algorithm no longer applies, and the
42908 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
42909 time that the first failure for the domain (combined with the local part if
42910 relevant) was detected, not from the time the message was received.
42911 </para>
42912 <para>
42913 <indexterm role="concept">
42914 <primary>retry</primary>
42915 <secondary>algorithms</secondary>
42916 </indexterm>
42917 <indexterm role="concept">
42918 <primary>retry</primary>
42919 <secondary>fixed intervals</secondary>
42920 </indexterm>
42921 <indexterm role="concept">
42922 <primary>retry</primary>
42923 <secondary>increasing intervals</secondary>
42924 </indexterm>
42925 <indexterm role="concept">
42926 <primary>retry</primary>
42927 <secondary>random intervals</secondary>
42928 </indexterm>
42929 The available algorithms are:
42930 </para>
42931 <itemizedlist>
42932 <listitem>
42933 <para>
42934 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
42935 the interval.
42936 </para>
42937 </listitem>
42938 <listitem>
42939 <para>
42940 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
42941 specifies a starting value for the interval, and the second a multiplier, which
42942 is used to increase the size of the interval at each retry.
42943 </para>
42944 </listitem>
42945 <listitem>
42946 <para>
42947 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
42948 retry, the previous interval is multiplied by the factor in order to get a
42949 maximum for the next interval. The mininum interval is the first argument of
42950 the parameter, and an actual interval is chosen randomly between them. Such a
42951 rule has been found to be helpful in cluster configurations when all the
42952 members of the cluster restart at once, and may therefore synchronize their
42953 queue processing times.
42954 </para>
42955 </listitem>
42956 </itemizedlist>
42957 <para>
42958 When computing the next retry time, the algorithm definitions are scanned in
42959 order until one whose cutoff time has not yet passed is reached. This is then
42960 used to compute a new retry time that is later than the current time. In the
42961 case of fixed interval retries, this simply means adding the interval to the
42962 current time. For geometrically increasing intervals, retry intervals are
42963 computed from the rule&#x2019;s parameters until one that is greater than the previous
42964 interval is found. The main configuration variable
42965 <indexterm role="concept">
42966 <primary>limit</primary>
42967 <secondary>retry interval</secondary>
42968 </indexterm>
42969 <indexterm role="concept">
42970 <primary>retry interval</primary>
42971 <secondary>maximum</secondary>
42972 </indexterm>
42973 <indexterm role="concept">
42974 <primary><option>retry_interval_max</option></primary>
42975 </indexterm>
42976 <option>retry_interval_max</option> limits the maximum interval between retries. It
42977 cannot be set greater than <literal>24h</literal>, which is its default value.
42978 </para>
42979 <para>
42980 A single remote domain may have a number of hosts associated with it, and each
42981 host may have more than one IP address. Retry algorithms are selected on the
42982 basis of the domain name, but are applied to each IP address independently. If,
42983 for example, a host has two IP addresses and one is unusable, Exim will
42984 generate retry times for it and will not try to use it until its next retry
42985 time comes. Thus the good IP address is likely to be tried first most of the
42986 time.
42987 </para>
42988 <para>
42989 <indexterm role="concept">
42990 <primary>hints database</primary>
42991 <secondary>use for retrying</secondary>
42992 </indexterm>
42993 Retry times are hints rather than promises. Exim does not make any attempt to
42994 run deliveries exactly at the computed times. Instead, a queue runner process
42995 starts delivery processes for delayed messages periodically, and these attempt
42996 new deliveries only for those addresses that have passed their next retry time.
42997 If a new message arrives for a deferred address, an immediate delivery attempt
42998 occurs only if the address has passed its retry time. In the absence of new
42999 messages, the minimum time between retries is the interval between queue runner
43000 processes. There is not much point in setting retry times of five minutes if
43001 your queue runners happen only once an hour, unless there are a significant
43002 number of incoming messages (which might be the case on a system that is
43003 sending everything to a smart host, for example).
43004 </para>
43005 <para>
43006 The data in the retry hints database can be inspected by using the
43007 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
43008 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
43009 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
43010 are for the hosts associated with a particular mail domain, and also for local
43011 deliveries that have been deferred.
43012 </para>
43013 </section>
43014 <section>
43015 <title>Retry rule examples</title>
43016 <para>
43017 Here are some example retry rules:
43018 </para>
43019 <literallayout class="monospaced">
43020 alice@wonderland.fict.example quota_5d  F,7d,3h
43021 wonderland.fict.example       quota_5d
43022 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
43023 lookingglass.fict.example     *         F,24h,30m;
43024 *                 refused_A   F,2h,20m;
43025 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
43026 </literallayout>
43027 <para>
43028 The first rule sets up special handling for mail to
43029 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
43030 mailbox has not been read for at least 5 days. Retries continue every three
43031 hours for 7 days. The second rule handles over-quota errors for all other local
43032 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
43033 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
43034 fail are bounced immediately if the mailbox has not been read for at least 5
43035 days.
43036 </para>
43037 <para>
43038 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
43039 happen every 15 minutes for an hour, then with geometrically increasing
43040 intervals until two days have passed since a delivery first failed. After the
43041 first hour there is a delay of one hour, then two hours, then four hours, and
43042 so on (this is a rather extreme example).
43043 </para>
43044 <para>
43045 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
43046 They happen every 30 minutes for 24 hours only. The remaining two rules handle
43047 all other domains, with special action for connection refusal from hosts that
43048 were not obtained from an MX record.
43049 </para>
43050 <para>
43051 The final rule in a retry configuration should always have asterisks in the
43052 first two fields so as to provide a general catch-all for any addresses that do
43053 not have their own special handling. This example tries every 15 minutes for 2
43054 hours, then with intervals starting at one hour and increasing by a factor of
43055 1.5 up to 16 hours, then every 8 hours up to 5 days.
43056 </para>
43057 </section>
43058 <section>
43059 <title>Timeout of retry data</title>
43060 <para>
43061 <indexterm role="concept">
43062 <primary>timeout</primary>
43063 <secondary>of retry data</secondary>
43064 </indexterm>
43065 <indexterm role="concept">
43066 <primary><option>retry_data_expire</option></primary>
43067 </indexterm>
43068 <indexterm role="concept">
43069 <primary>hints database</primary>
43070 <secondary>data expiry</secondary>
43071 </indexterm>
43072 <indexterm role="concept">
43073 <primary>retry</primary>
43074 <secondary>timeout of data</secondary>
43075 </indexterm>
43076 Exim timestamps the data that it writes to its retry hints database. When it
43077 consults the data during a delivery it ignores any that is older than the value
43078 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
43079 been tried for 7 days, Exim will try to deliver to it immediately a message
43080 arrives, and if that fails, it will calculate a retry time as if it were
43081 failing for the first time.
43082 </para>
43083 <para>
43084 This improves the behaviour for messages routed to rarely-used hosts such as MX
43085 backups. If such a host was down at one time, and happens to be down again when
43086 Exim tries a month later, using the old retry data would imply that it had been
43087 down all the time, which is not a justified assumption.
43088 </para>
43089 <para>
43090 If a host really is permanently dead, this behaviour causes a burst of retries
43091 every now and again, but only if messages routed to it are rare. It there is a
43092 message at least once every 7 days the retry data never expires.
43093 </para>
43094 </section>
43095 <section>
43096 <title>Long-term failures</title>
43097 <para>
43098 <indexterm role="concept">
43099 <primary>delivery failure</primary>
43100 <secondary>long-term</secondary>
43101 </indexterm>
43102 <indexterm role="concept">
43103 <primary>retry</primary>
43104 <secondary>after long-term failure</secondary>
43105 </indexterm>
43106 Special processing happens when an email address has been failing for so long
43107 that the cutoff time for the last algorithm is reached. For example, using the
43108 default retry rule:
43109 </para>
43110 <literallayout class="monospaced">
43111 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
43112 </literallayout>
43113 <para>
43114 the cutoff time is four days. Reaching the retry cutoff is independent of how
43115 long any specific message has been failing; it is the length of continuous
43116 failure for the recipient address that counts.
43117 </para>
43118 <para>
43119 When the cutoff time is reached for a local delivery, or for all the IP
43120 addresses associated with a remote delivery, a subsequent delivery failure
43121 causes Exim to give up on the address, and a bounce message is generated.
43122 In order to cater for new messages that use the failing address, a next retry
43123 time is still computed from the final algorithm, and is used as follows:
43124 </para>
43125 <para>
43126 For local deliveries, one delivery attempt is always made for any subsequent
43127 messages. If this delivery fails, the address fails immediately. The
43128 post-cutoff retry time is not used.
43129 </para>
43130 <para>
43131 If the delivery is remote, there are two possibilities, controlled by the
43132 <indexterm role="concept">
43133 <primary><option>delay_after_cutoff</option></primary>
43134 </indexterm>
43135 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
43136 default. Until the post-cutoff retry time for one of the IP addresses is
43137 reached, the failing email address is bounced immediately, without a delivery
43138 attempt taking place. After that time, one new delivery attempt is made to
43139 those IP addresses that are past their retry times, and if that still fails,
43140 the address is bounced and new retry times are computed.
43141 </para>
43142 <para>
43143 In other words, when all the hosts for a given email address have been failing
43144 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
43145 times is reached. Then it tries once, and bounces if that attempt fails. This
43146 behaviour ensures that few resources are wasted in repeatedly trying to deliver
43147 to a broken destination, but if the host does recover, Exim will eventually
43148 notice.
43149 </para>
43150 <para>
43151 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
43152 addresses are past their final cutoff time, Exim tries to deliver to those IP
43153 addresses that have not been tried since the message arrived. If there are
43154 no suitable IP addresses, or if they all fail, the address is bounced. In other
43155 words, it does not delay when a new message arrives, but tries the expired
43156 addresses immediately, unless they have been tried since the message arrived.
43157 If there is a continuous stream of messages for the failing domains, setting
43158 <option>delay_after_cutoff</option> false means that there will be many more attempts to
43159 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
43160 true.
43161 </para>
43162 </section>
43163 <section>
43164 <title>Deliveries that work intermittently</title>
43165 <para>
43166 <indexterm role="concept">
43167 <primary>retry</primary>
43168 <secondary>intermittently working deliveries</secondary>
43169 </indexterm>
43170 Some additional logic is needed to cope with cases where a host is
43171 intermittently available, or when a message has some attribute that prevents
43172 its delivery when others to the same address get through. In this situation,
43173 because some messages are successfully delivered, the <quote>retry clock</quote> for the
43174 host or address keeps getting reset by the successful deliveries, and so
43175 failing messages remain on the queue for ever because the cutoff time is never
43176 reached.
43177 </para>
43178 <para>
43179 Two exceptional actions are applied to prevent this happening. The first
43180 applies to errors that are related to a message rather than a remote host.
43181 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
43182 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
43183 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
43184 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
43185 is used when scanning the retry rules to decide when to try next and when to
43186 time out the address.
43187 </para>
43188 <para>
43189 The exceptional second action applies in all cases. If a message has been on
43190 the queue for longer than the cutoff time of any applicable retry rule for a
43191 given address, a delivery is attempted for that address, even if it is not yet
43192 time, and if this delivery fails, the address is timed out. A new retry time is
43193 not computed in this case, so that other messages for the same address are
43194 considered immediately.
43195 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
43196 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
43197 </para>
43198 </section>
43199 </chapter>
43200
43201 <chapter id="CHAPSMTPAUTH">
43202 <title>SMTP authentication</title>
43203 <para>
43204 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
43205 <primary>SMTP</primary>
43206 <secondary>authentication configuration</secondary>
43207 </indexterm>
43208 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
43209 <primary>authentication</primary>
43210 </indexterm>
43211 The <quote>authenticators</quote> section of Exim&#x2019;s run time configuration is concerned
43212 with SMTP authentication. This facility is an extension to the SMTP protocol,
43213 described in RFC 2554, which allows a client SMTP host to authenticate itself
43214 to a server. This is a common way for a server to recognize clients that are
43215 permitted to use it as a relay. SMTP authentication is not of relevance to the
43216 transfer of mail between servers that have no managerial connection with each
43217 other.
43218 </para>
43219 <para>
43220 <indexterm role="concept">
43221 <primary>AUTH</primary>
43222 <secondary>description of</secondary>
43223 </indexterm>
43224 Very briefly, the way SMTP authentication works is as follows:
43225 </para>
43226 <itemizedlist>
43227 <listitem>
43228 <para>
43229 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
43230 the client&#x2019;s EHLO command.
43231 </para>
43232 </listitem>
43233 <listitem>
43234 <para>
43235 The client issues an AUTH command, naming a specific mechanism. The command
43236 may, optionally, contain some authentication data.
43237 </para>
43238 </listitem>
43239 <listitem>
43240 <para>
43241 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
43242 appropriate responses. In simple authentication mechanisms, the challenges are
43243 just prompts for user names and passwords. The server does not have to issue
43244 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
43245 with the AUTH command.
43246 </para>
43247 </listitem>
43248 <listitem>
43249 <para>
43250 The server either accepts or denies authentication.
43251 </para>
43252 </listitem>
43253 <listitem>
43254 <para>
43255 If authentication succeeds, the client may optionally make use of the AUTH
43256 option on the MAIL command to pass an authenticated sender in subsequent
43257 mail transactions. Authentication lasts for the remainder of the SMTP
43258 connection.
43259 </para>
43260 </listitem>
43261 <listitem>
43262 <para>
43263 If authentication fails, the client may give up, or it may try a different
43264 authentication mechanism, or it may try transferring mail over the
43265 unauthenticated connection.
43266 </para>
43267 </listitem>
43268 </itemizedlist>
43269 <para>
43270 If you are setting up a client, and want to know which authentication
43271 mechanisms the server supports, you can use Telnet to connect to port 25 (the
43272 SMTP port) on the server, and issue an EHLO command. The response to this
43273 includes the list of supported mechanisms. For example:
43274 </para>
43275 <literallayout>
43276 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
43277 <literal>Trying 192.168.34.25...</literal>
43278 <literal>Connected to server.example.</literal>
43279 <literal>Escape character is '^]'.</literal>
43280 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
43281 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
43282 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
43283 <literal>250-SIZE 52428800</literal>
43284 <literal>250-PIPELINING</literal>
43285 <literal>250-AUTH PLAIN</literal>
43286 <literal>250 HELP</literal>
43287 </literallayout>
43288 <para>
43289 The second-last line of this example output shows that the server supports
43290 authentication using the PLAIN mechanism. In Exim, the different authentication
43291 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
43292 routers and transports, which authenticators are included in the binary is
43293 controlled by build-time definitions. The following are currently available,
43294 included by setting
43295 </para>
43296 <literallayout class="monospaced">
43297 AUTH_CRAM_MD5=yes
43298 AUTH_CYRUS_SASL=yes
43299 AUTH_PLAINTEXT=yes
43300 AUTH_SPA=yes
43301 </literallayout>
43302 <para>
43303 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
43304 authentication mechanism (RFC 2195), and the second provides an interface to
43305 the Cyrus SASL authentication library. The third can be configured to support
43306 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
43307 not formally documented, but used by several MUAs. The fourth authenticator
43308 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
43309 </para>
43310 <para>
43311 The authenticators are configured using the same syntax as other drivers (see
43312 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
43313 authentication section need be present in the configuration file. Each
43314 authenticator can in principle have both server and client functions. When Exim
43315 is receiving SMTP mail, it is acting as a server; when it is sending out
43316 messages over SMTP, it is acting as a client. Authenticator configuration
43317 options are provided for use in both these circumstances.
43318 </para>
43319 <para>
43320 To make it clear which options apply to which situation, the prefixes
43321 <option>server_</option> and <option>client_</option> are used on option names that are specific to
43322 either the server or the client function, respectively. Server and client
43323 functions are disabled if none of their options are set. If an authenticator is
43324 to be used for both server and client functions, a single definition, using
43325 both sets of options, is required. For example:
43326 </para>
43327 <literallayout class="monospaced">
43328 cram:
43329   driver = cram_md5
43330   public_name = CRAM-MD5
43331   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
43332   client_name = ph10
43333   client_secret = secret2
43334 </literallayout>
43335 <para>
43336 The <option>server_</option> option is used when Exim is acting as a server, and the
43337 <option>client_</option> options when it is acting as a client.
43338 </para>
43339 <para>
43340 Descriptions of the individual authenticators are given in subsequent chapters.
43341 The remainder of this chapter covers the generic options for the
43342 authenticators, followed by general discussion of the way authentication works
43343 in Exim.
43344 </para>
43345 <section>
43346 <title>Generic options for authenticators</title>
43347 <para>
43348 <indexterm role="concept">
43349 <primary>authentication</primary>
43350 <secondary>generic options</secondary>
43351 </indexterm>
43352 <indexterm role="concept">
43353 <primary>options</primary>
43354 <secondary>generic; for authenticators</secondary>
43355 </indexterm>
43356 </para>
43357 <para>
43358 <indexterm role="option">
43359 <primary>driver</primary>
43360 </indexterm>
43361 </para>
43362 <informaltable frame="all">
43363 <tgroup cols="4" colsep="0" rowsep="0">
43364 <colspec colwidth="8*" align="left"/>
43365 <colspec colwidth="5*" align="center"/>
43366 <colspec colwidth="5*" align="center"/>
43367 <colspec colwidth="6*" align="right"/>
43368 <tbody>
43369 <row>
43370 <entry><option>driver</option></entry>
43371 <entry>Use: <emphasis>authenticators</emphasis></entry>
43372 <entry>Type: <emphasis>string</emphasis></entry>
43373 <entry>Default: <emphasis>unset</emphasis></entry>
43374 </row>
43375 </tbody>
43376 </tgroup>
43377 </informaltable>
43378 <para>
43379 This option must always be set. It specifies which of the available
43380 authenticators is to be used.
43381 </para>
43382 <para>
43383 <indexterm role="option">
43384 <primary>public_name</primary>
43385 </indexterm>
43386 </para>
43387 <informaltable frame="all">
43388 <tgroup cols="4" colsep="0" rowsep="0">
43389 <colspec colwidth="8*" align="left"/>
43390 <colspec colwidth="5*" align="center"/>
43391 <colspec colwidth="5*" align="center"/>
43392 <colspec colwidth="6*" align="right"/>
43393 <tbody>
43394 <row>
43395 <entry><option>public_name</option></entry>
43396 <entry>Use: <emphasis>authenticators</emphasis></entry>
43397 <entry>Type: <emphasis>string</emphasis></entry>
43398 <entry>Default: <emphasis>unset</emphasis></entry>
43399 </row>
43400 </tbody>
43401 </tgroup>
43402 </informaltable>
43403 <para>
43404 This option specifies the name of the authentication mechanism that the driver
43405 implements, and by which it is known to the outside world. These names should
43406 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
43407 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
43408 defaults to the driver&#x2019;s instance name.
43409 </para>
43410 <para>
43411 <indexterm role="option">
43412 <primary>server_advertise_condition</primary>
43413 </indexterm>
43414 </para>
43415 <informaltable frame="all">
43416 <tgroup cols="4" colsep="0" rowsep="0">
43417 <colspec colwidth="8*" align="left"/>
43418 <colspec colwidth="5*" align="center"/>
43419 <colspec colwidth="5*" align="center"/>
43420 <colspec colwidth="6*" align="right"/>
43421 <tbody>
43422 <row>
43423 <entry><option>server_advertise_condition</option></entry>
43424 <entry>Use: <emphasis>authenticators</emphasis></entry>
43425 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43426 <entry>Default: <emphasis>unset</emphasis></entry>
43427 </row>
43428 </tbody>
43429 </tgroup>
43430 </informaltable>
43431 <para>
43432 When a server is about to advertise an authentication mechanism, the condition
43433 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
43434 mechanism is not advertised.
43435 If the expansion fails, the mechanism is not advertised. If the failure was not
43436 forced, and was not caused by a lookup defer, the incident is logged.
43437 See section <xref linkend="SECTauthexiser"/> below for further discussion.
43438 </para>
43439 <para>
43440 <indexterm role="option">
43441 <primary>server_debug_print</primary>
43442 </indexterm>
43443 </para>
43444 <informaltable frame="all">
43445 <tgroup cols="4" colsep="0" rowsep="0">
43446 <colspec colwidth="8*" align="left"/>
43447 <colspec colwidth="5*" align="center"/>
43448 <colspec colwidth="5*" align="center"/>
43449 <colspec colwidth="6*" align="right"/>
43450 <tbody>
43451 <row>
43452 <entry><option>server_debug_print</option></entry>
43453 <entry>Use: <emphasis>authenticators</emphasis></entry>
43454 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43455 <entry>Default: <emphasis>unset</emphasis></entry>
43456 </row>
43457 </tbody>
43458 </tgroup>
43459 </informaltable>
43460 <para>
43461 If this option is set and authentication debugging is enabled (see the <option>-d</option>
43462 command line option), the string is expanded and included in the debugging
43463 output when the authenticator is run as a server. This can help with checking
43464 out the values of variables.
43465 If expansion of the string fails, the error message is written to the debugging
43466 output, and Exim carries on processing.
43467 </para>
43468 <para>
43469 <indexterm role="option">
43470 <primary>server_set_id</primary>
43471 </indexterm>
43472 </para>
43473 <informaltable frame="all">
43474 <tgroup cols="4" colsep="0" rowsep="0">
43475 <colspec colwidth="8*" align="left"/>
43476 <colspec colwidth="5*" align="center"/>
43477 <colspec colwidth="5*" align="center"/>
43478 <colspec colwidth="6*" align="right"/>
43479 <tbody>
43480 <row>
43481 <entry><option>server_set_id</option></entry>
43482 <entry>Use: <emphasis>authenticators</emphasis></entry>
43483 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43484 <entry>Default: <emphasis>unset</emphasis></entry>
43485 </row>
43486 </tbody>
43487 </tgroup>
43488 </informaltable>
43489 <para>
43490 <indexterm role="concept">
43491 <primary><varname>$authenticated_id</varname></primary>
43492 </indexterm>
43493 When an Exim server successfully authenticates a client, this string is
43494 expanded using data from the authentication, and preserved for any incoming
43495 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
43496 lines for incoming messages. For example, a user/password authenticator
43497 configuration might preserve the user name that was used to authenticate, and
43498 refer to it subsequently during delivery of the message.
43499 If expansion fails, the option is ignored.
43500 </para>
43501 <para>
43502 <indexterm role="option">
43503 <primary>server_mail_auth_condition</primary>
43504 </indexterm>
43505 </para>
43506 <informaltable frame="all">
43507 <tgroup cols="4" colsep="0" rowsep="0">
43508 <colspec colwidth="8*" align="left"/>
43509 <colspec colwidth="5*" align="center"/>
43510 <colspec colwidth="5*" align="center"/>
43511 <colspec colwidth="6*" align="right"/>
43512 <tbody>
43513 <row>
43514 <entry><option>server_mail_auth_condition</option></entry>
43515 <entry>Use: <emphasis>authenticators</emphasis></entry>
43516 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43517 <entry>Default: <emphasis>unset</emphasis></entry>
43518 </row>
43519 </tbody>
43520 </tgroup>
43521 </informaltable>
43522 <para>
43523 This option allows a server to discard authenticated sender addresses supplied
43524 as part of MAIL commands in SMTP connections that are authenticated by the
43525 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
43526 as part of the authentication process; instead its (unexpanded) value is
43527 remembered for later use.
43528 How it is used is described in the following section.
43529 </para>
43530 </section>
43531 <section id="SECTauthparamail">
43532 <title>The AUTH parameter on MAIL commands</title>
43533 <para>
43534 <indexterm role="concept">
43535 <primary>authentication</primary>
43536 <secondary>sender; authenticated</secondary>
43537 </indexterm>
43538 <indexterm role="concept">
43539 <primary>AUTH</primary>
43540 <secondary>on MAIL command</secondary>
43541 </indexterm>
43542 When a client supplied an AUTH= item on a MAIL command, Exim applies
43543 the following checks before accepting it as the authenticated sender of the
43544 message:
43545 </para>
43546 <itemizedlist>
43547 <listitem>
43548 <para>
43549 If the connection is not using extended SMTP (that is, HELO was used rather
43550 than EHLO), the use of AUTH= is a syntax error.
43551 </para>
43552 </listitem>
43553 <listitem>
43554 <para>
43555 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
43556 </para>
43557 </listitem>
43558 <listitem>
43559 <para>
43560 <indexterm role="concept">
43561 <primary><varname>$authenticated_sender</varname></primary>
43562 </indexterm>
43563 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
43564 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
43565 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
43566 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
43567 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
43568 given for the MAIL command.
43569 </para>
43570 </listitem>
43571 <listitem>
43572 <para>
43573 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
43574 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
43575 authenticated.
43576 </para>
43577 </listitem>
43578 <listitem>
43579 <para>
43580 If the AUTH= value was accepted by either of the two previous rules, and
43581 the client has authenticated, and the authenticator has a setting for the
43582 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
43583 valued that was saved from the authenticator is expanded. If the expansion
43584 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
43585 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
43586 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
43587 message.
43588 </para>
43589 </listitem>
43590 </itemizedlist>
43591 <para>
43592 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
43593 hosts to which Exim authenticates as a client. Do not confuse this value with
43594 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
43595 process, and which is not usually a complete email address.
43596 </para>
43597 <para>
43598 <indexterm role="concept">
43599 <primary><varname>$sender_address</varname></primary>
43600 </indexterm>
43601 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
43602 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
43603 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
43604 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
43605 ACL is run.
43606 </para>
43607 </section>
43608 <section id="SECTauthexiser">
43609 <title>Authentication on an Exim server</title>
43610 <para>
43611 <indexterm role="concept">
43612 <primary>authentication</primary>
43613 <secondary>on an Exim server</secondary>
43614 </indexterm>
43615 When Exim receives an EHLO command, it advertises the public names of those
43616 authenticators that are configured as servers, subject to the following
43617 conditions:
43618 </para>
43619 <itemizedlist>
43620 <listitem>
43621 <para>
43622 The client host must match <option>auth_advertise_hosts</option> (default *).
43623 </para>
43624 </listitem>
43625 <listitem>
43626 <para>
43627 It the <option>server_advertise_condition</option> option is set, its expansion must not
43628 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
43629 </para>
43630 </listitem>
43631 </itemizedlist>
43632 <para>
43633 The order in which the authenticators are defined controls the order in which
43634 the mechanisms are advertised.
43635 </para>
43636 <para>
43637 Some mail clients (for example, some versions of Netscape) require the user to
43638 provide a name and password for authentication whenever AUTH is advertised,
43639 even though authentication may not in fact be needed (for example, Exim may be
43640 set up to allow unconditional relaying from the client by an IP address check).
43641 You can make such clients more friendly by not advertising AUTH to them.
43642 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
43643 that runs for RCPT) to relay without authentication, you should set
43644 </para>
43645 <literallayout class="monospaced">
43646 auth_advertise_hosts = ! 10.9.8.0/24
43647 </literallayout>
43648 <para>
43649 so that no authentication mechanisms are advertised to them.
43650 </para>
43651 <para>
43652 The <option>server_advertise_condition</option> controls the advertisement of individual
43653 authentication mechanisms. For example, it can be used to restrict the
43654 advertisement of a patricular mechanism to encrypted connections, by a setting
43655 such as:
43656 </para>
43657 <literallayout class="monospaced">
43658 server_advertise_condition = ${if eq{$tls_cipher}{}{no}{yes}}
43659 </literallayout>
43660 <para>
43661 <indexterm role="concept">
43662 <primary><varname>$tls_cipher</varname></primary>
43663 </indexterm>
43664 If the session is encrypted, <varname>$tls_cipher</varname> is not empty, and so the expansion
43665 yields <quote>yes</quote>, which allows the advertisement to happen.
43666 </para>
43667 <para>
43668 When an Exim server receives an AUTH command from a client, it rejects it
43669 immediately if AUTH was not advertised in response to an earlier EHLO
43670 command. This is the case if
43671 </para>
43672 <itemizedlist>
43673 <listitem>
43674 <para>
43675 The client host does not match <option>auth_advertise_hosts</option>; or
43676 </para>
43677 </listitem>
43678 <listitem>
43679 <para>
43680 No authenticators are configured with server options; or
43681 </para>
43682 </listitem>
43683 <listitem>
43684 <para>
43685 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
43686 server authenticators.
43687 </para>
43688 </listitem>
43689 </itemizedlist>
43690 <para>
43691 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
43692 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
43693 AUTH is accepted from any client host.
43694 </para>
43695 <para>
43696 If AUTH is not rejected by the ACL, Exim searches its configuration for a
43697 server authentication mechanism that was advertised in response to EHLO and
43698 that matches the one named in the AUTH command. If it finds one, it runs
43699 the appropriate authentication protocol, and authentication either succeeds or
43700 fails. If there is no matching advertised mechanism, the AUTH command is
43701 rejected with a 504 error.
43702 </para>
43703 <para>
43704 <indexterm role="concept">
43705 <primary><varname>$received_protocol</varname></primary>
43706 </indexterm>
43707 <indexterm role="concept">
43708 <primary><varname>$sender_host_authenticated</varname></primary>
43709 </indexterm>
43710 When a message is received from an authenticated host, the value of
43711 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
43712 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
43713 public name) of the authenticator driver that successfully authenticated the
43714 client from which the message was received. This variable is empty if there was
43715 no successful authentication.
43716 </para>
43717 </section>
43718 <section>
43719 <title>Testing server authentication</title>
43720 <para>
43721 <indexterm role="concept">
43722 <primary>authentication</primary>
43723 <secondary>testing a server</secondary>
43724 </indexterm>
43725 <indexterm role="concept">
43726 <primary>AUTH</primary>
43727 <secondary>testing a server</secondary>
43728 </indexterm>
43729 <indexterm role="concept">
43730 <primary>base64 encoding</primary>
43731 <secondary>creating authentication test data</secondary>
43732 </indexterm>
43733 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
43734 configurations. The data for the AUTH command has to be sent using base64
43735 encoding. A quick way to produce such data for testing is the following Perl
43736 script:
43737 </para>
43738 <literallayout class="monospaced">
43739 use MIME::Base64;
43740 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
43741 </literallayout>
43742 <para>
43743 <indexterm role="concept">
43744 <primary>binary zero</primary>
43745 <secondary>in authentication data</secondary>
43746 </indexterm>
43747 This interprets its argument as a Perl string, and then encodes it. The
43748 interpretation as a Perl string allows binary zeros, which are required for
43749 some kinds of authentication, to be included in the data. For example, a
43750 command line to run this script on such data might be
43751 </para>
43752 <literallayout class="monospaced">
43753 encode '\0user\0password'
43754 </literallayout>
43755 <para>
43756 Note the use of single quotes to prevent the shell interpreting the
43757 backslashes, so that they can be interpreted by Perl to specify characters
43758 whose code value is zero.
43759 </para>
43760 <para>
43761 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
43762 digit, you must use three zeros instead of one after the leading backslash. If
43763 you do not, the octal digit that starts your string will be incorrectly
43764 interpreted as part of the code for the first character.
43765 </para>
43766 <para>
43767 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
43768 specially, you must use a Perl escape to prevent them being misinterpreted. For
43769 example, a command such as
43770 </para>
43771 <literallayout class="monospaced">
43772 encode '\0user@domain.com\0pas$$word'
43773 </literallayout>
43774 <para>
43775 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
43776 </para>
43777 <para>
43778 If you have the <option>mimencode</option> command installed, another way to do produce
43779 base64-encoded strings is to run the command
43780 </para>
43781 <literallayout class="monospaced">
43782 echo -e -n `\0user\0password' | mimencode
43783 </literallayout>
43784 <para>
43785 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
43786 in the argument, and the <option>-n</option> option specifies no newline at the end of its
43787 output. However, not all versions of <option>echo</option> recognize these options, so you
43788 should check your version before relying on this suggestion.
43789 </para>
43790 </section>
43791 <section>
43792 <title>Authentication by an Exim client</title>
43793 <para>
43794 <indexterm role="concept">
43795 <primary>authentication</primary>
43796 <secondary>on an Exim client</secondary>
43797 </indexterm>
43798 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
43799 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
43800 announces support for authentication, and the host matches an entry in either
43801 of these options, Exim (as a client) tries to authenticate as follows:
43802 </para>
43803 <itemizedlist>
43804 <listitem>
43805 <para>
43806 For each authenticator that is configured as a client, it searches the
43807 authentication mechanisms announced by the server for one whose name
43808 matches the public name of the authenticator.
43809 </para>
43810 </listitem>
43811 <listitem>
43812 <para>
43813 <indexterm role="concept">
43814 <primary><varname>$host</varname></primary>
43815 </indexterm>
43816 <indexterm role="concept">
43817 <primary><varname>$host_address</varname></primary>
43818 </indexterm>
43819 When it finds one that matches, it runs the authenticator&#x2019;s client code.
43820 The variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string
43821 expansions that the client might do. They are set to the server&#x2019;s name and
43822 IP address. If any expansion is forced to fail, the authentication attempt
43823 is abandoned,
43824 and Exim moves on to the next authenticator.
43825 Otherwise an expansion failure causes delivery to be
43826 deferred.
43827 </para>
43828 </listitem>
43829 <listitem>
43830 <para>
43831 If the result of the authentication attempt is a temporary error or a timeout,
43832 Exim abandons trying to send the message to the host for the moment. It will
43833 try again later. If there are any backup hosts available, they are tried in the
43834 usual way.
43835 </para>
43836 </listitem>
43837 <listitem>
43838 <para>
43839 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
43840 carries on searching the list of authenticators and tries another one if
43841 possible. If all authentication attempts give permanent errors, or if there are
43842 no attempts because no mechanisms match (or option expansions force failure),
43843 what happens depends on whether the host matches <option>hosts_require_auth</option> or
43844 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
43845 delivery is deferred. The error can be detected in the retry rules, and thereby
43846 turned into a permanent error if you wish. In the second case, Exim tries to
43847 deliver the message unauthenticated.
43848 </para>
43849 </listitem>
43850 </itemizedlist>
43851 <para>
43852 <indexterm role="concept">
43853 <primary>AUTH</primary>
43854 <secondary>on MAIL command</secondary>
43855 </indexterm>
43856 When Exim has authenticated itself to a remote server, it adds the AUTH
43857 parameter to the MAIL commands it sends, if it has an authenticated sender for
43858 the message. If the message came from a remote host, the authenticated sender
43859 is the one that was receiving on an incoming MAIL command, provided that the
43860 incoming connection was authenticated and the <option>server_mail_auth</option> condition
43861 allowed the authenticated sender to be retained. If a local process calls Exim
43862 to send a message, the sender address that is built from the login name and
43863 <option>qualify_domain</option> is treated as authenticated. However, if the
43864 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
43865 the authenticated sender that was received with the message.
43866 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
43867 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
43868 </para>
43869 </section>
43870 </chapter>
43871
43872 <chapter id="CHAPplaintext">
43873 <title>The plaintext authenticator</title>
43874 <para>
43875 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
43876 <primary><command>plaintext</command> authenticator</primary>
43877 </indexterm>
43878 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
43879 <primary>authenticators</primary>
43880 <secondary><command>plaintext</command></secondary>
43881 </indexterm>
43882 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
43883 LOGIN authentication mechanisms, both of which transfer authentication data as
43884 plain (unencrypted) text (though base64 encoded). The use of plain text is a
43885 security risk; you are strongly advised to insist on the use of SMTP encryption
43886 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
43887 use unencrypted plain text, you should not use the same passwords for SMTP
43888 connections as you do for login accounts.
43889 </para>
43890 <section>
43891 <title>Using plaintext in a server</title>
43892 <para>
43893 <indexterm role="concept">
43894 <primary>options</primary>
43895 <secondary><command>plaintext</command> authenticator (server)</secondary>
43896 </indexterm>
43897 When running as a server, <command>plaintext</command> performs the authentication test by
43898 expanding a string. It has the following options:
43899 </para>
43900 <para>
43901 <indexterm role="option">
43902 <primary>server_prompts</primary>
43903 </indexterm>
43904 </para>
43905 <informaltable frame="all">
43906 <tgroup cols="4" colsep="0" rowsep="0">
43907 <colspec colwidth="8*" align="left"/>
43908 <colspec colwidth="5*" align="center"/>
43909 <colspec colwidth="5*" align="center"/>
43910 <colspec colwidth="6*" align="right"/>
43911 <tbody>
43912 <row>
43913 <entry><option>server_prompts</option></entry>
43914 <entry>Use: <emphasis>plaintext</emphasis></entry>
43915 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43916 <entry>Default: <emphasis>unset</emphasis></entry>
43917 </row>
43918 </tbody>
43919 </tgroup>
43920 </informaltable>
43921 <para>
43922 The contents of this option, after expansion, must be a colon-separated list of
43923 prompt strings. If expansion fails, a temporary authentication rejection is
43924 given.
43925 </para>
43926 <para>
43927 <indexterm role="option">
43928 <primary>server_condition</primary>
43929 </indexterm>
43930 </para>
43931 <informaltable frame="all">
43932 <tgroup cols="4" colsep="0" rowsep="0">
43933 <colspec colwidth="8*" align="left"/>
43934 <colspec colwidth="5*" align="center"/>
43935 <colspec colwidth="5*" align="center"/>
43936 <colspec colwidth="6*" align="right"/>
43937 <tbody>
43938 <row>
43939 <entry><option>server_condition</option></entry>
43940 <entry>Use: <emphasis>plaintext</emphasis></entry>
43941 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43942 <entry>Default: <emphasis>unset</emphasis></entry>
43943 </row>
43944 </tbody>
43945 </tgroup>
43946 </informaltable>
43947 <para>
43948 This option must be set in order to configure the driver as a server. Its use
43949 is described below.
43950 </para>
43951 <para>
43952 <indexterm role="concept">
43953 <primary>AUTH</primary>
43954 <secondary>in <command>plaintext</command> authenticator</secondary>
43955 </indexterm>
43956 <indexterm role="concept">
43957 <primary>binary zero</primary>
43958 <secondary>in <command>plaintext</command> authenticator</secondary>
43959 </indexterm>
43960 <indexterm role="concept">
43961 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
43962 <secondary>in <command>plaintext</command> authenticator</secondary>
43963 </indexterm>
43964 <indexterm role="concept">
43965 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
43966 </indexterm>
43967 <indexterm role="concept">
43968 <primary>base64 encoding</primary>
43969 <secondary>in <command>plaintext</command> authenticator</secondary>
43970 </indexterm>
43971 The data sent by the client with the AUTH command, or in response to
43972 subsequent prompts, is base64 encoded, and so may contain any byte values
43973 when decoded. If any data is supplied with the command, it is treated as a
43974 list of strings, separated by NULs (binary zeros), the first three of which are
43975 placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname> (neither
43976 LOGIN nor PLAIN uses more than three strings).
43977 </para>
43978 <para>
43979 For compatibility with previous releases of Exim, the values are also placed in
43980 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
43981 variables for this purpose is now deprecated, as it can lead to confusion in
43982 string expansions that also use them for other things.
43983 </para>
43984 <para>
43985 If there are more strings in <option>server_prompts</option> than the number of strings
43986 supplied with the AUTH command, the remaining prompts are used to obtain more
43987 data. Each response from the client may be a list of NUL-separated strings.
43988 </para>
43989 <para>
43990 <indexterm role="concept">
43991 <primary><varname>$authenticated_id</varname></primary>
43992 </indexterm>
43993 Once a sufficient number of data strings have been received,
43994 <option>server_condition</option> is expanded. If the expansion is forced to fail,
43995 authentication fails. Any other expansion failure causes a temporary error code
43996 to be returned. If the result of a successful expansion is an empty string,
43997 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
43998 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
43999 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
44000 For any other result, a temporary error code is returned, with the expanded
44001 string as the error text.
44002 </para>
44003 <para>
44004 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
44005 password, be sure to make the authentication fail if the user is unknown.
44006 There are good and bad examples at the end of the next section.
44007 </para>
44008 </section>
44009 <section>
44010 <title>The PLAIN authentication mechanism</title>
44011 <para>
44012 <indexterm role="concept">
44013 <primary>PLAIN authentication mechanism</primary>
44014 </indexterm>
44015 <indexterm role="concept">
44016 <primary>authentication</primary>
44017 <secondary>PLAIN mechanism</secondary>
44018 </indexterm>
44019 <indexterm role="concept">
44020 <primary>binary zero</primary>
44021 <secondary>in <command>plaintext</command> authenticator</secondary>
44022 </indexterm>
44023 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
44024 sent as one item of data (that is, one combined string containing two NUL
44025 separators). The data is sent either as part of the AUTH command, or
44026 subsequently in response to an empty prompt from the server.
44027 </para>
44028 <para>
44029 The second and third strings are a user name and a corresponding password.
44030 Using a single fixed user name and password as an example, this could be
44031 configured as follows:
44032 </para>
44033 <literallayout class="monospaced">
44034 fixed_plain:
44035   driver = plaintext
44036   public_name = PLAIN
44037   server_prompts = :
44038   server_condition = \
44039     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
44040   server_set_id = $auth2
44041 </literallayout>
44042 <para revisionflag="changed">
44043 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
44044 are exactly what we want here, so they need not be specified. Obviously, if the
44045 password contains expansion-significant characters such as dollar, backslash,
44046 or closing brace, they have to be escaped.
44047 </para>
44048 <para>
44049 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
44050 the end of a string list are ignored). If all the data comes as part of the
44051 AUTH command, as is commonly the case, the prompt is not used. This
44052 authenticator is advertised in the response to EHLO as
44053 </para>
44054 <literallayout class="monospaced">
44055 250-AUTH PLAIN
44056 </literallayout>
44057 <para>
44058 and a client host can authenticate itself by sending the command
44059 </para>
44060 <literallayout class="monospaced">
44061 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
44062 </literallayout>
44063 <para>
44064 As this contains three strings (more than the number of prompts), no further
44065 data is required from the client. Alternatively, the client may just send
44066 </para>
44067 <literallayout class="monospaced">
44068 AUTH PLAIN
44069 </literallayout>
44070 <para>
44071 to initiate authentication, in which case the server replies with an empty
44072 prompt. The client must respond with the combined data string.
44073 </para>
44074 <para>
44075 The data string is base64 encoded, as required by the RFC. This example,
44076 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;
44077 represents a zero byte. This is split up into three strings, the first of which
44078 is empty. The <option>server_condition</option> option in the authenticator checks that the
44079 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
44080 </para>
44081 <para>
44082 Having just one fixed user name and password, as in this example, is not very
44083 realistic, though for a small organization with only a handful of
44084 authenticating clients it could make sense.
44085 </para>
44086 <para>
44087 A more sophisticated instance of this authenticator could use the user name in
44088 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
44089 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
44090 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
44091 This is an incorrect example:
44092 </para>
44093 <literallayout class="monospaced" revisionflag="changed">
44094 server_condition = \
44095   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
44096 </literallayout>
44097 <para>
44098 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
44099 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
44100 incorrect? It works fine for existing users, but consider what happens if a
44101 non-existent user name is given. The lookup fails, but as no success/failure
44102 strings are given for the lookup, it yields an empty string. Thus, to defeat
44103 the authentication, all a client has to do is to supply a non-existent user
44104 name and an empty password. The correct way of writing this test is:
44105 </para>
44106 <literallayout class="monospaced" revisionflag="changed">
44107 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
44108   {${if eq{$value}{$auth3}}} {false}}
44109 </literallayout>
44110 <para revisionflag="changed">
44111 In this case, if the lookup succeeds, the result is checked; if the lookup
44112 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
44113 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
44114 always fails if its second argument is empty. However, the second way of
44115 writing the test makes the logic clearer.
44116 </para>
44117 </section>
44118 <section>
44119 <title>The LOGIN authentication mechanism</title>
44120 <para>
44121 <indexterm role="concept">
44122 <primary>LOGIN authentication mechanism</primary>
44123 </indexterm>
44124 <indexterm role="concept">
44125 <primary>authentication</primary>
44126 <secondary>LOGIN mechanism</secondary>
44127 </indexterm>
44128 The LOGIN authentication mechanism is not documented in any RFC, but is in use
44129 in a number of programs. No data is sent with the AUTH command. Instead, a
44130 user name and password are supplied separately, in response to prompts. The
44131 plaintext authenticator can be configured to support this as in this example:
44132 </para>
44133 <literallayout class="monospaced">
44134 fixed_login:
44135   driver = plaintext
44136   public_name = LOGIN
44137   server_prompts = User Name : Password
44138   server_condition = \
44139     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
44140   server_set_id = $auth1
44141 </literallayout>
44142 <para>
44143 Because of the way plaintext operates, this authenticator accepts data supplied
44144 with the AUTH command (in contravention of the specification of LOGIN), but
44145 if the client does not supply it (as is the case for LOGIN clients), the prompt
44146 strings are used to obtain two data items.
44147 </para>
44148 <para>
44149 Some clients are very particular about the precise text of the prompts. For
44150 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
44151 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
44152 strings. It uses the <option>ldapauth</option> expansion condition to check the user
44153 name and password by binding to an LDAP server:
44154 </para>
44155 <literallayout class="monospaced">
44156 login:
44157   driver = plaintext
44158   public_name = LOGIN
44159   server_prompts = Username:: : Password::
44160   server_condition = ${if ldapauth \
44161     {user="cn=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
44162     pass=${quote:$auth2} \
44163     ldap://ldap.example.org/}}
44164   server_set_id = uid=$auth1,ou=people,o=example.org
44165 </literallayout>
44166 <para>
44167 Note the use of the <option>quote_ldap_dn</option> operator to correctly quote the DN for
44168 authentication. However, the basic <option>quote</option> operator, rather than any of the
44169 LDAP quoting operators, is the correct one to use for the password, because
44170 quoting is needed only to make the password conform to the Exim syntax. At the
44171 LDAP level, the password is an uninterpreted string.
44172 </para>
44173 </section>
44174 <section>
44175 <title>Support for different kinds of authentication</title>
44176 <para>
44177 A number of string expansion features are provided for the purpose of
44178 interfacing to different ways of user authentication. These include checking
44179 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
44180 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
44181 <xref linkend="SECTexpcond"/>.
44182 </para>
44183 </section>
44184 <section>
44185 <title>Using plaintext in a client</title>
44186 <para>
44187 <indexterm role="concept">
44188 <primary>options</primary>
44189 <secondary><command>plaintext</command> authenticator (client)</secondary>
44190 </indexterm>
44191 The <command>plaintext</command> authenticator has two client options:
44192 </para>
44193 <para>
44194 <indexterm role="option">
44195 <primary>client_ignore_invalid_base64</primary>
44196 </indexterm>
44197 </para>
44198 <informaltable frame="all">
44199 <tgroup cols="4" colsep="0" rowsep="0">
44200 <colspec colwidth="8*" align="left"/>
44201 <colspec colwidth="5*" align="center"/>
44202 <colspec colwidth="5*" align="center"/>
44203 <colspec colwidth="6*" align="right"/>
44204 <tbody>
44205 <row>
44206 <entry><option>client_ignore_invalid_base64</option></entry>
44207 <entry>Use: <emphasis>plaintext</emphasis></entry>
44208 <entry>Type: <emphasis>boolean</emphasis></entry>
44209 <entry>Default: <emphasis>false</emphasis></entry>
44210 </row>
44211 </tbody>
44212 </tgroup>
44213 </informaltable>
44214 <para>
44215 If the client receives a server prompt that is not a valid base64 string,
44216 authentication is abandoned by default. However, if this option is set true,
44217 the error in the challenge is ignored and the client sends the response as
44218 usual.
44219 </para>
44220 <para>
44221 <indexterm role="option">
44222 <primary>client_send</primary>
44223 </indexterm>
44224 </para>
44225 <informaltable frame="all">
44226 <tgroup cols="4" colsep="0" rowsep="0">
44227 <colspec colwidth="8*" align="left"/>
44228 <colspec colwidth="5*" align="center"/>
44229 <colspec colwidth="5*" align="center"/>
44230 <colspec colwidth="6*" align="right"/>
44231 <tbody>
44232 <row>
44233 <entry><option>client_send</option></entry>
44234 <entry>Use: <emphasis>plaintext</emphasis></entry>
44235 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44236 <entry>Default: <emphasis>unset</emphasis></entry>
44237 </row>
44238 </tbody>
44239 </tgroup>
44240 </informaltable>
44241 <para>
44242 The string is a colon-separated list of authentication data strings. Each
44243 string is independently expanded before being sent to the server. The first
44244 string is sent with the AUTH command; any more strings are sent in response
44245 to prompts from the server. Before each string is expanded, the value of the
44246 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
44247 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
44248 way. Thus, the prompt that is received in response to sending the first string
44249 (with the AUTH command) can be used in the expansion of the second string, and
44250 so on. If an invalid base64 string is received when
44251 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
44252 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
44253 </para>
44254 <para>
44255 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
44256 splitting takes priority and happens first.
44257 </para>
44258 <para>
44259 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
44260 the data, further processing is applied to each string before it is sent. If
44261 there are any single circumflex characters in the string, they are converted to
44262 NULs. Should an actual circumflex be required as data, it must be doubled in
44263 the string.
44264 </para>
44265 <para>
44266 This is an example of a client configuration that implements the PLAIN
44267 authentication mechanism with a fixed user name and password:
44268 </para>
44269 <literallayout class="monospaced">
44270 fixed_plain:
44271   driver = plaintext
44272   public_name = PLAIN
44273   client_send = ^username^mysecret
44274 </literallayout>
44275 <para>
44276 The lack of colons means that the entire text is sent with the AUTH
44277 command, with the circumflex characters converted to NULs. A similar example
44278 that uses the LOGIN mechanism is:
44279 </para>
44280 <literallayout class="monospaced">
44281 fixed_login:
44282   driver = plaintext
44283   public_name = LOGIN
44284   client_send = : username : mysecret
44285 </literallayout>
44286 <para>
44287 The initial colon means that the first string is empty, so no data is sent with
44288 the AUTH command itself. The remaining strings are sent in response to
44289 prompts.
44290 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
44291 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
44292 </para>
44293 </section>
44294 </chapter>
44295
44296 <chapter>
44297 <title>The cram_md5 authenticator</title>
44298 <para>
44299 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
44300 <primary><command>cram_md5</command> authenticator</primary>
44301 </indexterm>
44302 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
44303 <primary>authenticators</primary>
44304 <secondary><command>cram_md5</command></secondary>
44305 </indexterm>
44306 <indexterm role="concept">
44307 <primary>CRAM-MD5 authentication mechanism</primary>
44308 </indexterm>
44309 <indexterm role="concept">
44310 <primary>authentication</primary>
44311 <secondary>CRAM-MD5 mechanism</secondary>
44312 </indexterm>
44313 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
44314 sends a challenge string to the client, and the response consists of a user
44315 name and the CRAM-MD5 digest of the challenge string combined with a secret
44316 string (password) which is known to both server and client. Thus, the secret
44317 is not sent over the network as plain text, which makes this authenticator more
44318 secure than <command>plaintext</command>. However, the downside is that the secret has to be
44319 available in plain text at either end.
44320 </para>
44321 <section>
44322 <title>Using cram_md5 as a server</title>
44323 <para>
44324 <indexterm role="concept">
44325 <primary>options</primary>
44326 <secondary><command>cram_md5</command> authenticator (server)</secondary>
44327 </indexterm>
44328 This authenticator has one server option, which must be set to configure the
44329 authenticator as a server:
44330 </para>
44331 <para>
44332 <indexterm role="option">
44333 <primary>server_secret</primary>
44334 </indexterm>
44335 </para>
44336 <informaltable frame="all">
44337 <tgroup cols="4" colsep="0" rowsep="0">
44338 <colspec colwidth="8*" align="left"/>
44339 <colspec colwidth="5*" align="center"/>
44340 <colspec colwidth="5*" align="center"/>
44341 <colspec colwidth="6*" align="right"/>
44342 <tbody>
44343 <row>
44344 <entry><option>server_secret</option></entry>
44345 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44346 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44347 <entry>Default: <emphasis>unset</emphasis></entry>
44348 </row>
44349 </tbody>
44350 </tgroup>
44351 </informaltable>
44352 <para>
44353 <indexterm role="concept">
44354 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44355 <secondary>in <command>cram_md5</command> authenticator</secondary>
44356 </indexterm>
44357 When the server receives the client&#x2019;s response, the user name is placed in
44358 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
44359 obtain the password for that user. The server then computes the CRAM-MD5 digest
44360 that the client should have sent, and checks that it received the correct
44361 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
44362 fails. If the expansion fails for some other reason, a temporary error code is
44363 returned to the client.
44364 </para>
44365 <para>
44366 For compatibility with previous releases of Exim, the user name is also placed
44367 in <varname>$1</varname>. However, the use of this variables for this purpose is now
44368 deprecated, as it can lead to confusion in string expansions that also use
44369 numeric variables for other things.
44370 </para>
44371 <para>
44372 For example, the following authenticator checks that the user name given by the
44373 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
44374 user name, authentication fails.
44375 </para>
44376 <literallayout class="monospaced">
44377 fixed_cram:
44378   driver = cram_md5
44379   public_name = CRAM-MD5
44380   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
44381   server_set_id = $auth1
44382 </literallayout>
44383 <para>
44384 <indexterm role="concept">
44385 <primary><varname>$authenticated_id</varname></primary>
44386 </indexterm>
44387 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
44388 name in <varname>$authenticated_id</varname>. A more tyical configuration might look up the
44389 secret string in a file, using the user name as the key. For example:
44390 </para>
44391 <literallayout class="monospaced">
44392 lookup_cram:
44393   driver = cram_md5
44394   public_name = CRAM-MD5
44395   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}{$value}fail}
44396   server_set_id = $auth1
44397 </literallayout>
44398 <para>
44399 Note that this expansion explicitly forces failure if the lookup fails
44400 because <varname>$1</varname> contains an unknown user name.
44401 </para>
44402 </section>
44403 <section>
44404 <title>Using cram_md5 as a client</title>
44405 <para>
44406 <indexterm role="concept">
44407 <primary>options</primary>
44408 <secondary><command>cram_md5</command> authenticator (client)</secondary>
44409 </indexterm>
44410 When used as a client, the <command>cram_md5</command> authenticator has two options:
44411 </para>
44412 <para>
44413 <indexterm role="option">
44414 <primary>client_name</primary>
44415 </indexterm>
44416 </para>
44417 <informaltable frame="all">
44418 <tgroup cols="4" colsep="0" rowsep="0">
44419 <colspec colwidth="8*" align="left"/>
44420 <colspec colwidth="5*" align="center"/>
44421 <colspec colwidth="5*" align="center"/>
44422 <colspec colwidth="6*" align="right"/>
44423 <tbody>
44424 <row>
44425 <entry><option>client_name</option></entry>
44426 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44427 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44428 <entry>Default: <emphasis>the primary host name</emphasis></entry>
44429 </row>
44430 </tbody>
44431 </tgroup>
44432 </informaltable>
44433 <para>
44434 This string is expanded, and the result used as the user name data when
44435 computing the response to the server&#x2019;s challenge.
44436 </para>
44437 <para>
44438 <indexterm role="option">
44439 <primary>client_secret</primary>
44440 </indexterm>
44441 </para>
44442 <informaltable frame="all">
44443 <tgroup cols="4" colsep="0" rowsep="0">
44444 <colspec colwidth="8*" align="left"/>
44445 <colspec colwidth="5*" align="center"/>
44446 <colspec colwidth="5*" align="center"/>
44447 <colspec colwidth="6*" align="right"/>
44448 <tbody>
44449 <row>
44450 <entry><option>client_secret</option></entry>
44451 <entry>Use: <emphasis>cram_md5</emphasis></entry>
44452 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44453 <entry>Default: <emphasis>unset</emphasis></entry>
44454 </row>
44455 </tbody>
44456 </tgroup>
44457 </informaltable>
44458 <para>
44459 This option must be set for the authenticator to work as a client. Its value is
44460 expanded and the result used as the secret string when computing the response.
44461 </para>
44462 <para>
44463 <indexterm role="concept">
44464 <primary><varname>$host</varname></primary>
44465 </indexterm>
44466 <indexterm role="concept">
44467 <primary><varname>$host_address</varname></primary>
44468 </indexterm>
44469 Different user names and secrets can be used for different servers by referring
44470 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
44471 expansion string is treated as an indication that this authenticator is not
44472 prepared to handle this case. Exim moves on to the next configured client
44473 authenticator. Any other expansion failure causes Exim to give up trying to
44474 send the message to the current server.
44475 </para>
44476 <para>
44477 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
44478 strings, is:
44479 </para>
44480 <literallayout class="monospaced">
44481 fixed_cram:
44482   driver = cram_md5
44483   public_name = CRAM-MD5
44484   client_name = ph10
44485   client_secret = secret
44486 </literallayout>
44487 <para>
44488 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
44489 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
44490 </para>
44491 </section>
44492 </chapter>
44493
44494 <chapter>
44495 <title>The cyrus_sasl authenticator</title>
44496 <para>
44497 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
44498 <primary><command>cyrus_sasl</command> authenticator</primary>
44499 </indexterm>
44500 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
44501 <primary>authenticators</primary>
44502 <secondary><command>cyrus_sasl</command></secondary>
44503 </indexterm>
44504 <indexterm role="concept">
44505 <primary>Cyrus</primary>
44506 <secondary>SASL library</secondary>
44507 </indexterm>
44508 The code for this authenticator was provided by Matthew Byng-Maddick of A L
44509 Digital Ltd (<emphasis role="bold"><ulink url="http://www.aldigital.co.uk">http://www.aldigital.co.uk</ulink></emphasis>).
44510 </para>
44511 <para>
44512 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
44513 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
44514 Layer</quote>). This library supports a number of authentication mechanisms,
44515 including PLAIN and LOGIN, but also several others that Exim does not support
44516 directly. In particular, there is support for Kerberos authentication.
44517 </para>
44518 <para>
44519 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
44520 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
44521 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
44522 name of the driver to determine which mechanism to support.
44523 </para>
44524 <para>
44525 Where access to some kind of secret file is required, for example in GSSAPI
44526 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
44527 user, and that the Cyrus SASL library has no way of escalating privileges
44528 by default. You may also find you need to set environment variables,
44529 depending on the driver you are using.
44530 </para>
44531 <section>
44532 <title>Using cyrus_sasl as a server</title>
44533 <para>
44534 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
44535 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
44536 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
44537 use of this variable for this purpose is now deprecated, as it can lead to
44538 confusion in string expansions that also use numeric variables for other
44539 things.
44540 </para>
44541 <para>
44542 <indexterm role="option">
44543 <primary>server_hostname</primary>
44544 </indexterm>
44545 </para>
44546 <informaltable frame="all">
44547 <tgroup cols="4" colsep="0" rowsep="0">
44548 <colspec colwidth="8*" align="left"/>
44549 <colspec colwidth="5*" align="center"/>
44550 <colspec colwidth="5*" align="center"/>
44551 <colspec colwidth="6*" align="right"/>
44552 <tbody>
44553 <row>
44554 <entry><option>server_hostname</option></entry>
44555 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44556 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44557 <entry>Default: <emphasis><literal>$primary_hostname</literal></emphasis></entry>
44558 </row>
44559 </tbody>
44560 </tgroup>
44561 </informaltable>
44562 <para>
44563 This option selects the hostname that is used when communicating with
44564 the library. It is up to the underlying SASL plug-in what it does with
44565 this data.
44566 </para>
44567 <para>
44568 <indexterm role="option">
44569 <primary>server_mech</primary>
44570 </indexterm>
44571 </para>
44572 <informaltable frame="all">
44573 <tgroup cols="4" colsep="0" rowsep="0">
44574 <colspec colwidth="8*" align="left"/>
44575 <colspec colwidth="5*" align="center"/>
44576 <colspec colwidth="5*" align="center"/>
44577 <colspec colwidth="6*" align="right"/>
44578 <tbody>
44579 <row>
44580 <entry><option>server_mech</option></entry>
44581 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44582 <entry>Type: <emphasis>string</emphasis></entry>
44583 <entry>Default: <emphasis><literal>public_name</literal></emphasis></entry>
44584 </row>
44585 </tbody>
44586 </tgroup>
44587 </informaltable>
44588 <para>
44589 This option selects the authentication mechanism this driver should
44590 use. It allows you to use a different underlying mechanism from the
44591 advertised name. For example:
44592 </para>
44593 <literallayout class="monospaced">
44594 sasl:
44595   driver = cyrus_sasl
44596   public_name = X-ANYTHING
44597   server_mech = CRAM-MD5
44598   server_set_id = $auth1
44599 </literallayout>
44600 <para>
44601 <indexterm role="option">
44602 <primary>server_realm</primary>
44603 </indexterm>
44604 </para>
44605 <informaltable frame="all">
44606 <tgroup cols="4" colsep="0" rowsep="0">
44607 <colspec colwidth="8*" align="left"/>
44608 <colspec colwidth="5*" align="center"/>
44609 <colspec colwidth="5*" align="center"/>
44610 <colspec colwidth="6*" align="right"/>
44611 <tbody>
44612 <row>
44613 <entry><option>server_realm</option></entry>
44614 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44615 <entry>Type: <emphasis>string</emphasis></entry>
44616 <entry>Default: <emphasis>unset</emphasis></entry>
44617 </row>
44618 </tbody>
44619 </tgroup>
44620 </informaltable>
44621 <para>
44622 This specifies the SASL realm that the server claims to be in.
44623 </para>
44624 <para>
44625 <indexterm role="option">
44626 <primary>server_service</primary>
44627 </indexterm>
44628 </para>
44629 <informaltable frame="all">
44630 <tgroup cols="4" colsep="0" rowsep="0">
44631 <colspec colwidth="8*" align="left"/>
44632 <colspec colwidth="5*" align="center"/>
44633 <colspec colwidth="5*" align="center"/>
44634 <colspec colwidth="6*" align="right"/>
44635 <tbody>
44636 <row>
44637 <entry><option>server_service</option></entry>
44638 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
44639 <entry>Type: <emphasis>string</emphasis></entry>
44640 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
44641 </row>
44642 </tbody>
44643 </tgroup>
44644 </informaltable>
44645 <para>
44646 This is the SASL service that the server claims to implement.
44647 </para>
44648 <para>
44649 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
44650 private options. All you need to do is to specify an appropriate mechanism as
44651 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
44652 PLAIN, you could have two authenticators as follows:
44653 </para>
44654 <literallayout class="monospaced">
44655 sasl_cram_md5:
44656   driver = cyrus_sasl
44657   public_name = CRAM-MD5
44658   server_set_id = $auth1
44659
44660 sasl_plain:
44661   driver = cyrus_sasl
44662   public_name = PLAIN
44663   server_set_id = $auth1
44664 </literallayout>
44665 <para>
44666 Cyrus SASL does implement the LOGIN authentication method, even though it is
44667 not a standard method. It is disabled by default in the source distribution,
44668 but it is present in many binary distributions.
44669 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
44670 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
44671 </para>
44672 </section>
44673 </chapter>
44674
44675 <chapter id="CHAPspa">
44676 <title>The spa authenticator</title>
44677 <para>
44678 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
44679 <primary><command>spa</command> authenticator</primary>
44680 </indexterm>
44681 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
44682 <primary>authenticators</primary>
44683 <secondary><command>spa</command></secondary>
44684 </indexterm>
44685 <indexterm role="concept">
44686 <primary>authentication</primary>
44687 <secondary>Microsoft Secure Password</secondary>
44688 </indexterm>
44689 <indexterm role="concept">
44690 <primary>authentication</primary>
44691 <secondary>NTLM</secondary>
44692 </indexterm>
44693 <indexterm role="concept">
44694 <primary>Microsoft Secure Password Authentication</primary>
44695 </indexterm>
44696 <indexterm role="concept">
44697 <primary>NTLM authentication</primary>
44698 </indexterm>
44699 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
44700 Password Authentication</emphasis> mechanism,
44701 which is also sometimes known as NTLM (NT LanMan). The code for client side of
44702 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
44703 taken from the Samba project (<emphasis role="bold"><ulink url="http://www.samba.org">http://www.samba.org</ulink></emphasis>). The code for the
44704 server side was subsequently contributed by Tom Kistner. The mechanism works as
44705 follows:
44706 </para>
44707 <itemizedlist>
44708 <listitem>
44709 <para>
44710 After the AUTH command has been accepted, the client sends an SPA
44711 authentication request based on the user name and optional domain.
44712 </para>
44713 </listitem>
44714 <listitem>
44715 <para>
44716 The server sends back a challenge.
44717 </para>
44718 </listitem>
44719 <listitem>
44720 <para>
44721 The client builds a challenge response which makes use of the user&#x2019;s password
44722 and sends it to the server, which then accepts or rejects it.
44723 </para>
44724 </listitem>
44725 </itemizedlist>
44726 <para>
44727 Encryption is used to protect the password in transit.
44728 </para>
44729 <section>
44730 <title>Using spa as a server</title>
44731 <para>
44732 <indexterm role="concept">
44733 <primary>options</primary>
44734 <secondary><command>spa</command> authenticator (server)</secondary>
44735 </indexterm>
44736 The <command>spa</command> authenticator has just one server option:
44737 </para>
44738 <para>
44739 <indexterm role="option">
44740 <primary>server_password</primary>
44741 </indexterm>
44742 </para>
44743 <informaltable frame="all">
44744 <tgroup cols="4" colsep="0" rowsep="0">
44745 <colspec colwidth="8*" align="left"/>
44746 <colspec colwidth="5*" align="center"/>
44747 <colspec colwidth="5*" align="center"/>
44748 <colspec colwidth="6*" align="right"/>
44749 <tbody>
44750 <row>
44751 <entry><option>server_password</option></entry>
44752 <entry>Use: <emphasis>spa</emphasis></entry>
44753 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44754 <entry>Default: <emphasis>unset</emphasis></entry>
44755 </row>
44756 </tbody>
44757 </tgroup>
44758 </informaltable>
44759 <para>
44760 <indexterm role="concept">
44761 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
44762 <secondary>in <command>spa</command> authenticator</secondary>
44763 </indexterm>
44764 This option is expanded, and the result must be the cleartext password for the
44765 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
44766 compatibility with previous releases of Exim, the user name is also placed in
44767 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
44768 it can lead to confusion in string expansions that also use numeric variables
44769 for other things. For example:
44770 </para>
44771 <literallayout class="monospaced">
44772 spa:
44773   driver = spa
44774   public_name = NTLM
44775   server_password = \
44776     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
44777 </literallayout>
44778 <para>
44779 If the expansion is forced to fail, authentication fails. Any other expansion
44780 failure causes a temporary error code to be returned.
44781 </para>
44782 </section>
44783 <section>
44784 <title>Using spa as a client</title>
44785 <para>
44786 <indexterm role="concept">
44787 <primary>options</primary>
44788 <secondary><command>spa</command> authenticator (client)</secondary>
44789 </indexterm>
44790 The <command>spa</command> authenticator has the following client options:
44791 </para>
44792 <para>
44793 <indexterm role="option">
44794 <primary>client_domain</primary>
44795 </indexterm>
44796 </para>
44797 <informaltable frame="all">
44798 <tgroup cols="4" colsep="0" rowsep="0">
44799 <colspec colwidth="8*" align="left"/>
44800 <colspec colwidth="5*" align="center"/>
44801 <colspec colwidth="5*" align="center"/>
44802 <colspec colwidth="6*" align="right"/>
44803 <tbody>
44804 <row>
44805 <entry><option>client_domain</option></entry>
44806 <entry>Use: <emphasis>spa</emphasis></entry>
44807 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44808 <entry>Default: <emphasis>unset</emphasis></entry>
44809 </row>
44810 </tbody>
44811 </tgroup>
44812 </informaltable>
44813 <para>
44814 This option specifies an optional domain for the authentication.
44815 </para>
44816 <para>
44817 <indexterm role="option">
44818 <primary>client_password</primary>
44819 </indexterm>
44820 </para>
44821 <informaltable frame="all">
44822 <tgroup cols="4" colsep="0" rowsep="0">
44823 <colspec colwidth="8*" align="left"/>
44824 <colspec colwidth="5*" align="center"/>
44825 <colspec colwidth="5*" align="center"/>
44826 <colspec colwidth="6*" align="right"/>
44827 <tbody>
44828 <row>
44829 <entry><option>client_password</option></entry>
44830 <entry>Use: <emphasis>spa</emphasis></entry>
44831 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44832 <entry>Default: <emphasis>unset</emphasis></entry>
44833 </row>
44834 </tbody>
44835 </tgroup>
44836 </informaltable>
44837 <para>
44838 This option specifies the user&#x2019;s password, and must be set.
44839 </para>
44840 <para>
44841 <indexterm role="option">
44842 <primary>client_username</primary>
44843 </indexterm>
44844 </para>
44845 <informaltable frame="all">
44846 <tgroup cols="4" colsep="0" rowsep="0">
44847 <colspec colwidth="8*" align="left"/>
44848 <colspec colwidth="5*" align="center"/>
44849 <colspec colwidth="5*" align="center"/>
44850 <colspec colwidth="6*" align="right"/>
44851 <tbody>
44852 <row>
44853 <entry><option>client_username</option></entry>
44854 <entry>Use: <emphasis>spa</emphasis></entry>
44855 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44856 <entry>Default: <emphasis>unset</emphasis></entry>
44857 </row>
44858 </tbody>
44859 </tgroup>
44860 </informaltable>
44861 <para>
44862 This option specifies the user name, and must be set. Here is an example of a
44863 configuration of this authenticator for use with the mail servers at
44864 <emphasis>msn.com</emphasis>:
44865 </para>
44866 <literallayout class="monospaced">
44867 msn:
44868   driver = spa
44869   public_name = MSN
44870   client_username = msn/msn_username
44871   client_password = msn_plaintext_password
44872   client_domain = DOMAIN_OR_UNSET
44873 </literallayout>
44874 <para>
44875 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
44876 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
44877 </para>
44878 </section>
44879 </chapter>
44880
44881 <chapter id="CHAPTLS">
44882 <title>Encrypted SMTP connections using TLS/SSL</title>
44883 <titleabbrev>Encrypted SMTP connections</titleabbrev>
44884 <para>
44885 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
44886 <primary>encryption</primary>
44887 <secondary>on SMTP connection</secondary>
44888 </indexterm>
44889 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
44890 <primary>SMTP</primary>
44891 <secondary>encryption</secondary>
44892 </indexterm>
44893 <indexterm role="concept">
44894 <primary>TLS</primary>
44895 <secondary>on SMTP connection</secondary>
44896 </indexterm>
44897 <indexterm role="concept">
44898 <primary>OpenSSL</primary>
44899 </indexterm>
44900 <indexterm role="concept">
44901 <primary>GnuTLS</primary>
44902 </indexterm>
44903 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
44904 Sockets Layer), is implemented by making use of the OpenSSL library or the
44905 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
44906 cryptographic code in the Exim distribution itself for implementing TLS. In
44907 order to use this feature you must install OpenSSL or GnuTLS, and then build a
44908 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
44909 You also need to understand the basic concepts of encryption at a managerial
44910 level, and in particular, the way that public keys, private keys, and
44911 certificates are used.
44912 </para>
44913 <para>
44914 RFC 3207 defines how SMTP connections can make use of encryption. Once a
44915 connection is established, the client issues a STARTTLS command. If the
44916 server accepts this, the client and the server negotiate an encryption
44917 mechanism. If the negotiation succeeds, the data that subsequently passes
44918 between them is encrypted.
44919 </para>
44920 <para>
44921 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
44922 and if so, what cipher suite is in use, whether the client supplied a
44923 certificate, and whether or not that certificate was verified. This makes it
44924 possible for an Exim server to deny or accept certain commands based on the
44925 encryption state.
44926 </para>
44927 <para>
44928 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
44929 disrupt TLS connections. You need to turn off SMTP scanning for these products
44930 in order to get TLS to work.
44931 </para>
44932 <section>
44933 <title>Support for the legacy <quote>ssmtp</quote> (aka <quote>smtps</quote>) protocol</title>
44934 <para>
44935 <indexterm role="concept">
44936 <primary>ssmtp protocol</primary>
44937 </indexterm>
44938 <indexterm role="concept">
44939 <primary>smtps protocol</primary>
44940 </indexterm>
44941 <indexterm role="concept">
44942 <primary>SMTP</primary>
44943 <secondary>ssmtp protocol</secondary>
44944 </indexterm>
44945 <indexterm role="concept">
44946 <primary>SMTP</primary>
44947 <secondary>smtps protocol</secondary>
44948 </indexterm>
44949 Early implementations of encrypted SMTP used a different TCP port from normal
44950 SMTP, and expected an encryption negotiation to start immediately, instead of
44951 waiting for a STARTTLS command from the client using the standard SMTP
44952 port. The protocol was called <quote>ssmtp</quote> or <quote>smtps</quote>, and port 465 was
44953 allocated for this purpose.
44954 </para>
44955 <para>
44956 This approach was abandoned when encrypted SMTP was standardised, but there are
44957 still some legacy clients that use it. Exim supports these clients by means of
44958 the <option>tls_on_connect_ports</option> global option. Its value must be a list of port
44959 numbers; the most common use is expected to be:
44960 </para>
44961 <literallayout class="monospaced">
44962 tls_on_connect_ports = 465
44963 </literallayout>
44964 <para>
44965 The port numbers specified by this option apply to all SMTP connections, both
44966 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
44967 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
44968 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
44969 an extra port &ndash; rather, it specifies different behaviour on a port that is
44970 defined elsewhere.
44971 </para>
44972 <para>
44973 There is also a <option>-tls-on-connect</option> command line option. This overrides
44974 <option>tls_on_connect_ports</option>; it forces the legacy behaviour for all ports.
44975 </para>
44976 </section>
44977 <section id="SECTopenvsgnu">
44978 <title>OpenSSL vs GnuTLS</title>
44979 <para>
44980 <indexterm role="concept">
44981 <primary>TLS</primary>
44982 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
44983 </indexterm>
44984 The first TLS support in Exim was implemented using OpenSSL. Support for GnuTLS
44985 followed later, when the first versions of GnuTLS were released. To build Exim
44986 to use GnuTLS, you need to set
44987 </para>
44988 <literallayout class="monospaced">
44989 USE_GNUTLS=yes
44990 </literallayout>
44991 <para>
44992 in Local/Makefile, in addition to
44993 </para>
44994 <literallayout class="monospaced">
44995 SUPPORT_TLS=yes
44996 </literallayout>
44997 <para>
44998 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
44999 include files and libraries for GnuTLS can be found.
45000 </para>
45001 <para>
45002 There are some differences in usage when using GnuTLS instead of OpenSSL:
45003 </para>
45004 <itemizedlist>
45005 <listitem>
45006 <para>
45007 The <option>tls_verify_certificates</option> option must contain the name of a file, not the
45008 name of a directory (for OpenSSL it can be either).
45009 </para>
45010 </listitem>
45011 <listitem>
45012 <para>
45013 The <option>tls_dhparam</option> option is ignored, because early versions of GnuTLS had no
45014 facility for varying its Diffie-Hellman parameters. I understand that this has
45015 changed, but Exim has not been updated to provide this facility.
45016 </para>
45017 </listitem>
45018 <listitem>
45019 <para>
45020 <indexterm role="concept">
45021 <primary><varname>$tls_peerdn</varname></primary>
45022 </indexterm>
45023 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
45024 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
45025 affects the value of the <varname>$tls_peerdn</varname> variable.
45026 </para>
45027 </listitem>
45028 <listitem>
45029 <para>
45030 OpenSSL identifies cipher suites using hyphens as separators, for example:
45031 DES-CBC3-SHA. GnuTLS uses underscores, for example: RSA_ARCFOUR_SHA. What is
45032 more, OpenSSL complains if underscores are present in a cipher list. To make
45033 life simpler, Exim changes underscores to hyhens for OpenSSL and hyphens to
45034 underscores for GnuTLS when processing lists of cipher suites in the
45035 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
45036 option).
45037 </para>
45038 </listitem>
45039 <listitem>
45040 <para>
45041 The <option>tls_require_ciphers</option> options operate differently, as described in the
45042 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
45043 </para>
45044 </listitem>
45045 </itemizedlist>
45046 </section>
45047 <section>
45048 <title>GnuTLS parameter computation</title>
45049 <para>
45050 GnuTLS uses RSA and D-H parameters that take a substantial amount of time to
45051 compute. It is unreasonable to re-compute them for every TLS session.
45052 Therefore, Exim keeps this data in a file in its spool directory, called
45053 <filename>gnutls-params</filename>. The file is owned by the Exim user and is readable only by
45054 its owner. Every Exim process that start up GnuTLS reads the RSA and D-H
45055 parameters from this file. If the file does not exist, the first Exim process
45056 that needs it computes the data and writes it to a temporary file which is
45057 renamed once it is complete. It does not matter if several Exim processes do
45058 this simultaneously (apart from wasting a few resources). Once a file is in
45059 place, new Exim processes immediately start using it.
45060 </para>
45061 <para>
45062 For maximum security, the parameters that are stored in this file should be
45063 recalculated periodically, the frequency depending on your paranoia level.
45064 Arranging this is easy in principle; just delete the file when you want new
45065 values to be computed. However, there may be a problem. The calculation of new
45066 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
45067 If the system is not very active, <filename>/dev/random</filename> may delay returning data
45068 until enough randomness (entropy) is available. This may cause Exim to hang for
45069 a substantial amount of time, causing timeouts on incoming connections.
45070 </para>
45071 <para>
45072 The solution is to generate the parameters externally to Exim. They are stored
45073 in <filename>gnutls-params</filename> in PEM format, which means that they can be generated
45074 externally using the <command>certtool</command> command that is part of GnuTLS.
45075 </para>
45076 <para>
45077 To replace the parameters with new ones, instead of deleting the file
45078 and letting Exim re-create it, you can generate new parameters using
45079 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
45080 renaming. The relevant commands are something like this:
45081 </para>
45082 <literallayout class="monospaced">
45083 # rm -f new-params
45084 # touch new-params
45085 # chown exim:exim new-params
45086 # chmod 0400 new-params
45087 # certtool --generate-privkey --bits 512 &gt;new-params
45088 # echo "" &gt;&gt;new-params
45089 # certtool --generate-dh-params --bits 1024 &gt;&gt; new-params
45090 # mv new-params gnutls-params
45091 </literallayout>
45092 <para>
45093 If Exim never has to generate the parameters itself, the possibility of
45094 stalling is removed.
45095 </para>
45096 </section>
45097 <section id="SECTreqciphssl">
45098 <title>Requiring specific ciphers in OpenSSL</title>
45099 <para>
45100 <indexterm role="concept">
45101 <primary>TLS</primary>
45102 <secondary>requiring specific ciphers (OpenSSL)</secondary>
45103 </indexterm>
45104 <indexterm role="concept">
45105 <primary><option>tls_require_ciphers</option></primary>
45106 <secondary>OpenSSL</secondary>
45107 </indexterm>
45108 There is a function in the OpenSSL library that can be passed a list of cipher
45109 suites before the cipher negotiation takes place. This specifies which ciphers
45110 are acceptable. The list is colon separated and may contain names like
45111 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
45112 directly to this function call. The following quotation from the OpenSSL
45113 documentation specifies what forms of item are allowed in the cipher string:
45114 </para>
45115 <itemizedlist>
45116 <listitem>
45117 <para>
45118 It can consist of a single cipher suite such as RC4-SHA.
45119 </para>
45120 </listitem>
45121 <listitem>
45122 <para>
45123 It can represent a list of cipher suites containing a certain algorithm,
45124 or cipher suites of a certain type. For example SHA1 represents all
45125 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
45126 SSL v3 algorithms.
45127 </para>
45128 </listitem>
45129 <listitem>
45130 <para>
45131 Lists of cipher suites can be combined in a single cipher string using
45132 the + character. This is used as a logical and operation. For example
45133 SHA1+DES represents all cipher suites containing the SHA1 and the DES
45134 algorithms.
45135 </para>
45136 </listitem>
45137 </itemizedlist>
45138 <para>
45139 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
45140 <literal>-</literal> or <literal>+</literal>.
45141 </para>
45142 <itemizedlist>
45143 <listitem>
45144 <para>
45145 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
45146 ciphers deleted can never reappear in the list even if they are explicitly
45147 stated.
45148 </para>
45149 </listitem>
45150 <listitem>
45151 <para>
45152 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
45153 of the ciphers can be added again by later options.
45154 </para>
45155 </listitem>
45156 <listitem>
45157 <para>
45158 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
45159 option does not add any new ciphers; it just moves matching existing ones.
45160 </para>
45161 </listitem>
45162 </itemizedlist>
45163 <para>
45164 If none of these characters is present, the string is interpreted as
45165 a list of ciphers to be appended to the current preference list. If the list
45166 includes any ciphers already present they will be ignored: that is, they will
45167 not be moved to the end of the list.
45168 </para>
45169 </section>
45170 <section id="SECTreqciphgnu">
45171 <title>Requiring specific ciphers in GnuTLS</title>
45172 <para>
45173 <indexterm role="concept">
45174 <primary>TLS</primary>
45175 <secondary>requiring specific ciphers (GnuTLS)</secondary>
45176 </indexterm>
45177 <indexterm role="concept">
45178 <primary><option>tls_require_ciphers</option></primary>
45179 <secondary>GnuTLS</secondary>
45180 </indexterm>
45181 The GnuTLS library does not have a combined function like OpenSSL. Instead,
45182 it allows the caller to specify separate lists of key-exchange methods,
45183 main cipher algorithms, and MAC algorithms. Unfortunately, these lists are
45184 numerical, and the library does not have a function for turning names into
45185 numbers. Consequently, the list of recognized names has to be built into
45186 the application.
45187 </para>
45188 <para>
45189 At present, Exim permits only the list of main cipher algorithms to be
45190 changed. The <option>tls_require_ciphers</option> option is in the same format as for
45191 OpenSSL. Exim searches each item for the name of available algorithm. For
45192 example, if the list contains RSA_AES_SHA then AES is recognized.
45193 </para>
45194 <para>
45195 The cipher algorithms list starts out with a default set of algorithms. If
45196 the first item in <option>tls_require_ciphers</option> does <emphasis>not</emphasis> start with an
45197 exclamation mark, all the default items are deleted. Thus, only those specified
45198 can be used. If the first item in <option>tls_require_ciphers</option> <emphasis>does</emphasis> start with
45199 an exclamation mark, the defaults are left on the list.
45200 </para>
45201 <para>
45202 Then, any item that starts with an exclamation mark causes the relevant
45203 algorithms to be removed from the list, and any item that does not start
45204 with an exclamation mark causes the relevant algorithms to be added to the
45205 list. Thus,
45206 </para>
45207 <literallayout class="monospaced">
45208 tls_require_ciphers = !RSA_ARCFOUR_SHA
45209 </literallayout>
45210 <para>
45211 allows all the defaults except those that use ARCFOUR, whereas
45212 </para>
45213 <literallayout class="monospaced">
45214 tls_require_ciphers = AES : 3DES
45215 </literallayout>
45216 <para>
45217 allows only cipher suites that use AES and 3DES. The currently recognized
45218 algorithms are: AES_256, AES_128, AES (both of the preceding), 3DES, and
45219 ARCFOUR_128. Unrecognized algorithms are ignored. In a server, the order of the
45220 list is unimportant; the server will advertise the availability of all the
45221 relevant cipher suites. However, in a client, the order of the list specifies a
45222 preference order for the algorithms. The first one in the client&#x2019;s list that is
45223 also advertised by the server is tried first. The default order is as listed
45224 above.
45225 </para>
45226 </section>
45227 <section>
45228 <title>Configuring an Exim server to use TLS</title>
45229 <para>
45230 <indexterm role="concept">
45231 <primary>TLS</primary>
45232 <secondary>configuring an Exim server</secondary>
45233 </indexterm>
45234 When Exim has been built with TLS support, it advertises the availability of
45235 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
45236 but not to any others. The default value of this option is unset, which means
45237 that STARTTLS is not advertised at all. This default is chosen because you
45238 need to set some other options in order to make TLS avaliable, and also it is
45239 sensible for systems that want to use TLS only as a client.
45240 </para>
45241 <para>
45242 If a client issues a STARTTLS command and there is some configuration
45243 problem in the server, the command is rejected with a 454 error. If the client
45244 persists in trying to issue SMTP commands, all except QUIT are rejected
45245 with the error
45246 </para>
45247 <literallayout class="monospaced">
45248 554 Security failure
45249 </literallayout>
45250 <para>
45251 If a STARTTLS command is issued within an existing TLS session, it is
45252 rejected with a 554 error code.
45253 </para>
45254 <para>
45255 To enable TLS operations on a server, you must set <option>tls_advertise_hosts</option> to
45256 match some hosts. You can, of course, set it to * to match all hosts.
45257 However, this is not all you need to do. TLS sessions to a server won&#x2019;t work
45258 without some further configuration at the server end.
45259 </para>
45260 <para>
45261 It is rumoured that all existing clients that support TLS/SSL use RSA
45262 encryption. To make this work you need to set, in the server,
45263 </para>
45264 <literallayout class="monospaced">
45265 tls_certificate = /some/file/name
45266 tls_privatekey = /some/file/name
45267 </literallayout>
45268 <para>
45269 These options are, in fact, expanded strings, so you can make them depend on
45270 the identity of the client that is connected if you wish. The first file
45271 contains the server&#x2019;s X509 certificate, and the second contains the private key
45272 that goes with it. These files need to be readable by the Exim user, and must
45273 always be given as full path names. They can be the same file if both the
45274 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
45275 set, or if its expansion is forced to fail or results in an empty string, this
45276 is assumed to be the case. The certificate file may also contain intermediate
45277 certificates that need to be sent to the client to enable it to authenticate
45278 the server&#x2019;s certificate.
45279 </para>
45280 <para>
45281 If you do not understand about certificates and keys, please try to find a
45282 source of this background information, which is not Exim-specific. (There are a
45283 few comments below in section <xref linkend="SECTcerandall"/>.)
45284 </para>
45285 <para>
45286 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
45287 they apply only in the case of a server. If you need to use a certificate in an
45288 Exim client, you must set the options of the same names in an <command>smtp</command>
45289 transport.
45290 </para>
45291 <para>
45292 With just these options, an Exim server will be able to use TLS. It does not
45293 require the client to have a certificate (but see below for how to insist on
45294 this). There is one other option that may be needed in other situations. If
45295 </para>
45296 <literallayout class="monospaced">
45297 tls_dhparam = /some/file/name
45298 </literallayout>
45299 <para>
45300 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
45301 with the parameters contained in the file. This increases the set of cipher
45302 suites that the server supports. See the command
45303 </para>
45304 <literallayout class="monospaced">
45305 openssl dhparam
45306 </literallayout>
45307 <para>
45308 for a way of generating this data. At present, <option>tls_dhparam</option> is used only
45309 when Exim is linked with OpenSSL. It is ignored if GnuTLS is being used.
45310 </para>
45311 <para>
45312 The strings supplied for these three options are expanded every time a client
45313 host connects. It is therefore possible to use different certificates and keys
45314 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
45315 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
45316 forced to fail, Exim behaves as if the option is not set.
45317 </para>
45318 <para>
45319 <indexterm role="concept">
45320 <primary>cipher</primary>
45321 <secondary>logging</secondary>
45322 </indexterm>
45323 <indexterm role="concept">
45324 <primary>log</primary>
45325 <secondary>TLS cipher</secondary>
45326 </indexterm>
45327 <indexterm role="concept">
45328 <primary><varname>$tls_cipher</varname></primary>
45329 </indexterm>
45330 The variable <varname>$tls_cipher</varname> is set to the cipher suite that was negotiated for
45331 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
45332 incoming message (by default &ndash; you can, of course, change this), and it is
45333 also included in the log line that records a message&#x2019;s arrival, keyed by
45334 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
45335 condition can be used to test for specific cipher suites in ACLs.
45336 </para>
45337 <para>
45338 The ACLs that run for subsequent SMTP commands can check the name of the cipher
45339 suite and vary their actions accordingly. The cipher suite names are those used
45340 by OpenSSL. These may differ from the names used elsewhere. For example,
45341 OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other contexts
45342 is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL
45343 documentation for more details.
45344 </para>
45345 </section>
45346 <section>
45347 <title>Requesting and verifying client certificates</title>
45348 <para>
45349 <indexterm role="concept">
45350 <primary>certificate</primary>
45351 <secondary>verification of client</secondary>
45352 </indexterm>
45353 <indexterm role="concept">
45354 <primary>TLS</primary>
45355 <secondary>client certificate verification</secondary>
45356 </indexterm>
45357 If you want an Exim server to request a certificate when negotiating a TLS
45358 session with a client, you must set either <option>tls_verify_hosts</option> or
45359 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
45360 apply to all TLS connections. For any host that matches one of these options,
45361 Exim requests a certificate as part of the setup of the TLS session. The
45362 contents of the certificate are verified by comparing it with a list of
45363 expected certificates. These must be available in a file or,
45364 for OpenSSL only (not GnuTLS), a directory, identified by
45365 <option>tls_verify_certificates</option>.
45366 </para>
45367 <para>
45368 A file can contain multiple certificates, concatenated end to end. If a
45369 directory is used
45370 (OpenSSL only),
45371 each certificate must be in a separate file, with a name (or a symbolic link)
45372 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
45373 certificate. You can compute the relevant hash by running the command
45374 </para>
45375 <literallayout class="monospaced">
45376 openssl x509 -hash -noout -in /cert/file
45377 </literallayout>
45378 <para>
45379 where <filename>/cert/file</filename> contains a single certificate.
45380 </para>
45381 <para>
45382 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
45383 what happens if the client does not supply a certificate, or if the certificate
45384 does not match any of the certificates in the collection named by
45385 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
45386 attempt to set up a TLS session is aborted, and the incoming connection is
45387 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
45388 session continues. ACLs that run for subsequent SMTP commands can detect the
45389 fact that no certificate was verified, and vary their actions accordingly. For
45390 example, you can insist on a certificate before accepting a message for
45391 relaying, but not when the message is destined for local delivery.
45392 </para>
45393 <para>
45394 <indexterm role="concept">
45395 <primary><varname>$tls_peerdn</varname></primary>
45396 </indexterm>
45397 When a client supplies a certificate (whether it verifies or not), the value of
45398 the Distinguished Name of the certificate is made available in the variable
45399 <varname>$tls_peerdn</varname> during subsequent processing of the message.
45400 </para>
45401 <para>
45402 <indexterm role="concept">
45403 <primary>log</primary>
45404 <secondary>distinguished name</secondary>
45405 </indexterm>
45406 Because it is often a long text string, it is not included in the log line or
45407 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
45408 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
45409 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
45410 certificate is supplied, <varname>$tls_peerdn</varname> is empty.
45411 </para>
45412 </section>
45413 <section>
45414 <title>Revoked certificates</title>
45415 <para>
45416 <indexterm role="concept">
45417 <primary>TLS</primary>
45418 <secondary>revoked certificates</secondary>
45419 </indexterm>
45420 <indexterm role="concept">
45421 <primary>revocation list</primary>
45422 </indexterm>
45423 <indexterm role="concept">
45424 <primary>certificate</primary>
45425 <secondary>revocation list</secondary>
45426 </indexterm>
45427 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
45428 certificates are revoked. If you have such a list, you can pass it to an Exim
45429 server using the global option called <option>tls_crl</option> and to an Exim client using
45430 an identically named option for the <command>smtp</command> transport. In each case, the value
45431 of the option is expanded and must then be the name of a file that contains a
45432 CRL in PEM format.
45433 </para>
45434 </section>
45435 <section>
45436 <title>Configuring an Exim client to use TLS</title>
45437 <para>
45438 <indexterm role="concept">
45439 <primary>cipher</primary>
45440 <secondary>logging</secondary>
45441 </indexterm>
45442 <indexterm role="concept">
45443 <primary>log</primary>
45444 <secondary>TLS cipher</secondary>
45445 </indexterm>
45446 <indexterm role="concept">
45447 <primary>log</primary>
45448 <secondary>distinguished name</secondary>
45449 </indexterm>
45450 <indexterm role="concept">
45451 <primary>TLS</primary>
45452 <secondary>configuring an Exim client</secondary>
45453 </indexterm>
45454 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
45455 deliveries as well as to incoming, the latter one causing logging of the
45456 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
45457 within the <command>smtp</command> transport.
45458 </para>
45459 <para>
45460 It is not necessary to set any options to have TLS work in the <command>smtp</command>
45461 transport. If Exim is built with TLS support, and TLS is advertised by a
45462 server, the <command>smtp</command> transport always tries to start a TLS session. However,
45463 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
45464 transport) to a list of server hosts for which TLS should not be used.
45465 </para>
45466 <para>
45467 If you do not want Exim to attempt to send messages unencrypted when an attempt
45468 to set up an encrypted connection fails in any way, you can set
45469 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
45470 those hosts, delivery is always deferred if an encrypted connection cannot be
45471 set up. If there are any other hosts for the address, they are tried in the
45472 usual way.
45473 </para>
45474 <para>
45475 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
45476 the message unencrypted. It always does this if the response to STARTTLS is
45477 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
45478 session after a success response code, what happens is controlled by the
45479 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
45480 delivery to this host is deferred, and other hosts (if available) are tried. If
45481 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
45482 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
45483 negotiation fails, Exim closes the current connection (because it is in an
45484 unknown state), opens a new one to the same host, and then tries the delivery
45485 unencrypted.
45486 </para>
45487 <para>
45488 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
45489 transport provide the client with a certificate, which is passed to the server
45490 if it requests it. If the server is Exim, it will request a certificate only if
45491 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client. <emphasis role="bold">Note</emphasis>:
45492 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
45493 is operating as a client. Exim does not assume that a server certificate (set
45494 by the global options of the same name) should also be used when operating as a
45495 client.
45496 </para>
45497 <para>
45498 If <option>tls_verify_certificates</option> is set, it must name a file or,
45499 for OpenSSL only (not GnuTLS), a directory, that contains a collection of
45500 expected server certificates. The client verifies the server&#x2019;s certificate
45501 against this collection, taking into account any revoked certificates that are
45502 in the list defined by <option>tls_crl</option>.
45503 </para>
45504 <para>
45505 If
45506 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
45507 list of permitted cipher suites. If either of these checks fails, delivery to
45508 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
45509 alternative hosts, if any.
45510 </para>
45511 <para>
45512 <indexterm role="concept">
45513 <primary><varname>$host</varname></primary>
45514 </indexterm>
45515 <indexterm role="concept">
45516 <primary><varname>$host_address</varname></primary>
45517 </indexterm>
45518 All the TLS options in the <command>smtp</command> transport are expanded before use, with
45519 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
45520 which the client is connected. Forced failure of an expansion causes Exim to
45521 behave as if the relevant option were unset.
45522 </para>
45523 </section>
45524 <section id="SECTmulmessam">
45525 <title>Multiple messages on the same encrypted TCP/IP connection</title>
45526 <para>
45527 <indexterm role="concept">
45528 <primary>multiple SMTP deliveries with TLS</primary>
45529 </indexterm>
45530 <indexterm role="concept">
45531 <primary>TLS</primary>
45532 <secondary>multiple message deliveries</secondary>
45533 </indexterm>
45534 Exim sends multiple messages down the same TCP/IP connection by starting up
45535 an entirely new delivery process for each message, passing the socket from
45536 one process to the next. This implementation does not fit well with the use
45537 of TLS, because there is quite a lot of state information associated with a TLS
45538 connection, not just a socket identification. Passing all the state information
45539 to a new process is not feasible. Consequently, Exim shuts down an existing TLS
45540 session before passing the socket to a new process. The new process may then
45541 try to start a new TLS session, and if successful, may try to re-authenticate
45542 if AUTH is in use, before sending the next message.
45543 </para>
45544 <para>
45545 The RFC is not clear as to whether or not an SMTP session continues in clear
45546 after TLS has been shut down, or whether TLS may be restarted again later, as
45547 just described. However, if the server is Exim, this shutdown and
45548 reinitialization works. It is not known which (if any) other servers operate
45549 successfully if the client closes a TLS session and continues with unencrypted
45550 SMTP, but there are certainly some that do not work. For such servers, Exim
45551 should not pass the socket to another process, because the failure of the
45552 subsequent attempt to use it would cause Exim to record a temporary host error,
45553 and delay other deliveries to that host.
45554 </para>
45555 <para>
45556 To test for this case, Exim sends an EHLO command to the server after
45557 closing down the TLS session. If this fails in any way, the connection is
45558 closed instead of being passed to a new delivery process, but no retry
45559 information is recorded.
45560 </para>
45561 <para>
45562 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
45563 <command>smtp</command> transport to match those hosts for which Exim should not pass
45564 connections to new processes if TLS has been used.
45565 </para>
45566 </section>
45567 <section id="SECTcerandall">
45568 <title>Certificates and all that</title>
45569 <para>
45570 <indexterm role="concept">
45571 <primary>certificate</primary>
45572 <secondary>references to discussion</secondary>
45573 </indexterm>
45574 In order to understand fully how TLS works, you need to know about
45575 certificates, certificate signing, and certificate authorities. This is not the
45576 place to give a tutorial, especially as I do not know very much about it
45577 myself. Some helpful introduction can be found in the FAQ for the SSL addition
45578 to Apache, currently at
45579 </para>
45580 <literallayout>
45581 <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>
45582 </literallayout>
45583 <para>
45584 Other parts of the <emphasis>modssl</emphasis> documentation are also helpful, and have
45585 links to further files.
45586 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
45587 0-201-61598-3), contains both introductory and more in-depth descriptions.
45588 Some sample programs taken from the book are available from
45589 </para>
45590 <literallayout>
45591 <emphasis role="bold"><ulink url="http://www.rtfm.com/openssl-examples/">http://www.rtfm.com/openssl-examples/</ulink></emphasis>
45592 </literallayout>
45593 </section>
45594 <section>
45595 <title>Certificate chains</title>
45596 <para>
45597 The file named by <option>tls_certificate</option> may contain more than one
45598 certificate. This is useful in the case where the certificate that is being
45599 sent is validated by an intermediate certificate which the other end does
45600 not have. Multiple certificates must be in the correct order in the file.
45601 First the host&#x2019;s certificate itself, then the first intermediate
45602 certificate to validate the issuer of the host certificate, then the next
45603 intermediate certificate to validate the issuer of the first intermediate
45604 certificate, and so on, until finally (optionally) the root certificate.
45605 The root certificate must already be trusted by the recipient for
45606 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
45607 root certificate along with the rest makes it available for the user to
45608 install if the receiving end is a client MUA that can interact with a user.
45609 </para>
45610 </section>
45611 <section>
45612 <title>Self-signed certificates</title>
45613 <para>
45614 <indexterm role="concept">
45615 <primary>certificate</primary>
45616 <secondary>self-signed</secondary>
45617 </indexterm>
45618 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
45619 with OpenSSL, like this:
45620 </para>
45621 <literallayout class="monospaced">
45622 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
45623             -days 9999 -nodes
45624 </literallayout>
45625 <para>
45626 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
45627 delimited and so can be identified independently. The <option>-days</option> option
45628 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
45629 important: if you do not set it, the key is encrypted with a passphrase
45630 that you are prompted for, and any use that is made of the key causes more
45631 prompting for the passphrase. This is not helpful if you are going to use
45632 this certificate and key in an MTA, where prompting is not possible.
45633 </para>
45634 <para>
45635 A self-signed certificate made in this way is sufficient for testing, and
45636 may be adequate for all your requirements if you are mainly interested in
45637 encrypting transfers, and not in secure identification.
45638 </para>
45639 <para>
45640 However, many clients require that the certificate presented by the server be a
45641 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
45642 certificate. In this situation, the self-signed certificate described above
45643 must be installed on the client host as a trusted root <emphasis>certification
45644 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
45645 signed with that self-signed certificate.
45646 </para>
45647 <para>
45648 For information on creating self-signed CA certificates and using them to sign
45649 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
45650 Open-source PKI book, available online at
45651 <emphasis role="bold"><ulink url="http://ospkibook.sourceforge.net/">http://ospkibook.sourceforge.net/</ulink></emphasis>.
45652 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
45653 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
45654 </para>
45655 </section>
45656 </chapter>
45657
45658 <chapter id="CHAPACL">
45659 <title>Access control lists</title>
45660 <para>
45661 <indexterm role="concept" id="IIDacl" class="startofrange">
45662 <primary>access control lists (ACLs)</primary>
45663 <secondary>description</secondary>
45664 </indexterm>
45665 <indexterm role="concept">
45666 <primary>control of incoming mail</primary>
45667 </indexterm>
45668 <indexterm role="concept">
45669 <primary>message</primary>
45670 <secondary>controlling incoming</secondary>
45671 </indexterm>
45672 <indexterm role="concept">
45673 <primary>policy control</primary>
45674 <secondary>access control lists</secondary>
45675 </indexterm>
45676 Access Control Lists (ACLs) are defined in a separate section of the run time
45677 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
45678 name, terminated by a colon. Here is a complete ACL section that contains just
45679 one very small ACL:
45680 </para>
45681 <literallayout class="monospaced">
45682 begin acl
45683
45684 small_acl:
45685   accept   hosts = one.host.only
45686 </literallayout>
45687 <para>
45688 You can have as many lists as you like in the ACL section, and the order in
45689 which they appear does not matter. The lists are self-terminating.
45690 </para>
45691 <para>
45692 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
45693 certain SMTP commands. This applies both to incoming TCP/IP connections, and
45694 when a local process submits a message using SMTP by specifying the <option>-bs</option>
45695 option. The most common use is for controlling which recipients are accepted
45696 in incoming messages. In addition, you can define an ACL that is used to check
45697 local non-SMTP messages. The default configuration file contains an example of
45698 a realistic ACL for checking RCPT commands. This is discussed in chapter
45699 <xref linkend="CHAPdefconfil"/>.
45700 </para>
45701 <section>
45702 <title>Testing ACLs</title>
45703 <para>
45704 The <option>-bh</option> command line option provides a way of testing your ACL
45705 configuration locally by running a fake SMTP session with which you interact.
45706 The host <emphasis>relay-test.mail-abuse.org</emphasis> provides a service for checking your
45707 relaying configuration (see section <xref linkend="SECTcheralcon"/> for more details).
45708 </para>
45709 </section>
45710 <section>
45711 <title>Specifying when ACLs are used</title>
45712 <para>
45713 <indexterm role="concept">
45714 <primary>access control lists (ACLs)</primary>
45715 <secondary>options for specifying</secondary>
45716 </indexterm>
45717 In order to cause an ACL to be used, you have to name it in one of the relevant
45718 options in the main part of the configuration. These options are:
45719 <indexterm role="concept">
45720 <primary>AUTH</primary>
45721 <secondary>ACL for</secondary>
45722 </indexterm>
45723 <indexterm role="concept">
45724 <primary>DATA</primary>
45725 <secondary>ACLs for</secondary>
45726 </indexterm>
45727 <indexterm role="concept">
45728 <primary>ETRN</primary>
45729 <secondary>ACL for</secondary>
45730 </indexterm>
45731 <indexterm role="concept">
45732 <primary>EXPN</primary>
45733 <secondary>ACL for</secondary>
45734 </indexterm>
45735 <indexterm role="concept">
45736 <primary>HELO</primary>
45737 <secondary>ACL for</secondary>
45738 </indexterm>
45739 <indexterm role="concept">
45740 <primary>EHLO</primary>
45741 <secondary>ACL for</secondary>
45742 </indexterm>
45743 <indexterm role="concept">
45744 <primary>MAIL</primary>
45745 <secondary>ACL for</secondary>
45746 </indexterm>
45747 <indexterm role="concept">
45748 <primary>QUIT</primary>
45749 <secondary>ACL for</secondary>
45750 </indexterm>
45751 <indexterm role="concept">
45752 <primary>RCPT</primary>
45753 <secondary>ACL for</secondary>
45754 </indexterm>
45755 <indexterm role="concept">
45756 <primary>STARTTLS</primary>
45757 <secondary>ACL for</secondary>
45758 </indexterm>
45759 <indexterm role="concept">
45760 <primary>VRFY</primary>
45761 <secondary>ACL for</secondary>
45762 </indexterm>
45763 <indexterm role="concept">
45764 <primary>SMTP connection</primary>
45765 <secondary>ACL for</secondary>
45766 </indexterm>
45767 <indexterm role="concept">
45768 <primary>non-smtp message</primary>
45769 <secondary>ACLs for</secondary>
45770 </indexterm>
45771 <indexterm role="concept">
45772 <primary>MIME parts</primary>
45773 <secondary>ACL for</secondary>
45774 </indexterm>
45775 </para>
45776 <informaltable frame="none">
45777 <tgroup cols="2" colsep="0" rowsep="0">
45778 <colspec colwidth="140pt" align="left"/>
45779 <colspec colwidth="254pt" align="left"/>
45780 <tbody>
45781 <row>
45782 <entry>&nbsp;<option>acl_not_smtp</option></entry>
45783 <entry>ACL for non-SMTP messages</entry>
45784 </row>
45785 <phrase revisionflag="changed"><row>
45786 <entry>&nbsp;<option>acl_not_smtp_mime</option></entry>
45787 <entry>ACL for non-SMTP MIME parts</entry>
45788 </row>
45789 <row>
45790 <entry>&nbsp;<option>acl_not_smtp_start</option></entry>
45791 <entry>ACL at start of non-SMTP message</entry>
45792 </row>
45793 </phrase><row>
45794 <entry>&nbsp;<option>acl_smtp_auth</option></entry>
45795 <entry>ACL for AUTH</entry>
45796 </row>
45797 <row>
45798 <entry>&nbsp;<option>acl_smtp_connect</option></entry>
45799 <entry>ACL for start of SMTP connection</entry>
45800 </row>
45801 <row>
45802 <entry>&nbsp;<option>acl_smtp_data</option></entry>
45803 <entry>ACL after DATA is complete</entry>
45804 </row>
45805 <row>
45806 <entry>&nbsp;<option>acl_smtp_etrn</option></entry>
45807 <entry>ACL for ETRN</entry>
45808 </row>
45809 <row>
45810 <entry>&nbsp;<option>acl_smtp_expn</option></entry>
45811 <entry>ACL for EXPN</entry>
45812 </row>
45813 <row>
45814 <entry>&nbsp;<option>acl_smtp_helo</option></entry>
45815 <entry>ACL for HELO or EHLO</entry>
45816 </row>
45817 <row>
45818 <entry>&nbsp;<option>acl_smtp_mail</option></entry>
45819 <entry>ACL for MAIL</entry>
45820 </row>
45821 <row>
45822 <entry>&nbsp;<option>acl_smtp_mailauth</option></entry>
45823 <entry>ACL for the AUTH parameter of MAIL</entry>
45824 </row>
45825 <row>
45826 <entry>&nbsp;<option>acl_smtp_mime</option></entry>
45827 <entry>ACL for content-scanning MIME parts</entry>
45828 </row>
45829 <row>
45830 <entry>&nbsp;<option>acl_smtp_predata</option></entry>
45831 <entry>ACL at start of DATA command</entry>
45832 </row>
45833 <row>
45834 <entry>&nbsp;<option>acl_smtp_quit</option></entry>
45835 <entry>ACL for QUIT</entry>
45836 </row>
45837 <row>
45838 <entry>&nbsp;<option>acl_smtp_rcpt</option></entry>
45839 <entry>ACL for RCPT</entry>
45840 </row>
45841 <row>
45842 <entry>&nbsp;<option>acl_smtp_starttls</option></entry>
45843 <entry>ACL for STARTTLS</entry>
45844 </row>
45845 <row>
45846 <entry>&nbsp;<option>acl_smtp_vrfy</option></entry>
45847 <entry>ACL for VRFY</entry>
45848 </row>
45849 </tbody>
45850 </tgroup>
45851 </informaltable>
45852 <para>
45853 For example, if you set
45854 </para>
45855 <literallayout class="monospaced">
45856 acl_smtp_rcpt = small_acl
45857 </literallayout>
45858 <para>
45859 the little ACL defined above is used whenever Exim receives a RCPT command
45860 in an SMTP dialogue. The majority of policy tests on incoming messages can be
45861 done when RCPT commands arrive. A rejection of RCPT should cause the
45862 sending MTA to give up on the recipient address contained in the RCPT
45863 command, whereas rejection at other times may cause the client MTA to keep on
45864 trying to deliver the message. It is therefore recommended that you do as much
45865 testing as possible at RCPT time.
45866 </para>
45867 </section>
45868 <section revisionflag="changed">
45869 <title>The non-SMTP ACLs</title>
45870 <para revisionflag="changed">
45871 <indexterm role="concept">
45872 <primary>non-smtp message</primary>
45873 <secondary>ACLs for</secondary>
45874 </indexterm>
45875 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
45876 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
45877 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
45878 the state of the SMTP connection such as encryption and authentication) are not
45879 relevant and are forbidden in these ACLs. However, the sender and recipients
45880 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
45881 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
45882 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
45883 in any of these ACLs.
45884 </para>
45885 <para revisionflag="changed">
45886 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
45887 non-SMTP message, before any of the message has been read. (This is the
45888 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) The result of this
45889 ACL is ignored; it cannot be used to reject a message. If you really need to,
45890 you could set a value in an ACL variable here and reject based on that in the
45891 <option>acl_not_smtp</option> ACL. However, this ACL can be used to set controls, and in
45892 particular, it can be used to set
45893 </para>
45894 <literallayout class="monospaced" revisionflag="changed">
45895 control = suppress_local_fixups
45896 </literallayout>
45897 <para revisionflag="changed">
45898 This cannot be used in the other non-SMTP ACLs because by the time they are
45899 run, it is too late.
45900 </para>
45901 <para revisionflag="changed">
45902 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
45903 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
45904 </para>
45905 <para revisionflag="changed">
45906 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
45907 kind of rejection is treated as permanent, because there is no way of sending a
45908 temporary error for these kinds of message.
45909 </para>
45910 </section>
45911 <section revisionflag="changed">
45912 <title>The SMTP connect ACL</title>
45913 <para revisionflag="changed">
45914 <indexterm role="concept">
45915 <primary>SMTP connection</primary>
45916 <secondary>ACL for</secondary>
45917 </indexterm>
45918 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
45919 session, after the test specified by <option>host_reject_connection</option> (which is now
45920 an anomaly) and any TCP Wrappers testing (if configured).
45921 </para>
45922 </section>
45923 <section>
45924 <title>The DATA ACLs</title>
45925 <para>
45926 <indexterm role="concept">
45927 <primary>DATA</primary>
45928 <secondary>ACLs for</secondary>
45929 </indexterm>
45930 Two ACLs are associated with the DATA command, because it is two-stage
45931 command, with two responses being sent to the client.
45932 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
45933 is obeyed. This gives you control after all the RCPT commands, but before
45934 the message itself is received. It offers the opportunity to give a negative
45935 response to the DATA command before the data is transmitted. Header lines
45936 added by MAIL or RCPT ACLs are not visible at this time, but any that
45937 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
45938 </para>
45939 <para>
45940 You cannot test the contents of the message, for example, to verify addresses
45941 in the headers, at RCPT time or when the DATA command is received. Such
45942 tests have to appear in the ACL that is run after the message itself has been
45943 received, before the final response to the DATA command is sent. This is
45944 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
45945 associated with the DATA command.
45946 </para>
45947 <para>
45948 For both of these ACLs, it is not possible to reject individual recipients. An
45949 error response rejects the entire message. Unfortunately, it is known that some
45950 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
45951 before or after the data) correctly &ndash; they keep the message on their queues
45952 and try again later, but that is their problem, though it does waste some of
45953 your resources.
45954 </para>
45955 </section>
45956 <section>
45957 <title>The SMTP MIME ACL</title>
45958 <para>
45959 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
45960 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
45961 </para>
45962 </section>
45963 <section id="SECTQUITACL">
45964 <title>The QUIT ACL</title>
45965 <para>
45966 <indexterm role="concept">
45967 <primary>QUIT</primary>
45968 <secondary>ACL for</secondary>
45969 </indexterm>
45970 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
45971 does not affect the response code to QUIT, which is always 221. Thus, the ACL
45972 does not in fact control any access. For this reason, the only verbs that are
45973 permitted are <option>accept</option> and <option>warn</option>.
45974 </para>
45975 <para>
45976 This ACL can be used for tasks such as custom logging at the end of an SMTP
45977 session. For example, you can use ACL variables in other ACLs to count
45978 messages, recipients, etc., and log the totals at QUIT time using one or
45979 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
45980 </para>
45981 <para>
45982 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
45983 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
45984 </para>
45985 <para>
45986 You do not need to have a final <option>accept</option>, but if you do, you can use a
45987 <option>message</option> modifier to specify custom text that is sent as part of the 221
45988 response to QUIT.
45989 </para>
45990 <para>
45991 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
45992 failure (for example, failure to open a log file, or when Exim is bombing out
45993 because it has detected an unrecoverable error), all SMTP commands from the
45994 client are given temporary error responses until QUIT is received or the
45995 connection is closed. In these special cases, the QUIT ACL does not run.
45996 </para>
45997 </section>
45998 <section>
45999 <title>Finding an ACL to use</title>
46000 <para>
46001 <indexterm role="concept">
46002 <primary>access control lists (ACLs)</primary>
46003 <secondary>finding which to use</secondary>
46004 </indexterm>
46005 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
46006 you can use different ACLs in different circumstances. For example,
46007 </para>
46008 <literallayout class="monospaced">
46009 acl_smtp_rcpt = ${if ={25}{$interface_port} \
46010                      {acl_check_rcpt} {acl_check_rcpt_submit} }
46011 </literallayout>
46012 <para>
46013 In the default configuration file there are some example settings for
46014 providing an RFC 4409 message submission service on port 587 and a
46015 non-standard <quote>smtps</quote> service on port 465. You can use a string
46016 expansion like this to choose an ACL for MUAs on these ports which is
46017 more appropriate for this purpose than the default ACL on port 25.
46018 </para>
46019 <para>
46020 The expanded string does not have to be the name of an ACL in the
46021 configuration file; there are other possibilities. Having expanded the
46022 string, Exim searches for an ACL as follows:
46023 </para>
46024 <itemizedlist>
46025 <listitem>
46026 <para>
46027 If the string begins with a slash, Exim uses it as a file name, and reads its
46028 contents as an ACL. The lines are processed in the same way as lines in the
46029 Exim configuration file. In particular, continuation lines are supported, blank
46030 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
46031 If the file does not exist or cannot be read, an error occurs (typically
46032 causing a temporary failure of whatever caused the ACL to be run). For example:
46033 </para>
46034 <literallayout class="monospaced">
46035 acl_smtp_data = /etc/acls/\
46036   ${lookup{$sender_host_address}lsearch\
46037   {/etc/acllist}{$value}{default}}
46038 </literallayout>
46039 <para>
46040 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
46041 back to a default if the lookup fails. If an ACL is successfully read from a
46042 file, it is retained in memory for the duration of the Exim process, so that it
46043 can be re-used without having to re-read the file.
46044 </para>
46045 </listitem>
46046 <listitem>
46047 <para>
46048 If the string does not start with a slash, and does not contain any spaces,
46049 Exim searches the ACL section of the configuration for an ACL whose name
46050 matches the string.
46051 </para>
46052 </listitem>
46053 <listitem>
46054 <para>
46055 If no named ACL is found, or if the string contains spaces, Exim parses
46056 the string as an inline ACL. This can save typing in cases where you just
46057 want to have something like
46058 </para>
46059 <literallayout class="monospaced">
46060 acl_smtp_vrfy = accept
46061 </literallayout>
46062 <para>
46063 in order to allow free use of the VRFY command. Such a string may contain
46064 newlines; it is processed in the same way as an ACL that is read from a file.
46065 </para>
46066 </listitem>
46067 </itemizedlist>
46068 </section>
46069 <section>
46070 <title>ACL return codes</title>
46071 <para>
46072 <indexterm role="concept">
46073 <primary>access control lists (ACLs)</primary>
46074 <secondary>return codes</secondary>
46075 </indexterm>
46076 Except for the QUIT ACL, which does not affect the SMTP return code (see
46077 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
46078 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
46079 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
46080 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
46081 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
46082 This also causes a 4<emphasis>xx</emphasis> return code.
46083 </para>
46084 <para>
46085 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
46086 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
46087 submitters of non-SMTP messages.
46088 </para>
46089 <para>
46090 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
46091 has the effect of <quote>accept</quote>, but causes either the entire message or an
46092 individual recipient address to be discarded. In other words, it is a
46093 blackholing facility. Use it with care.
46094 </para>
46095 <para>
46096 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
46097 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
46098 RCPT ACL is to discard just the one recipient address. If there are no
46099 recipients left when the message&#x2019;s data is received, the DATA ACL is not
46100 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
46101 remaining recipients. The <quote>discard</quote> return is not permitted for the
46102 <option>acl_smtp_predata</option> ACL.
46103 </para>
46104 <para>
46105 <indexterm role="concept">
46106 <primary><function>local_scan()</function> function</primary>
46107 <secondary>when all recipients discarded</secondary>
46108 </indexterm>
46109 The <function>local_scan()</function> function is always run, even if there are no remaining
46110 recipients; it may create new recipients.
46111 </para>
46112 </section>
46113 <section>
46114 <title>Unset ACL options</title>
46115 <para>
46116 <indexterm role="concept">
46117 <primary>access control lists (ACLs)</primary>
46118 <secondary>unset options</secondary>
46119 </indexterm>
46120 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
46121 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
46122 not defined at all. For any defined ACL, the default action when control
46123 reaches the end of the ACL statements is <quote>deny</quote>.
46124 </para>
46125 <para revisionflag="changed">
46126 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
46127 these two are ACLs that are used only for their side effects. They cannot be
46128 used to accept or reject anything.
46129 </para>
46130 <para>
46131 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
46132 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
46133 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
46134 when the ACL is not defined is <quote>accept</quote>.
46135 </para>
46136 <para>
46137 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
46138 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
46139 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
46140 messages over an SMTP connection. For an example, see the ACL in the default
46141 configuration file.
46142 </para>
46143 </section>
46144 <section>
46145 <title>Data for message ACLs</title>
46146 <para>
46147 <indexterm role="concept">
46148 <primary>access control lists (ACLs)</primary>
46149 <secondary>data for message ACL</secondary>
46150 </indexterm>
46151 <indexterm role="concept">
46152 <primary><varname>$domain</varname></primary>
46153 </indexterm>
46154 <indexterm role="concept">
46155 <primary><varname>$local_part</varname></primary>
46156 </indexterm>
46157 <indexterm role="concept">
46158 <primary><varname>$sender_address</varname></primary>
46159 </indexterm>
46160 <indexterm role="concept">
46161 <primary><varname>$sender_host_address</varname></primary>
46162 </indexterm>
46163 <indexterm role="concept">
46164 <primary><varname>$smtp_command</varname></primary>
46165 </indexterm>
46166 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
46167 that contain information about the host and the message&#x2019;s sender (for example,
46168 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
46169 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
46170 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
46171 is available in <varname>$smtp_command</varname>.
46172 </para>
46173 <para>
46174 When an ACL for the AUTH parameter of MAIL is running, the variables that
46175 contain information about the host are set, but <varname>$sender_address</varname> is not yet
46176 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
46177 how it is used.
46178 </para>
46179 <para>
46180 <indexterm role="concept">
46181 <primary><varname>$message_size</varname></primary>
46182 </indexterm>
46183 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
46184 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
46185 that parameter is not given. The value is updated to the true message size by
46186 the time the final DATA ACL is run (after the message data has been
46187 received).
46188 </para>
46189 <para>
46190 <indexterm role="concept">
46191 <primary><varname>$rcpt_count</varname></primary>
46192 </indexterm>
46193 <indexterm role="concept">
46194 <primary><varname>$recipients_count</varname></primary>
46195 </indexterm>
46196 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
46197 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
46198 accepted, so while an ACL for RCPT is being processed, it contains the number
46199 of previously accepted recipients. At DATA time (for both the DATA ACLs),
46200 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
46201 <varname>$recipients_count</varname> contains the total number of accepted recipients.
46202 </para>
46203 </section>
46204 <section id="SECTdatfornon">
46205 <title>Data for non-message ACLs</title>
46206 <para>
46207 <indexterm role="concept">
46208 <primary>access control lists (ACLs)</primary>
46209 <secondary>data for non-message ACL</secondary>
46210 </indexterm>
46211 <indexterm role="concept">
46212 <primary><varname>$smtp_command_argument</varname></primary>
46213 </indexterm>
46214 <indexterm role="concept">
46215 <primary><varname>$smtp_command</varname></primary>
46216 </indexterm>
46217 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
46218 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
46219 and the entire SMTP command is available in <varname>$smtp_command</varname>.
46220 These variables can be tested using a <option>condition</option> condition. For example,
46221 here is an ACL for use with AUTH, which insists that either the session is
46222 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
46223 does not permit authentication methods that use cleartext passwords on
46224 unencrypted connections.
46225 </para>
46226 <literallayout class="monospaced">
46227 acl_check_auth:
46228   accept encrypted = *
46229   accept condition = ${if eq{${uc:$smtp_command_argument}}\
46230                      {CRAM-MD5}}
46231   deny   message   = TLS encryption or CRAM-MD5 required
46232 </literallayout>
46233 <para>
46234 (Another way of applying this restriction is to arrange for the authenticators
46235 that use cleartext passwords not to be advertised when the connection is not
46236 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
46237 option to do this.)
46238 </para>
46239 </section>
46240 <section>
46241 <title>Format of an ACL</title>
46242 <para>
46243 <indexterm role="concept">
46244 <primary>access control lists (ACLs)</primary>
46245 <secondary>format of</secondary>
46246 </indexterm>
46247 <indexterm role="concept">
46248 <primary>access control lists (ACLs)</primary>
46249 <secondary>verbs; definition of</secondary>
46250 </indexterm>
46251 An individual ACL consists of a number of statements. Each statement starts
46252 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
46253 Modifiers can change the way the verb operates, define error and log messages,
46254 set variables, insert delays, and vary the processing of accepted messages.
46255 </para>
46256 <para>
46257 If all the conditions are met, the verb is obeyed. The same condition may be
46258 used (with different arguments) more than once in the same statement. This
46259 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
46260 example:
46261 </para>
46262 <literallayout class="monospaced">
46263 deny  dnslists = list1.example
46264 dnslists = list2.example
46265 </literallayout>
46266 <para>
46267 If there are no conditions, the verb is always obeyed. Exim stops evaluating
46268 the conditions and modifiers when it reaches a condition that fails. What
46269 happens then depends on the verb (and in one case, on a special modifier). Not
46270 all the conditions make sense at every testing point. For example, you cannot
46271 test a sender address in the ACL that is run for a VRFY command.
46272 </para>
46273 </section>
46274 <section>
46275 <title>ACL verbs</title>
46276 <para>
46277 The ACL verbs are as follows:
46278 </para>
46279 <itemizedlist>
46280 <listitem>
46281 <para>
46282 <indexterm role="concept">
46283 <primary><option>accept</option></primary>
46284 <secondary>ACL verb</secondary>
46285 </indexterm>
46286 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
46287 of the conditions are not met, what happens depends on whether <option>endpass</option>
46288 appears among the conditions (for syntax see below). If the failing condition
46289 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
46290 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
46291 check a RCPT command:
46292 </para>
46293 <literallayout class="monospaced">
46294 accept domains = +local_domains
46295 endpass
46296 verify = recipient
46297 </literallayout>
46298 <para>
46299 If the recipient domain does not match the <option>domains</option> condition, control
46300 passes to the next statement. If it does match, the recipient is verified, and
46301 the command is accepted if verification succeeds. However, if verification
46302 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
46303 <option>endpass</option>.
46304 </para>
46305 </listitem>
46306 <listitem>
46307 <para>
46308 <indexterm role="concept">
46309 <primary><option>defer</option></primary>
46310 <secondary>ACL verb</secondary>
46311 </indexterm>
46312 <option>defer</option>: If all the conditions are met, the ACL returns <quote>defer</quote> which, in
46313 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
46314 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
46315 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
46316 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
46317 be used in any ACL, and even for a recipient it might be a simpler approach.
46318 </para>
46319 </listitem>
46320 <listitem>
46321 <para>
46322 <indexterm role="concept">
46323 <primary><option>deny</option></primary>
46324 <secondary>ACL verb</secondary>
46325 </indexterm>
46326 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
46327 the conditions are not met, control is passed to the next ACL statement. For
46328 example,
46329 </para>
46330 <literallayout class="monospaced">
46331 deny dnslists = blackholes.mail-abuse.org
46332 </literallayout>
46333 <para>
46334 rejects commands from hosts that are on a DNS black list.
46335 </para>
46336 </listitem>
46337 <listitem>
46338 <para>
46339 <indexterm role="concept">
46340 <primary><option>discard</option></primary>
46341 <secondary>ACL verb</secondary>
46342 </indexterm>
46343 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
46344 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
46345 that are concerned with receiving messages, and it causes recipients to be
46346 discarded. If the <option>log_message</option> modifier is set when <option>discard</option> operates,
46347 its contents are added to the line that is automatically written to the log.
46348 </para>
46349 <para>
46350 If <option>discard</option> is used in an ACL for RCPT, just the one recipient is
46351 discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
46352 message&#x2019;s recipients are discarded. Recipients that are discarded before
46353 DATA do not appear in the log line when the <option>log_recipients</option> log selector
46354 is set.
46355 </para>
46356 </listitem>
46357 <listitem>
46358 <para>
46359 <indexterm role="concept">
46360 <primary><option>drop</option></primary>
46361 <secondary>ACL verb</secondary>
46362 </indexterm>
46363 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
46364 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
46365 </para>
46366 <literallayout class="monospaced">
46367 drop   message   = I don't take more than 20 RCPTs
46368        condition = ${if &gt; {$rcpt_count}{20}}
46369 </literallayout>
46370 <para>
46371 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
46372 The connection is always dropped after sending a 550 response.
46373 </para>
46374 </listitem>
46375 <listitem>
46376 <para>
46377 <indexterm role="concept">
46378 <primary><option>require</option></primary>
46379 <secondary>ACL verb</secondary>
46380 </indexterm>
46381 <option>require</option>: If all the conditions are met, control is passed to the next ACL
46382 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
46383 example, when checking a RCPT command,
46384 </para>
46385 <literallayout class="monospaced">
46386 require verify = sender
46387 </literallayout>
46388 <para>
46389 passes control to subsequent statements only if the message&#x2019;s sender can be
46390 verified. Otherwise, it rejects the command.
46391 </para>
46392 </listitem>
46393 <listitem>
46394 <para revisionflag="changed">
46395 <indexterm role="concept">
46396 <primary><option>warn</option></primary>
46397 <secondary>ACL verb</secondary>
46398 </indexterm>
46399 <option>warn</option>: If all the conditions are true, a line specified by the
46400 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
46401 to the next ACL statement. If any condition is false, the log line is not
46402 written. If an identical log line is requested several times in the same
46403 message, only one copy is actually written to the log. If you want to force
46404 duplicates to be written, use the <option>logwrite</option> modifier instead.
46405 </para>
46406 <para revisionflag="changed">
46407 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
46408 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
46409 <option>logwrite</option>, and <option>add_header</option>) that appear before any failing conditions.
46410 There is more about adding header lines in section <xref linkend="SECTaddheadacl"/>.
46411 </para>
46412 <para revisionflag="changed">
46413 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
46414 some sort of defer), the log line specified by <option>log_message</option> is not written.
46415 No further conditions or modifiers in the <option>warn</option> statement are processed. The
46416 incident is logged, and the ACL continues to be processed, from the next
46417 statement onwards.
46418 </para>
46419 <para>
46420 <indexterm role="concept">
46421 <primary><varname>$acl_verify_message</varname></primary>
46422 </indexterm>
46423 When one of the <option>warn</option> conditions is an address verification that fails, the
46424 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
46425 want this logged, you must set it up explicitly. For example:
46426 </para>
46427 <literallayout class="monospaced">
46428 warn   !verify = sender
46429        log_message = sender verify failed: $acl_verify_message
46430 </literallayout>
46431 </listitem>
46432 </itemizedlist>
46433 <para>
46434 At the end of each ACL there is an implicit unconditional <option>deny</option>.
46435 </para>
46436 <para>
46437 As you can see from the examples above, the conditions and modifiers are
46438 written one to a line, with the first one on the same line as the verb, and
46439 subsequent ones on following lines. If you have a very long condition, you can
46440 continue it onto several physical lines by the usual backslash continuation
46441 mechanism. It is conventional to align the conditions vertically.
46442 </para>
46443 </section>
46444 <section id="SECTaclvariables">
46445 <title>ACL variables</title>
46446 <para>
46447 <indexterm role="concept">
46448 <primary>access control lists (ACLs)</primary>
46449 <secondary>variables</secondary>
46450 </indexterm>
46451 There are some special variables that can be set during ACL processing. They
46452 can be used to pass information between different ACLs, different invocations
46453 of the same ACL in the same SMTP connection, and between ACLs and the routers,
46454 transports, and filters that are used to deliver a message. There are two sets
46455 of these variables:
46456 </para>
46457 <itemizedlist>
46458 <listitem>
46459 <para>
46460 The values of <varname>$acl_c0</varname> to <varname>$acl_c19</varname> persist throughout an SMTP
46461 connection. They are never reset. Thus, a value that is set while receiving one
46462 message is still available when receiving the next message on the same SMTP
46463 connection.
46464 </para>
46465 </listitem>
46466 <listitem>
46467 <para>
46468 The values of <varname>$acl_m0</varname> to <varname>$acl_m19</varname> persist only while a message is
46469 being received. They are reset afterwards. They are also reset by MAIL, RSET,
46470 EHLO, HELO, and after starting up a TLS session.
46471 </para>
46472 </listitem>
46473 </itemizedlist>
46474 <para>
46475 When a message is accepted, the current values of all the ACL variables are
46476 preserved with the message and are subsequently made available at delivery
46477 time. The ACL variables are set by a modifier called <option>set</option>. For example:
46478 </para>
46479 <literallayout class="monospaced">
46480 accept hosts = whatever
46481        set acl_m4 = some value
46482 </literallayout>
46483 <para>
46484 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
46485 be set. If you want to set a variable without taking any action, you can use a
46486 <option>warn</option> verb without any other modifiers or conditions.
46487 </para>
46488 </section>
46489 <section>
46490 <title>Condition and modifier processing</title>
46491 <para>
46492 <indexterm role="concept">
46493 <primary>access control lists (ACLs)</primary>
46494 <secondary>conditions; processing</secondary>
46495 </indexterm>
46496 <indexterm role="concept">
46497 <primary>access control lists (ACLs)</primary>
46498 <secondary>modifiers; processing</secondary>
46499 </indexterm>
46500 An exclamation mark preceding a condition negates its result. For example:
46501 </para>
46502 <literallayout class="monospaced">
46503 deny   domains = *.dom.example
46504       !verify  = recipient
46505 </literallayout>
46506 <para>
46507 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
46508 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
46509 negation can be used on the right-hand side of a condition. For example, these
46510 two statements are equivalent:
46511 </para>
46512 <literallayout class="monospaced">
46513 deny  hosts = !192.168.3.4
46514 deny !hosts =  192.168.3.4
46515 </literallayout>
46516 <para>
46517 However, for many conditions (<option>verify</option> being a good example), only left-hand
46518 side negation of the whole condition is possible.
46519 </para>
46520 <para>
46521 The arguments of conditions and modifiers are expanded. A forced failure
46522 of an expansion causes a condition to be ignored, that is, it behaves as if the
46523 condition is true. Consider these two statements:
46524 </para>
46525 <literallayout class="monospaced">
46526 accept  senders = ${lookup{$host_name}lsearch\
46527                   {/some/file}{$value}fail}
46528 accept  senders = ${lookup{$host_name}lsearch\
46529                   {/some/file}{$value}{}}
46530 </literallayout>
46531 <para>
46532 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
46533 the returned list is searched, but if the lookup fails the behaviour is
46534 different in the two cases. The <option>fail</option> in the first statement causes the
46535 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
46536 therefore succeeds. The second statement, however, generates an empty list when
46537 the lookup fails. No sender can match an empty list, so the condition fails,
46538 and therefore the <option>accept</option> also fails.
46539 </para>
46540 <para>
46541 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
46542 specify actions that are taken as the conditions for a statement are checked;
46543 others specify text for messages that are used when access is denied or a
46544 warning is generated. The <option>control</option> modifier affects the way an incoming
46545 message is handled.
46546 </para>
46547 <para>
46548 The positioning of the modifiers in an ACL statement important, because the
46549 processing of a verb ceases as soon as its outcome is known. Only those
46550 modifiers that have already been encountered will take effect. For example,
46551 consider this use of the <option>message</option> modifier:
46552 </para>
46553 <literallayout class="monospaced">
46554 require message = Can't verify sender
46555         verify  = sender
46556         message = Can't verify recipient
46557         verify  = recipient
46558         message = This message cannot be used
46559 </literallayout>
46560 <para>
46561 If sender verification fails, Exim knows that the result of the statement is
46562 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
46563 so its text is used as the error message. If sender verification succeeds, but
46564 recipient verification fails, the second message is used. If recipient
46565 verification succeeds, the third message becomes <quote>current</quote>, but is never used
46566 because there are no more conditions to cause failure.
46567 </para>
46568 <para>
46569 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
46570 modifier that is used, because all the conditions must be true for rejection to
46571 happen. Specifying more than one <option>message</option> modifier does not make sense, and
46572 the message can even be specified after all the conditions. For example:
46573 </para>
46574 <literallayout class="monospaced">
46575 deny   hosts = ...
46576       !senders = *@my.domain.example
46577        message = Invalid sender from client host
46578 </literallayout>
46579 <para>
46580 The <quote>deny</quote> result does not happen until the end of the statement is reached,
46581 by which time Exim has set up the message.
46582 </para>
46583 </section>
46584 <section id="SECTACLmodi">
46585 <title>ACL modifiers</title>
46586 <para>
46587 <indexterm role="concept">
46588 <primary>access control lists (ACLs)</primary>
46589 <secondary>modifiers; list of</secondary>
46590 </indexterm>
46591 The ACL modifiers are as follows:
46592 </para>
46593 <variablelist>
46594 <varlistentry>
46595 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
46596 <listitem>
46597 <para>
46598 This modifier specifies one or more header lines that are to be added to an
46599 incoming message, assuming, of course, that the message is ultimately
46600 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
46601 </para>
46602 </listitem></varlistentry>
46603 <varlistentry>
46604 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
46605 <listitem>
46606 <para>
46607 <indexterm role="concept">
46608 <primary><option>control</option></primary>
46609 <secondary>ACL modifier</secondary>
46610 </indexterm>
46611 This modifier affects the subsequent processing of the SMTP connection or of an
46612 incoming message that is accepted. The effect of the first type of control
46613 lasts for the duration of the connection, whereas the effect of the second type
46614 lasts only until the current message has been received. The message-specific
46615 controls always apply to the whole message, not to individual recipients,
46616 even if the <option>control</option> modifier appears in a RCPT ACL.
46617 </para>
46618 <para>
46619 As there are now quite a few controls that can be applied, they are described
46620 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
46621 in several different ways. For example:
46622 </para>
46623 <itemizedlist>
46624 <listitem>
46625 <para>
46626 It can be at the end of an <option>accept</option> statement:
46627 </para>
46628 <literallayout class="monospaced">
46629     accept  ...some conditions
46630             control = queue_only
46631 </literallayout>
46632 <para>
46633 In this case, the control is applied when this statement yields <quote>accept</quote>, in
46634 other words, when the conditions are all true.
46635 </para>
46636 </listitem>
46637 <listitem>
46638 <para>
46639 It can be in the middle of an <option>accept</option> statement:
46640 </para>
46641 <literallayout class="monospaced">
46642     accept  ...some conditions...
46643             control = queue_only
46644             ...some more conditions...
46645 </literallayout>
46646 <para>
46647 If the first set of conditions are true, the control is applied, even if the
46648 statement does not accept because one of the second set of conditions is false.
46649 In this case, some subsequent statement must yield <quote>accept</quote> for the control
46650 to be relevant.
46651 </para>
46652 </listitem>
46653 <listitem>
46654 <para>
46655 It can be used with <option>warn</option> to apply the control, leaving the
46656 decision about accepting or denying to a subsequent verb. For
46657 example:
46658 </para>
46659 <literallayout class="monospaced">
46660     warn    ...some conditions...
46661             control = freeze
46662     accept  ...
46663 </literallayout>
46664 <para>
46665 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
46666 <option>logwrite</option>, so it does not add anything to the message and does not write a
46667 log entry.
46668 </para>
46669 </listitem>
46670 <listitem>
46671 <para>
46672 If you want to apply a control unconditionally, you can use it with a
46673 <option>require</option> verb. For example:
46674 </para>
46675 <literallayout class="monospaced">
46676     require  control = no_multiline_response
46677 </literallayout>
46678 </listitem>
46679 </itemizedlist>
46680 </listitem></varlistentry>
46681 <varlistentry>
46682 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
46683 <listitem>
46684 <para>
46685 <indexterm role="concept">
46686 <primary><option>delay</option></primary>
46687 <secondary>ACL modifier</secondary>
46688 </indexterm>
46689 <indexterm role="concept">
46690 <primary><option>-bh</option> option</primary>
46691 </indexterm>
46692 This modifier causes Exim to wait for the time interval before proceeding. The
46693 time is given in the usual Exim notation. This modifier may appear in any ACL.
46694 The delay happens as soon as the modifier is processed. However, when testing
46695 Exim using the <option>-bh</option> option, the delay is not actually imposed (an
46696 appropriate message is output instead).
46697 </para>
46698 <para>
46699 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
46700 example:
46701 </para>
46702 <literallayout class="monospaced">
46703 deny    ...some conditions...
46704         delay = 30s
46705 </literallayout>
46706 <para>
46707 The delay happens if all the conditions are true, before the statement returns
46708 <quote>deny</quote>. Compare this with:
46709 </para>
46710 <literallayout class="monospaced">
46711 deny    delay = 30s
46712         ...some conditions...
46713 </literallayout>
46714 <para>
46715 which waits for 30s before processing the conditions. The <option>delay</option> modifier
46716 can also be used with <option>warn</option> and together with <option>control</option>:
46717 </para>
46718 <literallayout class="monospaced">
46719 warn    ...some conditions...
46720         delay = 2m
46721         control = freeze
46722 accept  ...
46723 </literallayout>
46724 </listitem></varlistentry>
46725 <varlistentry>
46726 <term><emphasis role="bold">endpass</emphasis></term>
46727 <listitem>
46728 <para>
46729 <indexterm role="concept">
46730 <primary><option>endpass</option></primary>
46731 <secondary>ACL modifier</secondary>
46732 </indexterm>
46733 This modifier, which has no argument, is recognized only in <option>accept</option>
46734 statements. It marks the boundary between the conditions whose failure causes
46735 control to pass to the next statement, and the conditions whose failure causes
46736 the ACL to return <quote>deny</quote>. See the description of <option>accept</option> above.
46737 </para>
46738 </listitem></varlistentry>
46739 <varlistentry>
46740 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
46741 <listitem>
46742 <para>
46743 <indexterm role="concept">
46744 <primary><option>log_message</option></primary>
46745 <secondary>ACL modifier</secondary>
46746 </indexterm>
46747 This modifier sets up a message that is used as part of the log message if the
46748 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
46749 </para>
46750 <literallayout class="monospaced">
46751 require log_message = wrong cipher suite $tls_cipher
46752         encrypted   = DES-CBC3-SHA
46753 </literallayout>
46754 <para>
46755 <option>log_message</option> adds to any underlying error message that may exist because of
46756 the condition failure. For example, while verifying a recipient address, a
46757 <emphasis>:fail:</emphasis> redirection might have already set up a message. Although the
46758 message is usually defined before the conditions to which it applies, the
46759 expansion does not happen until Exim decides that access is to be denied. This
46760 means that any variables that are set by the condition are available for
46761 inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt; variables are
46762 set after a DNS black list lookup succeeds. If the expansion of <option>log_message</option>
46763 fails, or if the result is an empty string, the modifier is ignored.
46764 </para>
46765 <para>
46766 <indexterm role="concept">
46767 <primary><varname>$acl_verify_message</varname></primary>
46768 </indexterm>
46769 If you want to use a <option>warn</option> statement to log the result of an address
46770 verification, you can use <varname>$acl_verify_message</varname> to include the verification
46771 error message.
46772 </para>
46773 <para>
46774 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
46775 the start of the logged message. If the same warning log message is requested
46776 more than once while receiving  a single email message, only one copy is
46777 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
46778 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
46779 is logged for a succesful <option>warn</option> statement.
46780 </para>
46781 <para>
46782 If <option>log_message</option> is not present and there is no underlying error message (for
46783 example, from the failure of address verification), but <option>message</option> is present,
46784 the <option>message</option> text is used for logging rejections. However, if any text for
46785 logging contains newlines, only the first line is logged. In the absence of
46786 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
46787 logging rejections.
46788 </para>
46789 </listitem></varlistentry>
46790 <varlistentry>
46791 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
46792 <listitem>
46793 <para>
46794 <indexterm role="concept">
46795 <primary><option>logwrite</option></primary>
46796 <secondary>ACL modifier</secondary>
46797 </indexterm>
46798 <indexterm role="concept">
46799 <primary>logging in ACL</primary>
46800 <secondary>immediate</secondary>
46801 </indexterm>
46802 This modifier writes a message to a log file as soon as it is encountered when
46803 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
46804 <option>warn</option>, is used only if the ACL statement denies access.) The <option>logwrite</option>
46805 modifier can be used to log special incidents in ACLs. For example:
46806 </para>
46807 <literallayout>
46808 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
46809 <literal>       control  = freeze</literal>
46810 <literal>       logwrite = froze message because ...</literal>
46811 </literallayout>
46812 <para>
46813 By default, the message is written to the main log. However, it may begin
46814 with a colon, followed by a comma-separated list of log names, and then
46815 another colon, to specify exactly which logs are to be written. For
46816 example:
46817 </para>
46818 <literallayout class="monospaced">
46819 logwrite = :main,reject: text for main and reject logs
46820 logwrite = :panic: text for panic log only
46821 </literallayout>
46822 </listitem></varlistentry>
46823 <varlistentry>
46824 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
46825 <listitem>
46826 <para>
46827 <indexterm role="concept">
46828 <primary><option>message</option></primary>
46829 <secondary>ACL modifier</secondary>
46830 </indexterm>
46831 This modifier sets up a text string that is expanded and used as an error
46832 message if the current statement causes the ACL to deny access. The expansion
46833 happens at the time Exim decides that access is to be denied, not at the time
46834 it processes <option>message</option>. If the expansion fails, or generates an empty string,
46835 the modifier is ignored. For ACLs that are triggered by SMTP commands, the
46836 message is returned as part of the SMTP error response.
46837 </para>
46838 <para revisionflag="changed">
46839 <indexterm role="concept">
46840 <primary>SMTP</primary>
46841 <secondary>error codes</secondary>
46842 </indexterm>
46843 By default, Exim uses a 550 SMTP code when it denies access. However, if the
46844 message starts with three digits followed by a space, optionally followed by an
46845 extended code of the form <emphasis>n.n.n</emphasis>, also followed by a space, and the very
46846 first digit is the same as the default error code, the code from the message is
46847 used instead. If the very first digit is incorrect, a panic error is logged,
46848 and the default code is used.
46849 </para>
46850 <para>
46851 The text is literal; any quotes are taken as literals, but because the string
46852 is expanded, backslash escapes are processed anyway. If the message contains
46853 newlines, this gives rise to a multi-line SMTP response. Like <option>log_message</option>,
46854 the contents of <option>message</option> are not expanded until after a condition has
46855 failed.
46856 </para>
46857 <para>
46858 <indexterm role="concept">
46859 <primary><varname>$acl_verify_message</varname></primary>
46860 </indexterm>
46861 If <option>message</option> is used on a statement that verifies an address, the message
46862 specified overrides any message that is generated by the verification process.
46863 However, the original message is available in the variable
46864 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
46865 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
46866 routers to be passed back as part of the SMTP response, you should either not
46867 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
46868 </para>
46869 <para>
46870 For compatibility with previous releases of Exim, a <option>message</option> modifier that
46871 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
46872 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
46873 all the conditions are true, wherever it appears in an ACL command, whereas
46874 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
46875 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
46876 effect.
46877 </para>
46878 </listitem></varlistentry>
46879 <varlistentry>
46880 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
46881 <listitem>
46882 <para>
46883 <indexterm role="concept">
46884 <primary><option>set</option></primary>
46885 <secondary>ACL modifier</secondary>
46886 </indexterm>
46887 This modifier puts a value into one of the ACL variables (see section
46888 <xref linkend="SECTaclvariables"/>).
46889 </para>
46890 </listitem></varlistentry>
46891 </variablelist>
46892 </section>
46893 <section id="SECTcontrols">
46894 <title>Use of the control modifier</title>
46895 <para>
46896 <indexterm role="concept">
46897 <primary><option>control</option></primary>
46898 <secondary>ACL modifier</secondary>
46899 </indexterm>
46900 The <option>control</option> modifier supports the following settings:
46901 </para>
46902 <variablelist>
46903 <varlistentry>
46904 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
46905 <listitem>
46906 <para>
46907 This modifier allows a client host to use the SMTP AUTH command even when it
46908 has not been advertised in response to EHLO. Furthermore, because there are
46909 apparently some really broken clients that do this, Exim will accept AUTH after
46910 HELO (rather than EHLO) when this control is set. It should be used only if you
46911 really need it, and you should limit its use to those broken clients that do
46912 not work without it. For example:
46913 </para>
46914 <literallayout class="monospaced">
46915 warn hosts   = 192.168.34.25
46916      control = allow_auth_unadvertised
46917 </literallayout>
46918 <para>
46919 Normally, when an Exim server receives an AUTH command, it checks the name of
46920 the authentication mechanism that is given in the command to ensure that it
46921 matches an advertised mechanism. When this control is set, the check that a
46922 mechanism has been advertised is bypassed. Any configured mechanism can be used
46923 by the client. This control is permitted only in the connection and HELO ACLs.
46924 </para>
46925 </listitem></varlistentry>
46926 <varlistentry>
46927 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
46928 <listitem>
46929 <para>
46930 See below.
46931 </para>
46932 </listitem></varlistentry>
46933 <varlistentry>
46934 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
46935 <listitem>
46936 <para>
46937 <indexterm role="concept">
46938 <primary>access control lists (ACLs)</primary>
46939 <secondary>case of local part in</secondary>
46940 </indexterm>
46941 <indexterm role="concept">
46942 <primary>case of local parts</primary>
46943 </indexterm>
46944 <indexterm role="concept">
46945 <primary><varname>$local_part</varname></primary>
46946 </indexterm>
46947 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
46948 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
46949 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
46950 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
46951 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
46952 is encountered.
46953 </para>
46954 <para>
46955 These controls affect only the current recipient. Moreover, they apply only to
46956 local part handling that takes place directly in the ACL (for example, as a key
46957 in lookups). If a test to verify the recipient is obeyed, the case-related
46958 handling of the local part during the verification is controlled by the router
46959 configuration (see the <option>caseful_local_part</option> generic router option).
46960 </para>
46961 <para>
46962 This facility could be used, for example, to add a spam score to local parts
46963 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
46964 spam score:
46965 </para>
46966 <literallayout class="monospaced">
46967 warn  control = caseful_local_part
46968       set acl_m4 = ${eval:\
46969                      $acl_m4 + \
46970                      ${if match{$local_part}{[A-Z]}{1}{0}}\
46971                     }
46972       control = caselower_local_part
46973 </literallayout>
46974 <para>
46975 Notice that we put back the lower cased version afterwards, assuming that
46976 is what is wanted for subsequent tests.
46977 </para>
46978 </listitem></varlistentry>
46979 <varlistentry>
46980 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
46981 <listitem>
46982 <para>
46983 See below.
46984 </para>
46985 </listitem></varlistentry>
46986 <varlistentry>
46987 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
46988 <listitem>
46989 <para>
46990 <indexterm role="concept">
46991 <primary>SMTP</primary>
46992 <secondary>synchronization checking</secondary>
46993 </indexterm>
46994 <indexterm role="concept">
46995 <primary>synchronization checking in SMTP</primary>
46996 </indexterm>
46997 These controls make it possible to be selective about when SMTP synchronization
46998 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
46999 state of the switch (it is true by default). See the description of this option
47000 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
47001 </para>
47002 <para>
47003 The effect of these two controls lasts for the remainder of the SMTP
47004 connection. They can appear in any ACL except the one for the non-SMTP
47005 messages. The most straightforward place to put them is in the ACL defined by
47006 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
47007 before the first synchronization check. The expected use is to turn off the
47008 synchronization checks for badly-behaved hosts that you nevertheless need to
47009 work with.
47010 </para>
47011 </listitem></varlistentry>
47012 <varlistentry>
47013 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
47014 <listitem>
47015 <para>
47016 <indexterm role="concept">
47017 <primary>fake defer</primary>
47018 </indexterm>
47019 <indexterm role="concept">
47020 <primary>defer</primary>
47021 <secondary>fake</secondary>
47022 </indexterm>
47023 This control works in exactly the same way as <option>fakereject</option> (described below)
47024 except that it causes an SMTP 450 response after the message data instead of a
47025 550 response. You must take care when using <option>fakedefer</option> because it causes the
47026 messages to be duplicated when the sender retries. Therefore, you should not
47027 use <option>fakedefer</option> if the message is to be delivered normally.
47028 </para>
47029 </listitem></varlistentry>
47030 <varlistentry>
47031 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
47032 <listitem>
47033 <para>
47034 <indexterm role="concept">
47035 <primary>fake rejection</primary>
47036 </indexterm>
47037 <indexterm role="concept">
47038 <primary>rejection</primary>
47039 <secondary>fake</secondary>
47040 </indexterm>
47041 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
47042 words, only when an SMTP message is being received. If Exim accepts the
47043 message, instead the final 250 response, a 550 rejection message is sent.
47044 However, Exim proceeds to deliver the message as normal. The control applies
47045 only to the current message, not to any subsequent ones that may be received in
47046 the same SMTP connection.
47047 </para>
47048 <para>
47049 The text for the 550 response is taken from the <option>control</option> modifier. If no
47050 message is supplied, the following is used:
47051 </para>
47052 <literallayout class="monospaced">
47053 550-Your message has been rejected but is being
47054 550-kept for evaluation.
47055 550-If it was a legitimate message, it may still be
47056 550 delivered to the target recipient(s).
47057 </literallayout>
47058 <para>
47059 This facilty should be used with extreme caution.
47060 </para>
47061 </listitem></varlistentry>
47062 <varlistentry>
47063 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
47064 <listitem>
47065 <para>
47066 <indexterm role="concept">
47067 <primary>frozen messages</primary>
47068 <secondary>forcing in ACL</secondary>
47069 </indexterm>
47070 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47071 other words, only when a message is being received. If the message is accepted,
47072 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
47073 current message, not to any subsequent ones that may be received in the same
47074 SMTP connection.
47075 </para>
47076 <para>
47077 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
47078 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
47079 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
47080 are obeyed for the current message have the <literal>/no_tell</literal> option.
47081 </para>
47082 </listitem></varlistentry>
47083 <varlistentry>
47084 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
47085 <listitem>
47086 <para>
47087 This control is available when Exim is compiled with the content scanning
47088 extension. Content scanning may require a copy of the current message, or parts
47089 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
47090 or spam scanner. Normally, such copies are deleted when they are no longer
47091 needed. If this control is set, the copies are not deleted. The control applies
47092 only to the current message, not to any subsequent ones that may be received in
47093 the same SMTP connection. It is provided for debugging purposes and is unlikely
47094 to be useful in production.
47095 </para>
47096 </listitem></varlistentry>
47097 <varlistentry>
47098 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_response</emphasis></term>
47099 <listitem>
47100 <para>
47101 <indexterm role="concept">
47102 <primary>multiline responses</primary>
47103 <secondary>suppressing</secondary>
47104 </indexterm>
47105 This control is permitted for any ACL except the one for non-SMTP messages.
47106 It seems that there are broken clients in use that cannot handle multiline
47107 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
47108 </para>
47109 <para>
47110 If this control is set, multiline SMTP responses from ACL rejections are
47111 suppressed. One way of doing this would have been to put out these responses as
47112 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
47113 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
47114 responses might get close to that. So this facility, which is after all only a
47115 sop to broken clients, is implemented by doing two very easy things:
47116 </para>
47117 <itemizedlist>
47118 <listitem>
47119 <para>
47120 Extra information that is normally output as part of a rejection caused by
47121 sender verification failure is omitted. Only the final line (typically <quote>sender
47122 verification failed</quote>) is sent.
47123 </para>
47124 </listitem>
47125 <listitem>
47126 <para>
47127 If a <option>message</option> modifier supplies a multiline response, only the first
47128 line is output.
47129 </para>
47130 </listitem>
47131 </itemizedlist>
47132 <para>
47133 The setting of the switch can, of course, be made conditional on the
47134 calling host. Its effect lasts until the end of the SMTP connection.
47135 </para>
47136 </listitem></varlistentry>
47137 <varlistentry>
47138 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
47139 <listitem>
47140 <para>
47141 <indexterm role="concept">
47142 <primary><option>queue_only</option></primary>
47143 </indexterm>
47144 <indexterm role="concept">
47145 <primary>queueing incoming messages</primary>
47146 </indexterm>
47147 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
47148 other words, only when a message is being received. If the message is accepted,
47149 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
47150 runner. No immediate delivery process is started. In other words, it has the
47151 effect as the <option>queue_only</option> global option. However, the control applies only
47152 to the current message, not to any subsequent ones that may be received in the
47153 same SMTP connection.
47154 </para>
47155 </listitem></varlistentry>
47156 <varlistentry>
47157 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
47158 <listitem>
47159 <para>
47160 <indexterm role="concept">
47161 <primary>message</primary>
47162 <secondary>submission</secondary>
47163 </indexterm>
47164 <indexterm role="concept">
47165 <primary>submission mode</primary>
47166 </indexterm>
47167 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
47168 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
47169 the current message is a submission from a local MUA. In this case, Exim
47170 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
47171 necessary. For example, it add a <emphasis>Date:</emphasis> header line if one is not present.
47172 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
47173 late (the message has already been created).
47174 </para>
47175 <para>
47176 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
47177 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
47178 submission mode; the available options for this control are described there.
47179 The control applies only to the current message, not to any subsequent ones
47180 that may be received in the same SMTP connection.
47181 </para>
47182 </listitem></varlistentry>
47183 <varlistentry>
47184 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
47185 <listitem>
47186 <para>
47187 <indexterm role="concept">
47188 <primary>submission fixups</primary>
47189 <secondary>suppressing</secondary>
47190 </indexterm>
47191 This control applies to locally submitted (non TCP/IP) messages, and is the
47192 complement of <literal>control</literal> <literal>=</literal> <literal>submission</literal>. It disables the fixups that are
47193 normally applied to locally-submitted messages. Specifically:
47194 </para>
47195 <itemizedlist>
47196 <listitem>
47197 <para>
47198 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
47199 dynamic version of <option>local_sender_retain</option>).
47200 </para>
47201 </listitem>
47202 <listitem>
47203 <para>
47204 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
47205 </para>
47206 </listitem>
47207 <listitem>
47208 <para>
47209 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
47210 </para>
47211 </listitem>
47212 </itemizedlist>
47213 <para revisionflag="changed">
47214 This control may be useful when a remotely-originated message is accepted,
47215 passed to some scanning program, and then re-submitted for delivery. It can be
47216 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
47217 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
47218 data is read.
47219 </para>
47220 </listitem></varlistentry>
47221 </variablelist>
47222 <para>
47223 All four possibilities for message fixups can be specified:
47224 </para>
47225 <itemizedlist>
47226 <listitem>
47227 <para>
47228 Locally submitted, fixups applied: the default.
47229 </para>
47230 </listitem>
47231 <listitem>
47232 <para>
47233 Locally submitted, no fixups applied: use <literal>control</literal> <literal>=</literal>
47234 <literal>suppress_local_fixups</literal>.
47235 </para>
47236 </listitem>
47237 <listitem>
47238 <para>
47239 Remotely submitted, no fixups applied: the default.
47240 </para>
47241 </listitem>
47242 <listitem>
47243 <para>
47244 Remotely submitted, fixups applied: use <literal>control</literal> <literal>=</literal> <literal>submission</literal>.
47245 </para>
47246 </listitem>
47247 </itemizedlist>
47248 </section>
47249 <section id="SECTaddheadacl">
47250 <title>Adding header lines in ACLs</title>
47251 <para>
47252 <indexterm role="concept">
47253 <primary>header lines</primary>
47254 <secondary>adding in an ACL</secondary>
47255 </indexterm>
47256 <indexterm role="concept">
47257 <primary>header lines</primary>
47258 <secondary>position of added lines</secondary>
47259 </indexterm>
47260 <indexterm role="concept">
47261 <primary><option>message</option></primary>
47262 <secondary>ACL modifier</secondary>
47263 </indexterm>
47264 The <option>add_header</option> modifier can be used to add one or more extra header lines
47265 to an incoming message, as in this example:
47266 </para>
47267 <literallayout class="monospaced">
47268 warn dnslists = sbl.spamhaus.org : \
47269                 dialup.mail-abuse.org
47270      add_header = X-blacklisted-at: $dnslist_domain
47271 </literallayout>
47272 <para>
47273 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
47274 MIME, and non-SMTP ACLs (in other words, those that are concerned with
47275 receiving a message). The message must ultimately be accepted for
47276 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
47277 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
47278 RCPT ACL).
47279 </para>
47280 <para>
47281 If the data for the <option>add_header</option> modifier contains one or more newlines that
47282 are not followed by a space or a tab, it is assumed to contain multiple header
47283 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
47284 front of any line that is not a valid header line.
47285 </para>
47286 <para>
47287 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
47288 They are added to the message before processing the DATA and MIME ACLs.
47289 However, if an identical header line is requested more than once, only one copy
47290 is actually added to the message. Further header lines may be accumulated
47291 during the DATA and MIME ACLs, after which they are added to the message, again
47292 with duplicates suppressed. Thus, it is possible to add two identical header
47293 lines to an SMTP message, but only if one is added before DATA and one after.
47294 In the case of non-SMTP messages, new headers are accumulated during the
47295 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
47296 message is rejected after DATA or by the non-SMTP ACL, all added header lines
47297 are included in the entry that is written to the reject log.
47298 </para>
47299 <para>
47300 <indexterm role="concept">
47301 <primary>header lines</primary>
47302 <secondary>added; visibility of</secondary>
47303 </indexterm>
47304 Header lines are not visible in string expansions until they are added to the
47305 message. It follows that header lines defined in the MAIL, RCPT, and predata
47306 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
47307 header lines that are added by the DATA or MIME ACLs are not visible in those
47308 ACLs. Because of this restriction, you cannot use header lines as a way of
47309 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
47310 this, you can use ACL variables, as described in section
47311 <xref linkend="SECTaclvariables"/>.
47312 </para>
47313 <para>
47314 The <option>add_header</option> modifier acts immediately it is encountered during the
47315 processing of an ACL. Notice the difference between these two cases:
47316 </para>
47317 <literallayout>
47318 <literal>accept add_header = ADDED: some text</literal>
47319 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
47320
47321 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
47322 <literal>       add_header = ADDED: some text</literal>
47323 </literallayout>
47324 <para>
47325 In the first case, the header line is always added, whether or not the
47326 condition is true. In the second case, the header line is added only if the
47327 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
47328 ACL statement. All those that are encountered before a condition fails are
47329 honoured.
47330 </para>
47331 <para>
47332 <indexterm role="concept">
47333 <primary><option>warn</option></primary>
47334 <secondary>ACL verb</secondary>
47335 </indexterm>
47336 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
47337 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
47338 effect only if all the conditions are true, even if it appears before some of
47339 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
47340 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
47341 are present on a <option>warn</option> verb, both are processed according to their
47342 specifications.
47343 </para>
47344 <para>
47345 By default, new header lines are added to a message at the end of the existing
47346 header lines. However, you can specify that any particular header line should
47347 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
47348 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
47349 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
47350 </para>
47351 <para>
47352 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
47353 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
47354 header line, respectively. (Header text cannot start with a colon, as there has
47355 to be a header name first.) For example:
47356 </para>
47357 <literallayout class="monospaced">
47358 warn add_header = \
47359        :after_received:X-My-Header: something or other...
47360 </literallayout>
47361 <para>
47362 If more than one header line is supplied in a single <option>add_header</option> modifier,
47363 each one is treated independently and can therefore be placed differently. If
47364 you add more than one line at the start, or after the Received: block, they end
47365 up in reverse order.
47366 </para>
47367 <para>
47368 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
47369 added in an ACL. It does NOT work for header lines that are added in a
47370 system filter or in a router or transport.
47371 </para>
47372 </section>
47373 <section id="SECTaclconditions">
47374 <title>ACL conditions</title>
47375 <para>
47376 <indexterm role="concept">
47377 <primary>access control lists (ACLs)</primary>
47378 <secondary>conditions; list of</secondary>
47379 </indexterm>
47380 Some of conditions listed in this section are available only when Exim is
47381 compiled with the content-scanning extension. They are included here briefly
47382 for completeness. More detailed descriptions can be found in the discussion on
47383 content scanning in chapter <xref linkend="CHAPexiscan"/>.
47384 </para>
47385 <para>
47386 Not all conditions are relevant in all circumstances. For example, testing
47387 senders and recipients does not make sense in an ACL that is being run as the
47388 result of the arrival of an ETRN command, and checks on message headers can be
47389 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
47390 can use the same condition (with different parameters) more than once in the
47391 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
47392 The conditions are as follows:
47393 </para>
47394 <variablelist>
47395 <varlistentry>
47396 <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>
47397 <listitem>
47398 <para>
47399 <indexterm role="concept">
47400 <primary>access control lists (ACLs)</primary>
47401 <secondary>nested</secondary>
47402 </indexterm>
47403 <indexterm role="concept">
47404 <primary>access control lists (ACLs)</primary>
47405 <secondary>indirect</secondary>
47406 </indexterm>
47407 <indexterm role="concept">
47408 <primary><option>acl</option></primary>
47409 <secondary>ACL condition</secondary>
47410 </indexterm>
47411 The possible values of the argument are the same as for the
47412 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
47413 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
47414 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
47415 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
47416 condition false. This means that further processing of the <option>warn</option> verb
47417 ceases, but processing of the ACL continues.
47418 </para>
47419 <para>
47420 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
47421 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
47422 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
47423 conditions are tested.
47424 </para>
47425 <para>
47426 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
47427 loops. This condition allows you to use different ACLs in different
47428 circumstances. For example, different ACLs can be used to handle RCPT commands
47429 for different local users or different local domains.
47430 </para>
47431 </listitem></varlistentry>
47432 <varlistentry>
47433 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
47434 <listitem>
47435 <para>
47436 <indexterm role="concept">
47437 <primary><option>authenticated</option></primary>
47438 <secondary>ACL condition</secondary>
47439 </indexterm>
47440 <indexterm role="concept">
47441 <primary>authentication</primary>
47442 <secondary>ACL checking</secondary>
47443 </indexterm>
47444 <indexterm role="concept">
47445 <primary>access control lists (ACLs)</primary>
47446 <secondary>testing for authentication</secondary>
47447 </indexterm>
47448 If the SMTP connection is not authenticated, the condition is false. Otherwise,
47449 the name of the authenticator is tested against the list. To test for
47450 authentication by any authenticator, you can set
47451 </para>
47452 <literallayout class="monospaced">
47453 authenticated = *
47454 </literallayout>
47455 </listitem></varlistentry>
47456 <varlistentry>
47457 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
47458 <listitem>
47459 <para>
47460 <indexterm role="concept">
47461 <primary><option>condition</option></primary>
47462 <secondary>ACL condition</secondary>
47463 </indexterm>
47464 <indexterm role="concept">
47465 <primary>customizing</primary>
47466 <secondary>ACL condition</secondary>
47467 </indexterm>
47468 <indexterm role="concept">
47469 <primary>access control lists (ACLs)</primary>
47470 <secondary>customized test</secondary>
47471 </indexterm>
47472 <indexterm role="concept">
47473 <primary>access control lists (ACLs)</primary>
47474 <secondary>testing; customized</secondary>
47475 </indexterm>
47476 This feature allows you to make up custom conditions. If the result of
47477 expanding the string is an empty string, the number zero, or one of the strings
47478 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
47479 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
47480 any other value, some error is assumed to have occurred, and the ACL returns
47481 <quote>defer</quote>. <phrase revisionflag="changed">However, if the expansion is forced to fail, the condition is
47482 ignored. The effect is to treat it as true, whether it is positive or
47483 negative.</phrase>
47484 </para>
47485 </listitem></varlistentry>
47486 <varlistentry>
47487 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
47488 <listitem>
47489 <para>
47490 <indexterm role="concept">
47491 <primary><option>decode</option></primary>
47492 <secondary>ACL condition</secondary>
47493 </indexterm>
47494 This condition is available only when Exim is compiled with the
47495 content-scanning extension, and it is allowed only the the ACL defined by
47496 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
47497 For details, see chapter <xref linkend="CHAPexiscan"/>.
47498 </para>
47499 </listitem></varlistentry>
47500 <varlistentry>
47501 <term><emphasis role="bold">demime&nbsp;=&nbsp;</emphasis>&lt;<emphasis>extension&nbsp;list</emphasis>&gt;</term>
47502 <listitem>
47503 <para>
47504 <indexterm role="concept">
47505 <primary><option>demime</option></primary>
47506 <secondary>ACL condition</secondary>
47507 </indexterm>
47508 This condition is available only when Exim is compiled with the
47509 content-scanning extension. Its use is described in section
47510 <xref linkend="SECTdemimecond"/>.
47511 </para>
47512 </listitem></varlistentry>
47513 <varlistentry>
47514 <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>
47515 <listitem>
47516 <para>
47517 <indexterm role="concept">
47518 <primary><option>dnslists</option></primary>
47519 <secondary>ACL condition</secondary>
47520 </indexterm>
47521 <indexterm role="concept">
47522 <primary>DNS list</primary>
47523 <secondary>in ACL</secondary>
47524 </indexterm>
47525 <indexterm role="concept">
47526 <primary>black list (DNS)</primary>
47527 </indexterm>
47528 <indexterm role="concept">
47529 <primary>access control lists (ACLs)</primary>
47530 <secondary>testing a DNS list</secondary>
47531 </indexterm>
47532 This condition checks for entries in DNS black lists. These are also known as
47533 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
47534 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
47535 different variants of this condition to describe briefly here. See sections
47536 <xref linkend="SECTmorednslists"/>--<xref linkend="SECTmorednslistslast"/> for details.
47537 </para>
47538 </listitem></varlistentry>
47539 <varlistentry>
47540 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
47541 <listitem>
47542 <para>
47543 <indexterm role="concept">
47544 <primary><option>domains</option></primary>
47545 <secondary>ACL condition</secondary>
47546 </indexterm>
47547 <indexterm role="concept">
47548 <primary>domain</primary>
47549 <secondary>ACL checking</secondary>
47550 </indexterm>
47551 <indexterm role="concept">
47552 <primary>access control lists (ACLs)</primary>
47553 <secondary>testing a recipient domain</secondary>
47554 </indexterm>
47555 <indexterm role="concept">
47556 <primary><varname>$domain_data</varname></primary>
47557 </indexterm>
47558 This condition is relevant only after a RCPT command. It checks that the domain
47559 of the recipient address is in the domain list. If percent-hack processing is
47560 enabled, it is done before this test is done. If the check succeeds with a
47561 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
47562 <option>domains</option> test.
47563 </para>
47564 </listitem></varlistentry>
47565 <varlistentry>
47566 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
47567 <listitem>
47568 <para>
47569 <indexterm role="concept">
47570 <primary><option>encrypted</option></primary>
47571 <secondary>ACL condition</secondary>
47572 </indexterm>
47573 <indexterm role="concept">
47574 <primary>encryption</primary>
47575 <secondary>checking in an ACL</secondary>
47576 </indexterm>
47577 <indexterm role="concept">
47578 <primary>access control lists (ACLs)</primary>
47579 <secondary>testing for encryption</secondary>
47580 </indexterm>
47581 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
47582 name of the cipher suite in use is tested against the list. To test for
47583 encryption without testing for any specific cipher suite(s), set
47584 </para>
47585 <literallayout class="monospaced">
47586 encrypted = *
47587 </literallayout>
47588 </listitem></varlistentry>
47589 <varlistentry>
47590 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>&nbsp;host&nbsp;list</emphasis>&gt;</term>
47591 <listitem>
47592 <para>
47593 <indexterm role="concept">
47594 <primary><option>hosts</option></primary>
47595 <secondary>ACL condition</secondary>
47596 </indexterm>
47597 <indexterm role="concept">
47598 <primary>host</primary>
47599 <secondary>ACL checking</secondary>
47600 </indexterm>
47601 <indexterm role="concept">
47602 <primary>access control lists (ACLs)</primary>
47603 <secondary>testing the client host</secondary>
47604 </indexterm>
47605 This condition tests that the calling host matches the host list. If you have
47606 name lookups or wildcarded host names and IP addresses in the same host list,
47607 you should normally put the IP addresses first. For example, you could have:
47608 </para>
47609 <literallayout class="monospaced">
47610 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
47611 </literallayout>
47612 <para>
47613 The reason for this lies in the left-to-right way that Exim processes lists.
47614 It can test IP addresses without doing any DNS lookups, but when it reaches an
47615 item that requires a host name, it fails if it cannot find a host name to
47616 compare with the pattern. If the above list is given in the opposite order, the
47617 <option>accept</option> statement fails for a host whose name cannot be found, even if its
47618 IP address is 10.9.8.7.
47619 </para>
47620 <para>
47621 If you really do want to do the name check first, and still recognize the IP
47622 address even if the name lookup fails, you can rewrite the ACL like this:
47623 </para>
47624 <literallayout class="monospaced">
47625 accept hosts = dbm;/etc/friendly/hosts
47626 accept hosts = 10.9.8.7
47627 </literallayout>
47628 <para>
47629 The default action on failing to find the host name is to assume that the host
47630 is not in the list, so the first <option>accept</option> statement fails. The second
47631 statement can then check the IP address.
47632 </para>
47633 <para>
47634 <indexterm role="concept">
47635 <primary><varname>$host_data</varname></primary>
47636 </indexterm>
47637 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
47638 of the lookup is made available in the <varname>$host_data</varname> variable. This
47639 allows you, for example, to set up a statement like this:
47640 </para>
47641 <literallayout class="monospaced">
47642 deny  hosts = net-lsearch;/some/file
47643 message = $host_data
47644 </literallayout>
47645 <para>
47646 which gives a custom error message for each denied host.
47647 </para>
47648 </listitem></varlistentry>
47649 <varlistentry>
47650 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
47651 <listitem>
47652 <para>
47653 <indexterm role="concept">
47654 <primary><option>local_parts</option></primary>
47655 <secondary>ACL condition</secondary>
47656 </indexterm>
47657 <indexterm role="concept">
47658 <primary>local part</primary>
47659 <secondary>ACL checking</secondary>
47660 </indexterm>
47661 <indexterm role="concept">
47662 <primary>access control lists (ACLs)</primary>
47663 <secondary>testing a local part</secondary>
47664 </indexterm>
47665 <indexterm role="concept">
47666 <primary><varname>$local_part_data</varname></primary>
47667 </indexterm>
47668 This condition is relevant only after a RCPT command. It checks that the local
47669 part of the recipient address is in the list. If percent-hack processing is
47670 enabled, it is done before this test. If the check succeeds with a lookup, the
47671 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
47672 the next <option>local_parts</option> test.
47673 </para>
47674 </listitem></varlistentry>
47675 <varlistentry>
47676 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
47677 <listitem>
47678 <para>
47679 <indexterm role="concept">
47680 <primary><option>malware</option></primary>
47681 <secondary>ACL condition</secondary>
47682 </indexterm>
47683 <indexterm role="concept">
47684 <primary>access control lists (ACLs)</primary>
47685 <secondary>virus scanning</secondary>
47686 </indexterm>
47687 <indexterm role="concept">
47688 <primary>access control lists (ACLs)</primary>
47689 <secondary>scanning for viruses</secondary>
47690 </indexterm>
47691 This condition is available only when Exim is compiled with the
47692 content-scanning extension. It causes the incoming message to be scanned for
47693 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
47694 </para>
47695 </listitem></varlistentry>
47696 <varlistentry>
47697 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
47698 <listitem>
47699 <para>
47700 <indexterm role="concept">
47701 <primary><option>mime_regex</option></primary>
47702 <secondary>ACL condition</secondary>
47703 </indexterm>
47704 <indexterm role="concept">
47705 <primary>access control lists (ACLs)</primary>
47706 <secondary>testing by regex matching</secondary>
47707 </indexterm>
47708 This condition is available only when Exim is compiled with the
47709 content-scanning extension, and it is allowed only the the ACL defined by
47710 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
47711 with any of the regular expressions. For details, see chapter
47712 <xref linkend="CHAPexiscan"/>.
47713 </para>
47714 </listitem></varlistentry>
47715 <varlistentry>
47716 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
47717 <listitem>
47718 <para>
47719 <indexterm role="concept">
47720 <primary>rate limiting</primary>
47721 </indexterm>
47722 This condition can be used to limit the rate at which a user or host submits
47723 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
47724 </para>
47725 </listitem></varlistentry>
47726 <varlistentry>
47727 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
47728 <listitem>
47729 <para>
47730 <indexterm role="concept">
47731 <primary><option>recipients</option></primary>
47732 <secondary>ACL condition</secondary>
47733 </indexterm>
47734 <indexterm role="concept">
47735 <primary>recipient</primary>
47736 <secondary>ACL checking</secondary>
47737 </indexterm>
47738 <indexterm role="concept">
47739 <primary>access control lists (ACLs)</primary>
47740 <secondary>testing a recipient</secondary>
47741 </indexterm>
47742 This condition is relevant only after a RCPT command. It checks the entire
47743 recipient address against a list of recipients.
47744 </para>
47745 </listitem></varlistentry>
47746 <varlistentry>
47747 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
47748 <listitem>
47749 <para>
47750 <indexterm role="concept">
47751 <primary><option>regex</option></primary>
47752 <secondary>ACL condition</secondary>
47753 </indexterm>
47754 <indexterm role="concept">
47755 <primary>access control lists (ACLs)</primary>
47756 <secondary>testing by regex matching</secondary>
47757 </indexterm>
47758 This condition is available only when Exim is compiled with the
47759 content-scanning extension, and is available only in the DATA, MIME, and
47760 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
47761 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
47762 </para>
47763 </listitem></varlistentry>
47764 <varlistentry>
47765 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
47766 <listitem>
47767 <para>
47768 <indexterm role="concept">
47769 <primary><option>sender_domains</option></primary>
47770 <secondary>ACL condition</secondary>
47771 </indexterm>
47772 <indexterm role="concept">
47773 <primary>sender</primary>
47774 <secondary>ACL checking</secondary>
47775 </indexterm>
47776 <indexterm role="concept">
47777 <primary>access control lists (ACLs)</primary>
47778 <secondary>testing a sender domain</secondary>
47779 </indexterm>
47780 <indexterm role="concept">
47781 <primary><varname>$domain</varname></primary>
47782 </indexterm>
47783 <indexterm role="concept">
47784 <primary><varname>$sender_address_domain</varname></primary>
47785 </indexterm>
47786 This condition tests the domain of the sender of the message against the given
47787 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
47788 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
47789 of this condition. This is an exception to the general rule for testing domain
47790 lists. It is done this way so that, if this condition is used in an ACL for a
47791 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
47792 influence the sender checking.
47793 </para>
47794 <para>
47795 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47796 relaying, because sender addresses are easily, and commonly, forged.
47797 </para>
47798 </listitem></varlistentry>
47799 <varlistentry>
47800 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
47801 <listitem>
47802 <para>
47803 <indexterm role="concept">
47804 <primary><option>senders</option></primary>
47805 <secondary>ACL condition</secondary>
47806 </indexterm>
47807 <indexterm role="concept">
47808 <primary>sender</primary>
47809 <secondary>ACL checking</secondary>
47810 </indexterm>
47811 <indexterm role="concept">
47812 <primary>access control lists (ACLs)</primary>
47813 <secondary>testing a sender</secondary>
47814 </indexterm>
47815 This condition tests the sender of the message against the given list. To test
47816 for a bounce message, which has an empty sender, set
47817 </para>
47818 <literallayout class="monospaced">
47819 senders = :
47820 </literallayout>
47821 <para>
47822 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
47823 relaying, because sender addresses are easily, and commonly, forged.
47824 </para>
47825 </listitem></varlistentry>
47826 <varlistentry>
47827 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
47828 <listitem>
47829 <para>
47830 <indexterm role="concept">
47831 <primary><option>spam</option></primary>
47832 <secondary>ACL condition</secondary>
47833 </indexterm>
47834 <indexterm role="concept">
47835 <primary>access control lists (ACLs)</primary>
47836 <secondary>scanning for spam</secondary>
47837 </indexterm>
47838 This condition is available only when Exim is compiled with the
47839 content-scanning extension. It causes the incoming message to be scanned by
47840 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
47841 </para>
47842 </listitem></varlistentry>
47843 <varlistentry>
47844 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
47845 <listitem>
47846 <para>
47847 <indexterm role="concept">
47848 <primary><option>verify</option></primary>
47849 <secondary>ACL condition</secondary>
47850 </indexterm>
47851 <indexterm role="concept">
47852 <primary>TLS</primary>
47853 <secondary>client certificate verification</secondary>
47854 </indexterm>
47855 <indexterm role="concept">
47856 <primary>certificate</primary>
47857 <secondary>verification of client</secondary>
47858 </indexterm>
47859 <indexterm role="concept">
47860 <primary>access control lists (ACLs)</primary>
47861 <secondary>certificate verification</secondary>
47862 </indexterm>
47863 <indexterm role="concept">
47864 <primary>access control lists (ACLs)</primary>
47865 <secondary>testing a TLS certificate</secondary>
47866 </indexterm>
47867 This condition is true in an SMTP session if the session is encrypted, and a
47868 certificate was received from the client, and the certificate was verified. The
47869 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
47870 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
47871 </para>
47872 </listitem></varlistentry>
47873 <varlistentry>
47874 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
47875 <listitem>
47876 <para>
47877 <indexterm role="concept">
47878 <primary>CSA verification</primary>
47879 </indexterm>
47880 This condition checks whether the sending host (the client) is authorized to
47881 send email. Details of how this works are given in section
47882 <xref linkend="SECTverifyCSA"/>.
47883 </para>
47884 </listitem></varlistentry>
47885 <varlistentry>
47886 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
47887 <listitem>
47888 <para>
47889 <indexterm role="concept">
47890 <primary><option>verify</option></primary>
47891 <secondary>ACL condition</secondary>
47892 </indexterm>
47893 <indexterm role="concept">
47894 <primary>access control lists (ACLs)</primary>
47895 <secondary>verifying sender in the header</secondary>
47896 </indexterm>
47897 <indexterm role="concept">
47898 <primary>header lines</primary>
47899 <secondary>verifying the sender in</secondary>
47900 </indexterm>
47901 <indexterm role="concept">
47902 <primary>sender</primary>
47903 <secondary>verifying in header</secondary>
47904 </indexterm>
47905 <indexterm role="concept">
47906 <primary>verifying</primary>
47907 <secondary>sender in header</secondary>
47908 </indexterm>
47909 This condition is relevant only in an ACL that is run after a message has been
47910 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47911 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
47912 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
47913 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
47914 However, an address that appears in one of these headers need not be an address
47915 that accepts bounce messages; only sender addresses in envelopes are required
47916 to accept bounces. Therefore, if you use the callout option on this check, you
47917 might want to arrange for a non-empty address in the MAIL command.
47918 </para>
47919 <para>
47920 Details of address verification and the options are given later, starting at
47921 section <xref linkend="SECTaddressverification"/> (callouts are described in section
47922 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
47923 condition to restrict it to bounce messages only:
47924 </para>
47925 <literallayout class="monospaced">
47926 deny    senders = :
47927         message = A valid sender header is required for bounces
47928        !verify  = header_sender
47929 </literallayout>
47930 </listitem></varlistentry>
47931 <varlistentry>
47932 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
47933 <listitem>
47934 <para>
47935 <indexterm role="concept">
47936 <primary><option>verify</option></primary>
47937 <secondary>ACL condition</secondary>
47938 </indexterm>
47939 <indexterm role="concept">
47940 <primary>access control lists (ACLs)</primary>
47941 <secondary>verifying header syntax</secondary>
47942 </indexterm>
47943 <indexterm role="concept">
47944 <primary>header lines</primary>
47945 <secondary>verifying syntax</secondary>
47946 </indexterm>
47947 <indexterm role="concept">
47948 <primary>verifying</primary>
47949 <secondary>header syntax</secondary>
47950 </indexterm>
47951 This condition is relevant only in an ACL that is run after a message has been
47952 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
47953 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
47954 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
47955 and <emphasis>Bcc:</emphasis>). Unqualified addresses (local parts without domains) are
47956 permitted only in locally generated messages and from hosts that match
47957 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
47958 appropriate.
47959 </para>
47960 <para>
47961 Note that this condition is a syntax check only. However, a common spamming
47962 ploy used to be to send syntactically invalid headers such as
47963 </para>
47964 <literallayout class="monospaced">
47965 To: @
47966 </literallayout>
47967 <para>
47968 and this condition can be used to reject such messages, though they are not as
47969 common as they used to be.
47970 </para>
47971 </listitem></varlistentry>
47972 <varlistentry>
47973 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
47974 <listitem>
47975 <para>
47976 <indexterm role="concept">
47977 <primary><option>verify</option></primary>
47978 <secondary>ACL condition</secondary>
47979 </indexterm>
47980 <indexterm role="concept">
47981 <primary>access control lists (ACLs)</primary>
47982 <secondary>verifying HELO/EHLO</secondary>
47983 </indexterm>
47984 <indexterm role="concept">
47985 <primary>HELO</primary>
47986 <secondary>verifying</secondary>
47987 </indexterm>
47988 <indexterm role="concept">
47989 <primary>EHLO</primary>
47990 <secondary>verifying</secondary>
47991 </indexterm>
47992 <indexterm role="concept">
47993 <primary>verifying</primary>
47994 <secondary>EHLO</secondary>
47995 </indexterm>
47996 <indexterm role="concept">
47997 <primary>verifying</primary>
47998 <secondary>HELO</secondary>
47999 </indexterm>
48000 This condition is true if a HELO or EHLO command has been received from the
48001 client host, and its contents have been verified. It there has been no previous
48002 attempt to verify the the HELO/EHLO contents, it is carried out when this
48003 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
48004 <option>helo_try_verify_hosts</option> options for details of how to request verification
48005 independently of this condition.
48006 </para>
48007 </listitem></varlistentry>
48008 <varlistentry>
48009 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind</emphasis></term>
48010 <listitem>
48011 <para>
48012 <indexterm role="concept">
48013 <primary>verifying</primary>
48014 <secondary>not blind</secondary>
48015 </indexterm>
48016 <indexterm role="concept">
48017 <primary>bcc recipients</primary>
48018 <secondary>verifying none</secondary>
48019 </indexterm>
48020 This condition checks that there are no blind (bcc) recipients in the message.
48021 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
48022 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
48023 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
48024 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
48025 used only in a DATA or non-SMTP ACL.
48026 </para>
48027 <para>
48028 There are, of course, many legitimate messages that make use of blind (bcc)
48029 recipients. This check should not be used on its own for blocking messages.
48030 </para>
48031 </listitem></varlistentry>
48032 <varlistentry>
48033 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48034 <listitem>
48035 <para>
48036 <indexterm role="concept">
48037 <primary><option>verify</option></primary>
48038 <secondary>ACL condition</secondary>
48039 </indexterm>
48040 <indexterm role="concept">
48041 <primary>access control lists (ACLs)</primary>
48042 <secondary>verifying recipient</secondary>
48043 </indexterm>
48044 <indexterm role="concept">
48045 <primary>recipient</primary>
48046 <secondary>verifying</secondary>
48047 </indexterm>
48048 <indexterm role="concept">
48049 <primary>verifying</primary>
48050 <secondary>recipient</secondary>
48051 </indexterm>
48052 <indexterm role="concept">
48053 <primary><varname>$address_data</varname></primary>
48054 </indexterm>
48055 This condition is relevant only after a RCPT command. It verifies the current
48056 recipient. Details of address verification are given later, starting at section
48057 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
48058 of <varname>$address_data</varname> is the last value that was set while routing the address.
48059 This applies even if the verification fails. When an address that is being
48060 verified is redirected to a single address, verification continues with the new
48061 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
48062 value for the child address.
48063 </para>
48064 </listitem></varlistentry>
48065 <varlistentry>
48066 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup</emphasis></term>
48067 <listitem>
48068 <para>
48069 <indexterm role="concept">
48070 <primary><option>verify</option></primary>
48071 <secondary>ACL condition</secondary>
48072 </indexterm>
48073 <indexterm role="concept">
48074 <primary>access control lists (ACLs)</primary>
48075 <secondary>verifying host reverse lookup</secondary>
48076 </indexterm>
48077 <indexterm role="concept">
48078 <primary>host</primary>
48079 <secondary>verifying reverse lookup</secondary>
48080 </indexterm>
48081 This condition ensures that a verified host name has been looked up from the IP
48082 address of the client host. (This may have happened already if the host name
48083 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
48084 Verification ensures that the host name obtained from a reverse DNS lookup, or
48085 one of its aliases, does, when it is itself looked up in the DNS, yield the
48086 original IP address.
48087 </para>
48088 <para>
48089 If this condition is used for a locally generated message (that is, when there
48090 is no client host involved), it always succeeds.
48091 </para>
48092 </listitem></varlistentry>
48093 <varlistentry>
48094 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48095 <listitem>
48096 <para>
48097 <indexterm role="concept">
48098 <primary><option>verify</option></primary>
48099 <secondary>ACL condition</secondary>
48100 </indexterm>
48101 <indexterm role="concept">
48102 <primary>access control lists (ACLs)</primary>
48103 <secondary>verifying sender</secondary>
48104 </indexterm>
48105 <indexterm role="concept">
48106 <primary>sender</primary>
48107 <secondary>verifying</secondary>
48108 </indexterm>
48109 <indexterm role="concept">
48110 <primary>verifying</primary>
48111 <secondary>sender</secondary>
48112 </indexterm>
48113 This condition is relevant only after a MAIL or RCPT command, or after a
48114 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
48115 the message&#x2019;s sender is empty (that is, this is a bounce message), the
48116 condition is true. Otherwise, the sender address is verified.
48117 </para>
48118 <para>
48119 <indexterm role="concept">
48120 <primary><varname>$address_data</varname></primary>
48121 </indexterm>
48122 <indexterm role="concept">
48123 <primary><varname>$sender_address_data</varname></primary>
48124 </indexterm>
48125 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
48126 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
48127 value can be used in subsequent conditions and modifiers in the same ACL
48128 statement. It does not persist after the end of the current statement. If you
48129 want to preserve the value for longer, you can save it in an ACL variable.
48130 </para>
48131 <para>
48132 Details of verification are given later, starting at section
48133 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
48134 to avoid doing it more than once per message.
48135 </para>
48136 </listitem></varlistentry>
48137 <varlistentry>
48138 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
48139 <listitem>
48140 <para>
48141 <indexterm role="concept">
48142 <primary><option>verify</option></primary>
48143 <secondary>ACL condition</secondary>
48144 </indexterm>
48145 This is a variation of the previous option, in which a modified address is
48146 verified as a sender.
48147 </para>
48148 </listitem></varlistentry>
48149 </variablelist>
48150 </section>
48151 <section id="SECTmorednslists">
48152 <title>Using DNS lists</title>
48153 <para>
48154 <indexterm role="concept">
48155 <primary>DNS list</primary>
48156 <secondary>in ACL</secondary>
48157 </indexterm>
48158 <indexterm role="concept">
48159 <primary>black list (DNS)</primary>
48160 </indexterm>
48161 <indexterm role="concept">
48162 <primary>access control lists (ACLs)</primary>
48163 <secondary>testing a DNS list</secondary>
48164 </indexterm>
48165 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
48166 is on at least one of a number of DNS lists by looking up the inverted IP
48167 address in one or more DNS domains. For example, if the calling host&#x2019;s IP
48168 address is 192.168.62.43, and the ACL statement is
48169 </para>
48170 <literallayout class="monospaced">
48171 deny dnslists = blackholes.mail-abuse.org : \
48172                 dialups.mail-abuse.org
48173 </literallayout>
48174 <para>
48175 the following records are looked up:
48176 </para>
48177 <literallayout class="monospaced">
48178 43.62.168.192.blackholes.mail-abuse.org
48179 43.62.168.192.dialups.mail-abuse.org
48180 </literallayout>
48181 <para>
48182 As soon as Exim finds an existing DNS record, processing of the list stops.
48183 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
48184 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
48185 use two separate conditions:
48186 </para>
48187 <literallayout class="monospaced">
48188 deny dnslists = blackholes.mail-abuse.org
48189      dnslists = dialups.mail-abuse.org
48190 </literallayout>
48191 <para>
48192 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
48193 behaves as if the host does not match the list item, that is, as if the DNS
48194 record does not exist. If there are further items in the DNS list, they are
48195 processed.
48196 </para>
48197 <para>
48198 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
48199 (which is the most common usage), because it prevents a DNS failure from
48200 blocking mail. However, you can change this behaviour by putting one of the
48201 following special items in the list:
48202 </para>
48203 <literallayout>
48204 <literal>+include_unknown </literal>   behave as if the item is on the list
48205 <literal>+exclude_unknown </literal>   behave as if the item is not on the list (default)
48206 <literal>+defer_unknown   </literal>   give a temporary error
48207 </literallayout>
48208 <para>
48209 <indexterm role="concept">
48210 <primary><literal>+include_unknown</literal></primary>
48211 </indexterm>
48212 <indexterm role="concept">
48213 <primary><literal>+exclude_unknown</literal></primary>
48214 </indexterm>
48215 <indexterm role="concept">
48216 <primary><literal>+defer_unknown</literal></primary>
48217 </indexterm>
48218 Each of these applies to any subsequent items on the list. For example:
48219 </para>
48220 <literallayout class="monospaced">
48221 deny dnslists = +defer_unknown : foo.bar.example
48222 </literallayout>
48223 <para>
48224 Testing the list of domains stops as soon as a match is found. If you want to
48225 warn for one list and block for another, you can use two different statements:
48226 </para>
48227 <literallayout class="monospaced">
48228 deny  dnslists = blackholes.mail-abuse.org
48229 warn  message  = X-Warn: sending host is on dialups list
48230       dnslists = dialups.mail-abuse.org
48231 </literallayout>
48232 <para>
48233 DNS list lookups are cached by Exim for the duration of the SMTP session,
48234 so a lookup based on the IP address is done at most once for any incoming
48235 connection. Exim does not share information between multiple incoming
48236 connections (but your local name server cache should be active).
48237 </para>
48238 </section>
48239 <section>
48240 <title>Specifying the IP address for a DNS list lookup</title>
48241 <para>
48242 <indexterm role="concept">
48243 <primary>DNS list</primary>
48244 <secondary>keyed by explicit IP address</secondary>
48245 </indexterm>
48246 By default, the IP address that is used in a DNS list lookup is the IP address
48247 of the calling host. However, you can specify another IP address by listing it
48248 after the domain name, introduced by a slash. For example:
48249 </para>
48250 <literallayout class="monospaced">
48251 deny dnslists = black.list.tld/192.168.1.2
48252 </literallayout>
48253 <para>
48254 This feature is not very helpful with explicit IP addresses; it is intended for
48255 use with IP addresses that are looked up, for example, the IP addresses of the
48256 MX hosts or nameservers of an email sender address. For an example, see section
48257 <xref linkend="SECTmulkeyfor"/> below.
48258 </para>
48259 </section>
48260 <section>
48261 <title>DNS lists keyed on domain names</title>
48262 <para>
48263 <indexterm role="concept">
48264 <primary>DNS list</primary>
48265 <secondary>keyed by domain name</secondary>
48266 </indexterm>
48267 There are some lists that are keyed on domain names rather than inverted IP
48268 addresses (see for example the <emphasis>domain based zones</emphasis> link at
48269 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
48270 with these lists. You can change the name that is looked up in a DNS list by
48271 listing it after the domain name, introduced by a slash. For example,
48272 </para>
48273 <literallayout class="monospaced">
48274 deny  message  = Sender's domain is listed at $dnslist_domain
48275       dnslists = dsn.rfc-ignorant.org/$sender_address_domain
48276 </literallayout>
48277 <para>
48278 This particular example is useful only in ACLs that are obeyed after the
48279 RCPT or DATA commands, when a sender address is available. If (for
48280 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
48281 up by this example is
48282 </para>
48283 <literallayout class="monospaced">
48284 tld.example.dsn.rfc-ignorant.org
48285 </literallayout>
48286 <para>
48287 A single <option>dnslists</option> condition can contain entries for both names and IP
48288 addresses. For example:
48289 </para>
48290 <literallayout class="monospaced">
48291 deny dnslists = sbl.spamhaus.org : \
48292                 dsn.rfc-ignorant.org/$sender_address_domain
48293 </literallayout>
48294 <para>
48295 The first item checks the sending host&#x2019;s IP address; the second checks a domain
48296 name. The whole condition is true if either of the DNS lookups succeeds.
48297 </para>
48298 </section>
48299 <section id="SECTmulkeyfor">
48300 <title>Multiple explicit keys for a DNS list</title>
48301 <para>
48302 <indexterm role="concept">
48303 <primary>DNS list</primary>
48304 <secondary>multiple keys for</secondary>
48305 </indexterm>
48306 The syntax described above for looking up explicitly-defined values (either
48307 names or IP addresses) in a DNS blacklist is a simplification. After the domain
48308 name for the DNS list, what follows the slash can in fact be a list of items.
48309 As with all lists in Exim, the default separator is a colon. However, because
48310 this is a sublist within the list of DNS blacklist domains, it is necessary
48311 either to double the separators like this:
48312 </para>
48313 <literallayout class="monospaced">
48314 dnslists = black.list.tld/name.1::name.2
48315 </literallayout>
48316 <para>
48317 or to change the separator character, like this:
48318 </para>
48319 <literallayout class="monospaced">
48320 dnslists = black.list.tld/&lt;;name.1;name.2
48321 </literallayout>
48322 <para>
48323 If an item in the list is an IP address, it is inverted before the DNS
48324 blacklist domain is appended. If it is not an IP address, no inversion
48325 occurs. Consider this condition:
48326 </para>
48327 <literallayout class="monospaced">
48328 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
48329 </literallayout>
48330 <para>
48331 The DNS lookups that occur are:
48332 </para>
48333 <literallayout class="monospaced">
48334 2.1.168.192.black.list.tld
48335 a.domain.black.list.tld
48336 </literallayout>
48337 <para>
48338 Once a DNS record has been found (that matches a specific IP return
48339 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
48340 are done. If there is a temporary DNS error, the rest of the sublist of domains
48341 or IP addresses is tried. A temporary error for the whole dnslists item occurs
48342 only if no other DNS lookup in this sublist succeeds. In other words, a
48343 successful lookup for any of the items in the sublist overrides a temporary
48344 error for a previous item.
48345 </para>
48346 <para>
48347 The ability to supply a list of items after the slash is in some sense just a
48348 syntactic convenience. These two examples have the same effect:
48349 </para>
48350 <literallayout class="monospaced">
48351 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
48352 dnslists = black.list.tld/a.domain::b.domain
48353 </literallayout>
48354 <para>
48355 However, when the data for the list is obtained from a lookup, the second form
48356 is usually much more convenient. Consider this example:
48357 </para>
48358 <literallayout class="monospaced">
48359 deny message  = The mail servers for the domain \
48360                 $sender_address_domain \
48361                 are listed at $dnslist_domain ($dnslist_value); \
48362                 see $dnslist_text.
48363      dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
48364                                    ${lookup dnsdb {&gt;|mxh=\
48365                                    $sender_address_domain} }} }
48366 </literallayout>
48367 <para>
48368 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
48369 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
48370 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
48371 of expanding the condition might be something like this:
48372 </para>
48373 <literallayout class="monospaced">
48374 dnslists = sbl.spahmaus.org/&lt;|192.168.2.3|192.168.5.6|...
48375 </literallayout>
48376 <para>
48377 Thus, this example checks whether or not the IP addresses of the sender
48378 domain&#x2019;s mail servers are on the Spamhaus black list.
48379 </para>
48380 </section>
48381 <section>
48382 <title>Data returned by DNS lists</title>
48383 <para>
48384 <indexterm role="concept">
48385 <primary>DNS list</primary>
48386 <secondary>data returned from</secondary>
48387 </indexterm>
48388 DNS lists are constructed using address records in the DNS. The original RBL
48389 just used the address 127.0.0.1 on the right hand side of each record, but the
48390 RBL+ list and some other lists use a number of values with different meanings.
48391 The values used on the RBL+ list are:
48392 </para>
48393 <literallayout>
48394 127.1.0.1  RBL
48395 127.1.0.2  DUL
48396 127.1.0.3  DUL and RBL
48397 127.1.0.4  RSS
48398 127.1.0.5  RSS and RBL
48399 127.1.0.6  RSS and DUL
48400 127.1.0.7  RSS and DUL and RBL
48401 </literallayout>
48402 <para>
48403 Some DNS lists may return more than one address record.
48404 </para>
48405 </section>
48406 <section>
48407 <title>Variables set from DNS lists</title>
48408 <para>
48409 <indexterm role="concept">
48410 <primary>DNS list</primary>
48411 <secondary>variables set from</secondary>
48412 </indexterm>
48413 <indexterm role="concept">
48414 <primary><varname>$dnslist_domain</varname></primary>
48415 </indexterm>
48416 <indexterm role="concept">
48417 <primary><varname>$dnslist_text</varname></primary>
48418 </indexterm>
48419 <indexterm role="concept">
48420 <primary><varname>$dnslist_value</varname></primary>
48421 </indexterm>
48422 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname>
48423 contains the name of the domain that matched, <varname>$dnslist_value</varname> contains the
48424 data from the entry, and <varname>$dnslist_text</varname> contains the contents of any
48425 associated TXT record. If more than one address record is returned by the DNS
48426 lookup, all the IP addresses are included in <varname>$dnslist_value</varname>, separated by
48427 commas and spaces.
48428 </para>
48429 <para>
48430 You can use these variables in <option>message</option> or <option>log_message</option> modifiers &ndash;
48431 although these appear before the condition in the ACL, they are not expanded
48432 until after it has failed. For example:
48433 </para>
48434 <literallayout class="monospaced">
48435 deny    hosts = !+local_networks
48436         message = $sender_host_address is listed \
48437                   at $dnslist_domain
48438         dnslists = rbl-plus.mail-abuse.example
48439 </literallayout>
48440 </section>
48441 <section id="SECTaddmatcon">
48442 <title>Additional matching conditions for DNS lists</title>
48443 <para>
48444 <indexterm role="concept">
48445 <primary>DNS list</primary>
48446 <secondary>matching specific returned data</secondary>
48447 </indexterm>
48448 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
48449 in order to restrict its action to DNS records with a matching right hand side.
48450 For example,
48451 </para>
48452 <literallayout class="monospaced">
48453 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
48454 </literallayout>
48455 <para>
48456 rejects only those hosts that yield 127.0.0.2. Without this additional data,
48457 any address record is considered to be a match. If more than one address record
48458 is found on the list, they are all checked for a matching right-hand side.
48459 </para>
48460 <para>
48461 More than one IP address may be given for checking, using a comma as a
48462 separator. These are alternatives &ndash; if any one of them matches, the
48463 <option>dnslists</option> condition is true. For example:
48464 </para>
48465 <literallayout class="monospaced">
48466 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
48467 </literallayout>
48468 <para>
48469 If you want to specify a constraining address list and also specify names or IP
48470 addresses to be looked up, the constraining address list must be specified
48471 first. For example:
48472 </para>
48473 <literallayout class="monospaced">
48474 deny dnslists = dsn.rfc-ignorant.org\
48475                 =127.0.0.2/$sender_address_domain
48476 </literallayout>
48477 <para>
48478 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
48479 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
48480 In other words, the listed addresses are used as bit masks. The comparison is
48481 true if all the bits in the mask are present in the address that is being
48482 tested. For example:
48483 </para>
48484 <literallayout class="monospaced">
48485 dnslists = a.b.c&amp;0.0.0.3
48486 </literallayout>
48487 <para>
48488 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
48489 want to test whether one bit or another bit is present (as opposed to both
48490 being present), you must use multiple values. For example:
48491 </para>
48492 <literallayout class="monospaced">
48493 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
48494 </literallayout>
48495 <para>
48496 matches if the final component of the address is an odd number or two times
48497 an odd number.
48498 </para>
48499 </section>
48500 <section>
48501 <title>Negated DNS matching conditions</title>
48502 <para>
48503 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
48504 condition. Whereas
48505 </para>
48506 <literallayout class="monospaced">
48507 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
48508 </literallayout>
48509 <para>
48510 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48511 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
48512 </para>
48513 <literallayout class="monospaced">
48514 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
48515 </literallayout>
48516 <para>
48517 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
48518 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
48519 words, the result of the test is inverted if an exclamation mark appears before
48520 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
48521 </para>
48522 <para>
48523 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
48524 host, or address list (which is why the syntax is different).
48525 </para>
48526 <para>
48527 If you are using just one list, the negation syntax does not gain you much. The
48528 previous example is precisely equivalent to
48529 </para>
48530 <literallayout class="monospaced">
48531 deny  dnslists = a.b.c
48532      !dnslists = a.b.c=127.0.0.2,127.0.0.3
48533 </literallayout>
48534 <para>
48535 However, if you are using multiple lists, the negation syntax is clearer.
48536 Consider this example:
48537 </para>
48538 <literallayout class="monospaced">
48539 deny  dnslists = sbl.spamhaus.org : \
48540                  list.dsbl.org : \
48541                  dnsbl.njabl.org!=127.0.0.3 : \
48542                  relays.ordb.org
48543 </literallayout>
48544 <para>
48545 Using only positive lists, this would have to be:
48546 </para>
48547 <literallayout class="monospaced">
48548 deny  dnslists = sbl.spamhaus.org : \
48549                  list.dsbl.org
48550 deny  dnslists = dnsbl.njabl.org
48551      !dnslists = dnsbl.njabl.org=127.0.0.3
48552 deny  dnslists = relays.ordb.org
48553 </literallayout>
48554 <para>
48555 which is less clear, and harder to maintain.
48556 </para>
48557 </section>
48558 <section id="SECTmorednslistslast">
48559 <title>DNS lists and IPv6</title>
48560 <para>
48561 <indexterm role="concept">
48562 <primary>IPv6</primary>
48563 <secondary>DNS black lists</secondary>
48564 </indexterm>
48565 <indexterm role="concept">
48566 <primary>DNS list</primary>
48567 <secondary>IPv6 usage</secondary>
48568 </indexterm>
48569 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
48570 nibble by nibble. For example, if the calling host&#x2019;s IP address is
48571 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
48572 </para>
48573 <literallayout class="monospaced">
48574 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
48575   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
48576 </literallayout>
48577 <para>
48578 (split over two lines here to fit on the page). Unfortunately, some of the DNS
48579 lists contain wildcard records, intended for IPv4, that interact badly with
48580 IPv6. For example, the DNS entry
48581 </para>
48582 <literallayout class="monospaced">
48583 *.3.some.list.example.    A    127.0.0.1
48584 </literallayout>
48585 <para>
48586 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
48587 Unfortunately, it also matches the entire 3::/4 IPv6 network.
48588 </para>
48589 <para>
48590 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
48591 <option>condition</option> condition, as in this example:
48592 </para>
48593 <literallayout class="monospaced">
48594 deny   condition = ${if isip4{$sender_host_address}}
48595        dnslists  = some.list.example
48596 </literallayout>
48597 </section>
48598 <section id="SECTratelimiting">
48599 <title>Rate limiting senders</title>
48600 <para>
48601 <indexterm role="concept">
48602 <primary>rate limiting</primary>
48603 <secondary>client sending</secondary>
48604 </indexterm>
48605 <indexterm role="concept">
48606 <primary>limiting client sending rates</primary>
48607 </indexterm>
48608 <indexterm role="option">
48609 <primary><option>smpt_ratelimit_*</option></primary>
48610 </indexterm>
48611 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
48612 which clients can send email. This is more powerful than the
48613 <option>smtp_ratelimit_*</option> options, because those options control the rate of
48614 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
48615 works across all connections (concurrent and sequential) from the same client
48616 host. The syntax of the <option>ratelimit</option> condition is:
48617 </para>
48618 <literallayout>
48619 <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;
48620 </literallayout>
48621 <para>
48622 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
48623 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
48624 </para>
48625 <para>
48626 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
48627 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
48628 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
48629 of <emphasis>p</emphasis>.
48630 </para>
48631 <para>
48632 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
48633 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
48634 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
48635 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
48636 send in each time interval. It also specifies the number of messages permitted
48637 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
48638 constant, you can allow a client to send more messages in a burst without
48639 changing its overall sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
48640 both small, messages must be sent at an even rate.
48641 </para>
48642 <para>
48643 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
48644 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
48645 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
48646 instructions when it is run with no arguments.
48647 </para>
48648 <para>
48649 The key is used to look up the data for calculating the client&#x2019;s average
48650 sending rate. This data is stored in a database maintained by Exim in its spool
48651 directory, alongside the retry and other hints databases. The default key is
48652 <varname>$sender_host_address</varname>, which applies the limit to each client host IP address.
48653 By changing the key you can change how Exim identifies clients for the purpose
48654 of ratelimiting. For example, to limit the sending rate of each authenticated
48655 user, independent of the computer they are sending from, set the key to
48656 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
48657 example, <varname>$authenticated_id</varname> is only meaningful if the client has
48658 authenticated, and you can check with with the <option>authenticated</option> ACL condition.
48659 </para>
48660 <para>
48661 Internally, Exim includes the smoothing constant <emphasis>p</emphasis> and the options in the
48662 lookup key because they alter the meaning of the stored data. This is not true
48663 for the limit <emphasis>m</emphasis>, so you can alter the configured maximum rate and Exim will
48664 still remember clients&#x2019; past behaviour, but if you alter the other ratelimit
48665 parameters Exim forgets past behaviour.
48666 </para>
48667 <para>
48668 Each <option>ratelimit</option> condition can have up to two options. The first option
48669 specifies what Exim measures the rate of, and the second specifies how Exim
48670 handles excessively fast clients. The options are separated by a slash, like
48671 the other parameters.
48672 </para>
48673 <para>
48674 The <option>per_conn</option> option limits the client&#x2019;s connection rate.
48675 </para>
48676 <para>
48677 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
48678 the default if none of the <option>per_*</option> options is specified.
48679 </para>
48680 <para>
48681 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. Note that it is
48682 best to use this option in the DATA ACL; if it is used in an earlier ACL it
48683 relies on the SIZE parameter on the MAIL command, which may be inaccurate or
48684 completely missing. You can follow the limit <emphasis>m</emphasis> in the configuration with K,
48685 M, or G to specify limits in kilobytes, megabytes, or gigabytes, respectively.
48686 </para>
48687 <para>
48688 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
48689 condition is processed. This can be used to limit the SMTP command rate. The
48690 alias <option>per_rcpt</option> is provided for use in the RCPT ACL instead of <option>per_cmd</option>
48691 to make it clear that the effect is to limit the rate at which recipients are
48692 accepted. Note that in this case the rate limiting engine will see a message
48693 with many recipients as a large high-speed burst.
48694 </para>
48695 <para>
48696 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
48697 engine can react in two possible ways, depending on the presence of the
48698 <option>strict</option> or <option>leaky</option> options. This is independent of the other
48699 counter-measures (such as rejecting the message) that may be specified by the
48700 rest of the ACL. The default mode is leaky, which avoids a sender&#x2019;s
48701 over-aggressive retry rate preventing it from getting any email through.
48702 </para>
48703 <para>
48704 The <option>strict</option> option means that the client&#x2019;s recorded rate is always updated.
48705 The effect of this is that Exim measures the client&#x2019;s average rate of attempts
48706 to send email, which can be much higher than the maximum. If the client is over
48707 the limit it will be subjected to counter-measures until it slows down below
48708 the maximum rate. The smoothing period determines the time it takes for a high
48709 sending rate to decay exponentially to 37% of its peak value, which means that
48710 you can work out the time (the number of smoothing periods) that a client is
48711 subjected to counter-measures after an over-limit burst with this formula:
48712 </para>
48713 <literallayout class="monospaced">
48714 ln(peakrate/maxrate)
48715 </literallayout>
48716 <para>
48717 The <option>leaky</option> option means that the client&#x2019;s recorded rate is not updated if it
48718 is above the limit. The effect of this is that Exim measures the client&#x2019;s
48719 average rate of successfully sent email, which cannot be greater than the
48720 maximum. If the client is over the limit it will suffer some counter-measures,
48721 but it will still be able to send email at the configured maximum rate,
48722 whatever the rate of its attempts. This is generally the better choice if you
48723 have clients that retry automatically.
48724 </para>
48725 <para>
48726 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
48727 when the rate limit is exceeded. This might be anything from logging a warning
48728 (for example, while measuring existing sending rates in order to define
48729 policy), through time delays to slow down fast senders, up to rejecting the
48730 message. For example:
48731 </para>
48732 <literallayout class="monospaced">
48733 # Log all senders' rates
48734 warn ratelimit = 0 / 1h / strict
48735      log_message = Sender rate $sender_rate / $sender_rate_period
48736
48737 # Slow down fast senders; note the need to truncate $sender_rate
48738 # at the decimal point.
48739 warn ratelimit = 100 / 1h / per_rcpt / strict
48740      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
48741                    $sender_rate_limit }s
48742
48743 # Keep authenticated users under control
48744 deny authenticated = *
48745      ratelimit = 100 / 1d / strict / $authenticated_id
48746
48747 # System-wide rate limit
48748 defer message = Sorry, too busy. Try again later.
48749      ratelimit = 10 / 1s / $primary_hostname
48750
48751 # Restrict incoming rate from each host, with a default
48752 # set using a macro and special cases looked up in a table.
48753 defer message = Sender rate exceeds $sender_rate_limit \
48754                messages per $sender_rate_period
48755      ratelimit = ${lookup {$sender_host_address} \
48756                    cdb {DB/ratelimits.cdb} \
48757                    {$value} {RATELIMIT} }
48758 </literallayout>
48759 <para>
48760 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
48761 especially with the <option>per_rcpt</option> option, you may suffer from a performance
48762 bottleneck caused by locking on the ratelimit hints database. Apart from
48763 making your ACLs less complicated, you can reduce the problem by using a
48764 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
48765 this means that Exim will lose its hints data after a reboot (including retry
48766 hints, the callout cache, and ratelimit data).
48767 </para>
48768 </section>
48769 <section id="SECTaddressverification">
48770 <title>Address verification</title>
48771 <para>
48772 <indexterm role="concept">
48773 <primary>verifying address</primary>
48774 <secondary>options for</secondary>
48775 </indexterm>
48776 <indexterm role="concept">
48777 <primary>policy control</primary>
48778 <secondary>address verification</secondary>
48779 </indexterm>
48780 Several of the <option>verify</option> conditions described in section
48781 <xref linkend="SECTaclconditions"/> cause addresses to be verified. These conditions can be
48782 followed by options that modify the verification process. The options are
48783 separated from the keyword and from each other by slashes, and some of them
48784 contain parameters. For example:
48785 </para>
48786 <literallayout class="monospaced">
48787 verify = sender/callout
48788 verify = recipient/defer_ok/callout=10s,defer_ok
48789 </literallayout>
48790 <para>
48791 The first stage of address verification, which always happens, is to run the
48792 address through the routers, in <quote>verify mode</quote>. Routers can detect the
48793 difference between verification and routing for delivery, and their actions can
48794 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
48795 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
48796 The available options are as follows:
48797 </para>
48798 <itemizedlist>
48799 <listitem>
48800 <para>
48801 If the <option>callout</option> option is specified, successful routing to one or more
48802 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
48803 check. Callouts and their sub-options are discussed in the next section.
48804 </para>
48805 </listitem>
48806 <listitem>
48807 <para>
48808 If there is a defer error while doing verification routing, the ACL
48809 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
48810 options, the condition is forced to be true instead. Note that this is a main
48811 verification option as well as a suboption for callouts.
48812 </para>
48813 </listitem>
48814 <listitem>
48815 <para>
48816 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
48817 discusses the reporting of sender address verification failures.
48818 </para>
48819 </listitem>
48820 <listitem>
48821 <para>
48822 The <option>success_on_redirect</option> option causes verification always to succeed
48823 immediately after a successful redirection. By default, if a redirection
48824 generates just one address, that address is also verified. See further
48825 discussion in section <xref linkend="SECTredirwhilveri"/>.
48826 </para>
48827 </listitem>
48828 </itemizedlist>
48829 <para>
48830 <indexterm role="concept">
48831 <primary>verifying address</primary>
48832 <secondary>differentiating failures</secondary>
48833 </indexterm>
48834 <indexterm role="concept">
48835 <primary><varname>$recipient_verify_failure</varname></primary>
48836 </indexterm>
48837 <indexterm role="concept">
48838 <primary><varname>$sender_verify_failure</varname></primary>
48839 </indexterm>
48840 <indexterm role="concept">
48841 <primary><varname>$acl_verify_message</varname></primary>
48842 </indexterm>
48843 After an address verification failure, <varname>$acl_verify_message</varname> contains the
48844 error message that is associated with the failure. It can be preserved by
48845 coding like this:
48846 </para>
48847 <literallayout class="monospaced">
48848 warn  !verify = sender
48849        set acl_m0 = $acl_verify_message
48850 </literallayout>
48851 <para>
48852 If you are writing your own custom rejection message or log message when
48853 denying access, you can use this variable to include information about the
48854 verification failure.
48855 </para>
48856 <para>
48857 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
48858 appropriate) contains one of the following words:
48859 </para>
48860 <itemizedlist>
48861 <listitem>
48862 <para>
48863 <option>qualify</option>: The address was unqualified (no domain), and the message
48864 was neither local nor came from an exempted host.
48865 </para>
48866 </listitem>
48867 <listitem>
48868 <para>
48869 <option>route</option>: Routing failed.
48870 </para>
48871 </listitem>
48872 <listitem>
48873 <para>
48874 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
48875 occurred at or before the MAIL command (that is, on initial
48876 connection, HELO, or MAIL).
48877 </para>
48878 </listitem>
48879 <listitem>
48880 <para>
48881 <option>recipient</option>: The RCPT command in a callout was rejected.
48882 </para>
48883 </listitem>
48884 <listitem>
48885 <para>
48886 <option>postmaster</option>: The postmaster check in a callout was rejected.
48887 </para>
48888 </listitem>
48889 </itemizedlist>
48890 <para>
48891 The main use of these variables is expected to be to distinguish between
48892 rejections of MAIL and rejections of RCPT in callouts.
48893 </para>
48894 </section>
48895 <section id="SECTcallver">
48896 <title>Callout verification</title>
48897 <para>
48898 <indexterm role="concept">
48899 <primary>verifying address</primary>
48900 <secondary>by callout</secondary>
48901 </indexterm>
48902 <indexterm role="concept">
48903 <primary>callout</primary>
48904 <secondary>verification</secondary>
48905 </indexterm>
48906 <indexterm role="concept">
48907 <primary>SMTP</primary>
48908 <secondary>callout verification</secondary>
48909 </indexterm>
48910 For non-local addresses, routing verifies the domain, but is unable to do any
48911 checking of the local part. There are situations where some means of verifying
48912 the local part is desirable. One way this can be done is to make an SMTP
48913 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
48914 a subsequent host for a recipient address, to see if the host accepts the
48915 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
48916 sender address, the callback is not to the client host that is trying to
48917 deliver the message, but to one of the hosts that accepts incoming mail for the
48918 sender&#x2019;s domain.
48919 </para>
48920 <para>
48921 Exim does not do callouts by default. If you want them to happen, you must
48922 request them by setting appropriate options on the <option>verify</option> condition, as
48923 described below. This facility should be used with care, because it can add a
48924 lot of resource usage to the cost of verifying an address. However, Exim does
48925 cache the results of callouts, which helps to reduce the cost. Details of
48926 caching are in section <xref linkend="SECTcallvercache"/>.
48927 </para>
48928 <para>
48929 Recipient callouts are usually used only between hosts that are controlled by
48930 the same administration. For example, a corporate gateway host could use
48931 callouts to check for valid recipients on an internal mailserver. A successful
48932 callout does not guarantee that a real delivery to the address would succeed;
48933 on the other hand, a failing callout does guarantee that a delivery would fail.
48934 </para>
48935 <para>
48936 If the <option>callout</option> option is present on a condition that verifies an address, a
48937 second stage of verification occurs if the address is successfully routed to
48938 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
48939 <command>manualroute</command> router, where the router specifies the hosts. However, if a
48940 router that does not set up hosts routes to an <command>smtp</command> transport with a
48941 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
48942 <option>hosts_override</option> set, its hosts are always used, whether or not the router
48943 supplies a host list.
48944 </para>
48945 <para>
48946 The port that is used is taken from the transport, if it is specified and is a
48947 remote transport. (For routers that do verification only, no transport need be
48948 specified.) Otherwise, the default SMTP port is used. If a remote transport
48949 specifies an outgoing interface, this is used; otherwise the interface is not
48950 specified.
48951 </para>
48952 <para>
48953 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
48954 test whether a bounce message could be delivered to the sender address. The
48955 following SMTP commands are sent:
48956 </para>
48957 <literallayout>
48958 <literal>HELO </literal>&lt;<emphasis>smtp active host name</emphasis>&gt;
48959 <literal>MAIL FROM:&lt;&gt;</literal>
48960 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
48961 <literal>QUIT</literal>
48962 </literallayout>
48963 <para>
48964 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
48965 set to <quote>lmtp</quote>.
48966 </para>
48967 <para>
48968 A recipient callout check is similar. By default, it also uses an empty address
48969 for the sender. This default is chosen because most hosts do not make use of
48970 the sender address when verifying a recipient. Using the same address means
48971 that a single cache entry can be used for each recipient. Some sites, however,
48972 do make use of the sender address when verifying. These are catered for by the
48973 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
48974 </para>
48975 <para>
48976 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
48977 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
48978 Exim tries the next host, if any. If there is a problem with all the remote
48979 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
48980 <option>callout</option> option is given, in which case the condition is forced to succeed.
48981 </para>
48982 </section>
48983 <section id="CALLaddparcall">
48984 <title>Additional parameters for callouts</title>
48985 <para>
48986 <indexterm role="concept">
48987 <primary>callout</primary>
48988 <secondary>additional parameters for</secondary>
48989 </indexterm>
48990 The <option>callout</option> option can be followed by an equals sign and a number of
48991 optional parameters, separated by commas. For example:
48992 </para>
48993 <literallayout class="monospaced">
48994 verify = recipient/callout=10s,defer_ok
48995 </literallayout>
48996 <para>
48997 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
48998 separate verify options, is retained for backwards compatibility, but is now
48999 deprecated. The additional parameters for <option>callout</option> are as follows:
49000 </para>
49001 <variablelist>
49002 <varlistentry>
49003 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
49004 <listitem>
49005 <para>
49006 <indexterm role="concept">
49007 <primary>callout timeout</primary>
49008 <secondary>specifying</secondary>
49009 </indexterm>
49010 This specifies the timeout that applies for the callout attempt to each host.
49011 For example:
49012 </para>
49013 <literallayout class="monospaced">
49014 verify = sender/callout=5s
49015 </literallayout>
49016 <para>
49017 The default is 30 seconds. The timeout is used for each response from the
49018 remote host. It is also used for the intial connection, unless overridden by
49019 the <option>connect</option> parameter.
49020 </para>
49021 </listitem></varlistentry>
49022 <varlistentry>
49023 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
49024 <listitem>
49025 <para>
49026 <indexterm role="concept">
49027 <primary>callout connection timeout</primary>
49028 <secondary>specifying</secondary>
49029 </indexterm>
49030 This parameter makes it possible to set a different (usually smaller) timeout
49031 for making the SMTP connection. For example:
49032 </para>
49033 <literallayout class="monospaced">
49034 verify = sender/callout=5s,connect=1s
49035 </literallayout>
49036 <para>
49037 If not specified, this timeout defaults to the general timeout value.
49038 </para>
49039 </listitem></varlistentry>
49040 <varlistentry>
49041 <term><emphasis role="bold">defer_ok</emphasis></term>
49042 <listitem>
49043 <para>
49044 <indexterm role="concept">
49045 <primary>callout defer</primary>
49046 <secondary>action on</secondary>
49047 </indexterm>
49048 When this parameter is present, failure to contact any host, or any other kind
49049 of temporary error, is treated as success by the ACL. However, the cache is not
49050 updated in this circumstance.
49051 </para>
49052 </listitem></varlistentry>
49053 <varlistentry>
49054 <term><emphasis role="bold">fullpostmaster</emphasis></term>
49055 <listitem>
49056 <para>
49057 <indexterm role="concept">
49058 <primary>callout</primary>
49059 <secondary>full postmaster check</secondary>
49060 </indexterm>
49061 This operates like the <option>postmaster</option> option (see below), but if the check for
49062 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
49063 accordance with the specification in RFC 2821. The RFC states that the
49064 unqualified address <emphasis>postmaster</emphasis> should be accepted.
49065 </para>
49066 </listitem></varlistentry>
49067 <varlistentry>
49068 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
49069 <listitem>
49070 <para>
49071 <indexterm role="concept">
49072 <primary>callout</primary>
49073 <secondary>sender when verifying header</secondary>
49074 </indexterm>
49075 When verifying addresses in header lines using the <option>header_sender</option>
49076 verification option, Exim behaves by default as if the addresses are envelope
49077 sender addresses from a message. Callout verification therefore tests to see
49078 whether a bounce message could be delivered, by using an empty address in the
49079 MAIL command. However, it is arguable that these addresses might never be used
49080 as envelope senders, and could therefore justifiably reject bounce messages
49081 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
49082 address to use in the MAIL command. For example:
49083 </para>
49084 <literallayout class="monospaced">
49085 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
49086 </literallayout>
49087 <para>
49088 This parameter is available only for the <option>header_sender</option> verification option.
49089 </para>
49090 </listitem></varlistentry>
49091 <varlistentry>
49092 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
49093 <listitem>
49094 <para>
49095 <indexterm role="concept">
49096 <primary>callout overall timeout</primary>
49097 <secondary>specifying</secondary>
49098 </indexterm>
49099 This parameter sets an overall timeout for performing a callout verification.
49100 For example:
49101 </para>
49102 <literallayout class="monospaced">
49103 verify = sender/callout=5s,maxwait=30s
49104 </literallayout>
49105 <para>
49106 This timeout defaults to four times the callout timeout for individual SMTP
49107 commands. The overall timeout applies when there is more than one host that can
49108 be tried. The timeout is checked before trying the next host. This prevents
49109 very long delays if there are a large number of hosts and all are timing out
49110 (for example, when network connections are timing out).
49111 </para>
49112 </listitem></varlistentry>
49113 <varlistentry>
49114 <term><emphasis role="bold">no_cache</emphasis></term>
49115 <listitem>
49116 <para>
49117 <indexterm role="concept">
49118 <primary>callout cache</primary>
49119 <secondary>suppressing</secondary>
49120 </indexterm>
49121 <indexterm role="concept">
49122 <primary>caching callout</primary>
49123 <secondary>suppressing</secondary>
49124 </indexterm>
49125 When this parameter is given, the callout cache is neither read nor updated.
49126 </para>
49127 </listitem></varlistentry>
49128 <varlistentry>
49129 <term><emphasis role="bold">postmaster</emphasis></term>
49130 <listitem>
49131 <para>
49132 <indexterm role="concept">
49133 <primary>callout</primary>
49134 <secondary>postmaster; checking</secondary>
49135 </indexterm>
49136 When this parameter is set, a sucessful callout check is followed by a similar
49137 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
49138 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
49139 the postmaster check is recorded in a cache record; if it is a failure, this is
49140 used to fail subsequent callouts for the domain without a connection being
49141 made, until the cache record expires.
49142 </para>
49143 </listitem></varlistentry>
49144 <varlistentry>
49145 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
49146 <listitem>
49147 <para>
49148 The postmaster check uses an empty sender in the MAIL command by default.
49149 You can use this parameter to do a postmaster check using a different address.
49150 For example:
49151 </para>
49152 <literallayout class="monospaced">
49153 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
49154 </literallayout>
49155 <para>
49156 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
49157 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
49158 </para>
49159 <literallayout class="monospaced">
49160 require  verify = sender/callout=postmaster_mailfrom=
49161 </literallayout>
49162 <para>
49163 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
49164 account of the sender address. It is assumed that either the empty address or
49165 a fixed non-empty address will be used. All that Exim remembers is that the
49166 postmaster check for the domain succeeded or failed.
49167 </para>
49168 </listitem></varlistentry>
49169 <varlistentry>
49170 <term><emphasis role="bold">random</emphasis></term>
49171 <listitem>
49172 <para>
49173 <indexterm role="concept">
49174 <primary>callout</primary>
49175 <secondary><quote>random</quote> check</secondary>
49176 </indexterm>
49177 When this parameter is set, before doing the normal callout check, Exim does a
49178 check for a <quote>random</quote> local part at the same domain. The local part is not
49179 really random &ndash; it is defined by the expansion of the option
49180 <option>callout_random_local_part</option>, which defaults to
49181 </para>
49182 <literallayout class="monospaced">
49183 $primary_host_name-$tod_epoch-testing
49184 </literallayout>
49185 <para>
49186 The idea here is to try to determine whether the remote host accepts all local
49187 parts without checking. If it does, there is no point in doing callouts for
49188 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
49189 a cache record, and used to force the current and subsequent callout checks to
49190 succeed without a connection being made, until the cache record expires.
49191 </para>
49192 </listitem></varlistentry>
49193 <varlistentry>
49194 <term><emphasis role="bold">use_postmaster</emphasis></term>
49195 <listitem>
49196 <para>
49197 <indexterm role="concept">
49198 <primary>callout</primary>
49199 <secondary>sender for recipient check</secondary>
49200 </indexterm>
49201 This parameter applies to recipient callouts only. For example:
49202 </para>
49203 <literallayout class="monospaced">
49204 deny  !verify = recipient/callout=use_postmaster
49205 </literallayout>
49206 <para>
49207 <indexterm role="concept">
49208 <primary><varname>$qualify_domain</varname></primary>
49209 </indexterm>
49210 It causes a non-empty postmaster address to be used in the MAIL command when
49211 performing the callout for the recipient, and also for a <quote>random</quote> check if
49212 that is configured. The local part of the address is <literal>postmaster</literal> and the
49213 domain is the contents of <varname>$qualify_domain</varname>.
49214 </para>
49215 </listitem></varlistentry>
49216 <varlistentry>
49217 <term><emphasis role="bold">use_sender</emphasis></term>
49218 <listitem>
49219 <para>
49220 This option applies to recipient callouts only. For example:
49221 </para>
49222 <literallayout class="monospaced">
49223 require  verify = recipient/callout=use_sender
49224 </literallayout>
49225 <para>
49226 It causes the message&#x2019;s actual sender address to be used in the MAIL
49227 command when performing the callout, instead of an empty address. There is no
49228 need to use this option unless you know that the called hosts make use of the
49229 sender when checking recipients. If used indiscriminately, it reduces the
49230 usefulness of callout caching.
49231 </para>
49232 </listitem></varlistentry>
49233 </variablelist>
49234 <para>
49235 If you use any of the parameters that set a non-empty sender for the MAIL
49236 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
49237 <option>use_sender</option>), you should think about possible loops. Recipient checking is
49238 usually done between two hosts that are under the same management, and the host
49239 that receives the callouts is not normally configured to do callouts itself.
49240 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
49241 these circumstances.
49242 </para>
49243 <para>
49244 However, if you use a non-empty sender address for a callout to an arbitrary
49245 host, there is the likelihood that the remote host will itself initiate a
49246 callout check back to your host. As it is checking what appears to be a message
49247 sender, it is likely to use an empty address in MAIL, thus avoiding a
49248 callout loop. However, to be on the safe side it would be best to set up your
49249 own ACLs so that they do not do sender verification checks when the recipient
49250 is the address you use for header sender or postmaster callout checking.
49251 </para>
49252 <para>
49253 Another issue to think about when using non-empty senders for callouts is
49254 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
49255 by the sender/recipient combination; thus, for any given recipient, many more
49256 actual callouts are performed than when an empty sender or postmaster is used.
49257 </para>
49258 </section>
49259 <section id="SECTcallvercache">
49260 <title>Callout caching</title>
49261 <para>
49262 <indexterm role="concept">
49263 <primary>hints database</primary>
49264 <secondary>callout cache</secondary>
49265 </indexterm>
49266 <indexterm role="concept">
49267 <primary>callout</primary>
49268 <secondary>caching</secondary>
49269 </indexterm>
49270 <indexterm role="concept">
49271 <primary>caching</primary>
49272 <secondary>callout</secondary>
49273 </indexterm>
49274 Exim caches the results of callouts in order to reduce the amount of resources
49275 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
49276 option. A hints database called <quote>callout</quote> is used for the cache. Two
49277 different record types are used: one records the result of a callout check for
49278 a specific address, and the other records information that applies to the
49279 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
49280 </para>
49281 <para>
49282 When an original callout fails, a detailed SMTP error message is given about
49283 the failure. However, for subsequent failures use the cache data, this message
49284 is not available.
49285 </para>
49286 <para>
49287 The expiry times for negative and positive address cache records are
49288 independent, and can be set by the global options <option>callout_negative_expire</option>
49289 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
49290 </para>
49291 <para>
49292 If a host gives a negative response to an SMTP connection, or rejects any
49293 commands up to and including
49294 </para>
49295 <literallayout class="monospaced">
49296 MAIL FROM:&lt;&gt;
49297 </literallayout>
49298 <para>
49299 (but not including the MAIL command with a non-empty address),
49300 any callout attempt is bound to fail. Exim remembers such failures in a
49301 domain cache record, which it uses to fail callouts for the domain without
49302 making new connections, until the domain record times out. There are two
49303 separate expiry times for domain cache records:
49304 <option>callout_domain_negative_expire</option> (default 3h) and
49305 <option>callout_domain_positive_expire</option> (default 7d).
49306 </para>
49307 <para>
49308 Domain records expire when the negative expiry time is reached if callouts
49309 cannot be made for the domain, or if the postmaster check failed.
49310 Otherwise, they expire when the positive expiry time is reached. This
49311 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
49312 will eventually be noticed.
49313 </para>
49314 <para>
49315 The callout caching mechanism is based on the domain of the address that is
49316 being tested. If the domain routes to several hosts, it is assumed that their
49317 behaviour will be the same.
49318 </para>
49319 </section>
49320 <section id="SECTsenaddver">
49321 <title>Sender address verification reporting</title>
49322 <para>
49323 <indexterm role="concept">
49324 <primary>verifying</primary>
49325 <secondary>suppressing error details</secondary>
49326 </indexterm>
49327 When sender verification fails in an ACL, the details of the failure are
49328 given as additional output lines before the 550 response to the relevant
49329 SMTP command (RCPT or DATA). For example, if sender callout is in use,
49330 you might see:
49331 </para>
49332 <literallayout class="monospaced">
49333 MAIL FROM:&lt;xyz@abc.example&gt;
49334 250 OK
49335 RCPT TO:&lt;pqr@def.example&gt;
49336 550-Verification failed for &lt;xyz@abc.example&gt;
49337 550-Called:   192.168.34.43
49338 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
49339 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
49340 550 Sender verification failed
49341 </literallayout>
49342 <para>
49343 If more than one RCPT command fails in the same way, the details are given
49344 only for the first of them. However, some administrators do not want to send
49345 out this much information. You can suppress the details by adding
49346 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
49347 example:
49348 </para>
49349 <literallayout class="monospaced">
49350 verify = sender/no_details
49351 </literallayout>
49352 </section>
49353 <section id="SECTredirwhilveri">
49354 <title>Redirection while verifying</title>
49355 <para>
49356 <indexterm role="concept">
49357 <primary>verifying</primary>
49358 <secondary>redirection while</secondary>
49359 </indexterm>
49360 <indexterm role="concept">
49361 <primary>address redirection</primary>
49362 <secondary>while verifying</secondary>
49363 </indexterm>
49364 A dilemma arises when a local address is redirected by aliasing or forwarding
49365 during verification: should the generated addresses themselves be verified,
49366 or should the successful expansion of the original address be enough to verify
49367 it? By default, Exim takes the following pragmatic approach:
49368 </para>
49369 <itemizedlist>
49370 <listitem>
49371 <para>
49372 When an incoming address is redirected to just one child address, verification
49373 continues with the child address, and if that fails to verify, the original
49374 verification also fails.
49375 </para>
49376 </listitem>
49377 <listitem>
49378 <para>
49379 When an incoming address is redirected to more than one child address,
49380 verification does not continue. A success result is returned.
49381 </para>
49382 </listitem>
49383 </itemizedlist>
49384 <para>
49385 This seems the most reasonable behaviour for the common use of aliasing as a
49386 way of redirecting different local parts to the same mailbox. It means, for
49387 example, that a pair of alias entries of the form
49388 </para>
49389 <literallayout class="monospaced">
49390 A.Wol:   aw123
49391 aw123:   :fail: Gone away, no forwarding address
49392 </literallayout>
49393 <para>
49394 work as expected, with both local parts causing verification failure. When a
49395 redirection generates more than one address, the behaviour is more like a
49396 mailing list, where the existence of the alias itself is sufficient for
49397 verification to succeed.
49398 </para>
49399 <para>
49400 It is possible, however, to change the default behaviour so that all successful
49401 redirections count as successful verifications, however many new addresses are
49402 generated. This is specified by the <option>success_on_redirect</option> verification
49403 option. For example:
49404 </para>
49405 <literallayout class="monospaced">
49406 require verify = recipient/success_on_redirect/callout=10s
49407 </literallayout>
49408 <para>
49409 In this example, verification succeeds if a router generates a new address, and
49410 the callout does not occur, because no address was routed to a remote host.
49411 </para>
49412 </section>
49413 <section id="SECTverifyCSA">
49414 <title>Client SMTP authorization (CSA)</title>
49415 <para>
49416 <indexterm role="concept">
49417 <primary>CSA</primary>
49418 <secondary>verifying</secondary>
49419 </indexterm>
49420 Client SMTP Authorization is a system that allows a site to advertise
49421 which machines are and are not permitted to send email. This is done by placing
49422 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
49423 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
49424 Authorization checks in Exim are performed by the ACL condition:
49425 </para>
49426 <literallayout class="monospaced">
49427 verify = csa
49428 </literallayout>
49429 <para>
49430 This fails if the client is not authorized. If there is a DNS problem, or if no
49431 valid CSA SRV record is found, or if the client is authorized, the condition
49432 succeeds. These three cases can be distinguished using the expansion variable
49433 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
49434 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
49435 be likely to cause problems for legitimate email.
49436 </para>
49437 <para>
49438 The error messages produced by the CSA code include slightly more
49439 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
49440 looking up the CSA SRV record, or problems looking up the CSA target
49441 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
49442 </para>
49443 <itemizedlist>
49444 <listitem>
49445 <para>
49446 The client&#x2019;s host name is explicitly not authorized.
49447 </para>
49448 </listitem>
49449 <listitem>
49450 <para>
49451 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
49452 </para>
49453 </listitem>
49454 <listitem>
49455 <para>
49456 The client&#x2019;s host name is authorized but it has no valid target IP addresses
49457 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
49458 </para>
49459 </listitem>
49460 <listitem>
49461 <para>
49462 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
49463 that all subdomains must be explicitly authorized.
49464 </para>
49465 </listitem>
49466 </itemizedlist>
49467 <para>
49468 The <option>csa</option> verification condition can take an argument which is the domain to
49469 use for the DNS query. The default is:
49470 </para>
49471 <literallayout class="monospaced">
49472 verify = csa/$sender_helo_name
49473 </literallayout>
49474 <para>
49475 This implementation includes an extension to CSA. If the query domain
49476 is an address literal such as [192.0.2.95], or if it is a bare IP
49477 address, Exim searches for CSA SRV records in the reverse DNS as if
49478 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
49479 meaningful to say:
49480 </para>
49481 <literallayout class="monospaced">
49482 verify = csa/$sender_host_address
49483 </literallayout>
49484 <para>
49485 In fact, this is the check that Exim performs if the client does not say HELO.
49486 This extension can be turned off by setting the main configuration option
49487 <option>dns_csa_use_reverse</option> to be false.
49488 </para>
49489 <para>
49490 If a CSA SRV record is not found for the domain itself, a search
49491 is performed through its parent domains for a record which might be
49492 making assertions about subdomains. The maximum depth of this search is limited
49493 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
49494 default. Exim does not look for CSA SRV records in a top level domain, so the
49495 default settings handle HELO domains as long as seven
49496 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
49497 of legitimate HELO domains.
49498 </para>
49499 <para>
49500 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
49501 direct SRV lookups, this is not sufficient because of the extra parent domain
49502 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
49503 addresses into lookups in the reverse DNS space. The result of a successful
49504 lookup such as:
49505 </para>
49506 <literallayout class="monospaced">
49507 ${lookup dnsdb {csa=$sender_helo_name}}
49508 </literallayout>
49509 <para>
49510 has two space-separated fields: an authorization code and a target host name.
49511 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
49512 authorization required but absent, or <quote>?</quote> for unknown.
49513 </para>
49514 </section>
49515 <section id="SECTverifyPRVS">
49516 <title>Bounce address tag validation</title>
49517 <para>
49518 <indexterm role="concept">
49519 <primary>BATV</primary>
49520 <secondary>verifying</secondary>
49521 </indexterm>
49522 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
49523 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
49524 Genuine incoming bounce messages should therefore always be addressed to
49525 recipients that have a valid tag. This scheme is a way of detecting unwanted
49526 bounce messages caused by sender address forgeries (often called <quote>collateral
49527 spam</quote>), because the recipients of such messages do not include valid tags.
49528 </para>
49529 <para>
49530 There are two expansion items to help with the implementation of the BATV
49531 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
49532 the original envelope sender address by using a simple key to add a hash of the
49533 address and some time-based randomizing information. The <option>prvs</option> expansion
49534 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
49535 The syntax of these expansion items is described in section
49536 <xref linkend="SECTexpansionitems"/>.
49537 </para>
49538 <para>
49539 As an example, suppose the secret per-address keys are stored in an MySQL
49540 database. A query to look up the key for an address could be defined as a macro
49541 like this:
49542 </para>
49543 <literallayout class="monospaced">
49544 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
49545                 WHERE sender='${quote_mysql:$prvscheck_address}'\
49546                 }{$value}}
49547 </literallayout>
49548 <para>
49549 Suppose also that the senders who make use of BATV are defined by an address
49550 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
49551 use this:
49552 </para>
49553 <literallayout class="monospaced">
49554 # Bounces: drop unsigned addresses for BATV senders
49555 deny message = This address does not send an unsigned reverse path.
49556      senders = :
49557      recipients = +batv_senders
49558
49559 # Bounces: In case of prvs-signed address, check signature.
49560 deny message = Invalid reverse path signature.
49561      senders = :
49562      condition  = ${prvscheck {$local_part@$domain}\
49563                   {PRVSCHECK_SQL}{1}}
49564      !condition = $prvscheck_result
49565 </literallayout>
49566 <para>
49567 The first statement rejects recipients for bounce messages that are addressed
49568 to plain BATV sender addresses, because it is known that BATV senders do not
49569 send out messages with plain sender addresses. The second statement rejects
49570 recipients that are prvs-signed, but with invalid signatures (either because
49571 the key is wrong, or the signature has timed out).
49572 </para>
49573 <para>
49574 A non-prvs-signed address is not rejected by the second statement, because the
49575 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
49576 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
49577 the first argument is a syntactically valid prvs-signed address, the yield is
49578 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
49579 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
49580 of the checks (empty for failure, <quote>1</quote> for success).
49581 </para>
49582 <para>
49583 There are two more issues you must consider when implementing prvs-signing.
49584 Firstly, you need to ensure that prvs-signed addresses are not blocked by your
49585 ACLs. A prvs-signed address contains a slash character, but the default Exim
49586 configuration contains this statement in the RCPT ACL:
49587 </para>
49588 <literallayout class="monospaced">
49589 deny    message       = Restricted characters in address
49590         domains       = +local_domains
49591         local_parts   = ^[.] : ^.*[@%!/|]
49592 </literallayout>
49593 <para>
49594 This is a conservative rule that blocks local parts that contain slashes. You
49595 should remove the slash in the last line.
49596 </para>
49597 <para>
49598 Secondly, you have to ensure that the routers accept prvs-signed addresses and
49599 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
49600 router to remove the signature with a configuration along these lines:
49601 </para>
49602 <literallayout class="monospaced">
49603 batv_redirect:
49604   driver = redirect
49605   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
49606 </literallayout>
49607 <para>
49608 This works because, if the third argument of <option>prvscheck</option> is empty, the result
49609 of the expansion of a prvs-signed address is the decoded value of the original
49610 address. This router should probably be the first of your routers that handles
49611 local addresses.
49612 </para>
49613 <para>
49614 To create BATV-signed addresses in the first place, a transport of this form
49615 can be used:
49616 </para>
49617 <literallayout class="monospaced">
49618 external_smtp_batv:
49619   driver = smtp
49620   return_path = ${prvs {$return_path} \
49621                        {${lookup mysql{SELECT \
49622                        secret FROM batv_prvs WHERE \
49623                        sender='${quote_mysql:$sender_address}'} \
49624                        {$value}fail}}}
49625 </literallayout>
49626 <para>
49627 If no key can be found for the existing return path, no signing takes place.
49628 </para>
49629 </section>
49630 <section id="SECTrelaycontrol">
49631 <title>Using an ACL to control relaying</title>
49632 <para>
49633 <indexterm role="concept">
49634 <primary>access control lists (ACLs)</primary>
49635 <secondary>relay control</secondary>
49636 </indexterm>
49637 <indexterm role="concept">
49638 <primary>relaying</primary>
49639 <secondary>control by ACL</secondary>
49640 </indexterm>
49641 <indexterm role="concept">
49642 <primary>policy control</primary>
49643 <secondary>relay control</secondary>
49644 </indexterm>
49645 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
49646 delivers it directly to another host as a result of a remote address contained
49647 within it. Redirecting a local address via an alias or forward file and then
49648 passing the message on to another host is not relaying,
49649 <indexterm role="concept">
49650 <primary><quote>percent hack</quote></primary>
49651 </indexterm>
49652 but a redirection as a result of the <quote>percent hack</quote> is.
49653 </para>
49654 <para>
49655 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
49656 A host which is acting as a gateway or an MX backup is concerned with incoming
49657 relaying from arbitrary hosts to a specific set of domains. On the other hand,
49658 a host which is acting as a smart host for a number of clients is concerned
49659 with outgoing relaying from those clients to the Internet at large. Often the
49660 same host is fulfilling both functions,
49661 but in principle these two kinds of relaying are entirely independent. What is
49662 not wanted is the transmission of mail from arbitrary remote hosts through your
49663 system to arbitrary domains.
49664 </para>
49665 <para>
49666 You can implement relay control by means of suitable statements in the ACL that
49667 runs for each RCPT command. For convenience, it is often easiest to use
49668 Exim&#x2019;s named list facility to define the domains and hosts involved. For
49669 example, suppose you want to do the following:
49670 </para>
49671 <itemizedlist>
49672 <listitem>
49673 <para>
49674 Deliver a number of domains to mailboxes on the local host (or process them
49675 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
49676 <emphasis>my.dom2.example</emphasis>.
49677 </para>
49678 </listitem>
49679 <listitem>
49680 <para>
49681 Relay mail for a number of other domains for which you are the secondary MX.
49682 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
49683 </para>
49684 </listitem>
49685 <listitem>
49686 <para>
49687 Relay mail from the hosts on your local LAN, to whatever domains are involved.
49688 Suppose your LAN is 192.168.45.0/24.
49689 </para>
49690 </listitem>
49691 </itemizedlist>
49692 <para>
49693 In the main part of the configuration, you put the following definitions:
49694 </para>
49695 <literallayout class="monospaced">
49696 domainlist local_domains = my.dom1.example : my.dom2.example
49697 domainlist relay_domains = friend1.example : friend2.example
49698 hostlist   relay_hosts   = 192.168.45.0/24
49699 </literallayout>
49700 <para>
49701 Now you can use these definitions in the ACL that is run for every RCPT
49702 command:
49703 </para>
49704 <literallayout class="monospaced">
49705 acl_check_rcpt:
49706   accept domains = +local_domains : +relay_domains
49707   accept hosts   = +relay_hosts
49708 </literallayout>
49709 <para>
49710 The first statement accepts any RCPT command that contains an address in
49711 the local or relay domains. For any other domain, control passes to the second
49712 statement, which accepts the command only if it comes from one of the relay
49713 hosts. In practice, you will probably want to make your ACL more sophisticated
49714 than this, for example, by including sender and recipient verification. The
49715 default configuration includes a more comprehensive example, which is described
49716 in chapter <xref linkend="CHAPdefconfil"/>.
49717 </para>
49718 </section>
49719 <section id="SECTcheralcon">
49720 <title>Checking a relay configuration</title>
49721 <para>
49722 <indexterm role="concept">
49723 <primary>relaying</primary>
49724 <secondary>checking control of</secondary>
49725 </indexterm>
49726 You can check the relay characteristics of your configuration in the same way
49727 that you can test any ACL behaviour for an incoming SMTP connection, by using
49728 the <option>-bh</option> option to run a fake SMTP session with which you interact.
49729 </para>
49730 <para>
49731 For specifically testing for unwanted relaying, the host
49732 <emphasis>relay-test.mail-abuse.org</emphasis> provides a useful service. If you telnet to this
49733 host from the host on which Exim is running, using the normal telnet port, you
49734 will see a normal telnet connection message and then quite a long delay. Be
49735 patient. The remote host is making an SMTP connection back to your host, and
49736 trying a number of common probes to test for open relay vulnerability. The
49737 results of the tests will eventually appear on your terminal.
49738 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
49739 </para>
49740 </section>
49741 </chapter>
49742
49743 <chapter id="CHAPexiscan">
49744 <title>Content scanning at ACL time</title>
49745 <para>
49746 <indexterm role="concept" id="IIDcosca" class="startofrange">
49747 <primary>content scanning</primary>
49748 <secondary>at ACL time</secondary>
49749 </indexterm>
49750 The extension of Exim to include content scanning at ACL time, formerly known
49751 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
49752 was integrated into the main source for Exim release 4.50, and Tom continues to
49753 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
49754 specification.
49755 </para>
49756 <para>
49757 It is also possible to scan the content of messages at other times. The
49758 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
49759 scanning after all the ACLs have run. A transport filter can be used to scan
49760 messages at delivery time (see the <option>transport_filter</option> option, described in
49761 chapter <xref linkend="CHAPtransportgeneric"/>).
49762 </para>
49763 <para>
49764 If you want to include the ACL-time content-scanning features when you compile
49765 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
49766 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
49767 </para>
49768 <itemizedlist>
49769 <listitem>
49770 <para>
49771 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
49772 for all MIME parts for SMTP and non-SMTP messages, respectively.
49773 </para>
49774 </listitem>
49775 <listitem>
49776 <para>
49777 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
49778 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
49779 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
49780 </para>
49781 </listitem>
49782 <listitem>
49783 <para>
49784 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
49785 of messages, or parts of messages, for debugging purposes.
49786 </para>
49787 </listitem>
49788 <listitem>
49789 <para>
49790 Additional expansion variables that are set in the new ACL and by the new
49791 conditions.
49792 </para>
49793 </listitem>
49794 <listitem>
49795 <para>
49796 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
49797 </para>
49798 </listitem>
49799 </itemizedlist>
49800 <para>
49801 There is another content-scanning configuration option for <filename>Local/Makefile</filename>,
49802 called WITH_OLD_DEMIME. If this is set, the old, deprecated <option>demime</option> ACL
49803 condition is compiled, in addition to all the other content-scanning features.
49804 </para>
49805 <para>
49806 Content-scanning is continually evolving, and new features are still being
49807 added. While such features are still unstable and liable to incompatible
49808 changes, they are made available in Exim by setting options whose names begin
49809 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
49810 this manual. You can find out about them by reading the file called
49811 <filename>doc/experimental.txt</filename>.
49812 </para>
49813 <para>
49814 All the content-scanning facilites work on a MBOX copy of the message that is
49815 temporarily created in a file called:
49816 </para>
49817 <literallayout>
49818 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
49819 </literallayout>
49820 <para>
49821 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
49822 expect an MBOX-like structure inside that file. The file is created when the
49823 first content scanning facility is called. Subsequent calls to content
49824 scanning conditions open the same file again. The directory is recursively
49825 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
49826 </para>
49827 <literallayout class="monospaced">
49828 control = no_mbox_unspool
49829 </literallayout>
49830 <para>
49831 has been encountered. When the MIME ACL decodes files, they are put into the
49832 same directory by default.
49833 </para>
49834 <section id="SECTscanvirus">
49835 <title>Scanning for viruses</title>
49836 <para>
49837 <indexterm role="concept">
49838 <primary>virus scanning</primary>
49839 </indexterm>
49840 <indexterm role="concept">
49841 <primary>content scanning</primary>
49842 <secondary>for viruses</secondary>
49843 </indexterm>
49844 <indexterm role="concept">
49845 <primary>content scanning</primary>
49846 <secondary>the <option>malware</option> condition</secondary>
49847 </indexterm>
49848 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
49849 It supports a <quote>generic</quote> interface to scanners called via the shell, and
49850 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
49851 in memory and thus are much faster.
49852 </para>
49853 <para>
49854 <indexterm role="concept">
49855 <primary><option>av_scanner</option></primary>
49856 </indexterm>
49857 You can set the <option>av_scanner</option> option in first part of the Exim configuration
49858 file to specify which scanner to use, together with any additional options that
49859 are needed. The basic syntax is as follows:
49860 </para>
49861 <literallayout>
49862 <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>
49863 </literallayout>
49864 <para>
49865 If you do not set <option>av_scanner</option>, it defaults to
49866 </para>
49867 <literallayout class="monospaced">
49868 av_scanner = sophie:/var/run/sophie
49869 </literallayout>
49870 <para>
49871 If the value of <option>av_scanner</option> starts with dollar character, it is expanded
49872 before use. The following scanner types are supported in this release:
49873 </para>
49874 <variablelist>
49875 <varlistentry>
49876 <term><option>aveserver</option></term>
49877 <listitem>
49878 <para>
49879 <indexterm role="concept">
49880 <primary>virus scanners</primary>
49881 <secondary>Kaspersky</secondary>
49882 </indexterm>
49883 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
49884 at <emphasis role="bold"><ulink url="http://www.kaspersky.com">http://www.kaspersky.com</ulink></emphasis>. This scanner type takes one option,
49885 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
49886 example:
49887 </para>
49888 <literallayout class="monospaced">
49889 av_scanner = aveserver:/var/run/aveserver
49890 </literallayout>
49891 </listitem></varlistentry>
49892 <varlistentry>
49893 <term><option>clamd</option></term>
49894 <listitem>
49895 <para>
49896 <indexterm role="concept">
49897 <primary>virus scanners</primary>
49898 <secondary>clamd</secondary>
49899 </indexterm>
49900 This daemon-type scanner is GPL and free. You can get it at
49901 <emphasis role="bold"><ulink url="http://www.clamav.net/">http://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
49902 unpack MIME containers, so it used to be recommended to unpack MIME attachments
49903 in the MIME ACL. This no longer believed to be necessary. One option is
49904 required: either the path and name of a UNIX socket file, or a hostname or IP
49905 number, and a port, separated by space, as in the second of these examples:
49906 </para>
49907 <literallayout class="monospaced">
49908 av_scanner = clamd:/opt/clamd/socket
49909 av_scanner = clamd:192.168.2.100 1234
49910 </literallayout>
49911 <para>
49912 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
49913 contributing the code for this scanner.
49914 </para>
49915 </listitem></varlistentry>
49916 <varlistentry>
49917 <term><option>cmdline</option></term>
49918 <listitem>
49919 <para>
49920 <indexterm role="concept">
49921 <primary>virus scanners</primary>
49922 <secondary>command line interface</secondary>
49923 </indexterm>
49924 This is the keyword for the generic command line scanner interface. It can be
49925 used to attach virus scanners that are invoked from the shell. This scanner
49926 type takes 3 mandatory options:
49927 </para>
49928 <orderedlist numeration="arabic">
49929 <listitem>
49930 <para>
49931 The full path and name of the scanner binary, with all command line options,
49932 and a placeholder (<literal>%s</literal>) for the directory to scan.
49933 </para>
49934 </listitem>
49935 <listitem>
49936 <para>
49937 A regular expression to match against the STDOUT and STDERR output of the
49938 virus scanner. If the expression matches, a virus was found. You must make
49939 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
49940 the <quote>trigger</quote> expression.
49941 </para>
49942 </listitem>
49943 <listitem>
49944 <para>
49945 Another regular expression, containing exactly one pair of parentheses, to
49946 match the name of the virus found in the scanners output. This is called the
49947 <quote>name</quote> expression.
49948 </para>
49949 </listitem>
49950 </orderedlist>
49951 <para>
49952 For example, Sophos Sweep reports a virus on a line like this:
49953 </para>
49954 <literallayout class="monospaced">
49955 Virus 'W32/Magistr-B' found in file ./those.bat
49956 </literallayout>
49957 <para>
49958 For the trigger expression, we can just match the word <quote>found</quote>. For the name
49959 expression, we want to extract the W32/Magistr-B string, so we can match for
49960 the single quotes left and right of it. Altogether, this makes the
49961 configuration setting:
49962 </para>
49963 <literallayout class="monospaced">
49964 av_scanner = cmdline:\
49965              /path/to/sweep -all -rec -archive %s:\
49966              found:'(.+)'
49967 </literallayout>
49968 </listitem></varlistentry>
49969 <varlistentry>
49970 <term><option>drweb</option></term>
49971 <listitem>
49972 <para>
49973 <indexterm role="concept">
49974 <primary>virus scanners</primary>
49975 <secondary>DrWeb</secondary>
49976 </indexterm>
49977 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="http://www.sald.com/">http://www.sald.com/</ulink></emphasis>) interface takes one
49978 argument, either a full path to a UNIX socket, or an IP address and port
49979 separated by white space, as in these examples:
49980 </para>
49981 <literallayout class="monospaced">
49982 av_scanner = drweb:/var/run/drwebd.sock
49983 av_scanner = drweb:192.168.2.20 31337
49984 </literallayout>
49985 <para>
49986 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
49987 is used. Thanks to Alex Miller for contributing the code for this scanner.
49988 </para>
49989 </listitem></varlistentry>
49990 <varlistentry>
49991 <term><option>fsecure</option></term>
49992 <listitem>
49993 <para>
49994 <indexterm role="concept">
49995 <primary>virus scanners</primary>
49996 <secondary>F-Secure</secondary>
49997 </indexterm>
49998 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="http://www.f-secure.com">http://www.f-secure.com</ulink></emphasis>) takes one
49999 argument which is the path to a UNIX socket. For example:
50000 </para>
50001 <literallayout class="monospaced">
50002 av_scanner = fsecure:/path/to/.fsav
50003 </literallayout>
50004 <para>
50005 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
50006 Thelmen for contributing the code for this scanner.
50007 </para>
50008 </listitem></varlistentry>
50009 <varlistentry>
50010 <term><option>kavdaemon</option></term>
50011 <listitem>
50012 <para>
50013 <indexterm role="concept">
50014 <primary>virus scanners</primary>
50015 <secondary>Kaspersky</secondary>
50016 </indexterm>
50017 This is the scanner daemon of Kaspersky Version 4. This version of the
50018 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
50019 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
50020 For example:
50021 </para>
50022 <literallayout class="monospaced">
50023 av_scanner = kavdaemon:/opt/AVP/AvpCtl
50024 </literallayout>
50025 <para>
50026 The default path is <filename>/var/run/AvpCtl</filename>.
50027 </para>
50028 </listitem></varlistentry>
50029 <varlistentry>
50030 <term><option>mksd</option></term>
50031 <listitem>
50032 <para>
50033 <indexterm role="concept">
50034 <primary>virus scanners</primary>
50035 <secondary>mksd</secondary>
50036 </indexterm>
50037 This is a daemon type scanner that is aimed mainly at Polish users, though some
50038 parts of documentation are now available in English. You can get it at
50039 <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
50040 the maximum number of processes used simultaneously to scan the attachments,
50041 provided that the demime facility is employed and also provided that mksd has
50042 been run with at least the same number of child processes. For example:
50043 </para>
50044 <literallayout class="monospaced">
50045 av_scanner = mksd:2
50046 </literallayout>
50047 <para>
50048 You can safely omit this option (the default value is 1).
50049 </para>
50050 </listitem></varlistentry>
50051 <varlistentry>
50052 <term><option>sophie</option></term>
50053 <listitem>
50054 <para revisionflag="changed">
50055 <indexterm role="concept">
50056 <primary>virus scanners</primary>
50057 <secondary>Sophos and Sophie</secondary>
50058 </indexterm>
50059 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
50060 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
50061 for this scanner type is the path to the UNIX socket that Sophie uses for
50062 client communication. For example:
50063 </para>
50064 <literallayout class="monospaced">
50065 av_scanner = sophie:/tmp/sophie
50066 </literallayout>
50067 <para>
50068 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
50069 the option.
50070 </para>
50071 </listitem></varlistentry>
50072 </variablelist>
50073 <para>
50074 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
50075 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
50076 ACL.
50077 </para>
50078 <para>
50079 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
50080 makes it possible to use different scanners. See further below for an example.
50081 The <option>malware</option> condition caches its results, so when you use it multiple times
50082 for the same message, the actual scanning process is only carried out once.
50083 However, using expandable items in <option>av_scanner</option> disables this caching, in
50084 which case each use of the <option>malware</option> condition causes a new scan of the
50085 message.
50086 </para>
50087 <para>
50088 The <option>malware</option> condition takes a right-hand argument that is expanded before
50089 use. It can then be one of
50090 </para>
50091 <itemizedlist>
50092 <listitem>
50093 <para>
50094 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
50095 The condition succeeds if a virus was found, and fail otherwise. This is the
50096 recommended usage.
50097 </para>
50098 </listitem>
50099 <listitem>
50100 <para revisionflag="changed">
50101 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
50102 the condition fails immediately.
50103 </para>
50104 </listitem>
50105 <listitem>
50106 <para>
50107 A regular expression, in which case the message is scanned for viruses. The
50108 condition succeeds if a virus is found and its name matches the regular
50109 expression. This allows you to take special actions on certain types of virus.
50110 </para>
50111 </listitem>
50112 </itemizedlist>
50113 <para revisionflag="changed">
50114 You can append <literal>/defer_ok</literal> to the <option>malware</option> condition to accept messages
50115 even if there is a problem with the virus scanner. Otherwise, such a problem
50116 causes the ACL to defer.
50117 </para>
50118 <para>
50119 <indexterm role="concept">
50120 <primary><varname>$malware_name</varname></primary>
50121 </indexterm>
50122 When a virus is found, the condition sets up an expansion variable called
50123 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
50124 <option>message</option> modifier that specifies the error returned to the sender, and/or in
50125 logging data.
50126 </para>
50127 <para>
50128 If your virus scanner cannot unpack MIME and TNEF containers itself, you should
50129 use the <option>demime</option> condition (see section <xref linkend="SECTdemimecond"/>) before the
50130 <option>malware</option> condition.
50131 </para>
50132 <para>
50133 Here is a very simple scanning example:
50134 </para>
50135 <literallayout class="monospaced">
50136 deny message = This message contains malware ($malware_name)
50137      demime = *
50138      malware = *
50139 </literallayout>
50140 <para>
50141 The next example accepts messages when there is a problem with the scanner:
50142 </para>
50143 <literallayout class="monospaced">
50144 deny message = This message contains malware ($malware_name)
50145      demime = *
50146      malware = */defer_ok
50147 </literallayout>
50148 <para>
50149 The next example shows how to use an ACL variable to scan with both sophie and
50150 aveserver. It assumes you have set:
50151 </para>
50152 <literallayout class="monospaced">
50153 av_scanner = $acl_m0
50154 </literallayout>
50155 <para>
50156 in the main Exim configuration.
50157 </para>
50158 <literallayout class="monospaced">
50159 deny message = This message contains malware ($malware_name)
50160      set acl_m0 = sophie
50161      malware = *
50162
50163 deny message = This message contains malware ($malware_name)
50164      set acl_m0 = aveserver
50165      malware = *
50166 </literallayout>
50167 </section>
50168 <section id="SECTscanspamass">
50169 <title>Scanning with SpamAssassin</title>
50170 <para>
50171 <indexterm role="concept">
50172 <primary>content scanning</primary>
50173 <secondary>for spam</secondary>
50174 </indexterm>
50175 <indexterm role="concept">
50176 <primary>spam scanning</primary>
50177 </indexterm>
50178 <indexterm role="concept">
50179 <primary>SpamAssassin</primary>
50180 <secondary>scanning with</secondary>
50181 </indexterm>
50182 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
50183 score and a report for the message. You can get SpamAssassin at
50184 <emphasis role="bold"><ulink url="http://www.spamassassin.org">http://www.spamassassin.org</ulink></emphasis>, or, if you have a working Perl
50185 installation, you can use CPAN by running:
50186 </para>
50187 <literallayout class="monospaced">
50188 perl -MCPAN -e 'install Mail::SpamAssassin'
50189 </literallayout>
50190 <para>
50191 SpamAssassin has its own set of configuration files. Please review its
50192 documentation to see how you can tweak it. The default installation should work
50193 nicely, however.
50194 </para>
50195 <para>
50196 <indexterm role="concept">
50197 <primary><option>spamd_address</option></primary>
50198 </indexterm>
50199 After having installed and configured SpamAssassin, start the <option>spamd</option> daemon.
50200 By default, it listens on 127.0.0.1, TCP port 783. If you use another host or
50201 port for <option>spamd</option>, you must set the <option>spamd_address</option> option in the global
50202 part of the Exim configuration as follows (example):
50203 </para>
50204 <literallayout class="monospaced">
50205 spamd_address = 192.168.99.45 387
50206 </literallayout>
50207 <para>
50208 You do not need to set this option if you use the default. As of version 2.60,
50209 <option>spamd</option> also supports communication over UNIX sockets. If you want to use
50210 these, supply <option>spamd_address</option> with an absolute file name instead of a
50211 address/port pair:
50212 </para>
50213 <literallayout class="monospaced">
50214 spamd_address = /var/run/spamd_socket
50215 </literallayout>
50216 <para>
50217 You can have multiple <option>spamd</option> servers to improve scalability. These can
50218 reside on other hardware reachable over the network. To specify multiple
50219 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
50220 option, separated with colons:
50221 </para>
50222 <literallayout class="monospaced">
50223 spamd_address = 192.168.2.10 783 : \
50224                 192.168.2.11 783 : \
50225                 192.168.2.12 783
50226 </literallayout>
50227 <para>
50228 Up to 32 <option>spamd</option> servers are supported. The servers are queried in a random
50229 fashion. When a server fails to respond to the connection attempt, all other
50230 servers are tried until one succeeds. If no server responds, the <option>spam</option>
50231 condition defers.
50232 </para>
50233 <para>
50234 <emphasis role="bold">Warning</emphasis>: It is not possible to use the UNIX socket connection method with
50235 multiple <option>spamd</option> servers.
50236 </para>
50237 </section>
50238 <section>
50239 <title>Calling SpamAssassin from an Exim ACL</title>
50240 <para>
50241 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
50242 </para>
50243 <literallayout class="monospaced">
50244 deny message = This message was classified as SPAM
50245      spam = joe
50246 </literallayout>
50247 <para>
50248 The right-hand side of the <option>spam</option> condition specifies the username that
50249 SpamAssassin should scan for. If you do not want to scan for a particular user,
50250 but rather use the SpamAssassin system-wide default profile, you can scan for
50251 an unknown user, or simply use <quote>nobody</quote>. However, you must put something on
50252 the right-hand side.
50253 </para>
50254 <para>
50255 The username allows you to use per-domain or per-user antispam profiles. The
50256 right-hand side is expanded before being used, so you can put lookups or
50257 conditions there. When the right-hand side evaluates to <quote>0</quote> or <quote>false</quote>, no
50258 scanning is done and the condition fails immediately.
50259 </para>
50260 <para>
50261 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
50262 large ones may cause significant performance degredation. As most spam messages
50263 are quite small, it is recommended that you do not scan the big ones. For
50264 example:
50265 </para>
50266 <literallayout class="monospaced">
50267 deny message = This message was classified as SPAM
50268      condition = ${if &lt; {$message_size}{10K}}
50269      spam = nobody
50270 </literallayout>
50271 <para>
50272 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
50273 SpamAssassin profile has been matched or exceeded. If you want to use the
50274 <option>spam</option> condition for its side effects (see the variables below), you can make
50275 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
50276 </para>
50277 <para>
50278 <indexterm role="concept">
50279 <primary>spam scanning</primary>
50280 <secondary>returned variables</secondary>
50281 </indexterm>
50282 When the <option>spam</option> condition is run, it sets up a number of expansion
50283 variables. With the exception of <varname>$spam_score_int</varname>, these are usable only
50284 within ACLs; their values are not retained with the message and so cannot be
50285 used at delivery time.
50286 </para>
50287 <variablelist>
50288 <varlistentry>
50289 <term><varname>$spam_score</varname></term>
50290 <listitem>
50291 <para>
50292 The spam score of the message, for example <quote>3.4</quote> or <quote>30.5</quote>. This is useful
50293 for inclusion in log or reject messages.
50294 </para>
50295 </listitem></varlistentry>
50296 <varlistentry>
50297 <term><varname>$spam_score_int</varname></term>
50298 <listitem>
50299 <para>
50300 The spam score of the message, multiplied by ten, as an integer value. For
50301 example <quote>34</quote> or <quote>305</quote>. This is useful for numeric comparisons in
50302 conditions. This variable is special; its value is saved with the message, and
50303 written to Exim&#x2019;s spool file. This means that it can be used during the whole
50304 life of the message on your Exim system, in particular, in routers or
50305 transports during the later delivery phase.
50306 </para>
50307 </listitem></varlistentry>
50308 <varlistentry>
50309 <term><varname>$spam_bar</varname></term>
50310 <listitem>
50311 <para>
50312 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
50313 integer part of the spam score value. A spam score of 4.4 would have a
50314 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
50315 headers, since MUAs can match on such strings.
50316 </para>
50317 </listitem></varlistentry>
50318 <varlistentry>
50319 <term><varname>$spam_report</varname></term>
50320 <listitem>
50321 <para>
50322 A multiline text table, containing the full SpamAssassin report for the
50323 message. Useful for inclusion in headers or reject messages.
50324 </para>
50325 </listitem></varlistentry>
50326 </variablelist>
50327 <para>
50328 The <option>spam</option> condition caches its results. If you call it again with the same
50329 user name, it does not scan again, but rather returns the same values as
50330 before.
50331 </para>
50332 <para>
50333 The <option>spam</option> condition returns DEFER if there is any error while running the
50334 message through SpamAssassin. If you want to treat DEFER as FAIL (to pass on to
50335 the next ACL statement block), append <literal>/defer_ok</literal> to the right-hand side of
50336 the spam condition, like this:
50337 </para>
50338 <literallayout class="monospaced">
50339 deny message = This message was classified as SPAM
50340      spam    = joe/defer_ok
50341 </literallayout>
50342 <para>
50343 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
50344 </para>
50345 <para>
50346 Here is a longer, commented example of the use of the <option>spam</option>
50347 condition:
50348 </para>
50349 <literallayout class="monospaced" revisionflag="changed">
50350 # put headers in all messages (no matter if spam or not)
50351 warn  spam = nobody:true
50352       add_header = X-Spam-Score: $spam_score ($spam_bar)
50353       add_header = X-Spam-Report: $spam_report
50354
50355 # add second subject line with *SPAM* marker when message
50356 # is over threshold
50357 warn  spam = nobody
50358       add_header = Subject: *SPAM* $h_Subject:
50359
50360 # reject spam at high scores (&gt; 12)
50361 deny  message = This message scored $spam_score spam points.
50362       spam = nobody:true
50363       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
50364 </literallayout>
50365 </section>
50366 <section id="SECTscanmimepart">
50367 <title>Scanning MIME parts</title>
50368 <para>
50369 <indexterm role="concept">
50370 <primary>content scanning</primary>
50371 <secondary>MIME parts</secondary>
50372 </indexterm>
50373 <indexterm role="concept">
50374 <primary>MIME content scanning</primary>
50375 </indexterm>
50376 <indexterm role="concept">
50377 <primary><option>acl_smtp_mime</option></primary>
50378 </indexterm>
50379 <indexterm role="concept">
50380 <primary><option>acl_not_smtp_mime</option></primary>
50381 </indexterm>
50382 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
50383 each MIME part of an SMTP message, including multipart types, in the sequence
50384 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
50385 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
50386 options may both refer to the same ACL if you want the same processing in both
50387 cases.
50388 </para>
50389 <para>
50390 <phrase revisionflag="changed">These ACLs are called (possibly many times) just before the
50391 <option>acl_smtp_data</option> ACL in the case of an SMTP message, or just before the
50392 <option>acl_not_smtp</option> ACL in the case of a non-SMTP message.</phrase> However, a MIME ACL
50393 is called only if the message contains a <emphasis>MIME-Version:</emphasis> header line. When a
50394 call to a MIME ACL does not yield <quote>accept</quote>, ACL processing is aborted and the
50395 appropriate result code is sent to the client. In the case of an SMTP message,
50396 the <option>acl_smtp_data</option> ACL is not called when this happens.
50397 </para>
50398 <para>
50399 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
50400 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
50401 condition to match against the raw MIME part. You can also use the
50402 <option>mime_regex</option> condition to match against the decoded MIME part (see section
50403 <xref linkend="SECTscanregex"/>).
50404 </para>
50405 <para>
50406 At the start of a MIME ACL, a number of variables are set from the header
50407 information for the relevant MIME part. These are described below. The contents
50408 of the MIME part are not by default decoded into a disk file except for MIME
50409 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
50410 part into a disk file, you can use the <option>decode</option> modifier. The general syntax
50411 is:
50412 </para>
50413 <literallayout>
50414 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
50415 </literallayout>
50416 <para>
50417 The right hand side is expanded before use. After expansion,
50418 the value can be:
50419 </para>
50420 <orderedlist numeration="arabic">
50421 <listitem>
50422 <para>
50423 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
50424 </para>
50425 </listitem>
50426 <listitem>
50427 <para>
50428 The string <quote>default</quote>. In that case, the file is put in the temporary
50429 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
50430 a sequential file name consisting of the message id and a sequence number. The
50431 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
50432 </para>
50433 </listitem>
50434 <listitem>
50435 <para>
50436 A full path name starting with a slash. If the full name is an existing
50437 directory, it is used as a replacement for the default directory. The filename
50438 is then sequentially assigned. If the path does not exist, it is used as
50439 the full path and file name.
50440 </para>
50441 </listitem>
50442 <listitem>
50443 <para>
50444 If the string does not start with a slash, it is used as the
50445 filename, and the default path is then used.
50446 </para>
50447 </listitem>
50448 </orderedlist>
50449 <para>
50450 You can easily decode a file with its original, proposed filename using
50451 </para>
50452 <literallayout class="monospaced">
50453 decode = $mime_filename
50454 </literallayout>
50455 <para>
50456 However, you should keep in mind that <varname>$mime_filename</varname> might contain
50457 anything. If you place files outside of the default path, they are not
50458 automatically unlinked.
50459 </para>
50460 <para>
50461 For RFC822 attachments (these are messages attached to messages, with a
50462 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
50463 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
50464 variable is set (see below). Attached messages are always decoded to disk
50465 before being checked, and the files are unlinked once the check is done.
50466 </para>
50467 <para>
50468 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
50469 used to match regular expressions against raw and decoded MIME parts,
50470 respectively. They are described in section <xref linkend="SECTscanregex"/>.
50471 </para>
50472 <para>
50473 <indexterm role="concept">
50474 <primary>MIME content scanning</primary>
50475 <secondary>returned variables</secondary>
50476 </indexterm>
50477 The following list describes all expansion variables that are
50478 available in the MIME ACL:
50479 </para>
50480 <variablelist>
50481 <varlistentry>
50482 <term><varname>$mime_boundary</varname></term>
50483 <listitem>
50484 <para>
50485 If the current part is a multipart (see <varname>$mime_is_multipart</varname>) below, it should
50486 have a boundary string, which is stored in this variable. If the current part
50487 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
50488 contains the empty string.
50489 </para>
50490 </listitem></varlistentry>
50491 <varlistentry>
50492 <term><varname>$mime_charset</varname></term>
50493 <listitem>
50494 <para>
50495 This variable contains the character set identifier, if one was found in the
50496 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
50497 </para>
50498 <literallayout class="monospaced">
50499 us-ascii
50500 gb2312 (Chinese)
50501 iso-8859-1
50502 </literallayout>
50503 <para>
50504 Please note that this value is not normalized, so you should do matches
50505 case-insensitively.
50506 </para>
50507 </listitem></varlistentry>
50508 <varlistentry>
50509 <term><varname>$mime_content_description</varname></term>
50510 <listitem>
50511 <para>
50512 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
50513 header. It can contain a human-readable description of the parts content. Some
50514 implementations repeat the filename for attachments here, but they are usually
50515 only used for display purposes.
50516 </para>
50517 </listitem></varlistentry>
50518 <varlistentry>
50519 <term><varname>$mime_content_disposition</varname></term>
50520 <listitem>
50521 <para>
50522 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
50523 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
50524 </para>
50525 </listitem></varlistentry>
50526 <varlistentry>
50527 <term><varname>$mime_content_id</varname></term>
50528 <listitem>
50529 <para>
50530 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
50531 This is a unique ID that can be used to reference a part from another part.
50532 </para>
50533 </listitem></varlistentry>
50534 <varlistentry>
50535 <term><varname>$mime_content_size</varname></term>
50536 <listitem>
50537 <para>
50538 This variable is set only after the <option>decode</option> modifier (see above) has been
50539 successfully run. It contains the size of the decoded part in kilobytes. The
50540 size is always rounded up to full kilobytes, so only a completely empty part
50541 has a <varname>$mime_content_size</varname> of zero.
50542 </para>
50543 </listitem></varlistentry>
50544 <varlistentry>
50545 <term><varname>$mime_content_transfer_encoding</varname></term>
50546 <listitem>
50547 <para>
50548 This variable contains the normalized content of the
50549 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
50550 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
50551 </para>
50552 </listitem></varlistentry>
50553 <varlistentry>
50554 <term><varname>$mime_content_type</varname></term>
50555 <listitem>
50556 <para>
50557 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
50558 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
50559 are some examples of popular MIME types, as they may appear in this variable:
50560 </para>
50561 <literallayout class="monospaced">
50562 text/plain
50563 text/html
50564 application/octet-stream
50565 image/jpeg
50566 audio/midi
50567 </literallayout>
50568 <para>
50569 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
50570 empty string.
50571 </para>
50572 </listitem></varlistentry>
50573 <varlistentry>
50574 <term><varname>$mime_decoded_filename</varname></term>
50575 <listitem>
50576 <para>
50577 This variable is set only after the <option>decode</option> modifier (see above) has been
50578 successfully run. It contains the full path and file name of the file
50579 containing the decoded data.
50580 </para>
50581 </listitem></varlistentry>
50582 </variablelist>
50583 <para>
50584 <indexterm role="concept">
50585 <primary>RFC 2047</primary>
50586 </indexterm>
50587 </para>
50588 <variablelist>
50589 <varlistentry>
50590 <term><varname>$mime_filename</varname></term>
50591 <listitem>
50592 <para>
50593 This is perhaps the most important of the MIME variables. It contains a
50594 proposed filename for an attachment, if one was found in either the
50595 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
50596 RFC2047 decoded, but no additional sanity checks are done. If no filename was
50597 found, this variable contains the empty string.
50598 </para>
50599 </listitem></varlistentry>
50600 <varlistentry>
50601 <term><varname>$mime_is_coverletter</varname></term>
50602 <listitem>
50603 <para>
50604 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
50605 attached data. It can be used to clamp down on flashy or unneccessarily encoded
50606 content in the cover letter, while not restricting attachments at all.
50607 </para>
50608 <para>
50609 The variable contains 1 (true) for a MIME part believed to be part of the
50610 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
50611 follows:
50612 </para>
50613 <orderedlist numeration="arabic">
50614 <listitem>
50615 <para>
50616 The outermost MIME part of a message is always a cover letter.
50617 </para>
50618 </listitem>
50619 <listitem>
50620 <para>
50621 If a multipart/alternative or multipart/related MIME part is a cover letter,
50622 so are all MIME subparts within that multipart.
50623 </para>
50624 </listitem>
50625 <listitem>
50626 <para>
50627 If any other multipart is a cover letter, the first subpart is a cover letter,
50628 and the rest are attachments.
50629 </para>
50630 </listitem>
50631 <listitem>
50632 <para>
50633 All parts contained within an attachment multipart are attachments.
50634 </para>
50635 </listitem>
50636 </orderedlist>
50637 <para>
50638 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
50639 alternative plain text), while allowing HTML files to be attached. HTML
50640 coverletter mail attached to non-HMTL coverletter mail will also be allowed:
50641 </para>
50642 <literallayout class="monospaced">
50643 deny message = HTML mail is not accepted here
50644 !condition = $mime_is_rfc822
50645 condition = $mime_is_coverletter
50646 condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
50647 </literallayout>
50648 </listitem></varlistentry>
50649 <varlistentry>
50650 <term><varname>$mime_is_multipart</varname></term>
50651 <listitem>
50652 <para>
50653 This variable has the value 1 (true) when the current part has the main type
50654 <quote>multipart</quote>, for example <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
50655 Since multipart entities only serve as containers for other parts, you may not
50656 want to carry out specific actions on them.
50657 </para>
50658 </listitem></varlistentry>
50659 <varlistentry>
50660 <term><varname>$mime_is_rfc822</varname></term>
50661 <listitem>
50662 <para>
50663 This variable has the value 1 (true) if the current part is not a part of the
50664 checked message itself, but part of an attached message. Attached message
50665 decoding is fully recursive.
50666 </para>
50667 </listitem></varlistentry>
50668 <varlistentry>
50669 <term><varname>$mime_part_count</varname></term>
50670 <listitem>
50671 <para>
50672 This variable is a counter that is raised for each processed MIME part. It
50673 starts at zero for the very first part (which is usually a multipart). The
50674 counter is per-message, so it is reset when processing RFC822 attachments (see
50675 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
50676 complete, so you can use it in the DATA ACL to determine the number of MIME
50677 parts of a message. For non-MIME messages, this variable contains the value -1.
50678 </para>
50679 </listitem></varlistentry>
50680 </variablelist>
50681 </section>
50682 <section id="SECTscanregex">
50683 <title>Scanning with regular expressions</title>
50684 <para>
50685 <indexterm role="concept">
50686 <primary>content scanning</primary>
50687 <secondary>with regular expressions</secondary>
50688 </indexterm>
50689 <indexterm role="concept">
50690 <primary>regular expressions</primary>
50691 <secondary>content scanning with</secondary>
50692 </indexterm>
50693 You can specify your own custom regular expression matches on the full body of
50694 the message, or on individual MIME parts.
50695 </para>
50696 <para>
50697 The <option>regex</option> condition takes one or more regular expressions as arguments and
50698 matches them against the full message (when called in the DATA ACL) or a raw
50699 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
50700 linewise, with a maximum line length of 32K characters. That means you cannot
50701 have multiline matches with the <option>regex</option> condition.
50702 </para>
50703 <para>
50704 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
50705 to 32K of decoded content (the whole content at once, not linewise). If the
50706 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
50707 is decoded automatically when <option>mime_regex</option> is executed (using default path
50708 and filename values). If the decoded data is larger than  32K, only the first
50709 32K characters are checked.
50710 </para>
50711 <para>
50712 The regular expressions are passed as a colon-separated list. To include a
50713 literal colon, you must double it. Since the whole right-hand side string is
50714 expanded before being used, you must also escape dollar signs and backslashes
50715 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
50716 Here is a simple example that contains two regular expressions:
50717 </para>
50718 <literallayout class="monospaced">
50719 deny message = contains blacklisted regex ($regex_match_string)
50720      regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
50721 </literallayout>
50722 <para>
50723 The conditions returns true if any one of the regular expressions matches. The
50724 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
50725 matching regular expression.
50726 </para>
50727 <para>
50728 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
50729 CPU-intensive.
50730 </para>
50731 </section>
50732 <section id="SECTdemimecond">
50733 <title>The demime condition</title>
50734 <para>
50735 <indexterm role="concept">
50736 <primary>content scanning</primary>
50737 <secondary>MIME checking</secondary>
50738 </indexterm>
50739 <indexterm role="concept">
50740 <primary>MIME content scanning</primary>
50741 </indexterm>
50742 The <option>demime</option> ACL condition provides MIME unpacking, sanity checking and file
50743 extension blocking. It is usable only in the DATA and non-SMTP ACLs. The
50744 <option>demime</option> condition uses a simpler interface to MIME decoding than the MIME
50745 ACL functionality, but provides no additional facilities. Please note that this
50746 condition is deprecated and kept only for backward compatibility. You must set
50747 the WITH_OLD_DEMIME option in <filename>Local/Makefile</filename> at build time to be able to
50748 use the <option>demime</option> condition.
50749 </para>
50750 <para>
50751 The <option>demime</option> condition unpacks MIME containers in the message. It detects
50752 errors in MIME containers and can match file extensions found in the message
50753 against a list. Using this facility produces files containing the unpacked MIME
50754 parts of the message in the temporary scan directory. If you do antivirus
50755 scanning, it is recommened that you use the <option>demime</option> condition before the
50756 antivirus (<option>malware</option>) condition.
50757 </para>
50758 <para>
50759 On the right-hand side of the <option>demime</option> condition you can pass a
50760 colon-separated list of file extensions that it should match against. For
50761 example:
50762 </para>
50763 <literallayout class="monospaced">
50764 deny message = Found blacklisted file attachment
50765      demime  = vbs:com:bat:pif:prf:lnk
50766 </literallayout>
50767 <para>
50768 If one of the file extensions is found, the condition is true, otherwise it is
50769 false. If there is a temporary error while demimeing (for example, <quote>disk
50770 full</quote>), the condition defers, and the message is temporarily rejected (unless
50771 the condition is on a <option>warn</option> verb).
50772 </para>
50773 <para>
50774 The right-hand side is expanded before being treated as a list, so you can have
50775 conditions and lookups there. If it expands to an empty string, <quote>false</quote>, or
50776 zero (<quote>0</quote>), no demimeing is done and the condition is false.
50777 </para>
50778 <para>
50779 The <option>demime</option> condition set the following variables:
50780 </para>
50781 <variablelist>
50782 <varlistentry>
50783 <term><varname>$demime_errorlevel</varname></term>
50784 <listitem>
50785 <para>
50786 <indexterm role="concept">
50787 <primary><varname>$demime_errorlevel</varname></primary>
50788 </indexterm>
50789 When an error is detected in a MIME container, this variable contains the
50790 severity of the error, as an integer number. The higher the value, the more
50791 severe the error (the current maximum value is 3). If this variable is unset or
50792 zero, no error occurred.
50793 </para>
50794 </listitem></varlistentry>
50795 <varlistentry>
50796 <term><varname>$demime_reason</varname></term>
50797 <listitem>
50798 <para>
50799 <indexterm role="concept">
50800 <primary><varname>$demime_reason</varname></primary>
50801 </indexterm>
50802 When <varname>$demime_errorlevel</varname> is greater than zero, this variable contains a
50803 human-readable text string describing the MIME error that occurred.
50804 </para>
50805 </listitem></varlistentry>
50806 </variablelist>
50807 <variablelist>
50808 <varlistentry>
50809 <term><varname>$found_extension</varname></term>
50810 <listitem>
50811 <para>
50812 <indexterm role="concept">
50813 <primary><varname>$found_extension</varname></primary>
50814 </indexterm>
50815 When the <option>demime</option> condition is true, this variable contains the file
50816 extension it found.
50817 </para>
50818 </listitem></varlistentry>
50819 </variablelist>
50820 <para>
50821 Both <varname>$demime_errorlevel</varname> and <varname>$demime_reason</varname> are set by the first call of
50822 the <option>demime</option> condition, and are not changed on subsequent calls.
50823 </para>
50824 <para>
50825 If you do not want to check for file extensions, but rather use the <option>demime</option>
50826 condition for unpacking or error checking purposes, pass <quote>*</quote> as the
50827 right-hand side value. Here is a more elaborate example of how to use this
50828 facility:
50829 </para>
50830 <literallayout class="monospaced">
50831 # Reject messages with serious MIME container errors
50832 deny  message = Found MIME error ($demime_reason).
50833       demime = *
50834       condition = ${if &gt;{$demime_errorlevel}{2}{1}{0}}
50835
50836 # Reject known virus spreading file extensions.
50837 # Accepting these is pretty much braindead.
50838 deny  message = contains $found_extension file (blacklisted).
50839       demime  = com:vbs:bat:pif:scr
50840
50841 # Freeze .exe and .doc files. Postmaster can
50842 # examine them and eventually thaw them.
50843 deny  log_message = Another $found_extension file.
50844       demime = exe:doc
50845       control = freeze
50846 </literallayout>
50847 <para>
50848 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
50849 </para>
50850 </section>
50851 </chapter>
50852
50853 <chapter id="CHAPlocalscan">
50854 <title>Adding a local scan function to Exim</title>
50855 <titleabbrev>Local scan function</titleabbrev>
50856 <para>
50857 <indexterm role="concept" id="IIDlosca" class="startofrange">
50858 <primary><function>local_scan()</function> function</primary>
50859 <secondary>description of</secondary>
50860 </indexterm>
50861 <indexterm role="concept">
50862 <primary>customizing</primary>
50863 <secondary>input scan using C function</secondary>
50864 </indexterm>
50865 <indexterm role="concept">
50866 <primary>policy control</primary>
50867 <secondary>by local scan function</secondary>
50868 </indexterm>
50869 In these days of email worms, viruses, and ever-increasing spam, some sites
50870 want to apply a lot of checking to messages before accepting them.
50871 </para>
50872 <para>
50873 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
50874 passing messages to external virus and spam scanning software. You can also do
50875 a certain amount in Exim itself through string expansions and the <option>condition</option>
50876 condition in the ACL that runs after the SMTP DATA command or the ACL for
50877 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
50878 </para>
50879 <para>
50880 To allow for further customization to a site&#x2019;s own requirements, there is the
50881 possibility of linking Exim with a private message scanning function, written
50882 in C. If you want to run code that is written in something other than C, you
50883 can of course use a little C stub to call it.
50884 </para>
50885 <para>
50886 The local scan function is run once for every incoming message, at the point
50887 when Exim is just about to accept the message.
50888 It can therefore be used to control non-SMTP messages from local processes as
50889 well as messages arriving via SMTP.
50890 </para>
50891 <para>
50892 Exim applies a timeout to calls of the local scan function, and there is an
50893 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
50894 Zero means <quote>no timeout</quote>.
50895 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
50896 before calling the local scan function, so that the most common types of crash
50897 are caught. If the timeout is exceeded or one of those signals is caught, the
50898 incoming message is rejected with a temporary error if it is an SMTP message.
50899 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
50900 code. The incident is logged on the main and reject logs.
50901 </para>
50902 <section>
50903 <title>Building Exim to use a local scan function</title>
50904 <para>
50905 <indexterm role="concept">
50906 <primary><function>local_scan()</function> function</primary>
50907 <secondary>building Exim to use</secondary>
50908 </indexterm>
50909 To make use of the local scan function feature, you must tell Exim where your
50910 function is before building Exim, by setting LOCAL_SCAN_SOURCE in your
50911 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
50912 directory, so you might set
50913 </para>
50914 <literallayout class="monospaced">
50915 LOCAL_SCAN_SOURCE=Local/local_scan.c
50916 </literallayout>
50917 <para>
50918 for example. The function must be called <function>local_scan()</function>. It is called by
50919 Exim after it has received a message, when the success return code is about to
50920 be sent. This is after all the ACLs have been run. The return code from your
50921 function controls whether the message is actually accepted or not. There is a
50922 commented template function (that just accepts the message) in the file
50923 _src/local_scan.c_.
50924 </para>
50925 <para>
50926 If you want to make use of Exim&#x2019;s run time configuration file to set options
50927 for your <function>local_scan()</function> function, you must also set
50928 </para>
50929 <literallayout class="monospaced">
50930 LOCAL_SCAN_HAS_OPTIONS=yes
50931 </literallayout>
50932 <para>
50933 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
50934 </para>
50935 </section>
50936 <section id="SECTapiforloc">
50937 <title>API for local_scan()</title>
50938 <para>
50939 <indexterm role="concept">
50940 <primary><function>local_scan()</function> function</primary>
50941 <secondary>API description</secondary>
50942 </indexterm>
50943 You must include this line near the start of your code:
50944 </para>
50945 <literallayout class="monospaced">
50946 #include "local_scan.h"
50947 </literallayout>
50948 <para>
50949 This header file defines a number of variables and other values, and the
50950 prototype for the function itself. Exim is coded to use unsigned char values
50951 almost exclusively, and one of the things this header defines is a shorthand
50952 for <literal>unsigned char</literal> called <literal>uschar</literal>.
50953 It also contains the following macro definitions, to simplify casting character
50954 strings and pointers to character strings:
50955 </para>
50956 <literallayout class="monospaced">
50957 #define CS   (char *)
50958 #define CCS  (const char *)
50959 #define CSS  (char **)
50960 #define US   (unsigned char *)
50961 #define CUS  (const unsigned char *)
50962 #define USS  (unsigned char **)
50963 </literallayout>
50964 <para>
50965 The function prototype for <function>local_scan()</function> is:
50966 </para>
50967 <literallayout class="monospaced">
50968 extern int local_scan(int fd, uschar **return_text);
50969 </literallayout>
50970 <para>
50971 The arguments are as follows:
50972 </para>
50973 <itemizedlist>
50974 <listitem>
50975 <para>
50976 <option>fd</option> is a file descriptor for the file that contains the body of the message
50977 (the -D file). The file is open for reading and writing, but updating it is not
50978 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
50979 </para>
50980 <para>
50981 The descriptor is positioned at character 19 of the file, which is the first
50982 character of the body itself, because the first 19 characters are the message
50983 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
50984 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
50985 case this changes in some future version.
50986 </para>
50987 </listitem>
50988 <listitem>
50989 <para>
50990 <option>return_text</option> is an address which you can use to return a pointer to a text
50991 string at the end of the function. The value it points to on entry is NULL.
50992 </para>
50993 </listitem>
50994 </itemizedlist>
50995 <para>
50996 The function must return an <option>int</option> value which is one of the following macros:
50997 </para>
50998 <variablelist>
50999 <varlistentry>
51000 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
51001 <listitem>
51002 <para>
51003 <indexterm role="concept">
51004 <primary><varname>$local_scan_data</varname></primary>
51005 </indexterm>
51006 The message is accepted. If you pass back a string of text, it is saved with
51007 the message, and made available in the variable <varname>$local_scan_data</varname>. No
51008 newlines are permitted (if there are any, they are turned into spaces) and the
51009 maximum length of text is 1000 characters.
51010 </para>
51011 </listitem></varlistentry>
51012 <varlistentry>
51013 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
51014 <listitem>
51015 <para>
51016 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51017 queued without immediate delivery, and is frozen.
51018 </para>
51019 </listitem></varlistentry>
51020 <varlistentry>
51021 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
51022 <listitem>
51023 <para>
51024 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
51025 queued without immediate delivery.
51026 </para>
51027 </listitem></varlistentry>
51028 <varlistentry>
51029 <term><literal>LOCAL_SCAN_REJECT</literal></term>
51030 <listitem>
51031 <para>
51032 The message is rejected; the returned text is used as an error message which is
51033 passed back to the sender and which is also logged. Newlines are permitted &ndash;
51034 they cause a multiline response for SMTP rejections, but are converted to
51035 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
51036 used.
51037 </para>
51038 </listitem></varlistentry>
51039 <varlistentry>
51040 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
51041 <listitem>
51042 <para>
51043 The message is temporarily rejected; the returned text is used as an error
51044 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
51045 problem</quote> is used.
51046 </para>
51047 </listitem></varlistentry>
51048 <varlistentry>
51049 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
51050 <listitem>
51051 <para>
51052 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
51053 message is not written to the reject log. It has the effect of unsetting the
51054 <option>rejected_header</option> log selector for just this rejection. If
51055 <option>rejected_header</option> is already unset (see the discussion of the
51056 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
51057 same as LOCAL_SCAN_REJECT.
51058 </para>
51059 </listitem></varlistentry>
51060 <varlistentry>
51061 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
51062 <listitem>
51063 <para>
51064 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
51065 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
51066 </para>
51067 </listitem></varlistentry>
51068 </variablelist>
51069 <para>
51070 If the message is not being received by interactive SMTP, rejections are
51071 reported by writing to <option>stderr</option> or by sending an email, as configured by the
51072 <option>-oe</option> command line options.
51073 </para>
51074 </section>
51075 <section id="SECTconoptloc">
51076 <title>Configuration options for local_scan()</title>
51077 <para>
51078 <indexterm role="concept">
51079 <primary><function>local_scan()</function> function</primary>
51080 <secondary>configuration options</secondary>
51081 </indexterm>
51082 It is possible to have option settings in the main configuration file
51083 that set values in static variables in the <function>local_scan()</function> module. If you
51084 want to do this, you must have the line
51085 </para>
51086 <literallayout class="monospaced">
51087 LOCAL_SCAN_HAS_OPTIONS=yes
51088 </literallayout>
51089 <para>
51090 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
51091 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
51092 file, you must define static variables to hold the option values, and a table
51093 to define them.
51094 </para>
51095 <para>
51096 The table must be a vector called <option>local_scan_options</option>, of type
51097 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
51098 and a pointer to the variable that holds the value. The entries must appear in
51099 alphabetical order. Following <option>local_scan_options</option> you must also define a
51100 variable called <option>local_scan_options_count</option> that contains the number of
51101 entries in the table. Here is a short example, showing two kinds of option:
51102 </para>
51103 <literallayout class="monospaced">
51104 static int my_integer_option = 42;
51105 static uschar *my_string_option = US"a default string";
51106
51107 optionlist local_scan_options[] = {
51108   { "my_integer", opt_int,       &amp;my_integer_option },
51109   { "my_string",  opt_stringptr, &amp;my_string_option }
51110 };
51111
51112 int local_scan_options_count =
51113   sizeof(local_scan_options)/sizeof(optionlist);
51114 </literallayout>
51115 <para>
51116 The values of the variables can now be changed from Exim&#x2019;s runtime
51117 configuration file by including a local scan section as in this example:
51118 </para>
51119 <literallayout class="monospaced">
51120 begin local_scan
51121 my_integer = 99
51122 my_string = some string of text...
51123 </literallayout>
51124 <para>
51125 The available types of option data are as follows:
51126 </para>
51127 <variablelist>
51128 <varlistentry>
51129 <term><emphasis role="bold">opt_bool</emphasis></term>
51130 <listitem>
51131 <para>
51132 This specifies a boolean (true/false) option. The address should point to a
51133 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
51134 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
51135 whether such a variable has been set at all, you can initialize it to
51136 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
51137 values.)
51138 </para>
51139 </listitem></varlistentry>
51140 <varlistentry>
51141 <term><emphasis role="bold">opt_fixed</emphasis></term>
51142 <listitem>
51143 <para>
51144 This specifies a fixed point number, such as is used for load averages.
51145 The address should point to a variable of type <literal>int</literal>. The value is stored
51146 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
51147 </para>
51148 </listitem></varlistentry>
51149 <varlistentry>
51150 <term><emphasis role="bold">opt_int</emphasis></term>
51151 <listitem>
51152 <para>
51153 This specifies an integer; the address should point to a variable of type
51154 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
51155 Exim.
51156 </para>
51157 </listitem></varlistentry>
51158 <varlistentry>
51159 <term><emphasis role="bold">opt_mkint</emphasis></term>
51160 <listitem>
51161 <para>
51162 This is the same as <option>opt_int</option>, except that when such a value is output in a
51163 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
51164 printed with the suffix K or M.
51165 </para>
51166 </listitem></varlistentry>
51167 <varlistentry>
51168 <term><emphasis role="bold">opt_octint</emphasis></term>
51169 <listitem>
51170 <para>
51171 This also specifies an integer, but the value is always interpeted as an
51172 octal integer, whether or not it starts with the digit zero, and it is
51173 always output in octal.
51174 </para>
51175 </listitem></varlistentry>
51176 <varlistentry>
51177 <term><emphasis role="bold">opt_stringptr</emphasis></term>
51178 <listitem>
51179 <para>
51180 This specifies a string value; the address must be a pointer to a
51181 variable that points to a string (for example, of type <literal>uschar *</literal>).
51182 </para>
51183 </listitem></varlistentry>
51184 <varlistentry>
51185 <term><emphasis role="bold">opt_time</emphasis></term>
51186 <listitem>
51187 <para>
51188 This specifies a time interval value. The address must point to a variable of
51189 type <literal>int</literal>. The value that is placed there is a number of seconds.
51190 </para>
51191 </listitem></varlistentry>
51192 </variablelist>
51193 <para>
51194 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
51195 out the values of all the <function>local_scan()</function> options.
51196 </para>
51197 </section>
51198 <section>
51199 <title>Available Exim variables</title>
51200 <para>
51201 <indexterm role="concept">
51202 <primary><function>local_scan()</function> function</primary>
51203 <secondary>available Exim variables</secondary>
51204 </indexterm>
51205 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
51206 are the only ones that are guaranteed to be maintained from release to release.
51207 Note, however, that you can obtain the value of any Exim variable by calling
51208 <emphasis>expand_string()</emphasis>. The exported variables are as follows:
51209 </para>
51210 <variablelist>
51211 <varlistentry>
51212 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
51213 <listitem>
51214 <para>
51215 This variable is set to zero when no debugging is taking place. Otherwise, it
51216 is a bitmap of debugging selectors. Two bits are identified for use in
51217 <function>local_scan()</function>; they are defined as macros:
51218 </para>
51219 <itemizedlist>
51220 <listitem>
51221 <para>
51222 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
51223 testing option that is not privileged &ndash; any caller may set it. All the
51224 other selector bits can be set only by admin users.
51225 </para>
51226 </listitem>
51227 <listitem>
51228 <para>
51229 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
51230 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
51231 of debugging bits.
51232 </para>
51233 </listitem>
51234 </itemizedlist>
51235 <para>
51236 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
51237 selected, you should use code like this:
51238 </para>
51239 <literallayout class="monospaced">
51240 if ((debug_selector &amp; D_local_scan) != 0)
51241   debug_printf("xxx", ...);
51242 </literallayout>
51243 </listitem></varlistentry>
51244 <varlistentry>
51245 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
51246 <listitem>
51247 <para>
51248 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
51249 variable <option>expand_string_message</option> contains the error message, zero-terminated.
51250 </para>
51251 </listitem></varlistentry>
51252 <varlistentry>
51253 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
51254 <listitem>
51255 <para>
51256 A pointer to a chain of header lines. The <option>header_line</option> structure is
51257 discussed below.
51258 </para>
51259 </listitem></varlistentry>
51260 <varlistentry>
51261 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
51262 <listitem>
51263 <para>
51264 A pointer to the last of the header lines.
51265 </para>
51266 </listitem></varlistentry>
51267 <varlistentry>
51268 <term><emphasis role="bold">uschar&nbsp;*headers_charset</emphasis></term>
51269 <listitem>
51270 <para>
51271 The value of the <option>headers_charset</option> configuration option.
51272 </para>
51273 </listitem></varlistentry>
51274 <varlistentry>
51275 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
51276 <listitem>
51277 <para>
51278 This variable is TRUE during a host checking session that is initiated by the
51279 <option>-bh</option> command line option.
51280 </para>
51281 </listitem></varlistentry>
51282 <varlistentry>
51283 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
51284 <listitem>
51285 <para>
51286 The IP address of the interface that received the message, as a string. This
51287 is NULL for locally submitted messages.
51288 </para>
51289 </listitem></varlistentry>
51290 <varlistentry>
51291 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
51292 <listitem>
51293 <para>
51294 The port on which this message was received.
51295 </para>
51296 </listitem></varlistentry>
51297 <varlistentry>
51298 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
51299 <listitem>
51300 <para>
51301 This variable contains Exim&#x2019;s message id for the incoming message (the value of
51302 <varname>$message_exim_id</varname>) as a zero-terminated string.
51303 </para>
51304 </listitem></varlistentry>
51305 <varlistentry>
51306 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
51307 <listitem>
51308 <para>
51309 The name of the protocol by which the message was received.
51310 </para>
51311 </listitem></varlistentry>
51312 <varlistentry>
51313 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
51314 <listitem>
51315 <para>
51316 The number of accepted recipients.
51317 </para>
51318 </listitem></varlistentry>
51319 <varlistentry>
51320 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
51321 <listitem>
51322 <para>
51323 <indexterm role="concept">
51324 <primary>recipient</primary>
51325 <secondary>adding in local scan</secondary>
51326 </indexterm>
51327 <indexterm role="concept">
51328 <primary>recipient</primary>
51329 <secondary>removing in local scan</secondary>
51330 </indexterm>
51331 The list of accepted recipients, held in a vector of length
51332 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
51333 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
51334 below). You can delete recipients by removing them from the vector and adusting
51335 the value in <option>recipients_count</option>. In particular, by setting
51336 <option>recipients_count</option> to zero you remove all recipients. If you then return the
51337 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
51338 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
51339 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
51340 </para>
51341 </listitem></varlistentry>
51342 <varlistentry>
51343 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
51344 <listitem>
51345 <para>
51346 The envelope sender address. For bounce messages this is the empty string.
51347 </para>
51348 </listitem></varlistentry>
51349 <varlistentry>
51350 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
51351 <listitem>
51352 <para>
51353 The IP address of the sending host, as a string. This is NULL for
51354 locally-submitted messages.
51355 </para>
51356 </listitem></varlistentry>
51357 <varlistentry>
51358 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
51359 <listitem>
51360 <para>
51361 The name of the authentication mechanism that was used, or NULL if the message
51362 was not received over an authenticated SMTP connection.
51363 </para>
51364 </listitem></varlistentry>
51365 <varlistentry>
51366 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
51367 <listitem>
51368 <para>
51369 The name of the sending host, if known.
51370 </para>
51371 </listitem></varlistentry>
51372 <varlistentry>
51373 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
51374 <listitem>
51375 <para>
51376 The port on the sending host.
51377 </para>
51378 </listitem></varlistentry>
51379 <varlistentry>
51380 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
51381 <listitem>
51382 <para>
51383 This variable is TRUE for all SMTP input, including BSMTP.
51384 </para>
51385 </listitem></varlistentry>
51386 <varlistentry>
51387 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
51388 <listitem>
51389 <para>
51390 This variable is TRUE for BSMTP input.
51391 </para>
51392 </listitem></varlistentry>
51393 <varlistentry>
51394 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
51395 <listitem>
51396 <para>
51397 The contents of this variable control which pool of memory is used for new
51398 requests. See section <xref linkend="SECTmemhanloc"/> for details.
51399 </para>
51400 </listitem></varlistentry>
51401 </variablelist>
51402 </section>
51403 <section>
51404 <title>Structure of header lines</title>
51405 <para>
51406 The <option>header_line</option> structure contains the members listed below.
51407 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
51408 (see below). You can cause header lines to be ignored (deleted) by setting
51409 their type to *.
51410 </para>
51411 <variablelist>
51412 <varlistentry>
51413 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
51414 <listitem>
51415 <para>
51416 A pointer to the next header line, or NULL for the last line.
51417 </para>
51418 </listitem></varlistentry>
51419 <varlistentry>
51420 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
51421 <listitem>
51422 <para>
51423 A code identifying certain headers that Exim recognizes. The codes are printing
51424 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
51425 Notice in particular that any header line whose type is * is not transmitted
51426 with the message. This flagging is used for header lines that have been
51427 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
51428 lines.) Effectively, * means <quote>deleted</quote>.
51429 </para>
51430 </listitem></varlistentry>
51431 <varlistentry>
51432 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
51433 <listitem>
51434 <para>
51435 The number of characters in the header line, including the terminating and any
51436 internal newlines.
51437 </para>
51438 </listitem></varlistentry>
51439 <varlistentry>
51440 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
51441 <listitem>
51442 <para>
51443 A pointer to the text of the header. It always ends with a newline, followed by
51444 a zero byte. Internal newlines are preserved.
51445 </para>
51446 </listitem></varlistentry>
51447 </variablelist>
51448 </section>
51449 <section>
51450 <title>Structure of recipient items</title>
51451 <para>
51452 The <option>recipient_item</option> structure contains these members:
51453 </para>
51454 <variablelist>
51455 <varlistentry>
51456 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
51457 <listitem>
51458 <para>
51459 This is a pointer to the recipient address as it was received.
51460 </para>
51461 </listitem></varlistentry>
51462 <varlistentry>
51463 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
51464 <listitem>
51465 <para>
51466 This is used in later Exim processing when top level addresses are created by
51467 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
51468 and must always contain -1 at this stage.
51469 </para>
51470 </listitem></varlistentry>
51471 <varlistentry>
51472 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
51473 <listitem>
51474 <para>
51475 If this value is not NULL, bounce messages caused by failing to deliver to the
51476 recipient are sent to the address it contains. In other words, it overrides the
51477 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
51478 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
51479 an unqualified address, Exim qualifies it using the domain from
51480 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
51481 is NULL for all recipients.
51482 </para>
51483 </listitem></varlistentry>
51484 </variablelist>
51485 </section>
51486 <section>
51487 <title>Available Exim functions</title>
51488 <para>
51489 <indexterm role="concept">
51490 <primary><function>local_scan()</function> function</primary>
51491 <secondary>available Exim functions</secondary>
51492 </indexterm>
51493 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
51494 These are the only ones that are guaranteed to be maintained from release to
51495 release:
51496 </para>
51497 <variablelist>
51498 <varlistentry>
51499 <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>
51500 <listitem>
51501 <para>
51502 This function creates a child process that runs the command specified by
51503 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
51504 be NULL if no environment variables are to be passed. A new umask is supplied
51505 for the process in <option>newumask</option>.
51506 </para>
51507 <para>
51508 Pipes to the standard input and output of the new process are set up
51509 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
51510 standard error is cloned to the standard output. If there are any file
51511 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
51512 argument is TRUE, the new process is made into a process group leader.
51513 </para>
51514 <para>
51515 The function returns the pid of the new process, or -1 if things go wrong.
51516 </para>
51517 </listitem></varlistentry>
51518 <varlistentry>
51519 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
51520 <listitem>
51521 <para>
51522 This function waits for a child process to terminate, or for a timeout (in
51523 seconds) to expire. A timeout value of zero means wait as long as it takes. The
51524 return value is as follows:
51525 </para>
51526 <itemizedlist>
51527 <listitem>
51528 <para>
51529 &gt;= 0
51530 </para>
51531 <para>
51532 The process terminated by a normal exit and the value is the process
51533 ending status.
51534 </para>
51535 </listitem>
51536 <listitem>
51537 <para>
51538 &lt; 0 and &gt; &ndash;256
51539 </para>
51540 <para>
51541 The process was terminated by a signal and the value is the negation of the
51542 signal number.
51543 </para>
51544 </listitem>
51545 <listitem>
51546 <para>
51547 &ndash;256
51548 </para>
51549 <para>
51550 The process timed out.
51551 </para>
51552 </listitem>
51553 <listitem>
51554 <para>
51555 &ndash;257
51556 </para>
51557 <para>
51558 The was some other error in wait(); <option>errno</option> is still set.
51559 </para>
51560 </listitem>
51561 </itemizedlist>
51562 </listitem></varlistentry>
51563 <varlistentry>
51564 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
51565 <listitem>
51566 <para>
51567 This function provide you with a means of submitting a new message to
51568 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
51569 want, but this packages it all up for you.) The function creates a pipe,
51570 forks a subprocess that is running
51571 </para>
51572 <literallayout class="monospaced">
51573 exim -t -oem -oi -f &lt;&gt;
51574 </literallayout>
51575 <para>
51576 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
51577 that is connected to the standard input. The yield of the function is the PID
51578 of the subprocess. You can then write a message to the file descriptor, with
51579 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
51580 </para>
51581 <para>
51582 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
51583 finish and to collect its ending status. A timeout value of zero is usually
51584 fine in this circumstance. Unless you have made a mistake with the recipient
51585 addresses, you should get a return code of zero.
51586 </para>
51587 </listitem></varlistentry>
51588 <varlistentry>
51589 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
51590 <listitem>
51591 <para>
51592 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
51593 that it runs is:
51594 </para>
51595 <literallayout>
51596 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
51597 </literallayout>
51598 <para>
51599 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
51600 </para>
51601 </listitem></varlistentry>
51602 <varlistentry>
51603 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
51604 <listitem>
51605 <para>
51606 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
51607 output is written to the standard error stream. If no debugging is selected,
51608 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
51609 conditional on the <literal>local_scan</literal> debug selector by coding like this:
51610 </para>
51611 <literallayout class="monospaced">
51612 if ((debug_selector &amp; D_local_scan) != 0)
51613   debug_printf("xxx", ...);
51614 </literallayout>
51615 </listitem></varlistentry>
51616 <varlistentry>
51617 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
51618 <listitem>
51619 <para>
51620 This is an interface to Exim&#x2019;s string expansion code. The return value is the
51621 expanded string, or NULL if there was an expansion failure.
51622 The C variable <option>expand_string_message</option> contains an error message after an
51623 expansion failure. If expansion does not change the string, the return value is
51624 the pointer to the input string. Otherwise, the return value points to a new
51625 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
51626 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
51627 </para>
51628 </listitem></varlistentry>
51629 <varlistentry>
51630 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
51631 <listitem>
51632 <para>
51633 This function allows you to an add additional header line at the end of the
51634 existing ones. The first argument is the type, and should normally be a space
51635 character. The second argument is a format string and any number of
51636 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
51637 if you want, and you must ensure that the string ends with a newline.
51638 </para>
51639 </listitem></varlistentry>
51640 <varlistentry>
51641 <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>
51642 <listitem>
51643 <para>
51644 This function adds a new header line at a specified point in the header
51645 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
51646 </para>
51647 <para>
51648 If <option>name</option> is NULL, the new header is added at the end of the chain if
51649 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
51650 NULL, the header lines are searched for the first non-deleted header that
51651 matches the name. If one is found, the new header is added before it if
51652 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
51653 found header and any adjacent subsequent ones with the same name (even if
51654 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
51655 option controls where the header is added. If it is true, addition is at the
51656 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
51657 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
51658 </para>
51659 <literallayout class="monospaced">
51660 header_add_at_position(TRUE, US"Received", TRUE,
51661   ' ', "X-xxx: ...");
51662 </literallayout>
51663 <para>
51664 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
51665 there may not be if <option>received_header_text</option> expands to an empty string.
51666 </para>
51667 </listitem></varlistentry>
51668 <varlistentry>
51669 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
51670 <listitem>
51671 <para>
51672 This function removes header lines. If <option>occurrence</option> is zero or negative, all
51673 occurrences of the header are removed. If occurrence is greater than zero, that
51674 particular instance of the header is removed. If no header(s) can be found that
51675 match the specification, the function does nothing.
51676 </para>
51677 </listitem></varlistentry>
51678 <varlistentry>
51679 <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>
51680 <listitem>
51681 <para>
51682 This function tests whether the given header has the given name. It is not just
51683 a string comparison, because white space is permitted between the name and the
51684 colon. If the <option>notdel</option> argument is true, a false return is forced for all
51685 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
51686 </para>
51687 <literallayout class="monospaced">
51688 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
51689 </literallayout>
51690 </listitem></varlistentry>
51691 <varlistentry>
51692 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
51693 <listitem>
51694 <para>
51695 <indexterm role="concept">
51696 <primary>base64 encoding</primary>
51697 <secondary>functions for <function>local_scan()</function> use</secondary>
51698 </indexterm>
51699 This function base64-encodes a string, which is passed by address and length.
51700 The text may contain bytes of any value, including zero. The result is passed
51701 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
51702 zero-terminated.
51703 </para>
51704 </listitem></varlistentry>
51705 <varlistentry>
51706 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
51707 <listitem>
51708 <para>
51709 This function decodes a base64-encoded string. Its arguments are a
51710 zero-terminated base64-encoded string and the address of a variable that is set
51711 to point to the result, which is in dynamic memory. The length of the decoded
51712 string is the yield of the function. If the input is invalid base64 data, the
51713 yield is -1. A zero byte is added to the end of the output string to make it
51714 easy to interpret as a C string (assuming it contains no zeros of its own). The
51715 added zero byte is not included in the returned count.
51716 </para>
51717 </listitem></varlistentry>
51718 <varlistentry>
51719 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
51720 <listitem>
51721 <para>
51722 This function checks for a match in a domain list. Domains are always
51723 matched caselessly. The return value is one of the following:
51724 </para>
51725 <literallayout>
51726 <literal>OK     </literal> match succeeded
51727 <literal>FAIL   </literal> match failed
51728 <literal>DEFER  </literal> match deferred
51729 </literallayout>
51730 <para>
51731 DEFER is usually caused by some kind of lookup defer, such as the
51732 inability to contact a database.
51733 </para>
51734 </listitem></varlistentry>
51735 <varlistentry>
51736 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
51737 <listitem>
51738 <para>
51739 This function checks for a match in a local part list. The third argument
51740 controls case-sensitivity. The return values are as for
51741 <emphasis>lss_match_domain()</emphasis>.
51742 </para>
51743 </listitem></varlistentry>
51744 <varlistentry>
51745 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
51746 <listitem>
51747 <para>
51748 This function checks for a match in an address list. The third argument
51749 controls the case-sensitivity of the local part match. The domain is always
51750 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
51751 </para>
51752 </listitem></varlistentry>
51753 <varlistentry>
51754 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
51755 <listitem>
51756 <para>
51757 This function checks for a match in a host list. The most common usage is
51758 expected to be
51759 </para>
51760 <literallayout class="monospaced">
51761 lss_match_host(sender_host_name, sender_host_address, ...)
51762 </literallayout>
51763 <para>
51764 <indexterm role="concept">
51765 <primary><varname>$sender_host_address</varname></primary>
51766 </indexterm>
51767 An empty address field matches an empty item in the host list. If the host name
51768 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
51769 looked up if a host name is required to match an item in the list. The return
51770 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
51771 returns ERROR in the case when it had to look up a host name, but the lookup
51772 failed.
51773 </para>
51774 </listitem></varlistentry>
51775 <varlistentry>
51776 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
51777 <listitem>
51778 <para>
51779 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
51780 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
51781 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
51782 them. It specifies to which log or logs the message is written. The remaining
51783 arguments are a format and relevant insertion arguments. The string should not
51784 contain any newlines, not even at the end.
51785 </para>
51786 </listitem></varlistentry>
51787 <varlistentry>
51788 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
51789 <listitem>
51790 <para>
51791 This function adds an additional recipient to the message. The first argument
51792 is the recipient address. If it is unqualified (has no domain), it is qualified
51793 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
51794 </para>
51795 <para>
51796 This function does not allow you to specify a private <option>errors_to</option> address (as
51797 described with the structure of <option>recipient_item</option> above), because it pre-dates
51798 the addition of that field to the structure. However, it is easy to add such a
51799 value afterwards. For example:
51800 </para>
51801 <literallayout class="monospaced">
51802  receive_add_recipient(US"monitor@mydom.example", -1);
51803  recipients_list[recipients_count-1].errors_to =
51804    US"postmaster@mydom.example";
51805 </literallayout>
51806 </listitem></varlistentry>
51807 <varlistentry>
51808 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
51809 <listitem>
51810 <para>
51811 This is a convenience function to remove a named recipient from the list of
51812 recipients. It returns true if a recipient was removed, and false if no
51813 matching recipient could be found. The argument must be a complete email
51814 address.
51815 </para>
51816 </listitem></varlistentry>
51817 </variablelist>
51818 <para>
51819 <indexterm role="concept">
51820 <primary>RFC 2047</primary>
51821 </indexterm>
51822 </para>
51823 <variablelist>
51824 <varlistentry>
51825 <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>
51826 <listitem>
51827 <para>
51828 This function decodes strings that are encoded according to RFC 2047. Typically
51829 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
51830 from the Q or B encoding into a byte-string. Then, if provided with the name of
51831 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
51832 made  to translate the result to the named character set. If this fails, the
51833 binary string is returned with an error message.
51834 </para>
51835 <para>
51836 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
51837 maximum MIME word length is enforced. The third argument is the target
51838 encoding, or NULL if no translation is wanted.
51839 </para>
51840 <para>
51841 <indexterm role="concept">
51842 <primary>binary zero</primary>
51843 <secondary>in RFC 2047 decoding</secondary>
51844 </indexterm>
51845 <indexterm role="concept">
51846 <primary>RFC 2047</primary>
51847 <secondary>binary zero in</secondary>
51848 </indexterm>
51849 If a binary zero is encountered in the decoded string, it is replaced by the
51850 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
51851 not be 0 because header lines are handled as zero-terminated strings.
51852 </para>
51853 <para>
51854 The function returns the result of processing the string, zero-terminated; if
51855 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
51856 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
51857 </para>
51858 <para>
51859 If an error is encountered, the function returns NULL and uses the <option>error</option>
51860 argument to return an error message. The variable pointed to by <option>error</option> is
51861 set to NULL if there is no error; it may be set non-NULL even when the function
51862 returns a non-NULL value if decoding was successful, but there was a problem
51863 with translation.
51864 </para>
51865 </listitem></varlistentry>
51866 <varlistentry>
51867 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
51868 <listitem>
51869 <para>
51870 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
51871 below.
51872 </para>
51873 </listitem></varlistentry>
51874 <varlistentry>
51875 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
51876 <listitem>
51877 <para>
51878 The arguments of this function are like <function>printf()</function>; it writes to the SMTP
51879 output stream. You should use this function only when there is an SMTP output
51880 stream, that is, when the incoming message is being received via interactive
51881 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
51882 is FALSE. If you want to test for an incoming message from another host (as
51883 opposed to a local process that used the <option>-bs</option> command line option), you can
51884 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
51885 is involved.
51886 </para>
51887 <para>
51888 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
51889 output function, so it can be used for all forms of SMTP connection.
51890 </para>
51891 <para>
51892 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
51893 must start with an appropriate response code: 550 if you are going to return
51894 LOCAL_SCAN_REJECT, 451 if you are going to return
51895 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
51896 initial lines of a multi-line response, the code must be followed by a hyphen
51897 to indicate that the line is not the final response line. You must also ensure
51898 that the lines you write terminate with CRLF. For example:
51899 </para>
51900 <literallayout class="monospaced">
51901 smtp_printf("550-this is some extra info\r\n");
51902 return LOCAL_SCAN_REJECT;
51903 </literallayout>
51904 <para>
51905 Note that you can also create multi-line responses by including newlines in
51906 the data returned via the <option>return_text</option> argument. The added value of using
51907 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
51908 multiple output lines.
51909 </para>
51910 <para>
51911 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
51912 does not automatically flush pending output, and therefore does not test
51913 the state of the stream. (In the main code of Exim, flushing and error
51914 detection is done when Exim is ready for the next SMTP input command.) If
51915 you want to flush the output and check for an error (for example, the
51916 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
51917 arguments. It flushes the output stream, and returns a non-zero value if there
51918 is an error.
51919 </para>
51920 </listitem></varlistentry>
51921 <varlistentry>
51922 <term><emphasis role="bold">void&nbsp;*store_get(int)</emphasis></term>
51923 <listitem>
51924 <para>
51925 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
51926 chunk of memory whose size is given by the argument. Exim bombs out if it ever
51927 runs out of memory. See the next section for a discussion of memory handling.
51928 </para>
51929 </listitem></varlistentry>
51930 <varlistentry>
51931 <term><emphasis role="bold">void&nbsp;*store_get_perm(int)</emphasis></term>
51932 <listitem>
51933 <para>
51934 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
51935 permanent pool. See the next section for a discussion of memory handling.
51936 </para>
51937 </listitem></varlistentry>
51938 <varlistentry>
51939 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
51940 <listitem>
51941 <para>
51942 See below.
51943 </para>
51944 </listitem></varlistentry>
51945 <varlistentry>
51946 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
51947 <listitem>
51948 <para>
51949 See below.
51950 </para>
51951 </listitem></varlistentry>
51952 <varlistentry>
51953 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
51954 <listitem>
51955 <para>
51956 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
51957 The first makes a copy of an entire string. The second copies up to a maximum
51958 number of characters, indicated by the second argument. The third uses a format
51959 and insertion arguments to create a new string. In each case, the result is a
51960 pointer to a new string in the current memory pool. See the next section for
51961 more discussion.
51962 </para>
51963 </listitem></varlistentry>
51964 </variablelist>
51965 </section>
51966 <section id="SECTmemhanloc">
51967 <title>More about Exim&#x2019;s memory handling</title>
51968 <para>
51969 <indexterm role="concept">
51970 <primary><function>local_scan()</function> function</primary>
51971 <secondary>memory handling</secondary>
51972 </indexterm>
51973 No function is provided for freeing memory, because that is never needed.
51974 The dynamic memory that Exim uses when receiving a message is automatically
51975 recycled if another message is received by the same process (this applies only
51976 to incoming SMTP connections &ndash; other input methods can supply only one
51977 message at a time). After receiving the last message, a reception process
51978 terminates.
51979 </para>
51980 <para>
51981 Because it is recycled, the normal dynamic memory cannot be used for holding
51982 data that must be preserved over a number of incoming messages on the same SMTP
51983 connection. However, Exim in fact uses two pools of dynamic memory; the second
51984 one is not recycled, and can be used for this purpose.
51985 </para>
51986 <para>
51987 If you want to allocate memory that remains available for subsequent messages
51988 in the same SMTP connection, you should set
51989 </para>
51990 <literallayout class="monospaced">
51991 store_pool = POOL_PERM
51992 </literallayout>
51993 <para>
51994 before calling the function that does the allocation. There is no need to
51995 restore the value if you do not need to; however, if you do want to revert to
51996 the normal pool, you can either restore the previous value of <option>store_pool</option> or
51997 set it explicitly to POOL_MAIN.
51998 </para>
51999 <para>
52000 The pool setting applies to all functions that get dynamic memory, including
52001 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
52002 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
52003 block of memory from the permanent pool while preserving the value of
52004 <option>store_pool</option>.
52005 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
52006 </para>
52007 </section>
52008 </chapter>
52009
52010 <chapter id="CHAPsystemfilter">
52011 <title>System-wide message filtering</title>
52012 <para>
52013 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
52014 <primary>filter</primary>
52015 <secondary>system filter</secondary>
52016 </indexterm>
52017 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
52018 <primary>filtering all mail</primary>
52019 </indexterm>
52020 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
52021 <primary>system filter</primary>
52022 </indexterm>
52023 The previous chapters (on ACLs and the local scan function) describe checks
52024 that can be applied to messages before they are accepted by a host. There is
52025 also a mechanism for checking messages once they have been received, but before
52026 they are delivered. This is called the <emphasis>system filter</emphasis>.
52027 </para>
52028 <para>
52029 The system filter operates in a similar manner to users&#x2019; filter files, but it
52030 is run just once per message (however many recipients the message has).
52031 It should not normally be used as a substitute for routing, because <option>deliver</option>
52032 commands in a system router provide new envelope recipient addresses.
52033 The system filter must be an Exim filter. It cannot be a Sieve filter.
52034 </para>
52035 <para>
52036 The system filter is run at the start of a delivery attempt, before any routing
52037 is done. If a message fails to be completely delivered at the first attempt,
52038 the system filter is run again at the start of every retry.
52039 If you want your filter to do something only once per message, you can make use
52040 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
52041 prevent it happening on retries.
52042 </para>
52043 <para>
52044 <indexterm role="concept">
52045 <primary><varname>$domain</varname></primary>
52046 </indexterm>
52047 <indexterm role="concept">
52048 <primary><varname>$local_part</varname></primary>
52049 </indexterm>
52050 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
52051 specific to individual recipient addresses, such as <varname>$local_part</varname> and
52052 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
52053 you want to run a centrally-specified filter for each recipient address
52054 independently, you can do so by setting up a suitable <command>redirect</command> router, as
52055 described in section <xref linkend="SECTperaddfil"/> below.
52056 </para>
52057 <section>
52058 <title>Specifying a system filter</title>
52059 <para>
52060 <indexterm role="concept">
52061 <primary>uid (user id)</primary>
52062 <secondary>system filter</secondary>
52063 </indexterm>
52064 <indexterm role="concept">
52065 <primary>gid (group id)</primary>
52066 <secondary>system filter</secondary>
52067 </indexterm>
52068 The name of the file that contains the system filter must be specified by
52069 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
52070 other than root, you must also set <option>system_filter_user</option> and
52071 <option>system_filter_group</option> as appropriate. For example:
52072 </para>
52073 <literallayout class="monospaced">
52074 system_filter = /etc/mail/exim.filter
52075 system_filter_user = exim
52076 </literallayout>
52077 <para>
52078 If a system filter generates any deliveries directly to files or pipes (via the
52079 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
52080 specified by setting <option>system_filter_file_transport</option> and
52081 <option>system_filter_pipe_transport</option>, respectively. Similarly,
52082 <option>system_filter_reply_transport</option> must be set to handle any messages generated
52083 by the <option>reply</option> command.
52084 </para>
52085 </section>
52086 <section>
52087 <title>Testing a system filter</title>
52088 <para>
52089 You can run simple tests of a system filter in the same way as for a user
52090 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
52091 are permitted only in system filters are recognized.
52092 </para>
52093 <para>
52094 If you want to test the combined effect of a system filter and a user filter,
52095 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
52096 </para>
52097 </section>
52098 <section>
52099 <title>Contents of a system filter</title>
52100 <para>
52101 The language used to specify system filters is the same as for users&#x2019; filter
52102 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
52103 mail filtering</emphasis>. However, there are some additional features that are
52104 available only in system filters; these are described in subsequent sections.
52105 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
52106 they cause errors.
52107 </para>
52108 <para>
52109 <indexterm role="concept">
52110 <primary>frozen messages</primary>
52111 <secondary>manual thaw; testing in filter</secondary>
52112 </indexterm>
52113 There are two special conditions which, though available in users&#x2019; filter
52114 files, are designed for use in system filters. The condition <option>first_delivery</option>
52115 is true only for the first attempt at delivering a message, and
52116 <option>manually_thawed</option> is true only if the message has been frozen, and
52117 subsequently thawed by an admin user. An explicit forced delivery counts as a
52118 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
52119 </para>
52120 <para>
52121 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
52122 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
52123 succeed, it will not be tried again.
52124 If you want Exim to retry an unseen delivery until it succeeds, you should
52125 arrange to set it up every time the filter runs.
52126 </para>
52127 <para>
52128 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
52129 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
52130 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
52131 to which users&#x2019; filter files can refer.
52132 </para>
52133 </section>
52134 <section>
52135 <title>Additional variable for system filters</title>
52136 <para>
52137 <indexterm role="concept">
52138 <primary><varname>$recipients</varname></primary>
52139 </indexterm>
52140 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
52141 of the message (separated by commas and white space), is available in system
52142 filters. It is not available in users&#x2019; filters for privacy reasons.
52143 </para>
52144 </section>
52145 <section>
52146 <title>Defer, freeze, and fail commands for system filters</title>
52147 <para>
52148 <indexterm role="concept">
52149 <primary>freezing messages</primary>
52150 </indexterm>
52151 <indexterm role="concept">
52152 <primary>message</primary>
52153 <secondary>freezing</secondary>
52154 </indexterm>
52155 <indexterm role="concept">
52156 <primary>message</primary>
52157 <secondary>forced failure</secondary>
52158 </indexterm>
52159 <indexterm role="concept">
52160 <primary><option>fail</option></primary>
52161 <secondary>in system filter</secondary>
52162 </indexterm>
52163 <indexterm role="concept">
52164 <primary><option>freeze</option> in system filter</primary>
52165 </indexterm>
52166 <indexterm role="concept">
52167 <primary><option>defer</option> in system filter</primary>
52168 </indexterm>
52169 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
52170 always available in system filters, but are not normally enabled in users&#x2019;
52171 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
52172 for the <command>redirect</command> router.) These commands can optionally be followed by the
52173 word <option>text</option> and a string containing an error message, for example:
52174 </para>
52175 <literallayout class="monospaced">
52176 fail text "this message looks like spam to me"
52177 </literallayout>
52178 <para>
52179 The keyword <option>text</option> is optional if the next character is a double quote.
52180 </para>
52181 <para>
52182 The <option>defer</option> command defers delivery of the original recipients of the
52183 message. The <option>fail</option> command causes all the original recipients to be failed,
52184 and a bounce message to be created. The <option>freeze</option> command suspends all
52185 delivery attempts for the original recipients. In all cases, any new deliveries
52186 that are specified by the filter are attempted as normal after the filter has
52187 run.
52188 </para>
52189 <para>
52190 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
52191 not manually frozen since. This means that automatic freezing by a system
52192 filter can be used as a way of checking out suspicious messages. If a message
52193 is found to be all right, manually unfreezing it allows it to be delivered.
52194 </para>
52195 <para>
52196 <indexterm role="concept">
52197 <primary>log</primary>
52198 <secondary><option>fail</option> command log line</secondary>
52199 </indexterm>
52200 <indexterm role="concept">
52201 <primary><option>fail</option></primary>
52202 <secondary>log line; reducing</secondary>
52203 </indexterm>
52204 The text given with a fail command is used as part of the bounce message as
52205 well as being written to the log. If the message is quite long, this can fill
52206 up a lot of log space when such failures are common. To reduce the size of the
52207 log message, Exim interprets the text in a special way if it starts with the
52208 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
52209 strings is written to the log, and the rest of the text is used in the bounce
52210 message. For example:
52211 </para>
52212 <literallayout class="monospaced">
52213 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
52214      because it contains attachments that we are \
52215      not prepared to receive."
52216 </literallayout>
52217 <para>
52218 <indexterm role="concept">
52219 <primary>loop</primary>
52220 <secondary>caused by <option>fail</option></secondary>
52221 </indexterm>
52222 Take great care with the <option>fail</option> command when basing the decision to fail on
52223 the contents of the message, because the bounce message will of course include
52224 the contents of the original message and will therefore trigger the <option>fail</option>
52225 command again (causing a mail loop) unless steps are taken to prevent this.
52226 Testing the <option>error_message</option> condition is one way to prevent this. You could
52227 use, for example
52228 </para>
52229 <literallayout class="monospaced">
52230 if $message_body contains "this is spam" and not error_message
52231 then fail text "spam is not wanted here" endif
52232 </literallayout>
52233 <para>
52234 though of course that might let through unwanted bounce messages. The
52235 alternative is clever checking of the body and/or headers to detect bounces
52236 generated by the filter.
52237 </para>
52238 <para>
52239 The interpretation of a system filter file ceases after a
52240 <option>defer</option>,
52241 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
52242 set up earlier in the filter file are honoured, so you can use a sequence such
52243 as
52244 </para>
52245 <literallayout class="monospaced">
52246 mail ...
52247 freeze
52248 </literallayout>
52249 <para>
52250 to send a specified message when the system filter is freezing (or deferring or
52251 failing) a message. The normal deliveries for the message do not, of course,
52252 take place.
52253 </para>
52254 </section>
52255 <section id="SECTaddremheasys">
52256 <title>Adding and removing headers in a system filter</title>
52257 <para>
52258 <indexterm role="concept">
52259 <primary>header lines</primary>
52260 <secondary>adding; in system filter</secondary>
52261 </indexterm>
52262 <indexterm role="concept">
52263 <primary>header lines</primary>
52264 <secondary>removing; in system filter</secondary>
52265 </indexterm>
52266 <indexterm role="concept">
52267 <primary>filter</primary>
52268 <secondary>header lines; adding/removing</secondary>
52269 </indexterm>
52270 Two filter commands that are available only in system filters are:
52271 </para>
52272 <literallayout class="monospaced">
52273 headers add &lt;string&gt;
52274 headers remove &lt;string&gt;
52275 </literallayout>
52276 <para>
52277 The argument for the <option>headers add</option> is a string that is expanded and then
52278 added to the end of the message&#x2019;s headers. It is the responsibility of the
52279 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
52280 space is ignored, and if the string is otherwise empty, or if the expansion is
52281 forced to fail, the command has no effect.
52282 </para>
52283 <para>
52284 You can use <quote>\n</quote> within the string, followed by white space, to specify
52285 continued header lines. More than one header may be added in one command by
52286 including <quote>\n</quote> within the string without any following white space. For
52287 example:
52288 </para>
52289 <literallayout class="monospaced">
52290 headers add "X-header-1: ....\n  \
52291              continuation of X-header-1 ...\n\
52292              X-header-2: ...."
52293 </literallayout>
52294 <para>
52295 Note that the header line continuation white space after the first newline must
52296 be placed before the backslash that continues the input string, because white
52297 space after input continuations is ignored.
52298 </para>
52299 <para>
52300 The argument for <option>headers remove</option> is a colon-separated list of header names.
52301 This command applies only to those headers that are stored with the message;
52302 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
52303 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
52304 header with the same name, they are all removed.
52305 </para>
52306 <para>
52307 The <option>headers</option> command in a system filter makes an immediate change to the set
52308 of header lines that was received with the message (with possible additions
52309 from ACL processing). Subsequent commands in the system filter operate on the
52310 modified set, which also forms the basis for subsequent message delivery.
52311 Unless further modified during routing or transporting, this set of headers is
52312 used for all recipients of the message.
52313 </para>
52314 <para>
52315 During routing and transporting, the variables that refer to the contents of
52316 header lines refer only to those lines that are in this set. Thus, header lines
52317 that are added by a system filter are visible to users&#x2019; filter files and to all
52318 routers and transports. This contrasts with the manipulation of header lines by
52319 routers and transports, which is not immediate, but which instead is saved up
52320 until the message is actually being written (see section
52321 <xref linkend="SECTheadersaddrem"/>).
52322 </para>
52323 <para>
52324 If the message is not delivered at the first attempt, header lines that were
52325 added by the system filter are stored with the message, and so are still
52326 present at the next delivery attempt. Header lines that were removed are still
52327 present, but marked <quote>deleted</quote> so that they are not transported with the
52328 message. For this reason, it is usual to make the <option>headers</option> command
52329 conditional on <option>first_delivery</option> so that the set of header lines is not
52330 modified more than once.
52331 </para>
52332 <para>
52333 Because header modification in a system filter acts immediately, you have to
52334 use an indirect approach if you want to modify the contents of a header line.
52335 For example:
52336 </para>
52337 <literallayout class="monospaced">
52338 headers add "Old-Subject: $h_subject:"
52339 headers remove "Subject"
52340 headers add "Subject: new subject (was: $h_old-subject:)"
52341 headers remove "Old-Subject"
52342 </literallayout>
52343 </section>
52344 <section>
52345 <title>Setting an errors address in a system filter</title>
52346 <para>
52347 <indexterm role="concept">
52348 <primary>envelope sender</primary>
52349 </indexterm>
52350 In a system filter, if a <option>deliver</option> command is followed by
52351 </para>
52352 <literallayout class="monospaced">
52353 errors_to &lt;some address&gt;
52354 </literallayout>
52355 <para>
52356 in order to change the envelope sender (and hence the error reporting) for that
52357 delivery, any address may be specified. (In a user filter, only the current
52358 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
52359 might use
52360 </para>
52361 <literallayout class="monospaced">
52362 unseen deliver monitor@spying.example errors_to root@local.example
52363 </literallayout>
52364 <para>
52365 to take a copy which would not be sent back to the normal error reporting
52366 address if its delivery failed.
52367 </para>
52368 </section>
52369 <section id="SECTperaddfil">
52370 <title>Per-address filtering</title>
52371 <para>
52372 <indexterm role="concept">
52373 <primary><varname>$domain</varname></primary>
52374 </indexterm>
52375 <indexterm role="concept">
52376 <primary><varname>$local_part</varname></primary>
52377 </indexterm>
52378 In contrast to the system filter, which is run just once per message for each
52379 delivery attempt, it is also possible to set up a system-wide filtering
52380 operation that runs once for each recipient address. In this case, variables
52381 such as <varname>$local_part</varname> and <varname>$domain</varname> can be used, and indeed, the choice of
52382 filter file could be made dependent on them. This is an example of a router
52383 which implements such a filter:
52384 </para>
52385 <literallayout class="monospaced">
52386 central_filter:
52387   check_local_user
52388   driver = redirect
52389   domains = +local_domains
52390   file = /central/filters/$local_part
52391   no_verify
52392   allow_filter
52393   allow_freeze
52394 </literallayout>
52395 <para>
52396 The filter is run in a separate process under its own uid. Therefore, either
52397 <option>check_local_user</option> must be set (as above), in which case the filter is run as
52398 the local user, or the <option>user</option> option must be used to specify which user to
52399 use. If both are set, <option>user</option> overrides.
52400 </para>
52401 <para>
52402 Care should be taken to ensure that none of the commands in the filter file
52403 specify a significant delivery if the message is to go on to be delivered to
52404 its intended recipient. The router will not then claim to have dealt with the
52405 address, so it will be passed on to subsequent routers to be delivered in the
52406 normal way.
52407 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
52408 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
52409 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
52410 </para>
52411 </section>
52412 </chapter>
52413
52414 <chapter id="CHAPmsgproc">
52415 <title>Message processing</title>
52416 <para>
52417 <indexterm role="concept" id="IIDmesproc" class="startofrange">
52418 <primary>message</primary>
52419 <secondary>general processing</secondary>
52420 </indexterm>
52421 Exim performs various transformations on the sender and recipient addresses of
52422 all messages that it handles, and also on the messages&#x2019; header lines. Some of
52423 these are optional and configurable, while others always take place. All of
52424 this processing, except rewriting as a result of routing, and the addition or
52425 removal of header lines while delivering, happens when a message is received,
52426 before it is placed on Exim&#x2019;s queue.
52427 </para>
52428 <para>
52429 Some of the automatic processing takes place by default only for
52430 <quote>locally-originated</quote> messages. This adjective is used to describe messages
52431 that are not received over TCP/IP, but instead are passed to an Exim process on
52432 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
52433 set up by the <option>-bs</option> command line option.
52434 </para>
52435 <para>
52436 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
52437 or ::1) are not considered to be locally-originated. Exim does not treat the
52438 loopback interface specially in any way.
52439 </para>
52440 <para>
52441 If you want the loopback interface to be treated specially, you must ensure
52442 that there are appropriate entries in your ACLs.
52443 </para>
52444 <section id="SECTsubmodnon">
52445 <title>Submission mode for non-local messages</title>
52446 <para>
52447 <indexterm role="concept">
52448 <primary>message</primary>
52449 <secondary>submission</secondary>
52450 </indexterm>
52451 <indexterm role="concept">
52452 <primary>submission mode</primary>
52453 </indexterm>
52454 Processing that happens automatically for locally-originated messages (unless
52455 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
52456 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
52457 state. Submisssion mode is set by the modifier
52458 </para>
52459 <literallayout class="monospaced">
52460 control = submission
52461 </literallayout>
52462 <para>
52463 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
52464 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
52465 a local submission, and is normally used when the source of the message is
52466 known to be an MUA running on a client host (as opposed to an MTA). For
52467 example, to set submission mode for messages originating on the IPv4 loopback
52468 interface, you could include the following in the MAIL ACL:
52469 </para>
52470 <literallayout class="monospaced">
52471 warn  hosts = 127.0.0.1
52472       control = submission
52473 </literallayout>
52474 <para>
52475 <indexterm role="concept">
52476 <primary><option>sender_retain</option></primary>
52477 </indexterm>
52478 There are some options that can be used when setting submission mode. A slash
52479 is used to separate options. For example:
52480 </para>
52481 <literallayout class="monospaced">
52482 control = submission/sender_retain
52483 </literallayout>
52484 <para>
52485 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
52486 true and <option>local_from_check</option> false for the current incoming message. The first
52487 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
52488 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
52489 authenticated sender. With this setting, Exim still fixes up messages by adding
52490 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
52491 attempt to check sender authenticity in header lines.
52492 </para>
52493 <para>
52494 When <option>sender_retain</option> is not set, a submission mode setting may specify a
52495 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
52496 example:
52497 </para>
52498 <literallayout class="monospaced">
52499 control = submission/domain=some.domain
52500 </literallayout>
52501 <para>
52502 The domain may be empty. How this value is used is described in sections
52503 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
52504 that allows you to specify the user&#x2019;s full name for inclusion in a created
52505 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
52506 </para>
52507 <literallayout class="monospaced">
52508 accept authenticated = *
52509        control = submission/domain=wonderland.example/\
52510                             name=${lookup {$authenticated_id} \
52511                                    lsearch {/etc/exim/namelist}}
52512 </literallayout>
52513 <para>
52514 Because the name may contain any characters, including slashes, the <option>name</option>
52515 option must be given last. The remainder of the string is used as the name. For
52516 the example above, if <filename>/etc/exim/namelist</filename> contains:
52517 </para>
52518 <literallayout class="monospaced">
52519 bigegg:  Humpty Dumpty
52520 </literallayout>
52521 <para>
52522 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
52523 line would be:
52524 </para>
52525 <literallayout class="monospaced">
52526 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
52527 </literallayout>
52528 <para>
52529 <indexterm role="concept">
52530 <primary>return path</primary>
52531 <secondary>in submission mode</secondary>
52532 </indexterm>
52533 By default, submission mode forces the return path to the same address as is
52534 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
52535 specified, the return path is also left unchanged.
52536 </para>
52537 <para>
52538 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
52539 ACL. This means that any sender checks performed before the fix-ups use the
52540 untrusted sender address specified by the user, not the trusted sender address
52541 specified by submission mode. Although this might be slightly unexpected, it
52542 does mean that you can configure ACL checks to spot that a user is trying to
52543 spoof another&#x2019;s address.
52544 </para>
52545 </section>
52546 <section id="SECTlineendings">
52547 <title>Line endings</title>
52548 <para>
52549 <indexterm role="concept">
52550 <primary>line endings</primary>
52551 </indexterm>
52552 <indexterm role="concept">
52553 <primary>carriage return</primary>
52554 </indexterm>
52555 <indexterm role="concept">
52556 <primary>linefeed</primary>
52557 </indexterm>
52558 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
52559 linefeed) is the line ending for messages transmitted over the Internet using
52560 SMTP over TCP/IP. However, within individual operating systems, different
52561 conventions are used. For example, Unix-like systems use just LF, but others
52562 use CRLF or just CR.
52563 </para>
52564 <para>
52565 Exim was designed for Unix-like systems, and internally, it stores messages
52566 using the system&#x2019;s convention of a single LF as a line terminator. When
52567 receiving a message, all line endings are translated to this standard format.
52568 Originally, it was thought that programs that passed messages directly to an
52569 MTA within an operating system would use that system&#x2019;s convention. Experience
52570 has shown that this is not the case; for example, there are Unix applications
52571 that use CRLF in this circumstance. For this reason, and for compatibility with
52572 other MTAs, the way Exim handles line endings for all messages is now as
52573 follows:
52574 </para>
52575 <itemizedlist>
52576 <listitem>
52577 <para>
52578 LF not preceded by CR is treated as a line ending.
52579 </para>
52580 </listitem>
52581 <listitem>
52582 <para>
52583 CR is treated as a line ending; if it is immediately followed by LF, the LF
52584 is ignored.
52585 </para>
52586 </listitem>
52587 <listitem>
52588 <para>
52589 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
52590 nor a local message in the state where a line containing only a dot is a
52591 terminator.
52592 </para>
52593 </listitem>
52594 <listitem>
52595 <para>
52596 If a bare CR is encountered within a header line, an extra space is added after
52597 the line terminator so as not to end the header line. The reasoning behind this
52598 is that bare CRs in header lines are most likely either to be mistakes, or
52599 people trying to play silly games.
52600 </para>
52601 </listitem>
52602 <listitem>
52603 <para>
52604 If the first header line received in a message ends with CRLF, a subsequent
52605 bare LF in a header line is treated in the same way as a bare CR in a header
52606 line.
52607 </para>
52608 </listitem>
52609 </itemizedlist>
52610 </section>
52611 <section>
52612 <title>Unqualified addresses</title>
52613 <para>
52614 <indexterm role="concept">
52615 <primary>unqualified addresses</primary>
52616 </indexterm>
52617 <indexterm role="concept">
52618 <primary>address</primary>
52619 <secondary>qualification</secondary>
52620 </indexterm>
52621 By default, Exim expects every envelope address it receives from an external
52622 host to be fully qualified. Unqualified addresses cause negative responses to
52623 SMTP commands. However, because SMTP is used as a means of transporting
52624 messages from MUAs running on personal workstations, there is sometimes a
52625 requirement to accept unqualified addresses from specific hosts or IP networks.
52626 </para>
52627 <para>
52628 Exim has two options that separately control which hosts may send unqualified
52629 sender or receipient addresses in SMTP commands, namely
52630 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
52631 cases, if an unqualified address is accepted, it is qualified by adding the
52632 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
52633 </para>
52634 <para>
52635 <indexterm role="concept">
52636 <primary><option>qualify_domain</option></primary>
52637 </indexterm>
52638 <indexterm role="concept">
52639 <primary><option>qualify_recipient</option></primary>
52640 </indexterm>
52641 Unqualified addresses in header lines are automatically qualified for messages
52642 that are locally originated, unless the <option>-bnq</option> option is given on the command
52643 line. For messages received over SMTP, unqualified addresses in header lines
52644 are qualified only if unqualified addresses are permitted in SMTP commands. In
52645 other words, such qualification is also controlled by
52646 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
52647 </para>
52648 </section>
52649 <section>
52650 <title>The UUCP From line</title>
52651 <para>
52652 <indexterm role="concept">
52653 <primary><quote>From</quote> line</primary>
52654 </indexterm>
52655 <indexterm role="concept">
52656 <primary>UUCP</primary>
52657 <secondary><quote>From</quote> line</secondary>
52658 </indexterm>
52659 <indexterm role="concept">
52660 <primary>sender</primary>
52661 <secondary>address</secondary>
52662 </indexterm>
52663 <indexterm role="concept">
52664 <primary><option>uucp_from_pattern</option></primary>
52665 </indexterm>
52666 <indexterm role="concept">
52667 <primary><option>uucp_from_sender</option></primary>
52668 </indexterm>
52669 <indexterm role="concept">
52670 <primary>envelope sender</primary>
52671 </indexterm>
52672 <indexterm role="concept">
52673 <primary>Sendmail compatibility</primary>
52674 <secondary><quote>From</quote> line</secondary>
52675 </indexterm>
52676 Messages that have come from UUCP (and some other applications) often begin
52677 with a line containing the envelope sender and a timestamp, following the word
52678 <quote>From</quote>. Examples of two common formats are:
52679 </para>
52680 <literallayout class="monospaced">
52681 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
52682 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
52683 </literallayout>
52684 <para>
52685 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
52686 Exim recognizes such lines at the start of messages that are submitted to it
52687 via the command line (that is, on the standard input). It does not recognize
52688 such lines in incoming SMTP messages, unless the sending host matches
52689 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
52690 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
52691 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
52692 default value matches the two common cases shown above and puts the address
52693 that follows <quote>From</quote> into <varname>$1</varname>.
52694 </para>
52695 <para>
52696 <indexterm role="concept">
52697 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52698 <secondary>in <quote>From </quote> line handling</secondary>
52699 </indexterm>
52700 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
52701 a trusted user, the message&#x2019;s sender address is constructed by expanding the
52702 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
52703 then parsed as an RFC 2822 address. If there is no domain, the local part is
52704 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
52705 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
52706 </para>
52707 <para>
52708 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
52709 sender address is not changed. This is also the case for incoming SMTP messages
52710 that are permitted to contain <quote>From</quote> lines.
52711 </para>
52712 <para>
52713 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
52714 treated as a data line that starts the body of the message, as it is not valid
52715 as a header line. This also happens if a <quote>From</quote> line is present in an
52716 incoming SMTP message from a source that is not permitted to send them.
52717 </para>
52718 </section>
52719 <section>
52720 <title>Resent- header lines</title>
52721 <para>
52722 <indexterm role="concept">
52723 <primary><option>Resent-</option> header lines</primary>
52724 </indexterm>
52725 RFC 2822 makes provision for sets of header lines starting with the string
52726 <literal>Resent-</literal> to be added to a message when it is resent by the original
52727 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
52728 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
52729 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
52730 </para>
52731 <blockquote>
52732 <para>
52733 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
52734 processing of replies or other such automatic actions on messages.</emphasis>
52735 </para>
52736 </blockquote>
52737 <para>
52738 This leaves things a bit vague as far as other processing actions such as
52739 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
52740 follows:
52741 </para>
52742 <itemizedlist>
52743 <listitem>
52744 <para>
52745 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
52746 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
52747 </para>
52748 </listitem>
52749 <listitem>
52750 <para>
52751 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
52752 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
52753 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
52754 </para>
52755 </listitem>
52756 <listitem>
52757 <para>
52758 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
52759 also removed.
52760 </para>
52761 </listitem>
52762 <listitem>
52763 <para>
52764 For a locally-submitted message,
52765 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
52766 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
52767 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
52768 included in log lines in this case.
52769 </para>
52770 </listitem>
52771 <listitem>
52772 <para>
52773 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
52774 <option>Resent-</option> header lines are present.
52775 </para>
52776 </listitem>
52777 </itemizedlist>
52778 </section>
52779 <section>
52780 <title>The Auto-Submitted: header line</title>
52781 <para>
52782 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
52783 includes the header line:
52784 </para>
52785 <literallayout class="monospaced">
52786 Auto-Submitted: auto-replied
52787 </literallayout>
52788 </section>
52789 <section>
52790 <title>The Bcc: header line</title>
52791 <para>
52792 <indexterm role="concept">
52793 <primary><emphasis>Bcc:</emphasis> header line</primary>
52794 </indexterm>
52795 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
52796 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
52797 extracting its addresses). If <option>-t</option> is not present on the command line, any
52798 existing <emphasis>Bcc:</emphasis> is not removed.
52799 </para>
52800 </section>
52801 <section>
52802 <title>The Date: header line</title>
52803 <para>
52804 <indexterm role="concept">
52805 <primary><emphasis>Date:</emphasis> header line</primary>
52806 </indexterm>
52807 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
52808 Exim adds one, using the current date and time, unless the
52809 <option>suppress_local_fixups</option> control has been specified.
52810 </para>
52811 </section>
52812 <section>
52813 <title>The Delivery-date: header line</title>
52814 <para>
52815 <indexterm role="concept">
52816 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
52817 </indexterm>
52818 <indexterm role="concept">
52819 <primary><option>delivery_date_remove</option></primary>
52820 </indexterm>
52821 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
52822 set. Exim can be configured to add them to the final delivery of messages. (See
52823 the generic <option>delivery_date_add</option> transport option.) They should not be present
52824 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
52825 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
52826 messages.
52827 </para>
52828 </section>
52829 <section>
52830 <title>The Envelope-to: header line</title>
52831 <para>
52832 <indexterm role="concept">
52833 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
52834 </indexterm>
52835 <indexterm role="concept">
52836 <primary><option>envelope_to_remove</option></primary>
52837 </indexterm>
52838 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
52839 Exim can be configured to add them to the final delivery of messages. (See the
52840 generic <option>envelope_to_add</option> transport option.) They should not be present in
52841 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
52842 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
52843 messages.
52844 </para>
52845 </section>
52846 <section id="SECTthefrohea">
52847 <title>The From: header line</title>
52848 <para>
52849 <indexterm role="concept">
52850 <primary><emphasis>From:</emphasis> header line</primary>
52851 </indexterm>
52852 <indexterm role="concept">
52853 <primary>Sendmail compatibility</primary>
52854 <secondary><quote>From</quote> line</secondary>
52855 </indexterm>
52856 <indexterm role="concept">
52857 <primary>message</primary>
52858 <secondary>submission</secondary>
52859 </indexterm>
52860 <indexterm role="concept">
52861 <primary>submission mode</primary>
52862 </indexterm>
52863 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
52864 adds one if either of the following conditions is true:
52865 </para>
52866 <itemizedlist>
52867 <listitem>
52868 <para>
52869 The envelope sender address is not empty (that is, this is not a bounce
52870 message). The added header line copies the envelope sender address.
52871 </para>
52872 </listitem>
52873 <listitem>
52874 <para>
52875 <indexterm role="concept">
52876 <primary><varname>$authenticated_id</varname></primary>
52877 </indexterm>
52878 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
52879 </para>
52880 <orderedlist numeration="arabic">
52881 <listitem>
52882 <para>
52883 <indexterm role="concept">
52884 <primary><varname>$qualify_domain</varname></primary>
52885 </indexterm>
52886 If no domain is specified by the submission control, the local part is
52887 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
52888 </para>
52889 </listitem>
52890 <listitem>
52891 <para>
52892 If a non-empty domain is specified by the submission control, the local
52893 part is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
52894 </para>
52895 </listitem>
52896 <listitem>
52897 <para>
52898 If an empty domain is specified by the submission control,
52899 <varname>$authenticated_id</varname> is assumed to be the complete address.
52900 </para>
52901 </listitem>
52902 </orderedlist>
52903 </listitem>
52904 </itemizedlist>
52905 <para>
52906 A non-empty envelope sender takes precedence.
52907 </para>
52908 <para>
52909 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
52910 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
52911 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
52912 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
52913 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
52914 <option>unknown_login</option> configuration option). The address is qualified with
52915 <option>qualify_domain</option>.
52916 </para>
52917 <para>
52918 For compatibility with Sendmail, if an incoming, non-SMTP message has a
52919 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
52920 user, this is replaced by an address containing the user&#x2019;s login name and full
52921 name as described in section <xref linkend="SECTconstr"/>.
52922 </para>
52923 </section>
52924 <section>
52925 <title>The Message-ID: header line</title>
52926 <para>
52927 <indexterm role="concept">
52928 <primary><emphasis>Message-ID:</emphasis> header line</primary>
52929 </indexterm>
52930 <indexterm role="concept">
52931 <primary>message</primary>
52932 <secondary>submission</secondary>
52933 </indexterm>
52934 <indexterm role="concept">
52935 <primary><option>message_id_header_text</option></primary>
52936 </indexterm>
52937 If a locally-generated or submission-mode incoming message does not contain a
52938 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
52939 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
52940 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
52941 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
52942 message id, preceded by the letter E to ensure it starts with a letter, and
52943 followed by @ and the primary host name. Additional information can be included
52944 in this header line by setting the <option>message_id_header_text</option> and/or
52945 <option>message_id_header_domain</option> options.
52946 </para>
52947 </section>
52948 <section>
52949 <title>The Received: header line</title>
52950 <para>
52951 <indexterm role="concept">
52952 <primary><emphasis>Received:</emphasis> header line</primary>
52953 </indexterm>
52954 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
52955 contents are defined by the <option>received_header_text</option> configuration option, and
52956 Exim automatically adds a semicolon and a timestamp to the configured string.
52957 </para>
52958 <para>
52959 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
52960 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
52961 line is the time that the message started to be received. This is the value
52962 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
52963 </para>
52964 <para>
52965 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
52966 changed to the time of acceptance, which is (apart from a small delay while the
52967 -H spool file is written) the earliest time at which delivery could start.
52968 </para>
52969 </section>
52970 <section>
52971 <title>The References: header line</title>
52972 <para>
52973 <indexterm role="concept">
52974 <primary><emphasis>References:</emphasis> header line</primary>
52975 </indexterm>
52976 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
52977 header line. This is constructed according to the rules that are described in
52978 section 3.64 of RFC 2822 (which states that replies should contain such a
52979 header line), and section 3.14 of RFC 3834 (which states that automatic
52980 responses are not different in this respect). However, because some mail
52981 processing software does not cope well with very long header lines, no more
52982 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
52983 incoming message. If there are more than 12, the first one and then the final
52984 11 are copied, before adding the message ID of the incoming message.
52985 </para>
52986 </section>
52987 <section>
52988 <title>The Return-path: header line</title>
52989 <para>
52990 <indexterm role="concept">
52991 <primary><emphasis>Return-path:</emphasis> header line</primary>
52992 </indexterm>
52993 <indexterm role="concept">
52994 <primary><option>return_path_remove</option></primary>
52995 </indexterm>
52996 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
52997 it does the final delivery of messages. (See the generic <option>return_path_add</option>
52998 transport option.) Therefore, they should not be present in messages in
52999 transit. If the <option>return_path_remove</option> configuration option is set (the
53000 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
53001 </para>
53002 </section>
53003 <section id="SECTthesenhea">
53004 <title>The Sender: header line</title>
53005 <para>
53006 <indexterm role="concept">
53007 <primary><emphasis>Sender:</emphasis> header line</primary>
53008 </indexterm>
53009 <indexterm role="concept">
53010 <primary>message</primary>
53011 <secondary>submission</secondary>
53012 </indexterm>
53013 For a locally-originated message from an untrusted user, Exim may remove an
53014 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
53015 these actions by setting the <option>local_sender_retain</option> option true, the
53016 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
53017 control setting.
53018 </para>
53019 <para>
53020 When a local message is received from an untrusted user and
53021 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
53022 control has not been set, a check is made to see if the address given in the
53023 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
53024 that is expected has the login name as the local part and the value of
53025 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
53026 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
53027 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
53028 line is added to the message.
53029 </para>
53030 <para>
53031 If you set <option>local_from_check</option> false, this checking does not occur. However,
53032 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
53033 <option>local_sender_retain</option> to be true. It is not possible to set both of these
53034 options true at the same time.
53035 </para>
53036 <para>
53037 <indexterm role="concept">
53038 <primary>submission mode</primary>
53039 </indexterm>
53040 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
53041 received over TCP/IP or for messages submitted by trusted users. However, when
53042 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
53043 not specified on the submission control, the following processing takes place:
53044 </para>
53045 <para>
53046 <indexterm role="concept">
53047 <primary><varname>$authenticated_id</varname></primary>
53048 </indexterm>
53049 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
53050 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
53051 created as follows:
53052 </para>
53053 <itemizedlist>
53054 <listitem>
53055 <para>
53056 <indexterm role="concept">
53057 <primary><varname>$qualify_domain</varname></primary>
53058 </indexterm>
53059 If no domain is specified by the submission control, the local part is
53060 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
53061 </para>
53062 </listitem>
53063 <listitem>
53064 <para>
53065 If a non-empty domain is specified by the submission control, the local part
53066 is <varname>$authenticated_id</varname>, and the the domain is the specified domain.
53067 </para>
53068 </listitem>
53069 <listitem>
53070 <para>
53071 If an empty domain is specified by the submission control,
53072 <varname>$authenticated_id</varname> is assumed to be the complete address.
53073 </para>
53074 </listitem>
53075 </itemizedlist>
53076 <para>
53077 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
53078 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
53079 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
53080 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
53081 </para>
53082 <para>
53083 <indexterm role="concept">
53084 <primary>return path</primary>
53085 <secondary>created from <emphasis>Sender:</emphasis></secondary>
53086 </indexterm>
53087 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
53088 the message (the envelope sender address) is changed to be the same address,
53089 except in the case of submission mode when <option>sender_retain</option> is specified.
53090 </para>
53091 </section>
53092 <section id="SECTheadersaddrem">
53093 <title>Adding and removing header lines in routers and transports</title>
53094 <para>
53095 <indexterm role="concept">
53096 <primary>header lines</primary>
53097 <secondary>adding; in router or transport</secondary>
53098 </indexterm>
53099 <indexterm role="concept">
53100 <primary>header lines</primary>
53101 <secondary>removing; in router or transport</secondary>
53102 </indexterm>
53103 When a message is delivered, the addition and removal of header lines can be
53104 specified in a system filter, or on any of the routers and transports that
53105 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
53106 modifying headers in a system filter. Header lines can also be added in an ACL
53107 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
53108 </para>
53109 <para>
53110 In contrast to what happens in a system filter, header modifications that are
53111 specified on routers and transports apply only to the particular recipient
53112 addresses that are being processed by those routers and transports. These
53113 changes do not actually take place until a copy of the message is being
53114 transported. Therefore, they do not affect the basic set of header lines, and
53115 they do not affect the values of the variables that refer to header lines.
53116 </para>
53117 <para>
53118 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
53119 the transport cannot refer to the modified header lines, because such
53120 expansions all occur before the message is actually transported.
53121 </para>
53122 <para>
53123 For both routers and transports, the result of expanding a <option>headers_add</option>
53124 option must be in the form of one or more RFC 2822 header lines, separated by
53125 newlines (coded as <quote>\n</quote>). For example:
53126 </para>
53127 <literallayout class="monospaced">
53128 headers_add = X-added-header: added by $primary_hostname\n\
53129               X-added-second: another added header line
53130 </literallayout>
53131 <para>
53132 Exim does not check the syntax of these added header lines.
53133 </para>
53134 <para>
53135 The result of expanding <option>headers_remove</option> must consist of a colon-separated
53136 list of header names. This is confusing, because header names themselves are
53137 often terminated by colons. In this case, the colons are the list separators,
53138 not part of the names. For example:
53139 </para>
53140 <literallayout class="monospaced">
53141 headers_remove = return-receipt-to:acknowledge-to
53142 </literallayout>
53143 <para>
53144 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router, its value
53145 is expanded at routing time, and then associated with all addresses that are
53146 accepted by that router, and also with any new addresses that it generates. If
53147 an address passes through several routers as a result of aliasing or
53148 forwarding, the changes are cumulative.
53149 </para>
53150 <para>
53151 <indexterm role="concept">
53152 <primary><option>unseen</option> option</primary>
53153 </indexterm>
53154 However, this does not apply to multiple routers that result from the use of
53155 the <option>unseen</option> option. Any header modifications that were specified by the
53156 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
53157 </para>
53158 <para>
53159 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
53160 settings cannot be delivered together in a batch, so a transport is always
53161 dealing with a set of addresses that have the same header-processing
53162 requirements.
53163 </para>
53164 <para>
53165 The transport starts by writing the original set of header lines that arrived
53166 with the message, possibly modified by the system filter. As it writes out
53167 these lines, it consults the list of header names that were attached to the
53168 recipient address(es) by <option>headers_remove</option> options in routers, and it also
53169 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
53170 names are on either of these lists are not written out. If there are multiple
53171 instances of any listed header, they are all skipped.
53172 </para>
53173 <para>
53174 After the remaining original header lines have been written, new header
53175 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
53176 the order in which they were attached to the address. These are followed by any
53177 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
53178 </para>
53179 <para>
53180 This way of handling header line modifications in routers and transports has
53181 the following consequences:
53182 </para>
53183 <itemizedlist>
53184 <listitem>
53185 <para>
53186 The original set of header lines, possibly modified by the system filter,
53187 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
53188 to it, at all times.
53189 </para>
53190 </listitem>
53191 <listitem>
53192 <para>
53193 Header lines that are added by a router&#x2019;s
53194 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
53195 expansion syntax in subsequent routers or the transport.
53196 </para>
53197 </listitem>
53198 <listitem>
53199 <para>
53200 Conversely, header lines that are specified for removal by <option>headers_remove</option>
53201 in a router remain visible to subsequent routers and the transport.
53202 </para>
53203 </listitem>
53204 <listitem>
53205 <para>
53206 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
53207 a later router or by a transport.
53208 </para>
53209 </listitem>
53210 <listitem>
53211 <para>
53212 An added header can refer to the contents of an original header that is to be
53213 removed, even it has the same name as the added header. For example:
53214 </para>
53215 <literallayout class="monospaced">
53216 headers_remove = subject
53217 headers_add = Subject: new subject (was: $h_subject:)
53218 </literallayout>
53219 </listitem>
53220 </itemizedlist>
53221 <para>
53222 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
53223 for a <command>redirect</command> router that has the <option>one_time</option> option set.
53224 </para>
53225 </section>
53226 <section id="SECTconstr">
53227 <title>Constructed addresses</title>
53228 <para>
53229 <indexterm role="concept">
53230 <primary>address</primary>
53231 <secondary>constructed</secondary>
53232 </indexterm>
53233 <indexterm role="concept">
53234 <primary>constructed address</primary>
53235 </indexterm>
53236 When Exim constructs a sender address for a locally-generated message, it uses
53237 the form
53238 </para>
53239 <literallayout>
53240 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
53241 </literallayout>
53242 <para>
53243 For example:
53244 </para>
53245 <literallayout class="monospaced">
53246 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
53247 </literallayout>
53248 <para>
53249 The user name is obtained from the <option>-F</option> command line option if set, or
53250 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
53251 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
53252 ampersand character, this is replaced by the login name with the first letter
53253 upper cased, as is conventional in a number of operating systems. See the
53254 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
53255 The <option>unknown_username</option> option can be used to specify user names in cases when
53256 there is no password file entry.
53257 </para>
53258 <para>
53259 <indexterm role="concept">
53260 <primary>RFC 2047</primary>
53261 </indexterm>
53262 In all cases, the user name is made to conform to RFC 2822 by quoting all or
53263 parts of it if necessary. In addition, if it contains any non-printing
53264 characters, it is encoded as described in RFC 2047, which defines a way of
53265 including non-ASCII characters in header lines. The value of the
53266 <option>headers_charset</option> option specifies the name of the encoding that is used (the
53267 characters are assumed to be in this encoding). The setting of
53268 <option>print_topbitchars</option> controls whether characters with the top bit set (that
53269 is, with codes greater than 127) count as printing characters or not.
53270 </para>
53271 </section>
53272 <section>
53273 <title>Case of local parts</title>
53274 <para>
53275 <indexterm role="concept">
53276 <primary>case of local parts</primary>
53277 </indexterm>
53278 <indexterm role="concept">
53279 <primary>local part</primary>
53280 <secondary>case of</secondary>
53281 </indexterm>
53282 RFC 2822 states that the case of letters in the local parts of addresses cannot
53283 be assumed to be non-significant. Exim preserves the case of local parts of
53284 addresses, but by default it uses a lower-cased form when it is routing,
53285 because on most Unix systems, usernames are in lower case and case-insensitive
53286 routing is required. However, any particular router can be made to use the
53287 original case for local parts by setting the <option>caseful_local_part</option> generic
53288 router option.
53289 </para>
53290 <para>
53291 <indexterm role="concept">
53292 <primary>mixed-case login names</primary>
53293 </indexterm>
53294 If you must have mixed-case user names on your system, the best way to proceed,
53295 assuming you want case-independent handling of incoming email, is to set up
53296 your first router to convert incoming local parts in your domains to the
53297 correct case by means of a file lookup. For example:
53298 </para>
53299 <literallayout class="monospaced">
53300 correct_case:
53301   driver = redirect
53302   domains = +local_domains
53303   data = ${lookup{$local_part}cdb\
53304               {/etc/usercased.cdb}{$value}fail}\
53305               @$domain
53306 </literallayout>
53307 <para>
53308 For this router, the local part is forced to lower case by the default action
53309 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
53310 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
53311 on any subsequent routers which process your domains, they will operate on
53312 local parts with the correct case in a case-sensitive manner.
53313 </para>
53314 </section>
53315 <section>
53316 <title>Dots in local parts</title>
53317 <para>
53318 <indexterm role="concept">
53319 <primary>dot</primary>
53320 <secondary>in local part</secondary>
53321 </indexterm>
53322 <indexterm role="concept">
53323 <primary>local part</primary>
53324 <secondary>dots in</secondary>
53325 </indexterm>
53326 RFC 2822 forbids empty components in local parts. That is, an unquoted local
53327 part may not begin or end with a dot, nor have two consecutive dots in the
53328 middle. However, it seems that many MTAs do not enforce this, so Exim permits
53329 empty components for compatibility.
53330 </para>
53331 </section>
53332 <section>
53333 <title>Rewriting addresses</title>
53334 <para>
53335 <indexterm role="concept">
53336 <primary>rewriting</primary>
53337 <secondary>addresses</secondary>
53338 </indexterm>
53339 Rewriting of sender and recipient addresses, and addresses in headers, can
53340 happen automatically, or as the result of configuration options, as described
53341 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
53342 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
53343 </para>
53344 <para>
53345 Automatic rewriting includes qualification, as mentioned above. The other case
53346 in which it can happen is when an incomplete non-local domain is given. The
53347 routing process may cause this to be expanded into the full domain name. For
53348 example, a header such as
53349 </para>
53350 <literallayout class="monospaced">
53351 To: hare@teaparty
53352 </literallayout>
53353 <para>
53354 might get rewritten as
53355 </para>
53356 <literallayout class="monospaced">
53357 To: hare@teaparty.wonderland.fict.example
53358 </literallayout>
53359 <para>
53360 Rewriting as a result of routing is the one kind of message processing that
53361 does not happen at input time, as it cannot be done until the address has
53362 been routed.
53363 </para>
53364 <para>
53365 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
53366 addresses have been routed, in case any of the headers get changed as a
53367 result of routing. However, doing this in practice would hold up many
53368 deliveries for unreasonable amounts of time, just because one address could not
53369 immediately be routed. Exim therefore does not delay other deliveries when
53370 routing of one or more addresses is deferred.
53371 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
53372 </para>
53373 </section>
53374 </chapter>
53375
53376 <chapter id="CHAPSMTP">
53377 <title>SMTP processing</title>
53378 <para>
53379 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
53380 <primary>SMTP</primary>
53381 <secondary>processing details</secondary>
53382 </indexterm>
53383 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
53384 <primary>LMTP</primary>
53385 <secondary>processing details</secondary>
53386 </indexterm>
53387 Exim supports a number of different ways of using the SMTP protocol, and its
53388 LMTP variant, which is an interactive protocol for transferring messages into a
53389 closed mail store application. This chapter contains details of how SMTP is
53390 processed. For incoming mail, the following are available:
53391 </para>
53392 <itemizedlist>
53393 <listitem>
53394 <para>
53395 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
53396 </para>
53397 </listitem>
53398 <listitem>
53399 <para>
53400 SMTP over the standard input and output (the <option>-bs</option> option);
53401 </para>
53402 </listitem>
53403 <listitem>
53404 <para>
53405 Batched SMTP on the standard input (the <option>-bS</option> option).
53406 </para>
53407 </listitem>
53408 </itemizedlist>
53409 <para>
53410 For mail delivery, the following are available:
53411 </para>
53412 <itemizedlist>
53413 <listitem>
53414 <para>
53415 SMTP over TCP/IP (the <command>smtp</command> transport);
53416 </para>
53417 </listitem>
53418 <listitem>
53419 <para>
53420 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
53421 <quote>lmtp</quote>);
53422 </para>
53423 </listitem>
53424 <listitem>
53425 <para>
53426 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
53427 transport);
53428 </para>
53429 </listitem>
53430 <listitem>
53431 <para>
53432 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
53433 the <option>use_bsmtp</option> option set).
53434 </para>
53435 </listitem>
53436 </itemizedlist>
53437 <para>
53438 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
53439 stored in or read from files (or pipes), in a format in which SMTP commands are
53440 used to contain the envelope information.
53441 </para>
53442 <section id="SECToutSMTPTCP">
53443 <title>Outgoing SMTP and LMTP over TCP/IP</title>
53444 <para>
53445 <indexterm role="concept">
53446 <primary>SMTP</primary>
53447 <secondary>outgoing over TCP/IP</secondary>
53448 </indexterm>
53449 <indexterm role="concept">
53450 <primary>outgoing SMTP over TCP/IP</primary>
53451 </indexterm>
53452 <indexterm role="concept">
53453 <primary>LMTP</primary>
53454 <secondary>over TCP/IP</secondary>
53455 </indexterm>
53456 <indexterm role="concept">
53457 <primary>outgoing LMTP over TCP/IP</primary>
53458 </indexterm>
53459 <indexterm role="concept">
53460 <primary>EHLO</primary>
53461 </indexterm>
53462 <indexterm role="concept">
53463 <primary>HELO</primary>
53464 </indexterm>
53465 <indexterm role="concept">
53466 <primary>SIZE option on MAIL command</primary>
53467 </indexterm>
53468 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
53469 The <option>protocol</option> option selects which protocol is to be used, but the actual
53470 processing is the same in both cases.
53471 </para>
53472 <para>
53473 If, in response to its EHLO command, Exim is told that the SIZE
53474 parameter is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
53475 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
53476 <option>size_addition</option> option (default 1024) to allow for additions to the message
53477 such as per-transport header lines, or changes made in a
53478 <indexterm role="concept">
53479 <primary>transport</primary>
53480 <secondary>filter</secondary>
53481 </indexterm>
53482 <indexterm role="concept">
53483 <primary>filter</primary>
53484 <secondary>transport filter</secondary>
53485 </indexterm>
53486 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
53487 suppressed.
53488 </para>
53489 <para>
53490 If the remote server advertises support for PIPELINING, Exim uses the
53491 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
53492 required for the transaction.
53493 </para>
53494 <para>
53495 If the remote server advertises support for the STARTTLS command, and Exim
53496 was built to support TLS encryption, it tries to start a TLS session unless the
53497 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
53498 </para>
53499 <para>
53500 If the remote server advertises support for the AUTH command, Exim scans
53501 the authenticators configuration for any suitable client settings, as described
53502 in chapter <xref linkend="CHAPSMTPAUTH"/>.
53503 </para>
53504 <para>
53505 <indexterm role="concept">
53506 <primary>carriage return</primary>
53507 </indexterm>
53508 <indexterm role="concept">
53509 <primary>linefeed</primary>
53510 </indexterm>
53511 Responses from the remote host are supposed to be terminated by CR followed by
53512 LF. However, there are known to be hosts that do not send CR characters, so in
53513 order to be able to interwork with such hosts, Exim treats LF on its own as a
53514 line terminator.
53515 </para>
53516 <para>
53517 If a message contains a number of different addresses, all those with the same
53518 characteristics (for example, the same envelope sender) that resolve to the
53519 same set of hosts, in the same order, are sent in a single SMTP transaction,
53520 even if they are for different domains, unless there are more than the setting
53521 of the <option>max_rcpts</option> option in the <command>smtp</command> transport allows, in which case
53522 they are split into groups containing no more than <option>max_rcpts</option> addresses
53523 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
53524 in parallel sessions. The order of hosts with identical MX values is not
53525 significant when checking whether addresses can be batched in this way.
53526 </para>
53527 <para>
53528 When the <command>smtp</command> transport suffers a temporary failure that is not
53529 message-related, Exim updates its transport-specific database, which contains
53530 records indexed by host name that remember which messages are waiting for each
53531 particular host. It also updates the retry database with new retry times.
53532 </para>
53533 <para>
53534 <indexterm role="concept">
53535 <primary>hints database</primary>
53536 <secondary>retry keys</secondary>
53537 </indexterm>
53538 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
53539 a multi-homed host is broken, it will soon be skipped most of the time.
53540 See the next section for more detail about error handling.
53541 </para>
53542 <para>
53543 <indexterm role="concept">
53544 <primary>SMTP</primary>
53545 <secondary>passed connection</secondary>
53546 </indexterm>
53547 <indexterm role="concept">
53548 <primary>SMTP</primary>
53549 <secondary>batching over TCP/IP</secondary>
53550 </indexterm>
53551 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
53552 looks in the hints database for the transport to see if there are any queued
53553 messages waiting for the host to which it is connected. If it finds one, it
53554 creates a new Exim process using the <option>-MC</option> option (which can only be used by
53555 a process running as root or the Exim user) and passes the TCP/IP socket to it
53556 so that it can deliver another message using the same socket. The new process
53557 does only those deliveries that are routed to the connected host, and may in
53558 turn pass the socket on to a third process, and so on.
53559 </para>
53560 <para>
53561 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
53562 limit the number of messages sent down a single TCP/IP connection.
53563 </para>
53564 <para>
53565 <indexterm role="concept">
53566 <primary>asterisk</primary>
53567 <secondary>after IP address</secondary>
53568 </indexterm>
53569 The second and subsequent messages delivered down an existing connection are
53570 identified in the main log by the addition of an asterisk after the closing
53571 square bracket of the IP address.
53572 </para>
53573 </section>
53574 <section id="SECToutSMTPerr">
53575 <title>Errors in outgoing SMTP</title>
53576 <para>
53577 <indexterm role="concept">
53578 <primary>error</primary>
53579 <secondary>in outgoing SMTP</secondary>
53580 </indexterm>
53581 <indexterm role="concept">
53582 <primary>SMTP</primary>
53583 <secondary>errors in outgoing</secondary>
53584 </indexterm>
53585 <indexterm role="concept">
53586 <primary>host</primary>
53587 <secondary>error</secondary>
53588 </indexterm>
53589 Three different kinds of error are recognized for outgoing SMTP: host errors,
53590 message errors, and recipient errors.
53591 </para>
53592 <variablelist>
53593 <varlistentry>
53594 <term><emphasis role="bold">Host errors</emphasis></term>
53595 <listitem>
53596 <para>
53597 A host error is not associated with a particular message or with a
53598 particular recipient of a message. The host errors are:
53599 </para>
53600 <itemizedlist>
53601 <listitem>
53602 <para>
53603 Connection refused or timed out,
53604 </para>
53605 </listitem>
53606 <listitem>
53607 <para>
53608 Any error response code on connection,
53609 </para>
53610 </listitem>
53611 <listitem>
53612 <para>
53613 Any error response code to EHLO or HELO,
53614 </para>
53615 </listitem>
53616 <listitem>
53617 <para>
53618 Loss of connection at any time, except after <quote>.</quote>,
53619 </para>
53620 </listitem>
53621 <listitem>
53622 <para>
53623 I/O errors at any time,
53624 </para>
53625 </listitem>
53626 <listitem>
53627 <para>
53628 Timeouts during the session, other than in response to MAIL, RCPT or
53629 the <quote>.</quote> at the end of the data.
53630 </para>
53631 </listitem>
53632 </itemizedlist>
53633 <para>
53634 For a host error, a permanent error response on connection, or in response to
53635 EHLO, causes all addresses routed to the host to be failed. Any other host
53636 error causes all addresses to be deferred, and retry data to be created for the
53637 host. It is not tried again, for any message, until its retry time arrives. If
53638 the current set of addresses are not all delivered in this run (to some
53639 alternative host), the message is added to the list of those waiting for this
53640 host, so if it is still undelivered when a subsequent successful delivery is
53641 made to the host, it will be sent down the same SMTP connection.
53642 </para>
53643 </listitem></varlistentry>
53644 <varlistentry>
53645 <term><emphasis role="bold">Message errors</emphasis></term>
53646 <listitem>
53647 <para>
53648 <indexterm role="concept">
53649 <primary>message</primary>
53650 <secondary>error</secondary>
53651 </indexterm>
53652 A message error is associated with a particular message when sent to a
53653 particular host, but not with a particular recipient of the message. The
53654 message errors are:
53655 </para>
53656 <itemizedlist>
53657 <listitem>
53658 <para>
53659 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
53660 the data,
53661 </para>
53662 </listitem>
53663 <listitem>
53664 <para>
53665 Timeout after MAIL,
53666 </para>
53667 </listitem>
53668 <listitem>
53669 <para>
53670 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
53671 timeout after the DATA command itself is treated as a host error, as is loss of
53672 connection at any other time.
53673 </para>
53674 </listitem>
53675 </itemizedlist>
53676 <para>
53677 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
53678 to be failed, and a delivery error report to be returned to the sender. A
53679 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
53680 addresses to be deferred. Retry data is not created for the host, but instead,
53681 a retry record for the combination of host plus message id is created. The
53682 message is not added to the list of those waiting for this host. This ensures
53683 that the failing message will not be sent to this host again until the retry
53684 time arrives. However, other messages that are routed to the host are not
53685 affected, so if it is some property of the message that is causing the error,
53686 it will not stop the delivery of other mail.
53687 </para>
53688 <para>
53689 If the remote host specified support for the SIZE parameter in its response
53690 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
53691 over-large message will cause a message error because the error arrives as a
53692 response to MAIL.
53693 </para>
53694 </listitem></varlistentry>
53695 <varlistentry>
53696 <term><emphasis role="bold">Recipient errors</emphasis></term>
53697 <listitem>
53698 <para>
53699 <indexterm role="concept">
53700 <primary>recipient</primary>
53701 <secondary>error</secondary>
53702 </indexterm>
53703 A recipient error is associated with a particular recipient of a message. The
53704 recipient errors are:
53705 </para>
53706 <itemizedlist>
53707 <listitem>
53708 <para>
53709 Any error response to RCPT,
53710 </para>
53711 </listitem>
53712 <listitem>
53713 <para>
53714 Timeout after RCPT.
53715 </para>
53716 </listitem>
53717 </itemizedlist>
53718 <para>
53719 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
53720 recipient address to be failed, and a bounce message to be returned to the
53721 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
53722 address to be deferred, and routing retry data to be created for it. This is
53723 used to delay processing of the address in subsequent queue runs, until its
53724 routing retry time arrives. This applies to all messages, but because it
53725 operates only in queue runs, one attempt will be made to deliver a new message
53726 to the failing address before the delay starts to operate. This ensures that,
53727 if the failure is really related to the message rather than the recipient
53728 (<quote>message too big for this recipient</quote> is a possible example), other messages
53729 have a chance of getting delivered. If a delivery to the address does succeed,
53730 the retry information gets cleared, so all stuck messages get tried again, and
53731 the retry clock is reset.
53732 </para>
53733 <para>
53734 The message is not added to the list of those waiting for this host. Use of the
53735 host for other messages is unaffected, and except in the case of a timeout,
53736 other recipients are processed independently, and may be successfully delivered
53737 in the current SMTP session. After a timeout it is of course impossible to
53738 proceed with the session, so all addresses get deferred. However, those other
53739 than the one that failed do not suffer any subsequent retry delays. Therefore,
53740 if one recipient is causing trouble, the others have a chance of getting
53741 through when a subsequent delivery attempt occurs before the failing
53742 recipient&#x2019;s retry time.
53743 </para>
53744 </listitem></varlistentry>
53745 </variablelist>
53746 <para>
53747 In all cases, if there are other hosts (or IP addresses) available for the
53748 current set of addresses (for example, from multiple MX records), they are
53749 tried in this run for any undelivered addresses, subject of course to their
53750 own retry data. In other words, recipient error retry data does not take effect
53751 until the next delivery attempt.
53752 </para>
53753 <para>
53754 Some hosts have been observed to give temporary error responses to every
53755 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
53756 would be nice if such circumstances could be recognized, and defer data for the
53757 host itself created, but this is not possible within the current Exim design.
53758 What actually happens is that retry data for every (host, message) combination
53759 is created.
53760 </para>
53761 <para>
53762 The reason that timeouts after MAIL and RCPT are treated specially is that
53763 these can sometimes arise as a result of the remote host&#x2019;s verification
53764 procedures. Exim makes this assumption, and treats them as if a temporary error
53765 response had been received. A timeout after <quote>.</quote> is treated specially because
53766 it is known that some broken implementations fail to recognize the end of the
53767 message if the last character of the last line is a binary zero. Thus, it is
53768 helpful to treat this case as a message error.
53769 </para>
53770 <para>
53771 Timeouts at other times are treated as host errors, assuming a problem with the
53772 host, or the connection to it. If a timeout after MAIL, RCPT,
53773 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
53774 the timeout is likely to occur at some other point in the dialogue, causing it
53775 then to be treated as a host error.
53776 </para>
53777 <para>
53778 There is experimental evidence that some MTAs drop the connection after the
53779 terminating <quote>.</quote> if they do not like the contents of the message for some
53780 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
53781 should be given. That is why Exim treats this case as a message rather than a
53782 host error, in order not to delay other messages to the same host.
53783 </para>
53784 </section>
53785 <section>
53786 <title>Incoming SMTP messages over TCP/IP</title>
53787 <para>
53788 <indexterm role="concept">
53789 <primary>SMTP</primary>
53790 <secondary>incoming over TCP/IP</secondary>
53791 </indexterm>
53792 <indexterm role="concept">
53793 <primary>incoming SMTP over TCP/IP</primary>
53794 </indexterm>
53795 <indexterm role="concept">
53796 <primary>inetd</primary>
53797 </indexterm>
53798 <indexterm role="concept">
53799 <primary>daemon</primary>
53800 </indexterm>
53801 Incoming SMTP messages can be accepted in one of two ways: by running a
53802 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
53803 <filename>/etc/inetd.conf</filename> should be like this:
53804 </para>
53805 <literallayout class="monospaced">
53806 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
53807 </literallayout>
53808 <para>
53809 Exim distinguishes between this case and the case of a locally running user
53810 agent using the <option>-bs</option> option by checking whether or not the standard input is
53811 a socket. When it is, either the port must be privileged (less than 1024), or
53812 the caller must be root or the Exim user. If any other user passes a socket
53813 with an unprivileged port number, Exim prints a message on the standard error
53814 stream and exits with an error code.
53815 </para>
53816 <para>
53817 By default, Exim does not make a log entry when a remote host connects or
53818 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
53819 unexpected. It can be made to write such log entries by setting the
53820 <option>smtp_connection</option> log selector.
53821 </para>
53822 <para>
53823 <indexterm role="concept">
53824 <primary>carriage return</primary>
53825 </indexterm>
53826 <indexterm role="concept">
53827 <primary>linefeed</primary>
53828 </indexterm>
53829 Commands from the remote host are supposed to be terminated by CR followed by
53830 LF. However, there are known to be hosts that do not send CR characters. In
53831 order to be able to interwork with such hosts, Exim treats LF on its own as a
53832 line terminator.
53833 Furthermore, because common code is used for receiving messages from all
53834 sources, a CR on its own is also interpreted as a line terminator. However, the
53835 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
53836 </para>
53837 <para>
53838 <indexterm role="concept">
53839 <primary>EHLO</primary>
53840 <secondary>invalid data</secondary>
53841 </indexterm>
53842 <indexterm role="concept">
53843 <primary>HELO</primary>
53844 <secondary>invalid data</secondary>
53845 </indexterm>
53846 One area that sometimes gives rise to problems concerns the EHLO or
53847 HELO commands. Some clients send syntactically invalid versions of these
53848 commands, which Exim rejects by default. (This is nothing to do with verifying
53849 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
53850 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
53851 match the broken hosts that send invalid commands.
53852 </para>
53853 <para>
53854 <indexterm role="concept">
53855 <primary>SIZE option on MAIL command</primary>
53856 </indexterm>
53857 <indexterm role="concept">
53858 <primary>MAIL</primary>
53859 <secondary>SIZE option</secondary>
53860 </indexterm>
53861 The amount of disk space available is checked whenever SIZE is received on
53862 a MAIL command, independently of whether <option>message_size_limit</option> or
53863 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
53864 false. A temporary error is given if there is not enough space. If
53865 <option>check_spool_space</option> is set, the check is for that amount of space plus the
53866 value given with SIZE, that is, it checks that the addition of the incoming
53867 message will not reduce the space below the threshold.
53868 </para>
53869 <para>
53870 When a message is successfully received, Exim includes the local message id in
53871 its response to the final <quote>.</quote> that terminates the data. If the remote host
53872 logs this text it can help with tracing what has happened to a message.
53873 </para>
53874 <para>
53875 The Exim daemon can limit the number of simultaneous incoming connections it is
53876 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
53877 number of simultaneous incoming connections from a single remote host (see the
53878 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
53879 rejected using the SMTP temporary error code 421.
53880 </para>
53881 <para>
53882 The Exim daemon does not rely on the SIGCHLD signal to detect when a
53883 subprocess has finished, as this can get lost at busy times. Instead, it looks
53884 for completed subprocesses every time it wakes up. Provided there are other
53885 things happening (new incoming calls, starts of queue runs), completed
53886 processes will be noticed and tidied away. On very quiet systems you may
53887 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
53888 it will be noticed when the daemon next wakes up.
53889 </para>
53890 <para>
53891 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
53892 and can also be set up to reject SMTP calls from non-reserved hosts at times of
53893 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
53894 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
53895 applies in both the daemon and <emphasis>inetd</emphasis> cases.
53896 </para>
53897 <para>
53898 Exim normally starts a delivery process for each message received, though this
53899 can be varied by means of the <option>-odq</option> command line option and the
53900 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
53901 number of simultaneously running delivery processes started in this way from
53902 SMTP input can be limited by the <option>smtp_accept_queue</option> and
53903 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
53904 subsequently received messages are just put on the input queue without starting
53905 a delivery process.
53906 </para>
53907 <para>
53908 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
53909 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
53910 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
53911 handled by an entirely independent Exim process. Control by load average is,
53912 however, available with <emphasis>inetd</emphasis>.
53913 </para>
53914 <para>
53915 Exim can be configured to verify addresses in incoming SMTP commands as they
53916 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
53917 to rewrite addresses at this time &ndash; before any syntax checking is done. See
53918 section <xref linkend="SECTrewriteS"/>.
53919 </para>
53920 <para>
53921 Exim can also be configured to limit the rate at which a client host submits
53922 MAIL and RCPT commands in a single SMTP session. See the
53923 <option>smtp_ratelimit_hosts</option> option.
53924 </para>
53925 </section>
53926 <section>
53927 <title>Unrecognized SMTP commands</title>
53928 <para>
53929 <indexterm role="concept">
53930 <primary>SMTP</primary>
53931 <secondary>unrecognized commands</secondary>
53932 </indexterm>
53933 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
53934 commands during a single SMTP connection, it drops the connection after sending
53935 the error response to the last command. The default value for
53936 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
53937 abuse that subvert web servers into making connections to SMTP ports; in these
53938 circumstances, a number of non-SMTP lines are sent first.
53939 </para>
53940 </section>
53941 <section>
53942 <title>Syntax and protocol errors in SMTP commands</title>
53943 <para>
53944 <indexterm role="concept">
53945 <primary>SMTP</primary>
53946 <secondary>syntax errors</secondary>
53947 </indexterm>
53948 <indexterm role="concept">
53949 <primary>SMTP</primary>
53950 <secondary>protocol errors</secondary>
53951 </indexterm>
53952 A syntax error is detected if an SMTP command is recognized, but there is
53953 something syntactically wrong with its data, for example, a malformed email
53954 address in a RCPT command. Protocol errors include invalid command
53955 sequencing such as RCPT before MAIL. If Exim receives more than
53956 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
53957 drops the connection after sending the error response to the last command. The
53958 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
53959 broken clients that loop sending bad commands (yes, it has been seen).
53960 </para>
53961 </section>
53962 <section>
53963 <title>Use of non-mail SMTP commands</title>
53964 <para>
53965 <indexterm role="concept">
53966 <primary>SMTP</primary>
53967 <secondary>non-mail commands</secondary>
53968 </indexterm>
53969 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
53970 DATA. Exim counts such commands, and drops the connection if there are too
53971 many of them in a single SMTP session. This action catches some
53972 denial-of-service attempts and things like repeated failing AUTHs, or a mad
53973 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
53974 defines what <quote>too many</quote> means. Its default value is 10.
53975 </para>
53976 <para>
53977 When a new message is expected, one occurrence of RSET is not counted. This
53978 allows a client to send one RSET between messages (this is not necessary,
53979 but some clients do it). Exim also allows one uncounted occurence of HELO
53980 or EHLO, and one occurrence of STARTTLS between messages. After
53981 starting up a TLS session, another EHLO is expected, and so it too is not
53982 counted.
53983 </para>
53984 <para>
53985 The first occurrence of AUTH in a connection, or immediately following
53986 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
53987 RCPT, DATA, and QUIT are counted.
53988 </para>
53989 <para>
53990 You can control which hosts are subject to the limit set by
53991 <option>smtp_accept_max_nonmail</option> by setting
53992 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
53993 the limit apply to all hosts. This option means that you can exclude any
53994 specific badly-behaved hosts that you have to live with.
53995 </para>
53996 </section>
53997 <section>
53998 <title>The VRFY and EXPN commands</title>
53999 <para>
54000 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
54001 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
54002 appropriate) in order to decide whether the command should be accepted or not.
54003 If no ACL is defined, the command is rejected.
54004 </para>
54005 <para>
54006 <indexterm role="concept">
54007 <primary>VRFY</primary>
54008 <secondary>processing</secondary>
54009 </indexterm>
54010 When VRFY is accepted, it runs exactly the same code as when Exim is
54011 called with the <option>-bv</option> option.
54012 </para>
54013 <para>
54014 <indexterm role="concept">
54015 <primary>EXPN</primary>
54016 <secondary>processing</secondary>
54017 </indexterm>
54018 When EXPN is accepted, a single-level expansion of the address is done.
54019 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
54020 than a verification (the <option>-bv</option> option). If an unqualified local part is given
54021 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
54022 of VRFY and EXPN commands are logged on the main and reject logs, and
54023 VRFY verification failures are logged on the main log for consistency with
54024 RCPT failures.
54025 </para>
54026 </section>
54027 <section id="SECTETRN">
54028 <title>The ETRN command</title>
54029 <para>
54030 <indexterm role="concept">
54031 <primary>ETRN</primary>
54032 <secondary>processing</secondary>
54033 </indexterm>
54034 RFC 1985 describes an SMTP command called ETRN that is designed to
54035 overcome the security problems of the TURN command (which has fallen into
54036 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
54037 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
54038 should be accepted or not. If no ACL is defined, the command is rejected.
54039 </para>
54040 <para>
54041 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
54042 delivery to certain hosts. As Exim does not organize its message queue by host,
54043 the only form of ETRN that is supported by default is the one where the
54044 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
54045 specific to the SMTP server. A valid ETRN command causes a run of Exim with
54046 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
54047 argument. For example,
54048 </para>
54049 <literallayout class="monospaced">
54050 ETRN #brigadoon
54051 </literallayout>
54052 <para>
54053 runs the command
54054 </para>
54055 <literallayout class="monospaced">
54056 exim -R brigadoon
54057 </literallayout>
54058 <para>
54059 which causes a delivery attempt on all messages with undelivered addresses
54060 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
54061 default), Exim prevents the simultaneous execution of more than one queue run
54062 for the same argument string as a result of an ETRN command. This stops
54063 a misbehaving client from starting more than one queue runner at once.
54064 </para>
54065 <para>
54066 <indexterm role="concept">
54067 <primary>hints database</primary>
54068 <secondary>ETRN serialization</secondary>
54069 </indexterm>
54070 Exim implements the serialization by means of a hints database in which a
54071 record is written whenever a process is started by ETRN, and deleted when
54072 the process completes. However, Exim does not keep the SMTP session waiting for
54073 the ETRN process to complete. Once ETRN is accepted, the client is sent
54074 a <quote>success</quote> return code. Obviously there is scope for hints records to get
54075 left lying around if there is a system or program crash. To guard against this,
54076 Exim ignores any records that are more than six hours old.
54077 </para>
54078 <para>
54079 <indexterm role="concept">
54080 <primary><option>smtp_etrn_command</option></primary>
54081 </indexterm>
54082 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
54083 used. This specifies a command that is run whenever ETRN is received,
54084 whatever the form of its argument. For
54085 example:
54086 </para>
54087 <literallayout class="monospaced">
54088 smtp_etrn_command = /etc/etrn_command $domain \
54089                     $sender_host_address
54090 </literallayout>
54091 <para>
54092 <indexterm role="concept">
54093 <primary><varname>$domain</varname></primary>
54094 </indexterm>
54095 The string is split up into arguments which are independently expanded. The
54096 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
54097 and no syntax checking is done on the contents of this argument. Exim does not
54098 wait for the command to complete, so its status code is not checked. Exim runs
54099 under its own uid and gid when receiving incoming SMTP, so it is not possible
54100 for it to change them before running the command.
54101 </para>
54102 </section>
54103 <section>
54104 <title>Incoming local SMTP</title>
54105 <para>
54106 <indexterm role="concept">
54107 <primary>SMTP</primary>
54108 <secondary>local incoming</secondary>
54109 </indexterm>
54110 Some user agents use SMTP to pass messages to their local MTA using the
54111 standard input and output, as opposed to passing the envelope on the command
54112 line and writing the message to the standard input. This is supported by the
54113 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
54114 messages over TCP/IP (including the use of ACLs), except that the envelope
54115 sender given in a MAIL command is ignored unless the caller is trusted. In
54116 an ACL you can detect this form of SMTP input by testing for an empty host
54117 identification. It is common to have this as the first line in the ACL that
54118 runs for RCPT commands:
54119 </para>
54120 <literallayout class="monospaced">
54121 accept hosts = :
54122 </literallayout>
54123 <para>
54124 This accepts SMTP messages from local processes without doing any other tests.
54125 </para>
54126 </section>
54127 <section id="SECTbatchSMTP">
54128 <title>Outgoing batched SMTP</title>
54129 <para>
54130 <indexterm role="concept">
54131 <primary>SMTP</primary>
54132 <secondary>batched outgoing</secondary>
54133 </indexterm>
54134 <indexterm role="concept">
54135 <primary>batched SMTP output</primary>
54136 </indexterm>
54137 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
54138 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
54139 be output in BSMTP format. No SMTP responses are possible for this form of
54140 delivery. All it is doing is using SMTP commands as a way of transmitting the
54141 envelope along with the message.
54142 </para>
54143 <para>
54144 The message is written to the file or pipe preceded by the SMTP commands
54145 MAIL and RCPT, and followed by a line containing a single dot. Lines in
54146 the message that start with a dot have an extra dot added. The SMTP command
54147 HELO is not normally used. If it is required, the <option>message_prefix</option> option
54148 can be used to specify it.
54149 </para>
54150 <para>
54151 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
54152 one recipient address at a time by default. However, you can arrange for them
54153 to handle several addresses at once by setting the <option>batch_max</option> option. When
54154 this is done for BSMTP, messages may contain multiple RCPT commands. See
54155 chapter <xref linkend="CHAPbatching"/> for more details.
54156 </para>
54157 <para>
54158 <indexterm role="concept">
54159 <primary><varname>$host</varname></primary>
54160 </indexterm>
54161 When one or more addresses are routed to a BSMTP transport by a router that
54162 sets up a host list, the name of the first host on the list is available to the
54163 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
54164 router:
54165 </para>
54166 <literallayout class="monospaced">
54167 begin routers
54168 route_append:
54169   driver = manualroute
54170   transport = smtp_appendfile
54171   route_list = domain.example  batch.host.example
54172
54173 begin transports
54174 smtp_appendfile:
54175   driver = appendfile
54176   directory = /var/bsmtp/$host
54177   batch_max = 1000
54178   use_bsmtp
54179   user = exim
54180 </literallayout>
54181 <para>
54182 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
54183 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
54184 message (unless there are more than 1000 recipients).
54185 </para>
54186 </section>
54187 <section id="SECTincomingbatchedSMTP">
54188 <title>Incoming batched SMTP</title>
54189 <para>
54190 <indexterm role="concept">
54191 <primary>SMTP</primary>
54192 <secondary>batched incoming</secondary>
54193 </indexterm>
54194 <indexterm role="concept">
54195 <primary>batched SMTP input</primary>
54196 </indexterm>
54197 The <option>-bS</option> command line option causes Exim to accept one or more messages by
54198 reading SMTP on the standard input, but to generate no responses. If the caller
54199 is trusted, the senders in the MAIL commands are believed; otherwise the
54200 sender is always the caller of Exim. Unqualified senders and receivers are not
54201 rejected (there seems little point) but instead just get qualified. HELO
54202 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
54203 as NOOP; QUIT quits.
54204 </para>
54205 <para>
54206 No policy checking is done for BSMTP input. That is, no ACL is run at anytime.
54207 In this respect it is like non-SMTP local input.
54208 </para>
54209 <para>
54210 If an error is detected while reading a message, including a missing <quote>.</quote> at
54211 the end, Exim gives up immediately. It writes details of the error to the
54212 standard output in a stylized way that the calling program should be able to
54213 make some use of automatically, for example:
54214 </para>
54215 <literallayout class="monospaced">
54216 554 Unexpected end of file
54217 Transaction started in line 10
54218 Error detected in line 14
54219 </literallayout>
54220 <para>
54221 It writes a more verbose version, for human consumption, to the standard error
54222 file, for example:
54223 </para>
54224 <literallayout class="monospaced">
54225 An error was detected while processing a file of BSMTP input.
54226 The error message was:
54227
54228 501 '&gt;' missing at end of address
54229
54230 The SMTP transaction started in line 10.
54231 The error was detected in line 12.
54232 The SMTP command at fault was:
54233
54234 rcpt to:&lt;malformed@in.com.plete
54235
54236 1 previous message was successfully processed.
54237 The rest of the batch was abandoned.
54238 </literallayout>
54239 <para>
54240 The return code from Exim is zero only if there were no errors. It is 1 if some
54241 messages were accepted before an error was detected, and 2 if no messages were
54242 accepted.
54243 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
54244 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
54245 </para>
54246 </section>
54247 </chapter>
54248
54249 <chapter id="CHAPemsgcust">
54250 <title>Customizing bounce and warning messages</title>
54251 <titleabbrev>Customizing messages</titleabbrev>
54252 <para>
54253 When a message fails to be delivered, or remains on the queue for more than a
54254 configured amount of time, Exim sends a message to the original sender, or
54255 to an alternative configured address. The text of these messages is built into
54256 the code of Exim, but it is possible to change it, either by adding a single
54257 string, or by replacing each of the paragraphs by text supplied in a file.
54258 </para>
54259 <para>
54260 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
54261 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
54262 option. Exim also adds the line
54263 </para>
54264 <literallayout class="monospaced">
54265 Auto-Submitted: auto-generated
54266 </literallayout>
54267 <para>
54268 to all warning and bounce messages,
54269 </para>
54270 <section>
54271 <title>Customizing bounce messages</title>
54272 <para>
54273 <indexterm role="concept">
54274 <primary>customizing</primary>
54275 <secondary>bounce message</secondary>
54276 </indexterm>
54277 <indexterm role="concept">
54278 <primary>bounce message</primary>
54279 <secondary>customizing</secondary>
54280 </indexterm>
54281 If <option>bounce_message_text</option> is set, its contents are included in the default
54282 message immediately after <quote>This message was created automatically by mail
54283 delivery software.</quote> The string is not expanded. It is not used if
54284 <option>bounce_message_file</option> is set.
54285 </para>
54286 <para>
54287 When <option>bounce_message_file</option> is set, it must point to a template file for
54288 constructing error messages. The file consists of a series of text items,
54289 separated by lines consisting of exactly four asterisks. If the file cannot be
54290 opened, default text is used and a message is written to the main and panic
54291 logs. If any text item in the file is empty, default text is used for that
54292 item.
54293 </para>
54294 <para>
54295 <indexterm role="concept">
54296 <primary><varname>$bounce_recipient</varname></primary>
54297 </indexterm>
54298 <indexterm role="concept">
54299 <primary><varname>$bounce_return_size_limit</varname></primary>
54300 </indexterm>
54301 Each item of text that is read from the file is expanded, and there are two
54302 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
54303 the recipient of an error message while it is being created, and
54304 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
54305 option, rounded to a whole number.
54306 </para>
54307 <para>
54308 The items must appear in the file in the following order:
54309 </para>
54310 <itemizedlist>
54311 <listitem>
54312 <para>
54313 The first item is included in the headers, and should include at least a
54314 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
54315 </para>
54316 </listitem>
54317 <listitem>
54318 <para>
54319 The second item forms the start of the error message. After it, Exim lists the
54320 failing addresses with their error messages.
54321 </para>
54322 </listitem>
54323 <listitem>
54324 <para>
54325 The third item is used to introduce any text from pipe transports that is to be
54326 returned to the sender. It is omitted if there is no such text.
54327 </para>
54328 </listitem>
54329 <listitem>
54330 <para>
54331 The fourth item is used to introduce the copy of the message that is returned
54332 as part of the error report.
54333 </para>
54334 </listitem>
54335 <listitem>
54336 <para>
54337 The fifth item is added after the fourth one if the returned message is
54338 truncated because it is bigger than <option>return_size_limit</option>.
54339 </para>
54340 </listitem>
54341 <listitem>
54342 <para>
54343 The sixth item is added after the copy of the original message.
54344 </para>
54345 </listitem>
54346 </itemizedlist>
54347 <para>
54348 The default state (<option>bounce_message_file</option> unset) is equivalent to the
54349 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
54350 other lines have been split in order to fit them on the page:
54351 </para>
54352 <literallayout class="monospaced">
54353 Subject: Mail delivery failed
54354   ${if eq{$sender_address}{$bounce_recipient}
54355   {: returning message to sender}}
54356 ****
54357 This message was created automatically by mail delivery software.
54358
54359 A message ${if eq{$sender_address}{$bounce_recipient}
54360   {that you sent }{sent by
54361
54362 &lt;$sender_address&gt;
54363
54364 }}could not be delivered to all of its recipients.
54365 The following address(es) failed:
54366 ****
54367 The following text was generated during the delivery attempt(s):
54368 ****
54369 ------ This is a copy of the message, including all the headers.
54370   ------
54371 ****
54372 ------ The body of the message is $message_size characters long;
54373   only the first
54374 ------ $bounce_return_size_limit or so are included here.
54375 ****
54376 </literallayout>
54377 </section>
54378 <section id="SECTcustwarn">
54379 <title>Customizing warning messages</title>
54380 <para>
54381 <indexterm role="concept">
54382 <primary>customizing</primary>
54383 <secondary>warning message</secondary>
54384 </indexterm>
54385 <indexterm role="concept">
54386 <primary>warning of delay</primary>
54387 <secondary>customizing the message</secondary>
54388 </indexterm>
54389 The option <option>warn_message_file</option> can be pointed at a template file for use when
54390 warnings about message delays are created. In this case there are only three
54391 text sections:
54392 </para>
54393 <itemizedlist>
54394 <listitem>
54395 <para>
54396 The first item is included in the headers, and should include at least a
54397 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
54398 </para>
54399 </listitem>
54400 <listitem>
54401 <para>
54402 The second item forms the start of the warning message. After it, Exim lists
54403 the delayed addresses.
54404 </para>
54405 </listitem>
54406 <listitem>
54407 <para>
54408 The third item then ends the message.
54409 </para>
54410 </listitem>
54411 </itemizedlist>
54412 <para>
54413 The default state is equivalent to the following file, except that some lines
54414 have been split here, in order to fit them on the page:
54415 </para>
54416 <literallayout class="monospaced">
54417 Subject: Warning: message $message_exim_id delayed
54418   $warn_message_delay
54419 ****
54420 This message was created automatically by mail delivery software.
54421
54422 A message ${if eq{$sender_address}{$warn_message_recipients}
54423 {that you sent }{sent by
54424
54425 &lt;$sender_address&gt;
54426
54427 }}has not been delivered to all of its recipients after
54428 more than $warn_message_delay on the queue on $primary_hostname.
54429
54430 The message identifier is:     $message_exim_id
54431 The subject of the message is: $h_subject
54432 The date of the message is:    $h_date
54433
54434 The following address(es) have not yet been delivered:
54435 ****
54436 No action is required on your part. Delivery attempts will
54437 continue for some time, and this warning may be repeated at
54438 intervals if the message remains undelivered. Eventually the
54439 mail delivery software will give up, and when that happens,
54440 the message will be returned to you.
54441 </literallayout>
54442 <para>
54443 <indexterm role="concept">
54444 <primary><varname>$warn_message_delay</varname></primary>
54445 </indexterm>
54446 <indexterm role="concept">
54447 <primary><varname>$warn_message_recipients</varname></primary>
54448 </indexterm>
54449 However, in the default state the subject and date lines are omitted if no
54450 appropriate headers exist. During the expansion of this file,
54451 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
54452 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
54453 of recipients for the warning message. There may be more than one if there are
54454 multiple addresses with different <option>errors_to</option> settings on the routers that
54455 handled them.
54456 </para>
54457 </section>
54458 </chapter>
54459
54460 <chapter id="CHAPcomconreq">
54461 <title>Some common configuration settings</title>
54462 <para>
54463 This chapter discusses some configuration settings that seem to be fairly
54464 common. More examples and discussion can be found in the Exim book.
54465 </para>
54466 <section>
54467 <title>Sending mail to a smart host</title>
54468 <para>
54469 <indexterm role="concept">
54470 <primary>smart host</primary>
54471 <secondary>example router</secondary>
54472 </indexterm>
54473 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
54474 should replace the default <command>dnslookup</command> router with a router which does the
54475 routing explicitly:
54476 </para>
54477 <literallayout class="monospaced">
54478 send_to_smart_host:
54479   driver = manualroute
54480   route_list = !+local_domains smart.host.name
54481   transport = remote_smtp
54482 </literallayout>
54483 <para>
54484 You can use the smart host&#x2019;s IP address instead of the name if you wish.
54485 If you are using Exim only to submit messages to a smart host, and not for
54486 receiving incoming messages, you can arrange for it to do the submission
54487 synchronously by setting the <option>mua_wrapper</option> option (see chapter
54488 <xref linkend="CHAPnonqueueing"/>).
54489 </para>
54490 </section>
54491 <section id="SECTmailinglists">
54492 <title>Using Exim to handle mailing lists</title>
54493 <para>
54494 <indexterm role="concept">
54495 <primary>mailing lists</primary>
54496 </indexterm>
54497 Exim can be used to run simple mailing lists, but for large and/or complicated
54498 requirements, the use of additional specialized mailing list software such as
54499 Majordomo or Mailman is recommended.
54500 </para>
54501 <para>
54502 The <command>redirect</command> router can be used to handle mailing lists where each list
54503 is maintained in a separate file, which can therefore be managed by an
54504 independent manager. The <option>domains</option> router option can be used to run these
54505 lists in a separate domain from normal mail. For example:
54506 </para>
54507 <literallayout class="monospaced">
54508 lists:
54509   driver = redirect
54510   domains = lists.example
54511   file = /usr/lists/$local_part
54512   forbid_pipe
54513   forbid_file
54514   errors_to = $local_part-request@lists.example
54515   no_more
54516 </literallayout>
54517 <para>
54518 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
54519 in that domain, it looks for a file that matches the local part. If there is no
54520 such file, the router declines, but because <option>no_more</option> is set, no subsequent
54521 routers are tried, and so the whole delivery fails.
54522 </para>
54523 <para>
54524 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
54525 expanded into a file name or a pipe delivery, which is usually inappropriate in
54526 a mailing list.
54527 </para>
54528 <para>
54529 <indexterm role="concept">
54530 <primary><option>errors_to</option></primary>
54531 </indexterm>
54532 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
54533 taken from a mailing list are to be sent to the given address rather than the
54534 original sender of the message. However, before acting on this, Exim verifies
54535 the error address, and ignores it if verification fails.
54536 </para>
54537 <para>
54538 For example, using the configuration above, mail sent to
54539 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
54540 <filename>/usr/lists/dicts</filename>, with error reports directed to
54541 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
54542 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
54543 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
54544 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
54545 or <option>local_part_suffix</option> options) to handle addresses of the form
54546 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
54547 </para>
54548 </section>
54549 <section>
54550 <title>Syntax errors in mailing lists</title>
54551 <para>
54552 <indexterm role="concept">
54553 <primary>mailing lists</primary>
54554 <secondary>syntax errors in</secondary>
54555 </indexterm>
54556 If an entry in redirection data contains a syntax error, Exim normally defers
54557 delivery of the original address. That means that a syntax error in a mailing
54558 list holds up all deliveries to the list. This may not be appropriate when a
54559 list is being maintained automatically from data supplied by users, and the
54560 addresses are not rigorously checked.
54561 </para>
54562 <para>
54563 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
54564 entries that fail to parse, noting the incident in the log. If in addition
54565 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
54566 whenever a broken address is skipped. It is usually appropriate to set
54567 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
54568 </para>
54569 </section>
54570 <section>
54571 <title>Re-expansion of mailing lists</title>
54572 <para>
54573 <indexterm role="concept">
54574 <primary>mailing lists</primary>
54575 <secondary>re-expansion of</secondary>
54576 </indexterm>
54577 Exim remembers every individual address to which a message has been delivered,
54578 in order to avoid duplication, but it normally stores only the original
54579 recipient addresses with a message. If all the deliveries to a mailing list
54580 cannot be done at the first attempt, the mailing list is re-expanded when the
54581 delivery is next tried. This means that alterations to the list are taken into
54582 account at each delivery attempt, so addresses that have been added to
54583 the list since the message arrived will therefore receive a copy of the
54584 message, even though it pre-dates their subscription.
54585 </para>
54586 <para>
54587 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
54588 on the <command>redirect</command> router. If this is done, any addresses generated by the
54589 router that fail to deliver at the first attempt are added to the message as
54590 <quote>top level</quote> addresses, and the parent address that generated them is marked
54591 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
54592 subsequent delivery attempts. The disadvantage of this is that if any of the
54593 failing addresses are incorrect, correcting them in the file has no effect on
54594 pre-existing messages.
54595 </para>
54596 <para>
54597 The original top-level address is remembered with each of the generated
54598 addresses, and is output in any log messages. However, any intermediate parent
54599 addresses are not recorded. This makes a difference to the log only if the
54600 <option>all_parents</option> selector is set, but for mailing lists there is normally only
54601 one level of expansion anyway.
54602 </para>
54603 </section>
54604 <section>
54605 <title>Closed mailing lists</title>
54606 <para>
54607 <indexterm role="concept">
54608 <primary>mailing lists</primary>
54609 <secondary>closed</secondary>
54610 </indexterm>
54611 The examples so far have assumed open mailing lists, to which anybody may
54612 send mail. It is also possible to set up closed lists, where mail is accepted
54613 from specified senders only. This is done by making use of the generic
54614 <option>senders</option> option to restrict the router that handles the list.
54615 </para>
54616 <para>
54617 The following example uses the same file as a list of recipients and as a list
54618 of permitted senders. It requires three routers:
54619 </para>
54620 <literallayout class="monospaced">
54621 lists_request:
54622   driver = redirect
54623   domains = lists.example
54624   local_part_suffix = -request
54625   file = /usr/lists/$local_part$local_part_suffix
54626   no_more
54627
54628 lists_post:
54629   driver = redirect
54630   domains = lists.example
54631   senders = ${if exists {/usr/lists/$local_part}\
54632              {lsearch;/usr/lists/$local_part}{*}}
54633   file = /usr/lists/$local_part
54634   forbid_pipe
54635   forbid_file
54636   errors_to = $local_part-request@lists.example
54637   no_more
54638
54639 lists_closed:
54640   driver = redirect
54641   domains = lists.example
54642   allow_fail
54643   data = :fail: $local_part@lists.example is a closed mailing list
54644 </literallayout>
54645 <para>
54646 All three routers have the same <option>domains</option> setting, so for any other domains,
54647 they are all skipped. The first router runs only if the local part ends in
54648 <option>-request</option>. It handles messages to the list manager(s) by means of an open
54649 mailing list.
54650 </para>
54651 <para>
54652 The second router runs only if the <option>senders</option> precondition is satisfied. It
54653 checks for the existence of a list that corresponds to the local part, and then
54654 checks that the sender is on the list by means of a linear search. It is
54655 necessary to check for the existence of the file before trying to search it,
54656 because otherwise Exim thinks there is a configuration error. If the file does
54657 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
54658 means that the router runs, but because there is no list, declines, and
54659 <option>no_more</option> ensures that no further routers are run. The address fails with an
54660 <quote>unrouteable address</quote> error.
54661 </para>
54662 <para>
54663 The third router runs only if the second router is skipped, which happens when
54664 a mailing list exists, but the sender is not on it. This router forcibly fails
54665 the address, giving a suitable error message.
54666 </para>
54667 </section>
54668 <section id="SECTverp">
54669 <title>Variable Envelope Return Paths (VERP)</title>
54670 <para>
54671 <indexterm role="concept">
54672 <primary>VERP</primary>
54673 </indexterm>
54674 <indexterm role="concept">
54675 <primary>Variable Envelope Return Paths</primary>
54676 </indexterm>
54677 <indexterm role="concept">
54678 <primary>envelope sender</primary>
54679 </indexterm>
54680 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;
54681 are a way of helping mailing list administrators discover which subscription
54682 address is the cause of a particular delivery failure. The idea is to encode
54683 the original recipient address in the outgoing envelope sender address, so that
54684 if the message is forwarded by another host and then subsequently bounces, the
54685 original recipient can be extracted from the recipient address of the bounce.
54686 </para>
54687 <para>
54688 <indexterm role="option">
54689 <primary><option>errors_to</option></primary>
54690 </indexterm>
54691 <indexterm role="option">
54692 <primary><option>return_path</option></primary>
54693 </indexterm>
54694 Envelope sender addresses can be modified by Exim using two different
54695 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
54696 list examples), or the <option>return_path</option> option on a transport. The second of
54697 these is effective only if the message is successfully delivered to another
54698 host; it is not used for errors detected on the local host (see the description
54699 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
54700 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
54701 </para>
54702 <literallayout class="monospaced">
54703 verp_smtp:
54704   driver = smtp
54705   max_rcpt = 1
54706   return_path = \
54707     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54708       {$1-request=$local_part%$domain@your.dom.example}fail}
54709 </literallayout>
54710 <para>
54711 This has the effect of rewriting the return path (envelope sender) on outgoing
54712 SMTP messages, if the local part of the original return path ends in
54713 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
54714 local part and domain of the recipient into the return path. Suppose, for
54715 example, that a message whose return path has been set to
54716 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
54717 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
54718 rewritten as
54719 </para>
54720 <literallayout class="monospaced">
54721 somelist-request=subscriber%other.dom.example@your.dom.example
54722 </literallayout>
54723 <para revisionflag="changed">
54724 <indexterm role="concept">
54725 <primary><varname>$local_part</varname></primary>
54726 </indexterm>
54727 For this to work, you must tell Exim to send multiple copies of messages that
54728 have more than one recipient, so that each copy has just one recipient. This is
54729 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
54730 might be sent to several different recipients in the same domain, in which case
54731 <varname>$local_part</varname> is not available in the transport, because it is not unique.
54732 </para>
54733 <para revisionflag="changed">
54734 Unless your host is doing nothing but mailing list deliveries, you should
54735 probably use a separate transport for the VERP deliveries, so as not to use
54736 extra resources in making one-per-recipient copies for other deliveries. This
54737 can easily be done by expanding the <option>transport</option> option in the router:
54738 </para>
54739 <literallayout class="monospaced">
54740 dnslookup:
54741   driver = dnslookup
54742   domains = ! +local_domains
54743   transport = \
54744     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
54745       {verp_smtp}{remote_smtp}}
54746   no_more
54747 </literallayout>
54748 <para>
54749 If you want to change the return path using <option>errors_to</option> in a router instead
54750 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
54751 routers that handle mailing list addresses. This will ensure that all delivery
54752 errors, including those detected on the local host, are sent to the VERP
54753 address.
54754 </para>
54755 <para>
54756 On a host that does no local deliveries and has no manual routing, only the
54757 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
54758 SMTP deliveries. Every mailing list recipient has its own return path value,
54759 and so Exim must hand them to the transport one at a time. Here is an example
54760 of a <command>dnslookup</command> router that implements VERP:
54761 </para>
54762 <literallayout class="monospaced">
54763 verp_dnslookup:
54764   driver = dnslookup
54765   domains = ! +local_domains
54766   transport = remote_smtp
54767   errors_to = \
54768     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
54769      {$1-request=$local_part%$domain@your.dom.example}fail}
54770   no_more
54771 </literallayout>
54772 <para>
54773 Before you start sending out messages with VERPed return paths, you must also
54774 configure Exim to accept the bounce messages that come back to those paths.
54775 Typically this is done by setting a <option>local_part_suffix</option> option for a
54776 router, and using this to route the messages to wherever you want to handle
54777 them.
54778 </para>
54779 <para>
54780 The overhead incurred in using VERP depends very much on the size of the
54781 message, the number of recipient addresses that resolve to the same remote
54782 host, and the speed of the connection over which the message is being sent. If
54783 a lot of addresses resolve to the same host and the connection is slow, sending
54784 a separate copy of the message for each address may take substantially longer
54785 than sending a single copy with many recipients (for which VERP cannot be
54786 used).
54787 </para>
54788 </section>
54789 <section id="SECTvirtualdomains">
54790 <title>Virtual domains</title>
54791 <para>
54792 <indexterm role="concept">
54793 <primary>virtual domains</primary>
54794 </indexterm>
54795 <indexterm role="concept">
54796 <primary>domain</primary>
54797 <secondary>virtual</secondary>
54798 </indexterm>
54799 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
54800 meanings:
54801 </para>
54802 <itemizedlist>
54803 <listitem>
54804 <para>
54805 A domain for which there are no real mailboxes; all valid local parts are
54806 aliases for other email addresses. Common examples are organizational
54807 top-level domains and <quote>vanity</quote> domains.
54808 </para>
54809 </listitem>
54810 <listitem>
54811 <para>
54812 One of a number of independent domains that are all handled by the same host,
54813 with mailboxes on that host, but where the mailbox owners do not necessarily
54814 have login accounts on that host.
54815 </para>
54816 </listitem>
54817 </itemizedlist>
54818 <para>
54819 The first usage is probably more common, and does seem more <quote>virtual</quote> than
54820 the second. This kind of domain can be handled in Exim with a straightforward
54821 aliasing router. One approach is to create a separate alias file for each
54822 virtual domain. Exim can test for the existence of the alias file to determine
54823 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
54824 to a router of this form:
54825 </para>
54826 <literallayout class="monospaced">
54827 virtual:
54828   driver = redirect
54829   domains = dsearch;/etc/mail/virtual
54830   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain}}
54831   no_more
54832 </literallayout>
54833 <para>
54834 The <option>domains</option> option specifies that the router is to be skipped, unless there
54835 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
54836 domain that is being processed. When the router runs, it looks up the local
54837 part in the file to find a new address (or list of addresses). The <option>no_more</option>
54838 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
54839 string), Exim gives up on the address without trying any subsequent routers.
54840 </para>
54841 <para>
54842 This one router can handle all the virtual domains because the alias file names
54843 follow a fixed pattern. Permissions can be arranged so that appropriate people
54844 can edit the different alias files. A successful aliasing operation results in
54845 a new envelope recipient address, which is then routed from scratch.
54846 </para>
54847 <para>
54848 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
54849 way. One approach is to create a file for each domain containing a list of
54850 valid local parts, and use it in a router like this:
54851 </para>
54852 <literallayout class="monospaced">
54853 my_domains:
54854   driver = accept
54855   domains = dsearch;/etc/mail/domains
54856   local_parts = lsearch;/etc/mail/domains/$domain
54857   transport = my_mailboxes
54858 </literallayout>
54859 <para>
54860 The address is accepted if there is a file for the domain, and the local part
54861 can be found in the file. The <option>domains</option> option is used to check for the
54862 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
54863 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
54864 because that option is tested after <option>local_parts</option>. The transport is as
54865 follows:
54866 </para>
54867 <literallayout class="monospaced">
54868 my_mailboxes:
54869   driver = appendfile
54870   file = /var/mail/$domain/$local_part
54871   user = mail
54872 </literallayout>
54873 <para>
54874 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
54875 required, to specify which uid is to be used for writing to the mailboxes.
54876 </para>
54877 <para>
54878 The configuration shown here is just one example of how you might support this
54879 requirement. There are many other ways this kind of configuration can be set
54880 up, for example, by using a database instead of separate files to hold all the
54881 information about the domains.
54882 </para>
54883 </section>
54884 <section id="SECTmulbox">
54885 <title>Multiple user mailboxes</title>
54886 <para>
54887 <indexterm role="concept">
54888 <primary>multiple mailboxes</primary>
54889 </indexterm>
54890 <indexterm role="concept">
54891 <primary>mailbox</primary>
54892 <secondary>multiple</secondary>
54893 </indexterm>
54894 <indexterm role="concept">
54895 <primary>local part</primary>
54896 <secondary>prefix</secondary>
54897 </indexterm>
54898 <indexterm role="concept">
54899 <primary>local part</primary>
54900 <secondary>suffix</secondary>
54901 </indexterm>
54902 Heavy email users often want to operate with multiple mailboxes, into which
54903 incoming mail is automatically sorted. A popular way of handling this is to
54904 allow users to use multiple sender addresses, so that replies can easily be
54905 identified. Users are permitted to add prefixes or suffixes to their local
54906 parts for this purpose. The wildcard facility of the generic router options
54907 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
54908 example, consider this router:
54909 </para>
54910 <literallayout class="monospaced">
54911 userforward:
54912   driver = redirect
54913   check_local_user
54914   file = $home/.forward
54915   local_part_suffix = -*
54916   local_part_suffix_optional
54917   allow_filter
54918 </literallayout>
54919 <para>
54920 <indexterm role="concept">
54921 <primary><varname>$local_part_suffix</varname></primary>
54922 </indexterm>
54923 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
54924 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
54925 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
54926 </para>
54927 <literallayout class="monospaced">
54928 if $local_part_suffix contains -special then
54929 save /home/$local_part/Mail/special
54930 endif
54931 </literallayout>
54932 <para>
54933 If the filter file does not exist, or does not deal with such addresses, they
54934 fall through to subsequent routers, and, assuming no subsequent use of the
54935 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
54936 control over which suffixes are valid.
54937 </para>
54938 <para>
54939 Alternatively, a suffix can be used to trigger the use of a different
54940 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
54941 another MTA:
54942 </para>
54943 <literallayout class="monospaced">
54944 userforward:
54945   driver = redirect
54946   check_local_user
54947   file = $home/.forward$local_part_suffix
54948   local_part_suffix = -*
54949   local_part_suffix_optional
54950   allow_filter
54951 </literallayout>
54952 <para>
54953 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
54954 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
54955 does not exist, or does not deal with the address, it is passed on to
54956 subsequent routers, which could, if required, look for an unqualified
54957 <filename>.forward</filename> file to use as a default.
54958 </para>
54959 </section>
54960 <section>
54961 <title>Simplified vacation processing</title>
54962 <para>
54963 <indexterm role="concept">
54964 <primary>vacation processing</primary>
54965 </indexterm>
54966 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
54967 a pipe command in a <filename>.forward</filename> file
54968 (see section <xref linkend="SECTspecitredli"/> for syntax details).
54969 This is prone to error by inexperienced users. There are two features of Exim
54970 that can be used to make this process simpler for users:
54971 </para>
54972 <itemizedlist>
54973 <listitem>
54974 <para>
54975 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
54976 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
54977 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
54978 <filename>.forward</filename> file are then much simpler. For example:
54979 </para>
54980 <literallayout class="monospaced">
54981 spqr, vacation-spqr
54982 </literallayout>
54983 </listitem>
54984 <listitem>
54985 <para>
54986 The <option>require_files</option> generic router option can be used to trigger a
54987 vacation delivery by checking for the existence of a certain file in the
54988 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
54989 ensure that the original delivery also proceeds. In this case, all the user has
54990 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
54991 message.
54992 </para>
54993 </listitem>
54994 </itemizedlist>
54995 <para>
54996 Another advantage of both these methods is that they both work even when the
54997 use of arbitrary pipes by users is locked out.
54998 </para>
54999 </section>
55000 <section>
55001 <title>Taking copies of mail</title>
55002 <para>
55003 <indexterm role="concept">
55004 <primary>message</primary>
55005 <secondary>copying every</secondary>
55006 </indexterm>
55007 Some installations have policies that require archive copies of all messages to
55008 be made. A single copy of each message can easily be taken by an appropriate
55009 command in a system filter, which could, for example, use a different file for
55010 each day&#x2019;s messages.
55011 </para>
55012 <para>
55013 There is also a shadow transport mechanism that can be used to take copies of
55014 messages that are successfully delivered by local transports, one copy per
55015 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
55016 notification of delivery by sites that insist on doing such things.
55017 </para>
55018 </section>
55019 <section>
55020 <title>Intermittently connected hosts</title>
55021 <para>
55022 <indexterm role="concept">
55023 <primary>intermittently connected hosts</primary>
55024 </indexterm>
55025 It has become quite common (because it is cheaper) for hosts to connect to the
55026 Internet periodically rather than remain connected all the time. The normal
55027 arrangement is that mail for such hosts accumulates on a system that is
55028 permanently connected.
55029 </para>
55030 <para>
55031 Exim was designed for use on permanently connected hosts, and so it is not
55032 particularly well-suited to use in an intermittently connected environment.
55033 Nevertheless there are some features that can be used.
55034 </para>
55035 </section>
55036 <section>
55037 <title>Exim on the upstream server host</title>
55038 <para>
55039 It is tempting to arrange for incoming mail for the intermittently connected
55040 host to remain on Exim&#x2019;s queue until the client connects. However, this
55041 approach does not scale very well. Two different kinds of waiting message are
55042 being mixed up in the same queue &ndash; those that cannot be delivered because of
55043 some temporary problem, and those that are waiting for their destination host
55044 to connect. This makes it hard to manage the queue, as well as wasting
55045 resources, because each queue runner scans the entire queue.
55046 </para>
55047 <para>
55048 A better approach is to separate off those messages that are waiting for an
55049 intermittently connected host. This can be done by delivering these messages
55050 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
55051 format, from where they are transmitted by other software when their
55052 destination connects. This makes it easy to collect all the mail for one host
55053 in a single directory, and to apply local timeout rules on a per-message basis
55054 if required.
55055 </para>
55056 <para>
55057 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
55058 you are doing this, you should configure Exim with a long retry period for the
55059 intermittent host. For example:
55060 </para>
55061 <literallayout class="monospaced">
55062 cheshire.wonderland.fict.example    *   F,5d,24h
55063 </literallayout>
55064 <para>
55065 This stops a lot of failed delivery attempts from occurring, but Exim remembers
55066 which messages it has queued up for that host. Once the intermittent host comes
55067 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
55068 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
55069 causes all the queued up messages to be delivered, often down a single SMTP
55070 connection. While the host remains connected, any new messages get delivered
55071 immediately.
55072 </para>
55073 <para>
55074 If the connecting hosts do not have fixed IP addresses, that is, if a host is
55075 issued with a different IP address each time it connects, Exim&#x2019;s retry
55076 mechanisms on the holding host get confused, because the IP address is normally
55077 used as part of the key string for holding retry information. This can be
55078 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
55079 Since this has disadvantages for permanently connected hosts, it is best to
55080 arrange a separate transport for the intermittently connected ones.
55081 </para>
55082 </section>
55083 <section>
55084 <title>Exim on the intermittently connected client host</title>
55085 <para>
55086 The value of <option>smtp_accept_queue_per_connection</option> should probably be
55087 increased, or even set to zero (that is, disabled) on the intermittently
55088 connected host, so that all incoming messages down a single connection get
55089 delivered immediately.
55090 </para>
55091 <para>
55092 <indexterm role="concept">
55093 <primary>SMTP</primary>
55094 <secondary>passed connection</secondary>
55095 </indexterm>
55096 <indexterm role="concept">
55097 <primary>SMTP</primary>
55098 <secondary>multiple deliveries</secondary>
55099 </indexterm>
55100 <indexterm role="concept">
55101 <primary>multiple SMTP deliveries</primary>
55102 </indexterm>
55103 Mail waiting to be sent from an intermittently connected host will probably
55104 not have been routed, because without a connection DNS lookups are not
55105 possible. This means that if a normal queue run is done at connection time,
55106 each message is likely to be sent in a separate SMTP session. This can be
55107 avoided by starting the queue run with a command line option beginning with
55108 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
55109 first pass, routing is done but no deliveries take place. The second pass is a
55110 normal queue run; since all the messages have been previously routed, those
55111 destined for the same host are likely to get sent as multiple deliveries in a
55112 single SMTP connection.
55113 </para>
55114 </section>
55115 </chapter>
55116
55117 <chapter id="CHAPnonqueueing">
55118 <title>Using Exim as a non-queueing client</title>
55119 <titleabbrev>Exim as a non-queueing client</titleabbrev>
55120 <para>
55121 <indexterm role="concept">
55122 <primary>client</primary>
55123 <secondary>non-queueing</secondary>
55124 </indexterm>
55125 <indexterm role="concept">
55126 <primary>smart host</primary>
55127 <secondary>queueing; suppressing</secondary>
55128 </indexterm>
55129 On a personal computer, it is a common requirement for all
55130 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
55131 configured to operate that way, for all the popular operating systems.
55132 However, there are some MUAs for Unix-like systems that cannot be so
55133 configured: they submit messages using the command line interface of
55134 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
55135 messages this way.
55136 </para>
55137 <para>
55138 If the personal computer runs continuously, there is no problem, because it can
55139 run a conventional MTA that handles delivery to the smart host, and deal with
55140 any delays via its queueing mechanism. However, if the computer does not run
55141 continuously or runs different operating systems at different times, queueing
55142 email is not desirable.
55143 </para>
55144 <para>
55145 There is therefore a requirement for something that can provide the
55146 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
55147 any queueing or retrying facilities. Furthermore, the delivery to the smart
55148 host should be synchronous, so that if it fails, the sending MUA is immediately
55149 informed. In other words, we want something that extends an MUA that submits
55150 to a local MTA via the command line so that it behaves like one that submits
55151 to a remote smart host using TCP/SMTP.
55152 </para>
55153 <para>
55154 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
55155 that do this job. However, people have found them to be lacking in various
55156 ways. For instance, you might want to allow aliasing and forwarding to be done
55157 before sending a message to the smart host.
55158 </para>
55159 <para>
55160 Exim already had the necessary infrastructure for doing this job. Just a few
55161 tweaks were needed to make it behave as required, though it is somewhat of an
55162 overkill to use a fully-featured MTA for this purpose.
55163 </para>
55164 <para>
55165 <indexterm role="concept">
55166 <primary><option>mua_wrapper</option></primary>
55167 </indexterm>
55168 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
55169 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
55170 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
55171 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
55172 compatible router and transport configuration. Typically there will be just one
55173 router and one transport, sending everything to a smart host.
55174 </para>
55175 <para>
55176 When run in MUA wrapping mode, the behaviour of Exim changes in the
55177 following ways:
55178 </para>
55179 <itemizedlist>
55180 <listitem>
55181 <para>
55182 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
55183 In other words, the only way to submit messages is via the command line.
55184 </para>
55185 </listitem>
55186 <listitem>
55187 <para>
55188 Each message is synchonously delivered as soon as it is received (<option>-odi</option> is
55189 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
55190 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
55191 does not finish until the delivery attempt is complete. If the delivery is
55192 successful, a zero return code is given.
55193 </para>
55194 </listitem>
55195 <listitem>
55196 <para>
55197 Address redirection is permitted, but the final routing for all addresses must
55198 be to the same remote transport, and to the same list of hosts. Furthermore,
55199 the return address (envelope sender) must be the same for all recipients, as
55200 must any added or deleted header lines. In other words, it must be possible to
55201 deliver the message in a single SMTP transaction, however many recipients there
55202 are.
55203 </para>
55204 </listitem>
55205 <listitem>
55206 <para>
55207 If these conditions are not met, or if routing any address results in a
55208 failure or defer status, or if Exim is unable to deliver all the recipients
55209 successfully to one of the smart hosts, delivery of the entire message fails.
55210 </para>
55211 </listitem>
55212 <listitem>
55213 <para>
55214 Because no queueing is allowed, all failures are treated as permanent; there
55215 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
55216 smart host. Furthermore, because only a single yes/no response can be given to
55217 the caller, it is not possible to deliver to some recipients and not others. If
55218 there is an error (temporary or permanent) for any recipient, all are failed.
55219 </para>
55220 </listitem>
55221 <listitem>
55222 <para>
55223 If more than one smart host is listed, Exim will try another host after a
55224 connection failure or a timeout, in the normal way. However, if this kind of
55225 failure happens for all the hosts, the delivery fails.
55226 </para>
55227 </listitem>
55228 <listitem>
55229 <para>
55230 When delivery fails, an error message is written to the standard error stream
55231 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
55232 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
55233 are ever generated.
55234 </para>
55235 </listitem>
55236 <listitem>
55237 <para>
55238 No retry data is maintained, and any retry rules are ignored.
55239 </para>
55240 </listitem>
55241 <listitem>
55242 <para>
55243 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
55244 true, <option>max_rcpt</option> in the smtp transport is forced to <quote>unlimited</quote>,
55245 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
55246 </para>
55247 </listitem>
55248 </itemizedlist>
55249 <para>
55250 The overall effect is that Exim makes a single synchronous attempt to deliver
55251 the message, failing if there is any kind of problem. Because no local
55252 deliveries are done and no daemon can be run, Exim does not need root
55253 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
55254 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
55255 the advantages and disadvantages of running without root privilege.
55256 </para>
55257 </chapter>
55258
55259 <chapter id="CHAPlog">
55260 <title>Log files</title>
55261 <para>
55262 <indexterm role="concept" id="IIDloggen" class="startofrange">
55263 <primary>log</primary>
55264 <secondary>general description</secondary>
55265 </indexterm>
55266 <indexterm role="concept">
55267 <primary>log</primary>
55268 <secondary>types of</secondary>
55269 </indexterm>
55270 Exim writes three different logs, referred to as the main log, the reject log,
55271 and the panic log:
55272 </para>
55273 <itemizedlist>
55274 <listitem>
55275 <para>
55276 <indexterm role="concept">
55277 <primary>main log</primary>
55278 </indexterm>
55279 The main log records the arrival of each message and each delivery in a single
55280 line in each case. The format is as compact as possible, in an attempt to keep
55281 down the size of log files. Two-character flag sequences make it easy to pick
55282 out these lines. A number of other events are recorded in the main log. Some of
55283 them are optional, in which case the <option>log_selector</option> option controls whether
55284 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
55285 analysis of main log files, is provided in the Exim distribution (see section
55286 <xref linkend="SECTmailstat"/>).
55287 </para>
55288 </listitem>
55289 <listitem>
55290 <para>
55291 <indexterm role="concept">
55292 <primary>reject log</primary>
55293 </indexterm>
55294 The reject log records information from messages that are rejected as a result
55295 of a configuration option (that is, for policy reasons).
55296 The first line of each rejection is a copy of the line that is also written to
55297 the main log. Then, if the message&#x2019;s header has been read at the time the log
55298 is written, its contents are written to this log. Only the original header
55299 lines are available; header lines added by ACLs are not logged. You can use the
55300 reject log to check that your policy controls are working correctly; on a busy
55301 host this may be easier than scanning the main log for rejection messages. You
55302 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
55303 false.
55304 </para>
55305 </listitem>
55306 <listitem>
55307 <para>
55308 <indexterm role="concept">
55309 <primary>panic log</primary>
55310 </indexterm>
55311 <indexterm role="concept">
55312 <primary>system log</primary>
55313 </indexterm>
55314 When certain serious errors occur, Exim writes entries to its panic log. If the
55315 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
55316 are usually written to the main log as well, but can get lost amid the mass of
55317 other entries. The panic log should be empty under normal circumstances. It is
55318 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
55319 regularly, in order to become aware of any problems. When Exim cannot open its
55320 panic log, it tries as a last resort to write to the system log (syslog). This
55321 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
55322 message itself is written at priority LOG_CRIT.
55323 </para>
55324 </listitem>
55325 </itemizedlist>
55326 <para>
55327 Every log line starts with a timestamp, in the format shown in the following
55328 example. Note that many of the examples shown in this chapter are line-wrapped.
55329 In the log file, this would be all on one line:
55330 </para>
55331 <literallayout class="monospaced">
55332 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
55333   by QUIT
55334 </literallayout>
55335 <para>
55336 By default, the timestamps are in the local timezone. There are two
55337 ways of changing this:
55338 </para>
55339 <itemizedlist>
55340 <listitem>
55341 <para>
55342 You can set the <option>timezone</option> option to a different time zone; in particular, if
55343 you set
55344 </para>
55345 <literallayout class="monospaced">
55346 timezone = UTC
55347 </literallayout>
55348 <para>
55349 the timestamps will be in UTC (aka GMT).
55350 </para>
55351 </listitem>
55352 <listitem>
55353 <para>
55354 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
55355 example:
55356 </para>
55357 <literallayout class="monospaced">
55358 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
55359 </literallayout>
55360 </listitem>
55361 </itemizedlist>
55362 <section id="SECTwhelogwri">
55363 <title>Where the logs are written</title>
55364 <para>
55365 <indexterm role="concept">
55366 <primary>log</primary>
55367 <secondary>destination</secondary>
55368 </indexterm>
55369 <indexterm role="concept">
55370 <primary>log</primary>
55371 <secondary>to file</secondary>
55372 </indexterm>
55373 <indexterm role="concept">
55374 <primary>log</primary>
55375 <secondary>to syslog</secondary>
55376 </indexterm>
55377 <indexterm role="concept">
55378 <primary>syslog</primary>
55379 </indexterm>
55380 The logs may be written to local files, or to syslog, or both. However, it
55381 should be noted that many syslog implementations use UDP as a transport, and
55382 are therefore unreliable in the sense that messages are not guaranteed to
55383 arrive at the loghost, nor is the ordering of messages necessarily maintained.
55384 It has also been reported that on large log files (tens of megabytes) you may
55385 need to tweak syslog to prevent it syncing the file with each write &ndash; on
55386 Linux this has been seen to make syslog take 90% plus of CPU time.
55387 </para>
55388 <para>
55389 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
55390 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the run time
55391 configuration. This latter string is expanded, so it can contain, for example,
55392 references to the host name:
55393 </para>
55394 <literallayout class="monospaced">
55395 log_file_path = /var/log/$primary_hostname/exim_%slog
55396 </literallayout>
55397 <para>
55398 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
55399 rather than at run time, because then the setting is available right from the
55400 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
55401 before it has read the configuration file (for example, an error in the
55402 configuration file) it will not use the path you want, and may not be able to
55403 log at all.
55404 </para>
55405 <para>
55406 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
55407 list, currently limited to at most two items. This is one option where the
55408 facility for changing a list separator may not be used. The list must always be
55409 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
55410 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
55411 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
55412 implying the use of a default path.
55413 </para>
55414 <para>
55415 When Exim encounters an empty item in the list, it searches the list defined by
55416 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
55417 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
55418 mean <quote>use the path specified at build time</quote>. It no such item exists, log
55419 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
55420 equivalent to the setting:
55421 </para>
55422 <literallayout class="monospaced">
55423 log_file_path = $spool_directory/log/%slog
55424 </literallayout>
55425 <para>
55426 If you do not specify anything at build time or run time, that is where the
55427 logs are written.
55428 </para>
55429 <para>
55430 A log file path may also contain <literal>%D</literal> if datestamped log file names are in
55431 use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
55432 </para>
55433 <para>
55434 Here are some examples of possible settings:
55435 </para>
55436 <literallayout>
55437 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
55438 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
55439 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
55440 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
55441 </literallayout>
55442 <para>
55443 If there are more than two paths in the list, the first is used and a panic
55444 error is logged.
55445 </para>
55446 </section>
55447 <section>
55448 <title>Logging to local files that are periodically <quote>cycled</quote></title>
55449 <para>
55450 <indexterm role="concept">
55451 <primary>log</primary>
55452 <secondary>cycling local files</secondary>
55453 </indexterm>
55454 <indexterm role="concept">
55455 <primary>cycling logs</primary>
55456 </indexterm>
55457 <indexterm role="concept">
55458 <primary><emphasis>exicyclog</emphasis></primary>
55459 </indexterm>
55460 <indexterm role="concept">
55461 <primary>log</primary>
55462 <secondary>local files; writing to</secondary>
55463 </indexterm>
55464 Some operating systems provide centralized and standardised methods for cycling
55465 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
55466 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
55467 main and reject logs each time it is called. The maximum number of old logs to
55468 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
55469 </para>
55470 <para>
55471 An Exim delivery process opens the main log when it first needs to write to it,
55472 and it keeps the file open in case subsequent entries are required &ndash; for
55473 example, if a number of different deliveries are being done for the same
55474 message. However, remote SMTP deliveries can take a long time, and this means
55475 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
55476 something similar is being used to rename log files on a regular basis. To
55477 ensure that a switch of log files is noticed as soon as possible, Exim calls
55478 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
55479 does not exist, or its inode has changed, the old file is closed and Exim
55480 tries to open the main log from scratch. Thus, an old log file may remain open
55481 for quite some time, but no Exim processes should write to it once it has been
55482 renamed.
55483 </para>
55484 </section>
55485 <section id="SECTdatlogfil">
55486 <title>Datestamped log files</title>
55487 <para>
55488 <indexterm role="concept">
55489 <primary>log</primary>
55490 <secondary>datestamped files</secondary>
55491 </indexterm>
55492 Instead of cycling the main and reject log files by renaming them
55493 periodically, some sites like to use files whose names contain a datestamp,
55494 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename>.
55495 Exim has support for this way of working. It is enabled by setting the
55496 <option>log_file_path</option> option to a path that includes <literal>%D</literal> at the point where the
55497 datestamp is required. For example:
55498 </para>
55499 <literallayout class="monospaced">
55500 log_file_path = /var/spool/exim/log/%slog-%D
55501 log_file_path = /var/log/exim-%s-%D.log
55502 log_file_path = /var/spool/exim/log/%D-%slog
55503 </literallayout>
55504 <para>
55505 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
55506 examples of names generated by the above examples:
55507 </para>
55508 <literallayout class="monospaced">
55509 /var/spool/exim/log/mainlog-20021225
55510 /var/log/exim-reject-20021225.log
55511 /var/spool/exim/log/20021225-mainlog
55512 </literallayout>
55513 <para>
55514 When this form of log file is specified, Exim automatically switches to new
55515 files at midnight. It does not make any attempt to compress old logs; you
55516 will need to write your own script if you require this. You should not
55517 run <emphasis>exicyclog</emphasis> with this form of logging.
55518 </para>
55519 <para>
55520 The location of the panic log is also determined by <option>log_file_path</option>, but it
55521 is not datestamped, because rotation of the panic log does not make sense.
55522 When generating the name of the panic log, <literal>%D</literal> is removed from the string.
55523 In addition, if it immediately follows a slash, a following non-alphanumeric
55524 character is removed; otherwise a preceding non-alphanumeric character is
55525 removed. Thus, the three examples above would give these panic log names:
55526 </para>
55527 <literallayout class="monospaced">
55528 /var/spool/exim/log/paniclog
55529 /var/log/exim-panic.log
55530 /var/spool/exim/log/paniclog
55531 </literallayout>
55532 </section>
55533 <section>
55534 <title>Logging to syslog</title>
55535 <para>
55536 <indexterm role="concept">
55537 <primary>log</primary>
55538 <secondary>syslog; writing to</secondary>
55539 </indexterm>
55540 The use of syslog does not change what Exim logs or the format of its messages,
55541 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
55542 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
55543 that, the same strings are written to syslog as to log files. The syslog
55544 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
55545 by default, but you can change these by setting the <option>syslog_facility</option> and
55546 <option>syslog_processname</option> options, respectively. If Exim was compiled with
55547 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
55548 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
55549 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
55550 the time and host name to each line.
55551 The three log streams are mapped onto syslog priorities as follows:
55552 </para>
55553 <itemizedlist>
55554 <listitem>
55555 <para>
55556 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
55557 </para>
55558 </listitem>
55559 <listitem>
55560 <para>
55561 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
55562 </para>
55563 </listitem>
55564 <listitem>
55565 <para>
55566 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
55567 </para>
55568 </listitem>
55569 </itemizedlist>
55570 <para>
55571 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
55572 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
55573 these are routed by syslog to the same place. You can suppress this duplication
55574 by setting <option>syslog_duplication</option> false.
55575 </para>
55576 <para>
55577 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
55578 entries contain multiple lines when headers are included. To cope with both
55579 these cases, entries written to syslog are split into separate <function>syslog()</function>
55580 calls at each internal newline, and also after a maximum of
55581 870 data characters. (This allows for a total syslog line length of 1024, when
55582 additions such as timestamps are added.) If you are running a syslog
55583 replacement that can handle lines longer than the 1024 characters allowed by
55584 RFC 3164, you should set
55585 </para>
55586 <literallayout class="monospaced">
55587 SYSLOG_LONG_LINES=yes
55588 </literallayout>
55589 <para>
55590 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
55591 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
55592 </para>
55593 <para>
55594 To make it easy to re-assemble split lines later, each component of a split
55595 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;]
55596 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
55597 components in the entry. The / delimiter is used when the line was split
55598 because it was too long; if it was split because of an internal newline, the \
55599 delimiter is used. For example, supposing the length limit to be 50 instead of
55600 870, the following would be the result of a typical rejection message to
55601 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
55602 name, and pid as added by syslog:
55603 </para>
55604 <literallayout class="monospaced">
55605 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
55606 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
55607 [3/5]  when scanning for sender: missing or malformed lo
55608 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
55609 [5/5] mple&gt;)
55610 </literallayout>
55611 <para>
55612 The same error might cause the following lines to be written to <quote>rejectlog</quote>
55613 (LOG_NOTICE):
55614 </para>
55615 <literallayout class="monospaced">
55616 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
55617 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
55618 [3/18] er when scanning for sender: missing or malformed
55619 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
55620 [5\18] .example&gt;)
55621 [6\18] Recipients: ph10@some.domain.cam.example
55622 [7\18] P Received: from [127.0.0.1] (ident=ph10)
55623 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
55624 [9\18]        id 16RdAL-0006pc-00
55625 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
55626 [11\18] 09:43 +0100
55627 [12\18] F From: &lt;&gt;
55628 [13\18]   Subject: this is a test header
55629 [18\18]   X-something: this is another header
55630 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
55631 [16\18] le&gt;
55632 [17\18] B Bcc:
55633 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
55634 </literallayout>
55635 <para>
55636 Log lines that are neither too long nor contain newlines are written to syslog
55637 without modification.
55638 </para>
55639 <para>
55640 If only syslog is being used, the Exim monitor is unable to provide a log tail
55641 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
55642 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
55643 where it is.
55644 </para>
55645 </section>
55646 <section>
55647 <title>Log line flags</title>
55648 <para>
55649 One line is written to the main log for each message received, and for each
55650 successful, unsuccessful, and delayed delivery. These lines can readily be
55651 picked out by the distinctive two-character flags that immediately follow the
55652 timestamp. The flags are:
55653 </para>
55654 <literallayout>
55655 <literal>&lt;=</literal>     message arrival
55656 <literal>=&gt;</literal>     normal message delivery
55657 <literal>-&gt;</literal>     additional address in same delivery
55658 <literal>*&gt;</literal>     delivery suppressed by <option>-N</option>
55659 <literal>**</literal>     delivery failed; address bounced
55660 <literal>==</literal>     delivery deferred; temporary problem
55661 </literallayout>
55662 </section>
55663 <section>
55664 <title>Logging message reception</title>
55665 <para>
55666 <indexterm role="concept">
55667 <primary>log</primary>
55668 <secondary>reception line</secondary>
55669 </indexterm>
55670 The format of the single-line entry in the main log that is written for every
55671 message received is shown in the basic example below, which is split over
55672 several lines in order to fit it on the page:
55673 </para>
55674 <literallayout class="monospaced">
55675 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
55676   H=mailer.fict.example [192.168.123.123] U=exim
55677   P=smtp S=5678 id=&lt;incoming message id&gt;
55678 </literallayout>
55679 <para>
55680 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
55681 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
55682 generated, this is followed by an item of the form
55683 </para>
55684 <literallayout class="monospaced">
55685 R=&lt;message id&gt;
55686 </literallayout>
55687 <para>
55688 which is a reference to the message that caused the bounce to be sent.
55689 </para>
55690 <para>
55691 <indexterm role="concept">
55692 <primary>HELO</primary>
55693 </indexterm>
55694 <indexterm role="concept">
55695 <primary>EHLO</primary>
55696 </indexterm>
55697 For messages from other hosts, the H and U fields identify the remote host and
55698 record the RFC 1413 identity of the user that sent the message, if one was
55699 received. The number given in square brackets is the IP address of the sending
55700 host. If there is a single, unparenthesized  host name in the H field, as
55701 above, it has been verified to correspond to the IP address (see the
55702 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
55703 by the remote host in the SMTP HELO or EHLO command, and has not been
55704 verified. If verification yields a different name to that given for HELO or
55705 EHLO, the verified name appears first, followed by the HELO or EHLO
55706 name in parentheses.
55707 </para>
55708 <para>
55709 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
55710 without brackets, in the HELO or EHLO command, leading to entries in
55711 the log containing text like these examples:
55712 </para>
55713 <literallayout class="monospaced">
55714 H=(10.21.32.43) [192.168.8.34]
55715 H=([10.21.32.43]) [192.168.8.34]
55716 </literallayout>
55717 <para>
55718 This can be confusing. Only the final address in square brackets can be relied
55719 on.
55720 </para>
55721 <para>
55722 For locally generated messages (that is, messages not received over TCP/IP),
55723 the H field is omitted, and the U field contains the login name of the caller
55724 of Exim.
55725 </para>
55726 <para>
55727 <indexterm role="concept">
55728 <primary>authentication</primary>
55729 <secondary>logging</secondary>
55730 </indexterm>
55731 <indexterm role="concept">
55732 <primary>AUTH</primary>
55733 <secondary>logging</secondary>
55734 </indexterm>
55735 For all messages, the P field specifies the protocol used to receive the
55736 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
55737 of incoming SMTP messages, the value indicates whether or not any SMTP
55738 extensions (ESMTP), encryption, or authentication were used. If the SMTP
55739 session was encrypted, there is an additional X field that records the cipher
55740 suite that was used.
55741 </para>
55742 <para>
55743 The protocol is set to <quote>esmptsa</quote> or <quote>esmtpa</quote> for messages received from
55744 hosts that have authenticated themselves using the SMTP AUTH command. The first
55745 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
55746 there is an additional item A= followed by the name of the authenticator that
55747 was used. If an authenticated identification was set up by the authenticator&#x2019;s
55748 <option>server_set_id</option> option, this is logged too, separated by a colon from the
55749 authenticator name.
55750 </para>
55751 <para>
55752 <indexterm role="concept">
55753 <primary>size</primary>
55754 <secondary>of message</secondary>
55755 </indexterm>
55756 The id field records the existing message id, if present. The size of the
55757 received message is given by the S field. When the message is delivered,
55758 headers may be removed or added, so that the size of delivered copies of the
55759 message may not correspond with this value (and indeed may be different to each
55760 other).
55761 </para>
55762 <para>
55763 The <option>log_selector</option> option can be used to request the logging of additional
55764 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
55765 </para>
55766 </section>
55767 <section>
55768 <title>Logging deliveries</title>
55769 <para>
55770 <indexterm role="concept">
55771 <primary>log</primary>
55772 <secondary>delivery line</secondary>
55773 </indexterm>
55774 The format of the single-line entry in the main log that is written for every
55775 delivery is shown in one of the examples below, for local and remote
55776 deliveries, respectively. Each example has been split into two lines in order
55777 to fit it on the page:
55778 </para>
55779 <literallayout class="monospaced">
55780 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
55781   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
55782 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
55783   monk@holistic.fict.example R=dnslookup T=remote_smtp
55784   H=holistic.fict.example [192.168.234.234]
55785 </literallayout>
55786 <para>
55787 For ordinary local deliveries, the original address is given in angle brackets
55788 after the final delivery address, which might be a pipe or a file. If
55789 intermediate address(es) exist between the original and the final address, the
55790 last of these is given in parentheses after the final address. The R and T
55791 fields record the router and transport that were used to process the address.
55792 </para>
55793 <para>
55794 If a shadow transport was run after a successful local delivery, the log line
55795 for the successful delivery has an item added on the end, of the form
55796 </para>
55797 <literallayout>
55798 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
55799 </literallayout>
55800 <para>
55801 If the shadow transport did not succeed, the error message is put in
55802 parentheses afterwards.
55803 </para>
55804 <para>
55805 <indexterm role="concept">
55806 <primary>asterisk</primary>
55807 <secondary>after IP address</secondary>
55808 </indexterm>
55809 When more than one address is included in a single delivery (for example, two
55810 SMTP RCPT commands in one transaction) the second and subsequent addresses are
55811 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
55812 down a single SMTP connection, an asterisk follows the IP address in the log
55813 lines for the second and subsequent messages.
55814 </para>
55815 <para>
55816 The generation of a reply message by a filter file gets logged as a
55817 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
55818 </para>
55819 <para>
55820 The <option>log_selector</option> option can be used to request the logging of additional
55821 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
55822 </para>
55823 </section>
55824 <section>
55825 <title>Discarded deliveries</title>
55826 <para>
55827 <indexterm role="concept">
55828 <primary>discarded messages</primary>
55829 </indexterm>
55830 <indexterm role="concept">
55831 <primary>message</primary>
55832 <secondary>discarded</secondary>
55833 </indexterm>
55834 <indexterm role="concept">
55835 <primary>delivery</primary>
55836 <secondary>discarded; logging</secondary>
55837 </indexterm>
55838 When a message is discarded as a result of the command <quote>seen finish</quote> being
55839 obeyed in a filter file which generates no deliveries, a log entry of the form
55840 </para>
55841 <literallayout class="monospaced">
55842 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
55843   &lt;low.club@bridge.example&gt; R=userforward
55844 </literallayout>
55845 <para>
55846 is written, to record why no deliveries are logged. When a message is discarded
55847 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
55848 </para>
55849 <literallayout class="monospaced">
55850 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
55851   &lt;hole@nowhere.example&gt; R=blackhole_router
55852 </literallayout>
55853 </section>
55854 <section>
55855 <title>Deferred deliveries</title>
55856 <para>
55857 When a delivery is deferred, a line of the following form is logged:
55858 </para>
55859 <literallayout class="monospaced">
55860 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
55861   R=dnslookup T=smtp defer (146): Connection refused
55862 </literallayout>
55863 <para>
55864 In the case of remote deliveries, the error is the one that was given for the
55865 last IP address that was tried. Details of individual SMTP failures are also
55866 written to the log, so the above line would be preceded by something like
55867 </para>
55868 <literallayout class="monospaced">
55869 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
55870   mail1.endrest.example [192.168.239.239]: Connection refused
55871 </literallayout>
55872 <para>
55873 When a deferred address is skipped because its retry time has not been reached,
55874 a message is written to the log, but this can be suppressed by setting an
55875 appropriate value in <option>log_selector</option>.
55876 </para>
55877 </section>
55878 <section>
55879 <title>Delivery failures</title>
55880 <para>
55881 <indexterm role="concept">
55882 <primary>delivery</primary>
55883 <secondary>failure; logging</secondary>
55884 </indexterm>
55885 If a delivery fails because an address cannot be routed, a line of the
55886 following form is logged:
55887 </para>
55888 <literallayout class="monospaced">
55889 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
55890   &lt;jim@trek99.example&gt;: unknown mail domain
55891 </literallayout>
55892 <para>
55893 If a delivery fails at transport time, the router and transport are shown, and
55894 the response from the remote host is included, as in this example:
55895 </para>
55896 <literallayout class="monospaced">
55897 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
55898   R=dnslookup T=remote_smtp: SMTP error from remote mailer
55899   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
55900   pbmail3.py.example [192.168.63.111]: 553 5.3.0
55901   &lt;ace400@pb.example&gt;...Addressee unknown
55902 </literallayout>
55903 <para>
55904 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
55905 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
55906 disabling PIPELINING. The log lines for all forms of delivery failure are
55907 flagged with <literal>**</literal>.
55908 </para>
55909 </section>
55910 <section>
55911 <title>Fake deliveries</title>
55912 <para>
55913 <indexterm role="concept">
55914 <primary>delivery</primary>
55915 <secondary>fake; logging</secondary>
55916 </indexterm>
55917 If a delivery does not actually take place because the <option>-N</option> option has been
55918 used to suppress it, a normal delivery line is written to the log, except that
55919 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
55920 </para>
55921 </section>
55922 <section>
55923 <title>Completion</title>
55924 <para>
55925 A line of the form
55926 </para>
55927 <literallayout class="monospaced">
55928 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
55929 </literallayout>
55930 <para>
55931 is written to the main log when a message is about to be removed from the spool
55932 at the end of its processing.
55933 </para>
55934 </section>
55935 <section>
55936 <title>Summary of Fields in Log Lines</title>
55937 <para>
55938 <indexterm role="concept">
55939 <primary>log</primary>
55940 <secondary>summary of fields</secondary>
55941 </indexterm>
55942 A summary of the field identifiers that are used in log lines is shown in
55943 the following table:
55944 </para>
55945 <literallayout>
55946 <literal>A   </literal>        authenticator name (and optional id)
55947 <literal>C   </literal>        SMTP confirmation on delivery
55948 <literal>CV  </literal>        certificate verification status
55949 <literal>DN  </literal>        distinguished name from peer certificate
55950 <literal>DT  </literal>        on <literal>=&gt;</literal> lines: time taken for a delivery
55951 <literal>F   </literal>        sender address (on delivery lines)
55952 <literal>H   </literal>        host name and IP address
55953 <literal>I   </literal>        local interface used
55954 <literal>id  </literal>        message id for incoming message
55955 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
55956 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
55957 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
55958 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
55959 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
55960 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>**</literal> and <literal>==</literal> lines: router name
55961 <literal>S   </literal>        size of message
55962 <literal>ST  </literal>        shadow transport name
55963 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
55964 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
55965 <literal>U   </literal>        local user or RFC 1413 identity
55966 <literal>X   </literal>        TLS cipher suite
55967 </literallayout>
55968 </section>
55969 <section>
55970 <title>Other log entries</title>
55971 <para>
55972 Various other types of log entry are written from time to time. Most should be
55973 self-explanatory. Among the more common are:
55974 </para>
55975 <itemizedlist>
55976 <listitem>
55977 <para>
55978 <indexterm role="concept">
55979 <primary>retry</primary>
55980 <secondary>time not reached</secondary>
55981 </indexterm>
55982 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
55983 during routing or local delivery, and the time to retry has not yet arrived.
55984 This message is not written to an individual message log file unless it happens
55985 during the first delivery attempt.
55986 </para>
55987 </listitem>
55988 <listitem>
55989 <para>
55990 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
55991 temporary errors during remote delivery, and the retry time has not yet arrived
55992 for any of the hosts to which it is routed.
55993 </para>
55994 </listitem>
55995 <listitem>
55996 <para>
55997 <indexterm role="concept">
55998 <primary>spool directory</primary>
55999 <secondary>file locked</secondary>
56000 </indexterm>
56001 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
56002 some other Exim process is already working on the message. This can be quite
56003 common if queue running processes are started at frequent intervals. The
56004 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
56005 doing.
56006 </para>
56007 </listitem>
56008 <listitem>
56009 <para>
56010 <indexterm role="concept">
56011 <primary>error</primary>
56012 <secondary>ignored</secondary>
56013 </indexterm>
56014 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
56015 message:
56016 </para>
56017 <orderedlist numeration="arabic">
56018 <listitem>
56019 <para>
56020 Exim failed to deliver a bounce message whose age was greater than
56021 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
56022 </para>
56023 </listitem>
56024 <listitem>
56025 <para>
56026 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
56027 failed. The delivery was discarded.
56028 </para>
56029 </listitem>
56030 <listitem>
56031 <para>
56032 A delivery set up by a router configured with
56033 </para>
56034 <literallayout class="monospaced">
56035     errors_to = &lt;&gt;
56036 </literallayout>
56037 <para>
56038 failed. The delivery was discarded.
56039 </para>
56040 </listitem>
56041 </orderedlist>
56042 </listitem>
56043 </itemizedlist>
56044 </section>
56045 <section id="SECTlogselector">
56046 <title>Reducing or increasing what is logged</title>
56047 <para>
56048 <indexterm role="concept">
56049 <primary>log</primary>
56050 <secondary>selectors</secondary>
56051 </indexterm>
56052 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
56053 default logging, or you can request additional logging. The value of
56054 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
56055 example:
56056 </para>
56057 <literallayout class="monospaced">
56058 log_selector = +arguments -retry_defer
56059 </literallayout>
56060 <para>
56061 The list of optional log items is in the following table, with the default
56062 selection marked by asterisks:
56063 </para>
56064 <literallayout>
56065 <literal>*acl_warn_skipped           </literal>  skipped <option>warn</option> statement in ACL
56066 <literal> address_rewrite            </literal>  address rewriting
56067 <literal> all_parents                </literal>  all parents in =&gt; lines
56068 <literal> arguments                  </literal>  command line arguments
56069 <literal>*connection_reject          </literal>  connection rejections
56070 <literal>*delay_delivery             </literal>  immediate delivery delayed
56071 <literal> deliver_time               </literal>  time taken to perform delivery
56072 <literal> delivery_size              </literal>  add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines
56073 <literal>*dnslist_defer              </literal>  defers of DNS list (aka RBL) lookups
56074 <literal>*etrn                       </literal>  ETRN commands
56075 <literal>*host_lookup_failed         </literal>  as it says
56076 <literal> ident_timeout              </literal>  timeout for ident connection
56077 <literal> incoming_interface         </literal>  incoming interface on &lt;= lines
56078 <literal> incoming_port              </literal>  incoming port on &lt;= lines
56079 <literal>*lost_incoming_connection   </literal>  as it says (includes timeouts)
56080 <literal> outgoing_port              </literal>  add remote port to =&gt; lines
56081 <literal>*queue_run                  </literal>  start and end queue runs
56082 <literal> queue_time                 </literal>  time on queue for one recipient
56083 <literal> queue_time_overall         </literal>  time on queue for whole message
56084 <literal> received_recipients        </literal>  recipients on &lt;= lines
56085 <literal> received_sender            </literal>  sender on &lt;= lines
56086 <literal>*rejected_header            </literal>  header contents on reject log
56087 <literal>*retry_defer                </literal>  <quote>retry time not reached</quote>
56088 <literal> return_path_on_delivery    </literal>  put return path on =&gt; and ** lines
56089 <literal> sender_on_delivery         </literal>  add sender to =&gt; lines
56090 <literal>*sender_verify_fail         </literal>  sender verification failures
56091 <literal>*size_reject                </literal>  rejection because too big
56092 <literal>*skip_delivery              </literal>  delivery skipped in a queue run
56093 <literal> smtp_confirmation          </literal>  SMTP confirmation on =&gt; lines
56094 <literal> smtp_connection            </literal>  SMTP connections
56095 <literal> smtp_incomplete_transaction</literal>  incomplete SMTP transactions
56096 <literal> smtp_protocol_error        </literal>  SMTP protocol errors
56097 <literal> smtp_syntax_error          </literal>  SMTP syntax errors
56098 <literal> subject                    </literal>  contents of <emphasis>Subject:</emphasis> on &lt;= lines
56099 <literal> tls_certificate_verified   </literal>  certificate verification status
56100 <literal>*tls_cipher                 </literal>  TLS cipher suite on &lt;= and =&gt; lines
56101 <literal> tls_peerdn                 </literal>  TLS peer DN on &lt;= and =&gt; lines
56102 <literal> unknown_in_list            </literal>  DNS lookup failed in list match
56103
56104 <literal> all                        </literal>  all of the above
56105 </literallayout>
56106 <para>
56107 More details on each of these items follows:
56108 </para>
56109 <itemizedlist>
56110 <listitem>
56111 <para>
56112 <indexterm role="concept">
56113 <primary><option>warn</option> statement</primary>
56114 <secondary>log when skipping</secondary>
56115 </indexterm>
56116 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
56117 its conditions cannot be evaluated, a log line to this effect is written if
56118 this log selector is set.
56119 </para>
56120 </listitem>
56121 <listitem>
56122 <para>
56123 <indexterm role="concept">
56124 <primary>log</primary>
56125 <secondary>rewriting</secondary>
56126 </indexterm>
56127 <indexterm role="concept">
56128 <primary>rewriting</primary>
56129 <secondary>logging</secondary>
56130 </indexterm>
56131 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
56132 rewrites, but not to rewrites in filters run as an unprivileged user (because
56133 such users cannot access the log).
56134 </para>
56135 </listitem>
56136 <listitem>
56137 <para>
56138 <indexterm role="concept">
56139 <primary>log</primary>
56140 <secondary>full parentage</secondary>
56141 </indexterm>
56142 <option>all_parents</option>: Normally only the original and final addresses are logged on
56143 delivery lines; with this selector, intermediate parents are given in
56144 parentheses between them.
56145 </para>
56146 </listitem>
56147 <listitem>
56148 <para>
56149 <indexterm role="concept">
56150 <primary>log</primary>
56151 <secondary>Exim arguments</secondary>
56152 </indexterm>
56153 <indexterm role="concept">
56154 <primary>Exim arguments</primary>
56155 <secondary>logging</secondary>
56156 </indexterm>
56157 <option>arguments</option>: This causes Exim to write the arguments with which it was called
56158 to the main log, preceded by the current working directory. This is a debugging
56159 feature, added to make it easier to find out how certain MUAs call
56160 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
56161 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
56162 that are empty or that contain white space are quoted. Non-printing characters
56163 are shown as escape sequences. This facility cannot log unrecognized arguments,
56164 because the arguments are checked before the configuration file is read. The
56165 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
56166 between the caller and Exim.
56167 </para>
56168 </listitem>
56169 <listitem>
56170 <para>
56171 <indexterm role="concept">
56172 <primary>log</primary>
56173 <secondary>connection rejections</secondary>
56174 </indexterm>
56175 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
56176 connection is rejected, for whatever reason.
56177 </para>
56178 </listitem>
56179 <listitem>
56180 <para>
56181 <indexterm role="concept">
56182 <primary>log</primary>
56183 <secondary>delayed delivery</secondary>
56184 </indexterm>
56185 <indexterm role="concept">
56186 <primary>delayed delivery</primary>
56187 <secondary>logging</secondary>
56188 </indexterm>
56189 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
56190 started for an incoming message because the load is too high or too many
56191 messages were received on one connection. Logging does not occur if no delivery
56192 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
56193 </para>
56194 </listitem>
56195 <listitem>
56196 <para>
56197 <indexterm role="concept">
56198 <primary>log</primary>
56199 <secondary>delivery duration</secondary>
56200 </indexterm>
56201 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
56202 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
56203 </para>
56204 </listitem>
56205 <listitem>
56206 <para>
56207 <indexterm role="concept">
56208 <primary>log</primary>
56209 <secondary>message size on delivery</secondary>
56210 </indexterm>
56211 <indexterm role="concept">
56212 <primary>size</primary>
56213 <secondary>of message</secondary>
56214 </indexterm>
56215 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
56216 the <quote>=&gt;</quote> line, tagged with S=.
56217 </para>
56218 </listitem>
56219 <listitem>
56220 <para>
56221 <indexterm role="concept">
56222 <primary>log</primary>
56223 <secondary>dnslist defer</secondary>
56224 </indexterm>
56225 <indexterm role="concept">
56226 <primary>DNS list</primary>
56227 <secondary>logging defer</secondary>
56228 </indexterm>
56229 <indexterm role="concept">
56230 <primary>black list (DNS)</primary>
56231 </indexterm>
56232 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
56233 DNS black list suffers a temporary error.
56234 </para>
56235 </listitem>
56236 <listitem>
56237 <para>
56238 <indexterm role="concept">
56239 <primary>log</primary>
56240 <secondary>ETRN commands</secondary>
56241 </indexterm>
56242 <indexterm role="concept">
56243 <primary>ETRN</primary>
56244 <secondary>logging</secondary>
56245 </indexterm>
56246 <option>etrn</option>: Every legal ETRN command that is received is logged, before the ACL
56247 is run to determine whether or not it is actually accepted. An invalid ETRN
56248 command, or one received within a message transaction is not logged by this
56249 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
56250 </para>
56251 </listitem>
56252 <listitem>
56253 <para>
56254 <indexterm role="concept">
56255 <primary>log</primary>
56256 <secondary>host lookup failure</secondary>
56257 </indexterm>
56258 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
56259 any addresses, or when a lookup of an IP address fails to find a host name, a
56260 log line is written. This logging does not apply to direct DNS lookups when
56261 routing email addresses, but it does apply to <quote>byname</quote> lookups.
56262 </para>
56263 </listitem>
56264 <listitem>
56265 <para>
56266 <indexterm role="concept">
56267 <primary>log</primary>
56268 <secondary>ident timeout</secondary>
56269 </indexterm>
56270 <indexterm role="concept">
56271 <primary>RFC 1413</primary>
56272 <secondary>logging timeout</secondary>
56273 </indexterm>
56274 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
56275 client&#x2019;s ident port times out.
56276 </para>
56277 </listitem>
56278 <listitem>
56279 <para>
56280 <indexterm role="concept">
56281 <primary>log</primary>
56282 <secondary>incoming interface</secondary>
56283 </indexterm>
56284 <indexterm role="concept">
56285 <primary>interface</primary>
56286 <secondary>logging</secondary>
56287 </indexterm>
56288 <option>incoming_interface</option>: The interface on which a message was received is added
56289 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
56290 followed by a colon and the port number. The local interface and port are also
56291 added to other SMTP log lines, for example <quote>SMTP connection from</quote>, and to
56292 rejection lines.
56293 </para>
56294 </listitem>
56295 <listitem>
56296 <para>
56297 <indexterm role="concept">
56298 <primary>log</primary>
56299 <secondary>incoming remote port</secondary>
56300 </indexterm>
56301 <indexterm role="concept">
56302 <primary>port</primary>
56303 <secondary>logging remote</secondary>
56304 </indexterm>
56305 <indexterm role="concept">
56306 <primary>TCP/IP</primary>
56307 <secondary>logging incoming remote port</secondary>
56308 </indexterm>
56309 <indexterm role="concept">
56310 <primary><varname>$sender_fullhost</varname></primary>
56311 </indexterm>
56312 <indexterm role="concept">
56313 <primary><varname>$sender_rcvhost</varname></primary>
56314 </indexterm>
56315 <option>incoming_port</option>: The remote port number from which a message was received is
56316 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
56317 in square brackets, and separated from it by a colon. This is implemented by
56318 changing the value that is put in the <varname>$sender_fullhost</varname> and
56319 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
56320 important with the widening use of NAT (see RFC 2505).
56321 </para>
56322 </listitem>
56323 <listitem>
56324 <para>
56325 <indexterm role="concept">
56326 <primary>log</primary>
56327 <secondary>dropped connection</secondary>
56328 </indexterm>
56329 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
56330 connection is unexpectedly dropped.
56331 </para>
56332 </listitem>
56333 <listitem>
56334 <para>
56335 <indexterm role="concept">
56336 <primary>log</primary>
56337 <secondary>outgoing remote port</secondary>
56338 </indexterm>
56339 <indexterm role="concept">
56340 <primary>port</primary>
56341 <secondary>logging outgoint remote</secondary>
56342 </indexterm>
56343 <indexterm role="concept">
56344 <primary>TCP/IP</primary>
56345 <secondary>logging ougtoing remote port</secondary>
56346 </indexterm>
56347 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
56348 containing =&gt; tags) following the IP address. This option is not included in
56349 the default setting, because for most ordinary configurations, the remote port
56350 number is always 25 (the SMTP port).
56351 </para>
56352 </listitem>
56353 <listitem>
56354 <para>
56355 <indexterm role="concept">
56356 <primary>log</primary>
56357 <secondary>queue run</secondary>
56358 </indexterm>
56359 <indexterm role="concept">
56360 <primary>queue runner</primary>
56361 <secondary>logging</secondary>
56362 </indexterm>
56363 <option>queue_run</option>: The start and end of every queue run are logged.
56364 </para>
56365 </listitem>
56366 <listitem>
56367 <para>
56368 <indexterm role="concept">
56369 <primary>log</primary>
56370 <secondary>queue time</secondary>
56371 </indexterm>
56372 <option>queue_time</option>: The amount of time the message has been in the queue on the
56373 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
56374 <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the message, so it
56375 includes reception time as well as the delivery time for the current address.
56376 This means that it may be longer than the difference between the arrival and
56377 delivery log line times, because the arrival log line is not written until the
56378 message has been successfully received.
56379 </para>
56380 </listitem>
56381 <listitem>
56382 <para>
56383 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
56384 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
56385 example, <literal>QT=3m45s</literal>. The clock starts when Exim starts to receive the
56386 message, so it includes reception time as well as the total delivery time.
56387 </para>
56388 </listitem>
56389 <listitem>
56390 <para>
56391 <indexterm role="concept">
56392 <primary>log</primary>
56393 <secondary>recipients</secondary>
56394 </indexterm>
56395 <option>received_recipients</option>: The recipients of a message are listed in the main log
56396 as soon as the message is received. The list appears at the end of the log line
56397 that is written when a message is received, preceded by the word <quote>for</quote>. The
56398 addresses are listed after they have been qualified, but before any rewriting
56399 has taken place.
56400 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
56401 in the list.
56402 </para>
56403 </listitem>
56404 <listitem>
56405 <para>
56406 <indexterm role="concept">
56407 <primary>log</primary>
56408 <secondary>sender reception</secondary>
56409 </indexterm>
56410 <option>received_sender</option>: The unrewritten original sender of a message is added to
56411 the end of the log line that records the message&#x2019;s arrival, after the word
56412 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
56413 </para>
56414 </listitem>
56415 <listitem>
56416 <para>
56417 <indexterm role="concept">
56418 <primary>log</primary>
56419 <secondary>header lines for rejection</secondary>
56420 </indexterm>
56421 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
56422 rejection is written to the reject log, the complete header is added to the
56423 log. Header logging can be turned off individually for messages that are
56424 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
56425 </para>
56426 </listitem>
56427 <listitem>
56428 <para>
56429 <indexterm role="concept">
56430 <primary>log</primary>
56431 <secondary>retry defer</secondary>
56432 </indexterm>
56433 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
56434 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
56435 message is always omitted from individual message logs after the first delivery
56436 attempt.
56437 </para>
56438 </listitem>
56439 <listitem>
56440 <para>
56441 <indexterm role="concept">
56442 <primary>log</primary>
56443 <secondary>return path</secondary>
56444 </indexterm>
56445 <option>return_path_on_delivery</option>: The return path that is being transmitted with
56446 the message is included in delivery and bounce lines, using the tag P=.
56447 This is omitted if no delivery actually happens, for example, if routing fails,
56448 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
56449 </para>
56450 </listitem>
56451 <listitem>
56452 <para>
56453 <indexterm role="concept">
56454 <primary>log</primary>
56455 <secondary>sender on delivery</secondary>
56456 </indexterm>
56457 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
56458 and bounce line, tagged by F= (for <quote>from</quote>).
56459 This is the original sender that was received with the message; it is not
56460 necessarily the same as the outgoing return path.
56461 </para>
56462 </listitem>
56463 <listitem>
56464 <para>
56465 <indexterm role="concept">
56466 <primary>log</primary>
56467 <secondary>sender verify failure</secondary>
56468 </indexterm>
56469 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
56470 gives details of a sender verification failure is not written. Log lines for
56471 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
56472 detail is lost.
56473 </para>
56474 </listitem>
56475 <listitem>
56476 <para>
56477 <indexterm role="concept">
56478 <primary>log</primary>
56479 <secondary>size rejection</secondary>
56480 </indexterm>
56481 <option>size_reject</option>: A log line is written whenever a message is rejected because
56482 it is too big.
56483 </para>
56484 </listitem>
56485 <listitem>
56486 <para>
56487 <indexterm role="concept">
56488 <primary>log</primary>
56489 <secondary>frozen messages; skipped</secondary>
56490 </indexterm>
56491 <indexterm role="concept">
56492 <primary>frozen messages</primary>
56493 <secondary>logging skipping</secondary>
56494 </indexterm>
56495 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
56496 queue run because it is frozen or because another process is already delivering
56497 it.
56498 <indexterm role="concept">
56499 <primary><quote>spool file is locked</quote></primary>
56500 </indexterm>
56501 The message that is written is <quote>spool file is locked</quote>.
56502 </para>
56503 </listitem>
56504 <listitem>
56505 <para>
56506 <indexterm role="concept">
56507 <primary>log</primary>
56508 <secondary>smtp confirmation</secondary>
56509 </indexterm>
56510 <indexterm role="concept">
56511 <primary>SMTP</primary>
56512 <secondary>logging confirmation</secondary>
56513 </indexterm>
56514 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP dialogue for
56515 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
56516 A number of MTAs (including Exim) return an identifying string in this
56517 response.
56518 </para>
56519 </listitem>
56520 <listitem>
56521 <para>
56522 <indexterm role="concept">
56523 <primary>log</primary>
56524 <secondary>SMTP connections</secondary>
56525 </indexterm>
56526 <indexterm role="concept">
56527 <primary>SMTP</primary>
56528 <secondary>logging connections</secondary>
56529 </indexterm>
56530 <option>smtp_connection</option>: A log line is written whenever an SMTP connection is
56531 established or closed, unless the connection is from a host that matches
56532 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
56533 only when the closure is unexpected.) This applies to connections from local
56534 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
56535 dropped in the middle of a message, a log line is always written, whether or
56536 not this selector is set, but otherwise nothing is written at the start and end
56537 of connections unless this selector is enabled.
56538 </para>
56539 <para>
56540 For TCP/IP connections to an Exim daemon, the current number of connections is
56541 included in the log message for each new connection, but note that the count is
56542 reset if the daemon is restarted.
56543 Also, because connections are closed (and the closure is logged) in
56544 subprocesses, the count may not include connections that have been closed but
56545 whose termination the daemon has not yet noticed. Thus, while it is possible to
56546 match up the opening and closing of connections in the log, the value of the
56547 logged counts may not be entirely accurate.
56548 </para>
56549 </listitem>
56550 <listitem>
56551 <para>
56552 <indexterm role="concept">
56553 <primary>log</primary>
56554 <secondary>SMTP transaction; incomplete</secondary>
56555 </indexterm>
56556 <indexterm role="concept">
56557 <primary>SMTP</primary>
56558 <secondary>logging incomplete transactions</secondary>
56559 </indexterm>
56560 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
56561 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
56562 and the message sender plus any accepted recipients are included in the log
56563 line. This can provide evidence of dictionary attacks.
56564 </para>
56565 </listitem>
56566 <listitem>
56567 <para>
56568 <indexterm role="concept">
56569 <primary>log</primary>
56570 <secondary>SMTP protocol error</secondary>
56571 </indexterm>
56572 <indexterm role="concept">
56573 <primary>SMTP</primary>
56574 <secondary>logging protocol error</secondary>
56575 </indexterm>
56576 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
56577 encountered. Exim does not have perfect detection of all protocol errors
56578 because of transmission delays and the use of pipelining. If PIPELINING has
56579 been advertised to a client, an Exim server assumes that the client will use
56580 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
56581 received after rejecting MAIL) as protocol errors.
56582 </para>
56583 </listitem>
56584 <listitem>
56585 <para>
56586 <indexterm role="concept">
56587 <primary>SMTP</primary>
56588 <secondary>logging syntax errors</secondary>
56589 </indexterm>
56590 <indexterm role="concept">
56591 <primary>SMTP</primary>
56592 <secondary>syntax errors; logging</secondary>
56593 </indexterm>
56594 <indexterm role="concept">
56595 <primary>SMTP</primary>
56596 <secondary>unknown command; logging</secondary>
56597 </indexterm>
56598 <indexterm role="concept">
56599 <primary>log</primary>
56600 <secondary>unknown SMTP command</secondary>
56601 </indexterm>
56602 <indexterm role="concept">
56603 <primary>log</primary>
56604 <secondary>SMTP syntax error</secondary>
56605 </indexterm>
56606 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
56607 encountered. An unrecognized command is treated as a syntax error. For an
56608 external connection, the host identity is given; for an internal connection
56609 using <option>-bs</option> the sender identification (normally the calling user) is given.
56610 </para>
56611 </listitem>
56612 <listitem>
56613 <para>
56614 <indexterm role="concept">
56615 <primary>log</primary>
56616 <secondary>subject</secondary>
56617 </indexterm>
56618 <indexterm role="concept">
56619 <primary>subject</primary>
56620 <secondary>logging</secondary>
56621 </indexterm>
56622 <option>subject</option>: The subject of the message is added to the arrival log line,
56623 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
56624 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
56625 specifies whether characters with values greater than 127 should be logged
56626 unchanged, or whether they should be rendered as escape sequences.
56627 </para>
56628 </listitem>
56629 <listitem>
56630 <para>
56631 <indexterm role="concept">
56632 <primary>log</primary>
56633 <secondary>certificate verification</secondary>
56634 </indexterm>
56635 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
56636 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
56637 verified, and <literal>CV=no</literal> if not.
56638 </para>
56639 </listitem>
56640 <listitem>
56641 <para>
56642 <indexterm role="concept">
56643 <primary>log</primary>
56644 <secondary>TLS cipher</secondary>
56645 </indexterm>
56646 <indexterm role="concept">
56647 <primary>TLS</primary>
56648 <secondary>logging cipher</secondary>
56649 </indexterm>
56650 <option>tls_cipher</option>: When a message is sent or received over an encrypted
56651 connection, the cipher suite used is added to the log line, preceded by X=.
56652 </para>
56653 </listitem>
56654 <listitem>
56655 <para>
56656 <indexterm role="concept">
56657 <primary>log</primary>
56658 <secondary>TLS peer DN</secondary>
56659 </indexterm>
56660 <indexterm role="concept">
56661 <primary>TLS</primary>
56662 <secondary>logging peer DN</secondary>
56663 </indexterm>
56664 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
56665 connection, and a certificate is supplied by the remote host, the peer DN is
56666 added to the log line, preceded by DN=.
56667 </para>
56668 </listitem>
56669 <listitem>
56670 <para>
56671 <indexterm role="concept">
56672 <primary>log</primary>
56673 <secondary>DNS failure in list</secondary>
56674 </indexterm>
56675 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
56676 result of a list match is failure because a DNS lookup failed.
56677 </para>
56678 </listitem>
56679 </itemizedlist>
56680 </section>
56681 <section>
56682 <title>Message log</title>
56683 <para>
56684 <indexterm role="concept">
56685 <primary>message</primary>
56686 <secondary>log file for</secondary>
56687 </indexterm>
56688 <indexterm role="concept">
56689 <primary>log</primary>
56690 <secondary>message log; description of</secondary>
56691 </indexterm>
56692 <indexterm role="concept">
56693 <primary><filename>msglog</filename> directory</primary>
56694 </indexterm>
56695 <indexterm role="concept">
56696 <primary><option>preserve_message_logs</option></primary>
56697 </indexterm>
56698 In addition to the general log files, Exim writes a log file for each message
56699 that it handles. The names of these per-message logs are the message ids, and
56700 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
56701 message log contains copies of the log lines that apply to the message. This
56702 makes it easier to inspect the status of an individual message without having
56703 to search the main log. A message log is deleted when processing of the message
56704 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
56705 only with great care because they can fill up your disk very quickly.
56706 </para>
56707 <para>
56708 On a heavily loaded system, it may be desirable to disable the use of
56709 per-message logs, in order to reduce disk I/O. This can be done by setting the
56710 <option>message_logs</option> option false.
56711 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
56712 </para>
56713 </section>
56714 </chapter>
56715
56716 <chapter id="CHAPutils">
56717 <title>Exim utilities</title>
56718 <para>
56719 <indexterm role="concept" id="IIDutils" class="startofrange">
56720 <primary>utilities</primary>
56721 </indexterm>
56722 A number of utility scripts and programs are supplied with Exim and are
56723 described in this chapter. There is also the Exim Monitor, which is covered in
56724 the next chapter. The utilities described here are:
56725 </para>
56726 <informaltable frame="none">
56727 <tgroup cols="4" colsep="0" rowsep="0">
56728 <colspec colwidth="2*" align="left"/>
56729 <colspec colwidth="8*" align="left"/>
56730 <colspec colwidth="30*" align="left"/>
56731 <colspec colwidth="40*" align="left"/>
56732 <tbody>
56733 <row>
56734 <entry></entry>
56735 <entry><xref linkend="SECTfinoutwha"/></entry>
56736 <entry><emphasis>exiwhat</emphasis></entry>
56737 <entry>list what Exim processes are doing</entry>
56738 </row>
56739 <row>
56740 <entry></entry>
56741 <entry><xref linkend="SECTgreptheque"/></entry>
56742 <entry><emphasis>exiqgrep</emphasis></entry>
56743 <entry>grep the queue</entry>
56744 </row>
56745 <row>
56746 <entry></entry>
56747 <entry><xref linkend="SECTsumtheque"/></entry>
56748 <entry><emphasis>exiqsumm</emphasis></entry>
56749 <entry>summarize the queue</entry>
56750 </row>
56751 <row>
56752 <entry></entry>
56753 <entry><xref linkend="SECTextspeinf"/></entry>
56754 <entry><emphasis>exigrep</emphasis></entry>
56755 <entry>search the main log</entry>
56756 </row>
56757 <row>
56758 <entry></entry>
56759 <entry><xref linkend="SECTexipick"/></entry>
56760 <entry><emphasis>exipick</emphasis></entry>
56761 <entry>select messages on various criteria</entry>
56762 </row>
56763 <row>
56764 <entry></entry>
56765 <entry><xref linkend="SECTcyclogfil"/></entry>
56766 <entry><emphasis>exicyclog</emphasis></entry>
56767 <entry>cycle (rotate) log files</entry>
56768 </row>
56769 <row>
56770 <entry></entry>
56771 <entry><xref linkend="SECTmailstat"/></entry>
56772 <entry><emphasis>eximstats</emphasis></entry>
56773 <entry>extract statistics from the log</entry>
56774 </row>
56775 <row>
56776 <entry></entry>
56777 <entry><xref linkend="SECTcheckaccess"/></entry>
56778 <entry><emphasis>exim_checkaccess</emphasis></entry>
56779 <entry>check address acceptance from given IP</entry>
56780 </row>
56781 <row>
56782 <entry></entry>
56783 <entry><xref linkend="SECTdbmbuild"/></entry>
56784 <entry><emphasis>exim_dbmbuild</emphasis></entry>
56785 <entry>build a DBM file</entry>
56786 </row>
56787 <row>
56788 <entry></entry>
56789 <entry><xref linkend="SECTfinindret"/></entry>
56790 <entry><emphasis>exinext</emphasis></entry>
56791 <entry>extract retry information</entry>
56792 </row>
56793 <row>
56794 <entry></entry>
56795 <entry><xref linkend="SECThindatmai"/></entry>
56796 <entry><emphasis>exim_dumpdb</emphasis></entry>
56797 <entry>dump a hints database</entry>
56798 </row>
56799 <row>
56800 <entry></entry>
56801 <entry><xref linkend="SECThindatmai"/></entry>
56802 <entry><emphasis>exim_tidydb</emphasis></entry>
56803 <entry>clean up a hints database</entry>
56804 </row>
56805 <row>
56806 <entry></entry>
56807 <entry><xref linkend="SECThindatmai"/></entry>
56808 <entry><emphasis>exim_fixdb</emphasis></entry>
56809 <entry>patch a hints database</entry>
56810 </row>
56811 <row>
56812 <entry></entry>
56813 <entry><xref linkend="SECTmailboxmaint"/></entry>
56814 <entry><emphasis>exim_lock</emphasis></entry>
56815 <entry>lock a mailbox file</entry>
56816 </row>
56817 </tbody>
56818 </tgroup>
56819 </informaltable>
56820 <para>
56821 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
56822 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
56823 <emphasis role="bold"><ulink url="http://duncanthrax.net/exilog/">http://duncanthrax.net/exilog/</ulink></emphasis> for details.
56824 </para>
56825 <section id="SECTfinoutwha">
56826 <title>Finding out what Exim processes are doing (exiwhat)</title>
56827 <para>
56828 <indexterm role="concept">
56829 <primary><emphasis>exiwhat</emphasis></primary>
56830 </indexterm>
56831 <indexterm role="concept">
56832 <primary>process</primary>
56833 <secondary>querying</secondary>
56834 </indexterm>
56835 <indexterm role="concept">
56836 <primary>SIGUSR1</primary>
56837 </indexterm>
56838 On operating systems that can restart a system call after receiving a signal
56839 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
56840 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
56841 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
56842 processes it can find, having first emptied the file. It then waits for one
56843 second to allow the Exim processes to react before displaying the results. In
56844 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
56845 send the signal to the Exim processes, so it is normally run as root.
56846 </para>
56847 <para>
56848 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
56849 use by system administrators. It is not sensible, for example, to set up a
56850 script that sends SIGUSR1 signals to Exim processes at short intervals.
56851 </para>
56852 <para>
56853 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
56854 varies in different operating systems. Not only are different options used,
56855 but the format of the output is different. For this reason, there are some
56856 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
56857 it doesn&#x2019;t seem to be working for you, check the following compile-time
56858 options:
56859 </para>
56860 <literallayout>
56861 <literal>EXIWHAT_PS_CMD    </literal> the command for running <emphasis>ps</emphasis>
56862 <literal>EXIWHAT_PS_ARG    </literal> the argument for <emphasis>ps</emphasis>
56863 <literal>EXIWHAT_EGREP_ARG </literal> the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output
56864 <literal>EXIWHAT_KILL_ARG  </literal> the argument for the <emphasis>kill</emphasis> command
56865 </literallayout>
56866 <para>
56867 An example of typical output from <emphasis>exiwhat</emphasis> is
56868 </para>
56869 <literallayout class="monospaced">
56870 164 daemon: -q1h, listening on port 25
56871 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
56872 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
56873   [10.19.42.42] (editor@ref.example)
56874 10592 handling incoming call from [192.168.243.242]
56875 10628 accepting a local non-SMTP message
56876 </literallayout>
56877 <para>
56878 The first number in the output line is the process number. The third line has
56879 been split here, in order to fit it on the page.
56880 </para>
56881 </section>
56882 <section id="SECTgreptheque">
56883 <title>Selective queue listing (exiqgrep)</title>
56884 <para>
56885 <indexterm role="concept">
56886 <primary><emphasis>exiqgrep</emphasis></primary>
56887 </indexterm>
56888 <indexterm role="concept">
56889 <primary>queue</primary>
56890 <secondary>grepping</secondary>
56891 </indexterm>
56892 This utility is a Perl script contributed by Matt Hubbard. It runs
56893 </para>
56894 <literallayout class="monospaced">
56895 exim -bpu
56896 </literallayout>
56897 <para>
56898 to obtain a queue listing with undelivered recipients only, and then greps the
56899 output to select messages that match given criteria. The following selection
56900 options are available:
56901 </para>
56902 <variablelist>
56903 <varlistentry>
56904 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
56905 <listitem>
56906 <para>
56907 Match the sender address. The field that is tested is enclosed in angle
56908 brackets, so you can test for bounce messages with
56909 </para>
56910 <literallayout class="monospaced">
56911 exiqgrep -f '^&lt;&gt;$'
56912 </literallayout>
56913 </listitem></varlistentry>
56914 <varlistentry>
56915 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
56916 <listitem>
56917 <para>
56918 Match a recipient address. The field that is tested is not enclosed in angle
56919 brackets.
56920 </para>
56921 </listitem></varlistentry>
56922 <varlistentry>
56923 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
56924 <listitem>
56925 <para>
56926 Match against the size field.
56927 </para>
56928 </listitem></varlistentry>
56929 <varlistentry>
56930 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
56931 <listitem>
56932 <para>
56933 Match messages that are younger than the given time.
56934 </para>
56935 </listitem></varlistentry>
56936 <varlistentry>
56937 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
56938 <listitem>
56939 <para>
56940 Match messages that are older than the given time.
56941 </para>
56942 </listitem></varlistentry>
56943 <varlistentry>
56944 <term><emphasis role="bold">-z</emphasis></term>
56945 <listitem>
56946 <para>
56947 Match only frozen messages.
56948 </para>
56949 </listitem></varlistentry>
56950 <varlistentry>
56951 <term><emphasis role="bold">-x</emphasis></term>
56952 <listitem>
56953 <para>
56954 Match only non-frozen messages.
56955 </para>
56956 </listitem></varlistentry>
56957 </variablelist>
56958 <para>
56959 The following options control the format of the output:
56960 </para>
56961 <variablelist>
56962 <varlistentry>
56963 <term><emphasis role="bold">-c</emphasis></term>
56964 <listitem>
56965 <para>
56966 Display only the count of matching messages.
56967 </para>
56968 </listitem></varlistentry>
56969 <varlistentry>
56970 <term><emphasis role="bold">-l</emphasis></term>
56971 <listitem>
56972 <para>
56973 Long format &ndash; display the full message information as output by Exim. This is
56974 the default.
56975 </para>
56976 </listitem></varlistentry>
56977 <varlistentry>
56978 <term><emphasis role="bold">-i</emphasis></term>
56979 <listitem>
56980 <para>
56981 Display message ids only.
56982 </para>
56983 </listitem></varlistentry>
56984 <varlistentry>
56985 <term><emphasis role="bold">-b</emphasis></term>
56986 <listitem>
56987 <para>
56988 Brief format &ndash; one line per message.
56989 </para>
56990 </listitem></varlistentry>
56991 <varlistentry>
56992 <term><emphasis role="bold">-R</emphasis></term>
56993 <listitem>
56994 <para>
56995 Display messages in reverse order.
56996 </para>
56997 </listitem></varlistentry>
56998 </variablelist>
56999 <para>
57000 There is one more option, <option>-h</option>, which outputs a list of options.
57001 </para>
57002 </section>
57003 <section id="SECTsumtheque">
57004 <title>Summarising the queue (exiqsumm)</title>
57005 <para>
57006 <indexterm role="concept">
57007 <primary><emphasis>exiqsumm</emphasis></primary>
57008 </indexterm>
57009 <indexterm role="concept">
57010 <primary>queue</primary>
57011 <secondary>summary</secondary>
57012 </indexterm>
57013 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
57014 -bp</literal> and produces a summary of the messages on the queue. Thus, you use it by
57015 running a command such as
57016 </para>
57017 <literallayout class="monospaced">
57018 exim -bp | exiqsumm
57019 </literallayout>
57020 <para>
57021 The output consists of one line for each domain that has messages waiting for
57022 it, as in the following example:
57023 </para>
57024 <literallayout class="monospaced">
57025 3   2322   74m   66m  msn.com.example
57026 </literallayout>
57027 <para>
57028 Each line lists the number of
57029 pending deliveries for a domain, their total volume, and the length of time
57030 that the oldest and the newest messages have been waiting. Note that the number
57031 of pending deliveries is greater than the number of messages when messages
57032 have more than one recipient.
57033 </para>
57034 <para>
57035 A summary line is output at the end. By default the output is sorted on the
57036 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
57037 the output to be sorted by oldest message and by count of messages,
57038 respectively.
57039 </para>
57040 <para>
57041 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
57042 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
57043 generated by aliasing or forwarding are included (unless the <option>one_time</option>
57044 option of the <command>redirect</command> router has been used to convert them into <quote>top
57045 level</quote> addresses).
57046 </para>
57047 </section>
57048 <section id="SECTextspeinf">
57049 <title>Extracting specific information from the log (exigrep)</title>
57050 <para>
57051 <indexterm role="concept">
57052 <primary><emphasis>exigrep</emphasis></primary>
57053 </indexterm>
57054 <indexterm role="concept">
57055 <primary>log</primary>
57056 <secondary>extracts; grepping for</secondary>
57057 </indexterm>
57058 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
57059 files for entries that match a given pattern. When it finds a match, it
57060 extracts all the log entries for the relevant message, not just those that
57061 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
57062 given message, or all mail for a given user, or for a given host, for example.
57063 The input files can be in Exim log format or syslog format.
57064 </para>
57065 <para>
57066 If a matching log line is not associated with a specific message, it is always
57067 included in <emphasis>exigrep</emphasis>&#x2019;s output. The usage is:
57068 </para>
57069 <literallayout>
57070 <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>
57071 </literallayout>
57072 <para>
57073 The <option>-t</option> argument specifies a number of seconds. It adds an additional
57074 condition for message selection. Messages that are complete are shown only if
57075 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds on the queue.
57076 </para>
57077 <para>
57078 The <option>-l</option> flag means <quote>literal</quote>, that is, treat all characters in the
57079 pattern as standing for themselves. Otherwise the pattern must be a Perl
57080 regular expression. The pattern match is case-insensitive. If no file names are
57081 given on the command line, the standard input is read.
57082 </para>
57083 <para>
57084 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
57085 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
57086 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
57087 </para>
57088 </section>
57089 <section id="SECTexipick">
57090 <title>Selecting messages by various criteria (exipick)</title>
57091 <para>
57092 <indexterm role="concept">
57093 <primary><emphasis>exipick</emphasis></primary>
57094 </indexterm>
57095 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
57096 lists messages from the queue according to a variety of criteria. For details,
57097 visit <emphasis role="bold"><ulink url="http://www.exim.org/eximwiki/ToolExipickManPage">http://www.exim.org/eximwiki/ToolExipickManPage</ulink></emphasis> or run:
57098 </para>
57099 <literallayout class="monospaced">
57100 exipick --help
57101 </literallayout>
57102 </section>
57103 <section id="SECTcyclogfil">
57104 <title>Cycling log files (exicyclog)</title>
57105 <para>
57106 <indexterm role="concept">
57107 <primary>log</primary>
57108 <secondary>cycling local files</secondary>
57109 </indexterm>
57110 <indexterm role="concept">
57111 <primary>cycling logs</primary>
57112 </indexterm>
57113 <indexterm role="concept">
57114 <primary><emphasis>exicyclog</emphasis></primary>
57115 </indexterm>
57116 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
57117 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
57118 you are using log files with datestamps in their names (see section
57119 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
57120 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
57121 There are two command line options for <emphasis>exicyclog</emphasis>:
57122 </para>
57123 <itemizedlist>
57124 <listitem>
57125 <para>
57126 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
57127 default that is set when Exim is built. The default default is 10.
57128 </para>
57129 </listitem>
57130 <listitem>
57131 <para>
57132 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
57133 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
57134 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
57135 configuration.
57136 </para>
57137 </listitem>
57138 </itemizedlist>
57139 <para>
57140 Each time <emphasis>exicyclog</emphasis> is run the file names get <quote>shuffled down</quote> by one. If
57141 the main log file name is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
57142 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
57143 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
57144 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
57145 logs are handled similarly.
57146 </para>
57147 <para>
57148 If the limit is greater than 99, the script uses 3-digit numbers such as
57149 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
57150 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
57151 any existing log files.
57152 </para>
57153 <para>
57154 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
57155 the end are deleted. All files with numbers greater than 01 are compressed,
57156 using a compression command which is configured by the COMPRESS_COMMAND
57157 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
57158 root <option>crontab</option> entry of the form
57159 </para>
57160 <literallayout class="monospaced">
57161 1 0 * * * su exim -c /usr/exim/bin/exicyclog
57162 </literallayout>
57163 <para>
57164 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
57165 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
57166 </para>
57167 </section>
57168 <section id="SECTmailstat">
57169 <title>Mail statistics (eximstats)</title>
57170 <para>
57171 <indexterm role="concept">
57172 <primary>statistics</primary>
57173 </indexterm>
57174 <indexterm role="concept">
57175 <primary><emphasis>eximstats</emphasis></primary>
57176 </indexterm>
57177 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
57178 information from log files. The output is either plain text, or HTML.
57179 Exim log files are also suported by the <emphasis>Lire</emphasis> system produced by the
57180 LogReport Foundation <emphasis role="bold"><ulink url="http://www.logreport.org">http://www.logreport.org</ulink></emphasis>.
57181 </para>
57182 <para>
57183 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
57184 latest version is the result of some extensive revision by Steve Campbell. A
57185 lot of information is given by default, but there are options for suppressing
57186 various parts of it. Following any options, the arguments to the script are a
57187 list of files, which should be main log files. For example:
57188 </para>
57189 <literallayout class="monospaced">
57190 eximstats -nr /var/spool/exim/log/mainlog.01
57191 </literallayout>
57192 <para>
57193 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
57194 messages received from or delivered to various hosts. The information is sorted
57195 both by message count and by volume, and the top fifty hosts in each category
57196 are listed on the standard output. Similar information, based on email
57197 addresses or domains instead of hosts can be requested by means of various
57198 options. For messages delivered and received locally, similar statistics are
57199 also produced per user.
57200 </para>
57201 <para>
57202 The output also includes total counts and statistics about delivery errors, and
57203 histograms showing the number of messages received and deliveries made in each
57204 hour of the day. A delivery with more than one address in its envelope (for
57205 example, an SMTP transaction with more than one RCPT command) is counted
57206 as a single delivery by <emphasis>eximstats</emphasis>.
57207 </para>
57208 <para>
57209 Though normally more deliveries than receipts are reported (as messages may
57210 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
57211 messages received than delivered, even though the queue is empty at the start
57212 and end of the period in question. If an incoming message contains no valid
57213 recipients, no deliveries are recorded for it. A bounce message is handled as
57214 an entirely separate message.
57215 </para>
57216 <para>
57217 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
57218 of messages received and deliveries made, and the number of hosts involved in
57219 each case. It also outputs the number of messages that were delayed (that is,
57220 not completely delivered at the first attempt), and the number that had at
57221 least one address that failed.
57222 </para>
57223 <para>
57224 The remainder of the output is in sections that can be independently disabled
57225 or modified by various options. It consists of a summary of deliveries by
57226 transport, histograms of messages received and delivered per time interval
57227 (default per hour), information about the time messages spent on the queue,
57228 a list of relayed messages, lists of the top fifty sending hosts, local
57229 senders, destination hosts, and destination local users by count and by volume,
57230 and a list of delivery errors that occurred.
57231 </para>
57232 <para>
57233 The relay information lists messages that were actually relayed, that is, they
57234 came from a remote host and were directly delivered to some other remote host,
57235 without being processed (for example, for aliasing or forwarding) locally.
57236 </para>
57237 <para>
57238 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
57239 outputs. These are documented in the Perl script itself, and can be extracted
57240 by running the command <command>perldoc</command> on the script. For example:
57241 </para>
57242 <literallayout class="monospaced">
57243 perldoc /usr/exim/bin/eximstats
57244 </literallayout>
57245 </section>
57246 <section id="SECTcheckaccess">
57247 <title>Checking access policy (exim_checkaccess)</title>
57248 <para>
57249 <indexterm role="concept">
57250 <primary><emphasis>exim_checkaccess</emphasis></primary>
57251 </indexterm>
57252 <indexterm role="concept">
57253 <primary>policy control</primary>
57254 <secondary>checking access</secondary>
57255 </indexterm>
57256 <indexterm role="concept">
57257 <primary>checking access</primary>
57258 </indexterm>
57259 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
57260 debugging output, in order to check what Exim is doing when it is applying
57261 policy controls to incoming SMTP mail. However, not everybody is sufficiently
57262 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
57263 sometimes you just want to answer the question <quote>Does this address have
57264 access?</quote> without bothering with any further details.
57265 </para>
57266 <para>
57267 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
57268 two arguments, an IP address and an email address:
57269 </para>
57270 <literallayout class="monospaced">
57271 exim_checkaccess 10.9.8.7 A.User@a.domain.example
57272 </literallayout>
57273 <para>
57274 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
57275 given email address would be accepted in a RCPT command in a TCP/IP
57276 connection from the host with the given IP address. The output of the utility
57277 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
57278 </para>
57279 <literallayout class="monospaced">
57280 Rejected:
57281 550 Relay not permitted
57282 </literallayout>
57283 <para>
57284 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
57285 for the MAIL command, but you can change this by providing additional
57286 options. These are passed directly to the Exim command. For example, to specify
57287 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
57288 you can use:
57289 </para>
57290 <literallayout class="monospaced">
57291 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
57292                  -f himself@there.example
57293 </literallayout>
57294 <para>
57295 Note that these additional Exim command line items must be given after the two
57296 mandatory arguments.
57297 </para>
57298 <para>
57299 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
57300 while running its checks. You can run checks that include callouts by using
57301 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
57302 </para>
57303 </section>
57304 <section id="SECTdbmbuild">
57305 <title>Making DBM files (exim_dbmbuild)</title>
57306 <para>
57307 <indexterm role="concept">
57308 <primary>DBM</primary>
57309 <secondary>building dbm files</secondary>
57310 </indexterm>
57311 <indexterm role="concept">
57312 <primary>building DBM files</primary>
57313 </indexterm>
57314 <indexterm role="concept">
57315 <primary><emphasis>exim_dbmbuild</emphasis></primary>
57316 </indexterm>
57317 <indexterm role="concept">
57318 <primary>lower casing</primary>
57319 </indexterm>
57320 <indexterm role="concept">
57321 <primary>binary zero</primary>
57322 <secondary>in lookup key</secondary>
57323 </indexterm>
57324 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
57325 the format used by the <command>lsearch</command> lookup (see section
57326 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
57327 names as keys and the remainder of the information as data. The lower-casing
57328 can be prevented by calling the program with the <option>-nolc</option> option.
57329 </para>
57330 <para>
57331 A terminating zero is included as part of the key string. This is expected by
57332 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
57333 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
57334 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
57335 files.
57336 </para>
57337 <para>
57338 The program requires two arguments: the name of the input file (which can be a
57339 single hyphen to indicate the standard input), and the name of the output file.
57340 It creates the output under a temporary name, and then renames it if all went
57341 well.
57342 </para>
57343 <para>
57344 <indexterm role="concept">
57345 <primary>USE_DB</primary>
57346 </indexterm>
57347 If the native DB interface is in use (USE_DB is set in a compile-time
57348 configuration file &ndash; this is common in free versions of Unix) the two file
57349 names must be different, because in this mode the Berkeley DB functions create
57350 a single output file using exactly the name given. For example,
57351 </para>
57352 <literallayout class="monospaced">
57353 exim_dbmbuild /etc/aliases /etc/aliases.db
57354 </literallayout>
57355 <para>
57356 reads the system alias file and creates a DBM version of it in
57357 <filename>/etc/aliases.db</filename>.
57358 </para>
57359 <para>
57360 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
57361 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
57362 environment, the suffixes are added to the second argument of
57363 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
57364 when the Berkeley functions are used in compatibility mode (though this is not
57365 recommended), because in that case it adds a <filename>.db</filename> suffix to the file name.
57366 </para>
57367 <para>
57368 If a duplicate key is encountered, the program outputs a warning, and when it
57369 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
57370 option is used. By default, only the first of a set of duplicates is used &ndash;
57371 this makes it compatible with <command>lsearch</command> lookups. There is an option
57372 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
57373 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
57374 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
57375 return code is 2.
57376 </para>
57377 </section>
57378 <section id="SECTfinindret">
57379 <title>Finding individual retry times (exinext)</title>
57380 <para>
57381 <indexterm role="concept">
57382 <primary>retry</primary>
57383 <secondary>times</secondary>
57384 </indexterm>
57385 <indexterm role="concept">
57386 <primary><emphasis>exinext</emphasis></primary>
57387 </indexterm>
57388 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
57389 fish specific information out of the retry database. Given a mail domain (or a
57390 complete address), it looks up the hosts for that domain, and outputs any retry
57391 information for the hosts or for the domain. At present, the retry information
57392 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
57393 output. For example:
57394 </para>
57395 <literallayout class="monospaced">
57396 $ exinext piglet@milne.fict.example
57397 kanga.milne.example:192.168.8.1 error 146: Connection refused
57398   first failed: 21-Feb-1996 14:57:34
57399   last tried:   21-Feb-1996 14:57:34
57400   next try at:  21-Feb-1996 15:02:34
57401 roo.milne.example:192.168.8.3 error 146: Connection refused
57402   first failed: 20-Jan-1996 13:12:08
57403   last tried:   21-Feb-1996 11:42:03
57404   next try at:  21-Feb-1996 19:42:03
57405   past final cutoff time
57406 </literallayout>
57407 <para>
57408 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
57409 will give any retry information for that local part in your default domain.
57410 A message id can be used to obtain retry information pertaining to a specific
57411 message. This exists only when an attempt to deliver a message to a remote host
57412 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
57413 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
57414 run very often.
57415 </para>
57416 <para>
57417 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
57418 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
57419 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
57420 configuration file, and the second sets macros for use within the configuration
57421 file. These features are mainly to help in testing, but might also be useful in
57422 environments where more than one configuration file is in use.
57423 </para>
57424 </section>
57425 <section id="SECThindatmai">
57426 <title>Hints database maintenance</title>
57427 <para>
57428 <indexterm role="concept">
57429 <primary>hints database</primary>
57430 <secondary>maintenance</secondary>
57431 </indexterm>
57432 <indexterm role="concept">
57433 <primary>maintaining Exim&#x2019;s hints database</primary>
57434 </indexterm>
57435 Three utility programs are provided for maintaining the DBM files that Exim
57436 uses to contain its delivery hint information. Each program requires two
57437 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
57438 second is the name of the database it is to operate on. These are as follows:
57439 </para>
57440 <itemizedlist>
57441 <listitem>
57442 <para>
57443 <emphasis>retry</emphasis>: the database of retry information
57444 </para>
57445 </listitem>
57446 <listitem>
57447 <para>
57448 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
57449 for remote hosts
57450 </para>
57451 </listitem>
57452 <listitem>
57453 <para>
57454 <emphasis>callout</emphasis>: the callout cache
57455 </para>
57456 </listitem>
57457 <listitem>
57458 <para>
57459 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
57460 </para>
57461 </listitem>
57462 <listitem>
57463 <para>
57464 <emphasis>misc</emphasis>: other hints data
57465 </para>
57466 </listitem>
57467 </itemizedlist>
57468 <para>
57469 The <emphasis>misc</emphasis> database is used for
57470 </para>
57471 <itemizedlist>
57472 <listitem>
57473 <para>
57474 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
57475 </para>
57476 </listitem>
57477 <listitem>
57478 <para>
57479 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
57480 <command>smtp</command> transport)
57481 </para>
57482 </listitem>
57483 </itemizedlist>
57484 </section>
57485 <section>
57486 <title>exim_dumpdb</title>
57487 <para>
57488 <indexterm role="concept">
57489 <primary><emphasis>exim_dumpdb</emphasis></primary>
57490 </indexterm>
57491 The entire contents of a database are written to the standard output by the
57492 <emphasis>exim_dumpdb</emphasis> program, which has no options or arguments other than the
57493 spool and database names. For example, to dump the retry database:
57494 </para>
57495 <literallayout class="monospaced">
57496 exim_dumpdb /var/spool/exim retry
57497 </literallayout>
57498 <para>
57499 Two lines of output are produced for each entry:
57500 </para>
57501 <literallayout class="monospaced">
57502 T:mail.ref.example:192.168.242.242 146 77 Connection refused
57503 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
57504 </literallayout>
57505 <para>
57506 The first item on the first line is the key of the record. It starts with one
57507 of the letters R, or T, depending on whether it refers to a routing or
57508 transport retry. For a local delivery, the next part is the local address; for
57509 a remote delivery it is the name of the remote host, followed by its failing IP
57510 address (unless <option>no_retry_include_ip_address</option> is set on the <command>smtp</command>
57511 transport). If the remote port is not the standard one (port 25), it is added
57512 to the IP address. Then there follows an error code, an additional error code,
57513 and a textual description of the error.
57514 </para>
57515 <para>
57516 The three times on the second line are the time of first failure, the time of
57517 the last delivery attempt, and the computed time for the next attempt. The line
57518 ends with an asterisk if the cutoff time for the last retry rule has been
57519 exceeded.
57520 </para>
57521 <para>
57522 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
57523 consists of a host name followed by a list of ids for messages that are or were
57524 waiting to be delivered to that host. If there are a very large number for any
57525 one host, continuation records, with a sequence number added to the host name,
57526 may be seen. The data in these records is often out of date, because a message
57527 may be routed to several alternative hosts, and Exim makes no effort to keep
57528 cross-references.
57529 </para>
57530 </section>
57531 <section>
57532 <title>exim_tidydb</title>
57533 <para>
57534 <indexterm role="concept">
57535 <primary><emphasis>exim_tidydb</emphasis></primary>
57536 </indexterm>
57537 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
57538 database. If run with no options, it removes all records that are more than 30
57539 days old. The age is calculated from the date and time that the record was last
57540 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
57541 since the first delivery failure. Information about a host that has been down
57542 for more than 30 days will remain in the database, provided that the record is
57543 updated sufficiently often.
57544 </para>
57545 <para>
57546 The cutoff date can be altered by means of the <option>-t</option> option, which must be
57547 followed by a time. For example, to remove all records older than a week from
57548 the retry database:
57549 </para>
57550 <literallayout class="monospaced">
57551 exim_tidydb -t 7d /var/spool/exim retry
57552 </literallayout>
57553 <para>
57554 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
57555 message ids. In the former these appear as data in records keyed by host &ndash;
57556 they were messages that were waiting for that host &ndash; and in the latter they
57557 are the keys for retry information for messages that have suffered certain
57558 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
57559 message ids in database records are those of messages that are still on the
57560 queue. Message ids for messages that no longer exist are removed from
57561 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
57562 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
57563 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
57564 whenever it removes information from the database.
57565 </para>
57566 <para>
57567 Certain records are automatically removed by Exim when they are no longer
57568 needed, but others are not. For example, if all the MX hosts for a domain are
57569 down, a retry record is created for each one. If the primary MX host comes back
57570 first, its record is removed when Exim successfully delivers to it, but the
57571 records for the others remain because Exim has not tried to use those hosts.
57572 </para>
57573 <para>
57574 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
57575 hints databases. You should do this at a quiet time of day, because it requires
57576 a database to be locked (and therefore inaccessible to Exim) while it does its
57577 work. Removing records from a DBM file does not normally make the file smaller,
57578 but all the common DBM libraries are able to re-use the space that is released.
57579 After an initial phase of increasing in size, the databases normally reach a
57580 point at which they no longer get any bigger, as long as they are regularly
57581 tidied.
57582 </para>
57583 <para>
57584 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
57585 databases is likely to keep on increasing.
57586 </para>
57587 </section>
57588 <section>
57589 <title>exim_fixdb</title>
57590 <para>
57591 <indexterm role="concept">
57592 <primary><emphasis>exim_fixdb</emphasis></primary>
57593 </indexterm>
57594 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
57595 Its main use is for testing Exim, but it might also be occasionally useful for
57596 getting round problems in a live system. It has no options, and its interface
57597 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
57598 key of a database record can then be entered, and the data for that record is
57599 displayed.
57600 </para>
57601 <para>
57602 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
57603 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
57604 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
57605 data for individual fields can be changed by typing the field number followed
57606 by new data, for example:
57607 </para>
57608 <literallayout class="monospaced">
57609 &gt; 4 951102:1000
57610 </literallayout>
57611 <para>
57612 resets the time of the next delivery attempt. Time values are given as a
57613 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
57614 used as optional separators.
57615 </para>
57616 </section>
57617 <section id="SECTmailboxmaint">
57618 <title>Mailbox maintenance (exim_lock)</title>
57619 <para>
57620 <indexterm role="concept">
57621 <primary>mailbox</primary>
57622 <secondary>maintenance</secondary>
57623 </indexterm>
57624 <indexterm role="concept">
57625 <primary><emphasis>exim_lock</emphasis></primary>
57626 </indexterm>
57627 <indexterm role="concept">
57628 <primary>locking mailboxes</primary>
57629 </indexterm>
57630 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
57631 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
57632 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
57633 a user agent while investigating a problem. The utility requires the name of
57634 the file as its first argument. If the locking is successful, the second
57635 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
57636 second argument, the value of the SHELL environment variable is used; if this
57637 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
57638 is unlocked and the utility ends. The following options are available:
57639 </para>
57640 <variablelist>
57641 <varlistentry>
57642 <term><option>-fcntl</option></term>
57643 <listitem>
57644 <para>
57645 Use <function>fcntl()</function> locking on the open mailbox.
57646 </para>
57647 </listitem></varlistentry>
57648 <varlistentry>
57649 <term><option>-flock</option></term>
57650 <listitem>
57651 <para>
57652 Use <function>flock()</function> locking on the open mailbox, provided the operating system
57653 supports it.
57654 </para>
57655 </listitem></varlistentry>
57656 <varlistentry>
57657 <term><option>-interval</option></term>
57658 <listitem>
57659 <para>
57660 This must be followed by a number, which is a number of seconds; it sets the
57661 interval to sleep between retries (default 3).
57662 </para>
57663 </listitem></varlistentry>
57664 <varlistentry>
57665 <term><option>-lockfile</option></term>
57666 <listitem>
57667 <para>
57668 Create a lock file before opening the mailbox.
57669 </para>
57670 </listitem></varlistentry>
57671 <varlistentry>
57672 <term><option>-mbx</option></term>
57673 <listitem>
57674 <para>
57675 Lock the mailbox using MBX rules.
57676 </para>
57677 </listitem></varlistentry>
57678 <varlistentry>
57679 <term><option>-q</option></term>
57680 <listitem>
57681 <para>
57682 Suppress verification output.
57683 </para>
57684 </listitem></varlistentry>
57685 <varlistentry>
57686 <term><option>-retries</option></term>
57687 <listitem>
57688 <para>
57689 This must be followed by a number; it sets the number of times to try to get
57690 the lock (default 10).
57691 </para>
57692 </listitem></varlistentry>
57693 <varlistentry>
57694 <term><option>-restore_time</option></term>
57695 <listitem>
57696 <para>
57697 This option causes <option>exim_lock</option> to restore the modified and read times to the
57698 locked file before exiting. This allows you to access a locked mailbox (for
57699 example, to take a backup copy) without disturbing the times that the user
57700 subsequently sees.
57701 </para>
57702 </listitem></varlistentry>
57703 <varlistentry>
57704 <term><option>-timeout</option></term>
57705 <listitem>
57706 <para>
57707 This must be followed by a number, which is a number of seconds; it sets a
57708 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
57709 default), a non-blocking call is used.
57710 </para>
57711 </listitem></varlistentry>
57712 <varlistentry>
57713 <term><option>-v</option></term>
57714 <listitem>
57715 <para>
57716 Generate verbose output.
57717 </para>
57718 </listitem></varlistentry>
57719 </variablelist>
57720 <para>
57721 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
57722 default is to create a lock file and also to use <function>fcntl()</function> locking on the
57723 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
57724 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
57725 requires that the directory containing the file be writeable. Locking by lock
57726 file does not last for ever; Exim assumes that a lock file is expired if it is
57727 more than 30 minutes old.
57728 </para>
57729 <para>
57730 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
57731 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
57732 to be taken out on the open mailbox, and an exclusive lock on the file
57733 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
57734 number of the mailbox file. When the locking is released, if an exclusive lock
57735 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
57736 </para>
57737 <para>
57738 The default output contains verification of the locking that takes place. The
57739 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
57740 suppresses all output except error messages.
57741 </para>
57742 <para>
57743 A command such as
57744 </para>
57745 <literallayout class="monospaced">
57746 exim_lock /var/spool/mail/spqr
57747 </literallayout>
57748 <para>
57749 runs an interactive shell while the file is locked, whereas
57750 </para>
57751 <literallayout>
57752 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
57753 &lt;<emphasis>some commands</emphasis>&gt;
57754 <literal>End</literal>
57755 </literallayout>
57756 <para>
57757 runs a specific non-interactive sequence of commands while the file is locked,
57758 suppressing all verification output. A single command can be run by a command
57759 such as
57760 </para>
57761 <literallayout class="monospaced">
57762 exim_lock -q /var/spool/mail/spqr \
57763   "cp /var/spool/mail/spqr /some/where"
57764 </literallayout>
57765 <para>
57766 Note that if a command is supplied, it must be entirely contained within the
57767 second argument &ndash; hence the quotes.
57768 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
57769 </para>
57770 </section>
57771 </chapter>
57772
57773 <chapter id="CHAPeximon">
57774 <title>The Exim monitor</title>
57775 <para>
57776 <indexterm role="concept" id="IIDeximon" class="startofrange">
57777 <primary>Exim monitor</primary>
57778 <secondary>description</secondary>
57779 </indexterm>
57780 <indexterm role="concept">
57781 <primary>X-windows</primary>
57782 </indexterm>
57783 <indexterm role="concept">
57784 <primary><emphasis>eximon</emphasis></primary>
57785 </indexterm>
57786 <indexterm role="concept">
57787 <primary>Local/eximon.conf</primary>
57788 </indexterm>
57789 <indexterm role="concept">
57790 <primary>_exim_monitor/EDITME_</primary>
57791 </indexterm>
57792 The Exim monitor is an application which displays in an X window information
57793 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
57794 perform certain operations on messages from this GUI interface; however all
57795 such facilities are also available from the command line, and indeed, the
57796 monitor itself makes use of the command line to perform any actions requested.
57797 </para>
57798 <section>
57799 <title>Running the monitor</title>
57800 <para>
57801 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
57802 script that sets up a number of environment variables, and then runs the
57803 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
57804 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
57805 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
57806 parameters are for.
57807 </para>
57808 <para>
57809 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
57810 a particular invocation by setting up environment variables of the same names,
57811 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
57812 </para>
57813 <literallayout class="monospaced">
57814 EXIMON_LOG_DEPTH=400 eximon
57815 </literallayout>
57816 <para>
57817 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
57818 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
57819 overrides the Exim log file configuration. This makes it possible to have
57820 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
57821 syslog messages are routed to a file on the local host.
57822 </para>
57823 <para>
57824 X resources can be used to change the appearance of the window in the normal
57825 way. For example, a resource setting of the form
57826 </para>
57827 <literallayout class="monospaced">
57828 Eximon*background: gray94
57829 </literallayout>
57830 <para>
57831 changes the colour of the background to light grey rather than white. The
57832 stripcharts are drawn with both the data lines and the reference lines in
57833 black. This means that the reference lines are not visible when on top of the
57834 data. However, their colour can be changed by setting a resource called
57835 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
57836 For example, if your X server is running Unix, you could set up lighter
57837 reference lines in the stripcharts by obeying
57838 </para>
57839 <literallayout class="monospaced">
57840 xrdb -merge &lt;&lt;End
57841 Eximon*highlight: gray
57842 End
57843 </literallayout>
57844 <para>
57845 <indexterm role="concept">
57846 <primary>admin user</primary>
57847 </indexterm>
57848 In order to see the contents of messages on the queue, and to operate on them,
57849 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
57850 </para>
57851 <para>
57852 The monitor&#x2019;s window is divided into three parts. The first contains one or
57853 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
57854 main log file, and the third is a display of the queue of messages awaiting
57855 delivery, with two more action buttons. The following sections describe these
57856 different parts of the display.
57857 </para>
57858 </section>
57859 <section>
57860 <title>The stripcharts</title>
57861 <para>
57862 <indexterm role="concept">
57863 <primary>stripchart</primary>
57864 </indexterm>
57865 The first stripchart is always a count of messages on the queue. Its name can
57866 be configured by setting QUEUE_STRIPCHART_NAME in the
57867 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
57868 configuration script by regular expression matches on log file entries, making
57869 it possible to display, for example, counts of messages delivered to certain
57870 hosts or using certain transports. The supplied defaults display counts of
57871 received and delivered messages, and of local and SMTP deliveries. The default
57872 period between stripchart updates is one minute; this can be adjusted by a
57873 parameter in the <filename>Local/eximon.conf</filename> file.
57874 </para>
57875 <para>
57876 The stripchart displays rescale themselves automatically as the value they are
57877 displaying changes. There are always 10 horizontal lines in each chart; the
57878 title string indicates the value of each division when it is greater than one.
57879 For example, <quote>x2</quote> means that each division represents a value of 2.
57880 </para>
57881 <para>
57882 It is also possible to have a stripchart which shows the percentage fullness of
57883 a particular disk partition, which is useful when local deliveries are confined
57884 to a single partition.
57885 </para>
57886 <para>
57887 <indexterm role="concept">
57888 <primary><option>statvfs</option> function</primary>
57889 </indexterm>
57890 This relies on the availability of the <function>statvfs()</function> function or equivalent in
57891 the operating system. Most, but not all versions of Unix that support Exim have
57892 this. For this particular stripchart, the top of the chart always represents
57893 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
57894 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
57895 <filename>Local/eximon.conf</filename> file.
57896 </para>
57897 </section>
57898 <section>
57899 <title>Main action buttons</title>
57900 <para>
57901 <indexterm role="concept">
57902 <primary>size</primary>
57903 <secondary>of monitor window</secondary>
57904 </indexterm>
57905 <indexterm role="concept">
57906 <primary>Exim monitor</primary>
57907 <secondary>window size</secondary>
57908 </indexterm>
57909 <indexterm role="concept">
57910 <primary>window size</primary>
57911 </indexterm>
57912 Below the stripcharts there is an action button for quitting the monitor. Next
57913 to this is another button marked <quote>Size</quote>. They are placed here so that
57914 shrinking the window to its default minimum size leaves just the queue count
57915 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
57916 the window to expand to its maximum size, unless it is already at the maximum,
57917 in which case it is reduced to its minimum.
57918 </para>
57919 <para>
57920 When expanding to the maximum, if the window cannot be fully seen where it
57921 currently is, it is moved back to where it was the last time it was at full
57922 size. When it is expanding from its minimum size, the old position is
57923 remembered, and next time it is reduced to the minimum it is moved back there.
57924 </para>
57925 <para>
57926 The idea is that you can keep a reduced window just showing one or two
57927 stripcharts at a convenient place on your screen, easily expand it to show
57928 the full window when required, and just as easily put it back to what it was.
57929 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
57930 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
57931 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
57932 </para>
57933 <para>
57934 Normally, the monitor starts up with the window at its full size, but it can be
57935 built so that it starts up with the window at its smallest size, by setting
57936 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
57937 </para>
57938 </section>
57939 <section>
57940 <title>The log display</title>
57941 <para>
57942 <indexterm role="concept">
57943 <primary>log</primary>
57944 <secondary>tail of; in monitor</secondary>
57945 </indexterm>
57946 The second section of the window is an area in which a display of the tail of
57947 the main log is maintained.
57948 To save space on the screen, the timestamp on each log line is shortened by
57949 removing the date and, if <option>log_timezone</option> is set, the timezone.
57950 The log tail is not available when the only destination for logging data is
57951 syslog, unless the syslog lines are routed to a local file whose name is passed
57952 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
57953 </para>
57954 <para>
57955 The log sub-window has a scroll bar at its lefthand side which can be used to
57956 move back to look at earlier text, and the up and down arrow keys also have a
57957 scrolling effect. The amount of log that is kept depends on the setting of
57958 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
57959 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
57960 much more efficient than throwing it away line by line. The sub-window also has
57961 a horizontal scroll bar for accessing the ends of long log lines. This is the
57962 only means of horizontal scrolling; the right and left arrow keys are not
57963 available. Text can be cut from this part of the window using the mouse in the
57964 normal way. The size of this subwindow is controlled by parameters in the
57965 configuration file <filename>Local/eximon.conf</filename>.
57966 </para>
57967 <para>
57968 Searches of the text in the log window can be carried out by means of the ^R
57969 and ^S keystrokes, which default to a reverse and a forward search,
57970 respectively. The search covers only the text that is displayed in the window.
57971 It cannot go further back up the log.
57972 </para>
57973 <para>
57974 The point from which the search starts is indicated by a caret marker. This is
57975 normally at the end of the text in the window, but can be positioned explicitly
57976 by pointing and clicking with the left mouse button, and is moved automatically
57977 by a successful search. If new text arrives in the window when it is scrolled
57978 back, the caret remains where it is, but if the window is not scrolled back,
57979 the caret is moved to the end of the new text.
57980 </para>
57981 <para>
57982 Pressing ^R or ^S pops up a window into which the search text can be typed.
57983 There are buttons for selecting forward or reverse searching, for carrying out
57984 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
57985 happens and the window remains so that further searches can be done. If the
57986 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
57987 ^C is typed the search is cancelled.
57988 </para>
57989 <para>
57990 The searching facility is implemented using the facilities of the Athena text
57991 widget. By default this pops up a window containing both <quote>search</quote> and
57992 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
57993 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
57994 However, the linkers in BSDI and HP-UX seem unable to handle an externally
57995 provided version of <option>TextPop</option> when the remaining parts of the text widget
57996 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
57997 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
57998 on these systems, at the expense of having unwanted items in the search popup
57999 window.
58000 </para>
58001 </section>
58002 <section>
58003 <title>The queue display</title>
58004 <para>
58005 <indexterm role="concept">
58006 <primary>queue</primary>
58007 <secondary>display in monitor</secondary>
58008 </indexterm>
58009 The bottom section of the monitor window contains a list of all messages that
58010 are on the queue, which includes those currently being received or delivered,
58011 as well as those awaiting delivery. The size of this subwindow is controlled by
58012 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
58013 at which it is updated is controlled by another parameter in the same file &ndash;
58014 the default is 5 minutes, since queue scans can be quite expensive. However,
58015 there is an <quote>Update</quote> action button just above the display which can be used
58016 to force an update of the queue display at any time.
58017 </para>
58018 <para>
58019 When a host is down for some time, a lot of pending mail can build up for it,
58020 and this can make it hard to deal with other messages on the queue. To help
58021 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
58022 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
58023 type anything in here and press <quote>Return</quote>, the text is added to a chain of
58024 such texts, and if every undelivered address in a message matches at least one
58025 of the texts, the message is not displayed.
58026 </para>
58027 <para>
58028 If there is an address that does not match any of the texts, all the addresses
58029 are displayed as normal. The matching happens on the ends of addresses so, for
58030 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
58031 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
58032 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
58033 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
58034 a hide request is automatically cancelled after one hour.
58035 </para>
58036 <para>
58037 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
58038 else to the monitor window. For this reason, if you want to cut text from the
58039 queue display to use in the dialogue box, you have to do the cutting before
58040 pressing the <quote>Hide</quote> button.
58041 </para>
58042 <para>
58043 The queue display contains, for each unhidden queued message, the length of
58044 time it has been on the queue, the size of the message, the message id, the
58045 message sender, and the first undelivered recipient, all on one line. If it is
58046 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
58047 recipient to which the message has not yet been delivered, subsequent ones are
58048 listed on additional lines, up to a maximum configured number, following which
58049 an ellipsis is displayed. Recipients that have already received the message are
58050 not shown.
58051 </para>
58052 <para>
58053 <indexterm role="concept">
58054 <primary>frozen messages</primary>
58055 <secondary>display</secondary>
58056 </indexterm>
58057 If a message is frozen, an asterisk is displayed at the left-hand side.
58058 </para>
58059 <para>
58060 The queue display has a vertical scroll bar, and can also be scrolled by means
58061 of the arrow keys. Text can be cut from it using the mouse in the normal way.
58062 The text searching facilities, as described above for the log window, are also
58063 available, but the caret is always moved to the end of the text when the queue
58064 display is updated.
58065 </para>
58066 </section>
58067 <section>
58068 <title>The queue menu</title>
58069 <para>
58070 <indexterm role="concept">
58071 <primary>queue</primary>
58072 <secondary>menu in monitor</secondary>
58073 </indexterm>
58074 If the <option>shift</option> key is held down and the left button is clicked when the mouse
58075 pointer is over the text for any message, an action menu pops up, and the first
58076 line of the queue display for the message is highlighted. This does not affect
58077 any selected text.
58078 </para>
58079 <para>
58080 If you want to use some other event for popping up the menu, you can set the
58081 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
58082 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
58083 value set in this parameter is a standard X event description. For example, to
58084 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
58085 </para>
58086 <literallayout class="monospaced">
58087 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
58088 </literallayout>
58089 <para>
58090 The title of the menu is the message id, and it contains entries which act as
58091 follows:
58092 </para>
58093 <itemizedlist>
58094 <listitem>
58095 <para>
58096 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
58097 in a new text window.
58098 </para>
58099 </listitem>
58100 <listitem>
58101 <para>
58102 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
58103 information and headers is displayed in a new text window. See chapter
58104 <xref linkend="CHAPspool"/> for a description of the format of spool files.
58105 </para>
58106 </listitem>
58107 <listitem>
58108 <para>
58109 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
58110 displayed in a new text window. There is a default limit of 20,000 bytes to the
58111 amount of data displayed. This can be changed by setting the BODY_MAX
58112 option at compile time, or the EXIMON_BODY_MAX option at run time.
58113 </para>
58114 </listitem>
58115 <listitem>
58116 <para>
58117 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
58118 delivery of the message. This causes an automatic thaw if the message is
58119 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
58120 a new text window. The delivery is run in a separate process, to avoid holding
58121 up the monitor while the delivery proceeds.
58122 </para>
58123 </listitem>
58124 <listitem>
58125 <para>
58126 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
58127 that the message be frozen.
58128 </para>
58129 </listitem>
58130 <listitem>
58131 <para>
58132 <indexterm role="concept">
58133 <primary>thawing messages</primary>
58134 </indexterm>
58135 <indexterm role="concept">
58136 <primary>unfreezing messages</primary>
58137 </indexterm>
58138 <indexterm role="concept">
58139 <primary>frozen messages</primary>
58140 <secondary>thawing</secondary>
58141 </indexterm>
58142 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
58143 that the message be thawed.
58144 </para>
58145 </listitem>
58146 <listitem>
58147 <para>
58148 <indexterm role="concept">
58149 <primary>delivery</primary>
58150 <secondary>forcing failure</secondary>
58151 </indexterm>
58152 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
58153 that Exim gives up trying to deliver the message. A bounce message is generated
58154 for any remaining undelivered addresses.
58155 </para>
58156 </listitem>
58157 <listitem>
58158 <para>
58159 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
58160 that the message be deleted from the system without generating a bounce
58161 message.
58162 </para>
58163 </listitem>
58164 <listitem>
58165 <para>
58166 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
58167 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58168 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58169 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58170 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
58171 additional recipient be added to the message, unless the entry box is empty, in
58172 which case no action is taken.
58173 </para>
58174 </listitem>
58175 <listitem>
58176 <para>
58177 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
58178 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
58179 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
58180 Otherwise it must be entered as a fully qualified address. Pressing RETURN
58181 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
58182 recipient address as already delivered, unless the entry box is empty, in which
58183 case no action is taken.
58184 </para>
58185 </listitem>
58186 <listitem>
58187 <para>
58188 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
58189 mark all recipient addresses as already delivered.
58190 </para>
58191 </listitem>
58192 <listitem>
58193 <para>
58194 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
58195 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
58196 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
58197 in which case no action is taken. If you want to set an empty sender (as in
58198 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
58199 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
58200 the address is qualified with that domain.
58201 </para>
58202 </listitem>
58203 </itemizedlist>
58204 <para>
58205 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
58206 other cases when a call to Exim is made, if there is any output from Exim (in
58207 particular, if the command fails) a window containing the command and the
58208 output is displayed. Otherwise, the results of the action are normally apparent
58209 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
58210 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
58211 if no output is generated.
58212 </para>
58213 <para>
58214 The queue display is automatically updated for actions such as freezing and
58215 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
58216 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
58217 force an update of the display after one of these actions.
58218 </para>
58219 <para>
58220 In any text window that is displayed as result of a menu action, the normal
58221 cut-and-paste facility is available, and searching can be carried out using ^R
58222 and ^S, as described above for the log tail window.
58223 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
58224 </para>
58225 </section>
58226 </chapter>
58227
58228 <chapter id="CHAPsecurity">
58229 <title>Security considerations</title>
58230 <para>
58231 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
58232 <primary>security</primary>
58233 <secondary>discussion of</secondary>
58234 </indexterm>
58235 This chapter discusses a number of issues concerned with security, some of
58236 which are also covered in other parts of this manual.
58237 </para>
58238 <para>
58239 For reasons that this author does not understand, some people have promoted
58240 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
58241 existence of this chapter in the documentation. However, the intent of the
58242 chapter is simply to describe the way Exim works in relation to certain
58243 security concerns, not to make any specific claims about the effectiveness of
58244 its security as compared with other MTAs.
58245 </para>
58246 <para>
58247 What follows is a description of the way Exim is supposed to be. Best efforts
58248 have been made to try to ensure that the code agrees with the theory, but an
58249 absence of bugs can never be guaranteed. Any that are reported will get fixed
58250 as soon as possible.
58251 </para>
58252 <section>
58253 <title>Building a more <quote>hardened</quote> Exim</title>
58254 <para>
58255 <indexterm role="concept">
58256 <primary>security</primary>
58257 <secondary>build-time features</secondary>
58258 </indexterm>
58259 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
58260 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
58261 Exim administrator who does not have the root password, or by someone who has
58262 penetrated the Exim (but not the root) account. These options are as follows:
58263 </para>
58264 <itemizedlist>
58265 <listitem>
58266 <para>
58267 ALT_CONFIG_PREFIX can be set to a string that is required to match the
58268 start of any file names used with the <option>-C</option> option. When it is set, these file
58269 names are also not allowed to contain the sequence <quote>/../</quote>. (However, if the
58270 value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
58271 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
58272 default setting for <option>ALT_CONFIG_PREFIX</option>.
58273 </para>
58274 <para>
58275 If the permitted configuration files are confined to a directory to
58276 which only root has access, this guards against someone who has broken
58277 into the Exim account from running a privileged Exim with an arbitrary
58278 configuration file, and using it to break into other accounts.
58279 </para>
58280 </listitem>
58281 <listitem>
58282 <para>
58283 If ALT_CONFIG_ROOT_ONLY is defined, root privilege is retained for <option>-C</option>
58284 and <option>-D</option> only if the caller of Exim is root. Without it, the Exim user may
58285 also use <option>-C</option> and <option>-D</option> and retain privilege. Setting this option locks out
58286 the possibility of testing a configuration using <option>-C</option> right through message
58287 reception and delivery, even if the caller is root. The reception works, but by
58288 that time, Exim is running as the Exim user, so when it re-execs to regain
58289 privilege for the delivery, the use of <option>-C</option> causes privilege to be lost.
58290 However, root can test reception and delivery using two separate commands.
58291 ALT_CONFIG_ROOT_ONLY is not set by default.
58292 </para>
58293 </listitem>
58294 <listitem>
58295 <para>
58296 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
58297 is disabled.
58298 </para>
58299 </listitem>
58300 <listitem>
58301 <para>
58302 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
58303 never to be used for any deliveries. This is like the <option>never_users</option> runtime
58304 option, but it cannot be overridden; the runtime option adds additional users
58305 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
58306 is permitted to modify the runtime file from using Exim as a way to get root.
58307 </para>
58308 </listitem>
58309 </itemizedlist>
58310 </section>
58311 <section>
58312 <title>Root privilege</title>
58313 <para>
58314 <indexterm role="concept">
58315 <primary>setuid</primary>
58316 </indexterm>
58317 <indexterm role="concept">
58318 <primary>root privilege</primary>
58319 </indexterm>
58320 The Exim binary is normally setuid to root, which means that it gains root
58321 privilege (runs as root) when it starts execution. In some special cases (for
58322 example, when the daemon is not in use and there are no local deliveries), it
58323 may be possible to run Exim setuid to some user other than root. This is
58324 discussed in the next section. However, in most installations, root privilege
58325 is required for two things:
58326 </para>
58327 <itemizedlist>
58328 <listitem>
58329 <para>
58330 To set up a socket connected to the standard SMTP port (25) when initialising
58331 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
58332 not required.
58333 </para>
58334 </listitem>
58335 <listitem>
58336 <para>
58337 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
58338 perform local deliveries as the receiving user or as specified in the
58339 configuration.
58340 </para>
58341 </listitem>
58342 </itemizedlist>
58343 <para>
58344 It is not necessary to be root to do any of the other things Exim does, such as
58345 receiving messages and delivering them externally over SMTP, and it is
58346 obviously more secure if Exim does not run as root except when necessary.
58347 For this reason, a user and group for Exim to use must be defined in
58348 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
58349 group</quote>. Their values can be changed by the run time configuration, though this
58350 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
58351 <emphasis>mail</emphasis> or another user name altogether.
58352 </para>
58353 <para>
58354 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
58355 abdication; the process cannot regain root afterwards. Prior to release 4.00,
58356 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
58357 </para>
58358 <para>
58359 After a new Exim process has interpreted its command line options, it changes
58360 uid and gid in the following cases:
58361 </para>
58362 <itemizedlist>
58363 <listitem>
58364 <para>
58365 <indexterm role="concept">
58366 <primary><option>-C</option> option</primary>
58367 </indexterm>
58368 <indexterm role="concept">
58369 <primary><option>-D</option> option</primary>
58370 </indexterm>
58371 If the <option>-C</option> option is used to specify an alternate configuration file, or if
58372 the <option>-D</option> option is used to define macro values for the configuration, and the
58373 calling process is not running as root or the Exim user, the uid and gid are
58374 changed to those of the calling process.
58375 However, if ALT_CONFIG_ROOT_ONLY is defined in <filename>Local/Makefile</filename>, only
58376 root callers may use <option>-C</option> and <option>-D</option> without losing privilege, and if
58377 DISABLE_D_OPTION is set, the <option>-D</option> option may not be used at all.
58378 </para>
58379 </listitem>
58380 <listitem>
58381 <para>
58382 <indexterm role="concept">
58383 <primary><option>-be</option> option</primary>
58384 </indexterm>
58385 <indexterm role="concept">
58386 <primary><option>-bf</option> option</primary>
58387 </indexterm>
58388 <indexterm role="concept">
58389 <primary><option>-bF</option> option</primary>
58390 </indexterm>
58391 If the expansion test option (<option>-be</option>) or one of the filter testing options
58392 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
58393 calling process.
58394 </para>
58395 </listitem>
58396 <listitem>
58397 <para>
58398 If the process is not a daemon process or a queue runner process or a delivery
58399 process or a process for testing address routing (started with <option>-bt</option>), the
58400 uid and gid are changed to the Exim user and group. This means that Exim always
58401 runs under its own uid and gid when receiving messages. This also applies when
58402 testing address verification
58403 <indexterm role="concept">
58404 <primary><option>-bv</option> option</primary>
58405 </indexterm>
58406 <indexterm role="concept">
58407 <primary><option>-bh</option> option</primary>
58408 </indexterm>
58409 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
58410 option).
58411 </para>
58412 </listitem>
58413 <listitem>
58414 <para>
58415 For a daemon, queue runner, delivery, or address testing process, the uid
58416 remains as root at this stage, but the gid is changed to the Exim group.
58417 </para>
58418 </listitem>
58419 </itemizedlist>
58420 <para>
58421 The processes that initially retain root privilege behave as follows:
58422 </para>
58423 <itemizedlist>
58424 <listitem>
58425 <para>
58426 A daemon process changes the gid to the Exim group and the uid to the Exim
58427 user after setting up one or more listening sockets. The <function>initgroups()</function>
58428 function is called, so that if the Exim user is in any additional groups, they
58429 will be used during message reception.
58430 </para>
58431 </listitem>
58432 <listitem>
58433 <para>
58434 A queue runner process retains root privilege throughout its execution. Its
58435 job is to fork a controlled sequence of delivery processes.
58436 </para>
58437 </listitem>
58438 <listitem>
58439 <para>
58440 A delivery process retains root privilege throughout most of its execution,
58441 but any actual deliveries (that is, the transports themselves) are run in
58442 subprocesses which always change to a non-root uid and gid. For local
58443 deliveries this is typically the uid and gid of the owner of the mailbox; for
58444 remote deliveries, the Exim uid and gid are used. Once all the delivery
58445 subprocesses have been run, a delivery process changes to the Exim uid and gid
58446 while doing post-delivery tidying up such as updating the retry database and
58447 generating bounce and warning messages.
58448 </para>
58449 <para>
58450 While the recipient addresses in a message are being routed, the delivery
58451 process runs as root. However, if a user&#x2019;s filter file has to be processed,
58452 this is done in a subprocess that runs under the individual user&#x2019;s uid and
58453 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
58454 </para>
58455 </listitem>
58456 <listitem>
58457 <para>
58458 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
58459 the routing is done in the same environment as a message delivery.
58460 </para>
58461 </listitem>
58462 </itemizedlist>
58463 </section>
58464 <section id="SECTrunexiwitpri">
58465 <title>Running Exim without privilege</title>
58466 <para>
58467 <indexterm role="concept">
58468 <primary>privilege</primary>
58469 <secondary>running without</secondary>
58470 </indexterm>
58471 <indexterm role="concept">
58472 <primary>unprivileged running</primary>
58473 </indexterm>
58474 <indexterm role="concept">
58475 <primary>root privilege</primary>
58476 <secondary>running without</secondary>
58477 </indexterm>
58478 Some installations like to run Exim in an unprivileged state for more of its
58479 operation, for added security. Support for this mode of operation is provided
58480 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
58481 gid are changed to the Exim user and group at the start of a delivery process
58482 (and also queue runner and address testing processes). This means that address
58483 routing is no longer run as root, and the deliveries themselves cannot change
58484 to any other uid.
58485 </para>
58486 <para>
58487 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
58488 that the daemon can still be started in the usual way, and it can respond
58489 correctly to SIGHUP because the re-invocation regains root privilege.
58490 </para>
58491 <para>
58492 An alternative approach is to make Exim setuid to the Exim user and also setgid
58493 to the Exim group.
58494 If you do this, the daemon must be started from a root process. (Calling
58495 Exim from a root process makes it behave in the way it does when it is setuid
58496 root.) However, the daemon cannot restart itself after a SIGHUP signal because
58497 it cannot regain privilege.
58498 </para>
58499 <para>
58500 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
58501 stops Exim from trying to re-invoke itself to do a delivery after a message has
58502 been received. Such a re-invocation is a waste of resources because it has no
58503 effect.
58504 </para>
58505 <para>
58506 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
58507 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
58508 to the Exim user seems a clean approach, but there is one complication:
58509 </para>
58510 <para>
58511 In this style of operation, Exim is running with the real uid and gid set to
58512 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
58513 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
58514 that is, the real uid/gid should be reset to the effective values so as to
58515 discard any privileges that the caller may have. While some operating systems
58516 have a function that permits this action for a non-root effective uid, quite a
58517 number of them do not. Because of this lack of standardization, Exim does not
58518 address this problem at this time.
58519 </para>
58520 <para>
58521 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
58522 is to keep the Exim binary setuid to root, and to set
58523 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
58524 be used in the most straightforward way.
58525 </para>
58526 <para>
58527 If you configure Exim not to run delivery processes as root, there are a
58528 number of restrictions on what you can do:
58529 </para>
58530 <itemizedlist>
58531 <listitem>
58532 <para>
58533 You can deliver only as the Exim user/group. You should  explicitly use the
58534 <option>user</option> and <option>group</option> options to override routers or local transports that
58535 normally deliver as the recipient. This makes sure that configurations that
58536 work in this mode function the same way in normal mode. Any implicit or
58537 explicit specification of another user causes an error.
58538 </para>
58539 </listitem>
58540 <listitem>
58541 <para>
58542 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
58543 not worthwhile to include them in the configuration.
58544 </para>
58545 </listitem>
58546 <listitem>
58547 <para>
58548 Users who wish to use <filename>.forward</filename> would have to make their home directory and
58549 the file itself accessible to the Exim user. Pipe and append-to-file entries,
58550 and their equivalents in Exim filters, cannot be used. While they could be
58551 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
58552 </para>
58553 </listitem>
58554 <listitem>
58555 <para>
58556 Unless the local user mailboxes are all owned by the Exim user (possible in
58557 some POP3 or IMAP-only environments):
58558 </para>
58559 <orderedlist numeration="arabic">
58560 <listitem>
58561 <para>
58562 They must be owned by the Exim group and be writable by that group. This
58563 implies you must set <option>mode</option> in the appendfile configuration, as well as the
58564 mode of the mailbox files themselves.
58565 </para>
58566 </listitem>
58567 <listitem>
58568 <para>
58569 You must set <option>no_check_owner</option>, since most or all of the files will not be
58570 owned by the Exim user.
58571 </para>
58572 </listitem>
58573 <listitem>
58574 <para>
58575 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
58576 on a newly created mailbox when unprivileged. This also implies that new
58577 mailboxes need to be created manually.
58578 </para>
58579 </listitem>
58580 </orderedlist>
58581 </listitem>
58582 </itemizedlist>
58583 <para>
58584 These restrictions severely restrict what can be done in local deliveries.
58585 However, there are no restrictions on remote deliveries. If you are running a
58586 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
58587 gives more security at essentially no cost.
58588 </para>
58589 <para>
58590 If you are using the <option>mua_wrapper</option> facility (see chapter
58591 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
58592 </para>
58593 </section>
58594 <section>
58595 <title>Delivering to local files</title>
58596 <para>
58597 Full details of the checks applied by <command>appendfile</command> before it writes to a file
58598 are given in chapter <xref linkend="CHAPappendfile"/>.
58599 </para>
58600 </section>
58601 <section>
58602 <title>IPv4 source routing</title>
58603 <para>
58604 <indexterm role="concept">
58605 <primary>source routing</primary>
58606 <secondary>in IP packets</secondary>
58607 </indexterm>
58608 <indexterm role="concept">
58609 <primary>IP source routing</primary>
58610 </indexterm>
58611 Many operating systems suppress IP source-routed packets in the kernel, but
58612 some cannot be made to do this, so Exim does its own check. It logs incoming
58613 IPv4 source-routed TCP calls, and then drops them. Things are all different in
58614 IPv6. No special checking is currently done.
58615 </para>
58616 </section>
58617 <section>
58618 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
58619 <para>
58620 Support for these SMTP commands is disabled by default. If required, they can
58621 be enabled by defining suitable ACLs.
58622 </para>
58623 </section>
58624 <section>
58625 <title>Privileged users</title>
58626 <para>
58627 <indexterm role="concept">
58628 <primary>trusted user</primary>
58629 </indexterm>
58630 <indexterm role="concept">
58631 <primary>admin user</primary>
58632 </indexterm>
58633 <indexterm role="concept">
58634 <primary>privileged user</primary>
58635 </indexterm>
58636 <indexterm role="concept">
58637 <primary>user</primary>
58638 <secondary>trusted</secondary>
58639 </indexterm>
58640 <indexterm role="concept">
58641 <primary>user</primary>
58642 <secondary>admin</secondary>
58643 </indexterm>
58644 Exim recognises two sets of users with special privileges. Trusted users are
58645 able to submit new messages to Exim locally, but supply their own sender
58646 addresses and information about a sending host. For other users submitting
58647 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
58648 permit a remote host to be specified.
58649 </para>
58650 <para>
58651 <indexterm role="concept">
58652 <primary><option>-f</option> option</primary>
58653 </indexterm>
58654 However, an untrusted user is permitted to use the <option>-f</option> command line option
58655 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
58656 message should not cause an error report. This affects the message&#x2019;s envelope,
58657 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
58658 permitted to use specific forms of address with the <option>-f</option> option by setting
58659 the <option>untrusted_set_sender</option> option.
58660 </para>
58661 <para>
58662 Trusted users are used to run processes that receive mail messages from some
58663 other mail domain and pass them on to Exim for delivery either locally, or over
58664 the Internet. Exim trusts a caller that is running as root, as the Exim user,
58665 as any user listed in the <option>trusted_users</option> configuration option, or under any
58666 group listed in the <option>trusted_groups</option> option.
58667 </para>
58668 <para>
58669 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
58670 can freeze or thaw messages, cause them to be returned to their senders, remove
58671 them entirely, or modify them in various ways. In addition, admin users can run
58672 the Exim monitor and see all the information it is capable of providing, which
58673 includes the contents of files on the spool.
58674 </para>
58675 <para>
58676 <indexterm role="concept">
58677 <primary><option>-M</option> option</primary>
58678 </indexterm>
58679 <indexterm role="concept">
58680 <primary><option>-q</option> option</primary>
58681 </indexterm>
58682 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
58683 delivery of messages on its queue is restricted to admin users. This
58684 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
58685 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
58686 queue is also restricted to admin users. This restriction can be relaxed by
58687 setting <option>no_queue_list_requires_admin</option>.
58688 </para>
58689 <para>
58690 Exim recognises an admin user if the calling process is running as root or as
58691 the Exim user or if any of the groups associated with the calling process is
58692 the Exim group. It is not necessary actually to be running under the Exim
58693 group. However, if admin users who are not root or the Exim user are to access
58694 the contents of files on the spool via the Exim monitor (which runs
58695 unprivileged), Exim must be built to allow group read access to its spool
58696 files.
58697 </para>
58698 </section>
58699 <section>
58700 <title>Spool files</title>
58701 <para>
58702 <indexterm role="concept">
58703 <primary>spool directory</primary>
58704 <secondary>files</secondary>
58705 </indexterm>
58706 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
58707 set to the Exim group. The mode for spool files is defined in the
58708 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
58709 any user who is a member of the Exim group can access these files.
58710 </para>
58711 </section>
58712 <section>
58713 <title>Use of argv[0]</title>
58714 <para>
58715 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
58716 of specific strings, Exim assumes certain options. For example, calling Exim
58717 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
58718 to calling it with the option <option>-bS</option>. There are no security implications in
58719 this.
58720 </para>
58721 </section>
58722 <section>
58723 <title>Use of %f formatting</title>
58724 <para>
58725 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
58726 are actually stored in integer variables as 1000 times the load average.
58727 Consequently, their range is limited and so therefore is the length of the
58728 converted output.
58729 </para>
58730 </section>
58731 <section>
58732 <title>Embedded Exim path</title>
58733 <para>
58734 Exim uses its own path name, which is embedded in the code, only when it needs
58735 to re-exec in order to regain root privilege. Therefore, it is not root when it
58736 does so. If some bug allowed the path to get overwritten, it would lead to an
58737 arbitrary program&#x2019;s being run as exim, not as root.
58738 </para>
58739 </section>
58740 <section>
58741 <title>Use of sprintf()</title>
58742 <para>
58743 <indexterm role="concept">
58744 <primary><function>sprintf()</function></primary>
58745 </indexterm>
58746 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
58747 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
58748 The intermediate formatting is done into a large fixed buffer by a function
58749 that runs through the format string itself, and checks the length of each
58750 conversion before performing it, thus preventing buffer overruns.
58751 </para>
58752 <para>
58753 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
58754 the output buffer is known to be sufficiently long to contain the converted
58755 string.
58756 </para>
58757 </section>
58758 <section>
58759 <title>Use of debug_printf() and log_write()</title>
58760 <para>
58761 Arbitrary strings are passed to both these functions, but they do their
58762 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
58763 the format string itself, and checks the length of each conversion.
58764 </para>
58765 </section>
58766 <section>
58767 <title>Use of strcat() and strcpy()</title>
58768 <para>
58769 These are used only in cases where the output buffer is known to be large
58770 enough to hold the result.
58771 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
58772 </para>
58773 </section>
58774 </chapter>
58775
58776 <chapter id="CHAPspool">
58777 <title>Format of spool files</title>
58778 <para>
58779 <indexterm role="concept" id="IIDforspo1" class="startofrange">
58780 <primary>format</primary>
58781 <secondary>spool files</secondary>
58782 </indexterm>
58783 <indexterm role="concept" id="IIDforspo2" class="startofrange">
58784 <primary>spool directory</primary>
58785 <secondary>format of files</secondary>
58786 </indexterm>
58787 <indexterm role="concept" id="IIDforspo3" class="startofrange">
58788 <primary>spool files</primary>
58789 <secondary>format of</secondary>
58790 </indexterm>
58791 <indexterm role="concept">
58792 <primary>spool files</primary>
58793 <secondary>editing</secondary>
58794 </indexterm>
58795 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
58796 followed by -D and -H, respectively. The data portion of the message is kept in
58797 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
58798 kept in the -H file, whose format is described in this chapter. Each of these
58799 two files contains the final component of its own name as its first line. This
58800 is insurance against disk crashes where the directory is lost but the files
58801 themselves are recoverable.
58802 </para>
58803 <para>
58804 Some people are tempted into editing -D files in order to modify messages. You
58805 need to be extremely careful if you do this; it is not recommended and you are
58806 on your own if you do it. Here are some of the pitfalls:
58807 </para>
58808 <itemizedlist>
58809 <listitem>
58810 <para>
58811 You must ensure that Exim does not try to deliver the message while you are
58812 fiddling with it. The safest way is to take out a write lock on the -D file,
58813 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
58814 place, the lock will be retained. If you write a new file and rename it, the
58815 lock will be lost at the instant of rename.
58816 </para>
58817 </listitem>
58818 <listitem>
58819 <para>
58820 <indexterm role="concept">
58821 <primary><varname>$body_linecount</varname></primary>
58822 </indexterm>
58823 If you change the number of lines in the file, the value of
58824 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect. At
58825 present, this value is not used by Exim, but there is no guarantee that this
58826 will always be the case.
58827 </para>
58828 </listitem>
58829 <listitem>
58830 <para>
58831 If the message is in MIME format, you must take care not to break it.
58832 </para>
58833 </listitem>
58834 <listitem>
58835 <para>
58836 If the message is cryptographically signed, any change will invalidate the
58837 signature.
58838 </para>
58839 </listitem>
58840 </itemizedlist>
58841 <para>
58842 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
58843 its subdirectories when <option>split_spool_directory</option> is set). These are journal
58844 files, used to record addresses to which the message has been delivered during
58845 the course of a delivery run. At the end of the run, the -H file is updated,
58846 and the -J file is deleted.
58847 </para>
58848 <section>
58849 <title>Format of the -H file</title>
58850 <para>
58851 <indexterm role="concept">
58852 <primary>uid (user id)</primary>
58853 <secondary>in spool file</secondary>
58854 </indexterm>
58855 <indexterm role="concept">
58856 <primary>gid (group id)</primary>
58857 <secondary>in spool file</secondary>
58858 </indexterm>
58859 The second line of the -H file contains the login name for the uid of the
58860 process that called Exim to read the message, followed by the numerical uid and
58861 gid. For a locally generated message, this is normally the user who sent the
58862 message. For a message received over TCP/IP, it is normally the Exim user.
58863 </para>
58864 <para>
58865 The third line of the file contains the address of the message&#x2019;s sender as
58866 transmitted in the envelope, contained in angle brackets. The sender address is
58867 empty for bounce messages. For incoming SMTP mail, the sender address is given
58868 in the MAIL command. For locally generated mail, the sender address is
58869 created by Exim from the login name of the current user and the configured
58870 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
58871 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
58872 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
58873 </para>
58874 <para>
58875 The fourth line contains two numbers. The first is the time that the message
58876 was received, in the conventional Unix form &ndash; the number of seconds since the
58877 start of the epoch. The second number is a count of the number of messages
58878 warning of delayed delivery that have been sent to the sender.
58879 </para>
58880 <para>
58881 There follow a number of lines starting with a hyphen. These can appear in any
58882 order, and are omitted when not relevant:
58883 </para>
58884 <variablelist>
58885 <varlistentry>
58886 <term><option>-acl</option> &lt;<emphasis>number</emphasis>&gt; &lt;<emphasis>length</emphasis>&gt;</term>
58887 <listitem>
58888 <para>
58889 This item is obsolete, and is not generated from Exim release 4.61 onwards;
58890 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
58891 recognized, to provide backward compatibility. In the old format, a line of
58892 this form is present for every ACL variable that is not empty. The number
58893 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
58894 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
58895 the data string for the variable. The string itself starts at the beginning of
58896 the next line, and is followed by a newline character. It may contain internal
58897 newlines.
58898 </para>
58899 </listitem></varlistentry>
58900 <varlistentry>
58901 <term><option>-aclc</option> &lt;<emphasis>number</emphasis>&gt; &lt;<emphasis>length</emphasis>&gt;</term>
58902 <listitem>
58903 <para>
58904 A line of this form is present for every ACL connection variable that is not
58905 empty. The number identifies the variable. The length is the length of the data
58906 string for the variable. The string itself starts at the beginning of the next
58907 line, and is followed by a newline character. It may contain internal newlines.
58908 </para>
58909 </listitem></varlistentry>
58910 <varlistentry>
58911 <term><option>-aclm</option> &lt;<emphasis>number</emphasis>&gt; &lt;<emphasis>length</emphasis>&gt;</term>
58912 <listitem>
58913 <para>
58914 A line of this form is present for every ACL message variable that is not
58915 empty. The number identifies the variable. The length is the length of the data
58916 string for the variable. The string itself starts at the beginning of the next
58917 line, and is followed by a newline character. It may contain internal newlines.
58918 </para>
58919 </listitem></varlistentry>
58920 <varlistentry>
58921 <term><option>-active_hostname</option> &lt;<emphasis>hostname</emphasis>&gt;</term>
58922 <listitem>
58923 <para>
58924 This is present if, when the message was received over SMTP, the value of
58925 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
58926 </para>
58927 </listitem></varlistentry>
58928 <varlistentry>
58929 <term><option>-allow_unqualified_recipient</option></term>
58930 <listitem>
58931 <para>
58932 This is present if unqualified recipient addresses are permitted in header
58933 lines (to stop such addresses from being qualified if rewriting occurs at
58934 transport time). Local messages that were input using <option>-bnq</option> and remote
58935 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
58936 </para>
58937 </listitem></varlistentry>
58938 <varlistentry>
58939 <term><option>-allow_unqualified_sender</option></term>
58940 <listitem>
58941 <para>
58942 This is present if unqualified sender addresses are permitted in header lines
58943 (to stop such addresses from being qualified if rewriting occurs at transport
58944 time). Local messages that were input using <option>-bnq</option> and remote messages from
58945 hosts that match <option>sender_unqualified_hosts</option> set this flag.
58946 </para>
58947 </listitem></varlistentry>
58948 <varlistentry>
58949 <term><option>-auth_id</option> &lt;<emphasis>text</emphasis>&gt;</term>
58950 <listitem>
58951 <para>
58952 The id information for a message received on an authenticated SMTP connection
58953 &ndash; the value of the <varname>$authenticated_id</varname> variable.
58954 </para>
58955 </listitem></varlistentry>
58956 <varlistentry>
58957 <term><option>-auth_sender</option> &lt;<emphasis>address</emphasis>&gt;</term>
58958 <listitem>
58959 <para>
58960 The address of an authenticated sender &ndash; the value of the
58961 <varname>$authenticated_sender</varname> variable.
58962 </para>
58963 </listitem></varlistentry>
58964 <varlistentry>
58965 <term><option>-body_linecount</option> &lt;<emphasis>number</emphasis>&gt;</term>
58966 <listitem>
58967 <para>
58968 This records the number of lines in the body of the message, and is always
58969 present.
58970 </para>
58971 </listitem></varlistentry>
58972 <varlistentry>
58973 <term><option>-body_zerocount</option> &lt;<emphasis>number</emphasis>&gt;</term>
58974 <listitem>
58975 <para>
58976 This records the number of binary zero bytes in the body of the message, and is
58977 present if the number is greater than zero.
58978 </para>
58979 </listitem></varlistentry>
58980 <varlistentry>
58981 <term><option>-deliver_firsttime</option></term>
58982 <listitem>
58983 <para>
58984 This is written when a new message is first added to the spool. When the spool
58985 file is updated after a deferral, it is omitted.
58986 </para>
58987 </listitem></varlistentry>
58988 <varlistentry>
58989 <term><option>-frozen</option> &lt;<emphasis>time</emphasis>&gt;</term>
58990 <listitem>
58991 <para>
58992 <indexterm role="concept">
58993 <primary>frozen messages</primary>
58994 <secondary>spool data</secondary>
58995 </indexterm>
58996 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
58997 </para>
58998 </listitem></varlistentry>
58999 <varlistentry>
59000 <term><option>-helo_name</option> &lt;<emphasis>text</emphasis>&gt;</term>
59001 <listitem>
59002 <para>
59003 This records the host name as specified by a remote host in a HELO or EHLO
59004 command.
59005 </para>
59006 </listitem></varlistentry>
59007 <varlistentry>
59008 <term><option>-host_address</option> &lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
59009 <listitem>
59010 <para>
59011 This records the IP address of the host from which the message was received and
59012 the remote port number that was used. It is omitted for locally generated
59013 messages.
59014 </para>
59015 </listitem></varlistentry>
59016 <varlistentry>
59017 <term><option>-host_auth</option> &lt;<emphasis>text</emphasis>&gt;</term>
59018 <listitem>
59019 <para>
59020 If the message was received on an authenticated SMTP connection, this records
59021 the name of the authenticator &ndash; the value of the
59022 <varname>$sender_host_authenticated</varname> variable.
59023 </para>
59024 </listitem></varlistentry>
59025 <varlistentry>
59026 <term><option>-host_lookup_failed</option></term>
59027 <listitem>
59028 <para>
59029 This is present if an attempt to look up the sending host&#x2019;s name from its IP
59030 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
59031 </para>
59032 </listitem></varlistentry>
59033 <varlistentry>
59034 <term><option>-host_name</option> &lt;<emphasis>text</emphasis>&gt;</term>
59035 <listitem>
59036 <para>
59037 <indexterm role="concept">
59038 <primary>reverse DNS lookup</primary>
59039 </indexterm>
59040 <indexterm role="concept">
59041 <primary>DNS</primary>
59042 <secondary>reverse lookup</secondary>
59043 </indexterm>
59044 This records the name of the remote host from which the message was received,
59045 if the host name was looked up from the IP address when the message was being
59046 received. It is not present if no reverse lookup was done.
59047 </para>
59048 </listitem></varlistentry>
59049 <varlistentry>
59050 <term><option>-ident</option> &lt;<emphasis>text</emphasis>&gt;</term>
59051 <listitem>
59052 <para>
59053 For locally submitted messages, this records the login of the originating user,
59054 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
59055 ident value. For messages received over TCP/IP, this records the ident string
59056 supplied by the remote host, if any.
59057 </para>
59058 </listitem></varlistentry>
59059 <varlistentry>
59060 <term><option>-interface_address</option> &lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
59061 <listitem>
59062 <para>
59063 This records the IP address of the local interface and the port number through
59064 which a message was received from a remote host. It is omitted for locally
59065 generated messages.
59066 </para>
59067 </listitem></varlistentry>
59068 <varlistentry>
59069 <term><option>-local</option></term>
59070 <listitem>
59071 <para>
59072 The message is from a local sender.
59073 </para>
59074 </listitem></varlistentry>
59075 <varlistentry>
59076 <term><option>-localerror</option></term>
59077 <listitem>
59078 <para>
59079 The message is a locally-generated bounce message.
59080 </para>
59081 </listitem></varlistentry>
59082 <varlistentry>
59083 <term><option>-local_scan</option> &lt;<emphasis>string</emphasis>&gt;</term>
59084 <listitem>
59085 <para>
59086 This records the data string that was returned by the <function>local_scan()</function> function
59087 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
59088 variable. It is omitted if no data was returned.
59089 </para>
59090 </listitem></varlistentry>
59091 <varlistentry>
59092 <term><option>-manual_thaw</option></term>
59093 <listitem>
59094 <para>
59095 The message was frozen but has been thawed manually, that is, by an explicit
59096 Exim command rather than via the auto-thaw process.
59097 </para>
59098 </listitem></varlistentry>
59099 <varlistentry>
59100 <term><option>-N</option></term>
59101 <listitem>
59102 <para>
59103 A testing delivery process was started using the <option>-N</option> option to suppress any
59104 actual deliveries, but delivery was deferred. At any further delivery attempts,
59105 <option>-N</option> is assumed.
59106 </para>
59107 </listitem></varlistentry>
59108 <varlistentry>
59109 <term><option>-received_protocol</option></term>
59110 <listitem>
59111 <para>
59112 This records the value of the <varname>$received_protocol</varname> variable, which contains
59113 the name of the protocol by which the message was received.
59114 </para>
59115 </listitem></varlistentry>
59116 <varlistentry>
59117 <term><option>-sender_set_untrusted</option></term>
59118 <listitem>
59119 <para>
59120 The envelope sender of this message was set by an untrusted local caller (used
59121 to ensure that the caller is displayed in queue listings).
59122 </para>
59123 </listitem></varlistentry>
59124 <varlistentry>
59125 <term><option>-spam_score_int</option> &lt;<emphasis>number</emphasis>&gt;</term>
59126 <listitem>
59127 <para>
59128 If a message was scanned by SpamAssassin, this is present. It records the value
59129 of <varname>$spam_score_int</varname>.
59130 </para>
59131 </listitem></varlistentry>
59132 <varlistentry>
59133 <term><option>-tls_certificate_verified</option></term>
59134 <listitem>
59135 <para>
59136 A TLS certificate was received from the client that sent this message, and the
59137 certificate was verified by the server.
59138 </para>
59139 </listitem></varlistentry>
59140 <varlistentry>
59141 <term><option>-tls_cipher</option> &lt;<emphasis>cipher name</emphasis>&gt;</term>
59142 <listitem>
59143 <para>
59144 When the message was received over an encrypted connection, this records the
59145 name of the cipher suite that was used.
59146 </para>
59147 </listitem></varlistentry>
59148 <varlistentry>
59149 <term><option>-tls_peerdn</option> &lt;<emphasis>peer DN</emphasis>&gt;</term>
59150 <listitem>
59151 <para>
59152 When the message was received over an encrypted connection, and a certificate
59153 was received from the client, this records the Distinguished Name from that
59154 certificate.
59155 </para>
59156 </listitem></varlistentry>
59157 </variablelist>
59158 <para>
59159 Following the options there is a list of those addresses to which the message
59160 is not to be delivered. This set of addresses is initialized from the command
59161 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
59162 is set; otherwise it starts out empty. Whenever a successful delivery is made,
59163 the address is added to this set. The addresses are kept internally as a
59164 balanced binary tree, and it is a representation of that tree which is written
59165 to the spool file. If an address is expanded via an alias or forward file, the
59166 original address is added to the tree when deliveries to all its child
59167 addresses are complete.
59168 </para>
59169 <para>
59170 If the tree is empty, there is a single line in the spool file containing just
59171 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
59172 Y or N, followed by an address. The address is the value for the node of the
59173 tree, and the letters indicate whether the node has a left branch and/or a
59174 right branch attached to it, respectively. If branches exist, they immediately
59175 follow. Here is an example of a three-node tree:
59176 </para>
59177 <literallayout class="monospaced">
59178 YY darcy@austen.fict.example
59179 NN alice@wonderland.fict.example
59180 NN editor@thesaurus.ref.example
59181 </literallayout>
59182 <para>
59183 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
59184 This is a simple list, preceded by a count. It includes all the original
59185 recipients of the message, including those to whom the message has already been
59186 delivered. In the simplest case, the list contains one address per line. For
59187 example:
59188 </para>
59189 <literallayout class="monospaced">
59190 4
59191 editor@thesaurus.ref.example
59192 darcy@austen.fict.example
59193 rdo@foundation
59194 alice@wonderland.fict.example
59195 </literallayout>
59196 <para>
59197 However, when a child address has been added to the top-level addresses as a
59198 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
59199 line is of the following form:
59200 </para>
59201 <literallayout>
59202 &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;
59203 </literallayout>
59204 <para>
59205 The 01 flag bit indicates the presence of the three other fields that follow
59206 the top-level address. Other bits may be used in future to support additional
59207 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
59208 original parent of the <quote>one time</quote> address. The first two fields are the
59209 envelope sender that is associated with this address and its length. If the
59210 length is zero, there is no special envelope sender (there are then two space
59211 characters in the line). A non-empty field can arise from a <command>redirect</command> router
59212 that has an <option>errors_to</option> setting.
59213 </para>
59214 <para>
59215 A blank line separates the envelope and status information from the headers
59216 which follow. A header may occupy several lines of the file, and to save effort
59217 when reading it in, each header is preceded by a number and an identifying
59218 character. The number is the number of characters in the header, including any
59219 embedded newlines and the terminating newline. The character is one of the
59220 following:
59221 </para>
59222 <informaltable frame="none">
59223 <tgroup cols="2" colsep="0" rowsep="0">
59224 <colspec colwidth="50pt" align="left"/>
59225 <colspec colwidth="254pt" align="left"/>
59226 <tbody>
59227 <row>
59228 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
59229 <entry>header in which Exim has no special interest</entry>
59230 </row>
59231 <row>
59232 <entry><literal>B</literal></entry>
59233 <entry><emphasis>Bcc:</emphasis> header</entry>
59234 </row>
59235 <row>
59236 <entry><literal>C</literal></entry>
59237 <entry><emphasis>Cc:</emphasis> header</entry>
59238 </row>
59239 <row>
59240 <entry><literal>F</literal></entry>
59241 <entry><emphasis>From:</emphasis> header</entry>
59242 </row>
59243 <row>
59244 <entry><literal>I</literal></entry>
59245 <entry><emphasis>Message-id:</emphasis> header</entry>
59246 </row>
59247 <row>
59248 <entry><literal>P</literal></entry>
59249 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
59250 </row>
59251 <row>
59252 <entry><literal>R</literal></entry>
59253 <entry><emphasis>Reply-To:</emphasis> header</entry>
59254 </row>
59255 <row>
59256 <entry><literal>S</literal></entry>
59257 <entry><emphasis>Sender:</emphasis> header</entry>
59258 </row>
59259 <row>
59260 <entry><literal>T</literal></entry>
59261 <entry><emphasis>To:</emphasis> header</entry>
59262 </row>
59263 <row>
59264 <entry><literal>*</literal></entry>
59265 <entry>replaced or deleted header</entry>
59266 </row>
59267 </tbody>
59268 </tgroup>
59269 </informaltable>
59270 <para>
59271 Deleted or replaced (rewritten) headers remain in the spool file for debugging
59272 purposes. They are not transmitted when the message is delivered. Here is a
59273 typical set of headers:
59274 </para>
59275 <literallayout class="monospaced">
59276 111P Received: by hobbit.fict.example with local (Exim 4.00)
59277 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
59278 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
59279 038* X-rewrote-sender: bb@hobbit.fict.example
59280 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
59281 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
59282 099* To: alice@wonderland.fict.example, rdo@foundation,
59283 darcy@austen.fict.example, editor@thesaurus.ref.example
59284 104T To: alice@wonderland.fict.example, rdo@foundation.example,
59285 darcy@austen.fict.example, editor@thesaurus.ref.example
59286 038  Date: Fri, 11 May 2001 10:28:59 +0100
59287 </literallayout>
59288 <para>
59289 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
59290 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
59291 unqualified domain <emphasis>foundation</emphasis>.
59292 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
59293 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
59294 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
59295 </para>
59296 </section>
59297 </chapter>
59298
59299 <chapter>
59300 <title>Adding new drivers or lookup types</title>
59301 <titleabbrev>Adding drivers or lookups</titleabbrev>
59302 <para>
59303 <indexterm role="concept">
59304 <primary>adding drivers</primary>
59305 </indexterm>
59306 <indexterm role="concept">
59307 <primary>new drivers</primary>
59308 <secondary>adding</secondary>
59309 </indexterm>
59310 <indexterm role="concept">
59311 <primary>drivers</primary>
59312 <secondary>adding new</secondary>
59313 </indexterm>
59314 The following actions have to be taken in order to add a new router, transport,
59315 authenticator, or lookup type to Exim:
59316 </para>
59317 <orderedlist numeration="arabic">
59318 <listitem>
59319 <para>
59320 Choose a name for the driver or lookup type that does not conflict with any
59321 existing name; I will use <quote>newdriver</quote> in what follows.
59322 </para>
59323 </listitem>
59324 <listitem>
59325 <para>
59326 Add to <filename>src/EDITME</filename> the line:
59327 </para>
59328 <literallayout>
59329 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
59330 </literallayout>
59331 <para>
59332 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
59333 code is not to be included in the binary by default, comment this line out. You
59334 should also add any relevant comments about the driver or lookup type.
59335 </para>
59336 </listitem>
59337 <listitem>
59338 <para>
59339 Add to <filename>src/config.h.defaults</filename> the line:
59340 </para>
59341 <literallayout class="monospaced">
59342 #define &lt;type&gt;_NEWDRIVER
59343 </literallayout>
59344 </listitem>
59345 <listitem>
59346 <para>
59347 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
59348 and create a table entry as is done for all the other drivers and lookup types.
59349 </para>
59350 </listitem>
59351 <listitem>
59352 <para>
59353 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
59354 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
59355 driver or lookup type and add it to the definition of OBJ.
59356 </para>
59357 </listitem>
59358 <listitem>
59359 <para>
59360 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
59361 <filename>src</filename>.
59362 </para>
59363 </listitem>
59364 <listitem>
59365 <para>
59366 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
59367 as for other drivers and lookups.
59368 </para>
59369 </listitem>
59370 </orderedlist>
59371 <para>
59372 Then all you need to do is write the code! A good way to start is to make a
59373 proforma by copying an existing module of the same type, globally changing all
59374 occurrences of the name, and cutting out most of the code. Note that any
59375 options you create must be listed in alphabetical order, because the tables are
59376 searched using a binary chop procedure.
59377 </para>
59378 <para>
59379 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
59380 the interface that is expected.
59381 </para>
59382 </chapter>
59383
59384 <index role="option">
59385 <title>Option index</title>
59386 </index>
59387
59388 <index role="concept">
59389 <title>Concept index</title>
59390 </index>
59391
59392 </book>